2012-11-13 yang.zhao:
> is there a good way to display source(such as C language) in ConTeXt?
There is the vim module. It uses the editor vim to mark up the
source with syntax highlighting code. However, it does only
highlighting, not indentation. But it might be possible to hook in
an auto-indenter or a formatter like `astyle`. Here's an example:
\usemodule
[vim]
\definevimtyping
[C]
[syntax=c,
style=smalltype,
tab=2]
\starttext
\startC
void EBI_BankByteLaneEnable(uint32_t banks, bool enable)
{
EFM_ASSERT((banks & ~(EBI_BANK0 | EBI_BANK1 | EBI_BANK2 | EBI_BANK3)) == 0);
/* Configure byte lane support for each selected bank */
if (banks & EBI_BANK0)
{
BITBAND_Peripheral(&(EBI->CTRL), _EBI_CTRL_BL_SHIFT, enable);
}
if (banks & EBI_BANK1)
{
BITBAND_Peripheral(&(EBI->CTRL), _EBI_CTRL_BL1_SHIFT, enable);
}
}
\stopC
\stoptext
Marco
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________