PreviousUpNext

15.3.230  src/lib/compiler/front/basics/source/source-code-source.api

## source-code-source.api

# Compiled by:
#     src/lib/compiler/front/basics/basics.sublib



api Source_Code_Source {
    #
    Input_Source = {   line_number_db:  line_number_db::Sourcemap,
                       file_opened:     String,
                       interactive:     Bool,

                       source_stream:   file::Input_Stream, 
                       saw_errors:      Ref( Bool ),
                       error_consumer:  prettyprint::Device
                   };

    make_source:  ((String, Int, file::Input_Stream, Bool, prettyprint::Device))
                 -> Input_Source;

    close_source: Input_Source -> Void;

    filepos:  Input_Source
               -> line_number_db::Charpos
               -> (String,
                   Int,
                   Int);

};

#  The [[fileOpened]] field contains the name of the file that was opened   
#  to produce a particular [[Input_Source]].                                
#  It is used only to derive related file names.                            
#  (For an example, see [[translate_raw_syntax_to_execode_g::codeopt]] and [[translate_raw_syntax_to_execode_g::parse]] in    
#  \texttt { build/translate-raw-syntax-to-execode-g.pkg }.)                                          
#                                                                           
#  [[make_source]] has some old warts build in.  It takes as argument a       
#  file and line number, and it assumes column-1.  The reason we don't      
#  simply pass a [[line_number_db::sourcemap]] is that we have to hide the        
#  Awful truth about the beginning position according to mythryl-lex (it's-2).   
#  That position, and therefore the creation of the source map, are         
#  encapsulated inside [[make_source]].                                       
#                                                                           
#  [[filepos]] is kept around for historical reasons, to avoid having to    
#  Change lots of code elsewhere in the compiler; it wraps a                
#  Call to [[line_number_db::filepos]] and massages the return type.              
#  It probably should be eliminated, but then somebody would have to fix    
#  All those call sites.                                                    
#                                                                           
#  <source-code-source.api>=                                                            



## COPYRIGHT (c) 1996 Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2011,
## released under Gnu Public Licence version 3.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext