00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <string.h>
00017 #include "../sexpress/sexpress.hpp"
00018 #include "../sexpress/shashtbl.hpp"
00019 #include "sreader.hpp"
00020
00021
00022 static SReference process_hashtable_seq(const SReference &ls)
00023 {
00024 SReference list(ls.Cdr());
00025
00026
00027 SString pred = list.Car()->TextRepresentation().c_str();
00028 SHashTableRef res;
00029 if(strcasecmp(pred.c_str(), "EQ") == 0)
00030 res = new SExpressionHashTable(SExprsAreEq);
00031 else
00032 if(strcasecmp(pred.c_str(), "EQL") == 0)
00033 res = new SExpressionHashTable(SExprsAreEql);
00034 else
00035 if(strcasecmp(pred.c_str(), "EQUAL") == 0)
00036 res = new SExpressionHashTable(SExprsAreEqual);
00037 else
00038 res = new SExpressionHashTable();
00039 list = list.Cdr();
00040
00041
00042 while(!list.IsEmptyList()) {
00043 res->AddItem(list.Car().Car(), list.Car().Cdr());
00044 list = list.Cdr();
00045 }
00046
00047 return res;
00048 }
00049
00050 void add_hashtables_to_reader(class IntelibReader &reader)
00051 {
00052 reader.AddSequenceOpener("#s(", process_hashtable_seq, ")");
00053 reader.AddSequenceOpener("#S(", process_hashtable_seq, ")");
00054 }