From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/82796 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: \define with more than 9 parameters?? Date: Thu, 6 Jun 2013 16:36:24 +0200 Message-ID: References: <51B040B0.70905@gyza.cz> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1370529410 23750 80.91.229.3 (6 Jun 2013 14:36:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Jun 2013 14:36:50 +0000 (UTC) To: hajtmar@gyza.cz, mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Jun 06 16:36:51 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UkbJ3-0002qn-S8 for gctc-ntg-context-518@m.gmane.org; Thu, 06 Jun 2013 16:36:49 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 57B35101E9; Thu, 6 Jun 2013 16:36:49 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IIDw7TMjKmys; Thu, 6 Jun 2013 16:36:43 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id C63DE101E5; Thu, 6 Jun 2013 16:36:43 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 13913101E5 for ; Thu, 6 Jun 2013 16:36:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id HtK105qazrlI for ; Thu, 6 Jun 2013 16:36:37 +0200 (CEST) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id 60775101E0 for ; Thu, 6 Jun 2013 16:36:27 +0200 (CEST) Original-Received: from mail-ea0-x22d.google.com (mail-ea0-x22d.google.com [IPv6:2a00:1450:4013:c01::22d]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r56EaQNv022046 for ; Thu, 6 Jun 2013 16:36:26 +0200 Original-Received: by mail-ea0-f173.google.com with SMTP id g15so2603866eak.18 for ; Thu, 06 Jun 2013 07:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=sOnK6V8Jxc6RPC81Ung6p9LbPl2V7FeJi/e4c4ZCCMw=; b=Qywpfp1xpUFy42HG6Y6rCi8aIw8PxKh4qEB2cDsHox8WPOWfwisqDeLroUfBS0lZBd FQXOmxbM7eVn7mxriLHZZ1X6MIjI61kH7bwsshaqdumZfhAR8T/HVQD7zHv9HbKsSyCq WkbYXQ5BaNRQ3R8EZ/I2xi5Q7NWO74yycCEZR3ZMIpD0bYuonvFwhzGkTgNTt4eE82r+ EzZz65j4rIvkcN7gXgUiaCrrApReyG1lJnyoIBOV2Ob3gukIH+KQ7Ml6oMflkEjGjKcm Rjrd2YGgh3AQelTvZQ7O411q593pqQdu7tJMnmHoeoT91+/hzqaR6wMgeiwf6fKJ/AUU CEGQ== X-Received: by 10.14.208.131 with SMTP id q3mr34622018eeo.111.1370529383575; Thu, 06 Jun 2013 07:36:23 -0700 (PDT) Original-Received: from keima.localdomain (nrbg-4d0726a0.pool.mediaWays.net. [77.7.38.160]) by mx.google.com with ESMTPSA id s8sm106419582eeo.4.2013.06.06.07.36.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Jun 2013 07:36:22 -0700 (PDT) In-Reply-To: <51B040B0.70905@gyza.cz> X-Mailer: Apple Mail (2.1508) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=2a00:1450:4013:c01::22d; country=IE X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 03JJ2AqvR - d1964c3e27e3 - 20130606 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:82796 Archived-At: Am 06.06.2013 um 09:56 schrieb Jaroslav Hajtmar : > Hello ConTeXist. > Is there in ConTeXt any dirty trick, which can put more than 9 parameters= into macro? > = > I mean for example \define[25]\macrowithtwentyfiveparams{ .... } There are a few tricks when you need more then nine parameters but it=92s better to use a different method to pass argument from one command to another. Better and more readable solutions are intermediate commands for each value or assignment lists (a=3Dx,b=3Dy,=85). > I use rarely any trick from Peter Olsak (see below) and I'd like somethin= g like that used in ConTeXt. > = > Thanx > Jaroslav Hajtmar > = > Here is minimal example of trick of Petr Olsak: > = > \newcount\tempnum > \def\terminator{*} > \newcount\tempnum > \def\readparameters{\tempnum=3D0\let\next=3D\readone \next} > \def\readone #1,{\advance\tempnum by 1 \def\param{#1}% > %\the\tempnum - \param\par% > \ifx\param\terminator \let\next=3D\relax > \else\expandafter\gdef\csname param\the\tempnum\endcsname{#1}% > \fi\next} > = > = > \def\moreparameters#1{% > \readparameters #1 % > \csname param1\endcsname, % write first parameter > \csname param3\endcsname, % write third parameter > \csname param5\endcsname, % write fifth parameter > } > = > = > \starttext > = > %\readparameters a,b,c,d,e,f,g,h,i,j,k,m,n,o,*, % > %\def\parameters{aaa,bbbb,cccc,dddd,eeeee,fffff,ggggg,*,} > %\expandafter\readparameters\parameters > = > \moreparameters{a,b,c,d,e,f,g,h,i,j,k,m,n,o,*,} > = > \stoptext Can be simplified with \processcommalist: \starttext \def\domoreparameters#1% {\advance\scratchcounter\plusone \setvalue{param\number\scratchcounter}{#1}} \def\moreparameters[#1]% {\scratchcounter\zerocount \processcommalist[#1]\domoreparameters} \moreparameters[a,b,c,d,e,f,g,h,i,j,k,m,n,o] \getvalue{param1}, \getvalue{param2}, \getvalue{param3} \stoptext Wolfgang ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________