# #include "ioutil.h"

This page has information from files ioutil.h and ioutil.c.

## Contents

- Public Routines
- Public Definitions
- Introduction

## Public Routines in File ioutil.c

#### Index

clause_reader | fwrite_clause | parse_clause_from_string | read_term_list
clause_writer | fwrite_clause_clist | read_clause | sb_write_clause
end_of_commands_term | fwrite_clause_jmap | read_clause_clist | sb_write_clause_jmap
end_of_list_clause | fwrite_clause_list | read_clause_list | sb_xml_write_clause_jmap
end_of_list_formula | fwrite_demod_clist | read_clause_or_formula | term_reader
end_of_list_term | fwrite_formula | read_clause_or_formula_list | term_to_topform2
f_clause | fwrite_formula_list | read_formula | term_writer
f_clauses | fwrite_term_list | read_formula_list | zap_formula_list

#### Details

    Topform clause_reader(BOOL fast);

If your program has optional fast parsing/writing, you can use this routine to save a few lines of code. The flag "fast" says whether or not to use fast parse form. A clause is read from stdin (NULL if there are none). Errors are fatal.

    void clause_writer(Topform c, BOOL fast);

If your program has optional fast parsing/writing, you can use this routine to save a few lines of code. The flag "fast" says whether or not to use fast parse form. The clause is written to stdout, with a period and newline.

    BOOL end_of_commands_term(Term t);

Check if a term is the constant "end_of_commands".

    BOOL end_of_list_clause(Topform c);

    BOOL end_of_list_formula(Formula f);

    BOOL end_of_list_term(Term t);

Check if a term is the constant "end_of_list".

    void f_clause(Topform c);

Write a clause to stdout, with id, with justification last.

    void f_clauses(Plist p);

    void fwrite_clause(FILE *fp, Topform c, int format);

This routine prints (to FILE *fp) a clause in mixfix form, followed by ".\n".

    void fwrite_clause_clist(FILE *fp, Clist lst, int format);

This routine prints (to FILE *fp) a Clist of clauses in mixfix form. Example:

    list(sos).
    a = b.
    end_of_list.

If the name of the list is "", it is written as list(anonymous).

    void fwrite_clause_jmap(FILE *fp, Topform c, int format, I3list map)
    			;

This routine prints (to FILE *fp) a clause in mixfix form, followed by ".\n".

    void fwrite_clause_list(FILE *fp, Plist lst, char *name, int format);

This routine prints (to FILE *fp) a Plist of clauses in mixfix form. Example:

    list(sos).
    a = b.
    end_of_list.

If the name of the list is "", it is written as list(anonymous).

    void fwrite_demod_clist(FILE *fp, Clist lst, int format);

Similar to fwirte_clause_clist, except that lex-dep demodulators are noted.

    void fwrite_formula(FILE *fp, Formula f);

This routine prints a formula, followed by ".\n" to a file. This version does not print extra parentheses (it first translates the formula to a term, then prints the term, then frees the term). To print the formula directly, with extra parentheses, call fprint_formula() instead.

    void fwrite_formula_list(FILE *fp, Plist lst, char *name);

This routine prints (to FILE *fp) a list of formulas in mixfix form. Example:

    list(sos).
    a = b.
    end_of_list.

If the name of the list is "", it is written as list(anonymous).

    void fwrite_term_list(FILE *fp, Plist lst, char *name);

This routine prints (to FILE *fp) a list of terms in mixfix form. Example:

    list(sos).
    a = b.
    end_of_list.

If the name of the list is "" or NULL, it is written as list(anonymous).

    Topform parse_clause_from_string(char *s);

    Topform read_clause(FILE *fin, FILE *fout);

This routine reads a clause from FILE *fin. If there are no more clauses in *fin, NULL is returned.

If any error occurs, a message is sent to FILE *fout and a fatal_error occurs.

Variables are "set", and upward links are made from all subterms to the clause.

    Clist read_clause_clist(FILE *fin, FILE *fout, char *name, BOOL assign_id);

This routine reads a list of clauses from FILE *fin. If you wish the list to have a name, send a string; othersize send NULL. (You can name the list later with name_clist().) If there are no more clauses in *fin, an empty Clist is returned.

If any error occurs, a message is sent to FILE *fout and a fatal_error occurs.

    Plist read_clause_list(FILE *fin, FILE *fout, BOOL assign_id);

Read clauses, up to end_of_list (or EOF), and return them in a Plist.

    Topform read_clause_or_formula(FILE *fin, FILE *fout);

    Plist read_clause_or_formula_list(FILE *fin, FILE *fout);

    Formula read_formula(FILE *fin, FILE *fout);

This routine reads a formula from FILE *fin. If there are no more formulas in *fin, NULL is returned.

If any error occurs, a message is sent to FILE *fout and a fatal_error occurs.

    Plist read_formula_list(FILE *fin, FILE *fout);

This routine reads a list of formulas from FILE *fin. If there are no more formulas in *fin, NULL is returned.

If any error occurs, a message is sent to FILE *fout and a fatal_error occurs.

    Plist read_term_list(FILE *fin, FILE *fout);

This routine reads a list of terms from FILE *fin. If there are no more terms in *fin, NULL is returned.

None of the returned terms or their subterms will have type VARIABLE, even if it looks like a variable (e.g., x).

If any error occurs, a message is sent to FILE *fout and a fatal_error occurs.

    void sb_write_clause(String_buf sb, Topform c, int format);

This routine prints (to FILE *fp) a clause in mixfix form, followed by ".\n".

    void sb_write_clause_jmap(String_buf sb, Topform c,
    			  int format,
    			  I3list map);

This routine writes a clause (in mixfix form, with ".\n") to a String_buf.

    void sb_xml_write_clause_jmap(String_buf sb, Topform c, I3list map);

This routine writes a clause (in mixfix form, with ".\n") to a String_buf. It is written in XML format.

    Term term_reader(BOOL fast);

If your program has optional fast parsing/writing, you can use this routine to save a few lines of code. The flag "fast" says whether or not to use fast parse form. A term is read from stdin (NULL if there are none). Errors are fatal.

    Topform term_to_topform2(Term t);

    void term_writer(Term t, BOOL fast);

If your program has optional fast parsing/writing, you can use this routine to save a few lines of code. The flag "fast" says whether or not to use fast parse form. The term is written to stdout, with a period and newline.

    void zap_formula_list(Plist lst);

Free a Plist of formulas.

## Public Definitions in File ioutil.h

    enum { CL_FORM_STD,
           CL_FORM_BARE,
           CL_FORM_PARENTS,
           CL_FORM_XML,
           CL_FORM_IVY};  /* clause print format */

## Introduction