//===========================// //== This software is ==// //== (c)opyrighted in 1993 ==// //== by Chris Koeritz ==// //== cak0l@Virginia.EDU ==// //===========================// #include "tree_content.h" #include "guards.h" tree_content::tree_content (int token, const string &token_text, int line, int position) { my_line_number = line; my_position = position; my_token = token; my_token_text = token_text; } int tree_content::token() const { return my_token; } string tree_content::token_text() const { return my_token_text; } int tree_content::line_number() const { return my_line_number; } int tree_content::position() const { return my_position; } tree_content::~tree_content() {} /* struct tc_pack_blob { int charpos; int lineno; int tokelen; int token; }; byte *tree_content::pack(int &size) const { if (!it_is_lang()) deadly_error(NAME, "pack", "can only operate on language contents"); tc_pack_blob temp; temp.charpos = character_position; temp.lineno = line_number; temp.tokelen = a->token_text.length() + 1; temp.token = a->token; size = sizeof(tc_pack_blob) + temp.tokelen; byte *to_return = new byte[size]; typed_copy(&temp, to_return, tc_pack_blob); byte *to_stuff = to_return + sizeof(tc_pack_blob); mcopy((char *)a->token_text, to_stuff, temp.tokelen); return to_return; } packable *tree_content_unpack(byte *packed_form, int size) { (size?1:0); tc_pack_blob temp; typed_copy(packed_form, &temp, tc_pack_blob); lang_contents *to_stuff = new lang_contents; byte *stuffed = packed_form + sizeof(tc_pack_blob); to_stuff->token = temp.token; to_stuff->token_text = string((char *)stuffed); tree_content *to_return = new tree_content(to_stuff); to_return->character_position = temp.charpos; to_return->line_number = temp.lineno; to_return->kind = tree_content::LANG; return to_return; } */