Commit d7e45c07 authored by John Beranek's avatar John Beranek
Browse files

* Improved namespacing of functions throughout remotedb. External functions...

* Improved namespacing of functions throughout remotedb.  External functions weren't able to be renamed, so as not to break compatability with programs that use remotedb

 * Added a new API call "remote_debug_print_line".  It is similar to
   "debug_print_line", except that it takes flags, and you can pass the
   length of the line you want to output (so you can pass non-NULL
   terminated strings).  The one used bit in the flag is bit 1, which if
   set means that the debug output should be "raw", i.e. bypass the
   priority code, and not force a \n at the end of the line.  The next
   DebugLib version (0.38) will use this raw mode.

 * Renamed the remotedb_version function to remote_debug_version to better
   fit the namespacing of the rest of the (correctly namespaced) API calls.
   Compatability shouldn't be too much of a concern, because it's a new
   API call, which very few people will be using.

 * Added -throwback into !Mk and !MkExport

 * Changed C flags to -ffah, to stop function name embedding...this was
   causing problems with using DebugLib Trace output with remotedb.


Version 0.06. Tagged as 'remotedb-0_06'
parent 08463c6c
......@@ -13,4 +13,4 @@
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine all
amu_machine THROWBACK=-throwback all
......@@ -13,5 +13,5 @@
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine export_hdrs
amu_machine export_libs
amu_machine THROWBACK=-throwback export_hdrs
amu_machine THROWBACK=-throwback export_libs
......@@ -48,8 +48,8 @@ INETLIB = TCPIPLibs:o.inetlib
DEBUGLIB = <Lib$Dir>.debug
CFLAGS = -c -depend !Depend -Wap -zps0 ${INCLUDES} ${THROWBACK} -fah -Fn ${DFLAGS}
CFLAGSZM = -c -depend !Depend -Wap -zps0 ${INCLUDES} ${THROWBACK} -fah -Fn ${DFLAGS} -zM
CFLAGS = -c -depend !Depend -Wap -zps0 ${INCLUDES} ${THROWBACK} -ffah ${DFLAGS}
CFLAGSZM = -c -depend !Depend -Wap -zps0 ${INCLUDES} ${THROWBACK} -ffah ${DFLAGS} -zM
CPFLAGS = ~cfr~v
WFLAGS = ~c~v
......
/* (0.05)
/* (0.06)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.05
#define Module_MajorVersion_CMHG 0.06
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 24 May 1999
#define Module_Date_CMHG 26 May 1999
#define Module_MajorVersion "0.05"
#define Module_Version 5
#define Module_MajorVersion "0.06"
#define Module_Version 6
#define Module_MinorVersion ""
#define Module_Date "24 May 1999"
#define Module_Date "26 May 1999"
#define Module_FullVersion "0.05"
#define Module_FullVersion "0.06"
......@@ -39,25 +39,18 @@
#include "VersionNum"
/* If macro value is empty, expression rewrites to "0 * + 1" which is zero. */
#if 0 * Module_MinorVersion_CMHG + 1 == 0
# define VSN Module_MajorVersion
#else
# define VSN Module_MajorVersion " " Module_MinorVersion
#endif
static const char REMOTE_DEBUG_VERSION[] = VSN;
static const char REMOTE_DEBUG_VERSION[] = Module_FullVersion;
#define REMOTE_DEBUG_MAX_LINE (10*1024)
static int poll=1;
static int remote_debug_poll=1;
static char *debug_line = NULL;
/*
* compare two strings caselessly
*/
static int
caseless_strcmp(char *a, char *b)
remote_debug_caseless_strcmp(char *a, char *b)
{
int d;
......@@ -87,7 +80,7 @@ debug_poll(debug_session *sess)
if (!sess)
return (0);
poll=0; /* don't poll during debug_printf */
remote_debug_poll=0; /* don't poll during debug_printf */
do
{
......@@ -133,7 +126,7 @@ debug_poll(debug_session *sess)
*/
if (argc == 0 || argv[0][0]=='#' || argv[0][0] == 0) /* ignore comments */
;
else if (caseless_strcmp(argv[0],"PRIORITY")==0)
else if (remote_debug_caseless_strcmp(argv[0],"PRIORITY")==0)
{
if (argc>1)
{
......@@ -153,7 +146,7 @@ debug_poll(debug_session *sess)
rc = sess->cmd_handler(argc, argv, sess->cmd_handle);
debug_printf(sess,"(6) cmd '%s' returns %d\n", name, rc);
}
else if (caseless_strcmp(argv[0], ":ack")==0)
else if (remote_debug_caseless_strcmp(argv[0], ":ack")==0)
{
/* Discard these silently */
}
......@@ -170,7 +163,7 @@ debug_poll(debug_session *sess)
}
} while (more);
poll=1; /* return to polling during debug_printf */
remote_debug_poll=1; /* return to polling during debug_printf */
return (0);
}
......@@ -213,31 +206,55 @@ debug_dvprintf(debug_session *sess, int priority, const char *file, int line, co
debug_print_line(sess, debug_line);
}
void
debug_print_line(debug_session *sess, const char *line)
{
remote_debug_print_line (0u, sess, line, strlen (line));
}
void
debug_print_line(debug_session *sess, const char *debug_line)
remote_debug_print_line (unsigned int flags, debug_session *sess, const char *line, size_t len)
{
unsigned char priority=7;
unsigned char priority = 7;
if (!sess)
return;
if (poll)
if (remote_debug_poll)
debug_poll(sess);
if (debug_line[0]=='(') /* get opening bracket */
if (strchr(debug_line,')')!=NULL) /* find closing bracket */
priority=atoi(debug_line+1);
if (priority<=sess->priority)
/* Not raw */
if ((flags & 1) == 0)
{
send(sess->sock, sess->info, strlen(sess->info), 0);
send(sess->sock, debug_line, strlen(debug_line), 0);
/* Get opening bracket */
if (line[0]=='(')
{
/* Find closing bracket */
if (strchr (line,')') != NULL)
priority = atoi (line+1);
}
/* If we're masking this line out, just return */
if (priority > sess->priority)
return;
/* Send the info string to the socket */
send (sess->sock, sess->info, strlen (sess->info), 0);
}
if (debug_line[strlen(debug_line)-1]!='\n')
send(sess->sock, "\n", 1, 0);
/* Send the actual debug data */
send (sess->sock, line, len, 0);
/* Not raw */
if ((flags & 1) == 0)
{
/* And if we're not in raw mode, output a \n if the debug data doesn't end with one */
if (line[len-1] != '\n')
send (sess->sock, "\n", strlen ("\n"), 0);
}
}
void
remote_debug_register_cmd_handler(debug_session *sess, remote_debug_cmd_handler fn, void *handle)
{
......@@ -390,8 +407,7 @@ remote_debug_close(debug_session *sess)
}
const char *remotedb_version (void)
const char *remote_debug_version (void)
{
return REMOTE_DEBUG_VERSION;
}
......@@ -65,7 +65,9 @@ void remote_debug_open(char *info, debug_session **sess);
void debug_printf(debug_session *sess, char *format, ...);
void debug_vprintf(debug_session *sess, const char *format, va_list list);
void debug_dvprintf(debug_session *sess, int priority, const char *file, int line, const char *format, va_list list);
void debug_print_line(debug_session *sess, const char *debug_line);
void debug_print_line(debug_session *sess, const char *line);
void remote_debug_print_line (unsigned int flags, debug_session *sess, const char *line, size_t len);
/*
* Register a command handler to handle commands sent from the server
......@@ -83,7 +85,7 @@ void remote_debug_close(debug_session *sess);
*/
int debug_poll(debug_session *sess);
const char *remotedb_version (void);
const char *remote_debug_version (void);
#else
......@@ -91,8 +93,9 @@ const char *remotedb_version (void);
#define debug_printf 1?0:printf
#define debug_vprintf(s,f,l)
#define debug_print_line(s,d)
#define remote_debug_print_line(f,s,l,le)
#define remote_debug_close(x)
#define remotedb_version()
#define remote_debug_version()
#endif /* REMOTE_DEBUG */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment