/**************************************************************************** ** PROJECT ** NEXTEXT ** ***************************************************************************** ** FUNCTION ** TAKES THE USER TO THE NEXT BUFFER WITH THE GIVEN EXTENSION ** ***************************************************************************** ** AUTHOR ** WARREN D HUMPHREYS ** ***************************************************************************** ** DATE ** MONDAY 21ST OCTOBER 1991 ** ***************************************************************************** ** COMMENTS ** ** ***************************************************************************** ** MODIFICATION HISTORY ** ***************************************************************************** ** DATE ** WHO ** CHANGED WHAT ** ***************************************************************************** ** ** ** ** ****************************************************************************/ /**************************************************************************** ** FUNCTION PROTOTYPES ** ****************************************************************************/ int NextExt(~string); extern _remove_newlines(); replacement _restore(); replacement _save_state(); /**************************************************************************** ** GLOBAL VARIABLES ** ****************************************************************************/ string ExtToFind; /**************************************************************************** ** ACTUAL FUNCTIONS ** ****************************************************************************/ int NextExt(~string) { int NewBuffID, ReturnCode, ThisBuffID; string ThisBuffExt, ThisFileName; ReturnCode=0; if (get_parm(0,ExtToFind,"Extension : ",3,ExtToFind)) { ExtToFind=upper(ExtToFind); ThisBuffID=inq_buffer(NULL); do { set_buffer(NewBuffID=next_buffer(0)); inq_names(ThisFileName,ThisBuffExt,NULL); } while ((NewBuffID!=ThisBuffID) && (ExtToFind!=upper(ThisBuffExt))); if (ExtToFind==upper(ThisBuffExt)) { edit_file(ThisFileName); ReturnCode=NewBuffID; } else { error("Couldn't find a buffer with the extension \".%s\"",ExtToFind); } } return(ReturnCode); } replacement _save_state() { insert("[NextExt]\n"); insert("ExtToFind=%s",_remove_newlines(ExtToFind)); returns(_save_state()); } replacement _restore() { top_of_buffer(); if (search_fwd("ExtToFind=\\c",1,NULL,NULL,NULL) > 0) ExtToFind=compress(ltrim(trim(read()))); returns(_restore()); }