[ Reference Manual | Alphabetic Index ]

# library(source_processor)

Tools for processing ECLiPSe sources

## Predicates

> expand_clause_and_goals(?, ?, ?, ?, ?, ?)
>   No description available
> expand_clause_goals(?, ?, ?, ?, ?)
>   No description available
> meta_attribute_now_later(?, ?, ?)
>   No description available
> source_close(+SourcePos, +OptionList)
>   Close an open ECLiPSe source file.
> source_open(+File, +OptionList, -SourcePos)
>   Open an ECLiPSe source code file for subsequent processing
> source_read(+SourcePos, -NextPos, -Kind, -SourceTerm)
>   Read the next term from an open ECLiPSe source file

## Structures

> struct source_position(filespec, stream, file, line, offset, remaining_files, included_from, options, created_modules, oldcwd, module, ifdefs, old_compiled_stream)
>   Current source position
> struct source_term(term, vars, annotated)
>   A source term with additional information

## Examples

        % This can be used as a template for source processing code:
        % a source file is opened,
        % every term is read and printed,
        % then the file is closed

        test(File) :-
    	source_open(File, [], SP0),
    	(
    	    fromto(begin, _, Class, end),
    	    fromto(SP0, SP1, SP2, SPend)
    	do
    	    source_read(SP1, SP2, Class, SourceTerm),
    	    SP1 = source_position{file:F,line:L,module:M},
    	    printf("%w %w:%d %w%n", [M,F,L,Class]),
    	    arg(term of source_term, SourceTerm, Term),
    	    writeclause(Term)
    	),
    	source_close(SPend, []).

## About

- Author: Joachim Schimpf, IC-Parc
- Copyright © Cisco Systems, Inc
- Date: $Date: 2017/08/19 20:00:39 $

Generated from source_processor.eci on 2022-09-03 14:26