Mercurial > hg > octave-nkf
changeset 1426:29f274b42cb1
[project @ 1995-09-19 03:41:32 by jwe]
author | jwe |
---|---|
date | Tue, 19 Sep 1995 03:48:06 +0000 |
parents | c194fa377970 |
children | a2305feef016 |
files | config.h.bot src/error.h src/file-io.cc src/toplev.h src/utils.h |
diffstat | 5 files changed, 19 insertions(+), 100 deletions(-) [+] |
line wrap: on
line diff
--- a/config.h.bot +++ b/config.h.bot @@ -1,6 +1,12 @@ #if defined (__GNUC__) -#define UNUSED +#define UNUSED /* waiting for this to work with g++ */ #else #define UNUSED #endif + +#if defined __GNUC__ +#define NORETURN __attribute__ ((__noreturn__)) +#else +#define NORETURN +#endif
--- a/src/error.h +++ b/src/error.h @@ -28,19 +28,14 @@ panic ("impossible state reached in file `%s' at line %d", \ __FILE__, __LINE__) -// Tell g++ that panic doesn't return; - -#ifdef __GNUG__ -typedef void v_fcn_cpc_x (const char *, ...); -volatile v_fcn_cpc_x panic; -#endif +class string; extern void message (const char *name, const char *fmt, ...); extern void usage (const char *fmt, ...); extern void warning (const char *fmt, ...); extern void error (const char *fmt, ...); extern void parse_error (const char *fmt, ...); -extern void panic (const char *fmt, ...); +extern void panic (const char *fmt, ...) NORETURN; // Current error state. extern int error_state;
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -54,6 +54,7 @@ #include "defun.h" #include "error.h" +#include "file-info.h" #include "file-io.h" #include "help.h" #include "input.h" @@ -81,75 +82,6 @@ // double linked list containing relevant information about open files static DLList <file_info> file_list; -file_info::file_info (void) -{ - file_number = -1; - file_name = 0; - file_fptr = 0; - file_mode = 0; -} - -file_info::file_info (int n, const char *nm, FILE *t, const char *md) -{ - file_number = n; - file_name = strsave (nm); - file_fptr = t; - file_mode = strsave (md); -} - -file_info::file_info (const file_info& f) -{ - file_number = f.file_number; - file_name = strsave (f.file_name); - file_fptr = f.file_fptr; - file_mode = strsave (f.file_mode); -} - -file_info& -file_info::operator = (const file_info& f) -{ - if (this != & f) - { - file_number = f.file_number; - delete [] file_name; - file_name = strsave (f.file_name); - file_fptr = f.file_fptr; - delete [] file_mode; - file_mode = strsave (f.file_mode); - } - return *this; -} - -file_info::~file_info (void) -{ - delete [] file_name; - delete [] file_mode; -} - -int -file_info::number (void) const -{ - return file_number; -} - -const char * -file_info::name (void) const -{ - return file_name; -} - -FILE * -file_info::fptr (void) const -{ - return file_fptr; -} - -const char * -file_info::mode (void) const -{ - return file_mode; -} - void initialize_file_io (void) { @@ -177,7 +109,7 @@ { const char *file_name = arg.string_value (); file = file_list (p); - if (strcmp (file.name (), file_name) == 0) + if (file.name () == file_name) return p; file_list.next (p); } @@ -230,7 +162,7 @@ for (int i = 0; i < file_count; i++) { file_from_list = file_list (p); - if (strcmp (file_from_list.name (), name) == 0) + if (file_from_list.name () == name) return p; file_list.next (p); } @@ -334,7 +266,7 @@ file_info file = file_list (p); - if (strcmp (file.mode (), "r") == 0) + if (file.mode () == "r") { warning ("can't flush an input stream"); return retval; @@ -613,8 +545,8 @@ for (int i = 0; i < file_count; i++) { file_info file = file_list (p); - output_buf.form ("%7d%6s %s\n", file.number (), file.mode (), - file.name ()); + output_buf.form ("%7d%6s %s\n", file.number (), + file.mode ().data (), file.name ().data ()); file_list.next (p); } @@ -822,7 +754,7 @@ { int success = fclose (file.fptr ()); if (success != 0) - error ("closing %s", file.name ()); + error ("closing %s", file.name ().data ()); } file_list.del (p); @@ -1395,7 +1327,7 @@ file = file_list (p); - if (strcmp (file.mode (), "w") == 0 || strcmp (file.mode (), "a") == 0) + if (file.mode () == "w" || file.mode () == "a") { error ("%s: this file is opened for writing only", type); return retval;
--- a/src/toplev.h +++ b/src/toplev.h @@ -30,14 +30,7 @@ class tree_function; class Octave_str_obj; -// Tell g++ that clean_up_and_exit doesn't return; - -#ifdef __GNUG__ -typedef void v_fcn_i (int); -volatile v_fcn_i clean_up_and_exit; -#endif - -extern void clean_up_and_exit (int); +extern void clean_up_and_exit (int) NORETURN; extern void parse_and_execute (FILE *f, int print = 0); extern void parse_and_execute (char *s, int print = 0, int verbose = 0);
--- a/src/utils.h +++ b/src/utils.h @@ -29,13 +29,6 @@ class tree_constant; class Octave_object; -// Tell g++ that jump_to_top_level doesn't return; - -#ifdef __GNUG__ -typedef void v_fcn_v (void); -volatile v_fcn_v jump_to_top_level; -#endif - extern char *strsave (const char *); extern char *strconcat (const char *, const char *); @@ -54,7 +47,7 @@ extern char **pathstring_to_vector (char *pathstring); -extern void jump_to_top_level (void); +extern void jump_to_top_level (void) NORETURN; extern int almost_match (const char *std, const char *s, int min_match_len = 1, int case_sens = 1);