/usr/share/doc/fweb/html-info/Overloading.html is in fweb-doc 1.62-13.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>FWEB: Overloading</title>
<meta name="description" content="FWEB: Overloading">
<meta name="keywords" content="FWEB: Overloading">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-index.html#Concept-index" rel="index" title="Concept index">
<link href="Parameter-index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Pretty_002dprinting.html#Pretty_002dprinting" rel="up" title="Pretty-printing">
<link href="Index.html#Index" rel="next" title="Index">
<link href="Alternatives.html#Alternatives" rel="prev" title="Alternatives">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Overloading"></a>
<div class="header">
<p>
Previous: <a href="Pseudo_002doperators.html#Pseudo_002doperators" accesskey="p" rel="prev">Pseudo-operators</a>, Up: <a href="Pretty_002dprinting.html#Pretty_002dprinting" accesskey="u" rel="up">Pretty-printing</a> [<a href="Parameter-index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-index.html#Concept-index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Overloading-operators-and-identifiers"></a>
<h4 class="subsection">10.2.3 Overloading operators and identifiers</h4>
<a name="index-Overloading"></a>
<p>For special effects in the woven output, there are commands to help
one change the appearance of operators and identifiers.
</p>
<a name="Overloading-operators"></a>
<h4 class="subsubsection">10.2.3.1 Overloading operators</h4>
<a name="index-Overloading-operators"></a>
<a name="index-Operators_002c-overloading-2"></a>
<p>A feature common to both C++ and <small>FORTRAN</small>–90 is <em>operator overloading</em>,
the ability to extend or redefine the definition of an operator such as
‘<samp>.FALSE.</samp>’
or ‘<samp>=</samp>’. <small>FORTRAN–90</small> even allows one to define new <em>dot
operators</em>—for example, one might define the operator ‘<samp>.IN.</samp>’ to test
for inclusion in a set. In a nontrivial extension of the original design,
<small>FWEAVE</small> allows one to define how overloaded
operators should appear on output.
Indeed, this feature can be used even when the compiler language itself
does not permit overloading in order to customize the appearance of the
woven output.
</p>
<p>The ‘<samp>@v</samp>’ control code is used to change the appearance of an operator.
The format is
</p>
<div class="example">
<pre class="example">@v new_operator_symbol_or_name "TeX material" old_operator
</pre></div>
<p>This means “Display the new operator according to the <i>TeX
material</i>, but treat it like the old operator—e.g., unary or binary—for
formatting purposes. The
quoted TeX material is treated just like a C string, so if
one wants to include a backslash one must escape it with another backslash.
For example, one can make an equals sign display on output as
a large left arrow by saying
</p>
<div class="example">
<pre class="example">@v = "\\Leftarrow" =
</pre></div>
<p>Two <small>FORTRAN</small> examples are
</p>
<div class="example">
<pre class="example">@v .FALSE. "\\.{.FALSE.}" .FALSE.
@v .IN. "\\in" +
</pre></div>
<p>This feature can go a long way toward enhancing readability of the woven
output, particularly when operators are actually being overloaded. It can
also lead to arbitrarily bizarre output that no-one else will understand.
As usual, restraint is advised.
</p>
<a name="Overloading-identifiers"></a>
<h4 class="subsubsection">10.2.3.2 Overloading identifiers</h4>
<a name="index-Overloading-identifiers"></a>
<a name="index-Identifiers_002c-overloading-1"></a>
<p>Although operator overloading is quite useful, it does not allow one to
change the appearance of identifiers. In its most general form, such a
facility becomes quite complicated; one must endow <small>FWEAVE</small> with a
macro-processing facility analogous to that of <small>FTANGLE</small>. This has
not been
done yet (maybe it will be someday). In the meantime, one has the
command ‘<samp>@W</samp>’,
which provides a restricted form of such a facility. <em>This
command is experimental, and not firmly established. Changes in usage
and/or syntax may be made in future versions.</em>
</p>
<p>The most general form of the ‘<samp>@W</samp>’ command is
</p>
<div class="example">
<pre class="example">@W identifier "replacement text"
</pre></div>
<p>This means: Replace any references to <i>identifier</i> in the
woven output with the <i>replacement text</i>.
</p>
<p>A more restrictive form is
</p>
<div class="example">
<pre class="example">@W identifier \newmacro
</pre></div>
<p>which replaces references to <i>identifier</i> with a call to
<code>\newmacro</code>. (Note that there are no quotes in this form.)
</p>
<p>The shortest form is
</p>
<div class="example">
<pre class="example">@W identifier .
</pre></div>
<p>which replaces references to <i>identifier</i> with a call to
<code>\identifier</code>. For example, the identifier <i>x</i> normally appears in
woven output as ‘<samp>\.{\Wshort\{x\}}</samp>’. If one says
</p>
<div class="example">
<pre class="example">@W x .
</pre></div>
<p>one will instead get the macro reference ‘<samp>\x</samp>’, which could
be defined to give a variety of special effects. (However, one may need
some rather intimate understanding of <small>FWEAVE</small>’s output in order to
ensure that things always work correctly.)
</p>
<p>One of the important uses of this facility is to expedite special
formatting of array references. This subject is discussed separately below
in the section on “Special array formatting” (sorry, that isn’t here
yet), where an example is given.
</p>
<hr>
<div class="header">
<p>
Previous: <a href="Pseudo_002doperators.html#Pseudo_002doperators" accesskey="p" rel="prev">Pseudo-operators</a>, Up: <a href="Pretty_002dprinting.html#Pretty_002dprinting" accesskey="u" rel="up">Pretty-printing</a> [<a href="Parameter-index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-index.html#Concept-index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|