Skip to content

Commit

Permalink
Fallback functionality if readline is not present.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed May 16, 2003
1 parent 1105801 commit 218d74f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
16 changes: 15 additions & 1 deletion vvp/config.h.in
Expand Up @@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: config.h.in,v 1.13 2003/03/13 20:31:40 steve Exp $"
#ident "$Id: config.h.in,v 1.14 2003/05/16 03:50:28 steve Exp $"
#endif

# define SIZEOF_UNSIGNED_LONG_LONG 0
Expand All @@ -35,6 +35,16 @@
# undef HAVE_GETOPT_H
# undef HAVE_MALLOC_H
# undef HAVE_LIBREADLINE
# undef HAVE_READLINE_READLINE_H
# undef HAVE_READLINE_HISTORY_H

/* Figure if I can use readline. */
#undef USE_READLINE
#ifdef HAVE_LIB_READLINE
#ifdef HAVE_READLINE_READLINE_H
# define USE_READLINE
#endif
#endif

#ifndef MODULE_DIR
# define MODULE_DIR "."
Expand Down Expand Up @@ -63,6 +73,7 @@ typedef unsigned long vvp_time64_t;
# undef HAVE_SYS_RESOURCE_H
# undef LINUX


/*
* When doing dynamic linking, we need a uniform way to identify the
* symbol. Some compilers put leading _, some trailing _. The
Expand All @@ -83,6 +94,9 @@ typedef unsigned long vvp_time64_t;

/*
* $Log: config.h.in,v $
* Revision 1.14 2003/05/16 03:50:28 steve
* Fallback functionality if readline is not present.
*
* Revision 1.13 2003/03/13 20:31:40 steve
* Warnings about long long time.
*
Expand Down
1 change: 1 addition & 0 deletions vvp/configure.in
Expand Up @@ -40,6 +40,7 @@ AC_CHECK_SIZEOF(unsigned)
# exist.
AC_CHECK_LIB(termcap, tputs)
AC_CHECK_LIB(readline, readline)
AC_CHECK_HEADERS(readline/readline.h readline/history.h)

# --
# Look for a dl library to use. First look for the standard dlopen
Expand Down
27 changes: 25 additions & 2 deletions vvp/stop.cc
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: stop.cc,v 1.7 2003/03/13 20:31:40 steve Exp $"
#ident "$Id: stop.cc,v 1.8 2003/05/16 03:50:28 steve Exp $"
#endif

/*
Expand All @@ -34,8 +34,10 @@
# include "schedule.h"
# include <stdio.h>
# include <ctype.h>
#ifdef HAVE_LIBREADLINE
#ifdef HAVE_READLINE_READLINE_H
# include <readline/readline.h>
#endif
#ifdef HAVE_READLINE_HISTORY_H
# include <readline/history.h>
#endif
# include <string.h>
Expand All @@ -46,6 +48,8 @@

struct __vpiScope*stop_current_scope = 0;

#ifdef USE_READLINE

static bool interact_flag = true;

static void cmd_call(unsigned argc, char*argv[])
Expand Down Expand Up @@ -409,7 +413,9 @@ void stop_handler(int rc)
first += 1;

if (first[0] != 0) {
#ifdef HAVE_READLINE_HISTORY
add_history(first);
#endif
invoke_command(first);
}

Expand All @@ -419,8 +425,25 @@ void stop_handler(int rc)
printf("** Continue **\n");
}

#else

void stop_handler(int rc)
{
printf("** VVP Stop(%d) **\n", rc);
printf("** Current simulation time is %" TIME_FMT "u ticks.\n",
schedule_simtime());

printf("** Interactive mode not supported, exiting simulation.\n");
exit(0);
}

#endif

/*
* $Log: stop.cc,v $
* Revision 1.8 2003/05/16 03:50:28 steve
* Fallback functionality if readline is not present.
*
* Revision 1.7 2003/03/13 20:31:40 steve
* Warnings about long long time.
*
Expand Down

0 comments on commit 218d74f

Please sign in to comment.