File: custom_streams.gd

package info (click to toggle)
gap 4.15.1-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 110,212 kB
  • sloc: ansic: 97,261; xml: 48,343; cpp: 13,946; sh: 4,900; perl: 1,650; javascript: 255; makefile: 252; ruby: 9
file content (111 lines) | stat: -rw-r--r-- 3,536 bytes parent folder | download | duplicates (2)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#############################################################################
##
##  This file is part of GAP, a system for computational discrete algebra.
##
##  Copyright of GAP belongs to its developers, whose names are too numerous
##  to list here. Please refer to the COPYRIGHT file for details.
##
##  SPDX-License-Identifier: GPL-2.0-or-later
##
##  Custom streams for HPC-GAP
##

#############################################################################
##
#R  IsInputTextCustomRep   (used for custom streams)
##
##  <ManSection>
##  <Filt Name="IsInputTextCustomRep" Arg='obj' Type='Representation'/>
##
##  <Description>
##  </Description>
##  </ManSection>
##
DeclareRepresentation(
    "IsInputTextCustomRep",
    IsComponentObjectRep,
    ["state", "read", "close", "buffer", "endofinput", "pos"] );


#############################################################################
##
#C  IsInputCustomStream( <obj> )  . . . . .  category of input custom streams
##
##  <#GAPDoc Label="IsInputCustomStream">
##  <ManSection>
##  <Filt Name="IsInputCustomStream" Arg='obj' Type='Category'/>
##
##  <Description>
##  All <E>custom</E> input streams lie in this category. They translate
##  new-line
##  characters read.
##  </Description>
##  </ManSection>
##  <#/GAPDoc>
##
DeclareCategory( "IsInputCustomStream", IsInputStream );


#############################################################################
##
#C  IsOutputCustomStream( <obj> ) . . . . . category of output custom streams
##
##  <#GAPDoc Label="IsOutputCustomStream">
##  <ManSection>
##  <Filt Name="IsOutputCustomStream" Arg='obj' Type='Category'/>
##
##  <Description>
##  All <E>custom</E> output streams lie in this category and translate
##  new-line characters on output.
##  </Description>
##  </ManSection>
##  <#/GAPDoc>
##
DeclareCategory( "IsOutputCustomStream", IsOutputStream );


#############################################################################
##
#O  InputTextCustom( <state>, <read>, <close> ) . . . . . . create input text
#O                              stream from state, read, and close functions.
##
##  <#GAPDoc Label="InputTextCustom">
##  <ManSection>
##  <Oper Name="InputTextCustom" Arg='state, read, close'/>
##
##  <Description>
##  <C>InputTextString( <A>state</A>, <A>read</A>, <A>close</A> )</C> returns
##  an input stream that
##  delivers the characters generated by the <A>read</A> function. The
##  <A>read</A> function is passed the <A>state</A> parameter as its
##  argument. When the stream is closed, <A>close</A> is called with
##  <A>state</a> as its argument.
##  </Description>
##  </ManSection>
##  <#/GAPDoc>
##
DeclareGlobalFunction( "InputTextCustom" );


#############################################################################
##
#O  OutputTextCustom( <state>, <write>, <close> )  . . . . . .  create custom
#O                                                         output text stream
##
##  <#GAPDoc Label="OutputTextCustom">
##  <ManSection>
##  <Oper Name="OutputTextCustom" Arg='state, write, close'/>
##
##  <Description>
##  returns an output stream that sends all received characters to the
##  <A>write</A> function. The <A>write</A> function is called with
##  <A>state</A> as its first parameter and a string containing characters
##  to be output as its second. The <A>close</A> function is called when
##  the stream is closed with <A>state</A> as its only argument.
##  </Description>
##  </ManSection>
##  <#/GAPDoc>
##
DeclareGlobalFunction( "OutputTextCustom" );