| |
| /pliant/storage/database/interface.pli |
| |
| 1 |
module "/pliant/language/compiler.pli" | |
| 2 |
module "prototype.pli" | |
| 3 |
| |
| 4 |
public | |
| 5 |
| |
| 6 |
gvar Relation data_interface_cache | |
| 7 |
gvar List data_interface_generators | |
| 8 |
| |
| 9 |
enumerated DataKind | |
| 10 |
data_undefined | |
| 11 |
data_field | |
| 12 |
data_record | |
| 13 |
data_set | |
| 14 |
| |
| 15 |
function data_kind t -> k | |
| 16 |
arg Type t ; arg DataKind k | |
| 17 |
if (t:flags .and. type_flag_field)<>0 | |
| 18 |
k := data_field | |
| 19 |
eif (t:flags .and. type_flag_record)<>0 | |
| 20 |
k := data_record | |
| 21 |
eif t:category="Set" | |
| 22 |
k := data_set | |
| 23 |
eif (t get_generic_method (the_function '. from string' Universal Str Str CBool Int Int -> Status):generic_index)<>(the_function '. from string' Universal Str Str CBool Int Int -> Status) | |
| 24 |
k := data_field | |
| 25 |
eif t:nb_fields>0 | |
| 26 |
k := data_record | |
| 27 |
else | |
| 28 |
k := data_field | |
| 29 |
| |
| 30 |
| |
| 31 |
function data_interface_prototype t f -> di | |
| 32 |
arg Type t ; arg Function f ; arg Link:DataInterface_ di | |
| 33 |
indirect | |
| 34 |
| |
| 35 |
constant genaddr addressof:data_interface_generators | |
| 36 |
| |
| 37 |
function data_interface t -> di | |
| 38 |
arg Type t ; arg Link:DataInterface_ di | |
| 39 |
if (data_interface_cache query addressof:t null)<>null | |
| 40 |
di :> (data_interface_cache query addressof:t null) map DataInterface_ | |
| 41 |
return | |
| 42 |
di :> null map DataInterface_ | |
| 43 |
var Pointer:List generators :> genaddr map List | |
| 44 |
var Pointer:Arrow c :> generators first | |
| 45 |
while c<>null and not exists:di | |
| 46 |
di :> data_interface_prototype t (c map Function) | |
| 47 |
if exists:di | |
| 48 |
data_interface_cache define addressof:t null addressof:di | |
| 49 |
return | |
| 50 |
c :> generators next c | |
| 51 |
| |
| 52 |
export data_interface | |
| |