Re: [NTG-context] strange file name

2008-10-26 Thread Ruini Xue
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
___


Re: [NTG-context] strange file name

2008-10-26 Thread Yue Wang
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 [EMAIL PROTECTED] 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
___


Re: [NTG-context] strange file name

2008-10-26 Thread Hans Hagen
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 [EMAIL PROTECTED] 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
___


Re: [NTG-context] strange file name

2008-10-26 Thread luigi scarso
On Sun, Oct 26, 2008 at 8:41 AM, Ruini Xue [EMAIL PROTECTED] 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
___
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
___


[NTG-context] strange file name

2008-10-25 Thread Ruini Xue
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
___


Re: [NTG-context] strange file name

2008-10-25 Thread luigi scarso
On Sat, Oct 25, 2008 at 6:12 PM, Ruini Xue [EMAIL PROTECTED] 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
___
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
___