From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/23957 Path: news.gmane.org!not-for-mail From: Peter Rolf Newsgroups: gmane.comp.tex.context Subject: Re: 'empty string' test in MP Date: Wed, 30 Nov 2005 13:36:59 +0100 Message-ID: <438D9CEB.9000303@gmx.net> References: <438CC79D.3070906@gmx.net> <438D680C.7070204@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1133357921 12766 80.91.229.2 (30 Nov 2005 13:38:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 30 Nov 2005 13:38:41 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Wed Nov 30 14:38:36 2005 Return-path: Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1EhRDR-00058I-CK for gctc-ntg-context-518@m.gmane.org; Wed, 30 Nov 2005 13:38:16 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 458E712835; Wed, 30 Nov 2005 13:37:39 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 04562-02; Wed, 30 Nov 2005 13:37:33 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 95C961282D; Wed, 30 Nov 2005 13:37:33 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 41D6F1282C for ; Wed, 30 Nov 2005 13:37:32 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 04561-02 for ; Wed, 30 Nov 2005 13:37:31 +0100 (CET) Original-Received: from mail.gmx.net (mail.gmx.net [213.165.64.21]) by ronja.ntg.nl (Postfix) with SMTP id 393B01282B for ; Wed, 30 Nov 2005 13:37:30 +0100 (CET) Original-Received: (qmail invoked by alias); 30 Nov 2005 12:37:30 -0000 Original-Received: from i577B9B0E.versanet.de (EHLO [192.168.0.3]) [87.123.155.14] by mail.gmx.net (mp010) with SMTP; 30 Nov 2005 13:37:30 +0100 X-Authenticated: #24293357 User-Agent: Thunderbird 1.5 (Windows/20051025) Original-To: mailing list for ConTeXt users In-Reply-To: <438D680C.7070204@wxs.nl> X-Enigmail-Version: 0.93.0.0 X-Y-GMX-Trusted: 0 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:23957 Archived-At: Hans Hagen wrote: > Peter Rolf wrote: > >> Hi all, >> >> I pass a string to a MP graphic using \setMPtext{LABEL}{TEXT}. The >> string can also be empty, and then no action (for the text) is taken. >> How can I test in MP, if the given \MPstring{LABEL} is empty? >> >> I have tried everything I can imagine in the last one hour, but no >> success. Not my day... >> >> This is the old, not working version >> >> if not(\MPstring{LABEL}="") : % is always true. >> >> >> > unless to set it to nothign (currently you don't assign it at all) > yes and no. I had an older macro \XXmacro[#1]#2{% ... \ifsecondargument\setMPtext{XX}{\SomeFontsettings\strut#2}\else\setMPtext{XX}{}\fi which is naturally always true. I replaced it with a \doiftextelse and now everything is working as expected. Thanks for the enlightenment and the nice example :) Peter > take this: > > \setupcolors[state=start] > > \starttext > > \startuseMPgraphic{test} > fill fullcircle > scaled 1cm > withcolor if not(\MPstring{XX}="") : red else : green fi ; > \stopuseMPgraphic > > \useMPgraphic{test} \start \setMPtext{XX}{} \useMPgraphic{test} \stop > > \unprotect > > \def\MPtext #1{\executeifdefined{\@@MPT#1}\empty} > \def\MPstring #1{"\executeifdefined{\@@MPT#1}\empty"} > \def\MPbetex #1{btex \executeifdefined{\@@MPT#1}\empty etex} > > \protect > > \useMPgraphic{test} \start \setMPtext{XX}{} \useMPgraphic{test} \stop > > \stoptext > > the current definitions return "\relax" when a text is not defined; i'll > change the definitions > > Hans > _______________________________________________ > ntg-context mailing list > ntg-context@ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context > >