// WebXref.vdm - Create a cross reference of a website. // // Author: Scott Lambert // Last change: 22-Aug-97 // Last change: 05-May-2004 Christian Ziemski (for long filenames) // // Requires: VEDIT 5.00 or later. // Place this macro in the VEDIT Home Directory, e.g. c:\vedit. // // Description: Creates a report listing all .htm files in a website, // including .htm files in subdirectories, and all // and statements each .htm file contains. // The report is saved under the filename webxref.rpt in the // website directory. // // The macro prompts on the status line for the directory path // of the website. Enter the directory for the "top" of the // website, e.g. "c:\website". When done you will be looking // at the webxref.rpt file. // // From OS: vedit -x webxref // // From VEDIT: Select {MISC, Load/Execute macro}. Select filename // "webxref.vdm". Use default register number "100". // // OR: Add this function to the {USER} menu by adding these lines // to USER.MNU: // // 4 // WebXref // Call_File(122,"webxref.vdm") // // Resources: T-Regs 20-25 and Numeric-Regs 10-12 are modified. // //////////////// // // Get the website directory and test that it exists // get_input(20,"Enter Website Directory = ",nocr+statline) reg_set(21,@20) reg_set(21,"\*.*",append) file_exist(@21) if (return_value==0) { return } chdir(@20) reg_empty(21) // // Get a directory listing of all .htm files including those in subdirectories // reg_set(21,'"') // CZ++ reg_set(21,@20, APPEND) // CZ APPEND added //reg_set(21,"\*.htm -s",append) // CZ reg_set(21,'\*.htm" -s',append) // CZ #20=buf_free buf_switch(#20) file_save_as("webxref.tmp",ok+nomsg) out_ins() //dir("|@(21)",count,1) // CZ dir('|@(21)',count,1) // CZ out_ins(clear) reg_empty(21) // // Create empty report file webxref.rpt and other misc setup // #10=buf_free buf_switch(#10) #11=buf_free buf_switch(#11) ins_text("Vedit's Analysis of the Links on this Website") ins_newline(2) file_save_as("webxref.rpt",ok+nomsg) buf_switch(#20) begin_of_file() // // Search for and get the path information // repeat(all) { buf_switch(#20) search("Directory ",advance+noerr) if (error_match>0) { break } block_begin(cur_pos) block_end(eol_pos) reg_copy_block(22,block_begin,block_end) #21=cur_line // // Get a .htm file // repeat(all) { #21=#21+1 goto_line(#21) if (at_eof) { break } if (cur_char<33) { break } if (cur_char>126) { break } block_begin(bol_pos) block_end(eol_pos) reg_copy_block(23,block_begin,block_end) reg_set(24,@22) reg_set(24,"\",append) reg_set(24,@23,append) reg_empty(23) buf_switch(#10) file_open("|@(24)") // //search for each "A HREF" tag // begin_of_file() reg_set(25,pathname) buf_switch(#11) reg_ins(25) reg_empty(25) ins_newline(1) buf_switch(#10) #12=0 while(#12==0) { search("",advance+noerr) block_end(cur_pos) reg_copy_block(16,block_begin,block_end) buf_switch(#11) reg_ins(16) reg_empty(16) ins_newline(1) buf_switch(#10) } buf_switch(#10) block_begin(clear) // // Search for each "IMG SRC" tag. // begin_of_file() #12=0 while(#12==0) { search("",advance+noerr) block_end(cur_pos) reg_copy_block(16,block_begin,block_end) buf_switch(#11) reg_ins(16) reg_empty(16) ins_newline(1) buf_switch(#10) } buf_switch(#10) block_begin(clear) buf_empty(ok) buf_switch(#11) ins_newline(1) buf_switch(#20) } } // // Macro cleanup // buf_switch(#10) buf_quit(ok) buf_switch(#20) buf_quit(ok) file_delete("webxref.tmp",ok+noerr) buf_switch(#11) file_save(nomsg) begin_of_file() return