The Meta-Environment API
00001 #ifndef __SERIALIZATION_UTILS__ 00002 #define __SERIALIZATION_UTILS__ 00003 00004 #include <module-manager.tb> 00005 00006 process InitializeTermStore(Name: str) is 00007 if not-equal(Name, "") then 00008 snd-msg(register-termstore-name(Name)) 00009 . rec-msg(termstore-name-registered) 00010 . TermStoreActivation 00011 else 00012 tau 00013 fi 00014 00015 process TermStoreActivation is 00016 let 00017 Checking: bool, 00018 TermStoreContents: term, 00019 Summary: summary, 00020 ModuleNames: list, 00021 ModuleName: str, 00022 Name: str, 00023 Id: int, 00024 Pairs: list 00025 in 00026 Id := process-id 00027 . snd-note(ui-status(start(Id, "Load TermStore"))) 00028 . snd-msg(get-termstore-name) 00029 . rec-msg(termstore-name(Name?)) 00030 . snd-msg(io-exists-file(Name)) 00031 . 00032 ( 00033 rec-msg(io-file-exists) 00034 . snd-note(ui-status(stat(Id, "Retrieving saved term-store"))) 00035 . snd-msg(io-read-term(Name)) 00036 . 00037 ( 00038 rec-msg(io-term(TermStoreContents?)) 00039 . snd-msg(ts-load-snapshot(TermStoreContents)) 00040 . rec-msg(ts-snapshot-loaded) 00041 . snd-msg(get-all-module-names) 00042 . rec-msg(all-module-names(ModuleNames)) 00043 . snd-note(ui-status(stat(Id, 00044 "Checking consistency of term-store content"))) 00045 . 00046 if not-equal(ModuleNames, []) then 00047 ModuleName := first(ModuleNames) 00048 . ModuleNames := next(ModuleNames) 00049 . CheckModuleConsistency(ModuleName) 00050 fi 00051 * 00052 if equal(ModuleNames, []) then 00053 tau 00054 fi 00055 + 00056 rec-msg(io-error-reading(Summary?)) 00057 . printf("TODO: fix this error %t\n", Summary) 00058 ) 00059 . snd-note(ui-status(endstat(Id))) 00060 + 00061 rec-msg(io-file-not-exists) 00062 . snd-note(ui-status(errorf("Termstore %s does not exist!", [Name]))) 00063 ) 00064 . snd-note(ui-status(stop(Id))) 00065 endlet 00066 00067 process TermStoreName is 00068 let 00069 TermStoreName: str 00070 in 00071 TermStoreName := "meta.termstore" 00072 . 00073 ( 00074 rec-msg(register-termstore-name(TermStoreName?)) 00075 . snd-msg(termstore-name-registered) 00076 + 00077 rec-msg(get-termstore-name) 00078 . snd-msg(termstore-name(TermStoreName)) 00079 ) 00080 * 00081 delta 00082 endlet 00083 00084 #endif /* __SERIALIZATION_UTILS__ */