1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>hsc - File Options</TITLE>
<LINK REV="owns" TITLE="Thomas Aglassinger" HREF="mailto:agi@giga.or.at">
<LINK REL="Next" HREF="messages.html">
<LINK REL="Copyright" HREF="copy.html">
<LINK REL="Previous" HREF="examples.html">
<META name="ROBOTS" content="NOINDEX, NOFOLLOW">
</HEAD>
<BODY>
<A HREF="index.html"><IMG SRC="image/main.gif" ALT="Contents" ALIGN="middle" WIDTH="70" HEIGHT="16"></A>
<IMG SRC="image/noindex.gif" ALT="-----" ALIGN="middle" WIDTH="70" HEIGHT="16">
<A HREF="copy.html"><IMG SRC="image/copy.gif" ALT="Copyright" ALIGN="middle" WIDTH="70" HEIGHT="16"></A>
<A HREF="index.html"><IMG SRC="image/back.gif" ALT="Up" ALIGN="middle" WIDTH="70" HEIGHT="16"></A>
<A HREF="examples.html"><IMG SRC="image/prev.gif" ALT="Previous" ALIGN="middle" WIDTH="70" HEIGHT="16"></A>
<A HREF="messages.html"><IMG SRC="image/next.gif" ALT="Next" ALIGN="middle" WIDTH="70" HEIGHT="16"></A>
<HR>
<H1>File Options</H1>
There are several CLI-options to specify where <KBD>hsc</KBD> should take the
input from and where the output should be placed. This section
describes the differences and (dis-)advantages.
<H2>Converting Single Files</H2>
This one uses a single file for input and output:
<PRE>
hsc FROM hugo.hsc TO hugo.html
</PRE>
It will use <I>hugo.hsc</I> and outputs to <I>hugo.html</I>.
Both input and output will be located in the current directory. This can
be useful if you only want to quickly process a single file trough <KBD>hsc</KBD>,
and do not want to set up a complete project.
<H2>Using Different Directories For Input And Output</H2>
<P>One of the features of <KBD>hsc</KBD> is that your object can be located at
a totally different place from the source. This enables you to place
your sources at a different disk as the one the w3-Server has access
to, saving server space.</P>
For instance, you can use
<PRE>hsc FROM hugo.hsc TO www:sepp/hugo.html</PRE>
<P>to use <I>hugo.hsc</I>, located in the current directory, and
create <I>www:sepp/hugo.html</I>. Note that all images,
other documents etc. you reference from out <I>hugo.hsc</I> using
relative URIs have to be located at the corresponding place within
the directory <I>www:sepp/</I>.</P>
<P>For example, if <I>hugo.hsc</I> contains a tag
<PRE><IMG SRC="image/back.gif" ALT="back"></PRE>
the image file <I>back.gif</I> will have to be located at
<I>www:sepp/image/back.gif</I>.
<H2>Using A Destination Directory</H2>
The same as above can be performed using
<PRE>hsc FROM hugo.hsc TO www:sepp/</PRE>
<P>Note the trailing slash that tells <KBD>hsc</KBD> that it should now output
to a directory and determine the filename by itself. Usually, it
will use (<CODE>input filename</CODE>, without ``<CODE>.hsc</CODE>'',
but a ``<CODE>.html</CODE>'' appended), resulting into <I>www:sepp/hugo.html</I>
as before. You can change the default extension using the CLI option
<A HREF="options.html#extension"><KBD>EXTENSION</KBD></A>.</P>
<H2>Using Sub Directories</H2>
<P>For complex project, usually not all documents are located at the
same directory. For example, <I>hugo.hsc</I> is no more
placed in the current directory, but in
<I>people/hugo.hsc</I>.</P>
Invoking hsc like
<PRE>hsc FROM people/hugo.hsc TO www:sepp/</PRE>
<P>will now output to <I>www:sepp/people/hugo.html</I>. Note that you
have to take care that the directory <I>www:sepp/people/</I>
exists, <KBD>hsc</KBD> will not create any new directories by itself.</P>
If you now want to embed an image located at
<I>www:sepp/image/back.gif</I> into this document, you have to
use
<PRE><IMG SRC="../image/back.gif" ALT="back"></PRE>
Alternatively, you can use a <A HREF="features/uris.html#prjrel">Project Relative URI</A>:
<PRE><IMG SRC=":image/back.gif" ALT="back"></PRE>
Another way to obtain the same result is using
<PRE>hsc FROM people/hugo.hsc TO www:sepp/people/hugo.html</PRE>
<P>In this case, <KBD>hsc</KBD> is smart enough to figure out that the
destination directory is <I>www:sepp/</I>, and you are using
<I>people/</I> as subdirectory.</P>
But if you try to use
<PRE>hsc FROM people/hugo.hsc TO www:sepp/stuff/hugo.html</PRE>
<KBD>hsc</KBD> can not figure out what to use as destination- or
subdirectory, and will show up an error message:
<PRE>unmatched corresponding relative directories:
input `people/'
output `stuff/'</PRE>
In this case, you will have to rename your directories.
<H2>Using Pipes</H2>
<P>Short: It is possible to use pipes with <KBD>hsc</KBD>, but it should be
avoided in most cases; <KBD>hsc</KBD> isn't really ``pipable''. It does not
continuously read data from the input and write parts of the output.</P>
<P>(<STRONG>Technical note</STRONG>: It reads the whole input file with a single call to
<CODE>fread()</CODE>, creates the output in memory and writes it with
(more or less) a single <CODE>fwrite()</CODE>. The main reasons why it
works this way are: I hate to check for I/O errors,
<CODE>fungetc()</CODE> usually does not work after a linefeed and
memory mapped files are not supported by the standard ANSI
library.)</P>
<P>Additionally, it impossible for <KBD>hsc</KBD> to maintain a project file
without knowledge of the filenames for document and source, so
several features will be disabled.</P>
<P>If <KBD>hsc</KBD> needs to access relative URIs, it will have to use the
current directory as starting point.</P>
<P>Therefor, pipes should only be used if you quickly want to test
a feature on a single file or something like that.</P>
Anyway, here is an example:
<PRE>hsc STDIN</PRE>
This specifies the (case sensitive) pseudo-filename <KBD>STDIN</KBD>
as input, which will use <CODE>stdin</CODE>. Missing a <KBD>TO</KBD> option, the
output will be written to <CODE>stdout</CODE>. Now using this like
<PRE>hsc STDIN <hugo.hsc >hugo.html</PRE>
would be equal to
<PRE>hsc hugo.hsc TO hugo.html</PRE>
Again: Try to avoid this.
</BODY></HTML>
|