210 lines
3.1 KiB
HTML
210 lines
3.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Metaprogramming</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="Linux Assembly HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Other Assemblers"
|
|
HREF="other.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="External filters"
|
|
HREF="external.html"></HEAD
|
|
><BODY
|
|
CLASS="chapter"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
SUMMARY="Header navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>Linux Assembly HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="other.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="external.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="chapter"
|
|
><H1
|
|
><A
|
|
NAME="AEN571"
|
|
></A
|
|
>Chapter 4. Metaprogramming</H1
|
|
><DIV
|
|
CLASS="TOC"
|
|
><DL
|
|
><DT
|
|
><B
|
|
>Table of Contents</B
|
|
></DT
|
|
><DT
|
|
>4.1. <A
|
|
HREF="external.html"
|
|
>External filters</A
|
|
></DT
|
|
><DD
|
|
><DL
|
|
><DT
|
|
>4.1.1. <A
|
|
HREF="external.html#AEN581"
|
|
>CPP</A
|
|
></DT
|
|
><DT
|
|
>4.1.2. <A
|
|
HREF="external.html#AEN586"
|
|
>M4</A
|
|
></DT
|
|
><DT
|
|
>4.1.3. <A
|
|
HREF="external.html#AEN595"
|
|
>Macroprocessing with your own filter</A
|
|
></DT
|
|
></DL
|
|
></DD
|
|
><DT
|
|
>4.2. <A
|
|
HREF="meta.html"
|
|
>Metaprogramming</A
|
|
></DT
|
|
><DD
|
|
><DL
|
|
><DT
|
|
>4.2.1. <A
|
|
HREF="meta.html#AEN618"
|
|
>Backends from compilers</A
|
|
></DT
|
|
><DT
|
|
>4.2.2. <A
|
|
HREF="meta.html#AEN621"
|
|
>The New-Jersey Machine-Code Toolkit</A
|
|
></DT
|
|
><DT
|
|
>4.2.3. <A
|
|
HREF="meta.html#AEN625"
|
|
>TUNES</A
|
|
></DT
|
|
></DL
|
|
></DD
|
|
></DL
|
|
></DIV
|
|
><P
|
|
> Assembly programming is a bore, but for critical parts of programs.
|
|
</P
|
|
><P
|
|
> You should use the appropriate tool for the right task, so don't choose
|
|
assembly when it does not fit; C, OCaml, perl, Scheme, might be a better
|
|
choice in the most cases.
|
|
</P
|
|
><P
|
|
> However, there are cases when these tools do not give fine enough control on
|
|
the machine, and assembly is useful or needed. In these cases you'll
|
|
appreciate a system of macroprocessing and metaprogramming that allows
|
|
recurring patterns to be factored each into one indefinitely reusable
|
|
definition, which allows safer programming, automatic propagation of pattern
|
|
modification, etc. Plain assembler often is not enough, even when one is doing
|
|
only small routines to link with C.
|
|
</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
SUMMARY="Footer navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="other.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
ACCESSKEY="H"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="external.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Other Assemblers</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
> </TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>External filters</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |