Files
TeslaRel410/sda4/BRIEF/MACROS/UTILS/NEXTEXT.CB
T
CydandClaude Fable 5 db7745fcd0 sda4: commit the Glaze developer hard-drive dump
Un-ignored: the dev drive is the ground truth the restoration and
emulator work constantly reference (DPL3/LIBDPL + VRENDER i860 renderer
source, BT/RP live+dev game trees, VGL_LABS pod boot, scene/audio
content). Kept in-repo for the pod-owner community.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-04 19:41:15 -05:00

87 lines
3.1 KiB
Plaintext

/****************************************************************************
** 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());
}