Category : Miscellaneous Language Source Code
Archive   : BAGTAG.ZIP
Filename : GOTO.CB
Output of file : GOTO.CB contained in archive : BAGTAG.ZIP
*
* goto.cb 21Mar93
*
* Pre-processor for goto_line, so that
* Esc kills the command
* entering a numeric string acts just like goto_line
* entering a non-numeric string "foo" acts like tag foo
* entering "+", "-" steps to next, previous function header
* Enter acts like ctag
*
* Contains macros:
* goto
*
* Copyright (c) 1992 B. Goldstein -- Pequod Software
*
* Change History (see also individual entries):
* Date Who What
* ------- --- -------------
* 17Nov92 BAG First draft
* 19Nov92 BAG Trim leading and trailing blanks from arg
* 21Nov92 BAG Add "-" and "+" to go to prior, subsequent function header
* 25Nov92 BAG Dropped cbrief.h for distribution
* 29Nov92 BAG Trim arg before checking it
* 21Mar93 BAG If shift key down, do goto column
*
****************************************************************************/
/* Definitions */
#include
/***************************************************************************/
/* Externals */
void ctag (void);
void tag (~string);
void center_line (void);
/***************************************************************************/
int goto (~string)
{ string _goto_arg;
global _goto_arg;
int retcode;
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/* First, see if "modified goto" */
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
if ((inq_kbd_flags () & (LEFT_SHIFT | RIGHT_SHIFT)))
{ int col;
if (get_parm (0, col, "Go to column: ") <= 0 || col == 0)
return (0);
move_abs (NULL, col);
return (1);
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/* "Un-modified" goto */
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
// Esc ==> get out
if (get_parm (0, _goto_arg,
"Go to line, function, or tag: ", NULL, _goto_arg) <= 0)
return (0);
_goto_arg = ltrim (trim (_goto_arg));
// No arg ==> ctag
if (strlen (_goto_arg) == 0)
{ ctag ();
return (1);
}
// Numeric arg ==> old goto_line
if (index ("0123456789", substr (_goto_arg, 1, 1)) != 0)
return (goto_line (atoi (_goto_arg)));
// search for a function definition
if (_goto_arg == "+" || _goto_arg == "-")
{ save_position ();
if (_goto_arg == "+")
{ next_char ();
retcode = search_fwd ("<[A-Za-z_.][~;\n]@([~;]@>");
}
else
{ prev_char ();
retcode = search_back ("<[A-Za-z_.][~;\n]@([~;]@>");
}
if (retcode <= 0)
{ restore_position (1);
message ("No %s function.",
((_goto_arg == "+") ? "next" : "prev"));
return (0);
}
else
{ restore_position (0);
center_line ();
message ("Found %s function.",
((_goto_arg == "+") ? "next" : "prev"));
return (1);
}
}
// Tag to explicit argument
tag (_goto_arg);
return (1);
}
/************************* end of goto.cb file *****************************/
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/