Add missing documentation
This commit is contained in:
@@ -30,8 +30,8 @@ static char SccsId[] = "%W% %G%";
|
||||
|
||||
|
||||
/**
|
||||
* @group
|
||||
*
|
||||
* @defgroup Aliases
|
||||
* @ingroup InputOutput
|
||||
*
|
||||
* Aliases:
|
||||
* This file defines the main operations on aliases, a second name for a file. Aliases are always
|
||||
|
@@ -601,7 +601,7 @@ static Int put_char(USES_REGS1) { /* '$put'(Stream,N) */
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/** @pred tab(+ _N_)
|
||||
/** @pred tab_1(+ _N_)
|
||||
|
||||
|
||||
Outputs _N_ spaces to the current output stream.
|
||||
|
@@ -31,6 +31,10 @@ static char SccsId[] = "%W% %G%";
|
||||
|
||||
|
||||
/// @addtogroup CharProps
|
||||
/**
|
||||
* @defgroup CharIO Character-Based Input/Output
|
||||
* @ingroup InputOutput
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file includes the definition of a character properties.
|
||||
|
28
os/console.c
28
os/console.c
@@ -18,9 +18,20 @@
|
||||
static char SccsId[] = "%W% %G%";
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file console.c
|
||||
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
|
||||
* @date Wed Jan 20 00:56:23 2016
|
||||
*
|
||||
* @brief
|
||||
*
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* This file includes the interface to the console IO, tty style. Refer also to the readline library.
|
||||
*
|
||||
* @defgroup console Support for console-based interaction.
|
||||
* @ingroup InputOutput
|
||||
|
||||
*/
|
||||
|
||||
#include "Yap.h"
|
||||
@@ -181,6 +192,13 @@ ConsoleGetc(int sno)
|
||||
return console_post_process_read_char(ch, s);
|
||||
}
|
||||
|
||||
/** @pred prompt1(+ _A__)
|
||||
|
||||
|
||||
Changes YAP input prompt for the .
|
||||
|
||||
|
||||
*/
|
||||
|
||||
static Int
|
||||
prompt1 ( USES_REGS1 )
|
||||
@@ -198,7 +216,13 @@ prompt1 ( USES_REGS1 )
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/** @pred prompt(- _A_,+ _B_)
|
||||
|
||||
|
||||
Changes YAP input prompt from _A_ to _B_, active on *next* standard input interaction.
|
||||
|
||||
|
||||
*/
|
||||
static Int
|
||||
prompt ( USES_REGS1 )
|
||||
{ /* prompt(Old,New) */
|
||||
@@ -211,7 +235,7 @@ prompt ( USES_REGS1 )
|
||||
a = AtomOfTerm (t);
|
||||
if (strlen(RepAtom (a)->StrOfAE) > MAX_PROMPT) {
|
||||
Yap_Error(SYSTEM_ERROR_INTERNAL,t,"prompt %s is too long", RepAtom (a)->StrOfAE);
|
||||
return(FALSE);
|
||||
return false;
|
||||
}
|
||||
strncpy(LOCAL_Prompt, (char *)RepAtom (LOCAL_AtPrompt)->StrOfAE, MAX_PROMPT);
|
||||
LOCAL_AtPrompt = a;
|
||||
|
81
os/edio.yap
81
os/edio.yap
@@ -1,7 +1,37 @@
|
||||
%
|
||||
% Edinburgh IO.
|
||||
/**
|
||||
* @file edio.yap
|
||||
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
|
||||
* @date Wed Jan 20 01:07:02 2016
|
||||
*
|
||||
* @brief Input/Output according to the DEC-10 Prolog. PLease consider using the ISO
|
||||
* standard predicates for new code.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
%
|
||||
|
||||
/** @pred see(+ _S_)
|
||||
|
||||
|
||||
If _S_ is a currently opened input stream then it is assumed to be
|
||||
the current input stream. If _S_ is an atom it is taken as a
|
||||
filename. If there is no input stream currently associated with it, then
|
||||
it is opened for input, and the new input stream thus created becomes
|
||||
the current input stream. If it is not possible to open the file, an
|
||||
error occurs. If there is a single opened input stream currently
|
||||
associated with the file, it becomes the current input stream; if there
|
||||
are more than one in that condition, then one of them is chosen.
|
||||
|
||||
When _S_ is a stream not currently opened for input, an error may be
|
||||
reported, depending on the state of the `file_errors` flag. If
|
||||
_S_ is neither a stream nor an atom the predicates just fails.
|
||||
|
||||
|
||||
*/
|
||||
see(user) :- !, set_input(user_input).
|
||||
see(F) :- var(F), !,
|
||||
'$do_error'(instantiation_error,see(F)).
|
||||
@@ -13,6 +43,13 @@ see(Stream) :- '$stream'(Stream), current_stream(_,read,Stream), !,
|
||||
set_input(Stream).
|
||||
see(F) :- open(F,read,Stream), set_input(Stream).
|
||||
|
||||
/** @pred seeing(- _S_)
|
||||
|
||||
|
||||
The current input stream is unified with _S_.
|
||||
|
||||
|
||||
*/
|
||||
seeing(File) :- current_input(Stream),
|
||||
stream_property(Stream,file_name(NFile)),
|
||||
(
|
||||
@@ -23,8 +60,33 @@ seeing(File) :- current_input(Stream),
|
||||
NFile = File
|
||||
).
|
||||
|
||||
/** @pred seen
|
||||
|
||||
|
||||
Closes the current input stream, as opened by see/1. Standard input
|
||||
stream goes to the original ùser_input`.
|
||||
|
||||
*/
|
||||
seen :- current_input(Stream), close(Stream), set_input(user).
|
||||
|
||||
/** @pred tell(+ _S_)
|
||||
|
||||
|
||||
If _S_ is a currently opened stream for output, it becomes the
|
||||
current output stream. If _S_ is an atom it is taken to be a
|
||||
filename. If there is no output stream currently associated with it,
|
||||
then it is opened for output, and the new output stream created becomes
|
||||
the current output stream. If it is not possible to open the file, an
|
||||
error occurs. If there is a single opened output stream currently
|
||||
associated with the file, then it becomes the current output stream; if
|
||||
there are more than one in that condition, one of them is chosen.
|
||||
|
||||
Whenever _S_ is a stream not currently opened for output, an error
|
||||
may be reported, depending on the state of the file_errors flag. The
|
||||
predicate just fails, if _S_ is neither a stream nor an atom.
|
||||
|
||||
|
||||
*/
|
||||
tell(user) :- !, set_output(user_output).
|
||||
tell(F) :- var(F), !,
|
||||
'$do_error'(instantiation_error,tell(F)).
|
||||
@@ -43,12 +105,29 @@ tell(Stream) :-
|
||||
tell(F) :-
|
||||
open(F,append,Stream),
|
||||
set_output(Stream).
|
||||
|
||||
|
||||
/** @pred telling(- _S_)
|
||||
|
||||
|
||||
The current output stream is unified with _S_.
|
||||
|
||||
|
||||
*/
|
||||
telling(File) :-
|
||||
current_output(Stream),
|
||||
stream_property(Stream,file_name(NFile)),
|
||||
( stream_property(user_output,file_name(NFile)) -> File = user ; File = NFile ).
|
||||
|
||||
/** @pred told
|
||||
|
||||
|
||||
Closes the current output stream, and the user's terminal becomes again
|
||||
the current output stream. It is important to remember to close streams
|
||||
after having finished using them, as the maximum number of
|
||||
simultaneously opened streams is 17.
|
||||
|
||||
|
||||
*/
|
||||
told :- current_output(Stream),
|
||||
!,
|
||||
set_output(user),
|
||||
|
@@ -239,6 +239,7 @@ Yap_GetStreamHandle(Term t)
|
||||
|
||||
#define YAP_ERROR NIL
|
||||
|
||||
/// maximum number of open streams
|
||||
#define MaxStreams 64
|
||||
|
||||
#define EXPAND_FILENAME 0x000080
|
||||
|
Reference in New Issue
Block a user