From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/23952 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: 'empty string' test in MP Date: Wed, 30 Nov 2005 09:51:24 +0100 Message-ID: <438D680C.7070204@wxs.nl> References: <438CC79D.3070906@gmx.net> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1133344369 7630 80.91.229.2 (30 Nov 2005 09:52:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 30 Nov 2005 09:52:49 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Wed Nov 30 10:52:27 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 1EhNgY-0006gz-D2 for gctc-ntg-context-518@m.gmane.org; Wed, 30 Nov 2005 09:51:33 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 2A0FF1283A; Wed, 30 Nov 2005 09:51:30 +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 02856-05-3; Wed, 30 Nov 2005 09:51:27 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id F2AA112828; Wed, 30 Nov 2005 09:51:26 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 05B0412828 for ; Wed, 30 Nov 2005 09:51:26 +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 02856-05-2 for ; Wed, 30 Nov 2005 09:51:25 +0100 (CET) Original-Received: from controller-1 (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by ronja.ntg.nl (Postfix) with ESMTP id 1649212816 for ; Wed, 30 Nov 2005 09:51:25 +0100 (CET) Original-Received: from [10.100.1.102] (unverified [10.100.1.102]) by controller-1 (SurgeMail 3.5b3) with ESMTP id 5656 for ; Wed, 30 Nov 2005 09:56:28 +0300 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: <438CC79D.3070906@gmx.net> X-Server: High Performance Mail Server - http://surgemail.com r=-274017400 X-Authenticated-User: hagen@controller-1 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:23952 Archived-At: 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) 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