File: source.sig

package info (click to toggle)
smlnj 110.79-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 82,564 kB
  • sloc: ansic: 32,532; asm: 6,314; sh: 2,296; makefile: 1,821; perl: 1,170; pascal: 295; yacc: 190; cs: 78; python: 77; lisp: 19
file content (51 lines) | stat: -rw-r--r-- 1,780 bytes parent folder | download | duplicates (4)
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
(* source.sig
 * COPYRIGHT (c) 1996 Bell Laboratories.
 *)

signature SOURCE =
  sig
    type inputSource = {
        sourceMap: SourceMap.sourcemap,
        fileOpened: string,
        interactive: bool,
        sourceStream: TextIO.instream, 
        content: string option ref,
        anyErrors: bool ref,
        errConsumer: PrettyPrintNew.device
      }

    val newSource : (string * TextIO.instream * bool * PrettyPrintNew.device)
          -> inputSource

    val closeSource: inputSource -> unit

    val filepos: inputSource -> SourceMap.charpos -> SourceMap.sourceloc
    (* simply calls SourceMap.filepos on the sourceMap component of inputSource,
     * provided for convenience. *)

    val getContent : inputSource -> string option

    val regionContent : inputSource * SourceMap.region ->
			(string * SourceMap.region * int) option
  end

(*
The fileOpened field contains the name of the file that was opened to
produce a particular inputSource.  It is used to derive related
file names (for example, see CompileF.codeopt and CompileF.parse
in build/compile.sml.). It is also used when we need to access the content
of the sourcefile for error messages (getContent).  This assumes that the
current directory remains fixed if the file name is a relative path.

newSource takes as argument a file name, the corresponding instream of the
opened file, a boolean flag indicating whether the source is interactive
(i.e. stdIn), and a prettyPrint device. (Note: Formerly newSource also took
an additional int argument representing the initial line number, but this
argument was always 1).

getContent only works if the source is a single file (no #line directives
changing the source file), and it won't work for an interactive source.
[This needs to be fixed.]

*)