void test_store(){ printf("--- testing store \n"); std::vector<BYTE> data; data.push_back( (BYTE) 0xde); data.push_back( (BYTE) 0xad); data.push_back( (BYTE) 0xbe); data.push_back( (BYTE) 0xef); std::string file_name1(".storage/test1.bin"); printf(" = creating file: %s\n", file_name1.c_str()); ps->store(std::string("test1.bin"), data); std::string file_name2(".storage/to_be_delete.txt"); printf(" = creating file: %s\n", file_name2.c_str()); std::vector<BYTE> data1; data1.push_back( (BYTE) 'A'); data1.push_back( (BYTE) 'B'); data1.push_back( (BYTE) 'C'); ps->store(std::string("to_be_delete.txt"), data1); printf("\n--- finished store test\n\n"); }
void Fpathname(CL_FORM *base) { COPY(ARG(0), ARG(1)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(2)); /* PATHNAME */ rt_struct_typep(ARG(1)); if(CL_TRUEP(ARG(1))) { COPY(ARG(0), ARG(1)); } else { COPY(ARG(0), ARG(1)); Fstringp(ARG(1)); if(CL_TRUEP(ARG(1))) { COPY(ARG(0), ARG(1)); LOAD_NIL(ARG(2)); COPY(SYMVAL(Slisp, 233), ARG(3)); /* *DEFAULT-PATHNAME-DEFAULTS* */ LOAD_FIXNUM(ARG(4), 0, ARG(4)); LOAD_NIL(ARG(5)); LOAD_NIL(ARG(6)); parse_namestring1(ARG(1)); mv_count = 1; } else { COPY(ARG(0), ARG(1)); LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(2)); /* STREAM */ rt_struct_typep(ARG(1)); if(CL_TRUEP(ARG(1))) { COPY(ARG(0), ARG(1)); LOAD_NIL(ARG(2)); file_name1(ARG(1)); COPY(SYMVAL(Slisp, 233), ARG(2)); /* *DEFAULT-PATHNAME-DEFAULTS* */ COPY(ARG(1), ARG(3)); LOAD_NIL(ARG(4)); COPY(ARG(2), ARG(5)); LOAD_FIXNUM(ARG(6), 0, ARG(6)); LOAD_NIL(ARG(7)); LOAD_NIL(ARG(8)); parse_namestring1(ARG(3)); mv_count = 1; COPY(ARG(3), ARG(1)); } else { LOAD_SMSTR((CL_FORM *)&KClisp[130], ARG(1)); /* etypecase: the value ~a is not a legal value */ COPY(ARG(0), ARG(2)); Ferror(ARG(1), 2); } } } COPY(ARG(1), ARG(0)); }
int main() { std::ifstream fin1, fin2, fin3; std::string file_name1("Doc.dat"), file_name2("Query.dat"); std::string file_name3("Doc2.dat"); std::string rele_file(""); StringSet Doc, Query; StringSet Doc2; Doc2 = Doc2.intoSet(fin3, file_name3); Doc = Doc.intoSet(fin1, file_name1); //Doc.Printer(); Query = Query.intoSet(fin2, file_name2); double sim = Doc.Sim(Query); double sim2 = Doc2.Sim(Query); int counted = Doc.CountSet(); int counted2 = Doc2.CountSet(); std::cout << "In " << file_name1 << " " << counted << " words." << std::endl; std::cout << "In " << file_name3 << " " << counted2 << " words." << std::endl; std::cout << "Relevence of first doc: " << sim << std::endl; std::cout << "Relevence of second doc: " << sim2 << std::endl; double Max; if(sim < sim2){ Max = sim2; rele_file = file_name3; } else{ Max = sim; rele_file = file_name1; } std::cout << rele_file << " is most relevant with: " << Max << std::endl; fin1.close(); fin2.close(); Doc.Clear(); Query.Clear(); return 0; }
void Fdirectory_namestring(CL_FORM *base) { COPY(ARG(0), ARG(1)); LOAD_SYMBOL(SYMBOL(Slisp, 232), ARG(2)); /* PATHNAME */ rt_struct_typep(ARG(1)); if(CL_TRUEP(ARG(1))) { COPY(ARG(0), ARG(1)); } else { COPY(ARG(0), ARG(1)); Fstringp(ARG(1)); if(CL_TRUEP(ARG(1))) { COPY(ARG(0), ARG(1)); LOAD_NIL(ARG(2)); COPY(SYMVAL(Slisp, 231), ARG(3)); /* *DEFAULT-PATHNAME-DEFAULTS* */ LOAD_SMALLFIXNUM(0, ARG(4)); LOAD_NIL(ARG(5)); LOAD_NIL(ARG(6)); parse_namestring1(ARG(1)); mv_count = 1; } else { COPY(ARG(0), ARG(1)); LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(2)); /* STREAM */ rt_struct_typep(ARG(1)); if(CL_TRUEP(ARG(1))) { COPY(ARG(0), ARG(1)); LOAD_NIL(ARG(2)); file_name1(ARG(1)); COPY(SYMVAL(Slisp, 231), ARG(2)); /* *DEFAULT-PATHNAME-DEFAULTS* */ LOAD_SMALLFIXNUM(0, ARG(3)); COPY(ARG(1), ARG(4)); LOAD_NIL(ARG(5)); COPY(ARG(2), ARG(6)); COPY(ARG(3), ARG(7)); LOAD_NIL(ARG(8)); LOAD_NIL(ARG(9)); parse_namestring1(ARG(4)); mv_count = 1; COPY(ARG(4), ARG(1)); } else { LOAD_SMSTR((CL_FORM *)&KClisp[94], ARG(1)); /* etypecase: the value ~a is not a legal value */ COPY(ARG(0), ARG(2)); Ferror(ARG(1), 2); } } } COPY(ARG(1), ARG(2)); Ppathname_host(ARG(2)); if(CL_TRUEP(ARG(2))) { COPY(ARG(1), ARG(0)); Ppathname_directory(ARG(0)); unparse_unix_directory_list(ARG(0)); } else { LOAD_SMSTR((CL_FORM *)&KClisp[92], ARG(0)); /* Cannot determine the namestring for pathnames with no host:~% ~S */ Ferror(ARG(0), 2); } }
void pathname_name1(CL_FORM *base) { COPY(ARG(0), ARG(2)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(3)); /* PATHNAME */ rt_struct_typep(ARG(2)); if(CL_TRUEP(ARG(2))) { COPY(ARG(0), ARG(2)); } else { COPY(ARG(0), ARG(2)); Fstringp(ARG(2)); if(CL_TRUEP(ARG(2))) { COPY(ARG(0), ARG(2)); LOAD_NIL(ARG(3)); COPY(SYMVAL(Slisp, 233), ARG(4)); /* *DEFAULT-PATHNAME-DEFAULTS* */ LOAD_FIXNUM(ARG(5), 0, ARG(5)); LOAD_NIL(ARG(6)); LOAD_NIL(ARG(7)); parse_namestring1(ARG(2)); mv_count = 1; } else { COPY(ARG(0), ARG(2)); LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(3)); /* STREAM */ rt_struct_typep(ARG(2)); if(CL_TRUEP(ARG(2))) { COPY(ARG(0), ARG(2)); LOAD_NIL(ARG(3)); file_name1(ARG(2)); COPY(SYMVAL(Slisp, 233), ARG(3)); /* *DEFAULT-PATHNAME-DEFAULTS* */ COPY(ARG(2), ARG(4)); LOAD_NIL(ARG(5)); COPY(ARG(3), ARG(6)); LOAD_FIXNUM(ARG(7), 0, ARG(7)); LOAD_NIL(ARG(8)); LOAD_NIL(ARG(9)); parse_namestring1(ARG(4)); mv_count = 1; COPY(ARG(4), ARG(2)); } else { LOAD_SMSTR((CL_FORM *)&Kpathname_name1[0], ARG(2)); /* etypecase: the value ~a is not a legal value */ COPY(ARG(0), ARG(3)); Ferror(ARG(2), 2); } } } COPY(ARG(2), ARG(3)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(4)); /* PATHNAME */ rt_struct_typep(ARG(3)); if(CL_TRUEP(ARG(3))) { COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 3 + 1), ARG(3)); } else { COPY(SYMVAL(Slisp, 352), ARG(3)); /* NO_STRUCT */ COPY(ARG(2), ARG(4)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5)); /* PATHNAME */ Ferror(ARG(3), 3); } if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 278)) /* COMMON */ { COPY(ARG(2), ARG(4)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5)); /* PATHNAME */ rt_struct_typep(ARG(4)); if(CL_TRUEP(ARG(4))) { COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 0 + 1), ARG(4)); } else { COPY(SYMVAL(Slisp, 352), ARG(4)); /* NO_STRUCT */ COPY(ARG(2), ARG(5)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(6)); /* PATHNAME */ Ferror(ARG(4), 3); } COPY(ARG(4), ARG(5)); LOAD_SYMBOL(SYMBOL(Slisp, 263), ARG(6)); /* HOST */ rt_struct_typep(ARG(5)); if(CL_TRUEP(ARG(5))) { COPY(OFFSET(AR_BASE(GET_FORM(ARG(4))), 6 + 1), ARG(4)); } else { COPY(SYMVAL(Slisp, 352), ARG(5)); /* NO_STRUCT */ COPY(ARG(4), ARG(6)); LOAD_SYMBOL(SYMBOL(Slisp, 263), ARG(7)); /* HOST */ Ferror(ARG(5), 3); } LOAD_BOOL(CL_SYMBOLP(ARG(4)) && GET_SYMBOL(ARG(4)) == SYMBOL(Slisp, 279), ARG(4)); /* LOWER */ } else { LOAD_NIL(ARG(4)); } maybe_diddle_case(ARG(3)); COPY(ARG(3), ARG(0)); }
void pathname_host1(CL_FORM *base) { COPY(ARG(0), ARG(2)); LOAD_SYMBOL(SYMBOL(Slisp, 232), ARG(3)); /* PATHNAME */ rt_struct_typep(ARG(2)); if(CL_TRUEP(ARG(2))) { COPY(ARG(0), ARG(2)); } else { COPY(ARG(0), ARG(2)); Fstringp(ARG(2)); if(CL_TRUEP(ARG(2))) { COPY(ARG(0), ARG(2)); LOAD_NIL(ARG(3)); COPY(SYMVAL(Slisp, 231), ARG(4)); /* *DEFAULT-PATHNAME-DEFAULTS* */ LOAD_SMALLFIXNUM(0, ARG(5)); LOAD_NIL(ARG(6)); LOAD_NIL(ARG(7)); parse_namestring1(ARG(2)); mv_count = 1; } else { COPY(ARG(0), ARG(2)); LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(3)); /* STREAM */ rt_struct_typep(ARG(2)); if(CL_TRUEP(ARG(2))) { COPY(ARG(0), ARG(2)); LOAD_NIL(ARG(3)); file_name1(ARG(2)); COPY(SYMVAL(Slisp, 231), ARG(3)); /* *DEFAULT-PATHNAME-DEFAULTS* */ LOAD_SMALLFIXNUM(0, ARG(4)); COPY(ARG(2), ARG(5)); LOAD_NIL(ARG(6)); COPY(ARG(3), ARG(7)); COPY(ARG(4), ARG(8)); LOAD_NIL(ARG(9)); LOAD_NIL(ARG(10)); parse_namestring1(ARG(5)); mv_count = 1; COPY(ARG(5), ARG(2)); } else { LOAD_SMSTR((CL_FORM *)&Kpathname_host1[0], ARG(2)); /* etypecase: the value ~a is not a legal value */ COPY(ARG(0), ARG(3)); Ferror(ARG(2), 2); } } } COPY(ARG(2), ARG(3)); LOAD_SYMBOL(SYMBOL(Slisp, 232), ARG(4)); /* PATHNAME */ rt_struct_typep(ARG(3)); if(CL_TRUEP(ARG(3))) { COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 0 + 1), ARG(0)); } else { COPY(SYMVAL(Slisp, 342), ARG(0)); /* NO_STRUCT */ COPY(ARG(2), ARG(1)); LOAD_SYMBOL(SYMBOL(Slisp, 232), ARG(2)); /* PATHNAME */ Ferror(ARG(0), 3); } }
void wild_pathname_p1(CL_FORM *base) { COPY(ARG(0), ARG(2)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(3)); /* PATHNAME */ rt_struct_typep(ARG(2)); if(CL_TRUEP(ARG(2))) { COPY(ARG(0), ARG(2)); } else { COPY(ARG(0), ARG(2)); Fstringp(ARG(2)); if(CL_TRUEP(ARG(2))) { COPY(ARG(0), ARG(2)); LOAD_NIL(ARG(3)); COPY(SYMVAL(Slisp, 233), ARG(4)); /* *DEFAULT-PATHNAME-DEFAULTS* */ LOAD_FIXNUM(ARG(5), 0, ARG(5)); LOAD_NIL(ARG(6)); LOAD_NIL(ARG(7)); parse_namestring1(ARG(2)); mv_count = 1; } else { COPY(ARG(0), ARG(2)); LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(3)); /* STREAM */ rt_struct_typep(ARG(2)); if(CL_TRUEP(ARG(2))) { COPY(ARG(0), ARG(2)); LOAD_NIL(ARG(3)); file_name1(ARG(2)); COPY(SYMVAL(Slisp, 233), ARG(3)); /* *DEFAULT-PATHNAME-DEFAULTS* */ COPY(ARG(2), ARG(4)); LOAD_NIL(ARG(5)); COPY(ARG(3), ARG(6)); LOAD_FIXNUM(ARG(7), 0, ARG(7)); LOAD_NIL(ARG(8)); LOAD_NIL(ARG(9)); parse_namestring1(ARG(4)); mv_count = 1; COPY(ARG(4), ARG(2)); } else { LOAD_SMSTR((CL_FORM *)&Kwild_pathname_p1[0], ARG(2)); /* etypecase: the value ~a is not a legal value */ COPY(ARG(0), ARG(3)); Ferror(ARG(2), 2); } } } if(CL_TRUEP(ARG(1))) { if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 251)) /* HOST */ { COPY(ARG(2), ARG(3)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(4)); /* PATHNAME */ rt_struct_typep(ARG(3)); if(CL_TRUEP(ARG(3))) { COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 0 + 1), ARG(3)); } else { COPY(SYMVAL(Slisp, 352), ARG(3)); /* NO_STRUCT */ COPY(ARG(2), ARG(4)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5)); /* PATHNAME */ Ferror(ARG(3), 3); } COPY(ARG(3), ARG(0)); LOAD_SYMBOL(SYMBOL(Slisp, 250), ARG(1)); /* PATTERN */ rt_struct_typep(ARG(0)); } else { if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 252)) /* DEVICE */ { COPY(ARG(2), ARG(3)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(4)); /* PATHNAME */ rt_struct_typep(ARG(3)); if(CL_TRUEP(ARG(3))) { COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 0 + 1), ARG(3)); } else { COPY(SYMVAL(Slisp, 352), ARG(3)); /* NO_STRUCT */ COPY(ARG(2), ARG(4)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5)); /* PATHNAME */ Ferror(ARG(3), 3); } COPY(ARG(3), ARG(0)); LOAD_SYMBOL(SYMBOL(Slisp, 250), ARG(1)); /* PATTERN */ rt_struct_typep(ARG(0)); } else { if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 253)) /* DIRECTORY */ { LOAD_GLOBFUN(&Cpattern_p, ARG(3)); COPY(ARG(2), ARG(4)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5)); /* PATHNAME */ rt_struct_typep(ARG(4)); if(CL_TRUEP(ARG(4))) { COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 2 + 1), ARG(4)); } else { COPY(SYMVAL(Slisp, 352), ARG(4)); /* NO_STRUCT */ COPY(ARG(2), ARG(5)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(6)); /* PATHNAME */ Ferror(ARG(4), 3); } Fsome(ARG(3), 2); COPY(ARG(3), ARG(0)); } else { if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 254)) /* NAME */ { COPY(ARG(2), ARG(3)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(4)); /* PATHNAME */ rt_struct_typep(ARG(3)); if(CL_TRUEP(ARG(3))) { COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 3 + 1), ARG(3)); } else { COPY(SYMVAL(Slisp, 352), ARG(3)); /* NO_STRUCT */ COPY(ARG(2), ARG(4)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5)); /* PATHNAME */ Ferror(ARG(3), 3); } COPY(ARG(3), ARG(0)); LOAD_SYMBOL(SYMBOL(Slisp, 250), ARG(1)); /* PATTERN */ rt_struct_typep(ARG(0)); } else { if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 80)) /* TYPE */ { COPY(ARG(2), ARG(3)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(4)); /* PATHNAME */ rt_struct_typep(ARG(3)); if(CL_TRUEP(ARG(3))) { COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 4 + 1), ARG(3)); } else { COPY(SYMVAL(Slisp, 352), ARG(3)); /* NO_STRUCT */ COPY(ARG(2), ARG(4)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5)); /* PATHNAME */ Ferror(ARG(3), 3); } COPY(ARG(3), ARG(0)); LOAD_SYMBOL(SYMBOL(Slisp, 250), ARG(1)); /* PATTERN */ rt_struct_typep(ARG(0)); } else { if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 255)) /* VERSION */ { COPY(ARG(2), ARG(3)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(4)); /* PATHNAME */ rt_struct_typep(ARG(3)); if(CL_TRUEP(ARG(3))) { COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 5 + 1), ARG(3)); } else { COPY(SYMVAL(Slisp, 352), ARG(3)); /* NO_STRUCT */ COPY(ARG(2), ARG(4)); LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5)); /* PATHNAME */ Ferror(ARG(3), 3); } LOAD_BOOL(CL_SYMBOLP(ARG(3)) && GET_SYMBOL(ARG(3)) == SYMBOL(Slisp, 271), ARG(0)); /* WILD */ } else { LOAD_SMSTR((CL_FORM *)&Kwild_pathname_p1[2], ARG(0)); /* ecase: the value ~a is not a legal value */ Ferror(ARG(0), 2); } } } } } } } else { COPY(ARG(2), ARG(3)); LOAD_SYMBOL(SYMBOL(Slisp, 251), ARG(4)); /* HOST */ wild_pathname_p1(ARG(3)); if(CL_TRUEP(ARG(3))) { COPY(ARG(3), ARG(0)); } else { COPY(ARG(2), ARG(4)); LOAD_SYMBOL(SYMBOL(Slisp, 252), ARG(5)); /* DEVICE */ wild_pathname_p1(ARG(4)); if(CL_TRUEP(ARG(4))) { COPY(ARG(4), ARG(0)); } else { COPY(ARG(2), ARG(5)); LOAD_SYMBOL(SYMBOL(Slisp, 253), ARG(6)); /* DIRECTORY */ wild_pathname_p1(ARG(5)); if(CL_TRUEP(ARG(5))) { COPY(ARG(5), ARG(0)); } else { COPY(ARG(2), ARG(6)); LOAD_SYMBOL(SYMBOL(Slisp, 254), ARG(7)); /* NAME */ wild_pathname_p1(ARG(6)); if(CL_TRUEP(ARG(6))) { COPY(ARG(6), ARG(0)); } else { COPY(ARG(2), ARG(7)); LOAD_SYMBOL(SYMBOL(Slisp, 80), ARG(8)); /* TYPE */ wild_pathname_p1(ARG(7)); if(CL_TRUEP(ARG(7))) { COPY(ARG(7), ARG(0)); } else { COPY(ARG(2), ARG(0)); LOAD_SYMBOL(SYMBOL(Slisp, 255), ARG(1)); /* VERSION */ wild_pathname_p1(ARG(0)); } } } } } } }