1(*
2    Copyright (c) 2000
3        Cambridge University Technical Services Limited
4        
5    Modified David C. J. Matthews 2009-2015.
6
7    This library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Lesser General Public
9    License version 2.1 as published by the Free Software Foundation.
10    
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15    
16    You should have received a copy of the GNU Lesser General Public
17    License along with this library; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19*)
20
21signature VALUEOPSSIG =
22sig
23    type lexan
24    type codetree
25    type types
26    type values
27    type structVals
28    type functors
29    type valAccess
30    type typeConstrs
31    type typeConstrSet
32    type signatures
33    type fixStatus
34    type univTable
35    type pretty
36    type location =
37        { file: string, startLine: FixedInt.int, startPosition: FixedInt.int,
38          endLine: FixedInt.int, endPosition: FixedInt.int }
39    type locationProp
40    type typeId
41    type typeVarForm
42    type typeVarMap
43    type level
44    type machineWord
45
46    (* Construction functions. *)
47    val mkGvar:        string * types * codetree * locationProp list -> values
48    val mkValVar:      string * types * locationProp list -> values
49    val mkPattVar:     string * types * locationProp list -> values
50    val mkSelectedVar: values * structVals * locationProp list -> values
51    val mkGconstr:     string * types * codetree * bool * int * locationProp list -> values
52    val mkGex:         string * types * codetree * locationProp list -> values
53    val mkEx:          string * types * locationProp list -> values
54
55
56    type printTypeEnv =
57        { lookupType: string -> (typeConstrSet * (int->typeId) option) option,
58          lookupStruct: string -> (structVals * (int->typeId) option) option}
59
60    (* Print values. *)
61    val displayFixStatus:  fixStatus -> pretty
62    val displaySignatures: signatures * FixedInt.int * printTypeEnv -> pretty
63    val displayStructures: structVals * FixedInt.int * printTypeEnv -> pretty
64    val displayFunctors:   functors   * FixedInt.int * printTypeEnv -> pretty
65    val displayValues: values * FixedInt.int * printTypeEnv -> pretty
66    val printValues: values * FixedInt.int -> pretty
67
68    val codeStruct:     structVals * level -> codetree
69    val codeAccess:     valAccess  * level -> codetree
70    val codeVal:
71        values * level * typeVarMap * {value: types, equality: bool, printity: bool} list * lexan * location -> codetree
72    val codeExFunction: values * level * typeVarMap * types list * lexan * location -> codetree
73    val applyFunction:
74        values * codetree * level * typeVarMap * {value: types, equality: bool, printity: bool} list *
75            lexan * location -> codetree
76    val getOverloadInstance: string * types * bool -> codetree*string
77    val makeGuard:      values * types list * codetree * level * typeVarMap -> codetree 
78    val makeInverse:    values * types list * codetree * level * typeVarMap -> codetree
79                    
80    val lookupStructure:  string * {lookupStruct: string -> structVals option} * 
81                            string * (string -> unit) -> structVals option
82                                           
83    val lookupStructureAsSignature:
84        (string -> structVals option) *  string * (string -> unit) -> structVals option
85                                           
86    val lookupValue:   string * {lookupVal: string -> values option, lookupStruct: string -> structVals option} * 
87                          string * (string -> unit) -> values
88                                
89    val lookupTyp:   {lookupType: string -> typeConstrSet option,
90                      lookupStruct: string -> structVals option} * 
91                        string * (string -> unit) -> typeConstrSet
92
93    val makeSelectedValue: values * structVals -> values
94    and makeSelectedStructure: structVals * structVals -> structVals
95    and makeSelectedType: typeConstrSet * structVals -> typeConstrSet
96
97    val codeLocation: location -> codetree
98
99    val getPolymorphism: values * types * typeVarMap -> {value: types, equality: bool, printity: bool} list
100    
101    val getLiteralValue: values * string * types * (string->unit) -> machineWord option
102
103    (* Types that can be shared. *)
104    structure Sharing:
105    sig
106        type lexan          = lexan
107        type codetree       = codetree
108        type types          = types
109        type values         = values
110        type structVals     = structVals
111        type functors       = functors
112        type valAccess      = valAccess
113        type typeConstrs    = typeConstrs
114        type typeConstrSet  = typeConstrSet
115        type signatures     = signatures
116        type fixStatus      = fixStatus
117        type univTable      = univTable
118        type pretty         = pretty
119        type locationProp   = locationProp
120        type typeId         = typeId
121        type typeVarForm    = typeVarForm
122        type typeVarMap     = typeVarMap
123        type level          = level
124        type machineWord    = machineWord
125    end
126end;
127