From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/100041 Path: news.gmane.org!.POSTED!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: Testing value of a \def Date: Thu, 08 Feb 2018 11:06:29 +0100 Message-ID: <5A7C2125.2070103@gmail.com> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5895308668170586051==" X-Trace: blaine.gmane.org 1518084339 17248 195.159.176.226 (8 Feb 2018 10:05:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 8 Feb 2018 10:05:39 +0000 (UTC) User-Agent: Postbox 5.0.22 (Macintosh/20171208) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Feb 08 11:05:35 2018 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejj51-0003aT-OG for gctc-ntg-context-518@m.gmane.org; Thu, 08 Feb 2018 11:05:23 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 68D2A42998D; Thu, 8 Feb 2018 11:07:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8XpyYofGq6LU; Thu, 8 Feb 2018 11:06:58 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 3F172429999; Thu, 8 Feb 2018 11:06:58 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 39EFE429999 for ; Thu, 8 Feb 2018 11:06:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id F_qDE32c912D for ; Thu, 8 Feb 2018 11:06:42 +0100 (CET) Original-Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com [209.85.128.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 947A442998D for ; Thu, 8 Feb 2018 11:06:32 +0100 (CET) Original-Received: by mail-wr0-f175.google.com with SMTP id a43so4032945wrc.4 for ; Thu, 08 Feb 2018 02:06:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to; bh=UDIN9nz7afHMryhwgSDJsgZHhCyAbZNNjTiS8H84tSo=; b=Lzv04L7ekA4+kEEb0BgDMX6km6/KauGDMw2QuIKf1GK9mEbRxPK9xXlwH2dptoNzqc CqbZRxJeaMAuQCUxwwRIZlWjXCaWHC/O5sYQRedqCexqEa2A9NvWaabFhsBrRK50q+Hv YViiT/WmgZeRL3IxEf/YuRwO/kgv8HrdCoT+qg/AKqI9/P74Z+6sZld4h1OU8r6Q62YL l9UBgLVn3ZGdR7fu/om6Zyt/hx+3FrDV9iYXZLtlRxBHTc3my8YwWK4BzCRsaKdvBPd2 VmUP+nV9w1eX3btE4CcFhqSqJTOjnt7ZU1A25exi6FEhysTkpGr+lK6ku1owP/IaUl+4 U+Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to; bh=UDIN9nz7afHMryhwgSDJsgZHhCyAbZNNjTiS8H84tSo=; b=Fgp53Gpnursrx+rsPoQ7PffSqOMyRNjW88dP56vWO8B3dTRkBl/oUcOmDiEb+zcZtI SfGFpm1xK+yrYTTCmYoEXTQK997dKLC8idwRQRrl822+XovoiFoor02bqG5y4UOmebXo NiEhdsoF5X5KhWN7K1j6COXpDWcXbwufC2cvH9Uqvw13LLZaaFKV9OSjdhc5TwWut0hq zvLRmlX5xEIjz4/TnXdvAIYzx4miAIaJ1doINAMWDZzFfPmuHEgbCdnTM26XwKqIbnze Vgy+bJnyxDZ15G/tOgrJu0MDlNAi/xNNX8j9vT0qP5sjLcShtLHu2h+o9ckaumzgYtKM jyew== X-Gm-Message-State: APf1xPAMaPKmD9/OCkdM6tnfcEB0paABdLYfWoUBKRkbj0/bBZrd5bjh Ee+f4YODlgN95zJNxx4GEv6ibddT X-Google-Smtp-Source: AH8x225NZ6ok0KIrX2opgZXfKyAScO0/pF7cf8hH1ebl1jewatHfznd0vnAYCcqiHUsXO88MeRLTJA== X-Received: by 10.223.143.83 with SMTP id p77mr152145wrb.81.1518084391781; Thu, 08 Feb 2018 02:06:31 -0800 (PST) Original-Received: from [192.168.1.11] (x4e305950.dyn.telefonica.de. [78.48.89.80]) by smtp.gmail.com with ESMTPSA id q195sm5382158wmb.33.2018.02.08.02.06.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 02:06:31 -0800 (PST) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 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" Xref: news.gmane.org gmane.comp.tex.context:100041 Archived-At: This is a multi-part message in MIME format. --===============5895308668170586051== Content-Type: multipart/alternative; boundary="------------090702000207030509080809" This is a multi-part message in MIME format. --------------090702000207030509080809 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit > Procházka Lukáš Ing. > 8. Februar 2018 um 10:50 > Hello, > > I'm trying to test whether value of \jobname is "Test"; I suppose it > should be as the file name is "Test.mkiv". > > But the code: > > ---- > \starttext > \jobname > \doifelse{\jobname}{Test}{Yes}{No} > \def\T{Test} > \ifx\jobname\T True\else False\fi > \ctxcommand{doifelse("\jobname" == "Test")}{1}{0} > \stoptext > ---- > > yields "No", "False" and "1", so only the printed "1" is what I expect. > > Why \doifelse and \ifx are evaluated as false? The string from \jobname consists of catcode 12 letters while normal text consists of catcode 11 letters. If you need the name of the file use one of the commands below. \starttext \starttabulate \NC \tex{jobfilefullname} \NC \jobfilefullname \NC\NR \NC \tex{jobfilename} \NC \jobfilename \NC\NR \NC \tex{jobfilesuffix} \NC \jobfilesuffix \NC\NR \TB \NC \tex{inputfilebarename} \NC \inputfilebarename \NC\NR \NC \tex{inputfilerealsuffix} \NC \inputfilerealsuffix \NC\NR \NC \tex{inputfilesuffix} \NC \inputfilesuffix \NC\NR \NC \tex{inputfilename} \NC \inputfilename \NC\NR \stoptabulate \stoptext Wolfgang --------------090702000207030509080809 Content-Type: text/html; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit
8. Februar 2018 um 10:50
Hello,

I'm trying to test whether value of \jobname is "Test"; I suppose it should be as the file name is "Test.mkiv".

But the code:

----
\starttext
  \jobname
  \doifelse{\jobname}{Test}{Yes}{No}
  \def\T{Test}
  \ifx\jobname\T True\else False\fi
  \ctxcommand{doifelse("\jobname" == "Test")}{1}{0}
\stoptext
----

yields "No", "False" and "1", so only the printed "1" is what I expect.

Why \doifelse and \ifx are evaluated as false?

The string from \jobname consists of catcode 12 letters while normal text
consists of catcode 11 letters. If you need the name of the file use one
of the commands below.


\starttext

\starttabulate
\NC \tex{jobfilefullname}     \NC \jobfilefullname     \NC\NR
\NC \tex{jobfilename}         \NC \jobfilename         \NC\NR
\NC \tex{jobfilesuffix}       \NC \jobfilesuffix       \NC\NR
\TB
\NC \tex{inputfilebarename}   \NC \inputfilebarename   \NC\NR
\NC \tex{inputfilerealsuffix} \NC \inputfilerealsuffix \NC\NR
\NC \tex{inputfilesuffix}     \NC \inputfilesuffix     \NC\NR
\NC \tex{inputfilename}       \NC \inputfilename       \NC\NR
\stoptabulate

\stoptext

Wolfgang
--------------090702000207030509080809-- --===============5895308668170586051== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --===============5895308668170586051==--