Re: [NTG-context] verb-c

2006-08-18 Thread wwl
  I have a little problem with the module 'verb-c'.
 
  Backslashes in verbatim text seem to disturb colors.
  
  \usemodule[verb-c]
  \setupcolors[state=start]
  \setuptyping[C][color=blue,palet=colorpretty,
  numbering=line]
  \starttext
  Davor
  \startC
  #include stdio.h
 
  int main()
  {
printf(Hallo\n);
  }
  \stopC
  Danach
  \stoptext
  
  Problem:
 
  'Danach' is blue!
  Last line number has the same color as the
  quotet String Hallo ConTeXt\n.
 
  Delete the newline char and all is ok!
 
  How can this be fixed?
 
   puts(Hallo);
 
   nikolai

You can't be serious!

Escape-Sequences like \n,\r,\t,\123 or \xef are integral part of the 
C-language and I have this in many different places in a lot of 
C-source files.

Is there no solution? Why does this happen?


Wolfgang

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] verb-c

2006-08-18 Thread Taco Hoekwater


[EMAIL PROTECTED] wrote:

How can this be fixed?

  puts(Hallo);

  nikolai
  
 You can't be serious!

I thought that was an extremely funny answer :-)

 Escape-Sequences like \n,\r,\t,\123 or \xef are integral part of the 
 C-language and I have this in many different places in a lot of 
 C-source files.
 
 Is there no solution? Why does this happen?

It happens because the \n is at the very end of the double
quoted string. It is a bug / oversight in the verb-c.tex,
but I have no time to fix it right now. I will try to  have
a look at it in the weekend.

Taco
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] verb-c

2006-08-18 Thread Hans Hagen
Taco Hoekwater wrote:
 [EMAIL PROTECTED] wrote:
   
 How can this be fixed?
 
  puts(Hallo);

  nikolai
   
  
 You can't be serious!
 

 I thought that was an extremely funny answer :-)

   
 Escape-Sequences like \n,\r,\t,\123 or \xef are integral part of the 
 C-language and I have this in many different places in a lot of 
 C-source files.

 Is there no solution? Why does this happen?
 

 It happens because the \n is at the very end of the double
 quoted string. It is a bug / oversight in the verb-c.tex,
 but I have no time to fix it right now. I will try to  have
 a look at it in the weekend.

   
can it be that the (here commented)

\beginofpretty[\!!prettyeight]%
\beginofpretty[\!!prettynine]%

pickup is not needed? i guess that it has no matching stop and since colors are 
grouped ... 


