$old_buffer = searchbuffer; #old_option = searchoption; #basefile = hidemaruhandle(0); #base_x = x; #base_y = y; writeinistr "maruo.ini","Env","DupOpen","1"; envchanged; getsearch; escape; $strings = searchbuffer; #section_pos = strstr($strings, " \\S "); #ssection_pos = strstr($strings, " \\S\\S "); #blancket_pos = strstr($strings, "("); #comma_pos = strstr($strings, ","); #usc = strstr($strings, "U.S.C."); #us = strstr($strings, "U.S."); #sct = strstr($strings, "S. Ct."); #sec = strstr($strings, "Sec. "); #html = strstr($strings, "http"); #publ = strstr($strings, "Pub. L."); #fed = strstr($strings, "F."); if (#html >= 0) { run "c:\\network\\www\\netscape.exe " + $strings; endmacro; } if (#us < 0 && #sct < 0 && #html < 0 && #publ < 0 #fed < 0) { readonlyopenfile filename; } disabledraw; if (#blancket_pos == 0) { readonlyopenfile filename; $section = leftstr($strings, 3); $ssection = rightstr($strings, (strlen($strings) - 3)); moveto #base_x, #base_y; searchup "^[ `]*SEC.", casesense, regular; if (!result) gofiletop; searchdown "^[ `]*\\(" + $section, casesense, regular; } else if (#sec > -1) { $section = rightstr($strings, (strlen($strings) - 5)); gofiletop; searchdown "SEC. " + $section, casesense; } else if (#usc > 0) { if (#section_pos > 0) { #keyword_length = 10; } else if (#ssection_pos > 0) { #keyword_length = 12; } else { #keyword_length = 7; } call OpenDoc #usc, #keyword_length, #blancket_pos, ".cod"; $ssection = rightstr($strings, (strlen($strings) - #blancket_pos)); } else if (#us > 0) { call OpenDoc #us, 5, #comma_pos, ".cas"; } else if (#sct > 0) { call OpenDoc #sct, 7, #comma_pos, ".sct"; } else if (#publ > -1) { call OpenDoc #publ, 8, #comma_pos, ".pub"; } else if (#fed > 0) { #pos = #fed + 2; $ext = ".f" + midstr($strings, #pos, 2); if ($ext == ".fSu") { #length = 8; } else { #length = 5; } call OpenDoc #fed, #length, #comma_pos, $ext; } else { $section = leftstr($strings, #blancket_pos); $ssection = rightstr($strings, (strlen($strings) - #blancket_pos)); gofiletop; searchdown "SEC. " + $section + " "; } if (result && (#comma_pos < 0)) { while (strlen($ssection) > 0) { $section = leftstr ($ssection, 3); searchdown "^[ `]*\\(" + $section, casesense, regular; if (result == 0 && #usc < 0) call Fail; $ssection = rightstr($ssection, (strlen($ssection) - 3)); } } else if (result && (#comma_pos > 0)) { gofiletop; searchdown "[" + $ssection + "]", casesense; if (!result) call Fail; } else { call Fail; } setsearch $old_buffer, #old_option; writeinistr "maruo.ini","Env","DupOpen","2"; envchanged; enabledraw; endmacro; // OpenDoc <##Keyword position>,<##keyword length>,<##appendix position>,<$$ext> OpenDoc: $datapath = getenv("DATA"); $title = leftstr($strings, (##1 - 1)); ##1 = ##1 + ##2; if (#comma_pos) #pos = 2; if (##3 > 0) { $section = midstr($strings, ##1, (##3 - ##1)); $ssection = rightstr($strings, (strlen($strings) - ##3 - #pos)); } else { $section = rightstr($strings, (strlen($strings) - ##1)); } if ($title != "") { openfile "/r /j1 " + $datapath + $title + "-" + $section + $$4; } else { openfile "/r /j1 " + $datapath + $section + $$4; } return result; Fail: setactivehidemaru #basefile; closehidemaru 1; setsearch $old_buffer, #old_option; writeinistr "maruo.ini","Env","DupOpen","2"; envchanged; enabledraw; message "Search failed."; endmacro;