mirror of
https://github.com/SSCLI/sscli_20021101
synced 2026-06-08 12:28:57 +00:00
9fa3874800
Moved the original file to the archive subfolder.
95 lines
3.6 KiB
HTML
95 lines
3.6 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>CodeToHtml Sample</title>
|
|
<link rel="stylesheet" type="text/css" href="../../../docs/rotor.css">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>CodeToHtml Sample</h1>
|
|
<h2>Sample Overview</h2>
|
|
<p>This sample program can be used to create an HTML file containing color-coded
|
|
source code, in various languages including JScript and C#.</p>
|
|
<p>This sample was written in JScript.</p>
|
|
<p>Some features:</p>
|
|
<ul>
|
|
<li>Support for coloring numbers and compiler directives.</li>
|
|
<li>Fully extensible .ini and command-line driven architecture.</li>
|
|
<li>Reads correct .ini file for JScript and C# depending on file extension.</li>
|
|
<li>Dynamic replacement of strings in the output file.</li>
|
|
</ul>
|
|
<h3>Extensible Architecture</h3>
|
|
<p>Anything you add in the .ini file or on the command-line gets added to the
|
|
global g_objOptions object, so you can use it in a dynamic
|
|
replacement as specified in the file replace.ini. </p>
|
|
<p>The default behavior is that extensions .cs and .js are recognized and the
|
|
correct .ini files loaded for that language. To support another language, copy
|
|
the js_* files and rename them to <lang_extention>_*. Then modify the files to
|
|
match the correct values for the new language.</p>
|
|
<ul>
|
|
<li><lang>_codetohtml.ini<ul>
|
|
<li>Contains the name of the language, the other INI files, and the CSS file
|
|
to use.</li>
|
|
</ul>
|
|
</li>
|
|
<li><lang>_keywords.ini<ul>
|
|
<li>Contains language keywords.</li>
|
|
</ul>
|
|
</li>
|
|
<li><lang>_userdefined.ini
|
|
<ul>
|
|
<li>Contains user-defined types to special case.</li>
|
|
</ul>
|
|
</li>
|
|
<li><lang>_futurereserved.ini
|
|
<ul>
|
|
<li>Contains future reserved words in the language.</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<p>Examine the default <code>js_replace.ini</code> and <code>header.txt</code>
|
|
files to see the sorts of things that you can do to with the .ini files.</p>
|
|
|
|
<h2>Sample Source and Build Output Locations</h2>
|
|
<p>The sample source is found in rotor\samples\utilities\codetohtml.</p>
|
|
<p>The source file is:</p>
|
|
<ul class="none">
|
|
<li><a href="codetohtml.js">codetohtml.js</a></li>
|
|
</ul>
|
|
<p>The build output location is %TARGETCOMPLUS%\samples\utilities\codetohtml.
|
|
The output file is an executable assembly named codetohtml.exe.</p>
|
|
<h2>Building the Sample</h2>
|
|
<p>All samples are built from the buildall script. </p>
|
|
<p>You can also build all the samples by switching to the root of the sample
|
|
directory, sscli\samples, and typing <code>build -c</code>.</p>
|
|
<p>You can build this specific sample by switching to the sample directory and
|
|
typing <code>build -c</code>.</p>
|
|
<h2>Running the Sample</h2>
|
|
<p>These steps require that the Shared Source CLI (SSCLI) be already built and
|
|
functional.</p>
|
|
<p>This sample requires the files <lang>_codetohtml.ini, <lang>_keywords.ini,
|
|
<lang>_userdefined.ini, and <lang>_futurereserved.ini to be present in the
|
|
current directory where the application is launched.</p>
|
|
<ol>
|
|
<li>Run env.bat or source the env.csh or env.sh script files, depending on
|
|
your platform.</li>
|
|
<li>Switch to the %TARGETCOMPLUS%\samples\utilities\codetohtml directory.</li>
|
|
<li>Type the following command:<blockquote>
|
|
<p>clix codetohtml <i>sourcefilename</i></p>
|
|
</blockquote>
|
|
</li>
|
|
</ol>
|
|
<blockquote>
|
|
<p>where <i>sourcefilename</i> is the full path to a C# or JScript source
|
|
file. The generated HTML file will be placed in the same directory as
|
|
the source file.</p>
|
|
</blockquote>
|
|
<hr>
|
|
<p><i>Copyright (c) 2002 Microsoft Corporation. All rights reserved.</i></p>
|
|
|
|
</body>
|
|
|
|
</html> |