Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/cm/Doc/05-classes.tex
ViewVC logotype

Diff of /sml/trunk/src/cm/Doc/05-classes.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 742, Thu Nov 30 14:09:32 2000 UTC revision 756, Thu Dec 14 16:01:33 2000 UTC
# Line 50  Line 50 
51  By default, CM automatically classifies files with a {\tt .sml}  By default, CM automatically classifies files with a {\tt .sml}
52  suffix, a {\tt .sig} suffix, or a {\tt .fun} suffix as ML-source, file  suffix, a {\tt .sig} suffix, or a {\tt .fun} suffix as ML-source, file
53  names ending in {\tt .cm} as CM descriptions.\footnote{Suffixes that  names ending in {\tt .cm} as CM descriptions.  Failure to classify a
54  are not known and for which no plugin module can be found are treated  member will be reported as an error.
 as ML source code.  However, as new tools are added there is no  
 guarantee that this behavior will be preserved in future versions of  
56  \subsection{Tool parameters}  \subsection{Tool parameters}
57  \label{sec:toolparam}  \label{sec:toolparam}
# Line 457  Line 454 
454            witness:foo.wtn            witness:foo.wtn
455            target:(name:main.sml))            target:(name:main.sml))
456  \end{verbatim}  \end{verbatim}
458    \subsubsection{Dir}
459    \label{sec:builtin-tools:dir}
461    Using the Dir tool one can use directory names in description files.
462    There are two possible uses for the Dir tool:
464    \begin{enumerate}
465    \item Factoring out common directory names.
466    \item Scanning the contents of directories for files with ML code.
467    \end{enumerate}
469    \paragraph{Directory factoring:}
470    The main purpose of the Dir tool (class {\tt dir}) is to simplify CM
471    descriptions that mention a large number of files all of which are
472    located in in the same directory.  For this style of usage, tool
473    options have to be specified.
475    For example, writing
477    \begin{verbatim}
478    Group is
479      long/directory/name : dir (a.sml b/c.sml d.sml)
480    \end{verbatim}
482    is equivalent to the following verbose description:
484    \begin{verbatim}
485    Group is
486      long/directory/name/a.sml
487      long/directory/name/b/c.sml
488      long/directory/name/d.sml
489    \end{verbatim}
491    Since CM automatically classifies directory names as members of class
492    {\tt dir}, the example can be further simplified:
494    \begin{verbatim}
495    Group is
496      long/directory/name (a.sml b/c.sml d.sml)
497    \end{verbatim}
499    Options for class {\tt dir} consist of a list of items, each item
500    having one of two possible forms:
502    \begin{enumerate}
503    \item The item can be a sub-option list of the form
504    {\tt member:($m$ class:$c$ options:$o$)} which emulates an ordinary
505    member specification with class and options.  The {\tt class}- and
506    {\tt options}-fields may (independently of each other) be missing, but
507    the order of fields that are present is fixed.
508    \item The item can be a simple name (as shown in the example).  Such a
509    simple name $m$ is equivalent to the longer form {\tt member:($m$)}.
510    \end{enumerate}
512    Members $m$ must always be specified using {\em relative} path names.
514    For example, the description
516    \begin{verbatim}
517    Group is
518      alpha/a.sml (private)
519      alpha/b.ml : sml (shared)
520      alpha/c.cm
521      beta/d.sml
522      beta/e.sml
523    \end{verbatim}
525    can be simplified as:
527    \begin{verbatim}
528    Group is
529      alpha (member:(a.sml options:private)
530             member:(b.ml class:sml options:shared)
531             c.cm)
532      beta (d.sml e.sml)
533    \end{verbatim}
535    \paragraph{Directory scanning:}
536    Another use of the Dir tool, indicated by the absence of tool options,
537    is to include all ML code in a given directory ``whole-sale style''.
538    For example, a member of the form
540    \begin{verbatim}
541      projects/ml/foo : dir
542    \end{verbatim}
544    lets CM scan the contents of directory {\tt projects/ml/foo} and
545    proceed as if a list of all discovered ML files had been written
546    in place of the {\tt dir} member.  For this, the usual classification
547    mechanism is used to decide which directory entries are to be
548    considered files containing ML code.
550    As before, the example could be further simplified by omitting the
551    class name.  Thus, a very quick way of putting together a small
552    project is to use a generic description file of the form:
554    \begin{verbatim}
555    Group is $/basis.cm .
556    \end{verbatim}
557    % $
559    As usual, the dot denotes the current directory.  Therefore, CM will
560    scan the current directory and include any ML code it finds there.
561    (Library {\tt \$/basis.cm} is necessary for most non-trivial programs,
562    so we included it also.)
564    This is deceptively simple, but be warned: The technique of letting CM
565    scan the physical directory is to be avoided for any serious project
566    because it is very fragile.  It does not mix well with the use of
567    other tools, it will break when certain otherwise unrelated ML files
568    are present, and so on, and so forth. In short, for serious
569    programming the Dir tool should not be used without specifying
570    options.

Removed from v.742  
changed lines
  Added in v.756

ViewVC Help
Powered by ViewVC 1.0.0