ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* strange file name
@ 2008-10-25 16:12 Ruini Xue
  2008-10-25 16:33 ` luigi scarso
  0 siblings, 1 reply; 6+ messages in thread
From: Ruini Xue @ 2008-10-25 16:12 UTC (permalink / raw)
  To: ntg-context

source file:

%%%%%%%%%%%%%%
\starttext
{\input knuth}

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

compiling it produces error:

! I can't find file `knuth}'.
l.2 {\input knuth}

Why does tex recognize "knuth}" but not "knuth" as the file name?

-- 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: strange file name
  2008-10-25 16:12 strange file name Ruini Xue
@ 2008-10-25 16:33 ` luigi scarso
  2008-10-26  6:41   ` Ruini Xue
  0 siblings, 1 reply; 6+ messages in thread
From: luigi scarso @ 2008-10-25 16:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

On Sat, Oct 25, 2008 at 6:12 PM, Ruini Xue <xueruini@gmail.com> wrote:

> source file:
>
> %%%%%%%%%%%%%%
> \starttext
> {\input knuth}
>
> \stoptext
> %%%%%%%%%%%%%%%%%%%
>
> compiling it produces error:
>
> ! I can't find file `knuth}'.
> l.2 {\input knuth}
>
> Why does tex recognize "knuth}" but not "knuth" as the file name?
>

Watch for the space after knuth

%%%%%%%%%%%%%%
\starttext
{\input knuth }

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



Also
%%%%%%%%%%%%%%
\starttext
{\input knuth\relax}

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

It's TeX \input


-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 970 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: strange file name
  2008-10-25 16:33 ` luigi scarso
@ 2008-10-26  6:41   ` Ruini Xue
  2008-10-26 11:24     ` Yue Wang
  2008-10-27  1:00     ` luigi scarso
  0 siblings, 2 replies; 6+ messages in thread
From: Ruini Xue @ 2008-10-26  6:41 UTC (permalink / raw)
  To: ntg-context

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}
> 

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

-- 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: strange file name
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Yue Wang @ 2008-10-26 11:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

I found this problem long ago and I think it is related to the web2c
implementation? because \input behavior is actually defined by web2c.
On Sun, Oct 26, 2008 at 2:41 PM, 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}
>>
>
> I just want to know why \input includes the right brace "}" in the file name.
>
> -- 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
> ___________________________________________________________________________________
>
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: strange file name
  2008-10-26 11:24     ` Yue Wang
@ 2008-10-26 22:47       ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2008-10-26 22:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Yue Wang wrote:
> I found this problem long ago and I think it is related to the web2c
> implementation? because \input behavior is actually defined by web2c.
> On Sun, Oct 26, 2008 at 2:41 PM, Ruini Xue <xueruini@gmail.com> wrote:

web2c might implement the working, but the space or \relax ending an 
\input is part of the tex spec

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: strange file name
  2008-10-26  6:41   ` Ruini Xue
  2008-10-26 11:24     ` Yue Wang
@ 2008-10-27  1:00     ` luigi scarso
  1 sibling, 0 replies; 6+ messages in thread
From: luigi scarso @ 2008-10-27  1:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-10-27  1:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-25 16:12 strange file name 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 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).