ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "luigi scarso" <luigi.scarso@gmail.com>
To: "mailing list for ConTeXt users" <ntg-context@ntg.nl>
Subject: Re: strange file name
Date: Mon, 27 Oct 2008 03:00:47 +0200	[thread overview]
Message-ID: <fe8d59da0810261800p5b5d1c6fi5838ac4eb4c4ba79@mail.gmail.com> (raw)
In-Reply-To: <loom.20081026T062629-84@post.gmane.org>


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

On Sun, Oct 26, 2008 at 8:41 AM, Ruini Xue <xueruini@gmail.com> wrote:

> luigi scarso <luigi.scarso <at> gmail.com> writes:
>
> >
> >
> > On Sat, Oct 25, 2008 at 6:12 PM, Ruini Xue <xueruini <at> gmail.com>
> wrote:
> > source file:
> >
> > Watch for the space after knuth
> > {\input knuth\relax}
> >
>
Also this works
%%%%%%%%%%%%%%
\starttext
\begingroup\input knuth\endgroup

\stoptext
%%%%%%%%%%%%%%%%%%%


and  this doesn't work
%%%%%%%%%%%%%%
\starttext
\bgroup\input knuth\egroup

\stoptext
%%%%%%%%%%%%%%%%%%%





>
> I just want to know why \input includes the right brace "}" in the file
> name.
>

\input is a primitive of LuaTeX;
give a look at luatex.pdf
to see how it's implemented .
Here some web code (look at name_in_progress ) :

378. The processing of \input involves the start input subroutine, which
will be declared later; the
processing of \endinput is trivial.
< Put each of TEX's primitives into the hash table 241 >+=
  primitive ("input", input , 0);
  primitive ("endinput", input , 1);
379.   <   Cases of print cmd chr for symbolic printing of primitives 242
>+=
input : if chr code = 0 then print esc ("input")
< Cases of input for print cmd chr 1529>
else print esc ("endinput");


380.     Initiate or terminate input from a file 380
  if cur chr = 1 then force eof  true
  <  Cases for input 1530>
else if name in progress then insert relax
  else start input
This code is used in section 368.

381. Sometimes the expansion looks too far ahead, so we want to insert a
harmless \relax into the user's
input.
< Declare the procedure called insert relax 381 > +=
procedure insert relax ;
  begin cur tok  cs token flag + cur cs ; back input ; cur tok  cs token
flag + frozen relax ; back input ;
  token type  inserted ;
  end;
This code is used in section 365.


536* Now let's consider the driver routines by which TEX deals with file
names in a system-independent.
manner. First comes a procedure that looks for a file name in the input by
calling get x token for the
information.
procedure scan file name ;
   label done ;
   begin name in progress  true ; begin name ; Get the next non-blank
non-call token 410 ;
   loop begin if (cur cmd > other char )  (cur chr > biggest char ) then {
not a character }
         begin back input ; goto done ;
         end; { If cur chr is a space and we're not scanning a token list,
check whether we're at the end of
             the buffer. Otherwise we end up adding spurious spaces to file
names in some cases. }
      if (cur chr = " ")  (state = token list )  (loc > limit ) then goto
done ;
      if ¬more name (cur chr ) then goto done ;
      get x token ;
      end;
done : end name ; name in progress  false ;
   end;


537. The global variable name in progress is used to prevent recursive use
of scan file name , since the
begin name and other procedures communicate via global variables. Recursion
would arise only by devious
tricks like `\input\input f'; such attempts at sabotage must be thwarted.
Furthermore, name in progress
prevents \input from being initiated when a font size specification is being
scanned.
   Another global variable, job name , contains the file name that was first
\input by the user. This name
is extended by `.log' and `.dvi' and `.fmt' in the names of TEX's output
files.
  Global variables 13 +
name in progress : boolean ; { is a file name being scanned? }
job name : str number ; { principal file name }
log opened : boolean ; { has the transcript file been opened? }






>
> -- ruini
>
>
>
>
>
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>



-- 
luigi

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

[-- Attachment #2: Type: text/plain, Size: 487 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      parent reply	other threads:[~2008-10-27  1:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-25 16:12 Ruini Xue
2008-10-25 16:33 ` luigi scarso
2008-10-26  6:41   ` Ruini Xue
2008-10-26 11:24     ` Yue Wang
2008-10-26 22:47       ` Hans Hagen
2008-10-27  1:00     ` luigi scarso [this message]

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=fe8d59da0810261800p5b5d1c6fi5838ac4eb4c4ba79@mail.gmail.com \
    --to=luigi.scarso@gmail.com \
    --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).