| |
| /pliant/fullpliant/this_computer.pli |
| |
| 1 |
abstract | |
| 2 |
[The definition of a computer] | |
| 3 |
doc | |
| 4 |
[The significant line is] | |
| 5 |
listing | |
| 6 |
field (Set (Set Set:Str)) env | |
| 7 |
[which means that that a computer is defined using a three stages directory.] ; eol | |
| 8 |
[You can think about it as a set of tables.] ; eol | |
| 9 |
para | |
| 10 |
italic [NB: ] | |
| 11 |
[I could have chosen a completely different implementation with many structures (one for the networking part, one for the partitions, ...), but I found the more abstract definition here more flexible. ] | |
| 12 |
[The key issue is that some external Pliant applications may want to have some per computer settings (think about the Win32 registery system) and this is a possible place for these. ] | |
| 13 |
[This three stages system is wild enough for most if not all possible uses, whereas a single stage system such as Unix environment would not be.] | |
| 14 |
| |
| 15 |
| |
| 16 |
submodule "/pliant/storage/database.pli" | |
| 17 |
module "/pliant/language/compiler.pli" | |
| 18 |
| |
| 19 |
public | |
| 20 |
| |
| 21 |
type ComputerContent | |
| 22 |
field Str component | |
| 23 |
field Str instance | |
| 24 |
| |
| 25 |
type ComputerForce | |
| 26 |
field Str category instance id value | |
| 27 |
| |
| 28 |
type Computer | |
| 29 |
field Set:ComputerContent content | |
| 30 |
field Set:ComputerForce force | |
| 31 |
field (Set (Set Set:Str)) env | |
| 32 |
field Str comment | |
| 33 |
| |
| 34 |
(gvar Database:Computer this_computer_database) load "security:/this_computer.pdb" | |
| 35 |
gvar Data:Computer this_computer :> this_computer_database data | |
| 36 |
| |
| 37 |
| |
| 38 |
method c '' category instance id -> value | |
| 39 |
arg_rw Data:Computer c ; arg Str category instance id ; arg Data:Str value | |
| 40 |
value :> c:env:category:instance:id | |
| 41 |
if not exists:value | |
| 42 |
c:env create category | |
| 43 |
c:env:category create instance | |
| 44 |
c:env:category:instance create id | |
| 45 |
value :> c:env:category:instance:id | |
| 46 |
| |
| 47 |
((the_function '' Data:Computer Str Str Str -> Data:Str) arg 4) access += access_result_consistent | |
| |