\gdef\doCtypefiveA#1#2%
  {\endCtypesix
   \ifinCcomment
 \getpretties{#1}{#2}%
   \else\ifinCsingle
 \getprettydata{#2}%
 \ifnum\prettytype=50
   
\beginofpretty[\!!prettyfive]\getpretties{#1}{#2}\endofpretty%\beginofpretty[\!!prettyeight]%
 \else\ifnum\prettytype=80
   
\beginofpretty[\!!prettyfive]\getpretties{#1}{#2}\endofpretty%\beginofpretty[\!!prettyeight]%
 \else
   \getpretties{#1}{#2}%
 \fi\fi
   \else\ifinCdouble
 \beginofpretty[\!!prettyfive]\getpretties{#1}{#2}\endofpretty% 
\beginofpretty[\!!prettynine]%
   \else
 \beginofpretty[\!!prettyfive]\getpretties{#1}{#2}\endofpretty
   \fi\fi\fi}

\gdef\doCtypefiveB#1%
  {\endCtypesix
   \ifinCcomment
 \ifcat#1\relax
   \continueCsinglelinecommenttrue
   \getpretty{#1}%
 \else
   \getpretty{#1}%
 \fi
   \else\ifinCsingle
 \getpretty{#1}%
   \else\ifinCdouble
 \beginofpretty[\!!prettyfive]\getpretty{#1}\endofpretty% 
\beginofpretty[\!!prettynine]%
   \else
 \beginofpretty[\!!prettyfive]\getpretty{#1}\endofpretty
   \fi\fi\fi}


so: 

\gdef\doCtypefiveA#1#2%
  {\endCtypesix
   \ifinCcomment
 \getpretties{#1}{#2}%
   \else\ifinCsingle
 \getprettydata{#2}%
 \ifnum\prettytype=50
   \beginofpretty[\!!prettyfive]\getpretties{#1}{#2}\endofpretty
 \else\ifnum\prettytype=80
   \beginofpretty[\!!prettyfive]\getpretties{#1}{#2}\endofpretty
 \else
   \getpretties{#1}{#2}%
 \fi\fi
   \else\ifinCdouble
 \beginofpretty[\!!prettyfive]\getpretties{#1}{#2}\endofpretty   \else
 \beginofpretty[\!!prettyfive]\getpretties{#1}{#2}\endofpretty
   \fi\fi\fi}

\gdef\doCtypefiveB#1%
  {\endCtypesix
   \ifinCcomment
 \ifcat#1\relax
   \continueCsinglelinecommenttrue
   \getpretty{#1}%
 \else
   \getpretty{#1}%
 \fi
   \else\ifinCsingle
 \getpretty{#1}%
   \else\ifinCdouble
 \beginofpretty[\!!prettyfive]\getpretty{#1}\endofpretty
  \else
 \beginofpretty[\!!prettyfive]\getpretty{#1}\endofpretty
   \fi\fi\fi}

seems to work ok here 


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

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] verb-c and tabulator width

2006-04-26 Thread Peter Münster
Hello,
thanks to Nikolai for the verb-c module!

One (probably there will come more) question:
How could I adjust the width of the tabulator?

It seems to be always one space inside \startC...\stopC :

\usemodule[verb-c]
\chardef\spacespertab=4
\starttext
\starttyping
int main(){
int i;
}
\stoptyping
\startC
int main(){
int i;
}
\stopC
\stoptext

Cheers, Peter

-- 
http://pmrb.free.fr/contact/
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] verb-c and tabulator width

2006-04-26 Thread nico
On Wed, 26 Apr 2006 19:43:48 +0200 (CEST), Peter Münster [EMAIL PROTECTED]  
wrote:

 Hello,
 thanks to Nikolai for the verb-c module!

 One (probably there will come more) question:
 How could I adjust the width of the tabulator?

Use the tab option (not specific to C):

\usemodule[verb-c]
\setupcolors[state=start]
\starttext

\startC[tab=2]
if (i == 0) {
a = b;
} else {
a = c;
}
\stopC

\startC[tab=4]
if (i == 0) {
a = b;
} else {
a = c;
}
\stopC

\startTEX[tab=8]
\startC[tab=4]
if (i == 0) {
a = b;
} else {
a = c;
}
\stopC
\stopTEX

\stoptext

Regards,
BG
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] verb-c and tabulator width

2006-04-26 Thread Peter Münster
On Wed, 26 Apr 2006, nico wrote:

 On Wed, 26 Apr 2006 19:43:48 +0200 (CEST), Peter Münster [EMAIL PROTECTED]  
 wrote:
 
  One (probably there will come more) question:
  How could I adjust the width of the tabulator?
 
 Use the tab option (not specific to C):

Thanks! In fact I should have looked into texshow instead of relying on the
old \chardef\spacespertab=...

I'm sorry, here comes already my second problem:

\usemodule[verb-c]
\setupcolors[state=start]
\setuptyping[option=C,tab=4]
\starttext
Contents of file \type{test.c}:
\startC
/** Doing this and that.
\param i the index */
void do_this(int i){
int bla;
}
\stopC

Here we get \quotation{\type{! Missing number, treated as zero.}}:
\typefile{test.c}
\stoptext

Could you help again?
Cheers, Peter

-- 
http://pmrb.free.fr/contact/
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] verb-c and tabulator width

2006-04-26 Thread nico
On Wed, 26 Apr 2006 21:26:08 +0200 (CEST), Peter Münster [EMAIL PROTECTED]  
wrote:

 On Wed, 26 Apr 2006, nico wrote:

 On Wed, 26 Apr 2006 19:43:48 +0200 (CEST), Peter Münster  
 [EMAIL PROTECTED]
 wrote:

  One (probably there will come more) question:
  How could I adjust the width of the tabulator?

 Use the tab option (not specific to C):

 Thanks! In fact I should have looked into texshow instead of relying on  
 the
 old \chardef\spacespertab=...

 I'm sorry, here comes already my second problem:

 \usemodule[verb-c]
 \setupcolors[state=start]
 \setuptyping[option=C,tab=4]
 \starttext
 Contents of file \type{test.c}:
 \startC
 /** Doing this and that.
   \param i the index */
 void do_this(int i){
   int bla;
 }
 \stopC

 Here we get \quotation{\type{! Missing number, treated as zero.}}:
 \typefile{test.c}
 \stoptext

 Could you help again?

Sorry, this time I cannot help. I think it's a bug in verb-c that makes a  
mess with standard C comments on several lines. C++/ISO C99 comments (//)  
seem correctly handled.

Regards,
BG
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context