diff options
| author | Rodney W. Grimes <rgrimes@FreeBSD.org> | 1995-05-30 05:05:38 +0000 |
|---|---|---|
| committer | Rodney W. Grimes <rgrimes@FreeBSD.org> | 1995-05-30 05:05:38 +0000 |
| commit | 4399be3cbd35324f7a2c00d77229d995b4022138 (patch) | |
| tree | a3959baf797787918878bec6d58d6a0fb743ad0a /gnu/lib | |
| parent | 709e8f9ae1d734c1a163c9b421df4b8153939ce7 (diff) | |
Notes
Diffstat (limited to 'gnu/lib')
139 files changed, 2303 insertions, 2303 deletions
diff --git a/gnu/lib/libdialog/checklist.c b/gnu/lib/libdialog/checklist.c index 20174ae76038..0890c00e0aa4 100644 --- a/gnu/lib/libdialog/checklist.c +++ b/gnu/lib/libdialog/checklist.c @@ -79,7 +79,7 @@ int dialog_checklist(unsigned char *title, unsigned char *prompt, int height, in /* center dialog box on screen */ x = (COLS - width)/2; y = (LINES - height)/2; - + #ifdef HAVE_NCURSES if (use_shadow) draw_shadow(stdscr, y, x, height, width); @@ -156,7 +156,7 @@ int dialog_checklist(unsigned char *title, unsigned char *prompt, int height, in if (key < 0x100 && toupper(key) == toupper(items[(scroll+i)*3][0])) break; - if (i < max_choice || (key >= '1' && key <= MIN('9', '0'+max_choice)) || + if (i < max_choice || (key >= '1' && key <= MIN('9', '0'+max_choice)) || key == KEY_UP || key == KEY_DOWN || key == ' ' || key == '+' || key == '-' ) { if (key >= '1' && key <= MIN('9', '0'+max_choice)) diff --git a/gnu/lib/libdialog/dialog.h b/gnu/lib/libdialog/dialog.h index 31f1e0882289..6500ef82c90b 100644 --- a/gnu/lib/libdialog/dialog.h +++ b/gnu/lib/libdialog/dialog.h @@ -44,7 +44,7 @@ #endif -/* +/* * Attribute names */ #define screen_attr attributes[0] @@ -115,5 +115,5 @@ void use_helpfile(char *helpfile); void use_helpline(char *helpline); char *get_helpline(void); void restore_helpline(char *helpline); -void dialog_gauge(char *title, char *prompt, int y, int x, +void dialog_gauge(char *title, char *prompt, int y, int x, int height, int width, int perc); diff --git a/gnu/lib/libdialog/dialog.priv.h b/gnu/lib/libdialog/dialog.priv.h index 35e91a260f43..d84dc3967c73 100644 --- a/gnu/lib/libdialog/dialog.priv.h +++ b/gnu/lib/libdialog/dialog.priv.h @@ -49,7 +49,7 @@ #ifndef ctrl #define ctrl(a) ((a) - 'a' + 1) -#endif +#endif #ifndef HAVE_NCURSES #ifndef ACS_ULCORNER @@ -101,7 +101,7 @@ bool use_shadow = USE_SHADOW; #endif -/* +/* * Attribute values, default is for mono display */ chtype attributes[] = { diff --git a/gnu/lib/libdialog/dir.c b/gnu/lib/libdialog/dir.c index 2fa5835f7a21..04a30b2656c3 100644 --- a/gnu/lib/libdialog/dir.c +++ b/gnu/lib/libdialog/dir.c @@ -3,7 +3,7 @@ * * Program: dir.c * Author: Marc van Kempen - * desc: Directory routines, sorting and reading + * desc: Directory routines, sorting and reading * * Copyright (c) 1995, Marc van Kempen * @@ -16,7 +16,7 @@ * responsible for the proper functioning of this software, nor does * the author assume any responsibility for damages incurred with * its use. - * + * ****************************************************************************/ #include <sys/types.h> @@ -71,7 +71,7 @@ static int _showdotfiles = TRUE; * ****************************************************************************/ -int +int dir_select_nd( #if defined __linux__ const struct dirent *d @@ -79,8 +79,8 @@ dir_select_nd( struct dirent *d #endif ) -/* - * desc: allways include a directory entry <d>, except +/* + * desc: allways include a directory entry <d>, except * for the current directory and other dot-files * keep '..' however. * pre: <d> points to a dirent @@ -90,13 +90,13 @@ dir_select_nd( if (strcmp(d->d_name, ".")==0 || (d->d_name[0] == '.' && strlen(d->d_name) > 1 && d->d_name[1] != '.')) { return(FALSE); - } else { + } else { return(TRUE); } }/* dir_select_nd() */ -int +int dir_select( #ifdef __linux__ const struct dirent *d @@ -104,8 +104,8 @@ dir_select( struct dirent *d #endif ) -/* - * desc: allways include a directory entry <d>, except +/* + * desc: allways include a directory entry <d>, except * for the current directory * pre: <d> points to a dirent * post: returns TRUE if d->d_name != "." else FALSE @@ -118,16 +118,16 @@ dir_select( } } /* dir_select() */ -int +int dir_select_root_nd( -#ifdef __linux__ +#ifdef __linux__ const struct dirent *d #else struct dirent *d #endif ) -/* - * desc: allways include a directory entry <d>, except +/* + * desc: allways include a directory entry <d>, except * for the current directory and the parent directory. * Also skip any other dot-files. * pre: <d> points to a dirent @@ -142,22 +142,22 @@ dir_select_root_nd( } /* dir_select_root_nd() */ -int +int dir_select_root( -#ifdef __linux__ +#ifdef __linux__ const struct dirent *d #else struct dirent *d #endif ) -/* - * desc: allways include a directory entry <d>, except +/* + * desc: allways include a directory entry <d>, except * for the current directory and the parent directory * pre: <d> points to a dirent * post: returns TRUE if d->d_name[0] != "." else FALSE */ { - if (strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0) { + if (strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0) { return(FALSE); } else { return(TRUE); @@ -185,7 +185,7 @@ dir_alphasort(const void *d1, const void *d2) * */ { - DirList *f1 = ((DirList *) d1), + DirList *f1 = ((DirList *) d1), *f2 = ((DirList *) d2); struct stat *s1 = &(f1->filestatus); struct stat *s2 = &(f2->filestatus); @@ -197,7 +197,7 @@ dir_alphasort(const void *d1, const void *d2) if (strcmp(((DirList *) d2)->filename, "..") == 0) { return(1); } - + /* put directories first */ if ((s1->st_mode & S_IFDIR) && (s2->st_mode & S_IFDIR)) { return(strcmp(f1->filename, f2->filename)); @@ -212,7 +212,7 @@ dir_alphasort(const void *d1, const void *d2) } /* dir_alphasort() */ - + int dir_sizesort(const void *d1, const void *d2) /* @@ -220,7 +220,7 @@ dir_sizesort(const void *d1, const void *d2) * */ { - DirList *f1 = ((DirList *) d1), + DirList *f1 = ((DirList *) d1), *f2 = ((DirList *) d2); struct stat *s1 = &(f1->filestatus); struct stat *s2 = &(f2->filestatus); @@ -232,12 +232,12 @@ dir_sizesort(const void *d1, const void *d2) if (strcmp(((DirList *) d2)->filename, "..") == 0) { return(1); } - + /* put directories first */ if ((s1->st_mode & S_IFDIR) && (s2->st_mode & S_IFDIR)) { - return(s1->st_size < s2->st_size ? - -1 - : + return(s1->st_size < s2->st_size ? + -1 + : s1->st_size >= s2->st_size); }; if (s1->st_mode & S_IFDIR) { @@ -246,11 +246,11 @@ dir_sizesort(const void *d1, const void *d2) if (s2->st_mode & S_IFDIR) { return(1); } - return(s1->st_size < s2->st_size ? - -1 - : + return(s1->st_size < s2->st_size ? + -1 + : s1->st_size >= s2->st_size); - + } /* dir_sizesort() */ int @@ -259,11 +259,11 @@ dir_datesort(const void *d1, const void *d2) * desc: compare d1 and d2 on date, but put directories always first */ { - DirList *f1 = ((DirList *) d1), + DirList *f1 = ((DirList *) d1), *f2 = ((DirList *) d2); struct stat *s1 = &(f1->filestatus); struct stat *s2 = &(f2->filestatus); - + /* check for '..' */ if (strcmp(((DirList *) d1)->filename, "..") == 0) { @@ -272,12 +272,12 @@ dir_datesort(const void *d1, const void *d2) if (strcmp(((DirList *) d2)->filename, "..") == 0) { return(1); } - + /* put directories first */ if ((s1->st_mode & S_IFDIR) && (s2->st_mode & S_IFDIR)) { - return(s1->st_mtime < s2->st_mtime ? - -1 - : + return(s1->st_mtime < s2->st_mtime ? + -1 + : s1->st_mtime >= s2->st_mtime); }; if (s1->st_mode & S_IFDIR) { @@ -286,13 +286,13 @@ dir_datesort(const void *d1, const void *d2) if (s2->st_mode & S_IFDIR) { return(1); } - return(s1->st_mtime < s2->st_mtime ? - -1 - : + return(s1->st_mtime < s2->st_mtime ? + -1 + : s1->st_mtime >= s2->st_mtime); } /* dir_datesort() */ - + int null_strcmp(char *s1, char *s2) @@ -303,15 +303,15 @@ null_strcmp(char *s1, char *s2) if ((s1 == NULL) && (s2 == NULL)) { return(0); } - if (s1 == NULL) { - return(-1); + if (s1 == NULL) { + return(-1); } if (s2 == NULL) { return(1); } return(strcmp(s1, s2)); } /* null_strcmp() */ - + int dir_extsort(const void *d1, const void *d2) @@ -322,7 +322,7 @@ dir_extsort(const void *d1, const void *d2) * post: see code */ { - DirList *f1 = ((DirList *) d1), + DirList *f1 = ((DirList *) d1), *f2 = ((DirList *) d2); struct stat *s1 = &(f1->filestatus); struct stat *s2 = &(f2->filestatus); @@ -337,10 +337,10 @@ dir_extsort(const void *d1, const void *d2) if (strcmp(((DirList *) d2)->filename, "..") == 0) { return(1); } - + /* find the first extension */ - + ext1 = f1->filename + strlen(f1->filename); extf = FALSE; while (!extf && (ext1 > f1->filename)) { @@ -353,21 +353,21 @@ dir_extsort(const void *d1, const void *d2) } /* ext1 == NULL if there's no "extension" else ext1 points */ /* to the first character of the extension string */ - + /* find the second extension */ - + ext2 = f2->filename + strlen(f2->filename); extf = FALSE; while (!extf && (ext2 > f2->filename)) { extf = (*--ext2 == '.'); - } + } if (!extf) { ext2 = NULL; } else { ext2++; } /* idem as for ext1 */ - + if ((s1->st_mode & S_IFDIR) && (s2->st_mode & S_IFDIR)) { ret = null_strcmp(ext1, ext2); if (ret == 0) { @@ -431,7 +431,7 @@ get_dir(char *dirname, char *fmask, DirList **dir, int *n) /* Solution: */ /* manually insert the parent directory as the only */ /* directory entry, and return. */ - + if (*n == -1) { *n = 1; *dir = (DirList *) malloc(sizeof(DirList)); @@ -440,7 +440,7 @@ get_dir(char *dirname, char *fmask, DirList **dir, int *n) (*dir)[0].filestatus = status; (*dir)[0].link = FALSE; return; - } + } *dir = (DirList *) malloc( *n * sizeof(DirList) ); d = 0; @@ -450,7 +450,7 @@ get_dir(char *dirname, char *fmask, DirList **dir, int *n) lstat(dire[j]->d_name, &status); /* check if this file is to be included */ /* always include directories, the rest is subject to fmask */ - if (S_ISDIR(status.st_mode) + if (S_ISDIR(status.st_mode) || fnmatch(fmask, dire[j]->d_name, FNM_NOESCAPE) != FNM_NOMATCH) { strcpy((*dir)[i].filename, dire[j]->d_name); (*dir)[i].filestatus = status; @@ -478,7 +478,7 @@ get_dir(char *dirname, char *fmask, DirList **dir, int *n) j++; } *n = i; - + /* sort the directory with the directory names on top */ qsort((*dir), *n, sizeof(DirList), _sort_func); @@ -490,13 +490,13 @@ get_dir(char *dirname, char *fmask, DirList **dir, int *n) return; }/* get_dir() */ - + void FreeDir(DirList *d, int n) /* * desc: free the dirlist d - * pre: d != NULL + * pre: d != NULL * post: memory allocated to d has been released */ { diff --git a/gnu/lib/libdialog/dir.h b/gnu/lib/libdialog/dir.h index cc06844b9cca..eadc0c5cb2f1 100644 --- a/gnu/lib/libdialog/dir.h +++ b/gnu/lib/libdialog/dir.h @@ -1,5 +1,5 @@ -/* - * include file for dir.c +/* + * include file for dir.c * * Copyright (c) 1995, Marc van Kempen * @@ -12,7 +12,7 @@ * responsible for the proper functioning of this software, nor does * the author assume any responsibility for damages incurred with * its use. - * + * */ #include <sys/types.h> @@ -25,7 +25,7 @@ typedef struct DirList { /* structure to hold the directory entries int link; /* is it a link ? */ char *linkname; /* the name of the file the link points to */ } DirList; - + #ifndef TRUE #define TRUE (1) #endif diff --git a/gnu/lib/libdialog/fselect.c b/gnu/lib/libdialog/fselect.c index e08849ba89e0..4a8d0751be44 100644 --- a/gnu/lib/libdialog/fselect.c +++ b/gnu/lib/libdialog/fselect.c @@ -1,7 +1,7 @@ /* * program: fselect.c * author: Marc van Kempen (wmbfmk@urc.tue.nl) - * Desc: File selection routine + * Desc: File selection routine * * Copyright (c) 1995, Marc van Kempen * @@ -14,7 +14,7 @@ * responsible for the proper functioning of this software, nor does * the author assume any responsibility for damages incurred with * its use. - * + * */ #include <stdlib.h> @@ -31,7 +31,7 @@ char *dialog_dfselect(char *dir, char *fmask, int is_fselect); -/* +/* * Functions */ @@ -60,7 +60,7 @@ get_directories(DirList *d, int n, char ***names, int *nd) void get_filenames(DirList *d, int n, char ***names, int *nf) /* - * Desc: return the filenames in <dir> as an arry in + * Desc: return the filenames in <dir> as an arry in * <names>, the # of entries in <nf>, memory allocated * to *names should be freed when done. */ @@ -78,7 +78,7 @@ get_filenames(DirList *d, int n, char ***names, int *nf) (*names)[i] = (char *) malloc( strlen(d[i+nd].filename) + 1); strcpy((*names)[i], d[i+nd].filename); } - + return; } /* get_filenames() */ @@ -102,8 +102,8 @@ FreeNames(char **names, int n) int dialog_dselect_old(void) /* - * Desc: starting from the current directory, - * choose a new current directory + * Desc: starting from the current directory, + * choose a new current directory */ { DirList *d = NULL; @@ -114,12 +114,12 @@ dialog_dselect_old(void) StringObj *dir_obj; char o_dir[MAXPATHLEN]; struct ComposeObj *obj = NULL; - int n, nd, okbutton, cancelbutton, + int n, nd, okbutton, cancelbutton, quit, cancel, ret; ds_win = newwin(LINES-8, COLS-30, 4, 15); if (ds_win == NULL) { - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", + fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", LINES-8, COLS-30, 4, 15); exit(1); } @@ -137,7 +137,7 @@ dialog_dselect_old(void) /* the list of directories */ get_dir(".", "*", &d, &n); get_directories(d, n, &names, &nd); - dirs_obj = NewListObj(ds_win, "Directories:", names, o_dir, 5, 2, + dirs_obj = NewListObj(ds_win, "Directories:", names, o_dir, 5, 2, LINES-15, COLS-48, nd); AddObj(&obj, LISTOBJ, (void *) dirs_obj); @@ -145,7 +145,7 @@ dialog_dselect_old(void) okbutton = FALSE; okbut = NewButtonObj(ds_win, "Continue", &okbutton, 7, COLS-45); AddObj(&obj, BUTTONOBJ, (void *) okbut); - + /* the Cancel-button */ cancelbutton = FALSE; cancelbut = NewButtonObj(ds_win, "Return", &cancelbutton, 11, COLS-44); @@ -176,7 +176,7 @@ dialog_dselect_old(void) strcpy(old_dir, o_dir); RefreshStringObj(dir_obj); } - } + } get_dir(".", "*", &d, &n); FreeNames(names, nd); get_directories(d, n, &names, &nd); @@ -194,7 +194,7 @@ dialog_dselect_old(void) break; } } - + FreeNames(names, nd); DelObj(obj); delwin(ds_win); @@ -229,7 +229,7 @@ char * dialog_dfselect(char *dir, char *fmask, int is_fselect) /* * Desc: choose a file from the directory <dir>, which - * initially display files with the mask <filemask> + * initially display files with the mask <filemask> * pre: <dir> is the initial directory * only files corresponding to the mask <fmask> are displayed * post: returns NULL if no file was selected @@ -262,7 +262,7 @@ dialog_dfselect(char *dir, char *fmask, int is_fselect) fs_win = newwin(LINES-2, COLS-20, 1, 10); if (fs_win == NULL) { endwin(); - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", + fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", LINES-2, COLS-20, 2, 10); exit(1); } @@ -289,7 +289,7 @@ dialog_dfselect(char *dir, char *fmask, int is_fselect) get_dir(".", fmask, &d, &n); /* read the entire directory */ get_directories(d, n, &dnames, &nd); /* extract the dir-entries */ if (is_fselect) { - dirs_obj = NewListObj(fs_win, "Directories:", dnames, o_dir, 5, 2, + dirs_obj = NewListObj(fs_win, "Directories:", dnames, o_dir, 5, 2, LINES-16, (COLS-20)/2-2, nd); } else { dirs_obj = NewListObj(fs_win, "Directories:", dnames, o_dir, 5, 2, @@ -340,7 +340,7 @@ dialog_dfselect(char *dir, char *fmask, int is_fselect) switch(ret) { case SEL_CR: if (strcmp(old_fmask, o_fm) || strcmp(old_dir, o_dir)) { - /* reread directory and update the listobjects */ + /* reread directory and update the listobjects */ if (strcmp(old_dir, o_dir)) { /* dir entry was changed */ if (chdir(o_dir)) { dialog_notify("Could not change into directory"); diff --git a/gnu/lib/libdialog/gauge.c b/gnu/lib/libdialog/gauge.c index 93f5542f8d7e..a44f96974416 100644 --- a/gnu/lib/libdialog/gauge.c +++ b/gnu/lib/libdialog/gauge.c @@ -20,7 +20,7 @@ #include "dialog.h" void -dialog_gauge(char *title, char *prompt, int y, int x, +dialog_gauge(char *title, char *prompt, int y, int x, int height, int width, int perc) /* * Desc: display a progress bar, progress indicated by <perc> @@ -36,7 +36,7 @@ dialog_gauge(char *title, char *prompt, int y, int x, height, width, y, x); exit(-1); } - + draw_box(gw, 0, 0, height, width, dialog_attr, border_attr); draw_shadow(stdscr, y, x, height, width); @@ -69,4 +69,4 @@ dialog_gauge(char *title, char *prompt, int y, int x, return; } /* dialog_gauge() */ - + diff --git a/gnu/lib/libdialog/help.c b/gnu/lib/libdialog/help.c index 51a1826f2e3a..de49c6ab576f 100644 --- a/gnu/lib/libdialog/help.c +++ b/gnu/lib/libdialog/help.c @@ -1,5 +1,5 @@ /*************************************************************** - * + * * Program: help.c * Author: Marc van Kempen * Desc: get help @@ -16,7 +16,7 @@ * responsible for the proper functioning of this software, nor does * the author assume any responsibility for damages incurred with * its use. - * + * ***************************************************************/ #include <stdlib.h> @@ -111,7 +111,7 @@ display_helpfile(void) return; } /* display_helpfile() */ - + /****************************************************************** * @@ -121,7 +121,7 @@ display_helpfile(void) void use_helpline(char *hline) -/* +/* * desc: set the helpline to printed in dialogs */ { @@ -177,7 +177,7 @@ get_helpline(void) } else { hlp = NULL; } - + return(hlp); } /* get_helpline() */ diff --git a/gnu/lib/libdialog/kernel.c b/gnu/lib/libdialog/kernel.c index f719f7988542..e9d23b212930 100644 --- a/gnu/lib/libdialog/kernel.c +++ b/gnu/lib/libdialog/kernel.c @@ -25,7 +25,7 @@ * 19/12/93 - menu will now scroll if there are more items than can fit * on the screen. * - added 'checklist', a dialog box with a list of options that - * can be turned on or off. A list of options that are on is + * can be turned on or off. A list of options that are on is * returned on exit. * * 20/12/93 - Version 0.15 released. @@ -67,7 +67,7 @@ * 13/01/94 - some changes for easier porting to other Unix systems (tested * on Ultrix, SunOS and HPUX) * - Version 0.3 released. - * + * * 08/06/94 - Patches by Stuart Herbert - S.Herbert@shef.ac.uk * Fixed attr_clear and the textbox stuff to work with ncurses 1.8.5 * Fixed the wordwrap routine - it'll actually wrap properly now diff --git a/gnu/lib/libdialog/menubox.c b/gnu/lib/libdialog/menubox.c index 15324b4c0bd8..b5aed1f61333 100644 --- a/gnu/lib/libdialog/menubox.c +++ b/gnu/lib/libdialog/menubox.c @@ -71,7 +71,7 @@ int dialog_menu(unsigned char *title, unsigned char *prompt, int height, int wid /* center dialog box on screen */ x = (COLS - width)/2; y = (LINES - height)/2; - + #ifdef HAVE_NCURSES if (use_shadow) draw_shadow(stdscr, y, x, height, width); @@ -149,7 +149,7 @@ int dialog_menu(unsigned char *title, unsigned char *prompt, int height, int wid if (key < 0x100 && toupper(key) == toupper(items[(scroll+i)*2][0])) break; - if (i < max_choice || (key >= '1' && key <= MIN('9', '0'+max_choice)) || + if (i < max_choice || (key >= '1' && key <= MIN('9', '0'+max_choice)) || key == KEY_UP || key == KEY_DOWN || key == '-' || key == '+') { if (key >= '1' && key <= MIN('9', '0'+max_choice)) i = key - '1'; @@ -245,7 +245,7 @@ int dialog_menu(unsigned char *title, unsigned char *prompt, int height, int wid *ch = choice; if (sc) *sc = scroll; - + switch (key) { case KEY_PPAGE: if (scroll > height-4) { /* can we go up? */ @@ -316,7 +316,7 @@ int dialog_menu(unsigned char *title, unsigned char *prompt, int height, int wid } if (redraw_menu) { for (i = 0; i < max_choice; i++) { - print_item(menu, items[(scroll+i)*2], + print_item(menu, items[(scroll+i)*2], items[(scroll+i)*2 + 1], i, i == choice); } wnoutrefresh(menu); diff --git a/gnu/lib/libdialog/msgbox.c b/gnu/lib/libdialog/msgbox.c index 867f64989fbd..75ff399f5539 100644 --- a/gnu/lib/libdialog/msgbox.c +++ b/gnu/lib/libdialog/msgbox.c @@ -226,7 +226,7 @@ dialog_mesgbox(unsigned char *title, unsigned char *prompt, int height, int widt display_helpfile(); break; } - print_page(dialog, theight, width, prompt, startline, hscroll); + print_page(dialog, theight, width, prompt, startline, hscroll); print_perc(dialog, height-3, width-9, (float) (startline+theight)/max_lines); wmove(dialog, height-2, width/2-2); wrefresh(dialog); @@ -284,7 +284,7 @@ getline(unsigned char *buf, int n) if (n<0) { return(NULL); } - + i=0; while (*buf && i<n) { if (*buf == '\n' || *buf == '\r') { @@ -315,7 +315,7 @@ print_page(WINDOW *win, int height, int width, unsigned char *buf, int startline wmove(win, 1+i, 1); for (j=0; j<width-2; j++) waddnstr(win, " ", 1); wmove(win, 1+i, 1); - j = 0; + j = 0; /* scroll to the right */ while (*b && (*b != '\n') && (*b != '\r') && (j<hscroll)) { b++; @@ -336,7 +336,7 @@ print_page(WINDOW *win, int height, int width, unsigned char *buf, int startline if (*b) b++; /* skip over '\n', if it exists */ } } /* print_page() */ - - - - + + + + diff --git a/gnu/lib/libdialog/notify.c b/gnu/lib/libdialog/notify.c index 1000c7bd0f90..052ee8f27528 100644 --- a/gnu/lib/libdialog/notify.c +++ b/gnu/lib/libdialog/notify.c @@ -14,7 +14,7 @@ * responsible for the proper functioning of this software, nor does * the author assume any responsibility for damages incurred with * its use. - * + * */ @@ -23,7 +23,7 @@ void dialog_notify(char *msg) -/* +/* * Desc: display an error message */ { diff --git a/gnu/lib/libdialog/radiolist.c b/gnu/lib/libdialog/radiolist.c index 31495d5587ef..fefcb53043f3 100644 --- a/gnu/lib/libdialog/radiolist.c +++ b/gnu/lib/libdialog/radiolist.c @@ -87,7 +87,7 @@ int dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, in /* center dialog box on screen */ x = (COLS - width)/2; y = (LINES - height)/2; - + #ifdef HAVE_NCURSES if (use_shadow) draw_shadow(stdscr, y, x, height, width); @@ -164,7 +164,7 @@ int dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, in if (toupper(key) == toupper(items[(scroll+i)*3][0])) break; - if (i < max_choice || (key >= '1' && key <= MIN('9', '0'+max_choice)) || + if (i < max_choice || (key >= '1' && key <= MIN('9', '0'+max_choice)) || key == KEY_UP || key == KEY_DOWN || key == ' ' || key == '+' || key == '-' ) { if (key >= '1' && key <= MIN('9', '0'+max_choice)) diff --git a/gnu/lib/libdialog/raw_popen.c b/gnu/lib/libdialog/raw_popen.c index 6393eb189944..fabf91e20c94 100644 --- a/gnu/lib/libdialog/raw_popen.c +++ b/gnu/lib/libdialog/raw_popen.c @@ -53,8 +53,8 @@ static struct pid { struct pid *next; FILE *fp; pid_t pid; -} *pidlist; - +} *pidlist; + FILE * raw_popen(const char *program, char * const *argv, const char *type) { @@ -155,6 +155,6 @@ raw_pclose(FILE *iop) else last->next = cur->next; free(cur); - + return (pid == -1 ? -1 : pstat.w_status); } diff --git a/gnu/lib/libdialog/ui_objects.c b/gnu/lib/libdialog/ui_objects.c index efa39dcc9d3c..c588b94a9464 100644 --- a/gnu/lib/libdialog/ui_objects.c +++ b/gnu/lib/libdialog/ui_objects.c @@ -3,7 +3,7 @@ * Author: Marc van Kempen * Desc: Implementation of UI-objects: * - String input fields - * - List selection + * - List selection * - Buttons * * Copyright (c) 1995, Marc van Kempen @@ -17,7 +17,7 @@ * responsible for the proper functioning of this software, nor does * the author assume any responsibility for damages incurred with * its use. - * + * */ #include <stdlib.h> @@ -79,14 +79,14 @@ FreeObj(ComposeObj *Obj) */ { ComposeObj *o = Obj; - + o = Obj; while (o) { o = Obj->next; free(Obj); Obj = o; } - + return; } /* FreeObj() */ @@ -94,7 +94,7 @@ FreeObj(ComposeObj *Obj) int ReadObj(ComposeObj *Obj) /* - * Desc: navigate through the different objects calling their + * Desc: navigate through the different objects calling their * respective navigation routines as necessary * Pre: Obj != NULL */ @@ -145,7 +145,7 @@ ReadObj(ComposeObj *Obj) } return(ret); - + } /* ReadObj() */ @@ -225,7 +225,7 @@ DelObj(ComposeObj *Obj) FreeObj(o); } /* DelObj() */ - + /*********************************************************************** * * StringObj routines @@ -265,7 +265,7 @@ NewStringObj(WINDOW *win, char *title, char *s, int y, int x, int w, int len) */ { StringObj *so; - + /* Initialize a new object */ so = (StringObj *) malloc( sizeof(StringObj) ); if (!so) { @@ -302,7 +302,7 @@ SelectStringObj(StringObj *so) char tmp[so->len+1]; strcpy(tmp, so->s); - key = line_edit(so->win, so->y+2, so->x+1, + key = line_edit(so->win, so->y+2, so->x+1, so->len, so->w-2, inputbox_attr, TRUE, tmp); if ((key == '\n') || (key == '\r') || (key == '\t') || key == (KEY_BTAB) ) { strcpy(so->s, tmp); @@ -335,7 +335,7 @@ DelStringObj(StringObj *so) return; } - + /*********************************************************************** * * ListObj routines @@ -377,7 +377,7 @@ DrawNames(ListObj *lo) i++; } - return; + return; } /* DrawNames() */ void @@ -401,12 +401,12 @@ RefreshListObj(ListObj *lo) sprintf(perc, "(%3d%%)", MIN(100, (int) (100 * (lo->sel+lo->h-2) / MAX(1, lo->n)))); wmove(lo->win, lo->y + lo->h, lo->x + lo->w - 8); wattrset(lo->win, dialog_attr); - waddstr(lo->win, perc); - - + waddstr(lo->win, perc); + + return; } /* RefreshListObj() */ - + ListObj * NewListObj(WINDOW *win, char *title, char **list, char *listelt, int y, int x, int h, int w, int n) @@ -485,7 +485,7 @@ UpdateListObj(ListObj *lo, char **list, int n) } } else { lo->seld = NULL; - } + } lo->n = n; lo->scroll = 0; lo->sel = 0; @@ -521,7 +521,7 @@ SelectListObj(ListObj *lo) key = wgetch(lo->win); quit = FALSE; - while ((key != '\t') && (key != '\n') && (key != '\r') + while ((key != '\t') && (key != '\n') && (key != '\r') && (key != ESC) && (key != KEY_F(1)) && (key != '?') && !quit) { /* first draw current item in normal video */ wmove(lo->win, sel_y, sel_x); @@ -620,11 +620,11 @@ SelectListObj(ListObj *lo) break; } /* Draw % indication */ - sprintf(perc, "(%3d%%)", MIN(100, (int) + sprintf(perc, "(%3d%%)", MIN(100, (int) (100 * (lo->sel+lo->h - 2) / MAX(1, lo->n)))); wmove(lo->win, lo->y + lo->h, lo->x + lo->w - 8); wattrset(lo->win, dialog_attr); - waddstr(lo->win, perc); + waddstr(lo->win, perc); /* draw current item in inverse */ wmove(lo->win, sel_y, sel_x); @@ -632,8 +632,8 @@ SelectListObj(ListObj *lo) if (strlen(lo->name[lo->sel]) > lo->w - 2) { /* when printing in inverse video show the last characters in the */ /* name that will fit in the window */ - strncpy(tmp, - lo->name[lo->sel] + strlen(lo->name[lo->sel]) - (lo->w - 2), + strncpy(tmp, + lo->name[lo->sel] + strlen(lo->name[lo->sel]) - (lo->w - 2), lo->w - 2); tmp[lo->w - 2] = 0; waddstr(lo->win, tmp); @@ -642,7 +642,7 @@ SelectListObj(ListObj *lo) } if (!quit) key = wgetch(lo->win); } - + if (key == ESC) { return(SEL_ESC); } @@ -674,8 +674,8 @@ DelListObj(ListObj *lo) void MarkCurrentListObj(ListObj *lo) -/* - * Desc: mark the current item for the selection list +/* + * Desc: mark the current item for the selection list */ { lo->seld[lo->sel] = !(lo->seld[lo->sel]); @@ -707,7 +707,7 @@ UnMarkAllListObj(ListObj *lo) */ { int i; - + for (i=0; i<lo->n; i++) { lo->seld[i] = FALSE; } @@ -745,7 +745,7 @@ NewButtonObj(WINDOW *win, char *title, int *pushed, int y, int x) ButtonObj *bo; bo = (ButtonObj *) malloc( sizeof(ButtonObj) ); - + bo->win = win; bo->title = (char *) malloc( strlen(title) + 1); strcpy(bo->title, title); @@ -771,7 +771,7 @@ SelectButtonObj(ButtonObj *bo) print_button(bo->win, bo->title, bo->y+1, bo->x+2, TRUE); wmove(bo->win, bo->y+1, bo->x+(bo->w/2)-1); key = wgetch(bo->win); - print_button(bo->win, bo->title, bo->y+1, bo->x+2, FALSE); + print_button(bo->win, bo->title, bo->y+1, bo->x+2, FALSE); switch(key) { case '\t': return(SEL_TAB); diff --git a/gnu/lib/libdialog/ui_objects.h b/gnu/lib/libdialog/ui_objects.h index 3b0a544250ba..db9a12c18516 100644 --- a/gnu/lib/libdialog/ui_objects.h +++ b/gnu/lib/libdialog/ui_objects.h @@ -13,7 +13,7 @@ * responsible for the proper functioning of this software, nor does * the author assume any responsibility for damages incurred with * its use. - * + * */ #include "dialog.h" @@ -85,13 +85,13 @@ typedef struct ComposeObj { **********************************************************************/ void RefreshStringObj(StringObj *so); -StringObj *NewStringObj(WINDOW *win, char *title, char *s, +StringObj *NewStringObj(WINDOW *win, char *title, char *s, int y, int x, int w, int len); int SelectStringObj(StringObj *so); void DelStringObj(StringObj *so); void RefreshListObj(ListObj *lo); -ListObj *NewListObj(WINDOW *win, char *title, char **list, +ListObj *NewListObj(WINDOW *win, char *title, char **list, char *listelt, int y, int x, int h, int w, int n); void UpdateListObj(ListObj *lo, char **list, int n); int SelectListObj(ListObj *lo); @@ -101,7 +101,7 @@ void MarkAllListObj(ListObj *lo); void UnMarkAllListObj(ListObj *lo); void RefreshButtonObj(ButtonObj *bo); -ButtonObj *NewButtonObj(WINDOW *win, char *title, int *pushed, +ButtonObj *NewButtonObj(WINDOW *win, char *title, int *pushed, int y, int x); int SelectButtonObj(ButtonObj *bo); void DelButtonObj(ButtonObj *bo); diff --git a/gnu/lib/libdialog/yesno.c b/gnu/lib/libdialog/yesno.c index 14ec47dc8ec6..67de4243c55b 100644 --- a/gnu/lib/libdialog/yesno.c +++ b/gnu/lib/libdialog/yesno.c @@ -52,7 +52,7 @@ int dialog_yesno(unsigned char *title, unsigned char * prompt, int height, int w /* center dialog box on screen */ x = (COLS - width)/2; y = (LINES - height)/2; - + #ifdef HAVE_NCURSES if (use_shadow) draw_shadow(stdscr, y, x, height, width); diff --git a/gnu/lib/libg++/include/ACG.h b/gnu/lib/libg++/include/ACG.h index 809380050ba9..fc16e2a82044 100644 --- a/gnu/lib/libg++/include/ACG.h +++ b/gnu/lib/libg++/include/ACG.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -16,7 +16,7 @@ License along with this library; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _ACG_h -#define _ACG_h 1 +#define _ACG_h 1 #include <RNG.h> #include <math.h> diff --git a/gnu/lib/libg++/include/AllocRing.h b/gnu/lib/libg++/include/AllocRing.h index 15dd1610750c..f2f5db57d0e3 100644 --- a/gnu/lib/libg++/include/AllocRing.h +++ b/gnu/lib/libg++/include/AllocRing.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1989 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -25,7 +25,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. /* - An AllocRing holds the last n malloc'ed strings, reallocating/reusing + An AllocRing holds the last n malloc'ed strings, reallocating/reusing one only when the queue wraps around. It thus guarantees that the last n allocations are intact. It is useful for things like I/O formatting where reasonable restrictions may be made about the diff --git a/gnu/lib/libg++/include/Binomial.h b/gnu/lib/libg++/include/Binomial.h index f88dfc3a4670..f02730bf49aa 100644 --- a/gnu/lib/libg++/include/Binomial.h +++ b/gnu/lib/libg++/include/Binomial.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) diff --git a/gnu/lib/libg++/include/BitSet.h b/gnu/lib/libg++/include/BitSet.h index ca1d96f9ce32..c80e3274bae4 100644 --- a/gnu/lib/libg++/include/BitSet.h +++ b/gnu/lib/libg++/include/BitSet.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -36,11 +36,11 @@ struct BitSetRep unsigned short s[1]; // bits start here }; -extern BitSetRep* BitSetalloc(BitSetRep*, const unsigned short*, +extern BitSetRep* BitSetalloc(BitSetRep*, const unsigned short*, int, int, int); extern BitSetRep* BitSetcopy(BitSetRep*, const BitSetRep*); extern BitSetRep* BitSetresize(BitSetRep*, int); -extern BitSetRep* BitSetop(const BitSetRep*, const BitSetRep*, +extern BitSetRep* BitSetop(const BitSetRep*, const BitSetRep*, BitSetRep*, char); extern BitSetRep* BitSetcmpl(const BitSetRep*, BitSetRep*); @@ -69,7 +69,7 @@ class BitSet protected: BitSetRep* rep; - + public: // constructors @@ -116,7 +116,7 @@ public: int test(int from, int to) const; BitSetBit operator [] (int i); - + // iterators int first(int b = 1) const; @@ -132,13 +132,13 @@ public: int empty() const; int virtual_bit() const; int count(int b = 1) const; - + // convertors & IO - friend BitSet atoBitSet(const char* s, + friend BitSet atoBitSet(const char* s, char f='0', char t='1', char star='*'); // BitSettoa is deprecated; do not use in new programs. - friend const char* BitSettoa(const BitSet& x, + friend const char* BitSettoa(const BitSet& x, char f='0', char t='1', char star='*'); friend BitSet shorttoBitSet(unsigned short w); @@ -193,7 +193,7 @@ inline BitSet::BitSet(const BitSet& x) :rep(BitSetcopy(0, x.rep)) {} inline BitSet::~BitSet() { if (rep != &_nilBitSetRep) delete rep; } inline BitSet& BitSet::operator = (const BitSet& y) -{ +{ rep = BitSetcopy(rep, y.rep); return *this; } @@ -258,27 +258,27 @@ inline BitSet operator ~ (const BitSet& x) return r #else /* NO_NRV */ -inline BitSet operator & (const BitSet& x, const BitSet& y) +inline BitSet operator & (const BitSet& x, const BitSet& y) { BitSet r; and(x, y, r); return r; } -inline BitSet operator | (const BitSet& x, const BitSet& y) +inline BitSet operator | (const BitSet& x, const BitSet& y) { BitSet r; or(x, y, r); return r; } -inline BitSet operator ^ (const BitSet& x, const BitSet& y) +inline BitSet operator ^ (const BitSet& x, const BitSet& y) { BitSet r; xor(x, y, r); return r; } -inline BitSet operator - (const BitSet& x, const BitSet& y) +inline BitSet operator - (const BitSet& x, const BitSet& y) { BitSet r; diff(x, y, r); return r; } -inline BitSet operator ~ (const BitSet& x) +inline BitSet operator ~ (const BitSet& x) { BitSet r; ::complement(x, r); return r; } @@ -329,7 +329,7 @@ inline int BitSet::test(int p) const { if (p < 0) error("Illegal bit index"); int index = BitSet_index(p); - return (index >= rep->len)? rep->virt : + return (index >= rep->len)? rep->virt : ((rep->s[index] & (1 << BitSet_pos(p))) != 0); } diff --git a/gnu/lib/libg++/include/BitString.h b/gnu/lib/libg++/include/BitString.h index b2b92b153c04..f30b440afaa3 100644 --- a/gnu/lib/libg++/include/BitString.h +++ b/gnu/lib/libg++/include/BitString.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -138,7 +138,7 @@ public: friend void complement(const BitString&, BitString&); - friend int lcompare(const BitString&, const BitString&); + friend int lcompare(const BitString&, const BitString&); // assignment-based operators // (constuctive versions decalred inline below @@ -162,7 +162,7 @@ public: void clear(int pos); void clear(int from, int to); - void clear(); + void clear(); void invert(int pos); void invert(int from, int to); @@ -188,7 +188,7 @@ public: // searching & matching - int index(unsigned int bit, int startpos = 0) const ; + int index(unsigned int bit, int startpos = 0) const ; int index(const BitString&, int startpos = 0) const; int index(const BitSubString&, int startpos = 0) const; int index(const BitPattern&, int startpos = 0) const; @@ -208,9 +208,9 @@ public: // BitSubString extraction BitSubString at(int pos, int len); - BitSubString at(const BitString&, int startpos = 0); - BitSubString at(const BitSubString&, int startpos = 0); - BitSubString at(const BitPattern&, int startpos = 0); + BitSubString at(const BitString&, int startpos = 0); + BitSubString at(const BitSubString&, int startpos = 0); + BitSubString at(const BitPattern&, int startpos = 0); BitSubString before(int pos); BitSubString before(const BitString&, int startpos = 0); @@ -224,9 +224,9 @@ public: // other friends & utilities - friend BitString common_prefix(const BitString&, const BitString&, + friend BitString common_prefix(const BitString&, const BitString&, int pos = 0); - friend BitString common_suffix(const BitString&, const BitString&, + friend BitString common_suffix(const BitString&, const BitString&, int pos = -1); friend BitString reverse(const BitString&); @@ -259,7 +259,7 @@ public: friend BitPattern atoBitPattern(const char* s, char f='0',char t='1',char x='X'); - friend const char* BitPatterntoa(const BitPattern& p, + friend const char* BitPatterntoa(const BitPattern& p, char f='0',char t='1',char x='X'); int OK() const; }; @@ -277,7 +277,7 @@ public: ~BitPattern(); - friend const char* BitPatterntoa(const BitPattern& p, + friend const char* BitPatterntoa(const BitPattern& p, char f/*='0'*/,char t/*='1'*/,char x/*='X'*/); void printon(ostream&, char f='0',char t='1',char x='X') const; friend BitPattern atoBitPattern(const char* s, char f,char t, char x); @@ -320,16 +320,16 @@ inline BitString::BitString() :rep(&_nilBitStrRep) {} inline BitString::BitString(const BitString& x) :rep(BStr_copy(0, x.rep)) {} -inline BitString::BitString(const BitSubString& y) +inline BitString::BitString(const BitSubString& y) :rep (BStr_alloc(0, y.S.rep->s, y.pos, y.pos+y.len, y.len)) {} inline BitString::~BitString() -{ +{ if (rep != &_nilBitStrRep) delete rep; } -inline BitString shorttoBitString(unsigned short w) -{ +inline BitString shorttoBitString(unsigned short w) +{ BitString r; _BS_word ww = w; #if _BS_BIGENDIAN @@ -339,8 +339,8 @@ inline BitString shorttoBitString(unsigned short w) return r; } -inline BitString longtoBitString(unsigned long w) -{ +inline BitString longtoBitString(unsigned long w) +{ BitString r; #if 1 _BS_word u = w; @@ -355,13 +355,13 @@ inline BitString longtoBitString(unsigned long w) } inline BitString& BitString::operator = (const BitString& y) -{ +{ rep = BStr_copy(rep, y.rep); return *this; } inline BitString& BitString::operator = (unsigned int b) -{ +{ _BS_word bit = b; rep = BStr_alloc(rep, &bit, 0, 1, 1); return *this; @@ -373,7 +373,7 @@ inline BitString& BitString::operator=(const BitSubString& y) return *this; } -inline BitSubString::BitSubString(const BitSubString& x) +inline BitSubString::BitSubString(const BitSubString& x) :S(x.S), pos(x.pos), len(x.len) {} inline BitSubString::BitSubString(BitString& x, int p, int l) @@ -544,47 +544,47 @@ inline BitString operator ~ (const BitString& x) return r #else /* NO_NRV */ -inline BitString operator & (const BitString& x, const BitString& y) +inline BitString operator & (const BitString& x, const BitString& y) { BitString r; and(x, y, r); return r; } -inline BitString operator | (const BitString& x, const BitString& y) +inline BitString operator | (const BitString& x, const BitString& y) { BitString r; or(x, y, r); return r; } -inline BitString operator ^ (const BitString& x, const BitString& y) +inline BitString operator ^ (const BitString& x, const BitString& y) { BitString r; xor(x, y, r); return r; } -inline BitString operator << (const BitString& x, int y) +inline BitString operator << (const BitString& x, int y) { BitString r; lshift(x, y, r); return r; } -inline BitString operator >> (const BitString& x, int y) +inline BitString operator >> (const BitString& x, int y) { BitString r; rshift(x, y, r); return r; } -inline BitString operator - (const BitString& x, const BitString& y) +inline BitString operator - (const BitString& x, const BitString& y) { BitString r; diff(x, y, r); return r; } -inline BitString operator + (const BitString& x, const BitString& y) +inline BitString operator + (const BitString& x, const BitString& y) { BitString r; cat(x, y, r); return r; } -inline BitString operator + (const BitString& x, unsigned int y) +inline BitString operator + (const BitString& x, unsigned int y) { BitString r; cat(x, y, r); return r; } -inline BitString operator ~ (const BitString& x) +inline BitString operator ~ (const BitString& x) { BitString r; complement(x, r); return r; } @@ -594,32 +594,32 @@ inline BitString operator ~ (const BitString& x) // status, matching inline int BitString::length() const -{ +{ return rep->len; } inline int BitString::empty() const -{ +{ return rep->len == 0; } inline int BitString::index(const BitString& y, int startpos) const -{ +{ return search(startpos, rep->len, y.rep->s, 0, y.rep->len); } inline int BitString::index(const BitSubString& y, int startpos) const -{ +{ return search(startpos, rep->len, y.S.rep->s, y.pos, y.pos+y.len); } inline int BitString::contains(const BitString& y) const -{ +{ return search(0, rep->len, y.rep->s, 0, y.rep->len) >= 0; } inline int BitString::contains(const BitSubString& y) const -{ +{ return search(0, rep->len, y.S.rep->s, y.pos, y.pos+y.len) >= 0; } @@ -664,12 +664,12 @@ inline int BitString::index(const BitPattern& r, int startpos) const } inline int BitSubString::length() const -{ +{ return len; } inline int BitSubString::empty() const -{ +{ return len == 0; } @@ -706,7 +706,7 @@ inline int BitString::index(unsigned int bit, int startpos) const return prev(rep->len + startpos + 1, bit); } -inline void BitString::right_trim(unsigned int b) +inline void BitString::right_trim(unsigned int b) { int nb = (b == 0)? 1 : 0; rep = BStr_resize(rep, prev(rep->len, nb) + 1); @@ -721,7 +721,7 @@ inline void BitString::left_trim(unsigned int b) inline int BitString::test(int i) const { - return ((unsigned)(i) >= rep->len)? 0 : + return ((unsigned)(i) >= rep->len)? 0 : ((rep->s[BitStr_index(i)] & (1 << (BitStr_pos(i)))) != 0); } @@ -754,7 +754,7 @@ inline BitSubString BitString::_substr(int first, int l) { if (first < 0 || l <= 0 || (unsigned)(first + l) > rep->len) return BitSubString(_nil_BitString, 0, 0) ; - else + else return BitSubString(*this, first, l); } diff --git a/gnu/lib/libg++/include/Complex.h b/gnu/lib/libg++/include/Complex.h index 9b7e378ed383..128227bc3cc5 100644 --- a/gnu/lib/libg++/include/Complex.h +++ b/gnu/lib/libg++/include/Complex.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -57,8 +57,8 @@ public: Complex& operator *= (const Complex& y); Complex& operator *= (double y); - Complex& operator /= (const Complex& y); - Complex& operator /= (double y); + Complex& operator /= (const Complex& y); + Complex& operator /= (double y); void error(const char* msg) const; }; @@ -83,7 +83,7 @@ Complex pow(const Complex& x, int p); Complex pow(const Complex& x, const Complex& p); Complex pow(const Complex& x, double y); Complex sqrt(const Complex& x); - + istream& operator >> (istream& s, Complex& x); ostream& operator << (ostream& s, const Complex& x); @@ -99,42 +99,42 @@ inline Complex::Complex(double r, double i) :re(r), im(i) {} inline Complex::~Complex() {} -inline Complex& Complex::operator = (const Complex& y) -{ - re = y.real(); im = y.imag(); return *this; -} +inline Complex& Complex::operator = (const Complex& y) +{ + re = y.real(); im = y.imag(); return *this; +} inline Complex& Complex::operator += (const Complex& y) -{ - re += y.real(); im += y.imag(); return *this; +{ + re += y.real(); im += y.imag(); return *this; } inline Complex& Complex::operator += (double y) -{ - re += y; return *this; +{ + re += y; return *this; } inline Complex& Complex::operator -= (const Complex& y) -{ - re -= y.real(); im -= y.imag(); return *this; +{ + re -= y.real(); im -= y.imag(); return *this; } inline Complex& Complex::operator -= (double y) -{ - re -= y; return *this; +{ + re -= y; return *this; } inline Complex& Complex::operator *= (const Complex& y) -{ +{ double r = re * y.real() - im * y.imag(); - im = re * y.imag() + im * y.real(); - re = r; - return *this; + im = re * y.imag() + im * y.real(); + re = r; + return *this; } inline Complex& Complex::operator *= (double y) -{ - re *= y; im *= y; return *this; +{ + re *= y; im *= y; return *this; } @@ -202,7 +202,7 @@ inline Complex operator - (double x, const Complex& y) inline Complex operator * (const Complex& x, const Complex& y) { - return Complex(x.real() * y.real() - x.imag() * y.imag(), + return Complex(x.real() * y.real() - x.imag() * y.imag(), x.real() * y.imag() + x.imag() * y.real()); } diff --git a/gnu/lib/libg++/include/CursesW.h b/gnu/lib/libg++/include/CursesW.h index 1df2e8a0aa41..8ac6f3c4af6d 100644 --- a/gnu/lib/libg++/include/CursesW.h +++ b/gnu/lib/libg++/include/CursesW.h @@ -1,6 +1,6 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1989 Free Software Foundation written by Eric Newton (newton@rocky.oswego.edu) @@ -237,7 +237,7 @@ inline int (mvinsch)(int y, int x, char c) * */ -class CursesWindow +class CursesWindow { protected: static int count; // count of all active windows: @@ -385,102 +385,102 @@ inline int CursesWindow::width() return maxx() - begx() + 1; } -inline int CursesWindow::box(char vert, char hor) +inline int CursesWindow::box(char vert, char hor) { - return ::box(w, vert, hor); + return ::box(w, vert, hor); } -inline int CursesWindow::overlay(CursesWindow &win) +inline int CursesWindow::overlay(CursesWindow &win) { - return ::overlay(w, win.w); + return ::overlay(w, win.w); } -inline int CursesWindow::overwrite(CursesWindow &win) +inline int CursesWindow::overwrite(CursesWindow &win) { - return ::overwrite(w, win.w); + return ::overwrite(w, win.w); } -inline int CursesWindow::scroll() +inline int CursesWindow::scroll() { - return ::scroll(w); + return ::scroll(w); } -inline int CursesWindow::touchwin() +inline int CursesWindow::touchwin() { - return ::touchwin(w); + return ::touchwin(w); } -inline int CursesWindow::addch(const char ch) +inline int CursesWindow::addch(const char ch) { - return ::waddch(w, ch); + return ::waddch(w, ch); } -inline int CursesWindow::addstr(const char * str) +inline int CursesWindow::addstr(const char * str) { // The (char*) cast is to hack around prototypes in curses.h that // have const missing in the parameter lists. [E.g. SVR4] - return ::waddstr(w, (char*)str); + return ::waddstr(w, (char*)str); } -inline int CursesWindow::clear() +inline int CursesWindow::clear() { - return ::wclear(w); + return ::wclear(w); } -inline int CursesWindow::clrtobot() +inline int CursesWindow::clrtobot() { - return ::wclrtobot(w); + return ::wclrtobot(w); } -inline int CursesWindow::clrtoeol() +inline int CursesWindow::clrtoeol() { - return ::wclrtoeol(w); + return ::wclrtoeol(w); } -inline int CursesWindow::delch() +inline int CursesWindow::delch() { - return ::wdelch(w); + return ::wdelch(w); } -inline int CursesWindow::deleteln() +inline int CursesWindow::deleteln() { - return ::wdeleteln(w); + return ::wdeleteln(w); } -inline int CursesWindow::erase() +inline int CursesWindow::erase() { - return ::werase(w); + return ::werase(w); } -inline int CursesWindow::getch() +inline int CursesWindow::getch() { - return ::wgetch(w); + return ::wgetch(w); } -inline int CursesWindow::getstr(char * str) +inline int CursesWindow::getstr(char * str) { - return ::wgetstr(w, str); + return ::wgetstr(w, str); } -inline int CursesWindow::inch() +inline int CursesWindow::inch() { - return winch(w); + return winch(w); } -inline int CursesWindow::insch(char c) +inline int CursesWindow::insch(char c) { - return ::winsch(w, c); + return ::winsch(w, c); } -inline int CursesWindow::insertln() +inline int CursesWindow::insertln() { - return ::winsertln(w); + return ::winsertln(w); } -inline int CursesWindow::move(int y, int x) +inline int CursesWindow::move(int y, int x) { - return ::wmove(w, y, x); + return ::wmove(w, y, x); } @@ -524,56 +524,56 @@ inline int CursesWindow::mvinsch(int y, int x, char ch) return (::wmove(w, y, x)==ERR) ? ERR : ::winsch(w, ch); } -inline int CursesWindow::refresh() +inline int CursesWindow::refresh() { - return ::wrefresh(w); + return ::wrefresh(w); } -inline int CursesWindow::clearok(int bf) +inline int CursesWindow::clearok(int bf) { - return ::clearok(w,bf); + return ::clearok(w,bf); } -inline int CursesWindow::leaveok(int bf) +inline int CursesWindow::leaveok(int bf) { - return ::leaveok(w,bf); + return ::leaveok(w,bf); } -inline int CursesWindow::scrollok(int bf) +inline int CursesWindow::scrollok(int bf) { - return ::scrollok(w,bf); + return ::scrollok(w,bf); } #ifndef _no_flushok -inline int CursesWindow::flushok(int bf) +inline int CursesWindow::flushok(int bf) { - return ::flushok(w, bf); + return ::flushok(w, bf); } #endif -inline void CursesWindow::getyx(int& y, int& x) +inline void CursesWindow::getyx(int& y, int& x) { - ::getyx(w, y, x); + ::getyx(w, y, x); } -inline int CursesWindow::standout() +inline int CursesWindow::standout() { - return ::wstandout(w); + return ::wstandout(w); } -inline int CursesWindow::standend() +inline int CursesWindow::standend() { - return ::wstandend(w); + return ::wstandend(w); } -inline int CursesWindow::lines() +inline int CursesWindow::lines() { - return LINES; + return LINES; } -inline int CursesWindow::cols() +inline int CursesWindow::cols() { - return COLS; + return COLS; } inline CursesWindow* CursesWindow::child() diff --git a/gnu/lib/libg++/include/DLList.h b/gnu/lib/libg++/include/DLList.h index 36f73bcb4aab..ba7ee868fa9f 100644 --- a/gnu/lib/libg++/include/DLList.h +++ b/gnu/lib/libg++/include/DLList.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) diff --git a/gnu/lib/libg++/include/DiscUnif.h b/gnu/lib/libg++/include/DiscUnif.h index 5f26f90b9592..0cd6a0f07097 100644 --- a/gnu/lib/libg++/include/DiscUnif.h +++ b/gnu/lib/libg++/include/DiscUnif.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -25,7 +25,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // // The interval [lo..hi) -// +// class DiscreteUniform: public Random { long pLow; diff --git a/gnu/lib/libg++/include/Erlang.h b/gnu/lib/libg++/include/Erlang.h index 98093884f72c..18838fc44af5 100644 --- a/gnu/lib/libg++/include/Erlang.h +++ b/gnu/lib/libg++/include/Erlang.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -19,7 +19,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #ifdef __GNUG__ #pragma interface #endif -#define _Erlang_h 1 +#define _Erlang_h 1 #include <Random.h> diff --git a/gnu/lib/libg++/include/Fix.h b/gnu/lib/libg++/include/Fix.h index df76c94fb962..fab91b8e7b26 100644 --- a/gnu/lib/libg++/include/Fix.h +++ b/gnu/lib/libg++/include/Fix.h @@ -1,5 +1,5 @@ // -*- C++ -*- -// Fix.h : variable length fixed point data type +// Fix.h : variable length fixed point data type // #ifndef _Fix_h @@ -124,7 +124,7 @@ public: friend char* Ftoa(const Fix&, int width = default_print_width); void printon(ostream&, int width = default_print_width) const; friend Fix atoF(const char*, int len = default_length); - + friend istream& operator >> (istream&, Fix&); friend ostream& operator << (ostream&, const Fix&); @@ -184,7 +184,7 @@ Fix::mask (Fix::Rep* x) { int n = x->len & 0x0f; if ( n ) - x->s[x->siz - 1] &= 0xffff0000 >> n; + x->s[x->siz - 1] &= 0xffff0000 >> n; } inline Fix::Rep* @@ -269,7 +269,7 @@ Fix::operator = (const Fix& y) if ( rep->len == y.rep->len ) { ++y.rep->ref; if ( --rep->ref <= 0 ) delete rep; - rep = y.rep; + rep = y.rep; } else { unique(); @@ -290,37 +290,37 @@ Fix::operator = (double d) inline int operator == (const Fix& x, const Fix& y) { - return Fix::compare(x.rep, y.rep) == 0; + return Fix::compare(x.rep, y.rep) == 0; } inline int operator != (const Fix& x, const Fix& y) { - return Fix::compare(x.rep, y.rep) != 0; + return Fix::compare(x.rep, y.rep) != 0; } inline int operator < (const Fix& x, const Fix& y) { - return Fix::compare(x.rep, y.rep) < 0; + return Fix::compare(x.rep, y.rep) < 0; } inline int operator <= (const Fix& x, const Fix& y) { - return Fix::compare(x.rep, y.rep) <= 0; + return Fix::compare(x.rep, y.rep) <= 0; } inline int operator > (const Fix& x, const Fix& y) { - return Fix::compare(x.rep, y.rep) > 0; + return Fix::compare(x.rep, y.rep) > 0; } inline int operator >= (const Fix& x, const Fix& y) { - return Fix::compare(x.rep, y.rep) >= 0; + return Fix::compare(x.rep, y.rep) >= 0; } inline Fix& @@ -415,7 +415,7 @@ operator << (const Fix& x, int y) inline Fix operator >> (const Fix& x, int y) -{ +{ Fix::Rep* rep = Fix::shift(x.rep, -y); return rep; } diff --git a/gnu/lib/libg++/include/Fix16.h b/gnu/lib/libg++/include/Fix16.h index e598113ede88..2ab220975d9a 100644 --- a/gnu/lib/libg++/include/Fix16.h +++ b/gnu/lib/libg++/include/Fix16.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Kurt Baudendistel (gt-eedsp!baud@gatech.edu) adapted for libg++ by Doug Lea (dl@rocky.oswego.edu) @@ -58,8 +58,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // consists of a 16-bit mantissa (sign bit & 15 data bits). // -class Fix16 -{ +class Fix16 +{ friend class Fix32; short m; @@ -102,7 +102,7 @@ public: Fix16& operator -= (const Fix16& f); Fix16& operator *= (const Fix16& ); Fix16& operator /= (const Fix16& f); - + Fix16& operator <<=(int b); Fix16& operator >>=(int b); @@ -124,15 +124,15 @@ public: Fix16& operator *= (int g); }; - + // // Fix32 class: 32-bit Fixed point data type // // consists of a 32-bit mantissa (sign bit & 31 data bits). // -class Fix32 -{ +class Fix32 +{ friend class Fix16; _G_int32_t m; @@ -241,141 +241,141 @@ extern void inline Fix16::~Fix16() {} inline short Fix16::round(double d) -{ - return short( (d >= 0)? d + 0.5 : d - 0.5); +{ + return short( (d >= 0)? d + 0.5 : d - 0.5); } -inline Fix16::Fix16(short i) -{ - m = i; +inline Fix16::Fix16(short i) +{ + m = i; } -inline Fix16::Fix16(int i) -{ - m = i; +inline Fix16::Fix16(int i) +{ + m = i; } -inline Fix16::operator double() const -{ - return Fix16_div * m; +inline Fix16::operator double() const +{ + return Fix16_div * m; } -inline Fix16::Fix16() -{ - m = 0; +inline Fix16::Fix16() +{ + m = 0; } -inline Fix16::Fix16(const Fix16& f) -{ - m = f.m; +inline Fix16::Fix16(const Fix16& f) +{ + m = f.m; } -inline Fix16::Fix16(double d) +inline Fix16::Fix16(double d) { m = assign(d); } -inline Fix16& Fix16::operator=(const Fix16& f) -{ - m = f.m; - return *this; +inline Fix16& Fix16::operator=(const Fix16& f) +{ + m = f.m; + return *this; } -inline Fix16& Fix16::operator=(double d) -{ - m = assign(d); - return *this; +inline Fix16& Fix16::operator=(double d) +{ + m = assign(d); + return *this; } -inline Fix32::Fix32() -{ +inline Fix32::Fix32() +{ m = 0; } -inline Fix32::Fix32(_G_int32_t i) -{ +inline Fix32::Fix32(_G_int32_t i) +{ m = i; } -inline Fix32:: operator double() const -{ +inline Fix32:: operator double() const +{ return Fix32_div * m; } -inline Fix32::Fix32(const Fix32& f) -{ +inline Fix32::Fix32(const Fix32& f) +{ m = f.m; } -inline Fix32::Fix32(const Fix16& f) -{ +inline Fix32::Fix32(const Fix16& f) +{ m = _G_int32_t(f.m) << 16; } -inline Fix32::Fix32(double d) -{ +inline Fix32::Fix32(double d) +{ m = assign(d); } -inline Fix16::Fix16(const Fix32& f) -{ - m = f.m >> 16; +inline Fix16::Fix16(const Fix32& f) +{ + m = f.m >> 16; } inline Fix16& Fix16::operator=(const Fix32& f) -{ - m = f.m >> 16; - return *this; +{ + m = f.m >> 16; + return *this; } -inline Fix32& Fix32::operator=(const Fix32& f) -{ +inline Fix32& Fix32::operator=(const Fix32& f) +{ m = f.m; - return *this; + return *this; } -inline Fix32& Fix32::operator=(const Fix16& f) -{ +inline Fix32& Fix32::operator=(const Fix16& f) +{ m = _G_int32_t(f.m) << 16; return *this; } -inline Fix32& Fix32::operator=(double d) -{ +inline Fix32& Fix32::operator=(double d) +{ m = assign(d); - return *this; + return *this; } -inline short& mantissa(Fix16& f) -{ - return f.m; +inline short& mantissa(Fix16& f) +{ + return f.m; } -inline const short& mantissa(const Fix16& f) -{ - return f.m; +inline const short& mantissa(const Fix16& f) +{ + return f.m; } -inline double value(const Fix16& f) -{ - return double(f); +inline double value(const Fix16& f) +{ + return double(f); } -inline Fix16 Fix16::operator+() const -{ - return m; +inline Fix16 Fix16::operator+() const +{ + return m; } -inline Fix16 Fix16::operator-() const -{ - return -m; +inline Fix16 Fix16::operator-() const +{ + return -m; } -inline Fix16 operator+(const Fix16& f, const Fix16& g) +inline Fix16 operator+(const Fix16& f, const Fix16& g) { short sum = f.m + g.m; if ( (f.m ^ sum) & (g.m ^ sum) & Fix16_msb ) @@ -383,7 +383,7 @@ inline Fix16 operator+(const Fix16& f, const Fix16& g) return sum; } -inline Fix16 operator-(const Fix16& f, const Fix16& g) +inline Fix16 operator-(const Fix16& f, const Fix16& g) { short sum = f.m - g.m; if ( (f.m ^ sum) & (-g.m ^ sum) & Fix16_msb ) @@ -392,90 +392,90 @@ inline Fix16 operator-(const Fix16& f, const Fix16& g) } inline Fix32 operator*(const Fix16& f, const Fix16& g) -{ - return Fix32( _G_int32_t( _G_int32_t(f.m) * _G_int32_t(g.m) << 1)); +{ + return Fix32( _G_int32_t( _G_int32_t(f.m) * _G_int32_t(g.m) << 1)); } -inline Fix16 operator<<(const Fix16& a, int b) -{ - return a.m << b; +inline Fix16 operator<<(const Fix16& a, int b) +{ + return a.m << b; } -inline Fix16 operator>>(const Fix16& a, int b) -{ - return a.m >> b; +inline Fix16 operator>>(const Fix16& a, int b) +{ + return a.m >> b; } inline Fix16& Fix16:: operator+=(const Fix16& f) -{ - return *this = *this + f; +{ + return *this = *this + f; } -inline Fix16& Fix16:: operator-=(const Fix16& f) -{ - return *this = *this - f; +inline Fix16& Fix16:: operator-=(const Fix16& f) +{ + return *this = *this - f; } -inline Fix16& Fix16::operator*=(const Fix16& f) -{ - return *this = *this * f; +inline Fix16& Fix16::operator*=(const Fix16& f) +{ + return *this = *this * f; } -inline Fix16& Fix16:: operator/=(const Fix16& f) -{ - return *this = *this / f; +inline Fix16& Fix16:: operator/=(const Fix16& f) +{ + return *this = *this / f; } -inline Fix16& Fix16:: operator<<=(int b) -{ +inline Fix16& Fix16:: operator<<=(int b) +{ return *this = *this << b; } -inline Fix16& Fix16:: operator>>=(int b) -{ +inline Fix16& Fix16:: operator>>=(int b) +{ return *this = *this >> b; } -inline int operator==(const Fix16& f, const Fix16& g) -{ +inline int operator==(const Fix16& f, const Fix16& g) +{ return f.m == g.m; } -inline int operator!=(const Fix16& f, const Fix16& g) -{ +inline int operator!=(const Fix16& f, const Fix16& g) +{ return f.m != g.m; } -inline int operator>=(const Fix16& f, const Fix16& g) -{ +inline int operator>=(const Fix16& f, const Fix16& g) +{ return f.m >= g.m; } -inline int operator<=(const Fix16& f, const Fix16& g) -{ +inline int operator<=(const Fix16& f, const Fix16& g) +{ return f.m <= g.m; } -inline int operator>(const Fix16& f, const Fix16& g) -{ +inline int operator>(const Fix16& f, const Fix16& g) +{ return f.m > g.m; } -inline int operator<(const Fix16& f, const Fix16& g) -{ +inline int operator<(const Fix16& f, const Fix16& g) +{ return f.m < g.m; } inline istream& operator>>(istream& s, Fix16& f) -{ +{ double d; - s >> d; - f = d; - return s; + s >> d; + f = d; + return s; } inline ostream& operator<<(ostream& s, const Fix16& f) -{ +{ return s << double(f); } @@ -499,36 +499,36 @@ inline Fix16& Fix16::operator*=(int g) inline Fix32::~Fix32() {} inline _G_int32_t Fix32::round(double d) -{ +{ return _G_int32_t( (d >= 0)? d + 0.5 : d - 0.5); } -inline _G_int32_t& mantissa(Fix32& f) -{ +inline _G_int32_t& mantissa(Fix32& f) +{ return f.m; } -inline const _G_int32_t& mantissa(const Fix32& f) -{ +inline const _G_int32_t& mantissa(const Fix32& f) +{ return f.m; } -inline double value(const Fix32& f) -{ +inline double value(const Fix32& f) +{ return double(f); } inline Fix32 Fix32::operator+() const -{ +{ return m; } -inline Fix32 Fix32::operator-() const -{ +inline Fix32 Fix32::operator-() const +{ return -m; } -inline Fix32 operator+(const Fix32& f, const Fix32& g) +inline Fix32 operator+(const Fix32& f, const Fix32& g) { _G_int32_t sum = f.m + g.m; if ( (f.m ^ sum) & (g.m ^ sum) & Fix32_msb ) @@ -536,7 +536,7 @@ inline Fix32 operator+(const Fix32& f, const Fix32& g) return sum; } -inline Fix32 operator-(const Fix32& f, const Fix32& g) +inline Fix32 operator-(const Fix32& f, const Fix32& g) { _G_int32_t sum = f.m - g.m; if ( (f.m ^ sum) & (-g.m ^ sum) & Fix32_msb ) @@ -544,87 +544,87 @@ inline Fix32 operator-(const Fix32& f, const Fix32& g) return sum; } -inline Fix32 operator<<(const Fix32& a, int b) -{ +inline Fix32 operator<<(const Fix32& a, int b) +{ return a.m << b; } -inline Fix32 operator>>(const Fix32& a, int b) -{ +inline Fix32 operator>>(const Fix32& a, int b) +{ return a.m >> b; } -inline Fix32& Fix32::operator+=(const Fix32& f) -{ +inline Fix32& Fix32::operator+=(const Fix32& f) +{ return *this = *this + f; } -inline Fix32& Fix32::operator-=(const Fix32& f) -{ +inline Fix32& Fix32::operator-=(const Fix32& f) +{ return *this = *this - f; } -inline Fix32& Fix32::operator*=(const Fix32& f) -{ +inline Fix32& Fix32::operator*=(const Fix32& f) +{ return *this = *this * f; } -inline Fix32& Fix32::operator/=(const Fix32& f) -{ +inline Fix32& Fix32::operator/=(const Fix32& f) +{ return *this = *this / f; } -inline Fix32& Fix32::operator<<=(int b) -{ +inline Fix32& Fix32::operator<<=(int b) +{ return *this = *this << b; } -inline Fix32& Fix32::operator>>=(int b) -{ +inline Fix32& Fix32::operator>>=(int b) +{ return *this = *this >> b; } -inline int operator==(const Fix32& f, const Fix32& g) -{ +inline int operator==(const Fix32& f, const Fix32& g) +{ return f.m == g.m; } -inline int operator!=(const Fix32& f, const Fix32& g) -{ +inline int operator!=(const Fix32& f, const Fix32& g) +{ return f.m != g.m; } -inline int operator>=(const Fix32& f, const Fix32& g) -{ +inline int operator>=(const Fix32& f, const Fix32& g) +{ return f.m >= g.m; } -inline int operator<=(const Fix32& f, const Fix32& g) -{ +inline int operator<=(const Fix32& f, const Fix32& g) +{ return f.m <= g.m; } -inline int operator>(const Fix32& f, const Fix32& g) -{ +inline int operator>(const Fix32& f, const Fix32& g) +{ return f.m > g.m; } -inline int operator<(const Fix32& f, const Fix32& g) -{ +inline int operator<(const Fix32& f, const Fix32& g) +{ return f.m < g.m; } inline istream& operator>>(istream& s, Fix32& f) -{ +{ double d; - s >> d; - f = d; - return s; + s >> d; + f = d; + return s; } inline ostream& operator<<(ostream& s, const Fix32& f) -{ +{ return s << double(f); } diff --git a/gnu/lib/libg++/include/Fix24.h b/gnu/lib/libg++/include/Fix24.h index 5db346e36896..0f4daeaa9e6d 100644 --- a/gnu/lib/libg++/include/Fix24.h +++ b/gnu/lib/libg++/include/Fix24.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Kurt Baudendistel (gt-eedsp!baud@gatech.edu) adapted for libg++ by Doug Lea (dl@rocky.oswego.edu) @@ -26,7 +26,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #include <stream.h> #include <std.h> -// extra type definitions +// extra type definitions typedef struct { _G_int32_t u; @@ -37,14 +37,14 @@ typedef struct { static const int Fix24_shift = 31; - + static const double Fix24_fs = 2147483648., // 2^Fix24_shift Fix24_mult = Fix24_fs, Fix24_div = 1./Fix24_fs, Fix24_max = 1. - .5/Fix24_fs, Fix24_min = -1.; - + static const _G_uint32_t Fix24_msb = 0x80000000L, Fix24_lsb = 0x00000100L, @@ -57,21 +57,21 @@ static const double Fix48_min = -1., Fix48_div_u = 1./Fix24_fs, Fix48_div_l = 1./Fix48_fs; - + static const twolongs Fix48_msb = { 0x80000000L, 0L }, Fix48_lsb = { 0L, 0x00000100L }, Fix48_m_max = { 0x7fffff00L, 0xffffff00L }, Fix48_m_min = { 0x80000000L, 0L }; - + // // Fix24 class: 24-bit Fixed point data type // // consists of a 24-bit mantissa (sign bit & 23 data bits). // -class Fix24 -{ +class Fix24 +{ friend class Fix48; _G_int32_t m; @@ -133,15 +133,15 @@ public: void range_error(_G_int32_t&) const; }; - + // // Fix48 class: 48-bit Fixed point data type // // consists of a 48-bit mantissa (sign bit & 47 data bits). // -class Fix48 -{ +class Fix48 +{ friend class Fix24; twolongs m; @@ -242,85 +242,85 @@ extern void inline Fix24::~Fix24() {} -inline Fix24::Fix24(long i) -{ - m = i; +inline Fix24::Fix24(long i) +{ + m = i; } -inline Fix24::Fix24(int i) -{ - m = i; +inline Fix24::Fix24(int i) +{ + m = i; } inline Fix24::operator double() const -{ - return Fix24_div * m; +{ + return Fix24_div * m; } -inline Fix24::Fix24() -{ - m = 0; +inline Fix24::Fix24() +{ + m = 0; } -inline Fix24::Fix24(const Fix24& f) -{ - m = f.m; +inline Fix24::Fix24(const Fix24& f) +{ + m = f.m; } -inline Fix24::Fix24(double d) +inline Fix24::Fix24(double d) { m = assign(d); } -inline Fix24::Fix24(const Fix48& f) -{ +inline Fix24::Fix24(const Fix48& f) +{ m = f.m.u; } -inline Fix24& Fix24::operator=(const Fix24& f) -{ - m = f.m; - return *this; +inline Fix24& Fix24::operator=(const Fix24& f) +{ + m = f.m; + return *this; } -inline Fix24& Fix24::operator=(double d) -{ - m = assign(d); - return *this; +inline Fix24& Fix24::operator=(double d) +{ + m = assign(d); + return *this; } inline Fix24& Fix24::operator=(const Fix48& f) -{ +{ m = f.m.u; - return *this; + return *this; } inline _G_int32_t& mantissa(Fix24& f) -{ - return f.m; +{ + return f.m; } inline const _G_int32_t& mantissa(const Fix24& f) -{ - return f.m; +{ + return f.m; } inline double value(const Fix24& f) -{ - return double(f); +{ + return double(f); } -inline Fix24 Fix24::operator+() const -{ - return m; +inline Fix24 Fix24::operator+() const +{ + return m; } inline Fix24 Fix24::operator-() const -{ - return -m; +{ + return -m; } -inline Fix24 operator+(const Fix24& f, const Fix24& g) +inline Fix24 operator+(const Fix24& f, const Fix24& g) { _G_int32_t sum = f.m + g.m; if ( (f.m ^ sum) & (g.m ^ sum) & Fix24_msb ) @@ -328,7 +328,7 @@ inline Fix24 operator+(const Fix24& f, const Fix24& g) return sum; } -inline Fix24 operator-(const Fix24& f, const Fix24& g) +inline Fix24 operator-(const Fix24& f, const Fix24& g) { _G_int32_t sum = f.m - g.m; if ( (f.m ^ sum) & (-g.m ^ sum) & Fix24_msb ) @@ -336,23 +336,23 @@ inline Fix24 operator-(const Fix24& f, const Fix24& g) return sum; } -inline Fix24 operator*(const Fix24& a, int b) -{ - return a.m * b; +inline Fix24 operator*(const Fix24& a, int b) +{ + return a.m * b; } -inline Fix24 operator*(int b, const Fix24& a) -{ - return a * b; +inline Fix24 operator*(int b, const Fix24& a) +{ + return a * b; } -inline Fix24 operator<<(const Fix24& a, int b) -{ - return a.m << b; +inline Fix24 operator<<(const Fix24& a, int b) +{ + return a.m << b; } -inline Fix24 operator>>(const Fix24& a, int b) -{ +inline Fix24 operator>>(const Fix24& a, int b) +{ return (a.m >> b) & ~0xff; } @@ -361,236 +361,236 @@ inline Fix24& Fix24:: operator+=(const Fix24& f) return *this = *this + f; } -inline Fix24& Fix24:: operator-=(const Fix24& f) -{ - return *this = *this - f; +inline Fix24& Fix24:: operator-=(const Fix24& f) +{ + return *this = *this - f; } -inline Fix24& Fix24::operator*=(const Fix24& f) -{ - return *this = *this * f; +inline Fix24& Fix24::operator*=(const Fix24& f) +{ + return *this = *this * f; } -inline Fix24& Fix24:: operator/=(const Fix24& f) -{ - return *this = *this / f; +inline Fix24& Fix24:: operator/=(const Fix24& f) +{ + return *this = *this / f; } -inline Fix24& Fix24:: operator<<=(int b) -{ +inline Fix24& Fix24:: operator<<=(int b) +{ return *this = *this << b; } -inline Fix24& Fix24:: operator>>=(int b) -{ +inline Fix24& Fix24:: operator>>=(int b) +{ return *this = *this >> b; } inline Fix24& Fix24::operator*=(int b) -{ - return *this = *this * b; +{ + return *this = *this * b; } -inline int operator==(const Fix24& f, const Fix24& g) -{ +inline int operator==(const Fix24& f, const Fix24& g) +{ return f.m == g.m; } -inline int operator!=(const Fix24& f, const Fix24& g) -{ +inline int operator!=(const Fix24& f, const Fix24& g) +{ return f.m != g.m; } -inline int operator>=(const Fix24& f, const Fix24& g) -{ +inline int operator>=(const Fix24& f, const Fix24& g) +{ return f.m >= g.m; } -inline int operator<=(const Fix24& f, const Fix24& g) -{ +inline int operator<=(const Fix24& f, const Fix24& g) +{ return f.m <= g.m; } -inline int operator>(const Fix24& f, const Fix24& g) -{ +inline int operator>(const Fix24& f, const Fix24& g) +{ return f.m > g.m; } -inline int operator<(const Fix24& f, const Fix24& g) -{ +inline int operator<(const Fix24& f, const Fix24& g) +{ return f.m < g.m; } inline istream& operator>>(istream& s, Fix24& f) -{ +{ double d; - s >> d; - f = d; - return s; + s >> d; + f = d; + return s; } inline ostream& operator<<(ostream& s, const Fix24& f) -{ +{ return s << double(f); } inline Fix48::~Fix48() {} -inline Fix48::Fix48(twolongs i) -{ +inline Fix48::Fix48(twolongs i) +{ m = i; } inline Fix48:: operator double() const -{ +{ /* * Note: can't simply do Fix48_div_u * m.u + Fix48_div_l * m.l, because * m.u is signed and m.l is unsigned. */ return (m.u >= 0)? Fix48_div_u * m.u + Fix48_div_l * m.l : - (Fix48_div_u * ((_G_uint32_t)(m.u & 0xffffff00)) + (Fix48_div_u * ((_G_uint32_t)(m.u & 0xffffff00)) + Fix48_div_l * m.l) - 2; } -inline Fix48::Fix48() -{ +inline Fix48::Fix48() +{ m.u = 0; m.l = 0; } -inline Fix48::Fix48(const Fix48& f) -{ +inline Fix48::Fix48(const Fix48& f) +{ m = f.m; } -inline Fix48::Fix48(const Fix24& f) -{ +inline Fix48::Fix48(const Fix24& f) +{ m.u = f.m; m.l = 0; } -inline Fix48::Fix48(double d) -{ +inline Fix48::Fix48(double d) +{ m = assign(d); } -inline Fix48& Fix48::operator=(const Fix48& f) -{ +inline Fix48& Fix48::operator=(const Fix48& f) +{ m = f.m; - return *this; + return *this; } -inline Fix48& Fix48::operator=(const Fix24& f) -{ +inline Fix48& Fix48::operator=(const Fix24& f) +{ m.u = f.m; m.l = 0; return *this; } -inline Fix48& Fix48::operator=(double d) -{ +inline Fix48& Fix48::operator=(double d) +{ m = assign(d); - return *this; + return *this; } -inline twolongs& mantissa(Fix48& f) -{ +inline twolongs& mantissa(Fix48& f) +{ return f.m; } -inline const twolongs& mantissa(const Fix48& f) -{ +inline const twolongs& mantissa(const Fix48& f) +{ return f.m; } inline double value(const Fix48& f) -{ +{ return double(f); } -inline Fix48 Fix48::operator+() const -{ +inline Fix48 Fix48::operator+() const +{ return m; } inline Fix48 Fix48::operator-() const -{ +{ twolongs n; n.l = -m.l; n.u = ~m.u + ((n.l ^ m.l) & Fix24_msb ? 0 : Fix24_lsb); return Fix48(n); } -inline Fix48 operator*(int b, const Fix48& a) -{ - return a * b; +inline Fix48 operator*(int b, const Fix48& a) +{ + return a * b; } -inline Fix48& Fix48::operator+=(const Fix48& f) -{ +inline Fix48& Fix48::operator+=(const Fix48& f) +{ return *this = *this + f; } -inline Fix48& Fix48::operator-=(const Fix48& f) -{ +inline Fix48& Fix48::operator-=(const Fix48& f) +{ return *this = *this - f; } -inline Fix48& Fix48::operator*=(int b) -{ +inline Fix48& Fix48::operator*=(int b) +{ return *this = *this * b; } -inline Fix48& Fix48::operator<<=(int b) -{ +inline Fix48& Fix48::operator<<=(int b) +{ return *this = *this << b; } -inline Fix48& Fix48::operator>>=(int b) -{ +inline Fix48& Fix48::operator>>=(int b) +{ return *this = *this >> b; } -inline int operator==(const Fix48& f, const Fix48& g) -{ +inline int operator==(const Fix48& f, const Fix48& g) +{ return f.m.u == g.m.u && f.m.l == g.m.l; } -inline int operator!=(const Fix48& f, const Fix48& g) -{ +inline int operator!=(const Fix48& f, const Fix48& g) +{ return f.m.u != g.m.u || f.m.l != g.m.l; } -inline int operator>=(const Fix48& f, const Fix48& g) -{ +inline int operator>=(const Fix48& f, const Fix48& g) +{ return f.m.u >= g.m.u || (f.m.u == g.m.u && f.m.l >= g.m.l); } -inline int operator<=(const Fix48& f, const Fix48& g) -{ +inline int operator<=(const Fix48& f, const Fix48& g) +{ return f.m.u <= g.m.u || (f.m.u == g.m.u && f.m.l <= g.m.l); } -inline int operator>(const Fix48& f, const Fix48& g) -{ +inline int operator>(const Fix48& f, const Fix48& g) +{ return f.m.u > g.m.u || (f.m.u == g.m.u && f.m.l > g.m.l); } -inline int operator<(const Fix48& f, const Fix48& g) -{ +inline int operator<(const Fix48& f, const Fix48& g) +{ return f.m.u < g.m.u || (f.m.u == g.m.u && f.m.l < g.m.l); } inline istream& operator>>(istream& s, Fix48& f) -{ +{ double d; - s >> d; - f = d; - return s; + s >> d; + f = d; + return s; } inline ostream& operator<<(ostream& s, const Fix48& f) -{ +{ return s << double(f); } diff --git a/gnu/lib/libg++/include/Geom.h b/gnu/lib/libg++/include/Geom.h index 5cfa39aaa396..7d05b8388bf5 100644 --- a/gnu/lib/libg++/include/Geom.h +++ b/gnu/lib/libg++/include/Geom.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -19,7 +19,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #ifdef __GNUG__ #pragma interface #endif -#define _Geometric_h +#define _Geometric_h #include <Random.h> diff --git a/gnu/lib/libg++/include/GetOpt.h b/gnu/lib/libg++/include/GetOpt.h index 66ecf5c16165..9dfc3c6e6c04 100644 --- a/gnu/lib/libg++/include/GetOpt.h +++ b/gnu/lib/libg++/include/GetOpt.h @@ -1,4 +1,4 @@ -/* Getopt for GNU. +/* Getopt for GNU. Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc. (Modified by Douglas C. Schmidt for use with GNU G++.) @@ -45,51 +45,51 @@ private: /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. - + If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ - + static char *nextchar; - - + + /* Describe how to deal with options that follow non-option ARGV-elements. - + UNSPECIFIED means the caller did not specify anything; the default is then REQUIRE_ORDER if the environment variable _OPTIONS_FIRST is defined, PERMUTE otherwise. - + REQUIRE_ORDER means don't recognize them as options. Stop option processing when the first non-option is seen. This is what Unix does. - + PERMUTE is the default. We permute the contents of `argv' as we scan, so that eventually all the options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. - + RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code zero. Using `-' as the first character of the list of option characters requests this mode of operation. - + The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return EOF with `optind' != ARGC. */ - + enum OrderingEnum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER }; OrderingEnum ordering; /* Handle permutation of arguments. */ - + /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ - + static int first_nonopt; static int last_nonopt; - + void exchange (char **argv); public: /* For communication from `getopt' to the caller. @@ -97,31 +97,31 @@ public: the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ - + char *optarg; - + /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. - + When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. - + Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ - + int optind; /* Callers store zero here to inhibit the error message for unrecognized options. */ - + int opterr; - + int nargc; char **nargv; const char *noptstring; - + GetOpt (int argc, char **argv, const char *optstring); int operator () (void); }; diff --git a/gnu/lib/libg++/include/HypGeom.h b/gnu/lib/libg++/include/HypGeom.h index e16e6552ccee..1864e9151a26 100644 --- a/gnu/lib/libg++/include/HypGeom.h +++ b/gnu/lib/libg++/include/HypGeom.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -19,7 +19,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #ifdef __GNUG__ #pragma interface #endif -#define _HyperGeometric_h +#define _HyperGeometric_h #include <Random.h> diff --git a/gnu/lib/libg++/include/Integer.h b/gnu/lib/libg++/include/Integer.h index 7e67ae5be6e2..b5c1768a7bef 100644 --- a/gnu/lib/libg++/include/Integer.h +++ b/gnu/lib/libg++/include/Integer.h @@ -1,6 +1,6 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -29,7 +29,7 @@ struct IntRep // internal Integer representations { unsigned short len; // current length unsigned short sz; // allocated space (0 means static). - short sgn; // 1 means >= 0; 0 means < 0 + short sgn; // 1 means >= 0; 0 means < 0 unsigned short s[1]; // represented as ushort array starting here }; @@ -67,7 +67,7 @@ extern int ucompare(const IntRep*, const IntRep*); extern int ucompare(const IntRep*, long); extern char* Itoa(const IntRep* x, int base = 10, int width = 0); extern char* cvtItoa(const IntRep* x, char* fmt, int& fmtlen, int base, - int showbase, int width, int align_right, + int showbase, int width, int align_right, char fillchar, char Xcase, int showpos); extern IntRep* atoIntRep(const char* s, int base = 10); extern long Itolong(const IntRep*); @@ -152,14 +152,14 @@ public: friend void negate(const Integer& x, Integer& dest); friend void complement(const Integer& x, Integer& dest); - friend int compare(const Integer&, const Integer&); - friend int ucompare(const Integer&, const Integer&); + friend int compare(const Integer&, const Integer&); + friend int ucompare(const Integer&, const Integer&); friend void add(const Integer& x, const Integer& y, Integer& dest); friend void sub(const Integer& x, const Integer& y, Integer& dest); friend void mul(const Integer& x, const Integer& y, Integer& dest); friend void div(const Integer& x, const Integer& y, Integer& dest); friend void mod(const Integer& x, const Integer& y, Integer& dest); - friend void divide(const Integer& x, const Integer& y, + friend void divide(const Integer& x, const Integer& y, Integer& q, Integer& r); friend void and(const Integer& x, const Integer& y, Integer& dest); friend void or(const Integer& x, const Integer& y, Integer& dest); @@ -168,8 +168,8 @@ public: friend void rshift(const Integer& x, const Integer& y, Integer& dest); friend void pow(const Integer& x, const Integer& y, Integer& dest); - friend int compare(const Integer&, long); - friend int ucompare(const Integer&, long); + friend int compare(const Integer&, long); + friend int ucompare(const Integer&, long); friend void add(const Integer& x, long y, Integer& dest); friend void sub(const Integer& x, long y, Integer& dest); friend void mul(const Integer& x, long y, Integer& dest); @@ -183,8 +183,8 @@ public: friend void rshift(const Integer& x, long y, Integer& dest); friend void pow(const Integer& x, long y, Integer& dest); - friend int compare(long, const Integer&); - friend int ucompare(long, const Integer&); + friend int compare(long, const Integer&); + friend int ucompare(long, const Integer&); friend void add(long x, const Integer& y, Integer& dest); friend void sub(long x, const Integer& y, Integer& dest); friend void mul(long x, const Integer& y, Integer& dest); @@ -203,7 +203,7 @@ public: friend char* Itoa(const Integer& x, int base = 10, int width = 0); friend Integer atoI(const char* s, int base = 10); void printon(ostream& s, int base = 10, int width = 0) const; - + friend istream& operator >> (istream& s, Integer& y); friend ostream& operator << (ostream& s, const Integer& y); @@ -211,7 +211,7 @@ public: int initialized() const; void error(const char* msg) const; - int OK() const; + int OK() const; }; @@ -263,7 +263,7 @@ public: Integer pow(const Integer& x, const Integer& y); Integer pow(const Integer& x, long y); - Integer Ipow(long x, long y); // x to the y as Integer + Integer Ipow(long x, long y); // x to the y as Integer extern char* dec(const Integer& x, int width = 0); @@ -498,62 +498,62 @@ inline void xor(long x, const Integer& y, Integer& dest) inline int operator == (const Integer& x, const Integer& y) { - return compare(x, y) == 0; + return compare(x, y) == 0; } inline int operator == (const Integer& x, long y) { - return compare(x, y) == 0; + return compare(x, y) == 0; } inline int operator != (const Integer& x, const Integer& y) { - return compare(x, y) != 0; + return compare(x, y) != 0; } inline int operator != (const Integer& x, long y) { - return compare(x, y) != 0; + return compare(x, y) != 0; } inline int operator < (const Integer& x, const Integer& y) { - return compare(x, y) < 0; + return compare(x, y) < 0; } inline int operator < (const Integer& x, long y) { - return compare(x, y) < 0; + return compare(x, y) < 0; } inline int operator <= (const Integer& x, const Integer& y) { - return compare(x, y) <= 0; + return compare(x, y) <= 0; } inline int operator <= (const Integer& x, long y) { - return compare(x, y) <= 0; + return compare(x, y) <= 0; } inline int operator > (const Integer& x, const Integer& y) { - return compare(x, y) > 0; + return compare(x, y) > 0; } inline int operator > (const Integer& x, long y) { - return compare(x, y) > 0; + return compare(x, y) > 0; } inline int operator >= (const Integer& x, const Integer& y) { - return compare(x, y) >= 0; + return compare(x, y) >= 0; } inline int operator >= (const Integer& x, long y) { - return compare(x, y) >= 0; + return compare(x, y) >= 0; } @@ -738,12 +738,12 @@ inline char* Itoa(const Integer& y, int base, int width) -inline long lg(const Integer& x) +inline long lg(const Integer& x) { return lg(x.rep); } -// constructive operations +// constructive operations #if defined(__GNUG__) && !defined(_G_NO_NRV) @@ -926,179 +926,179 @@ inline Integer gcd(const Integer& x, const Integer& y) return r #else /* NO_NRV */ -inline Integer operator + (const Integer& x, const Integer& y) +inline Integer operator + (const Integer& x, const Integer& y) { Integer r; add(x, y, r); return r; } -inline Integer operator + (const Integer& x, long y) +inline Integer operator + (const Integer& x, long y) { Integer r; add(x, y, r); return r; } -inline Integer operator + (long x, const Integer& y) +inline Integer operator + (long x, const Integer& y) { Integer r; add(x, y, r); return r; } -inline Integer operator - (const Integer& x, const Integer& y) +inline Integer operator - (const Integer& x, const Integer& y) { Integer r; sub(x, y, r); return r; } -inline Integer operator - (const Integer& x, long y) +inline Integer operator - (const Integer& x, long y) { Integer r; sub(x, y, r); return r; } -inline Integer operator - (long x, const Integer& y) +inline Integer operator - (long x, const Integer& y) { Integer r; sub(x, y, r); return r; } -inline Integer operator * (const Integer& x, const Integer& y) +inline Integer operator * (const Integer& x, const Integer& y) { Integer r; mul(x, y, r); return r; } -inline Integer operator * (const Integer& x, long y) +inline Integer operator * (const Integer& x, long y) { Integer r; mul(x, y, r); return r; } -inline Integer operator * (long x, const Integer& y) +inline Integer operator * (long x, const Integer& y) { Integer r; mul(x, y, r); return r; } -inline Integer sqr(const Integer& x) +inline Integer sqr(const Integer& x) { Integer r; mul(x, x, r); return r; } -inline Integer operator & (const Integer& x, const Integer& y) +inline Integer operator & (const Integer& x, const Integer& y) { Integer r; and(x, y, r); return r; } -inline Integer operator & (const Integer& x, long y) +inline Integer operator & (const Integer& x, long y) { Integer r; and(x, y, r); return r; } -inline Integer operator & (long x, const Integer& y) +inline Integer operator & (long x, const Integer& y) { Integer r; and(x, y, r); return r; } -inline Integer operator | (const Integer& x, const Integer& y) +inline Integer operator | (const Integer& x, const Integer& y) { Integer r; or(x, y, r); return r; } -inline Integer operator | (const Integer& x, long y) +inline Integer operator | (const Integer& x, long y) { Integer r; or(x, y, r); return r; } -inline Integer operator | (long x, const Integer& y) +inline Integer operator | (long x, const Integer& y) { Integer r; or(x, y, r); return r; } -inline Integer operator ^ (const Integer& x, const Integer& y) +inline Integer operator ^ (const Integer& x, const Integer& y) { Integer r; xor(x, y, r); return r; } -inline Integer operator ^ (const Integer& x, long y) +inline Integer operator ^ (const Integer& x, long y) { Integer r; xor(x, y, r); return r; } -inline Integer operator ^ (long x, const Integer& y) +inline Integer operator ^ (long x, const Integer& y) { Integer r; xor(x, y, r); return r; } -inline Integer operator / (const Integer& x, const Integer& y) +inline Integer operator / (const Integer& x, const Integer& y) { Integer r; div(x, y, r); return r; } -inline Integer operator / (const Integer& x, long y) +inline Integer operator / (const Integer& x, long y) { Integer r; div(x, y, r); return r; } -inline Integer operator % (const Integer& x, const Integer& y) +inline Integer operator % (const Integer& x, const Integer& y) { Integer r; mod(x, y, r); return r; } -inline Integer operator % (const Integer& x, long y) +inline Integer operator % (const Integer& x, long y) { Integer r; mod(x, y, r); return r; } -inline Integer operator << (const Integer& x, const Integer& y) +inline Integer operator << (const Integer& x, const Integer& y) { Integer r; lshift(x, y, r); return r; } -inline Integer operator << (const Integer& x, long y) +inline Integer operator << (const Integer& x, long y) { Integer r; lshift(x, y, r); return r; } -inline Integer operator >> (const Integer& x, const Integer& y) +inline Integer operator >> (const Integer& x, const Integer& y) { Integer r; rshift(x, y, r); return r; } -inline Integer operator >> (const Integer& x, long y) +inline Integer operator >> (const Integer& x, long y) { Integer r; rshift(x, y, r); return r; } -inline Integer pow(const Integer& x, long y) +inline Integer pow(const Integer& x, long y) { Integer r; pow(x, y, r); return r; } -inline Integer Ipow(long x, long y) +inline Integer Ipow(long x, long y) { Integer r(x); pow(r, y, r); return r; } -inline Integer pow(const Integer& x, const Integer& y) +inline Integer pow(const Integer& x, const Integer& y) { Integer r; pow(x, y, r); return r; } -inline Integer abs(const Integer& x) +inline Integer abs(const Integer& x) { Integer r; abs(x, r); return r; } -inline Integer operator - (const Integer& x) +inline Integer operator - (const Integer& x) { Integer r; negate(x, r); return r; } -inline Integer operator ~ (const Integer& x) +inline Integer operator ~ (const Integer& x) { Integer r; complement(x, r); return r; } -inline Integer atoI(const char* s, int base) +inline Integer atoI(const char* s, int base) { Integer r; r.rep = atoIntRep(s, base); return r; } -inline Integer gcd(const Integer& x, const Integer& y) +inline Integer gcd(const Integer& x, const Integer& y) { Integer r; r.rep = gcd(x.rep, y.rep); return r; } diff --git a/gnu/lib/libg++/include/LogNorm.h b/gnu/lib/libg++/include/LogNorm.h index ac98141e62a3..b5c4b463b151 100644 --- a/gnu/lib/libg++/include/LogNorm.h +++ b/gnu/lib/libg++/include/LogNorm.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -19,7 +19,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #ifdef __GNUG__ #pragma interface #endif -#define _LogNormal_h +#define _LogNormal_h #include <Normal.h> @@ -44,7 +44,7 @@ inline void LogNormal::setState() pMean = log(m2 / sqrt(logVariance + m2) ); // from ch@heike.informatik.uni-dortmund.de: // (was pVariance = log((sqrt(logVariance + m2)/m2 )); ) - pStdDev = sqrt(log((logVariance + m2)/m2 )); + pStdDev = sqrt(log((logVariance + m2)/m2 )); } inline LogNormal::LogNormal(double mean, double variance, RNG *gen) diff --git a/gnu/lib/libg++/include/MLCG.h b/gnu/lib/libg++/include/MLCG.h index 8fa08a856fe0..9b288a731283 100644 --- a/gnu/lib/libg++/include/MLCG.h +++ b/gnu/lib/libg++/include/MLCG.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -16,7 +16,7 @@ License along with this library; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MLCG_h -#define _MLCG_h 1 +#define _MLCG_h 1 #ifdef __GNUG__ #pragma interface #endif diff --git a/gnu/lib/libg++/include/NegExp.h b/gnu/lib/libg++/include/NegExp.h index b96f9132dfa8..041e083bffde 100644 --- a/gnu/lib/libg++/include/NegExp.h +++ b/gnu/lib/libg++/include/NegExp.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -25,7 +25,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // // Negative Exponential Random Numbers // -// +// #include <Random.h> diff --git a/gnu/lib/libg++/include/Normal.h b/gnu/lib/libg++/include/Normal.h index 8c8358ee1215..ab80f2a14d2d 100644 --- a/gnu/lib/libg++/include/Normal.h +++ b/gnu/lib/libg++/include/Normal.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -19,7 +19,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #ifdef __GNUG__ #pragma interface #endif -#define _Normal_h +#define _Normal_h #include <Random.h> @@ -31,7 +31,7 @@ protected: double pMean; double pVariance; double pStdDev; - + public: Normal(double xmean, double xvariance, RNG *gen); double mean(); diff --git a/gnu/lib/libg++/include/Obstack.h b/gnu/lib/libg++/include/Obstack.h index 384157f630ef..6e353fb56a22 100644 --- a/gnu/lib/libg++/include/Obstack.h +++ b/gnu/lib/libg++/include/Obstack.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -84,127 +84,127 @@ public: inline Obstack::~Obstack() { - _free(0); + _free(0); } inline void* Obstack::base() { - return objectbase; + return objectbase; } inline void* Obstack::next_free() { - return nextfree; + return nextfree; } inline int Obstack::alignment_mask() { - return alignmentmask; + return alignmentmask; } inline int Obstack::chunk_size() { - return chunksize; + return chunksize; } inline int Obstack::size() { - return nextfree - objectbase; + return nextfree - objectbase; } inline int Obstack::room() { - return chunklimit - nextfree; + return chunklimit - nextfree; } inline void Obstack:: grow(const void* data, int size) { - if (nextfree+size > chunklimit) + if (nextfree+size > chunklimit) newchunk(size); memcpy(nextfree, data, size); - nextfree += size; + nextfree += size; } inline void Obstack:: grow(const void* data, int size, char terminator) { - if (nextfree+size+1 > chunklimit) + if (nextfree+size+1 > chunklimit) newchunk(size+1); memcpy(nextfree, data, size); - nextfree += size; - *(nextfree)++ = terminator; + nextfree += size; + *(nextfree)++ = terminator; } inline void Obstack:: grow(const char* s) { - grow((const void*)s, strlen(s), 0); + grow((const void*)s, strlen(s), 0); } inline void Obstack:: grow(char c) { - if (nextfree+1 > chunklimit) - newchunk(1); - *(nextfree)++ = c; + if (nextfree+1 > chunklimit) + newchunk(1); + *(nextfree)++ = c; } inline void Obstack:: blank(int size) { - if (nextfree+size > chunklimit) + if (nextfree+size > chunklimit) newchunk(size); - nextfree += size; + nextfree += size; } inline void* Obstack::finish(char terminator) { - grow(terminator); - return finish(); + grow(terminator); + return finish(); } inline void* Obstack::copy(const void* data, int size) { grow (data, size); - return finish(); + return finish(); } inline void* Obstack::copy(const void* data, int size, char terminator) { - grow(data, size, terminator); - return finish(); + grow(data, size, terminator); + return finish(); } inline void* Obstack::copy(const char* s) { - grow((const void*)s, strlen(s), 0); - return finish(); + grow((const void*)s, strlen(s), 0); + return finish(); } inline void* Obstack::copy(char c) { grow(c); - return finish(); + return finish(); } inline void* Obstack::alloc(int size) { blank(size); - return finish(); + return finish(); } -inline void Obstack:: free(void* obj) +inline void Obstack:: free(void* obj) { if (obj >= (void*)chunk && obj<(void*)chunklimit) nextfree = objectbase = (char *) obj; - else - _free(obj); + else + _free(obj); } inline void Obstack:: grow_fast(char c) { - *(nextfree)++ = c; + *(nextfree)++ = c; } inline void Obstack:: blank_fast(int size) { - nextfree += size; + nextfree += size; } inline void Obstack:: shrink(int size) // from ken@cs.rochester.edu diff --git a/gnu/lib/libg++/include/PlotFile.h b/gnu/lib/libg++/include/PlotFile.h index 91ab6aeb5eb1..1a401cd57f1f 100644 --- a/gnu/lib/libg++/include/PlotFile.h +++ b/gnu/lib/libg++/include/PlotFile.h @@ -22,10 +22,10 @@ the resulting executable to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. */ -/* +/* a very simple implementation of a class to output unix "plot" format plotter files. See corresponding unix man pages for - more details. + more details. written by Doug Lea (dl@rocky.oswego.edu) converted to use iostream library by Per Bothner (bothner@cygnus.com) @@ -39,7 +39,7 @@ the executable file might be covered by the GNU General Public License. */ #include <fstream.h> -/* +/* Some plot libraries have the `box' command to draw boxes. Some don't. `box' is included here via moves & lines to allow both possiblilties. */ @@ -51,21 +51,21 @@ protected: PlotFile& cmd(char c); PlotFile& operator << (const int x); PlotFile& operator << (const char *s); - + public: - + PlotFile() : ofstream() { } PlotFile(int fd) : ofstream(fd) { } PlotFile(const char *name, int mode=ios::out, int prot=0664) : ofstream(name, mode, prot) { } - + // PlotFile& remove() { ofstream::remove(); return *this; } - + // int filedesc() { return ofstream::filedesc(); } // const char* name() { return File::name(); } // void setname(const char* newname) { File::setname(newname); } // int iocount() { return File::iocount(); } - + PlotFile& arc(const int xi, const int yi, const int x0, const int y0, const int x1, const int y1); @@ -75,7 +75,7 @@ public: PlotFile& cont(const int xi, const int yi); PlotFile& dot(const int xi, const int yi, const int dx, int n, const int* pat); - PlotFile& erase(); + PlotFile& erase(); PlotFile& label(const char* s); PlotFile& line(const int x0, const int y0, const int x1, const int y1); diff --git a/gnu/lib/libg++/include/Poisson.h b/gnu/lib/libg++/include/Poisson.h index e5851453be1f..895b072fc9d4 100644 --- a/gnu/lib/libg++/include/Poisson.h +++ b/gnu/lib/libg++/include/Poisson.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -19,7 +19,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #ifdef __GNUG__ #pragma interface #endif -#define _Poisson_h +#define _Poisson_h #include <Random.h> diff --git a/gnu/lib/libg++/include/RNG.h b/gnu/lib/libg++/include/RNG.h index b924fb697c34..81b5e16797aa 100644 --- a/gnu/lib/libg++/include/RNG.h +++ b/gnu/lib/libg++/include/RNG.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) diff --git a/gnu/lib/libg++/include/Random.h b/gnu/lib/libg++/include/Random.h index 925698f68b83..e3e624acdf51 100644 --- a/gnu/lib/libg++/include/Random.h +++ b/gnu/lib/libg++/include/Random.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) diff --git a/gnu/lib/libg++/include/Rational.h b/gnu/lib/libg++/include/Rational.h index 131aabc79dd4..1f8b76b57b03 100644 --- a/gnu/lib/libg++/include/Rational.h +++ b/gnu/lib/libg++/include/Rational.h @@ -1,6 +1,6 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -171,22 +171,22 @@ inline int operator != (const Rational& x, const Rational& y) inline int operator < (const Rational& x, const Rational& y) { - return compare(x, y) < 0; + return compare(x, y) < 0; } inline int operator <= (const Rational& x, const Rational& y) { - return compare(x, y) <= 0; + return compare(x, y) <= 0; } inline int operator > (const Rational& x, const Rational& y) { - return compare(x, y) > 0; + return compare(x, y) > 0; } inline int operator >= (const Rational& x, const Rational& y) { - return compare(x, y) >= 0; + return compare(x, y) >= 0; } inline int sign(const Rational& x) @@ -200,25 +200,25 @@ inline void Rational::negate() } -inline Rational& Rational::operator += (const Rational& y) +inline Rational& Rational::operator += (const Rational& y) { add(*this, y, *this); return *this; } -inline Rational& Rational::operator -= (const Rational& y) +inline Rational& Rational::operator -= (const Rational& y) { sub(*this, y, *this); return *this; } -inline Rational& Rational::operator *= (const Rational& y) +inline Rational& Rational::operator *= (const Rational& y) { mul(*this, y, *this); return *this; } -inline Rational& Rational::operator /= (const Rational& y) +inline Rational& Rational::operator /= (const Rational& y) { div(*this, y, *this); return *this; @@ -264,7 +264,7 @@ inline Rational operator / (const Rational& x, const Rational& y) return r #else /* NO_NRV */ -inline Rational operator + (const Rational& x, const Rational& y) +inline Rational operator + (const Rational& x, const Rational& y) { Rational r; add(x, y, r); return r; } diff --git a/gnu/lib/libg++/include/Regex.h b/gnu/lib/libg++/include/Regex.h index c8cf7319f244..adc1cea1354d 100644 --- a/gnu/lib/libg++/include/Regex.h +++ b/gnu/lib/libg++/include/Regex.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -44,15 +44,15 @@ protected: re_registers* reg; public: - Regex(const char* t, - int fast = 0, - int bufsize = 40, + Regex(const char* t, + int fast = 0, + int bufsize = 40, const char* transtable = 0); ~Regex(); int match(const char* s, int len, int pos = 0) const; - int search(const char* s, int len, + int search(const char* s, int len, int& matchlen, int startpos = 0) const; int match_info(int& start, int& length, int nth = 0) const; diff --git a/gnu/lib/libg++/include/RndInt.h b/gnu/lib/libg++/include/RndInt.h index b16c7f88ec89..bf0f955db21d 100644 --- a/gnu/lib/libg++/include/RndInt.h +++ b/gnu/lib/libg++/include/RndInt.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1990 Free Software Foundation adapted from a submission from John Reidl <riedl@cs.purdue.edu> @@ -40,13 +40,13 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // in a specified range. By default the range is 0..1. Since in my // experience random numbers are often needed for a wide variety of // ranges in the same program, this generator accepts a new low or high value -// as an argument to the asLong and operator() methods to temporarily +// as an argument to the asLong and operator() methods to temporarily // override stored values #include <math.h> #include <RNG.h> -class RandomInteger +class RandomInteger { protected: RNG *pGenerator; @@ -90,20 +90,20 @@ class RandomInteger }; -inline RandomInteger::RandomInteger(long low, long high, RNG *gen) +inline RandomInteger::RandomInteger(long low, long high, RNG *gen) : pLow((low < high) ? low : high), pHigh((low < high) ? high : low), pGenerator(gen) {} -inline RandomInteger::RandomInteger(long high, RNG *gen) +inline RandomInteger::RandomInteger(long high, RNG *gen) : pLow((0 < high) ? 0 : high), pHigh((0 < high) ? high : 0), pGenerator(gen) {} - -inline RandomInteger::RandomInteger(RNG *gen) + +inline RandomInteger::RandomInteger(RNG *gen) : pLow(0), pHigh(1), pGenerator(gen) @@ -113,28 +113,28 @@ inline RNG* RandomInteger::generator() const { return pGenerator;} inline long RandomInteger::low() const { return pLow; } inline long RandomInteger::high() const { return pHigh; } -inline RNG* RandomInteger::generator(RNG *gen) +inline RNG* RandomInteger::generator(RNG *gen) { RNG *tmp = pGenerator; pGenerator = gen; return tmp; } -inline long RandomInteger::low(long x) +inline long RandomInteger::low(long x) { long tmp = pLow; pLow = x; return tmp; } -inline long RandomInteger:: high(long x) +inline long RandomInteger:: high(long x) { long tmp = pHigh; pHigh = x; return tmp; } inline long RandomInteger:: _asLong(long low, long high) -{ +{ return (pGenerator->asLong() % (high-low+1)) + low; } -inline long RandomInteger:: asLong() +inline long RandomInteger:: asLong() { return _asLong(pLow, pHigh); } @@ -149,7 +149,7 @@ inline long RandomInteger:: asLong(long low, long high) return _asLong(low, high); } -inline long RandomInteger:: operator () () +inline long RandomInteger:: operator () () { return _asLong(pLow, pHigh); } @@ -167,7 +167,7 @@ inline long RandomInteger:: operator () (long low, long high) -inline int RandomInteger:: asInt() +inline int RandomInteger:: asInt() { return int(asLong()); } diff --git a/gnu/lib/libg++/include/SFile.h b/gnu/lib/libg++/include/SFile.h index 3726844cf564..d4b4c71fd20a 100644 --- a/gnu/lib/libg++/include/SFile.h +++ b/gnu/lib/libg++/include/SFile.h @@ -41,10 +41,10 @@ public: SFile(int fd, int size); SFile(const char *name, int size, int mode, int prot=0664); void open(const char *name, int size, int mode, int prot=0664); - + int size() { return sz; } int setsize(int s) { int old = sz; sz = s; return old; } - + SFile& get(void* x); SFile& put(void* x); SFile& operator[](long i); diff --git a/gnu/lib/libg++/include/SLList.h b/gnu/lib/libg++/include/SLList.h index 8c133d7ebf6d..4be457fd3524 100644 --- a/gnu/lib/libg++/include/SLList.h +++ b/gnu/lib/libg++/include/SLList.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988, 1992 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -104,7 +104,7 @@ public: Pix ins_after(Pix p, const T& item) { return BaseSLList::ins_after(p, &item); } void join(SLList<T>& a) { BaseSLList::join(a); } - + T& front() { if (last == 0) error("front: empty list"); return ((SLNode<T>*)last->tl)->hd; } diff --git a/gnu/lib/libg++/include/SmplHist.h b/gnu/lib/libg++/include/SmplHist.h index a9a755018374..54614b99bd90 100644 --- a/gnu/lib/libg++/include/SmplHist.h +++ b/gnu/lib/libg++/include/SmplHist.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -28,7 +28,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. extern const int SampleHistogramMinimum; extern const int SampleHistogramMaximum; -class SampleHistogram : public SampleStatistic +class SampleHistogram : public SampleStatistic { protected: short howManyBuckets; @@ -36,7 +36,7 @@ protected: double *bucketLimit; public: - + SampleHistogram(double low, double hi, double bucketWidth = -1.0); ~SampleHistogram(); diff --git a/gnu/lib/libg++/include/SmplStat.h b/gnu/lib/libg++/include/SmplStat.h index 191ec676f75b..2ed5ab984c0b 100644 --- a/gnu/lib/libg++/include/SmplStat.h +++ b/gnu/lib/libg++/include/SmplStat.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -34,7 +34,7 @@ protected: SampleStatistic(); virtual ~SampleStatistic(); - virtual void reset(); + virtual void reset(); virtual void operator+=(double); int samples(); @@ -54,7 +54,7 @@ protected: extern void default_SampleStatistic_error_handler(const char*); extern one_arg_error_handler_t SampleStatistic_error_handler; -extern one_arg_error_handler_t +extern one_arg_error_handler_t set_SampleStatistic_error_handler(one_arg_error_handler_t f); inline SampleStatistic:: SampleStatistic(){ reset();} diff --git a/gnu/lib/libg++/include/String.h b/gnu/lib/libg++/include/String.h index 95b2bdf9e67d..7a3d82b5bb19 100644 --- a/gnu/lib/libg++/include/String.h +++ b/gnu/lib/libg++/include/String.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -28,9 +28,9 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. struct StrRep // internal String representations { - unsigned short len; // string length + unsigned short len; // string length unsigned short sz; // allocated space - char s[1]; // the string starts here + char s[1]; // the string starts here // (at least 1 char for trailing null) // allocated & expanded via non-public fcts }; @@ -89,7 +89,7 @@ public: int matches(const Regex& r) const; -// IO +// IO friend ostream& operator<<(ostream& s, const SubString& x); @@ -99,7 +99,7 @@ public: int empty() const; const char* chars() const; - int OK() const; + int OK() const; }; @@ -140,12 +140,12 @@ public: // concatenation - String& operator += (const String& y); + String& operator += (const String& y); String& operator += (const SubString& y); String& operator += (const char* t); String& operator += (char c); - void prepend(const String& y); + void prepend(const String& y); void prepend(const SubString& y); void prepend(const char* t); void prepend(char c); @@ -169,7 +169,7 @@ public: friend inline void cat(const char*, const char*, String&); friend inline void cat(const char*, char, String&); -// double concatenation, by request. (yes, there are too many versions, +// double concatenation, by request. (yes, there are too many versions, // but if one is supported, then the others should be too...) // Concatenate first 3 args, store in last arg @@ -204,11 +204,11 @@ public: // return position of target in string or -1 for failure - int index(char c, int startpos = 0) const; - int index(const String& y, int startpos = 0) const; - int index(const SubString& y, int startpos = 0) const; - int index(const char* t, int startpos = 0) const; - int index(const Regex& r, int startpos = 0) const; + int index(char c, int startpos = 0) const; + int index(const String& y, int startpos = 0) const; + int index(const SubString& y, int startpos = 0) const; + int index(const char* t, int startpos = 0) const; + int index(const Regex& r, int startpos = 0) const; // return 1 if target appears anyhere in String; else 0 @@ -218,7 +218,7 @@ public: int contains(const char* t) const; int contains(const Regex& r) const; -// return 1 if target appears anywhere after position pos +// return 1 if target appears anywhere after position pos // (or before, if pos is negative) in String; else 0 int contains(char c, int pos) const; @@ -237,7 +237,7 @@ public: // return number of occurences of target in String - int freq(char c) const; + int freq(char c) const; int freq(const String& y) const; int freq(const SubString& y) const; int freq(const char* t) const; @@ -251,11 +251,11 @@ public: SubString at(int pos, int len); SubString operator () (int pos, int len); // synonym for at - SubString at(const String& x, int startpos = 0); - SubString at(const SubString& x, int startpos = 0); + SubString at(const String& x, int startpos = 0); + SubString at(const SubString& x, int startpos = 0); SubString at(const char* t, int startpos = 0); SubString at(char c, int startpos = 0); - SubString at(const Regex& r, int startpos = 0); + SubString at(const Regex& r, int startpos = 0); SubString before(int pos); SubString before(const String& x, int startpos = 0); @@ -311,14 +311,14 @@ public: // split string into array res at separators; return number of elements - friend int split(const String& x, String res[], int maxn, + friend int split(const String& x, String res[], int maxn, const String& sep); - friend int split(const String& x, String res[], int maxn, + friend int split(const String& x, String res[], int maxn, const Regex& sep); - friend String common_prefix(const String& x, const String& y, + friend String common_prefix(const String& x, const String& y, int startpos = 0); - friend String common_suffix(const String& x, const String& y, + friend String common_suffix(const String& x, const String& y, int startpos = -1); friend String replicate(char c, int n); friend String replicate(const String& y, int n); @@ -358,7 +358,7 @@ public: friend ostream& operator<<(ostream& s, const SubString& x); friend istream& operator>>(istream& s, String& x); - friend int readline(istream& s, String& x, + friend int readline(istream& s, String& x, char terminator = '\n', int discard_terminator = 1); @@ -409,17 +409,17 @@ inline const char* SubString::chars() const { return &(S.rep->s[pos]); } // constructors -inline String::String() +inline String::String() : rep(&_nilStrRep) {} -inline String::String(const String& x) +inline String::String(const String& x) : rep(Scopy(0, x.rep)) {} -inline String::String(const char* t) +inline String::String(const char* t) : rep(Salloc(0, t, -1, -1)) {} inline String::String(const char* t, int tlen) : rep(Salloc(0, t, tlen, tlen)) {} inline String::String(const SubString& y) : rep(Salloc(0, y.chars(), y.length(), y.length())) {} -inline String::String(char c) +inline String::String(char c) : rep(Salloc(0, &c, 1, 1)) {} inline String::~String() { if (rep != &_nilStrRep) delete rep; } @@ -434,7 +434,7 @@ inline SubString::~SubString() {} // assignment inline String& String::operator = (const String& y) -{ +{ rep = Scopy(rep, y.rep); return *this; } @@ -773,67 +773,67 @@ inline String operator + (const String& x, const String& y) String r; cat(x, y, r); return r; } -inline String operator + (const String& x, const SubString& y) +inline String operator + (const String& x, const SubString& y) { String r; cat(x, y, r); return r; } -inline String operator + (const String& x, const char* y) +inline String operator + (const String& x, const char* y) { String r; cat(x, y, r); return r; } -inline String operator + (const String& x, char y) +inline String operator + (const String& x, char y) { String r; cat(x, y, r); return r; } -inline String operator + (const SubString& x, const String& y) +inline String operator + (const SubString& x, const String& y) { String r; cat(x, y, r); return r; } -inline String operator + (const SubString& x, const SubString& y) +inline String operator + (const SubString& x, const SubString& y) { String r; cat(x, y, r); return r; } -inline String operator + (const SubString& x, const char* y) +inline String operator + (const SubString& x, const char* y) { String r; cat(x, y, r); return r; } -inline String operator + (const SubString& x, char y) +inline String operator + (const SubString& x, char y) { String r; cat(x, y, r); return r; } -inline String operator + (const char* x, const String& y) +inline String operator + (const char* x, const String& y) { String r; cat(x, y, r); return r; } -inline String operator + (const char* x, const SubString& y) +inline String operator + (const char* x, const SubString& y) { String r; cat(x, y, r); return r; } -inline String reverse(const String& x) +inline String reverse(const String& x) { String r; r.rep = Sreverse(x.rep, r.rep); return r; } -inline String upcase(const String& x) +inline String upcase(const String& x) { String r; r.rep = Supcase(x.rep, r.rep); return r; } -inline String downcase(const String& x) +inline String downcase(const String& x) { String r; r.rep = Sdowncase(x.rep, r.rep); return r; } -inline String capitalize(const String& x) +inline String capitalize(const String& x) { String r; r.rep = Scapitalize(x.rep, r.rep); return r; } @@ -849,12 +849,12 @@ inline void String::prepend(const String& y) inline void String::prepend(const char* y) { - rep = Sprepend(rep, y, -1); + rep = Sprepend(rep, y, -1); } inline void String::prepend(char y) { - rep = Sprepend(rep, &y, 1); + rep = Sprepend(rep, &y, 1); } inline void String::prepend(const SubString& y) @@ -890,31 +890,31 @@ inline void String::capitalize() // element extraction -inline char& String::operator [] (int i) -{ +inline char& String::operator [] (int i) +{ if (((unsigned)i) >= length()) error("invalid index"); return rep->s[i]; } inline const char& String::operator [] (int i) const -{ +{ if (((unsigned)i) >= length()) error("invalid index"); return rep->s[i]; } inline char String::elem (int i) const -{ +{ if (((unsigned)i) >= length()) error("invalid index"); return rep->s[i]; } inline char String::firstchar() const -{ +{ return elem(0); } inline char String::lastchar() const -{ +{ return elem(length() - 1); } @@ -926,17 +926,17 @@ inline int String::index(char c, int startpos) const } inline int String::index(const char* t, int startpos) const -{ +{ return search(startpos, length(), t); } inline int String::index(const String& y, int startpos) const -{ +{ return search(startpos, length(), y.chars(), y.length()); } inline int String::index(const SubString& y, int startpos) const -{ +{ return search(startpos, length(), y.chars(), y.length()); } @@ -951,17 +951,17 @@ inline int String::contains(char c) const } inline int String::contains(const char* t) const -{ +{ return search(0, length(), t) >= 0; } inline int String::contains(const String& y) const -{ +{ return search(0, length(), y.chars(), y.length()) >= 0; } inline int String::contains(const SubString& y) const -{ +{ return search(0, length(), y.chars(), y.length()) >= 0; } @@ -1024,17 +1024,17 @@ inline int String::matches(const Regex& r, int p) const inline int SubString::contains(const char* t) const -{ +{ return S.search(pos, pos+len, t) >= 0; } inline int SubString::contains(const String& y) const -{ +{ return S.search(pos, pos+len, y.chars(), y.length()) >= 0; } inline int SubString::contains(const SubString& y) const -{ +{ return S.search(pos, pos+len, y.chars(), y.length()) >= 0; } @@ -1088,99 +1088,99 @@ inline ostream& operator<<(ostream& s, const String& x) // a zillion comparison operators -inline int operator==(const String& x, const String& y) +inline int operator==(const String& x, const String& y) { - return compare(x, y) == 0; + return compare(x, y) == 0; } inline int operator!=(const String& x, const String& y) { - return compare(x, y) != 0; + return compare(x, y) != 0; } inline int operator>(const String& x, const String& y) { - return compare(x, y) > 0; + return compare(x, y) > 0; } inline int operator>=(const String& x, const String& y) { - return compare(x, y) >= 0; + return compare(x, y) >= 0; } inline int operator<(const String& x, const String& y) { - return compare(x, y) < 0; + return compare(x, y) < 0; } inline int operator<=(const String& x, const String& y) { - return compare(x, y) <= 0; + return compare(x, y) <= 0; } -inline int operator==(const String& x, const SubString& y) +inline int operator==(const String& x, const SubString& y) { - return compare(x, y) == 0; + return compare(x, y) == 0; } inline int operator!=(const String& x, const SubString& y) { - return compare(x, y) != 0; + return compare(x, y) != 0; } -inline int operator>(const String& x, const SubString& y) +inline int operator>(const String& x, const SubString& y) { - return compare(x, y) > 0; + return compare(x, y) > 0; } inline int operator>=(const String& x, const SubString& y) { - return compare(x, y) >= 0; + return compare(x, y) >= 0; } -inline int operator<(const String& x, const SubString& y) +inline int operator<(const String& x, const SubString& y) { - return compare(x, y) < 0; + return compare(x, y) < 0; } inline int operator<=(const String& x, const SubString& y) { - return compare(x, y) <= 0; + return compare(x, y) <= 0; } -inline int operator==(const String& x, const char* t) +inline int operator==(const String& x, const char* t) { - return compare(x, t) == 0; + return compare(x, t) == 0; } -inline int operator!=(const String& x, const char* t) +inline int operator!=(const String& x, const char* t) { - return compare(x, t) != 0; + return compare(x, t) != 0; } -inline int operator>(const String& x, const char* t) +inline int operator>(const String& x, const char* t) { - return compare(x, t) > 0; + return compare(x, t) > 0; } -inline int operator>=(const String& x, const char* t) +inline int operator>=(const String& x, const char* t) { - return compare(x, t) >= 0; + return compare(x, t) >= 0; } -inline int operator<(const String& x, const char* t) +inline int operator<(const String& x, const char* t) { - return compare(x, t) < 0; + return compare(x, t) < 0; } -inline int operator<=(const String& x, const char* t) +inline int operator<=(const String& x, const char* t) { - return compare(x, t) <= 0; + return compare(x, t) <= 0; } -inline int operator==(const SubString& x, const String& y) +inline int operator==(const SubString& x, const String& y) { - return compare(y, x) == 0; + return compare(y, x) == 0; } inline int operator!=(const SubString& x, const String& y) @@ -1188,29 +1188,29 @@ inline int operator!=(const SubString& x, const String& y) return compare(y, x) != 0; } -inline int operator>(const SubString& x, const String& y) +inline int operator>(const SubString& x, const String& y) { return compare(y, x) < 0; } -inline int operator>=(const SubString& x, const String& y) +inline int operator>=(const SubString& x, const String& y) { return compare(y, x) <= 0; } -inline int operator<(const SubString& x, const String& y) +inline int operator<(const SubString& x, const String& y) { return compare(y, x) > 0; } -inline int operator<=(const SubString& x, const String& y) +inline int operator<=(const SubString& x, const String& y) { return compare(y, x) >= 0; } -inline int operator==(const SubString& x, const SubString& y) +inline int operator==(const SubString& x, const SubString& y) { - return compare(x, y) == 0; + return compare(x, y) == 0; } inline int operator!=(const SubString& x, const SubString& y) @@ -1218,7 +1218,7 @@ inline int operator!=(const SubString& x, const SubString& y) return compare(x, y) != 0; } -inline int operator>(const SubString& x, const SubString& y) +inline int operator>(const SubString& x, const SubString& y) { return compare(x, y) > 0; } @@ -1228,7 +1228,7 @@ inline int operator>=(const SubString& x, const SubString& y) return compare(x, y) >= 0; } -inline int operator<(const SubString& x, const SubString& y) +inline int operator<(const SubString& x, const SubString& y) { return compare(x, y) < 0; } @@ -1238,34 +1238,34 @@ inline int operator<=(const SubString& x, const SubString& y) return compare(x, y) <= 0; } -inline int operator==(const SubString& x, const char* t) +inline int operator==(const SubString& x, const char* t) { - return compare(x, t) == 0; + return compare(x, t) == 0; } -inline int operator!=(const SubString& x, const char* t) +inline int operator!=(const SubString& x, const char* t) { return compare(x, t) != 0; } -inline int operator>(const SubString& x, const char* t) +inline int operator>(const SubString& x, const char* t) { - return compare(x, t) > 0; + return compare(x, t) > 0; } -inline int operator>=(const SubString& x, const char* t) +inline int operator>=(const SubString& x, const char* t) { - return compare(x, t) >= 0; + return compare(x, t) >= 0; } -inline int operator<(const SubString& x, const char* t) +inline int operator<(const SubString& x, const char* t) { - return compare(x, t) < 0; + return compare(x, t) < 0; } -inline int operator<=(const SubString& x, const char* t) +inline int operator<=(const SubString& x, const char* t) { - return compare(x, t) <= 0; + return compare(x, t) <= 0; } @@ -1275,7 +1275,7 @@ inline SubString String::_substr(int first, int l) { if (first < 0 || (unsigned)(first + l) > length() ) return SubString(_nilString, 0, 0) ; - else + else return SubString(*this, first, l); } diff --git a/gnu/lib/libg++/include/Uniform.h b/gnu/lib/libg++/include/Uniform.h index 5933f6b09b6f..91536ebedf1a 100644 --- a/gnu/lib/libg++/include/Uniform.h +++ b/gnu/lib/libg++/include/Uniform.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -25,7 +25,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // // The interval [lo..hi] -// +// class Uniform: public Random { double pLow; diff --git a/gnu/lib/libg++/include/Weibull.h b/gnu/lib/libg++/include/Weibull.h index d03567aa74c4..c0360dcdfac6 100644 --- a/gnu/lib/libg++/include/Weibull.h +++ b/gnu/lib/libg++/include/Weibull.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Dirk Grunwald (grunwald@cs.uiuc.edu) @@ -19,7 +19,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #ifdef __GNUG__ #pragma interface #endif -#define _Weibull_h +#define _Weibull_h #include <Random.h> @@ -30,7 +30,7 @@ protected: double pBeta; void setState(); - + public: Weibull(double alpha, double beta, RNG *gen); @@ -47,7 +47,7 @@ public: inline void Weibull::setState() { pInvAlpha = 1.0 / pAlpha; } - + inline Weibull::Weibull(double alpha, double beta, RNG *gen) : Random(gen) { pAlpha = alpha; diff --git a/gnu/lib/libg++/include/_G_config.h b/gnu/lib/libg++/include/_G_config.h index fabb5707fe37..cbd1acf4078f 100644 --- a/gnu/lib/libg++/include/_G_config.h +++ b/gnu/lib/libg++/include/_G_config.h @@ -1,4 +1,4 @@ -/* AUTOMATICALLY GENERATED; DO NOT EDIT! */ +/* AUTOMATICALLY GENERATED; DO NOT EDIT! */ #include <sys/types.h> #ifndef _G_config_h #define _G_config_h diff --git a/gnu/lib/libg++/include/builtin.h b/gnu/lib/libg++/include/builtin.h index 73bb43187dde..e2d7bcee7909 100644 --- a/gnu/lib/libg++/include/builtin.h +++ b/gnu/lib/libg++/include/builtin.h @@ -1,6 +1,6 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988, 1992 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -42,7 +42,7 @@ typedef void (*one_arg_error_handler_t)(const char*); typedef void (*two_arg_error_handler_t)(const char*, const char*); long gcd(long, long); -long lg(unsigned long); +long lg(unsigned long); double pow(double, long); long pow(long, long); @@ -60,30 +60,30 @@ extern _VOLATILE_VOID default_two_arg_error_handler(const char*, const char*); extern two_arg_error_handler_t lib_error_handler; -extern two_arg_error_handler_t +extern two_arg_error_handler_t set_lib_error_handler(two_arg_error_handler_t f); #if !defined(IV) #if ! _G_MATH_H_INLINES /* hpux and SCO define this in math.h */ -inline double abs(double arg) +inline double abs(double arg) { return (arg < 0.0)? -arg : arg; } #endif -inline float abs(float arg) +inline float abs(float arg) { return (arg < 0.0)? -arg : arg; } -inline short abs(short arg) +inline short abs(short arg) { return (arg < 0)? -arg : arg; } -inline long abs(long arg) +inline long abs(long arg) { return (arg < 0)? -arg : arg; } diff --git a/gnu/lib/libg++/include/builtinbuf.h b/gnu/lib/libg++/include/builtinbuf.h index fb91e6a83ff7..d67629a1de65 100644 --- a/gnu/lib/libg++/include/builtinbuf.h +++ b/gnu/lib/libg++/include/builtinbuf.h @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/include/compare.h b/gnu/lib/libg++/include/compare.h index bd13614179ca..aec3c30bd679 100644 --- a/gnu/lib/libg++/include/compare.h +++ b/gnu/lib/libg++/include/compare.h @@ -1,6 +1,6 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) diff --git a/gnu/lib/libg++/include/defines.h b/gnu/lib/libg++/include/defines.h index 0f2fb3be4f37..f5056b69c80b 100644 --- a/gnu/lib/libg++/include/defines.h +++ b/gnu/lib/libg++/include/defines.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1994 Free Software Foundation written by Jason Merrill (jason@cygnus.com) diff --git a/gnu/lib/libg++/include/editbuf.h b/gnu/lib/libg++/include/editbuf.h index 8535155d6d44..2cac3bb8c2ad 100644 --- a/gnu/lib/libg++/include/editbuf.h +++ b/gnu/lib/libg++/include/editbuf.h @@ -39,9 +39,9 @@ typedef /*unsigned*/ char buf_char; // Logical pos from start of buffer (does not count gap). typedef long buf_index; - + // Pos from start of buffer, possibly including gap_size. -typedef long buf_offset; +typedef long buf_offset; #if 0 struct buf_cookie { diff --git a/gnu/lib/libg++/include/floatio.h b/gnu/lib/libg++/include/floatio.h index edfe2971135a..880f8074c849 100644 --- a/gnu/lib/libg++/include/floatio.h +++ b/gnu/lib/libg++/include/floatio.h @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/include/iomanip.h b/gnu/lib/libg++/include/iomanip.h index bf3d6f46c06b..a87e7bf63e5c 100644 --- a/gnu/lib/libg++/include/iomanip.h +++ b/gnu/lib/libg++/include/iomanip.h @@ -42,10 +42,10 @@ template<class TP> class smanip; // TP = Type Param template<class TP> class sapp { ios& (*_f)(ios&, TP); -public: +public: sapp(ios& (*f)(ios&, TP)) : _f(f) {} // - smanip<TP> operator()(TP a) + smanip<TP> operator()(TP a) { return smanip<TP>(_f, a); } }; @@ -55,7 +55,7 @@ template <class TP> class smanip { public: smanip(ios& (*f)(ios&, TP), TP a) : _f(f), _a(a) {} // - friend + friend istream& operator>>(istream& i, const smanip<TP>& m); friend ostream& operator<<(ostream& o, const smanip<TP>& m); @@ -85,11 +85,11 @@ extern template ostream& operator<<(ostream&, const smanip<ios::fmtflags>&); // Input-Stream Manipulators //----------------------------------------------------------------------------- // -template<class TP> class imanip; +template<class TP> class imanip; template<class TP> class iapp { istream& (*_f)(istream&, TP); -public: +public: iapp(istream& (*f)(istream&,TP)) : _f(f) {} // imanip<TP> operator()(TP a) @@ -102,7 +102,7 @@ template <class TP> class imanip { public: imanip(istream& (*f)(istream&, TP), TP a) : _f(f), _a(a) {} // - friend + friend istream& operator>>(istream& i, const imanip<TP>& m) { return (*m._f)( i, m._a); } }; @@ -112,11 +112,11 @@ public: // Output-Stream Manipulators //----------------------------------------------------------------------------- // -template<class TP> class omanip; +template<class TP> class omanip; template<class TP> class oapp { ostream& (*_f)(ostream&, TP); -public: +public: oapp(ostream& (*f)(ostream&,TP)) : _f(f) {} // omanip<TP> operator()(TP a) @@ -141,7 +141,7 @@ public: // // Macro to define an iomanip function, with one argument -// The underlying function is `__iomanip_<name>' +// The underlying function is `__iomanip_<name>' // #define __DEFINE_IOMANIP_FN1(type,param,function) \ extern ios& __iomanip_##function (ios&, param); \ diff --git a/gnu/lib/libg++/include/iostream.h b/gnu/lib/libg++/include/iostream.h index e370be2725a9..4802b37b0dea 100644 --- a/gnu/lib/libg++/include/iostream.h +++ b/gnu/lib/libg++/include/iostream.h @@ -1,4 +1,4 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. +/* This is part of libio/iostream, providing -*- C++ -*- input/output. Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/include/iostreamP.h b/gnu/lib/libg++/include/iostreamP.h index 720deb32ee91..e24c93f115c7 100644 --- a/gnu/lib/libg++/include/iostreamP.h +++ b/gnu/lib/libg++/include/iostreamP.h @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/include/libio.h b/gnu/lib/libg++/include/libio.h index 8a9c25beee0c..f00b730f5e2d 100644 --- a/gnu/lib/libg++/include/libio.h +++ b/gnu/lib/libg++/include/libio.h @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free @@ -185,21 +185,21 @@ struct _IO_FILE { char *_IO_save_end; /* Pointer to end of non-current get area. */ struct _IO_marker *_markers; - + struct _IO_FILE *_chain; - + struct _IO_jump_t *_jumps; /* Jump table */ - + int _fileno; int _blksize; _IO_off_t _offset; - + #define __HAVE_COLUMN /* temporary */ /* 1+column number of pbase(); 0 is unknown. */ unsigned short _cur_column; char _unused; char _shortbuf[1]; - + /* char* _save_gptr; char* _save_egptr; */ }; diff --git a/gnu/lib/libg++/include/libioP.h b/gnu/lib/libg++/include/libioP.h index ca870479671f..074b9d7fa0cd 100644 --- a/gnu/lib/libg++/include/libioP.h +++ b/gnu/lib/libg++/include/libioP.h @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/include/parsestream.h b/gnu/lib/libg++/include/parsestream.h index b1687073ad49..c0dfce2c51fb 100644 --- a/gnu/lib/libg++/include/parsestream.h +++ b/gnu/lib/libg++/include/parsestream.h @@ -67,7 +67,7 @@ class parsebuf : public streambuf { // Length of current line, not counting either '\n'. int line_length() { return _line_length; } - // Current line - not a copy, so file ops may trash it. + // Current line - not a copy, so file ops may trash it. virtual char* current_line(); virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); virtual streambuf* setbuf(char* p, int len); diff --git a/gnu/lib/libg++/include/rx.h b/gnu/lib/libg++/include/rx.h index 0c9db1e49024..edb26b4a8c00 100644 --- a/gnu/lib/libg++/include/rx.h +++ b/gnu/lib/libg++/include/rx.h @@ -67,7 +67,7 @@ typedef int (*rx_sp_comparer) (void * a, void * b); typedef int (*rx_sp_comparer) (); #endif -struct rx_sp_node +struct rx_sp_node { void * key; void * data; @@ -135,7 +135,7 @@ struct rx_hash_rules /* Matchers decide what to do by examining a series of these. * Instruction types are described below. */ -struct rx_inx +struct rx_inx { void * inx; void * data; @@ -179,7 +179,7 @@ struct rx /* --------- The remaining fields are for internal use only. --------- */ /* --------- But! they should be initialized to 0. --------- */ /* NODEC is the number of nodes in the NFA with non-epsilon - * orx transitions. + * orx transitions. */ int nodec; @@ -196,7 +196,7 @@ struct rx /* A memo for sets of states in the possible_future lists of an nfa: */ struct rx_hash set_list_memo; - /* The instruction table is indexed by the enum of instructions defined in + /* The instruction table is indexed by the enum of instructions defined in * rxrun.h. The values in the table are used to fill in the `inx' * slot of instruction frames (see rxrun.h). */ @@ -213,7 +213,7 @@ struct rx /* An RX NFA may contain epsilon edges labeled with side effects. * These side effects represent match actions that can not normally be * defined in a `pure' NFA; for example, recording the location at - * which a paren is crossed in a register structure. + * which a paren is crossed in a register structure. * * A matcher is supposed to find a particular path * through the NFA (such as leftmost-longest), and then to execute the @@ -222,7 +222,7 @@ struct rx * backtracking. * * As the NFA is manipulated during matching sets of side effects. - * Simple lists are used to hold side effect lists. + * Simple lists are used to hold side effect lists. */ typedef void * rx_side_effect; @@ -287,7 +287,7 @@ struct rexp_node struct rx_nfa_state { - int id; + int id; struct rx_nfa_edge *edges; struct rx_possible_future *futures; unsigned int is_final:1; @@ -333,17 +333,17 @@ struct rx_possible_future enum rx_opcode { - /* + /* * BACKTRACK_POINT is invoked when a transition results in more * than one possible future. * * There is one occurence of this instruction per transition_class - * structure; that occurence is only ever executed if the + * structure; that occurence is only ever executed if the * transition_class contains a list of more than 1 edge. */ rx_backtrack_point = 0, /* data is (struct transition_class *) */ - /* + /* * RX_DO_SIDE_EFFECTS evaluates the side effects of an epsilon path. * There is one occurence of this instruction per rx_distinct_future. * This instruction is skipped if a rx_distinct_future has no side effects. @@ -351,7 +351,7 @@ enum rx_opcode rx_do_side_effects = rx_backtrack_point + 1, /* data is (struct rx_distinct_future *) */ - /* + /* * RX_CACHE_MISS instructions are stored in rx_distinct_futures whose * destination superstate has been reclaimed (or was never built). * It recomputes the destination superstate. @@ -361,9 +361,9 @@ enum rx_opcode rx_cache_miss = rx_do_side_effects + 1, /* data is (struct rx_distinct_future *) */ - /* + /* * RX_NEXT_CHAR is called to consume the next character and take the - * corresponding transition. This is the only instruction that uses + * corresponding transition. This is the only instruction that uses * the DATA field of the instruction frame instead of DATA_2. * (see EXPLORE_FUTURE in regex.c). */ @@ -373,7 +373,7 @@ enum rx_opcode */ rx_backtrack = rx_next_char + 1, /* no data */ - /* + /* * RX_ERROR_INX is stored only in places that should never be executed. */ rx_error_inx = rx_backtrack + 1, /* Not supposed to occur. */ @@ -390,7 +390,7 @@ extern void * rx_id_instruction_table[rx_num_instructions]; /* If the instruction is `rx_next_char' then data is valid. Otherwise it's 0 * and data_2 is valid. */ -struct rx_inx +struct rx_inx { void * inx; void * data; @@ -431,7 +431,7 @@ struct rx_superset /* Every character occurs in at most one super edge per super-state. * But, that edge might have more than one option, indicating a point - * of non-determinism. + * of non-determinism. */ struct rx_super_edge { @@ -447,7 +447,7 @@ struct rx_super_edge * without warning. To protect a superstate, use LOCK_SUPERSTATE. * * Joe Keane thought of calling these superstates and several people - * have commented on what a good name it is for what they do. + * have commented on what a good name it is for what they do. */ struct rx_superstate { @@ -501,7 +501,7 @@ typedef void (*rx_morecore_fn)(struct rx_cache *); typedef void (*rx_morecore_fn)(); #endif -/* You use this to control the allocation of superstate data +/* You use this to control the allocation of superstate data * during matching. Most of it should be initialized to 0. * * A MORECORE function is necessary. It should allocate @@ -512,10 +512,10 @@ typedef void (*rx_morecore_fn)(); * the system will try to allocate. The default is 128. Batch style * applications that are very regexp intensive should use as high a number * as possible without thrashing. - * + * * The LOCAL_CSET_SIZE is the number of characters in a character set. * It is therefore the number of entries in a superstate transition table. - * Generally, it should be 256. If your character set has 16 bits, + * Generally, it should be 256. If your character set has 16 bits, * it is better to translate your regexps into equivalent 8 bit patterns. */ @@ -523,7 +523,7 @@ struct rx_cache { struct rx_hash_rules superset_hash_rules; - /* Objects are allocated by incrementing a pointer that + /* Objects are allocated by incrementing a pointer that * scans across rx_blocklists. */ struct rx_blocklist * memory; @@ -614,7 +614,7 @@ typedef enum rx_get_burst_return (*rx_get_burst_fn) (struct rx_string_position * pos, void * app_closure, int stop); - + #else typedef enum rx_get_burst_return (*rx_get_burst_fn) (); #endif @@ -628,7 +628,7 @@ enum rx_back_check_return rx_back_check_fail }; -/* Back_check should advance the position it is passed +/* Back_check should advance the position it is passed * over rparen - lparen characters and return pass iff * the characters starting at POS match those indexed * by [LPAREN..RPAREN]. @@ -645,7 +645,7 @@ typedef enum rx_back_check_return unsigned char * translate, void * app_closure, int stop); - + #else typedef enum rx_back_check_return (*rx_back_check_fn) (); #endif @@ -683,7 +683,7 @@ enum rx_search_return /* regex.h - * + * * The remaining declarations replace regex.h. */ @@ -707,7 +707,7 @@ typedef enum REG_EESCAPE, /* Trailing backslash. */ REG_ESUBREG, /* Invalid back reference. */ REG_EBRACK, /* Unmatched left bracket. */ - REG_EPAREN, /* Parenthesis imbalance. */ + REG_EPAREN, /* Parenthesis imbalance. */ REG_EBRACE, /* Unmatched \{. */ REG_BADBR, /* Invalid contents of \{\}. */ REG_ERANGE, /* Invalid range end. */ @@ -741,8 +741,8 @@ enum re_side_effects }; /* These hold paramaters for the kinds of side effects that are possible - * in the supported pattern languages. These include things like the - * numeric bounds of {} operators and the index of paren registers for + * in the supported pattern languages. These include things like the + * numeric bounds of {} operators and the index of paren registers for * subexpression measurement or backreferencing. */ struct re_se_params @@ -761,10 +761,10 @@ struct re_pattern_buffer unsigned int no_sub:1; /* If set, don't return register offsets. */ unsigned int not_bol:1; /* If set, the anchors ('^' and '$') don't */ - unsigned int not_eol:1; /* match at the ends of the string. */ + unsigned int not_eol:1; /* match at the ends of the string. */ unsigned int newline_anchor:1;/* If true, an anchor at a newline matches.*/ unsigned int least_subs:1; /* If set, and returning registers, return - * as few values as possible. Only + * as few values as possible. Only * backreferenced groups and group 0 (the whole * match) will be returned. */ @@ -780,18 +780,18 @@ struct re_pattern_buffer unsigned int is_anchored:1; /* Anchorded by ^? */ unsigned int begbuf_only:1; /* Anchored to char position 0? */ - + /* If REGS_UNALLOCATED, allocate space in the `regs' structure * for `max (RE_NREGS, re_nsub + 1)' groups. * If REGS_REALLOCATE, reallocate space if necessary. - * If REGS_FIXED, use what's there. + * If REGS_FIXED, use what's there. */ #define REGS_UNALLOCATED 0 #define REGS_REALLOCATE 1 #define REGS_FIXED 2 unsigned int regs_allocated:2; - + /* Either a translate table to apply to all characters before * comparing them, or zero for no translation. The translation * is applied to a pattern when it is compiled and to a string @@ -799,11 +799,11 @@ struct re_pattern_buffer */ unsigned char * translate; - /* If this is a valid pointer, it tells rx not to store the extents of + /* If this is a valid pointer, it tells rx not to store the extents of * certain subexpressions (those corresponding to non-zero entries). * Passing 0x1 is the same as passing an array of all ones. Passing 0x0 * is the same as passing an array of all zeros. - * The array should contain as many entries as their are subexps in the + * The array should contain as many entries as their are subexps in the * regexp. */ char * syntax_parens; @@ -820,7 +820,7 @@ struct re_pattern_buffer char *fastmap; unsigned int fastmap_accurate:1; /* These three are internal. */ - unsigned int can_match_empty:1; + unsigned int can_match_empty:1; struct rx_nfa_state * start; /* The nfa starting state. */ /* This is the list of iterator bounds for {lo,hi} constructs. @@ -871,7 +871,7 @@ typedef struct #define RE_BACKSLASH_ESCAPE_IN_LISTS (1) /* If this bit is not set, then + and ? are operators, and \+ and \? are - literals. + literals. If set, then \+ and \? are operators and + and ? are literals. */ #define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) @@ -887,7 +887,7 @@ typedef struct ^ is an anchor if it is at the beginning of a regular expression or after an open-group or an alternation operator; $ is an anchor if it is at the end of a regular expression, or - before a close-group or an alternation operator. + before a close-group or an alternation operator. This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because POSIX draft 11.2 says that * etc. in leading positions is undefined. @@ -898,7 +898,7 @@ typedef struct /* If this bit is set, then special characters are always special regardless of where they are in the pattern. If this bit is not set, then special characters are special only in - some contexts; otherwise they are ordinary. Specifically, + some contexts; otherwise they are ordinary. Specifically, * + ? and intervals are only special when not after the beginning, open-group, or alternation operator. */ #define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) @@ -920,7 +920,7 @@ typedef struct #define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) /* If this bit is set, either \{...\} or {...} defines an - interval, depending on RE_NO_BK_BRACES. + interval, depending on RE_NO_BK_BRACES. If not set, \{, \}, {, and } are literals. */ #define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) @@ -945,7 +945,7 @@ typedef struct If not set, then \<digit> is a back-reference. */ #define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) -/* If this bit is set, then | is an alternation operator, and \| is literal. +/* If this bit is set, then | is an alternation operator, and \| is literal. If not set, then \| is an alternation operator, and | is literal. */ #define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) @@ -967,7 +967,7 @@ extern reg_syntax_t re_syntax_options; /* Define combinations of the above bits for the standard possibilities. (The [[[ comments delimit what gets put into the Texinfo file, so - don't delete them!) */ + don't delete them!) */ /* [[[begin syntaxes]]] */ #define RE_SYNTAX_EMACS 0 @@ -1031,7 +1031,7 @@ extern reg_syntax_t re_syntax_options; #ifdef RE_DUP_MAX #undef RE_DUP_MAX #endif -#define RE_DUP_MAX ((1 << 15) - 1) +#define RE_DUP_MAX ((1 << 15) - 1) #if !defined(BSD) || (BSD < 199306) @@ -1044,7 +1044,7 @@ extern reg_syntax_t re_syntax_options; /* If this bit is set, then ignore case when matching. If not set, then case is significant. */ #define REG_ICASE (REG_EXTENDED << 1) - + /* If this bit is set, then anchors do not match at newline characters in the string. If not set, then anchors do match at newlines. */ @@ -1070,7 +1070,7 @@ extern reg_syntax_t re_syntax_options; /* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer, * `re_match_2' returns information about at least this many registers - * the first time a `regs' structure is passed. + * the first time a `regs' structure is passed. * * Also, this is the greatest number of backreferenced subexpressions * allowed in a pattern being matched without caller-supplied registers. @@ -1087,7 +1087,7 @@ extern char rx_version_string[]; #ifdef RX_WANT_RX_DEFS /* This is decls to the interesting subsystems and lower layers - * of rx. Everything which doesn't have a public counterpart in + * of rx. Everything which doesn't have a public counterpart in * regex.c is declared here. */ @@ -1318,7 +1318,7 @@ struct rx_backtrack_frame { char * counter_stack_sp; - /* A frame is used to save the matchers state when it crosses a + /* A frame is used to save the matchers state when it crosses a * backtracking point. The `stk_' fields correspond to variables * in re_search_2 (just strip off thes `stk_'). They are documented * tere. @@ -1331,7 +1331,7 @@ struct rx_backtrack_frame int stk_test_ret; /* This is the list of options left to explore at the backtrack - * point for which this frame was created. + * point for which this frame was created. */ struct rx_distinct_future * df; struct rx_distinct_future * first_df; @@ -1407,15 +1407,15 @@ struct rx_search_state int * best_lpspace; /* in case the user doesn't want these */ int * best_rpspace; /* values, we still need space to store * them. Normally, this memoryis unused - * and the space pointed to by REGS is + * and the space pointed to by REGS is * used instead. */ - + int last_l; /* Highest index of a valid lparen. */ int last_r; /* It's dual. */ - + int * best_lparen; /* This contains the best known register */ - int * best_rparen; /* assignments. + int * best_rparen; /* assignments. * This may point to the same mem as * best_lpspace, or it might point to memory * passed by the caller. @@ -1424,7 +1424,7 @@ struct rx_search_state int best_last_r; - unsigned char * translate; + unsigned char * translate; struct rx_string_position outer_pos; @@ -1443,7 +1443,7 @@ struct rx_search_state rx_get_burst_fn saved_get_burst; rx_back_check_fn saved_back_check; struct re_registers * saved_regs; - + /** ** state for fastmap **/ @@ -1455,23 +1455,23 @@ struct rx_search_state enum rx_fastmap_entry fastmap_resume_pt; /** - ** state for test_match + ** state for test_match **/ /* The current superNFA position of the matcher. */ struct rx_superstate * super; - + /* The matcher interprets a series of instruction frames. * This is the `instruction counter' for the interpretation. */ struct rx_inx * ifr; - + /* We insert a ghost character in the string to prime * the nfa. test_pos.pos, test_pos.str_half, and test_pos.end_half * keep track of the test-match position and string-half. */ unsigned char c; - + /* Position within the string. */ struct rx_string_position test_pos; @@ -1481,7 +1481,7 @@ struct rx_search_state int chunk_bytes; struct rx_stack_chunk * free_chunks; - /* To return from this function, set test_ret and + /* To return from this function, set test_ret and * `goto test_do_return'. * * Possible return values are: @@ -1501,14 +1501,14 @@ struct rx_search_state int test_ret; int could_have_continued; - + #ifdef RX_DEBUG int backtrack_depth; /* There is a search tree with every node as set of deterministic - * transitions in the super nfa. For every branch of a + * transitions in the super nfa. For every branch of a * backtrack point is an edge in the tree. * This counts up a pre-order of nodes in that tree. - * It's saved on the search stack and printed when debugging. + * It's saved on the search stack and printed when debugging. */ int line_no; int lines_found; @@ -1521,7 +1521,7 @@ struct rx_search_state struct rx_inx * saved_this_tr_table; int saved_reg; struct rx_backtrack_frame * saved_bf; - + }; @@ -1536,7 +1536,7 @@ init_fastmap (rxb, search_state) search_state->fastmap = (rxb->fastmap ? (char *)rxb->fastmap : (char *)rx_slowmap); - /* Update the fastmap now if not correct already. + /* Update the fastmap now if not correct already. * When the regexp was compiled, the fastmap was computed * and stored in a bitset. This expands the bitset into a * character array containing 1s and 0s. @@ -1586,7 +1586,7 @@ fastmap_search (rxb, stop, get_burst, app_closure, search_state) * This sentinal will trap the fastmap loop when it reaches the last * valid character in a string half. * - * This must be reset when the fastmap/search loop crosses a string + * This must be reset when the fastmap/search loop crosses a string * boundry, and before returning to the caller. So sometimes, * the fastmap loop is restarted with `continue', othertimes by * `goto init_fastmap_sentinal'. @@ -1605,7 +1605,7 @@ fastmap_search (rxb, stop, get_burst, app_closure, search_state) search_state->fastmap_chr = -1; search_state->fastmap_val = 0; } - + if (search_state->outer_pos.pos >= search_state->outer_pos.end) goto fastmap_hit_bound; else @@ -1629,7 +1629,7 @@ fastmap_search (rxb, stop, get_burst, app_closure, search_state) ++search_state->outer_pos.pos; if (*search_state->outer_pos.pos != search_state->fastmap_chr) return rx_fastmap_ok; - else + else { ++search_state->outer_pos.pos; if (search_state->outer_pos.pos == search_state->outer_pos.end) @@ -1659,7 +1659,7 @@ fastmap_search (rxb, stop, get_burst, app_closure, search_state) --search_state->outer_pos.pos; if ((*search_state->outer_pos.pos != search_state->fastmap_chr) || search_state->fastmap_val) return rx_fastmap_ok; - else + else { --search_state->outer_pos.pos; if (search_state->outer_pos.pos == bound) @@ -1669,12 +1669,12 @@ fastmap_search (rxb, stop, get_burst, app_closure, search_state) } } } - + case rx_fastmap_string_break: fastmap_hit_bound: { /* If we hit a bound, it may be time to fetch another burst - * of string, or it may be time to return a continuation to + * of string, or it may be time to return a continuation to * the caller, or it might be time to fail. */ @@ -1692,7 +1692,7 @@ fastmap_search (rxb, stop, get_burst, app_closure, search_state) case rx_get_burst_ok: goto init_fastmap_sentinal; case rx_get_burst_no_more: - /* ...not a string split, simply no more string. + /* ...not a string split, simply no more string. * * When searching backward, running out of string * is reason to quit. @@ -1714,7 +1714,7 @@ fastmap_search (rxb, stop, get_burst, app_closure, search_state) #ifdef emacs /* The `emacs' switch turns on certain matching commands - * that make sense only in Emacs. + * that make sense only in Emacs. */ #include "config.h" #include "lisp.h" @@ -1731,7 +1731,7 @@ fastmap_search (rxb, stop, get_burst, app_closure, search_state) #else /* not RX_RX_MEMDBUG */ /* We used to test for `BSTRING' here, but only GCC and Emacs define - * `BSTRING', as far as I know, and neither of them use this code. + * `BSTRING', as far as I know, and neither of them use this code. */ #if HAVE_STRING_H || STDC_HEADERS #include <string.h> @@ -1767,7 +1767,7 @@ char *realloc (); * This must be nonzero for the wordchar and notwordchar pattern * commands in re_match_2. */ -#ifndef Sword +#ifndef Sword #define Sword 1 #endif @@ -1780,7 +1780,7 @@ RX_DECL char re_syntax_table[CHAR_SET_SIZE]; /* Test if at very beginning or at very end of the virtual concatenation - * of `string1' and `string2'. If only one string, it's `string2'. + * of `string1' and `string2'. If only one string, it's `string2'. */ #define AT_STRINGS_BEG() \ @@ -1799,14 +1799,14 @@ RX_DECL char re_syntax_table[CHAR_SET_SIZE]; * the first character in string2; and if before the beginning of * string2, look at the last character in string1. * - * Assumes `string1' exists, so use in conjunction with AT_STRINGS_BEG (). + * Assumes `string1' exists, so use in conjunction with AT_STRINGS_BEG (). */ #define LETTER_P(POS,OFF) \ ( SYNTAX (fetch_char(POS, OFF, app_closure, stop)) \ == Sword) /* Test if the character at D and the one after D differ with respect - * to being word-constituent. + * to being word-constituent. */ #define AT_WORD_BOUNDARY(d) \ (AT_STRINGS_BEG () || AT_STRINGS_END () || LETTER_P (d,0) != LETTER_P (d, 1)) @@ -1948,17 +1948,17 @@ rx_search (rxb, startpos, range, stop, total_size, = search_state.best_lpspace = search_state.best_rpspace = 0); - + /* figure the number of registers we may need for use in backreferences. - * the number here includes an element for register zero. + * the number here includes an element for register zero. */ search_state.num_regs = rxb->re_nsub + 1; - - + + /* check for out-of-range startpos. */ if ((startpos < 0) || (startpos > total_size)) return rx_search_fail; - + /* fix up range if it might eventually take us outside the string. */ { int endpos; @@ -1968,7 +1968,7 @@ rx_search (rxb, startpos, range, stop, total_size, else if (endpos > total_size) range = total_size - startpos; } - + /* if the search isn't to be a backwards one, don't waste time in a * long search for a pattern that says it is anchored. */ @@ -1979,7 +1979,7 @@ rx_search (rxb, startpos, range, stop, total_size, else range = 1; } - + /* decide whether to use internal or user-provided reg buffers. */ if (!regs || rxb->no_sub) { @@ -1991,7 +1991,7 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.best_rparen = search_state.best_rpspace; } else - { + { /* have the register data arrays been allocated? */ if (rxb->regs_allocated == REGS_UNALLOCATED) { /* no. so allocate them with malloc. we need one @@ -2025,7 +2025,7 @@ rx_search (rxb, startpos, range, stop, total_size, } else if (rxb->regs_allocated != REGS_FIXED) return rx_search_error; - + if (regs->num_regs < search_state.num_regs + 1) { search_state.best_lpspace = @@ -2043,38 +2043,38 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.best_rparen = regs->end; } } - + search_state.lparen = (int *) REGEX_ALLOCATE (search_state.num_regs * sizeof(int )); search_state.rparen = (int *) REGEX_ALLOCATE (search_state.num_regs * sizeof(int )); - + if (! ( search_state.best_rparen && search_state.best_lparen && search_state.lparen && search_state.rparen)) return rx_search_error; - + search_state.best_last_l = search_state.best_last_r = -1; - + search_state.translate = (rxb->translate ? rxb->translate : rx_id_translation); - - - + + + /* - * two nfa's were compiled. + * two nfa's were compiled. * `0' is complete. * `1' faster but gets registers wrong and ends too soon. */ search_state.nfa_choice = (regs && !rxb->least_subs) ? '\0' : '\1'; - + /* we have the option to look for the best match or the first * one we can find. if the user isn't asking for register information, * we don't need to find the best match. */ search_state.first_found = !regs; - + if (range >= 0) { search_state.outer_pos.search_end = MIN (total_size, startpos + range) + 1; @@ -2085,20 +2085,20 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.outer_pos.search_end = MAX(-1, startpos + range); search_state.outer_pos.search_direction = -1; } - + /* the vacuous search always turns up nothing. */ if ((search_state.outer_pos.search_direction == 1) ? (startpos > search_state.outer_pos.search_end) : (startpos < search_state.outer_pos.search_end)) return rx_search_fail; - + /* now we build the starting state of the supernfa. */ { struct rx_superset * start_contents; struct rx_nfa_state_set * start_nfa_set; - + /* we presume here that the nfa start state has only one - * possible future with no side effects. + * possible future with no side effects. */ start_nfa_set = rxb->start->futures->destset; if ( rxb->rx.start_set @@ -2110,10 +2110,10 @@ rx_search (rxb, startpos, range, stop, total_size, rx_superstate_eclosure_union (&rxb->rx, rx_superset_cons (&rxb->rx, 0, 0), start_nfa_set); - + if (!start_contents) return rx_search_fail; - + start_contents->starts_for = &rxb->rx; rxb->rx.start_set = start_contents; } @@ -2126,7 +2126,7 @@ rx_search (rxb, startpos, range, stop, total_size, else { rx_protect_superset (&rxb->rx, start_contents); - + search_state.start_super = rx_superstate (&rxb->rx, start_contents); if (!search_state.start_super) return rx_search_fail; @@ -2134,9 +2134,9 @@ rx_search (rxb, startpos, range, stop, total_size, rx_release_superset (&rxb->rx, start_contents); } } - - - + + + ( search_state.outer_pos.string = search_state.outer_pos.end = 0); @@ -2166,8 +2166,8 @@ rx_search (rxb, startpos, range, stop, total_size, break; } } - - /* now the fastmap loop has brought us to a plausible + + /* now the fastmap loop has brought us to a plausible * starting point for a match. so, it's time to run the * nfa and see if a match occured. */ @@ -2225,12 +2225,12 @@ rx_search (rxb, startpos, range, stop, total_size, : (startpos > search_state.outer_pos.search_end)) goto pseudo_do; - + finish: uninit_fastmap (rxb, &search_state); if (search_state.start_super) rx_unlock_superstate (&rxb->rx, search_state.start_super); - + #ifdef regex_malloc if (search_state.lparen) free (search_state.lparen); if (search_state.rparen) free (search_state.rparen); @@ -2255,7 +2255,7 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.lparen[0] = startpos; search_state.super = search_state.start_super; search_state.c = search_state.nfa_choice; - search_state.test_pos.pos = search_state.outer_pos.pos - 1; + search_state.test_pos.pos = search_state.outer_pos.pos - 1; search_state.test_pos.string = search_state.outer_pos.string; search_state.test_pos.end = search_state.outer_pos.end; search_state.test_pos.offset = search_state.outer_pos.offset; @@ -2272,8 +2272,8 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.free_chunks = 0; search_state.test_ret = rx_test_line_finished; search_state.could_have_continued = 0; - } - /* This is while (1)...except that the body of the loop is interrupted + } + /* This is while (1)...except that the body of the loop is interrupted * by some alternative entry points. */ pseudo_while_1: @@ -2288,42 +2288,42 @@ rx_search (rxb, startpos, range, stop, total_size, case rx_test_start: #ifdef RX_DEBUG /* There is a search tree with every node as set of deterministic - * transitions in the super nfa. For every branch of a + * transitions in the super nfa. For every branch of a * backtrack point is an edge in the tree. * This counts up a pre-order of nodes in that tree. - * It's saved on the search stack and printed when debugging. + * It's saved on the search stack and printed when debugging. */ search_state.line_no = 0; search_state.lines_found = 0; #endif - + top_of_cycle: - /* A superstate is basicly a transition table, indexed by - * characters from the string being tested, and containing + /* A superstate is basicly a transition table, indexed by + * characters from the string being tested, and containing * RX_INX (`instruction frame') structures. */ search_state.ifr = &search_state.super->transitions [search_state.c]; - + recurse_test_match: /* This is the point to which control is sent when the * test matcher `recurses'. Before jumping here, some variables * need to be saved on the stack and the next instruction frame * has to be computed. */ - + restart: /* Some instructions don't advance the matcher, but just * carry out some side effects and fetch a new instruction. * To dispatch that new instruction, `goto restart'. */ - + { struct rx_inx * next_tr_table; struct rx_inx * this_tr_table; - /* The fastest route through the loop is when the instruction + /* The fastest route through the loop is when the instruction * is RX_NEXT_CHAR. This case is detected when SEARCH_STATE.IFR->DATA * is non-zero. In that case, it points to the next - * superstate. + * superstate. * * This allows us to not bother fetching the bytecode. */ @@ -2335,19 +2335,19 @@ rx_search (rxb, startpos, range, stop, total_size, if (rx_debug_trace) { struct rx_superset * setp; - + fprintf (stderr, "%d %d>> re_next_char @ %d (%d)", search_state.line_no, search_state.backtrack_depth, (search_state.test_pos.pos - search_state.test_pos.string + search_state.test_pos.offset), search_state.c); - + search_state.super = ((struct rx_superstate *) ((char *)this_tr_table - ((unsigned long) ((struct rx_superstate *)0)->transitions))); - + setp = search_state.super->contents; fprintf (stderr, " superstet (rx=%d, &=%x: ", rxb->rx.rx_id, setp); @@ -2374,22 +2374,22 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.saved_next_tr_table = next_tr_table; test_pc = rx_test_cache_hit_loop; goto test_return_continuation; - + resume_continuation_1: /* Continuation one jumps here to do its work: */ search_state.saved_this_tr_table = this_tr_table; search_state.saved_next_tr_table = next_tr_table; goto try_burst_1; - + case rx_get_burst_ok: /* get_burst succeeded...keep going */ break; - + case rx_get_burst_no_more: search_state.test_ret = rx_test_line_finished; search_state.could_have_continued = 1; goto test_do_return; - + case rx_get_burst_error: /* An error... */ search_state.test_ret = rx_test_internal_error; @@ -2400,8 +2400,8 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.ifr = this_tr_table + search_state.c; next_tr_table = (struct rx_inx *)search_state.ifr->data; } /* Fast loop through cached transition tables */ - - /* Here when we ran out of cached next-char transitions. + + /* Here when we ran out of cached next-char transitions. * So, it will be necessary to do a more expensive * dispatch on the current instruction. The superstate * pointer is allowed to become invalid during next-char @@ -2413,7 +2413,7 @@ rx_search (rxb, startpos, range, stop, total_size, - ((unsigned long) ((struct rx_superstate *)0)->transitions))); } - + /* We've encountered an instruction other than next-char. * Dispatch that instruction: */ @@ -2422,13 +2422,13 @@ rx_search (rxb, startpos, range, stop, total_size, if (rx_debug_trace) { struct rx_superset * setp = search_state.super->contents; - + fprintf (stderr, "%d %d>> %s @ %d (%d)", search_state.line_no, search_state.backtrack_depth, inx_names[inx], (search_state.test_pos.pos - search_state.test_pos.string + (test_pos.half == 0 ? 0 : size1)), search_state.c); - + fprintf (stderr, " superstet (rx=%d, &=%x: ", rxb->rx.rx_id, setp); while (setp) @@ -2442,8 +2442,8 @@ rx_search (rxb, startpos, range, stop, total_size, switch ((enum rx_opcode)inx) { case rx_do_side_effects: - - /* RX_DO_SIDE_EFFECTS occurs when we cross epsilon + + /* RX_DO_SIDE_EFFECTS occurs when we cross epsilon * edges associated with parentheses, backreferencing, etc. */ { @@ -2463,7 +2463,7 @@ rx_search (rxb, startpos, range, stop, total_size, if (rx_debug_trace) { struct rx_superset * setp = search_state.super->contents; - + fprintf (stderr, "....%d %d>> %s\n", search_state.line_no, search_state.backtrack_depth, efnames[-effect]); @@ -2590,7 +2590,7 @@ rx_search (rxb, startpos, range, stop, total_size, else goto test_do_return; } - + case re_se_try: /* This is the first side effect in every * expression. @@ -2598,7 +2598,7 @@ rx_search (rxb, startpos, range, stop, total_size, * FOR NO GOOD REASON...get rid of it... */ break; - + case re_se_pushpos: { int urhere = @@ -2621,7 +2621,7 @@ rx_search (rxb, startpos, range, stop, total_size, cf->cdr = old_cf; break; } - + case re_se_chkpos: { int urhere = @@ -2637,13 +2637,13 @@ rx_search (rxb, startpos, range, stop, total_size, break; } break; - + case re_se_poppos: POP(search_state.counter_stack, sizeof (struct rx_counter_frame)); break; - - + + case re_se_at_dot: case re_se_syntax: case re_se_not_syntax: @@ -2677,10 +2677,10 @@ rx_search (rxb, startpos, range, stop, total_size, switch (rxb->se_params [effect].se) { case re_se_win: - /* This side effect indicates that we've - * found a match, though not necessarily the - * best match. This is a fancy assignment to - * register 0 unless the caller didn't + /* This side effect indicates that we've + * found a match, though not necessarily the + * best match. This is a fancy assignment to + * register 0 unless the caller didn't * care about registers. In which case, * this stops the match. */ @@ -2689,7 +2689,7 @@ rx_search (rxb, startpos, range, stop, total_size, ((int)(search_state.test_pos.pos - search_state.test_pos.string) + search_state.test_pos.offset); - + if ( (search_state.best_last_r < 0) || (urhere + 1 > search_state.best_rparen[0])) { @@ -2705,7 +2705,7 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.best_rparen[0] = urhere + 1; search_state.best_last_r = search_state.last_r; } - /* If we're not reporting the match-length + /* If we're not reporting the match-length * or other register info, we need look no * further. */ @@ -2722,7 +2722,7 @@ rx_search (rxb, startpos, range, stop, total_size, ((int)(search_state.test_pos.pos - search_state.test_pos.string) + search_state.test_pos.offset); - + int reg = rxb->se_params [effect].op1; #if 0 if (reg > search_state.last_l) @@ -2742,7 +2742,7 @@ rx_search (rxb, startpos, range, stop, total_size, } break; } - + case re_se_rparen: { int urhere = @@ -2759,14 +2759,14 @@ rx_search (rxb, startpos, range, stop, total_size, } break; } - + case re_se_backref: { int reg = rxb->se_params [effect].op1; if ( reg > search_state.last_r || search_state.rparen[reg] < 0) goto test_do_return; - + { int backref_status; check_backreference: @@ -2873,7 +2873,7 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.ifr = &df->future_frame; goto restart; } - + case rx_backtrack_point: { /* A backtrack point indicates that we've reached a @@ -2883,18 +2883,18 @@ rx_search (rxb, startpos, range, stop, total_size, * A backtracking strategy is used. We keep track of what * registers are valid so we can erase side effects. * - * First, make sure there is some stack space to hold + * First, make sure there is some stack space to hold * our state. */ - + struct rx_backtrack_frame * bf; - + PUSH(search_state.backtrack_stack, search_state.backtrack_frame_bytes); #ifdef RX_DEBUG ++search_state.backtrack_depth; #endif - + bf = ((struct rx_backtrack_frame *) search_state.backtrack_stack->sp); { @@ -2929,30 +2929,30 @@ rx_search (rxb, startpos, range, stop, total_size, stk[x] = search_state.rparen[x]; } } - + /* Here is a while loop whose body is mainly a function * call and some code to handle a return from that * function. * * From here on for the rest of `case backtrack_point' it - * is unsafe to assume that the search_state copies of + * is unsafe to assume that the search_state copies of * variables saved on the backtracking stack are valid * -- so read their values from the backtracking stack. * * This lets us use one generation fewer stack saves in * the call-graph of a search. */ - + while_non_det_options: #ifdef RX_DEBUG ++search_state.lines_found; if (rx_debug_trace) fprintf (stderr, "@@@ %d calls %d @@@\n", search_state.line_no, search_state.lines_found); - + search_state.line_no = search_state.lines_found; #endif - + if (bf->df->next_same_super_edge[0] == bf->first_df) { /* This is a tail-call optimization -- we don't recurse @@ -2961,7 +2961,7 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.ifr = (bf->df->effects ? &bf->df->side_effects_frame : &bf->df->future_frame); - + rx_unlock_superstate (&rxb->rx, search_state.super); POP(search_state.backtrack_stack, search_state.backtrack_frame_bytes); @@ -2983,14 +2983,14 @@ rx_search (rxb, startpos, range, stop, total_size, cf->val = old_cf->val; cf->inherited_from = old_cf; cf->cdr = 0; - } + } /* `Call' this test-match block */ search_state.ifr = (bf->df->effects ? &bf->df->side_effects_frame : &bf->df->future_frame); goto recurse_test_match; } - + /* Returns in this block are accomplished by * goto test_do_return. There are two cases. * If there is some search-stack left, @@ -2998,9 +2998,9 @@ rx_search (rxb, startpos, range, stop, total_size, * If there is no search-stack left, then * we should return to the fastmap/search loop. */ - + test_do_return: - + if (!search_state.backtrack_stack) { #ifdef RX_DEBUG @@ -3008,18 +3008,18 @@ rx_search (rxb, startpos, range, stop, total_size, fprintf (stderr, "!!! %d bails returning %d !!!\n", search_state.line_no, search_state.test_ret); #endif - + /* No more search-stack -- this test is done. */ if (search_state.test_ret) goto return_from_test_match; else goto error_in_testing_match; } - - /* Returning from a recursive call to + + /* Returning from a recursive call to * the test match block: */ - + bf = ((struct rx_backtrack_frame *) search_state.backtrack_stack->sp); #ifdef RX_DEBUG @@ -3029,7 +3029,7 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.test_ret, bf->stk_search_state.line_no); #endif - + while (search_state.counter_stack && (!bf->counter_stack_sp || (bf->counter_stack_sp @@ -3038,15 +3038,15 @@ rx_search (rxb, startpos, range, stop, total_size, POP(search_state.counter_stack, sizeof (struct rx_counter_frame)); } - + if (search_state.test_ret == rx_test_error) { POP (search_state.backtrack_stack, search_state.backtrack_frame_bytes); goto test_do_return; } - - /* If a non-longest match was found and that is good + + /* If a non-longest match was found and that is good * enough, return immediately. */ if ( (search_state.test_ret == rx_test_found_first) @@ -3057,7 +3057,7 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.backtrack_frame_bytes); goto test_do_return; } - + search_state.test_ret = bf->stk_test_ret; search_state.last_l = bf->stk_last_l; search_state.last_r = bf->stk_last_r; @@ -3067,7 +3067,7 @@ rx_search (rxb, startpos, range, stop, total_size, #ifdef RX_DEBUG search_state.line_no = bf->stk_search_state.line_no; #endif - + if (rxb->match_regs_on_stack) { int x; @@ -3079,7 +3079,7 @@ rx_search (rxb, startpos, range, stop, total_size, for (x = 0; x <= search_state.last_r; ++x) search_state.rparen[x] = stk[x]; } - + { int x; try_burst_2: @@ -3107,8 +3107,8 @@ rx_search (rxb, startpos, range, stop, total_size, search_state.test_pos = bf->stk_test_pos; goto while_non_det_options; } - - + + case rx_cache_miss: /* Because the superstate NFA is lazily constructed, * and in fact may erode from underneath us, we sometimes @@ -3125,14 +3125,14 @@ rx_search (rxb, startpos, range, stop, total_size, goto test_do_return; } goto restart; - + case rx_backtrack: /* RX_BACKTRACK means that we've reached the empty * superstate, indicating that match can't succeed * from this point. */ goto test_do_return; - + case rx_next_char: case rx_error_inx: case rx_num_instructions: @@ -3141,21 +3141,21 @@ rx_search (rxb, startpos, range, stop, total_size, } goto pseudo_while_1; } - - /* Healthy exits from the test-match loop do a - * `goto return_from_test_match' On the other hand, + + /* Healthy exits from the test-match loop do a + * `goto return_from_test_match' On the other hand, * we might end up here. */ error_in_testing_match: test_state = rx_test_error; goto test_returns_to_search; - + /***** fastmap/search loop body * considering the results testing for a match */ - + return_from_test_match: - + if (search_state.best_last_l >= 0) { if (regs && (regs->start != search_state.best_lparen)) @@ -3185,7 +3185,7 @@ rx_search (rxb, startpos, range, stop, total_size, test_state = rx_test_fail; goto test_returns_to_search; } - + test_return_continuation: search_state.test_match_resume_pt = test_pc; test_state = rx_test_continuation; @@ -3203,16 +3203,16 @@ rx_search (rxb, startpos, range, stop, total_size, /* Integers are used to represent side effects. * * Simple side effects are given negative integer names by these enums. - * + * * Non-negative names are reserved for complex effects. * - * Complex effects are those that take arguments. For example, + * Complex effects are those that take arguments. For example, * a register assignment associated with a group is complex because * it requires an argument to tell which group is being matched. - * + * * The integer name of a complex effect is an index into rxb->se_params. */ - + RX_DEF_SE(1, re_se_try, = -1) /* Epsilon from start state */ RX_DEF_SE(0, re_se_pushback, = re_se_try - 1) @@ -3228,15 +3228,15 @@ rx_search (rxb, startpos, range, stop, total_size, RX_DEF_SE(1, re_se_begbuf, = re_se_not_syntax - 1) /* match beginning of buffer */ RX_DEF_SE(1, re_se_hat, = re_se_begbuf - 1) /* match beginning of line */ - RX_DEF_SE(1, re_se_wordbeg, = re_se_hat - 1) + RX_DEF_SE(1, re_se_wordbeg, = re_se_hat - 1) RX_DEF_SE(1, re_se_wordbound, = re_se_wordbeg - 1) RX_DEF_SE(1, re_se_notwordbound, = re_se_wordbound - 1) RX_DEF_SE(1, re_se_wordend, = re_se_notwordbound - 1) RX_DEF_SE(1, re_se_endbuf, = re_se_wordend - 1) - /* This fails except at the end of a line. - * It deserves to go here since it is typicly one of the last steps + /* This fails except at the end of a line. + * It deserves to go here since it is typicly one of the last steps * in a match. */ RX_DEF_SE(1, re_se_dollar, = re_se_endbuf - 1) @@ -3244,7 +3244,7 @@ rx_search (rxb, startpos, range, stop, total_size, /* Simple effects: */ RX_DEF_SE(1, re_se_fail, = re_se_dollar - 1) - /* Complex effects. These are used in the 'se' field of + /* Complex effects. These are used in the 'se' field of * a struct re_se_params. Indexes into the se array * are stored as instructions on nfa edges. */ @@ -3252,7 +3252,7 @@ rx_search (rxb, startpos, range, stop, total_size, RX_DEF_CPLX_SE(1, re_se_lparen, = re_se_win + 1) RX_DEF_CPLX_SE(1, re_se_rparen, = re_se_lparen + 1) RX_DEF_CPLX_SE(0, re_se_backref, = re_se_rparen + 1) - RX_DEF_CPLX_SE(0, re_se_iter, = re_se_backref + 1) + RX_DEF_CPLX_SE(0, re_se_iter, = re_se_backref + 1) RX_DEF_CPLX_SE(0, re_se_end_iter, = re_se_iter + 1) RX_DEF_CPLX_SE(0, re_se_tv, = re_se_end_iter + 1) diff --git a/gnu/lib/libg++/include/std.h b/gnu/lib/libg++/include/std.h index 069b522d68d5..dcafc354c045 100644 --- a/gnu/lib/libg++/include/std.h +++ b/gnu/lib/libg++/include/std.h @@ -1,5 +1,5 @@ // This may look like C code, but it is really -*- C++ -*- -/* +/* Copyright (C) 1988, 1992 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -24,7 +24,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <stdio.h> +#include <stdio.h> #include <errno.h> #include <fcntl.h> @@ -32,4 +32,4 @@ extern "C" { int strcasecmp _G_ARGS((const char*, const char*)); } -#endif +#endif diff --git a/gnu/lib/libg++/include/stream.h b/gnu/lib/libg++/include/stream.h index 488f3679bcd1..f9569a5582d7 100644 --- a/gnu/lib/libg++/include/stream.h +++ b/gnu/lib/libg++/include/stream.h @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/include/streambuf.h b/gnu/lib/libg++/include/streambuf.h index efbab12c2b59..7a3df54fcb69 100644 --- a/gnu/lib/libg++/include/streambuf.h +++ b/gnu/lib/libg++/include/streambuf.h @@ -314,7 +314,7 @@ struct streambuf : public _IO_FILE { // protected?? void setp(char* p, char* ep) { _IO_write_base=_IO_write_ptr=p; _IO_write_end=ep; } void setg(char* eb, char* g, char *eg) { - if (_IO_file_flags & _IO_IN_BACKUP) _IO_free_backup_area(this); + if (_IO_file_flags & _IO_IN_BACKUP) _IO_free_backup_area(this); _IO_read_base = eb; _IO_read_ptr = g; _IO_read_end = eg; } char *shortbuf() { return _shortbuf; } @@ -336,7 +336,7 @@ struct streambuf : public _IO_FILE { // protected?? void unsave_markers(); // Make all streammarkers !saving(). int put_mode() { return _flags & _IO_CURRENTLY_PUTTING; } int switch_to_get_mode(); - + streambuf(int flags=0); public: static int flush_all(); diff --git a/gnu/lib/libg++/include/strfile.h b/gnu/lib/libg++/include/strfile.h index bff25b1ed106..950f2f56b3b5 100644 --- a/gnu/lib/libg++/include/strfile.h +++ b/gnu/lib/libg++/include/strfile.h @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libg++/timer.c b/gnu/lib/libg++/libg++/timer.c index 6e3432bf5b42..579cc549c667 100644 --- a/gnu/lib/libg++/libg++/timer.c +++ b/gnu/lib/libg++/libg++/timer.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1990, 1992 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) @@ -22,9 +22,9 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. /* Timing functions from Doug Schmidt... */ /* no such thing as "negative time"! */ -#define TIMER_ERROR_VALUE -1.0 +#define TIMER_ERROR_VALUE -1.0 -/* If this does not work on your system, change this to #if 0, and +/* If this does not work on your system, change this to #if 0, and report the problem. */ #if 1 @@ -73,7 +73,7 @@ return_elapsed_time(Last_Time) { if (!Timer_Set) { return(TIMER_ERROR_VALUE); - } + } else { /* get process time */ #ifdef USE_TIMES @@ -85,8 +85,8 @@ return_elapsed_time(Last_Time) #ifdef USE_TIMES return((double) (New_Time.tms_utime - Old_Time.tms_utime) / HZ); #else - return((New_Time.ru_utime.tv_sec - Old_Time.ru_utime.tv_sec) + - ((New_Time.ru_utime.tv_usec - Old_Time.ru_utime.tv_usec) + return((New_Time.ru_utime.tv_sec - Old_Time.ru_utime.tv_sec) + + ((New_Time.ru_utime.tv_usec - Old_Time.ru_utime.tv_usec) / 1000000.0)); #endif } @@ -94,7 +94,7 @@ return_elapsed_time(Last_Time) #ifdef USE_TIMES return((double) New_Time.tms_utime / HZ - Last_Time); #else - return((New_Time.ru_utime.tv_sec + + return((New_Time.ru_utime.tv_sec + (New_Time.ru_utime.tv_usec / 1000000.0)) - Last_Time); #endif } @@ -115,7 +115,7 @@ getrusage(int dummy,struct rusage* time){ /* we subtract an offset to make sure that the number fits in a long int*/ rtime=rtime/1.0e+7-4.144e+9; time->ru_utime.tv_sec= rtime; - rtime=(rtime-time->ru_utime.tv_sec)*1.0e6; + rtime=(rtime-time->ru_utime.tv_sec)*1.0e6; time->ru_utime.tv_usec= rtime; } #endif diff --git a/gnu/lib/libg++/libiberty/strerror.c b/gnu/lib/libg++/libiberty/strerror.c index 5c0a58d97a46..29a4e4acc86b 100644 --- a/gnu/lib/libg++/libiberty/strerror.c +++ b/gnu/lib/libg++/libiberty/strerror.c @@ -666,7 +666,7 @@ strerror (errnoval) /* In range, and a valid message. Just return the message. */ msg = (char *) sys_errlist[errnoval]; } - + return (msg); } diff --git a/gnu/lib/libg++/libiberty/strsignal.c b/gnu/lib/libg++/libiberty/strsignal.c index 7acb733bd56f..815af831d78d 100644 --- a/gnu/lib/libg++/libiberty/strsignal.c +++ b/gnu/lib/libg++/libiberty/strsignal.c @@ -448,7 +448,7 @@ strsignal (signo) /* In range, and a valid message. Just return the message. */ msg = (const char *) sys_siglist[signo]; } - + return (msg); } diff --git a/gnu/lib/libg++/libio/filedoalloc.c b/gnu/lib/libg++/libio/filedoalloc.c index a85b84613e64..92c510563179 100644 --- a/gnu/lib/libg++/libio/filedoalloc.c +++ b/gnu/lib/libg++/libio/filedoalloc.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free @@ -74,7 +74,7 @@ _IO_file_doallocate(fp) if (_IO_cleanup_registration_needed) (*_IO_cleanup_registration_needed)(); - + if (fp->_fileno < 0 || fp->_jumps->__stat(fp, &st) < 0) { couldbetty = 0; diff --git a/gnu/lib/libg++/libio/fileops.c b/gnu/lib/libg++/libio/fileops.c index 2bd7c2410990..332a0da9f028 100644 --- a/gnu/lib/libg++/libio/fileops.c +++ b/gnu/lib/libg++/libio/fileops.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free @@ -68,14 +68,14 @@ extern int errno; (The pointers save_gptr() and save_egptr() are the values of gptr() and egptr() at the time putback mode was entered.) The OS position corresponds to that of save_egptr(). - + LINE BUFFERED OUTPUT: During line buffered output, pbase()==base() && epptr()==base(). However, ptr() may be anywhere between base() and ebuf(). This forces a call to filebuf::overflow(int C) on every put. If there is more space in the buffer, and C is not a '\n', then C is inserted, and pptr() incremented. - + UNBUFFERED STREAMS: If a filebuf is unbuffered(), the _shortbuf[1] is used as the buffer. */ @@ -108,7 +108,7 @@ _IO_file_close_it(fp) _IO_unsave_markers(fp); status = fp->_jumps->__close(fp); - + /* Free buffer. */ _IO_setb(fp, NULL, NULL, 0); _IO_setg(fp, NULL, NULL, NULL); @@ -228,7 +228,7 @@ _IO_do_write(fp, data, to_do) unpredictable. */ fp->_offset = _IO_pos_BAD; else if (fp->_IO_read_end != fp->_IO_write_base) - { + { _IO_pos_t new_pos = fp->_jumps->__seek(fp, fp->_IO_write_base - fp->_IO_read_end, 1); if (new_pos == _IO_pos_BAD) return EOF; @@ -337,7 +337,7 @@ _IO_file_sync(fp) /* char* ptr = cur_ptr(); */ if (fp->_IO_write_ptr > fp->_IO_write_base) if (_IO_do_flush(fp)) return EOF; - delta = fp->_IO_read_ptr - fp->_IO_read_end; + delta = fp->_IO_read_ptr - fp->_IO_read_end; if (delta != 0) { #ifdef TODO @@ -643,7 +643,7 @@ _IO_file_xsputn(f, data, n) if (_IO_do_write(f, s, count) == EOF) return n - to_do; to_do = dont_write; - + /* Now write out the remainder. Normally, this will fit in the buffer, but it's somewhat messier for line-buffered files, so we let _IO_default_xsputn handle the general case. */ @@ -710,7 +710,7 @@ _IO_file_xsgetn(fp, data, n) else fp->_flags |= _IO_ERR_SEEN, count = 0; } - + s += count; more -= count; } diff --git a/gnu/lib/libg++/libio/floatconv.c b/gnu/lib/libg++/libio/floatconv.c index ff300bbbefca..acd6998a0c82 100644 --- a/gnu/lib/libg++/libio/floatconv.c +++ b/gnu/lib/libg++/libio/floatconv.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/genops.c b/gnu/lib/libg++/libio/genops.c index 469694cb68dd..71989a5b4c5d 100644 --- a/gnu/lib/libg++/libio/genops.c +++ b/gnu/lib/libg++/libio/genops.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free @@ -589,7 +589,7 @@ int _IO_get_column(fp) register _IO_FILE *fp; { - if (fp->_cur_column) + if (fp->_cur_column) return _IO_adjust_column(fp->_cur_column - 1, fp->_IO_write_base, fp->_IO_write_ptr - fp->_IO_write_base); @@ -636,7 +636,7 @@ _IO_cleanup () So it is possible that other static destructord might want to write to cout - and they're supposed to be able to do so. - The following will make the standard streambufs be unbuffered, + The following will make the standard streambufs be unbuffered, which forces any output from late destructors to be written out. */ _IO_unbuffer_all (); } @@ -652,7 +652,7 @@ void _IO_init_marker(marker, fp) marker->_pos = fp->_IO_read_ptr - fp->_IO_read_end; else marker->_pos = fp->_IO_read_ptr - fp->_IO_read_base; - + /* Should perhaps sort the chain? */ marker->_next = fp->_markers; fp->_markers = marker; @@ -776,7 +776,7 @@ _IO_default_pbackfail(fp, c) /* Need to handle a filebuf in write mode (switch to read mode). FIXME!*/ if (_IO_have_backup(fp) && !_IO_in_backup(fp)) _IO_switch_to_backup_area(fp); - + if (!_IO_have_backup(fp)) { /* No backup buffer: allocate one. */ @@ -860,7 +860,7 @@ _IO_default_write(fp, data, n) struct __io_defs { __io_defs() { } ~__io_defs() { _IO_cleanup(); } -}; +}; __io_defs io_defs__; #endif diff --git a/gnu/lib/libg++/libio/iofclose.c b/gnu/lib/libg++/libio/iofclose.c index 03be4518b4db..d8ad3a6f47a2 100644 --- a/gnu/lib/libg++/libio/iofclose.c +++ b/gnu/lib/libg++/libio/iofclose.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/iofgetpos.c b/gnu/lib/libg++/libio/iofgetpos.c index ac417f5dbc1c..f345463d3902 100644 --- a/gnu/lib/libg++/libio/iofgetpos.c +++ b/gnu/lib/libg++/libio/iofgetpos.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/iofread.c b/gnu/lib/libg++/libio/iofread.c index 4bfe717c029d..9cb633e5678c 100644 --- a/gnu/lib/libg++/libio/iofread.c +++ b/gnu/lib/libg++/libio/iofread.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/iofscanf.c b/gnu/lib/libg++/libio/iofscanf.c index 5daef91741aa..fc43d7eb540e 100644 --- a/gnu/lib/libg++/libio/iofscanf.c +++ b/gnu/lib/libg++/libio/iofscanf.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/iofsetpos.c b/gnu/lib/libg++/libio/iofsetpos.c index 0a6fff2f02f2..5f2023b7b995 100644 --- a/gnu/lib/libg++/libio/iofsetpos.c +++ b/gnu/lib/libg++/libio/iofsetpos.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/iogetdelim.c b/gnu/lib/libg++/libio/iogetdelim.c index 3dc5cd1ca77b..42527ffe666a 100644 --- a/gnu/lib/libg++/libio/iogetdelim.c +++ b/gnu/lib/libg++/libio/iogetdelim.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1994 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/iogetline.c b/gnu/lib/libg++/libio/iogetline.c index dcaa4a167bae..9ca1b70a8f37 100644 --- a/gnu/lib/libg++/libio/iogetline.c +++ b/gnu/lib/libg++/libio/iogetline.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/ioignore.c b/gnu/lib/libg++/libio/ioignore.c index 1b26503a9c68..70479e21925c 100644 --- a/gnu/lib/libg++/libio/ioignore.c +++ b/gnu/lib/libg++/libio/ioignore.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/iopadn.c b/gnu/lib/libg++/libio/iopadn.c index 84dcee615e32..77b7af758d32 100644 --- a/gnu/lib/libg++/libio/iopadn.c +++ b/gnu/lib/libg++/libio/iopadn.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free @@ -40,7 +40,7 @@ _IO_padn(fp, pad, count) const char *padptr; register int i; _IO_size_t written = 0, w; - + if (pad == ' ') padptr = blanks; else if (pad == '0') @@ -57,7 +57,7 @@ _IO_padn(fp, pad, count) if (w != PADSIZE) return written; } - + if (i > 0) { w = _IO_sputn(fp, padptr, i); diff --git a/gnu/lib/libg++/libio/iopopen.c b/gnu/lib/libg++/libio/iopopen.c index dfa3482a22cf..99a91452503a 100644 --- a/gnu/lib/libg++/libio/iopopen.c +++ b/gnu/lib/libg++/libio/iopopen.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free @@ -170,7 +170,7 @@ _IO_proc_close(fp) _IO_proc_file **ptr = &proc_file_chain; _IO_pid_t wait_pid; int status = -1; - + /* Unlink from proc_file_chain. */ for ( ; *ptr != NULL; ptr = &(*ptr)->next) { diff --git a/gnu/lib/libg++/libio/ioprims.c b/gnu/lib/libg++/libio/ioprims.c index 4c41ed8f823f..8164ba3bb113 100644 --- a/gnu/lib/libg++/libio/ioprims.c +++ b/gnu/lib/libg++/libio/ioprims.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/ioprintf.c b/gnu/lib/libg++/libio/ioprintf.c index 519785a0d237..69dce3eadcf0 100644 --- a/gnu/lib/libg++/libio/ioprintf.c +++ b/gnu/lib/libg++/libio/ioprintf.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/ioseekoff.c b/gnu/lib/libg++/libio/ioseekoff.c index 7ebf183d0b46..c409586713f8 100644 --- a/gnu/lib/libg++/libio/ioseekoff.c +++ b/gnu/lib/libg++/libio/ioseekoff.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/ioseekpos.c b/gnu/lib/libg++/libio/ioseekpos.c index a99b7033f83f..54a36b2c0ea1 100644 --- a/gnu/lib/libg++/libio/ioseekpos.c +++ b/gnu/lib/libg++/libio/ioseekpos.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/ioungetc.c b/gnu/lib/libg++/libio/ioungetc.c index b52e4a27e92f..0b13e6d159e3 100644 --- a/gnu/lib/libg++/libio/ioungetc.c +++ b/gnu/lib/libg++/libio/ioungetc.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/iovfprintf.c b/gnu/lib/libg++/libio/iovfprintf.c index e3fb2da0c1fe..4ee12e07be0f 100644 --- a/gnu/lib/libg++/libio/iovfprintf.c +++ b/gnu/lib/libg++/libio/iovfprintf.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free @@ -132,7 +132,7 @@ helper_vfprintf(fp, fmt0, ap) hp->_IO_write_end = buf+_IO_BUFSIZ; hp->_IO_file_flags = _IO_MAGIC|_IO_NO_READS; hp->_jumps = &_IO_helper_jumps; - + /* Now print to helper instead. */ result = _IO_vfprintf(hp, fmt0, ap); diff --git a/gnu/lib/libg++/libio/iovfscanf.c b/gnu/lib/libg++/libio/iovfscanf.c index 85168afdbd78..909f1ac90215 100644 --- a/gnu/lib/libg++/libio/iovfscanf.c +++ b/gnu/lib/libg++/libio/iovfscanf.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free diff --git a/gnu/lib/libg++/libio/outfloat.c b/gnu/lib/libg++/libio/outfloat.c index 7f4559b22c0a..83101b5387fb 100644 --- a/gnu/lib/libg++/libio/outfloat.c +++ b/gnu/lib/libg++/libio/outfloat.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free @@ -132,7 +132,7 @@ int _IO_outfloat(value, sb, type, width, precision, flags, precision = 0; show_dot = 0; } - + /* dtoa truncates trailing zeroes. Set the variable trailing_zeroes to the number of 0's we have to add (after the decimal point). */ if (skip_zeroes) @@ -146,7 +146,7 @@ int _IO_outfloat(value, sb, type, width, precision, flags, trailing_zeroes = useful_digits <= decpt ? precision - decpt : precision-useful_digits; if (trailing_zeroes < 0) trailing_zeroes = 0; - + if (trailing_zeroes != 0 || useful_digits > decpt) show_dot = 1; if (sign_mode == 0) @@ -155,14 +155,14 @@ int _IO_outfloat(value, sb, type, width, precision, flags, print_sign = sign ? '-' : '+'; else /* if (sign_mode == ' ') */ print_sign = sign ? '-' : ' '; - + /* Calculate the width (before padding). */ unpadded_width = (print_sign != 0) + trailing_zeroes + exponent_size + show_dot + useful_digits + (decpt > useful_digits ? decpt - useful_digits : decpt > 0 ? 0 : 1 - decpt); - + padding = width > unpadded_width ? width - unpadded_width : 0; if (padding > 0 && pad_kind != _IO_LEFT && pad_kind != _IO_INTERNAL) PADN(fill, padding); /* Default (right) adjust */ diff --git a/gnu/lib/libg++/libio/strops.c b/gnu/lib/libg++/libio/strops.c index f507343fbafa..1332d0b37e5f 100644 --- a/gnu/lib/libg++/libio/strops.c +++ b/gnu/lib/libg++/libio/strops.c @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993 Free Software Foundation This file is part of the GNU IO Library. This library is free @@ -195,7 +195,7 @@ _IO_str_count (fp) if (put_len < ((_IO_strfile*)fp)->_s._len) put_len = ((_IO_strfile*)fp)->_s._len; return put_len; -} +} _IO_pos_t _IO_str_seekoff(fp, offset, mode) diff --git a/gnu/lib/libg++/librx/rx.c b/gnu/lib/libg++/librx/rx.c index 2c7ea0362429..58add6753516 100644 --- a/gnu/lib/libg++/librx/rx.c +++ b/gnu/lib/libg++/librx/rx.c @@ -19,9 +19,9 @@ write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA #define _RX_C_ -/* NOTE!!! AIX is so losing it requires this to be the first thing in the - * file. - * Do not put ANYTHING before it! +/* NOTE!!! AIX is so losing it requires this to be the first thing in the + * file. + * Do not put ANYTHING before it! */ #if !defined (__GNUC__) && defined (_AIX) #pragma alloca @@ -77,7 +77,7 @@ typedef char boolean; #ifndef _AIX /* Already did AIX, up at the top. */ char *alloca (); #endif /* not _AIX */ -#endif /* not HAVE_ALLOCA_H */ +#endif /* not HAVE_ALLOCA_H */ #endif /* not __GNUC__ */ #endif /* not alloca */ @@ -102,7 +102,7 @@ char *alloca (); #ifdef RX_WANT_RX_DEFS #define RX_DECL extern -#define RX_DEF_QUAL +#define RX_DEF_QUAL #else #define RX_WANT_RX_DEFS #define RX_DECL static @@ -333,7 +333,7 @@ static char * efnames2[] = "re_se_tv" }; -static char * inx_names[] = +static char * inx_names[] = { "rx_backtrack_point", "rx_do_side_effects", @@ -617,7 +617,7 @@ rx_bitset_hash (size, b) } -RX_DECL RX_subset rx_subset_singletons [RX_subset_bits] = +RX_DECL RX_subset rx_subset_singletons [RX_subset_bits] = { 0x1, 0x2, @@ -689,13 +689,13 @@ static unsigned long rx_hash_masks[4] = /* Hash tables */ #ifdef __STDC__ -RX_DECL struct rx_hash_item * +RX_DECL struct rx_hash_item * rx_hash_find (struct rx_hash * table, unsigned long hash, void * value, struct rx_hash_rules * rules) #else -RX_DECL struct rx_hash_item * +RX_DECL struct rx_hash_item * rx_hash_find (table, hash, value, rules) struct rx_hash * table; unsigned long hash; @@ -749,7 +749,7 @@ rx_hash_store (table, hash, value, rules) long mask = rx_hash_masks[0]; int bucket = (hash & mask) % 13; int depth = 0; - + while (table->children [bucket]) { table = table->children [bucket]; @@ -758,7 +758,7 @@ rx_hash_store (table, hash, value, rules) bucket = (hash & mask) % 13; ++depth; } - + { struct rx_hash_item * it = table->buckets[bucket]; while (it) @@ -767,7 +767,7 @@ rx_hash_store (table, hash, value, rules) else it = it->next_same_hash; } - + { if ( (depth < 3) && (table->bucket_size [bucket] >= 4)) @@ -842,7 +842,7 @@ rx_hash_free (it, rules) : 0); int bucket = (hash & rx_hash_masks [depth]) % 13; struct rx_hash_item ** pos = &table->buckets [bucket]; - + while (*pos != it) pos = &(*pos)->next_same_hash; *pos = it->next_same_hash; @@ -1232,7 +1232,7 @@ rx_free_rexp (rx, node) case r_side_effect: break; - + case r_concat: case r_alternate: case r_2phase_star: @@ -1252,11 +1252,11 @@ rx_free_rexp (rx, node) #ifdef __STDC__ -RX_DECL struct rexp_node * +RX_DECL struct rexp_node * rx_copy_rexp (struct rx *rx, struct rexp_node *node) #else -RX_DECL struct rexp_node * +RX_DECL struct rexp_node * rx_copy_rexp (rx, node) struct rx *rx; struct rexp_node *node; @@ -1349,11 +1349,11 @@ rx_free_nfa_state (n) * assigned after the nfa has been built. */ #ifdef __STDC__ -RX_DECL struct rx_nfa_state * +RX_DECL struct rx_nfa_state * rx_id_to_nfa_state (struct rx * rx, int id) #else -RX_DECL struct rx_nfa_state * +RX_DECL struct rx_nfa_state * rx_id_to_nfa_state (rx, id) struct rx * rx; int id; @@ -1367,18 +1367,18 @@ rx_id_to_nfa_state (rx, id) } -/* This adds an edge between two nodes, but doesn't initialize the +/* This adds an edge between two nodes, but doesn't initialize the * edge label. */ #ifdef __STDC__ -RX_DECL struct rx_nfa_edge * +RX_DECL struct rx_nfa_edge * rx_nfa_edge (struct rx *rx, enum rx_nfa_etype type, struct rx_nfa_state *start, struct rx_nfa_state *dest) #else -RX_DECL struct rx_nfa_edge * +RX_DECL struct rx_nfa_edge * rx_nfa_edge (rx, type, start, dest) struct rx *rx; enum rx_nfa_etype type; @@ -1413,14 +1413,14 @@ rx_free_nfa_edge (e) /* This constructs a POSSIBLE_FUTURE, which is a kind epsilon-closure * of an NFA. These are added to an nfa automaticly by eclose_nfa. - */ + */ #ifdef __STDC__ -static struct rx_possible_future * +static struct rx_possible_future * rx_possible_future (struct rx * rx, struct rx_se_list * effects) #else -static struct rx_possible_future * +static struct rx_possible_future * rx_possible_future (rx, effects) struct rx * rx; struct rx_se_list * effects; @@ -1499,17 +1499,17 @@ rx_free_nfa (rx) -/* This page: translating a pattern expression into an nfa and doing the +/* This page: translating a pattern expression into an nfa and doing the * static part of the nfa->super-nfa translation. */ -/* This is the thompson regexp->nfa algorithm. +/* This is the thompson regexp->nfa algorithm. * It is modified to allow for `side-effect epsilons.' Those are * edges that are taken whenever a similar epsilon edge would be, - * but which imply that some side effect occurs when the edge + * but which imply that some side effect occurs when the edge * is taken. * - * Side effects are used to model parts of the pattern langauge + * Side effects are used to model parts of the pattern langauge * that are not regular (in the formal sense). */ @@ -1566,7 +1566,7 @@ rx_build_nfa (rx, rexp, start, end) return 0; } return 1; - + case r_opt: return (rx_build_nfa (rx, rexp->params.pair.left, start, end) && rx_nfa_edge (rx, ne_epsilon, *start, *end)); @@ -1646,10 +1646,10 @@ rx_build_nfa (rx, rexp, start, end) /* RX_NAME_NFA_STATES identifies all nodes with outgoing non-epsilon - * transitions. Only these nodes can occur in super-states. - * All nodes are given an integer id. + * transitions. Only these nodes can occur in super-states. + * All nodes are given an integer id. * The id is non-negative if the node has non-epsilon out-transitions, negative - * otherwise (this is because we want the non-negative ids to be used as + * otherwise (this is because we want the non-negative ids to be used as * array indexes in a few places). */ @@ -1728,10 +1728,10 @@ rx_name_nfa_states (rx) */ #ifdef __STDC__ -static int +static int se_list_cmp (void * va, void * vb) #else -static int +static int se_list_cmp (va, vb) void * va; void * vb; @@ -1755,10 +1755,10 @@ se_list_cmp (va, vb) #ifdef __STDC__ -static int +static int se_list_equal (void * va, void * vb) #else -static int +static int se_list_equal (va, vb) void * va; void * vb; @@ -1778,11 +1778,11 @@ static struct rx_hash_rules se_list_hash_rules = #ifdef __STDC__ -static struct rx_se_list * +static struct rx_se_list * side_effect_cons (struct rx * rx, void * se, struct rx_se_list * list) #else -static struct rx_se_list * +static struct rx_se_list * side_effect_cons (rx, se, list) struct rx * rx; void * se; @@ -1834,7 +1834,7 @@ hash_cons_se_prog (rx, memo, car, cdr) return (struct rx_se_list *)it->data; } } - + #ifdef __STDC__ static struct rx_se_list * @@ -1859,10 +1859,10 @@ hash_se_prog (rx, memo, prog) } #ifdef __STDC__ -static int +static int nfa_set_cmp (void * va, void * vb) #else -static int +static int nfa_set_cmp (va, vb) void * va; void * vb; @@ -1885,10 +1885,10 @@ nfa_set_cmp (va, vb) } #ifdef __STDC__ -static int +static int nfa_set_equal (void * va, void * vb) #else -static int +static int nfa_set_equal (va, vb) void * va; void * vb; @@ -1908,12 +1908,12 @@ static struct rx_hash_rules nfa_set_hash_rules = #ifdef __STDC__ -static struct rx_nfa_state_set * +static struct rx_nfa_state_set * nfa_set_cons (struct rx * rx, struct rx_hash * memo, struct rx_nfa_state * state, struct rx_nfa_state_set * set) #else -static struct rx_nfa_state_set * +static struct rx_nfa_state_set * nfa_set_cons (rx, memo, state, set) struct rx * rx; struct rx_hash * memo; @@ -1944,12 +1944,12 @@ nfa_set_cons (rx, memo, state, set) #ifdef __STDC__ -static struct rx_nfa_state_set * +static struct rx_nfa_state_set * nfa_set_enjoin (struct rx * rx, struct rx_hash * memo, struct rx_nfa_state * state, struct rx_nfa_state_set * set) #else -static struct rx_nfa_state_set * +static struct rx_nfa_state_set * nfa_set_enjoin (rx, memo, state, set) struct rx * rx; struct rx_hash * memo; @@ -1976,7 +1976,7 @@ nfa_set_enjoin (rx, memo, state, set) /* This page: computing epsilon closures. The closures aren't total. * Each node's closures are partitioned according to the side effects entailed * along the epsilon edges. Return true on success. - */ + */ struct eclose_frame { @@ -1985,11 +1985,11 @@ struct eclose_frame #ifdef __STDC__ -static int +static int eclose_node (struct rx *rx, struct rx_nfa_state *outnode, struct rx_nfa_state *node, struct eclose_frame *frame) #else -static int +static int eclose_node (rx, outnode, node, frame) struct rx *rx; struct rx_nfa_state *outnode; @@ -2054,7 +2054,7 @@ eclose_node (rx, outnode, node, frame) break; case ne_side_effect: { - frame->prog_backwards = side_effect_cons (rx, + frame->prog_backwards = side_effect_cons (rx, e->params.side_effect, frame->prog_backwards); if (!frame->prog_backwards) @@ -2079,10 +2079,10 @@ eclose_node (rx, outnode, node, frame) #ifdef __STDC__ -RX_DECL int +RX_DECL int rx_eclose_nfa (struct rx *rx) #else -RX_DECL int +RX_DECL int rx_eclose_nfa (rx) struct rx *rx; #endif @@ -2090,7 +2090,7 @@ rx_eclose_nfa (rx) struct rx_nfa_state *n = rx->nfa_states; struct eclose_frame frame; static int rx_id = 0; - + frame.prog_backwards = 0; rx->rx_id = rx_id++; bzero (&rx->se_list_memo, sizeof (rx->se_list_memo)); @@ -2113,10 +2113,10 @@ rx_eclose_nfa (rx) */ #ifdef __STDC__ -RX_DECL void +RX_DECL void rx_delete_epsilon_transitions (struct rx *rx) #else -RX_DECL void +RX_DECL void rx_delete_epsilon_transitions (rx) struct rx *rx; #endif @@ -2154,16 +2154,16 @@ rx_delete_epsilon_transitions (rx) */ /* This is for qsort on an array of nfa_states. The order - * is based on state ids and goes + * is based on state ids and goes * [0...MAX][MIN..-1] where (MAX>=0) and (MIN<0) * This way, positive ids double as array indices. */ #ifdef __STDC__ -static int +static int nfacmp (void * va, void * vb) #else -static int +static int nfacmp (va, vb) void * va; void * vb; @@ -2180,10 +2180,10 @@ nfacmp (va, vb) } #ifdef __STDC__ -static int +static int count_hash_nodes (struct rx_hash * st) #else -static int +static int count_hash_nodes (st) struct rx_hash * st; #endif @@ -2194,16 +2194,16 @@ count_hash_nodes (st) count += ((st->children[x]) ? count_hash_nodes (st->children[x]) : st->bucket_size[x]); - + return count; } #ifdef __STDC__ -static void +static void se_memo_freer (struct rx_hash_item * node) #else -static void +static void se_memo_freer (node) struct rx_hash_item * node; #endif @@ -2213,10 +2213,10 @@ se_memo_freer (node) #ifdef __STDC__ -static void +static void nfa_set_freer (struct rx_hash_item * node) #else -static void +static void nfa_set_freer (node) struct rx_hash_item * node; #endif @@ -2231,11 +2231,11 @@ nfa_set_freer (node) */ #ifdef __STDC__ -RX_DECL int +RX_DECL int rx_compactify_nfa (struct rx *rx, void **mem, unsigned long *size) #else -RX_DECL int +RX_DECL int rx_compactify_nfa (rx, mem, size) struct rx *rx; void **mem; @@ -2251,8 +2251,8 @@ rx_compactify_nfa (rx, mem, size) unsigned long total_size; /* This takes place in two stages. First, the total size of the - * nfa is computed, then structures are copied. - */ + * nfa is computed, then structures are copied. + */ n = rx->nfa_states; total_nodec = 0; while (n) @@ -2425,11 +2425,11 @@ rx_compactify_nfa (rx, mem, size) /* The functions in the next several pages define the lazy-NFA-conversion used - * by matchers. The input to this construction is an NFA such as + * by matchers. The input to this construction is an NFA such as * is built by compactify_nfa (rx.c). The output is the superNFA. */ -/* Match engines can use arbitrary values for opcodes. So, the parse tree +/* Match engines can use arbitrary values for opcodes. So, the parse tree * is built using instructions names (enum rx_opcode), but the superstate * nfa is populated with mystery opcodes (void *). * @@ -2502,16 +2502,16 @@ rx_cache_free (cache, freelist, mem) } -/* The partially instantiated superstate graph has a transition +/* The partially instantiated superstate graph has a transition * table at every node. There is one entry for every character. * This fills in the transition for a set. */ #ifdef __STDC__ -static void +static void install_transition (struct rx_superstate *super, - struct rx_inx *answer, rx_Bitset trcset) + struct rx_inx *answer, rx_Bitset trcset) #else -static void +static void install_transition (super, answer, trcset) struct rx_superstate *super; struct rx_inx *answer; @@ -2579,14 +2579,14 @@ check_cache (cache) check_cache (you_fucked_up); } -/* When a superstate is old and neglected, it can enter a +/* When a superstate is old and neglected, it can enter a * semi-free state. A semi-free state is slated to die. * Incoming transitions to a semi-free state are re-written * to cause an (interpreted) fault when they are taken. * The fault handler revives the semi-free state, patches * incoming transitions back to normal, and continues. * - * The idea is basicly to free in two stages, aborting + * The idea is basicly to free in two stages, aborting * between the two if the state turns out to be useful again. * When a free is aborted, the rescued superstate is placed * in the most-favored slot to maximize the time until it @@ -2663,11 +2663,11 @@ semifree_superstate (cache) #ifdef __STDC__ -static void +static void refresh_semifree_superstate (struct rx_cache * cache, struct rx_superstate * super) #else -static void +static void refresh_semifree_superstate (cache, super) struct rx_cache * cache; struct rx_superstate * super; @@ -2677,7 +2677,7 @@ refresh_semifree_superstate (cache, super) if (super->transition_refs) { - super->transition_refs->prev_same_dest->next_same_dest = 0; + super->transition_refs->prev_same_dest->next_same_dest = 0; for (df = super->transition_refs; df; df = df->next_same_dest) { df->future_frame.inx = cache->instruction_table[rx_next_char]; @@ -2745,11 +2745,11 @@ rx_refresh_this_superstate (cache, superstate) } #ifdef __STDC__ -static void +static void release_superset_low (struct rx_cache * cache, struct rx_superset *set) #else -static void +static void release_superset_low (cache, set) struct rx_cache * cache; struct rx_superset *set; @@ -2774,11 +2774,11 @@ release_superset_low (cache, set) } #ifdef __STDC__ -RX_DECL void +RX_DECL void rx_release_superset (struct rx *rx, struct rx_superset *set) #else -RX_DECL void +RX_DECL void rx_release_superset (rx, set) struct rx *rx; struct rx_superset *set; @@ -2888,8 +2888,8 @@ rx_really_free_superstate (cache) { struct rx_distinct_future *dft = df; df = df->next_same_super_edge[0]; - - + + if (dft->future && dft->future->transition_refs == dft) { dft->future->transition_refs = dft->next_same_dest; @@ -2905,7 +2905,7 @@ rx_really_free_superstate (cache) tc = tct; } } - + if (it->contents->superstate == it) it->contents->superstate = 0; release_superset_low (cache, it->contents); @@ -3043,10 +3043,10 @@ superset_allocator (rules, val) } #ifdef __STDC__ -static struct rx_hash * +static struct rx_hash * super_hash_allocator (struct rx_hash_rules * rules) #else -static struct rx_hash * +static struct rx_hash * super_hash_allocator (rules) struct rx_hash_rules * rules; #endif @@ -3133,7 +3133,7 @@ rx_morecore (cache) while (*pos) pos = &(*pos)->next; *pos = ((struct rx_blocklist *) - malloc (size + sizeof (struct rx_blocklist))); + malloc (size + sizeof (struct rx_blocklist))); if (!*pos) return; @@ -3145,7 +3145,7 @@ rx_morecore (cache) } } -static struct rx_cache default_cache = +static struct rx_cache default_cache = { { supersetcmp, @@ -3191,7 +3191,7 @@ static struct rx_cache default_cache = /* This adds an element to a superstate set. These sets are lists, such * that lists with == elements are ==. The empty set is returned by - * superset_cons (rx, 0, 0) and is NOT equivelent to + * superset_cons (rx, 0, 0) and is NOT equivelent to * (struct rx_superset)0. */ @@ -3247,7 +3247,7 @@ rx_superset_cons (rx, car, cdr) #ifdef __STDC__ RX_DECL struct rx_superset * rx_superstate_eclosure_union - (struct rx * rx, struct rx_superset *set, struct rx_nfa_state_set *ecl) + (struct rx * rx, struct rx_superset *set, struct rx_nfa_state_set *ecl) #else RX_DECL struct rx_superset * rx_superstate_eclosure_union (rx, set, ecl) @@ -3304,14 +3304,14 @@ rx_superstate_eclosure_union (rx, set, ecl) * This makes sure that a list of rx_distinct_futures contains * a future for each possible set of side effects in the eclosure * of a given state. This is some of the work of filling in a - * superstate transition. + * superstate transition. */ #ifdef __STDC__ static struct rx_distinct_future * include_futures (struct rx *rx, struct rx_distinct_future *df, struct rx_nfa_state - *state, struct rx_superstate *superstate) + *state, struct rx_superstate *superstate) #else static struct rx_distinct_future * include_futures (rx, df, state, superstate) @@ -3385,7 +3385,7 @@ include_futures (rx, df, state, superstate) -/* This constructs a new superstate from its state set. The only +/* This constructs a new superstate from its state set. The only * complexity here is memory management. */ #ifdef __STDC__ @@ -3520,10 +3520,10 @@ rx_superstate (rx, set) */ #ifdef __STDC__ -static int +static int solve_destination (struct rx *rx, struct rx_distinct_future *df) #else -static int +static int solve_destination (rx, df) struct rx *rx; struct rx_distinct_future *df; @@ -3544,7 +3544,7 @@ solve_destination (rx, df) struct rx_nfa_edge *e; /* Iterate over all edges of each NFA state. */ for (e = nfa_state->car->edges; e; e = e->next) - /* If we find an edge that is labeled with + /* If we find an edge that is labeled with * the characters we are solving for..... */ if (rx_bitset_is_subset (rx->local_cset_size, @@ -3572,7 +3572,7 @@ solve_destination (rx, df) } } } - /* It is possible that the RX_DISTINCT_FUTURE we are working on has + /* It is possible that the RX_DISTINCT_FUTURE we are working on has * the empty set of NFA states as its definition. In that case, this * is a failure point. */ @@ -3617,20 +3617,20 @@ solve_destination (rx, df) /* This takes a superstate and a character, and computes some edges * from the superstate NFA. In particular, this computes all edges - * that lead from SUPERSTATE given CHR. This function also + * that lead from SUPERSTATE given CHR. This function also * computes the set of characters that share this edge set. * This returns 0 on allocation error. - * The character set and list of edges are returned through + * The character set and list of edges are returned through * the paramters CSETOUT and DFOUT. } */ #ifdef __STDC__ -static int +static int compute_super_edge (struct rx *rx, struct rx_distinct_future **dfout, rx_Bitset csetout, struct rx_superstate *superstate, - unsigned char chr) + unsigned char chr) #else -static int +static int compute_super_edge (rx, dfout, csetout, superstate, chr) struct rx *rx; struct rx_distinct_future **dfout; @@ -3641,7 +3641,7 @@ compute_super_edge (rx, dfout, csetout, superstate, chr) { struct rx_superset *stateset = superstate->contents; - /* To compute the set of characters that share edges with CHR, + /* To compute the set of characters that share edges with CHR, * we start with the full character set, and subtract. */ rx_bitset_universe (rx->local_cset_size, csetout); @@ -3712,7 +3712,7 @@ compute_super_edge (rx, dfout, csetout, superstate, chr) static struct rx_super_edge * rx_super_edge (struct rx *rx, struct rx_superstate *super, rx_Bitset cset, - struct rx_distinct_future *df) + struct rx_distinct_future *df) #else static struct rx_super_edge * rx_super_edge (rx, super, cset, df) @@ -3784,7 +3784,7 @@ install_partial_transition (super, answer, set, offset) int end = start + 32; RX_subset pos = 1; struct rx_inx * transitions = super->transitions; - + while (start < end) { if (set & pos) @@ -3798,7 +3798,7 @@ install_partial_transition (super, answer, set, offset) #ifdef __STDC__ RX_DECL struct rx_inx * rx_handle_cache_miss - (struct rx *rx, struct rx_superstate *super, unsigned char chr, void *data) + (struct rx *rx, struct rx_superstate *super, unsigned char chr, void *data) #else RX_DECL struct rx_inx * rx_handle_cache_miss (rx, super, chr, data) @@ -3875,7 +3875,7 @@ rx_handle_cache_miss (rx, super, chr, data) } else if (df->future) /* A cache miss on an edge with a future? Must be * a semi-free destination. */ - { + { if (df->future->is_semifree) refresh_semifree_superstate (rx->cache, df->future); return &df->future_frame; @@ -3927,7 +3927,7 @@ __const__ char *re_error_msg[] = -/* +/* * Macros used while compiling patterns. * * By convention, PEND points just past the end of the uncompiled pattern, @@ -3938,7 +3938,7 @@ __const__ char *re_error_msg[] = /* - * Fetch the next character in the uncompiled pattern---translating it + * Fetch the next character in the uncompiled pattern---translating it * if necessary. *Also cast from a signed character in the constant * string passed to us by the user to an unsigned char that we can use * as an array index (in, e.g., `translate'). @@ -3949,7 +3949,7 @@ __const__ char *re_error_msg[] = c = translate[c]; \ } while (0) -/* +/* * Fetch the next character in the uncompiled pattern, with no * translation. */ @@ -4016,7 +4016,7 @@ typedef struct PATFETCH (c); \ } \ } \ - } + } #define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ @@ -4033,7 +4033,7 @@ typedef struct /* P points to just after a ^ in PATTERN. Return true if that ^ comes * after an alternative or a begin-subexpression. We assume there is at - * least one character before the ^. + * least one character before the ^. */ #ifdef __STDC__ @@ -4049,9 +4049,9 @@ at_begline_loc_p (pattern, p, syntax) { __const__ char *prev = p - 2; boolean prev_prev_backslash = ((prev > pattern) && (prev[-1] == '\\')); - + return - + (/* After a subexpression? */ ((*prev == '(') && ((syntax & RE_NO_BK_PARENS) || prev_prev_backslash)) || @@ -4078,7 +4078,7 @@ at_endline_loc_p (p, pend, syntax) __const__ char *next = p; boolean next_backslash = (*next == '\\'); __const__ char *next_next = (p + 1 < pend) ? (p + 1) : 0; - + return ( /* Before a subexpression? */ @@ -4147,7 +4147,7 @@ inverse_translation (rxb, valid, cache, translate, c) #endif { rx_Bitset cs - = cache + c * rx_bitset_numb_subsets (rxb->rx.local_cset_size); + = cache + c * rx_bitset_numb_subsets (rxb->rx.local_cset_size); if (!valid[c]) { @@ -4167,7 +4167,7 @@ inverse_translation (rxb, valid, cache, translate, c) /* More subroutine declarations and macros for regex_compile. */ -/* Returns true if REGNUM is in one of COMPILE_STACK's elements and +/* Returns true if REGNUM is in one of COMPILE_STACK's elements and false if it's not. */ #ifdef __STDC__ @@ -4182,8 +4182,8 @@ group_in_compile_stack (compile_stack, regnum) { int this_element; - for (this_element = compile_stack.avail - 1; - this_element >= 0; + for (this_element = compile_stack.avail - 1; + this_element >= 0; this_element--) if (compile_stack.stack[this_element].regnum == regnum) return true; @@ -4198,11 +4198,11 @@ group_in_compile_stack (compile_stack, regnum) * starting character is in `P[-2]'. (`P[-1]' is the character `-'.) * Then we set the translation of all bits between the starting and * ending characters (inclusive) in the compiled pattern B. - * + * * Return an error code. - * + * * We use these short variable names so we can use the same macros as - * `regex_compile' itself. + * `regex_compile' itself. */ #ifdef __STDC__ @@ -4247,7 +4247,7 @@ compile_range (rxb, cs, p_ptr, pend, translate, syntax, inv_tr, valid_inv_tr) inverse_translation (rxb, valid_inv_tr, inv_tr, translate, this_char); rx_bitset_union (rxb->rx.local_cset_size, cs, it); } - + return REG_NOERROR; } @@ -4383,7 +4383,7 @@ is_anchored (rexp, se) case r_opt: case r_star: return is_anchored (rexp->params.pair.left, se) ? 2 : 0; - + case r_side_effect: return ((rexp->params.side_effect == se) ? 1 : 2); @@ -4397,7 +4397,7 @@ is_anchored (rexp, se) /* This removes register assignments that aren't required by backreferencing. * This can speed up explore_future, especially if it eliminates * non-determinism in the superstate NFA. - * + * * NEEDED is an array of characters, presumably filled in by FIND_BACKREFS. * The non-zero elements of the array indicate which register assignments * can NOT be removed from the expression. @@ -4605,7 +4605,7 @@ static char idempotent_complex_se[] = #define RX_WANT_SE_DEFS 1 #undef RX_DEF_SE #undef RX_DEF_CPLX_SE -#define RX_DEF_SE(IDEM, NAME, VALUE) +#define RX_DEF_SE(IDEM, NAME, VALUE) #define RX_DEF_CPLX_SE(IDEM, NAME, VALUE) IDEM, #include "rx.h" #undef RX_DEF_SE @@ -4621,7 +4621,7 @@ static char idempotent_se[] = #undef RX_DEF_SE #undef RX_DEF_CPLX_SE #define RX_DEF_SE(IDEM, NAME, VALUE) IDEM, -#define RX_DEF_CPLX_SE(IDEM, NAME, VALUE) +#define RX_DEF_CPLX_SE(IDEM, NAME, VALUE) #include "rx.h" #undef RX_DEF_SE #undef RX_DEF_CPLX_SE @@ -4654,7 +4654,7 @@ has_any_se (rx, rexp) case r_side_effect: return 1; - + case r_2phase_star: case r_concat: case r_alternate: @@ -4702,7 +4702,7 @@ has_non_idempotent_epsilon_path (rx, rexp, params) !((long)rexp->params.side_effect > 0 ? idempotent_complex_se [ params [(long)rexp->params.side_effect].se ] : idempotent_se [-(long)rexp->params.side_effect]); - + case r_alternate: return ( has_non_idempotent_epsilon_path (rx, @@ -4729,7 +4729,7 @@ has_non_idempotent_epsilon_path (rx, rexp, params) -/* This computes rougly what it's name suggests. It can (and does) go wrong +/* This computes rougly what it's name suggests. It can (and does) go wrong * in the direction of returning spurious 0 without causing disasters. */ #ifdef __STDC__ @@ -4753,7 +4753,7 @@ begins_with_complex_se (rx, rexp) case r_side_effect: return ((long)rexp->params.side_effect >= 0); - + case r_alternate: return ( begins_with_complex_se (rx, rexp->params.pair.left) @@ -4773,11 +4773,11 @@ begins_with_complex_se (rx, rexp) } -/* This destructively removes some of the re_se_tv side effects from +/* This destructively removes some of the re_se_tv side effects from * a rexp tree. In particular, during parsing re_se_tv was inserted on the - * right half of every | to guarantee that posix path preference could be - * honored. This function removes some which it can be determined aren't - * needed. + * right half of every | to guarantee that posix path preference could be + * honored. This function removes some which it can be determined aren't + * needed. */ #ifdef __STDC__ @@ -4819,7 +4819,7 @@ speed_up_alt (rx, rexp, unposix) speed_up_alt (rx, rexp->params.pair.left, unposix); speed_up_alt (rx, rexp->params.pair.right->params.pair.right, unposix); - + if ( unposix || (begins_with_complex_se (rx, rexp->params.pair.right->params.pair.right)) @@ -4852,7 +4852,7 @@ speed_up_alt (rx, rexp, unposix) `fastmap_accurate' is set to zero; `re_nsub' is set to the number of groups in PATTERN; `not_bol' and `not_eol' are set to zero. - + The `fastmap' and `newline_anchor' fields are neither examined nor set. */ @@ -4862,7 +4862,7 @@ speed_up_alt (rx, rexp, unposix) RX_DECL reg_errcode_t rx_compile (__const__ char *pattern, int size, reg_syntax_t syntax, - struct re_pattern_buffer * rxb) + struct re_pattern_buffer * rxb) #else RX_DECL reg_errcode_t rx_compile (pattern, size, syntax, rxb) @@ -4881,17 +4881,17 @@ rx_compile (pattern, size, syntax, rxb) `char *' (i.e., signed), we declare these variables as unsigned, so they can be reliably used as array indices. */ register unsigned char c, c1; - + /* A random tempory spot in PATTERN. */ __const__ char *p1; - + /* Keeps track of unclosed groups. */ compile_stack_type compile_stack; /* Points to the current (ending) position in the pattern. */ __const__ char *p = pattern; __const__ char *pend = pattern + size; - + /* How to translate the characters in the pattern. */ unsigned char *translate = (rxb->translate ? rxb->translate @@ -4900,7 +4900,7 @@ rx_compile (pattern, size, syntax, rxb) /* When parsing is done, this will hold the expression tree. */ struct rexp_node * rexp = 0; - /* In the midst of compilation, this holds onto the regexp + /* In the midst of compilation, this holds onto the regexp * first parst while rexp goes on to aquire additional constructs. */ struct rexp_node * orig_rexp = 0; @@ -4909,7 +4909,7 @@ rx_compile (pattern, size, syntax, rxb) /* This and top_expression are saved on the compile stack. */ struct rexp_node ** top_expression = &rexp; struct rexp_node ** last_expression = top_expression; - + /* Parameter to `goto append_node' */ struct rexp_node * append; @@ -4919,7 +4919,7 @@ rx_compile (pattern, size, syntax, rxb) regnum_t regnum = 0; /* Place in the uncompiled pattern (i.e., the {) to - * which to go back if the interval is invalid. + * which to go back if the interval is invalid. */ __const__ char *beg_interval; @@ -4947,8 +4947,8 @@ rx_compile (pattern, size, syntax, rxb) rxb->fastmap_accurate = 0; rxb->not_bol = rxb->not_eol = 0; rxb->least_subs = 0; - - /* Always count groups, whether or not rxb->no_sub is set. + + /* Always count groups, whether or not rxb->no_sub is set. * The whole pattern is implicitly group 0, so counting begins * with 1. */ @@ -4991,7 +4991,7 @@ rx_compile (pattern, size, syntax, rxb) case '$': { if ( /* If at end of pattern, it's an operator. */ - p == pend + p == pend /* If context independent, it's an operator. */ || syntax & RE_CONTEXT_INDEP_ANCHORS /* Otherwise, depends on what's next. */ @@ -5158,7 +5158,7 @@ rx_compile (pattern, size, syntax, rxb) goto add_side_effect; } } - /* The old regex.c used to optimize `.*\n'. + /* The old regex.c used to optimize `.*\n'. * Maybe rx should too? */ } @@ -5191,36 +5191,36 @@ rx_compile (pattern, size, syntax, rxb) rx_Bitset cs = rx_cset (&rxb->rx); struct rexp_node * node = rx_mk_r_cset (&rxb->rx, cs); int is_inverted = *p == '^'; - + if (!(node && cs)) return REG_ESPACE; - + /* This branch of the switch is normally exited with *`goto append_node' */ append = node; - + if (is_inverted) p++; - + /* Remember the first position in the bracket expression. */ p1 = p; - + /* Read in characters and ranges, setting map bits. */ for (;;) { if (p == pend) return REG_EBRACK; - + PATFETCH (c); - + /* \ might escape characters inside [...] and [^...]. */ if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\') { if (p == pend) return REG_EESCAPE; - + PATFETCH (c1); { - rx_Bitset it = inverse_translation (rxb, + rx_Bitset it = inverse_translation (rxb, validate_inv_tr, inverse_translate, translate, @@ -5229,24 +5229,24 @@ rx_compile (pattern, size, syntax, rxb) } continue; } - + /* Could be the end of the bracket expression. If it's not (i.e., when the bracket expression is `[]' so far), the ']' character bit gets set way below. */ if (c == ']' && p != p1 + 1) goto finalize_class_and_append; - + /* Look ahead to see if it's a range when the last thing was a character class. */ if (had_char_class && c == '-' && *p != ']') return REG_ERANGE; - + /* Look ahead to see if it's a range when the last thing was a character: if this is a hyphen not at the beginning or the end of a list, then it's the range operator. */ - if (c == '-' - && !(p - 2 >= pattern && p[-2] == '[') + if (c == '-' + && !(p - 2 >= pattern && p[-2] == '[') && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^') && *p != ']') { @@ -5255,33 +5255,33 @@ rx_compile (pattern, size, syntax, rxb) inverse_translate, validate_inv_tr); if (ret != REG_NOERROR) return ret; } - + else if (p[0] == '-' && p[1] != ']') { /* This handles ranges made up of characters only. */ reg_errcode_t ret; - + /* Move past the `-'. */ PATFETCH (c1); - + ret = compile_range (rxb, cs, &p, pend, translate, syntax, inverse_translate, validate_inv_tr); if (ret != REG_NOERROR) return ret; } - + /* See if we're at the beginning of a possible character class. */ - + else if ((syntax & RE_CHAR_CLASSES) && (c == '[') && (*p == ':')) { char str[CHAR_CLASS_MAX_LENGTH + 1]; - + PATFETCH (c); c1 = 0; - + /* If pattern is `[[:'. */ if (p == pend) return REG_EBRACK; - + for (;;) { PATFETCH (c); @@ -5291,9 +5291,9 @@ rx_compile (pattern, size, syntax, rxb) str[c1++] = c; } str[c1] = '\0'; - + /* If isn't a word bracketed by `[:' and:`]': - undo the ending character, the letters, and leave + undo the ending character, the letters, and leave the leading `:' and `[' (but set bits for them). */ if (c == ':' && *p == ']') { @@ -5310,15 +5310,15 @@ rx_compile (pattern, size, syntax, rxb) boolean is_space = !strcmp (str, "space"); boolean is_upper = !strcmp (str, "upper"); boolean is_xdigit = !strcmp (str, "xdigit"); - + if (!IS_CHAR_CLASS (str)) return REG_ECTYPE; - + /* Throw away the ] at the end of the character class. */ - PATFETCH (c); - + PATFETCH (c); + if (p == pend) return REG_EBRACK; - + for (ch = 0; ch < 1 << CHARBITS; ch++) { if ( (is_alnum && isalnum (ch)) @@ -5335,7 +5335,7 @@ rx_compile (pattern, size, syntax, rxb) || (is_xdigit && isxdigit (ch))) { rx_Bitset it = - inverse_translation (rxb, + inverse_translation (rxb, validate_inv_tr, inverse_translate, translate, @@ -5349,11 +5349,11 @@ rx_compile (pattern, size, syntax, rxb) else { c1++; - while (c1--) + while (c1--) PATUNFETCH; { rx_Bitset it = - inverse_translation (rxb, + inverse_translation (rxb, validate_inv_tr, inverse_translate, translate, @@ -5363,7 +5363,7 @@ rx_compile (pattern, size, syntax, rxb) } { rx_Bitset it = - inverse_translation (rxb, + inverse_translation (rxb, validate_inv_tr, inverse_translate, translate, @@ -5378,7 +5378,7 @@ rx_compile (pattern, size, syntax, rxb) { had_char_class = false; { - rx_Bitset it = inverse_translation (rxb, + rx_Bitset it = inverse_translation (rxb, validate_inv_tr, inverse_translate, translate, @@ -5453,7 +5453,7 @@ rx_compile (pattern, size, syntax, rxb) rxb->re_nsub++; regnum++; if (COMPILE_STACK_FULL) - { + { ((compile_stack.stack) = (compile_stack_elt_t *) realloc (compile_stack.stack, ( compile_stack.size << 1) * sizeof ( compile_stack_elt_t))); @@ -5474,14 +5474,14 @@ rx_compile (pattern, size, syntax, rxb) /* * These are the values to restore when we hit end of this - * group. + * group. */ COMPILE_STACK_TOP.top_expression = top_expression; COMPILE_STACK_TOP.last_expression = last_expression; COMPILE_STACK_TOP.regnum = regnum; - + compile_stack.avail++; - + top_expression = last_expression; break; @@ -5595,10 +5595,10 @@ rx_compile (pattern, size, syntax, rxb) break; - case '{': + case '{': /* If \{ is a literal. */ if (!(syntax & RE_INTERVALS) - /* If we're at `\{' and it's not the open-interval + /* If we're at `\{' and it's not the open-interval operator. */ || ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) || (p - 2 == pattern && p == pend)) @@ -5637,11 +5637,11 @@ rx_compile (pattern, size, syntax, rxb) { if (syntax & RE_NO_BK_BRACES) goto unfetch_interval; - else + else return REG_BADBR; } - if (!(syntax & RE_NO_BK_BRACES)) + if (!(syntax & RE_NO_BK_BRACES)) { if (c != '\\') return REG_EBRACE; PATFETCH (c); @@ -5651,7 +5651,7 @@ rx_compile (pattern, size, syntax, rxb) { if (syntax & RE_NO_BK_BRACES) goto unfetch_interval; - else + else return REG_BADBR; } @@ -5747,7 +5747,7 @@ rx_compile (pattern, size, syntax, rxb) beg_interval = NULL; /* normal_char and normal_backslash need `c'. */ - PATFETCH (c); + PATFETCH (c); if (!(syntax & RE_NO_BK_BRACES)) { @@ -5780,7 +5780,7 @@ rx_compile (pattern, size, syntax, rxb) char code = syntax_spec_code (c); for (x = 0; x < 256; ++x) { - + if (SYNTAX (x) & code) { rx_Bitset it = @@ -5819,7 +5819,7 @@ rx_compile (pattern, size, syntax, rxb) /* With a little extra work, some of these side effects could be optimized * away (basicly by looking at what we already know about the surrounding - * chars). + * chars). */ case '<': side = (rx_side_effect)re_se_wordbeg; @@ -5845,7 +5845,7 @@ rx_compile (pattern, size, syntax, rxb) side = (rx_side_effect)re_se_begbuf; goto add_side_effect; break; - + case '\'': side = (rx_side_effect)re_se_endbuf; goto add_side_effect; @@ -5945,7 +5945,7 @@ rx_compile (pattern, size, syntax, rxb) } /* switch (c) */ } /* while p != pend */ - + { int win_se = paramc; params = (params @@ -5972,7 +5972,7 @@ rx_compile (pattern, size, syntax, rxb) /* Through the pattern now. */ - if (!COMPILE_STACK_EMPTY) + if (!COMPILE_STACK_EMPTY) return REG_EPAREN; free (compile_stack.stack); @@ -6023,11 +6023,11 @@ rx_compile (pattern, size, syntax, rxb) } } - /* At least one more optimization would be nice to have here but i ran out - * of time. The idea would be to delay side effects. + /* At least one more optimization would be nice to have here but i ran out + * of time. The idea would be to delay side effects. * For examle, `(abc)' is the same thing as `abc()' except that the * left paren is offset by 3 (which we know at compile time). - * (In this comment, write that second pattern `abc(:3:)' + * (In this comment, write that second pattern `abc(:3:)' * where `(:3:' is a syntactic unit.) * * Trickier: `(abc|defg)' is the same as `(abc(:3:|defg(:4:))' @@ -6041,7 +6041,7 @@ rx_compile (pattern, size, syntax, rxb) /* What we compile is different than what the parser returns. * Suppose the parser returns expression R. - * Let R' be R with unnecessary register assignments removed + * Let R' be R with unnecessary register assignments removed * (see REMOVE_UNECESSARY_SIDE_EFFECTS, above). * * What we will compile is the expression: @@ -6049,8 +6049,8 @@ rx_compile (pattern, size, syntax, rxb) * m{try}R{win}\|s{try}R'{win} * * {try} and {win} denote side effect epsilons (see EXPLORE_FUTURE). - * - * When trying a match, we insert an `m' at the beginning of the + * + * When trying a match, we insert an `m' at the beginning of the * string if the user wants registers to be filled, `s' if not. */ new_rexp = @@ -6105,7 +6105,7 @@ rx_compile (pattern, size, syntax, rxb) else { rx_delete_epsilon_transitions (&rxb->rx); - + /* For compatability reasons, we need to shove the * compiled nfa into one chunk of malloced memory. */ @@ -6136,7 +6136,7 @@ rx_compile (pattern, size, syntax, rxb) rx_bitset_null (rxb->rx.local_cset_size, rxb->fastset); rxb->can_match_empty = compute_fastset (rxb, orig_rexp); rxb->match_regs_on_stack = - registers_on_stack (rxb, orig_rexp, 0, params); + registers_on_stack (rxb, orig_rexp, 0, params); rxb->search_regs_on_stack = registers_on_stack (rxb, fewer_side_effects, 0, params); if (rxb->can_match_empty) @@ -6231,7 +6231,7 @@ rx_blow_up_fastmap (rxb) #define RE_S2_QUAL static #else #define RE_SEARCH_2_FN re_search_2 -#define RE_S2_QUAL +#define RE_S2_QUAL #endif struct re_search_2_closure @@ -6381,7 +6381,7 @@ re_search_2_fetch_char (pos, offset, app_closure, stop) else return *pos->pos; } - + #ifdef __STDC__ RE_S2_QUAL int @@ -6657,10 +6657,10 @@ re_set_registers (bufp, regs, num_regs, starts, ends) #ifdef __STDC__ -static int +static int cplx_se_sublist_len (struct rx_se_list * list) #else -static int +static int cplx_se_sublist_len (list) struct rx_se_list * list; #endif @@ -6679,11 +6679,11 @@ cplx_se_sublist_len (list) /* For rx->se_list_cmp */ #ifdef __STDC__ -static int +static int posix_se_list_order (struct rx * rx, struct rx_se_list * a, struct rx_se_list * b) #else -static int +static int posix_se_list_order (rx, a, b) struct rx * rx; struct rx_se_list * a; @@ -6697,7 +6697,7 @@ posix_se_list_order (rx, a, b) return ((a == b) ? 0 : ((a < b) ? -1 : 1)); - + else if (!al) return -1; @@ -6713,7 +6713,7 @@ posix_se_list_order (rx, a, b) struct rx_se_list * ap = a; struct rx_se_list * bp = b; int ai, bi; - + for (ai = al - 1; ai >= 0; --ai) { while ((long)ap->car < 0) @@ -6782,7 +6782,7 @@ re_compile_pattern (pattern, length, rxb) /* Match anchors at newline. */ rxb->newline_anchor = 1; - + rxb->re_nsub = 0; rxb->start = 0; rxb->se_params = 0; diff --git a/gnu/lib/libmalloc/mem-limits.h b/gnu/lib/libmalloc/mem-limits.h index ab594fcf3cc9..6ad994fb8224 100644 --- a/gnu/lib/libmalloc/mem-limits.h +++ b/gnu/lib/libmalloc/mem-limits.h @@ -69,12 +69,12 @@ extern char etext; #endif #endif -#else /* Not emacs */ +#else /* Not emacs */ extern char etext; #define start_of_data() &etext #endif /* Not emacs */ - + /* start of data space; can be changed by calling malloc_init */ static POINTER data_space_start; diff --git a/gnu/lib/libmalloc/ralloc.c b/gnu/lib/libmalloc/ralloc.c index 78b9f62fec06..32094d2d2d1c 100644 --- a/gnu/lib/libmalloc/ralloc.c +++ b/gnu/lib/libmalloc/ralloc.c @@ -1,4 +1,4 @@ -/* Block-relocating memory allocator. +/* Block-relocating memory allocator. Copyright (C) 1993 Free Software Foundation, Inc. @@ -104,7 +104,7 @@ static POINTER page_break_value; /* This is the size of a page. We round memory requests to this boundary. */ static int page_size; -/* Whenever we get memory from the system, get this many extra bytes. This +/* Whenever we get memory from the system, get this many extra bytes. This must be a multiple of page_size. */ static int extra_bytes; @@ -173,7 +173,7 @@ relinquish (size) break_value -= size; new_page_break = (POINTER) ROUNDUP (break_value); excess = (char *) page_break_value - (char *) new_page_break; - + if (excess > extra_bytes * 2) { /* Keep extra_bytes worth of empty space. @@ -286,7 +286,7 @@ relocate_some_blocs (bloc, address) register SIZE offset = address - bloc->data; register SIZE data_size = 0; register bloc_ptr b; - + for (b = bloc; b != NIL_BLOC; b = b->next) { data_size += b->size; @@ -346,7 +346,7 @@ static int use_relocatable_buffers; __morecore hook values - in particular, __default_morecore in the GNU malloc package. */ -POINTER +POINTER r_alloc_sbrk (size) long size; { diff --git a/gnu/lib/libmalloc/vm-limit.c b/gnu/lib/libmalloc/vm-limit.c index a2ac96ce4c82..06ea071c2f6a 100644 --- a/gnu/lib/libmalloc/vm-limit.c +++ b/gnu/lib/libmalloc/vm-limit.c @@ -68,7 +68,7 @@ check_memory_limits () if (warn_function) switch (warnlevel) { - case 0: + case 0: if (data_size > five_percent * 15) { warnlevel++; @@ -76,7 +76,7 @@ check_memory_limits () } break; - case 1: + case 1: if (data_size > five_percent * 17) { warnlevel++; @@ -84,7 +84,7 @@ check_memory_limits () } break; - case 2: + case 2: if (data_size > five_percent * 19) { warnlevel++; diff --git a/gnu/lib/libreadline/complete.c b/gnu/lib/libreadline/complete.c index 8084c38fbfce..4726079f4d11 100644 --- a/gnu/lib/libreadline/complete.c +++ b/gnu/lib/libreadline/complete.c @@ -334,14 +334,14 @@ print_filename (to_print, full_pathname) PUTX (*s); } return 0; -#else +#else char *s, c, *new_full_pathname; int extension_char = 0, slen, tlen; for (s = to_print; *s; s++) { PUTX (*s); - } + } if (rl_filename_completion_desired && rl_visible_stats) { diff --git a/gnu/lib/libreadline/display.c b/gnu/lib/libreadline/display.c index 07fc909e2f41..fcc766c6ce35 100644 --- a/gnu/lib/libreadline/display.c +++ b/gnu/lib/libreadline/display.c @@ -166,7 +166,7 @@ static int visible_first_line_len = 0; \002 (^B) end non-visible characters all characters except \001 and \002 (following a \001) are copied to the returned string; all characters except those between \001 and - \002 are assumed to be `visible'. */ + \002 are assumed to be `visible'. */ static char * expand_prompt (pmt, lp) @@ -187,7 +187,7 @@ expand_prompt (pmt, lp) l = strlen (pmt); r = ret = xmalloc (l + 1); - + for (rl = ignoring = 0, p = pmt; p && *p; p++) { /* This code strips the invisible character string markers @@ -377,7 +377,7 @@ rl_redisplay () out += 4; } else - line[out++] = c; + line[out++] = c; } #if defined (DISPLAY_TABS) else if (c == '\t') @@ -693,7 +693,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) if (old[0] && new[0]) old[0] = new[0]; } - + /* Find first difference. */ for (ofd = old, nfd = new; (ofd - old < omax) && *ofd && (*ofd == *nfd); diff --git a/gnu/lib/libreadline/examples/Makefile b/gnu/lib/libreadline/examples/Makefile index 55ebffc27518..3f9659e73ebc 100644 --- a/gnu/lib/libreadline/examples/Makefile +++ b/gnu/lib/libreadline/examples/Makefile @@ -9,4 +9,4 @@ fileman: fileman.o $(CC) $(LDFLAGS) -o fileman fileman.o -lreadline -ltermcap fileman.o: fileman.c - + diff --git a/gnu/lib/libreadline/examples/fileman.c b/gnu/lib/libreadline/examples/fileman.c index 3ecb9f184861..3256bf371e31 100644 --- a/gnu/lib/libreadline/examples/fileman.c +++ b/gnu/lib/libreadline/examples/fileman.c @@ -161,7 +161,7 @@ stripwhite (string) for (s = string; whitespace (*s); s++) ; - + if (*s == 0) return (s); diff --git a/gnu/lib/libreadline/examples/manexamp.c b/gnu/lib/libreadline/examples/manexamp.c index 3496efa00e76..051dcbc10a02 100644 --- a/gnu/lib/libreadline/examples/manexamp.c +++ b/gnu/lib/libreadline/examples/manexamp.c @@ -56,7 +56,7 @@ invert_case_line (count, key) } else direction = 1; - + /* Find the end of the range to modify. */ end = start + (count * direction); diff --git a/gnu/lib/libreadline/funmap.c b/gnu/lib/libreadline/funmap.c index 9255974c9ce6..c37cf39ea276 100644 --- a/gnu/lib/libreadline/funmap.c +++ b/gnu/lib/libreadline/funmap.c @@ -170,7 +170,7 @@ rl_add_funmap_entry (name, function) else funmap = (FUNMAP **)xrealloc (funmap, (funmap_size += 80) * sizeof (FUNMAP *)); - + funmap[funmap_entry] = (FUNMAP *)xmalloc (sizeof (FUNMAP)); funmap[funmap_entry]->name = name; funmap[funmap_entry]->function = function; diff --git a/gnu/lib/libreadline/history.c b/gnu/lib/libreadline/history.c index 410dd6af488d..a0a25603f419 100644 --- a/gnu/lib/libreadline/history.c +++ b/gnu/lib/libreadline/history.c @@ -862,7 +862,7 @@ history_set_pos (pos) history_offset = pos; return (1); } - + /* **************************************************************** */ /* */ @@ -996,7 +996,7 @@ get_history_event (string, caller_index, delimiting_quote) { entry = current_history (); history_offset = history_length; - + /* If this was a substring search, then remember the string that we matched for word substitution. */ if (substring_okay) @@ -1259,7 +1259,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) quoted_search_delimiter = string[i - 1]; event = get_history_event (string, &i, quoted_search_delimiter); } - + if (!event) { *ret_string = hist_error (string, start, i, EVENT_NOT_FOUND); @@ -1581,7 +1581,7 @@ history_expand (hstring, output) *output = savestring (hstring); return (0); } - + /* Prepare the buffer for printing error messages. */ result = xmalloc (result_len = 256); result[0] = '\0'; @@ -1650,7 +1650,7 @@ history_expand (hstring, output) } #endif /* SHELL */ } - + if (string[i] != history_expansion_char) { free (result); @@ -1968,7 +1968,7 @@ history_tokenize_internal (string, wind, indp) return (result); start = i; - + if (member (string[i], "()\n")) { i++; diff --git a/gnu/lib/libreadline/history.h b/gnu/lib/libreadline/history.h index 6935efd20d13..d9d41315e9fa 100644 --- a/gnu/lib/libreadline/history.h +++ b/gnu/lib/libreadline/history.h @@ -67,7 +67,7 @@ extern HIST_ENTRY **history_list (); /* Returns the number which says what history element we are now looking at. */ extern int where_history (); - + /* Return the history entry at the current position, as determined by history_offset. If there is no entry there, return a NULL pointer. */ HIST_ENTRY *current_history (); diff --git a/gnu/lib/libreadline/posixstat.h b/gnu/lib/libreadline/posixstat.h index 7d1cece35257..ce123f8c3b83 100644 --- a/gnu/lib/libreadline/posixstat.h +++ b/gnu/lib/libreadline/posixstat.h @@ -114,7 +114,7 @@ /* * POSIX 1003.1 5.6.1.2 <sys/stat.h> File Modes */ - + #if !defined (S_IRWXU) # if !defined (S_IREAD) # define S_IREAD 00400 diff --git a/gnu/lib/libreadline/readline.c b/gnu/lib/libreadline/readline.c index 1a27bd4f0f85..6d5dac517e23 100644 --- a/gnu/lib/libreadline/readline.c +++ b/gnu/lib/libreadline/readline.c @@ -216,12 +216,12 @@ int _rl_horizontal_scroll_mode = 0; /* Non-zero means to display an asterisk at the starts of history lines which have been modified. */ -int _rl_mark_modified_lines = 0; +int _rl_mark_modified_lines = 0; /* The style of `bell' notification preferred. This can be set to NO_BELL, AUDIBLE_BELL, or VISIBLE_BELL. */ int _rl_bell_preference = AUDIBLE_BELL; - + /* Line buffer and maintenence. */ char *rl_line_buffer = (char *)NULL; int rl_line_buffer_len = 0; @@ -1003,7 +1003,7 @@ readline_initialize_everything () _rl_convert_meta_chars_to_ascii = 0; _rl_output_meta_chars = 1; } - + /* Read in the init file. */ rl_read_init_file ((char *)NULL); @@ -2110,7 +2110,7 @@ rl_quoted_insert (count, key) int c; c = rl_read_key (); - return (rl_insert (count, c)); + return (rl_insert (count, c)); } /* Insert a tab character. */ @@ -2224,7 +2224,7 @@ rl_delete (count, invoking_key) } else return (rl_delete_text (rl_point, rl_point + 1)); - + } /* Delete all spaces and tabs around point. */ diff --git a/gnu/lib/libreadline/readline.h b/gnu/lib/libreadline/readline.h index 652d8ca80a94..81328430a5e2 100644 --- a/gnu/lib/libreadline/readline.h +++ b/gnu/lib/libreadline/readline.h @@ -162,7 +162,7 @@ extern char *rl_basic_word_break_characters; extern char *rl_completer_word_break_characters; /* List of characters which can be used to quote a substring of the line. - Completion occurs on the entire substring, and within the substring + Completion occurs on the entire substring, and within the substring rl_completer_word_break_characters are treated as any other character, unless they also appear within this list. */ extern char *rl_completer_quote_characters; diff --git a/gnu/lib/libreadline/tilde.c b/gnu/lib/libreadline/tilde.c index da75d957863d..a2693514e5de 100644 --- a/gnu/lib/libreadline/tilde.c +++ b/gnu/lib/libreadline/tilde.c @@ -23,7 +23,7 @@ # include <string.h> #else /* !HAVE_STRING_H */ # include <strings.h> -#endif /* !HAVE_STRING_H */ +#endif /* !HAVE_STRING_H */ #if defined (HAVE_STDLIB_H) # include <stdlib.h> diff --git a/gnu/lib/libreadline/vi_mode.c b/gnu/lib/libreadline/vi_mode.c index 66d2d403e327..b50c7079afae 100644 --- a/gnu/lib/libreadline/vi_mode.c +++ b/gnu/lib/libreadline/vi_mode.c @@ -174,7 +174,7 @@ rl_vi_redo (count, c) return (0); } - + /* Yank the nth arg from the previous line into this line at point. */ rl_vi_yank_arg (count, key) int count, key; @@ -886,7 +886,7 @@ rl_vi_delete (count, key) end = rl_end; rl_kill_text (rl_point, end); - + if (rl_point > 0 && rl_point == rl_end) rl_backward (1); return (0); diff --git a/gnu/lib/libregex/Makefile.gnu b/gnu/lib/libregex/Makefile.gnu index 0976aa8bdc48..b8bc2096675c 100644 --- a/gnu/lib/libregex/Makefile.gnu +++ b/gnu/lib/libregex/Makefile.gnu @@ -1,6 +1,6 @@ # Generated automatically from Makefile.in by configure. # Makefile for regex. -# +# # Copyright (C) 1992, 1993 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify @@ -27,7 +27,7 @@ version = 0.12 # -DEXTRACT_MACROS to use the macros EXTRACT_* (as opposed to # the corresponding C procedures). If not -DDEBUG, the macros # are used. -CPPFLAGS = +CPPFLAGS = # Likewise, you can override CFLAGS to optimize, use -Wall, etc. CFLAGS = -g @@ -83,7 +83,7 @@ TAGS check:: .NOEXPORT: distfiles = AUTHORS ChangeLog COPYING INSTALL NEWS README \ - *.in configure regex.c regex.h + *.in configure regex.c regex.h distdir = regex-$(version) distargs = version=$(version) distdir=../$(distdir)/$$d dist: TAGS configure diff --git a/gnu/lib/libregex/Makefile.in b/gnu/lib/libregex/Makefile.in index 836e6de0ba5a..a21f97021e0f 100644 --- a/gnu/lib/libregex/Makefile.in +++ b/gnu/lib/libregex/Makefile.in @@ -1,5 +1,5 @@ # Makefile for regex. -# +# # Copyright (C) 1992, 1993 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify @@ -26,7 +26,7 @@ version = 0.12 # -DEXTRACT_MACROS to use the macros EXTRACT_* (as opposed to # the corresponding C procedures). If not -DDEBUG, the macros # are used. -CPPFLAGS = +CPPFLAGS = # Likewise, you can override CFLAGS to optimize, use -Wall, etc. CFLAGS = -g @@ -82,7 +82,7 @@ TAGS check:: .NOEXPORT: distfiles = AUTHORS ChangeLog COPYING INSTALL NEWS README \ - *.in configure regex.c regex.h + *.in configure regex.c regex.h distdir = regex-$(version) distargs = version=$(version) distdir=../$(distdir)/$$d dist: TAGS configure diff --git a/gnu/lib/libregex/regex.c b/gnu/lib/libregex/regex.c index 6a36f3de8178..320b72b8faf5 100644 --- a/gnu/lib/libregex/regex.c +++ b/gnu/lib/libregex/regex.c @@ -79,7 +79,7 @@ char *realloc (); /* This must be nonzero for the wordchar and notwordchar pattern commands in re_match_2. */ -#ifndef Sword +#ifndef Sword #define Sword 1 #endif @@ -188,8 +188,8 @@ init_syntax_once () use `alloca' instead of `malloc'. This is because using malloc in re_search* or re_match* could cause memory leaks when C-g is used in Emacs; also, malloc is slower and causes storage fragmentation. On - the other hand, malloc is more portable, and easier to debug. - + the other hand, malloc is more portable, and easier to debug. + Because we sometimes use alloca, some routines have to be macros, not functions -- `alloca'-allocated space disappears at the end of the function it is called in. */ @@ -214,7 +214,7 @@ init_syntax_once () #ifndef _AIX /* Already did AIX, up at the top. */ char *alloca (); #endif /* not _AIX */ -#endif /* not HAVE_ALLOCA_H */ +#endif /* not HAVE_ALLOCA_H */ #endif /* not __GNUC__ */ #endif /* not alloca */ @@ -317,9 +317,9 @@ typedef enum /* Analogously, for end of buffer/string. */ endbuf, - + /* Followed by two byte relative address to which to jump. */ - jump, + jump, /* Same as jump, but marks the end of an alternative. */ jump_past_alt, @@ -327,11 +327,11 @@ typedef enum /* Followed by two-byte relative address of place to resume at in case of failure. */ on_failure_jump, - + /* Like on_failure_jump, but pushes a placeholder instead of the current string position when executed. */ on_failure_keep_string_jump, - + /* Throw away latest failure point and then jump to following two-byte relative address. */ pop_failure_jump, @@ -428,7 +428,7 @@ extract_number (dest, source) int *dest; unsigned char *source; { - int temp = SIGN_EXTEND_CHAR (*(source + 1)); + int temp = SIGN_EXTEND_CHAR (*(source + 1)); *dest = *source & 0377; *dest += temp << 8; } @@ -456,7 +456,7 @@ static void extract_number_and_incr (destination, source) int *destination; unsigned char **source; -{ +{ extract_number (destination, *source); *source += 2; } @@ -505,8 +505,8 @@ print_fastmap (fastmap) char *fastmap; { unsigned was_a_range = 0; - unsigned i = 0; - + unsigned i = 0; + while (i < (1 << BYTEWIDTH)) { if (fastmap[i++]) @@ -525,7 +525,7 @@ print_fastmap (fastmap) } } } - putchar ('\n'); + putchar ('\n'); } @@ -546,7 +546,7 @@ print_partial_compiled_pattern (start, end) printf ("(null)\n"); return; } - + /* Loop over pattern commands. */ while (p < pend) { @@ -595,7 +595,7 @@ print_partial_compiled_pattern (start, end) printf ("/charset [%s", (re_opcode_t) *(p - 1) == charset_not ? "^" : ""); - + assert (p + *p < pend); for (c = 0; c < 256; c++) @@ -614,7 +614,7 @@ print_partial_compiled_pattern (start, end) printchar (last); in_range = 0; } - + if (! in_range) printchar (c); @@ -656,7 +656,7 @@ print_partial_compiled_pattern (start, end) case push_dummy_failure: printf ("/push_dummy_failure"); break; - + case maybe_pop_jump: extract_number_and_incr (&mcnt, &p); printf ("/maybe_pop_jump to %d", p + mcnt - start); @@ -665,36 +665,36 @@ print_partial_compiled_pattern (start, end) case pop_failure_jump: extract_number_and_incr (&mcnt, &p); printf ("/pop_failure_jump to %d", p + mcnt - start); - break; - + break; + case jump_past_alt: extract_number_and_incr (&mcnt, &p); printf ("/jump_past_alt to %d", p + mcnt - start); - break; - + break; + case jump: extract_number_and_incr (&mcnt, &p); printf ("/jump to %d", p + mcnt - start); break; - case succeed_n: + case succeed_n: extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt2, &p); printf ("/succeed_n to %d, %d times", p + mcnt - start, mcnt2); break; - - case jump_n: + + case jump_n: extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt2, &p); printf ("/jump_n to %d, %d times", p + mcnt - start, mcnt2); break; - - case set_number_at: + + case set_number_at: extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt2, &p); printf ("/set_number_at location %d to %d", p + mcnt - start, mcnt2); break; - + case wordbound: printf ("/wordbound"); break; @@ -706,10 +706,10 @@ print_partial_compiled_pattern (start, end) case wordbeg: printf ("/wordbeg"); break; - + case wordend: printf ("/wordend"); - + #ifdef emacs case before_dot: printf ("/before_dot"); @@ -728,7 +728,7 @@ print_partial_compiled_pattern (start, end) mcnt = *p++; printf ("/%d", mcnt); break; - + case notsyntaxspec: printf ("/notsyntaxspec"); mcnt = *p++; @@ -739,7 +739,7 @@ print_partial_compiled_pattern (start, end) case wordchar: printf ("/wordchar"); break; - + case notwordchar: printf ("/notwordchar"); break; @@ -799,7 +799,7 @@ print_double_string (where, string1, size1, string2, size2) int size2; { unsigned this_char; - + if (where == NULL) printf ("(null)"); else @@ -809,7 +809,7 @@ print_double_string (where, string1, size1, string2, size2) for (this_char = where - string1; this_char < size1; this_char++) printchar (string1[this_char]); - where = string2; + where = string2; } for (this_char = where - string2; this_char < size2; this_char++) @@ -850,7 +850,7 @@ re_set_syntax (syntax) reg_syntax_t syntax; { reg_syntax_t ret = re_syntax_options; - + re_syntax_options = syntax; return ret; } @@ -900,7 +900,7 @@ static reg_errcode_t compile_range _RE_ARGS((const char **p_ptr, reg_syntax_t syntax, unsigned char *b)); -/* Fetch the next character in the uncompiled pattern---translating it +/* Fetch the next character in the uncompiled pattern---translating it if necessary. Also cast from a signed character in the constant string passed to us by the user to an unsigned char that we can use as an array index (in, e.g., `translate'). */ @@ -1054,7 +1054,7 @@ typedef struct pattern_offset_t begalt_offset; pattern_offset_t fixup_alt_jump; pattern_offset_t inner_group_offset; - pattern_offset_t laststart_offset; + pattern_offset_t laststart_offset; regnum_t regnum; } compile_stack_elt_t; @@ -1097,7 +1097,7 @@ typedef struct PATFETCH (c); \ } \ } \ - } + } #define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ @@ -1127,7 +1127,7 @@ static boolean group_in_compile_stack _RE_ARGS((compile_stack_type `fastmap_accurate' is zero; `re_nsub' is the number of subexpressions in PATTERN; `not_bol' and `not_eol' are zero; - + The `fastmap' and `newline_anchor' fields are neither examined nor set. */ @@ -1142,20 +1142,20 @@ regex_compile (pattern, size, syntax, bufp) `char *' (i.e., signed), we declare these variables as unsigned, so they can be reliably used as array indices. */ register unsigned char c, c1; - + /* A random tempory spot in PATTERN. */ const char *p1; /* Points to the end of the buffer, where we should append. */ register unsigned char *b; - + /* Keeps track of unclosed groups. */ compile_stack_type compile_stack; /* Points to the current (ending) position in the pattern. */ const char *p = pattern; const char *pend = pattern + size; - + /* How to translate the characters in the pattern. */ char *translate = bufp->translate; @@ -1176,7 +1176,7 @@ regex_compile (pattern, size, syntax, bufp) /* Place in the uncompiled pattern (i.e., the {) to which to go back if the interval is invalid. */ const char *beg_interval; - + /* Address of the place where a forward jump should go to the end of the containing expression. Each alternative of an `or' -- except the last -- ends with a forward jump of this sort. */ @@ -1192,7 +1192,7 @@ regex_compile (pattern, size, syntax, bufp) if (debug) { unsigned debug_count; - + for (debug_count = 0; debug_count < size; debug_count++) printchar (pattern[debug_count]); putchar ('\n'); @@ -1216,9 +1216,9 @@ regex_compile (pattern, size, syntax, bufp) printer (for debugging) will think there's no pattern. We reset it at the end. */ bufp->used = 0; - + /* Always count groups, whether or not bufp->no_sub is set. */ - bufp->re_nsub = 0; + bufp->re_nsub = 0; #if !defined (emacs) && !defined (SYNTAX_TABLE) /* Initialize the syntax table. */ @@ -1269,7 +1269,7 @@ regex_compile (pattern, size, syntax, bufp) case '$': { if ( /* If at end of pattern, it's an operator. */ - p == pend + p == pend /* If context independent, it's an operator. */ || syntax & RE_CONTEXT_INDEP_ANCHORS /* Otherwise, depends on what's next. */ @@ -1300,7 +1300,7 @@ regex_compile (pattern, size, syntax, bufp) { /* Are we optimizing this jump? */ boolean keep_string_p = false; - + /* 1 means zero (many) matches is allowed. */ char zero_times_ok = 0, many_times_ok = 0; @@ -1348,7 +1348,7 @@ regex_compile (pattern, size, syntax, bufp) /* Star, etc. applied to an empty pattern is equivalent to an empty pattern. */ - if (!laststart) + if (!laststart) break; /* Now we know whether or not zero matches is allowed @@ -1357,7 +1357,7 @@ regex_compile (pattern, size, syntax, bufp) { /* More than one repetition is allowed, so put in at the end a backward relative jump from `b' to before the next jump we're going to put in below (which jumps from - laststart to after this jump). + laststart to after this jump). But if we are at the `*' in the exact sequence `.*\n', insert an unconditional jump backwards to the ., @@ -1434,7 +1434,7 @@ regex_compile (pattern, size, syntax, bufp) /* We test `*p == '^' twice, instead of using an if statement, so we only need one BUF_PUSH. */ - BUF_PUSH (*p == '^' ? charset_not : charset); + BUF_PUSH (*p == '^' ? charset_not : charset); if (*p == '^') p++; @@ -1484,8 +1484,8 @@ regex_compile (pattern, size, syntax, bufp) was a character: if this is a hyphen not at the beginning or the end of a list, then it's the range operator. */ - if (c == '-' - && !(p - 2 >= pattern && p[-2] == '[') + if (c == '-' + && !(p - 2 >= pattern && p[-2] == '[') && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^') && *p != ']') { @@ -1500,7 +1500,7 @@ regex_compile (pattern, size, syntax, bufp) /* Move past the `-'. */ PATFETCH (c1); - + ret = compile_range (&p, pend, translate, syntax, b); if (ret != REG_NOERROR) return ret; } @@ -1529,7 +1529,7 @@ regex_compile (pattern, size, syntax, bufp) str[c1] = '\0'; /* If isn't a word bracketed by `[:' and:`]': - undo the ending character, the letters, and leave + undo the ending character, the letters, and leave the leading `:' and `[' (but set bits for them). */ if (c == ':' && *p == ']') { @@ -1546,12 +1546,12 @@ regex_compile (pattern, size, syntax, bufp) boolean is_space = STREQ (str, "space"); boolean is_upper = STREQ (str, "upper"); boolean is_xdigit = STREQ (str, "xdigit"); - + if (!IS_CHAR_CLASS (str)) return REG_ECTYPE; /* Throw away the ] at the end of the character class. */ - PATFETCH (c); + PATFETCH (c); if (p == pend) return REG_EBRACK; @@ -1576,7 +1576,7 @@ regex_compile (pattern, size, syntax, bufp) else { c1++; - while (c1--) + while (c1--) PATUNFETCH; SET_LIST_BIT ('['); SET_LIST_BIT (':'); @@ -1592,8 +1592,8 @@ regex_compile (pattern, size, syntax, bufp) /* Discard any (non)matching list bytes that are all 0 at the end of the map. Decrease the map-length byte too. */ - while ((int) b[-1] > 0 && b[b[-1] - 1] == 0) - b[-1]--; + while ((int) b[-1] > 0 && b[b[-1] - 1] == 0) + b[-1]--; b += b[-1]; } break; @@ -1653,7 +1653,7 @@ regex_compile (pattern, size, syntax, bufp) regnum++; if (COMPILE_STACK_FULL) - { + { RETALLOC (compile_stack.stack, compile_stack.size << 1, compile_stack_elt_t); if (compile_stack.stack == NULL) return REG_ESPACE; @@ -1666,7 +1666,7 @@ regex_compile (pattern, size, syntax, bufp) whole pattern moves because of realloc, they will still be valid. */ COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer; - COMPILE_STACK_TOP.fixup_alt_jump + COMPILE_STACK_TOP.fixup_alt_jump = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer; COMPILE_STACK_TOP.regnum = regnum; @@ -1680,7 +1680,7 @@ regex_compile (pattern, size, syntax, bufp) COMPILE_STACK_TOP.inner_group_offset = b - bufp->buffer + 2; BUF_PUSH_3 (start_memory, regnum, 0); } - + compile_stack.avail++; fixup_alt_jump = 0; @@ -1709,7 +1709,7 @@ regex_compile (pattern, size, syntax, bufp) `pop_failure_jump' to pop. See comments at `push_dummy_failure' in `re_match_2'. */ BUF_PUSH (push_dummy_failure); - + /* We allocated space for this jump when we assigned to `fixup_alt_jump', in the `handle_alt' case below. */ STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1); @@ -1731,11 +1731,11 @@ regex_compile (pattern, size, syntax, bufp) as in `(ab)c(de)' -- the second group is #2. */ regnum_t this_group_regnum; - compile_stack.avail--; + compile_stack.avail--; begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset; fixup_alt_jump = COMPILE_STACK_TOP.fixup_alt_jump - ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 + ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 : 0; laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset; this_group_regnum = COMPILE_STACK_TOP.regnum; @@ -1750,7 +1750,7 @@ regex_compile (pattern, size, syntax, bufp) { unsigned char *inner_group_loc = bufp->buffer + COMPILE_STACK_TOP.inner_group_offset; - + *inner_group_loc = regnum - this_group_regnum; BUF_PUSH_3 (stop_memory, this_group_regnum, regnum - this_group_regnum); @@ -1779,10 +1779,10 @@ regex_compile (pattern, size, syntax, bufp) jump (put in below, which in turn will jump to the next (if any) alternative's such jump, etc.). The last such jump jumps to the correct final destination. A picture: - _____ _____ - | | | | - | v | v - a | b | c + _____ _____ + | | | | + | v | v + a | b | c If we are at `b', then fixup_alt_jump right now points to a three-byte space after `a'. We'll put in the jump, set @@ -1804,10 +1804,10 @@ regex_compile (pattern, size, syntax, bufp) break; - case '{': + case '{': /* If \{ is a literal. */ if (!(syntax & RE_INTERVALS) - /* If we're at `\{' and it's not the open-interval + /* If we're at `\{' and it's not the open-interval operator. */ || ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) || (p - 2 == pattern && p == pend)) @@ -1846,11 +1846,11 @@ regex_compile (pattern, size, syntax, bufp) { if (syntax & RE_NO_BK_BRACES) goto unfetch_interval; - else + else return REG_BADBR; } - if (!(syntax & RE_NO_BK_BRACES)) + if (!(syntax & RE_NO_BK_BRACES)) { if (c != '\\') return REG_EBRACE; @@ -1861,7 +1861,7 @@ regex_compile (pattern, size, syntax, bufp) { if (syntax & RE_NO_BK_BRACES) goto unfetch_interval; - else + else return REG_BADBR; } @@ -1897,7 +1897,7 @@ regex_compile (pattern, size, syntax, bufp) jump_n <succeed_n addr> <jump count> (The upper bound and `jump_n' are omitted if `upper_bound' is 1, though.) */ - else + else { /* If the upper bound is > 1, we need to insert more at the end of the loop. */ unsigned nbytes = 10 + (upper_bound > 1) * 10; @@ -1914,7 +1914,7 @@ regex_compile (pattern, size, syntax, bufp) lower_bound); b += 5; - /* Code to initialize the lower bound. Insert + /* Code to initialize the lower bound. Insert before the `succeed_n'. The `5' is the last two bytes of this `set_number_at', plus 3 bytes of the following `succeed_n'. */ @@ -1925,7 +1925,7 @@ regex_compile (pattern, size, syntax, bufp) { /* More than one repetition is allowed, so append a backward jump to the `succeed_n' that starts this interval. - + When we've reached this during matching, we'll have matched the interval once, so jump back only `upper_bound - 1' times. */ @@ -1943,7 +1943,7 @@ regex_compile (pattern, size, syntax, bufp) so everything is getting moved up by 5. Conclusion: (b - 2) - (laststart + 3) + 5, i.e., b - laststart. - + We insert this at the beginning of the loop so that if we fail during matching, we'll reinitialize the bounds. */ @@ -1964,7 +1964,7 @@ regex_compile (pattern, size, syntax, bufp) beg_interval = NULL; /* normal_char and normal_backslash need `c'. */ - PATFETCH (c); + PATFETCH (c); if (!(syntax & RE_NO_BK_BRACES)) { @@ -1980,7 +1980,7 @@ regex_compile (pattern, size, syntax, bufp) BUF_PUSH (at_dot); break; - case 's': + case 's': laststart = b; PATFETCH (c); BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]); @@ -2087,11 +2087,11 @@ regex_compile (pattern, size, syntax, bufp) /* Expects the character in `c'. */ normal_char: /* If no exactn currently being built. */ - if (!pending_exact + if (!pending_exact /* If last exactn not at current position. */ || pending_exact + *pending_exact + 1 != b - + /* We have only one byte following the exactn for the count. */ || *pending_exact == (1 << BYTEWIDTH) - 1 @@ -2106,26 +2106,26 @@ regex_compile (pattern, size, syntax, bufp) : (p[0] == '\\' && p[1] == '{')))) { /* Start building a new exactn. */ - + laststart = b; BUF_PUSH_2 (exactn, 0); pending_exact = b - 1; } - + BUF_PUSH (c); (*pending_exact)++; break; } /* switch (c) */ } /* while p != pend */ - + /* Through the pattern now. */ - + if (fixup_alt_jump) STORE_JUMP (jump_past_alt, fixup_alt_jump, b); - if (!COMPILE_STACK_EMPTY) + if (!COMPILE_STACK_EMPTY) return REG_EPAREN; free (compile_stack.stack); @@ -2181,14 +2181,14 @@ insert_op1 (op, loc, arg, end) re_opcode_t op; unsigned char *loc; int arg; - unsigned char *end; + unsigned char *end; { register unsigned char *pfrom = end; register unsigned char *pto = end + 3; while (pfrom != loc) *--pto = *--pfrom; - + store_op1 (op, loc, arg); } @@ -2200,14 +2200,14 @@ insert_op2 (op, loc, arg1, arg2, end) re_opcode_t op; unsigned char *loc; int arg1, arg2; - unsigned char *end; + unsigned char *end; { register unsigned char *pfrom = end; register unsigned char *pto = end + 5; while (pfrom != loc) *--pto = *--pfrom; - + store_op2 (op, loc, arg1, arg2); } @@ -2223,7 +2223,7 @@ at_begline_loc_p (pattern, p, syntax) { const char *prev = p - 2; boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\'; - + return /* After a subexpression? */ (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash)) @@ -2243,7 +2243,7 @@ at_endline_loc_p (p, pend, syntax) const char *next = p; boolean next_backslash = *next == '\\'; const char *next_next = p + 1 < pend ? p + 1 : NULL; - + return /* Before a subexpression? */ (syntax & RE_NO_BK_PARENS ? *next == ')' @@ -2254,7 +2254,7 @@ at_endline_loc_p (p, pend, syntax) } -/* Returns true if REGNUM is in one of COMPILE_STACK's elements and +/* Returns true if REGNUM is in one of COMPILE_STACK's elements and false if it's not. */ static boolean @@ -2264,8 +2264,8 @@ group_in_compile_stack (compile_stack, regnum) { int this_element; - for (this_element = compile_stack.avail - 1; - this_element >= 0; + for (this_element = compile_stack.avail - 1; + this_element >= 0; this_element--) if (compile_stack.stack[this_element].regnum == regnum) return true; @@ -2279,9 +2279,9 @@ group_in_compile_stack (compile_stack, regnum) starting character is in `P[-2]'. (`P[-1]' is the character `-'.) Then we set the translation of all bits between the starting and ending characters (inclusive) in the compiled pattern B. - + Return an error code. - + We use these short variable names so we can use the same macros as `regex_compile' itself. */ @@ -2296,7 +2296,7 @@ compile_range (p_ptr, pend, translate, syntax, b) const char *p = *p_ptr; int range_start, range_end; - + if (p == pend) return REG_ERANGE; @@ -2305,7 +2305,7 @@ compile_range (p_ptr, pend, translate, syntax, b) is set, the range endpoints will be negative if we fetch using a signed char *. - We also want to fetch the endpoints without translating them; the + We also want to fetch the endpoints without translating them; the appropriate translation is done in the bit-setting loop below. */ range_start = ((unsigned char *) p)[-2]; range_end = ((unsigned char *) p)[0]; @@ -2326,14 +2326,14 @@ compile_range (p_ptr, pend, translate, syntax, b) { SET_LIST_BIT (TRANSLATE (this_char)); } - + return REG_NOERROR; } /* Failure stack declarations and macros; both re_compile_fastmap and re_match_2 use a failure stack. These have to be macros because of REGEX_ALLOCATE. */ - + /* Number of failure points for which to initially allocate space when matching. If this number is exceeded, we allocate more @@ -2381,8 +2381,8 @@ typedef struct /* Double the size of FAIL_STACK, up to approximately `re_max_failures' items. Return 1 if succeeds, and 0 if either ran out of memory - allocating space for it or it was already too large. - + allocating space for it or it was already too large. + REGEX_REALLOCATE requires `destination' be declared. */ #define DOUBLE_FAIL_STACK(fail_stack) \ @@ -2399,7 +2399,7 @@ typedef struct 1))) -/* Push PATTERN_OP on FAIL_STACK. +/* Push PATTERN_OP on FAIL_STACK. Return 1 if was able to do so and 0 if ran out of memory allocating space to do so. */ @@ -2430,12 +2430,12 @@ typedef struct /* Push the information about the state we will need - if we ever fail back to it. - + if we ever fail back to it. + Requires variables fail_stack, regstart, regend, reg_info, and num_regs be declared. DOUBLE_FAIL_STACK requires `destination' be declared. - + Does `return FAILURE_CODE' if runs out of memory. */ #define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \ @@ -2466,7 +2466,7 @@ typedef struct DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \ (fail_stack).size); \ DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\ - } + } #define PUSH_FAILURE_POINT2(pattern_place, string_place, failure_code) \ /* Push the info, starting with the registers. */ \ @@ -2552,7 +2552,7 @@ typedef struct LOW_REG, HIGH_REG -- the highest and lowest active registers. REGSTART, REGEND -- arrays of string positions. REG_INFO -- array of information about each subexpression. - + Also assumes the variables `fail_stack' and (if debugging), `bufp', `pend', `string1', `size1', `string2', and `size2'. */ @@ -2627,7 +2627,7 @@ typedef struct The caller must supply the address of a (1 << BYTEWIDTH)-byte data area as BUFP->fastmap. - + We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in the pattern buffer. @@ -2644,7 +2644,7 @@ re_compile_fastmap (bufp) #endif /* We don't push any register information onto the failure stack. */ unsigned num_regs = 0; - + register char *fastmap = bufp->fastmap; unsigned char *pattern = bufp->buffer; const unsigned char *p = pattern; @@ -2660,27 +2660,27 @@ re_compile_fastmap (bufp) boolean succeed_n_p = false; assert (fastmap != NULL && p != NULL); - + INIT_FAIL_STACK (); bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ bufp->fastmap_accurate = 1; /* It will be when we're done. */ bufp->can_be_null = 0; - + while (p != pend || !FAIL_STACK_EMPTY ()) { if (p == pend) { bufp->can_be_null |= path_can_be_null; - + /* Reset for next path. */ path_can_be_null = true; - + p = fail_stack.stack[--fail_stack.avail]; } /* We should never be about to go beyond the end of the pattern. */ assert (p < pend); - + #ifdef SWITCH_ENUM_BUG switch ((int) ((re_opcode_t) *p++)) #else @@ -2804,10 +2804,10 @@ re_compile_fastmap (bufp) case jump_past_alt: case dummy_failure_jump: EXTRACT_NUMBER_AND_INCR (j, p); - p += j; + p += j; if (j > 0) continue; - + /* Jump backward implies we just went through the body of a loop and matched nothing. Opcode jumped to should be `on_failure_jump' or `succeed_n'. Just treat it like an @@ -2819,10 +2819,10 @@ re_compile_fastmap (bufp) p++; EXTRACT_NUMBER_AND_INCR (j, p); - p += j; - + p += j; + /* If what's on the stack is where we are now, pop it. */ - if (!FAIL_STACK_EMPTY () + if (!FAIL_STACK_EMPTY () && fail_stack.stack[fail_stack.avail - 1] == p) fail_stack.avail--; @@ -2860,7 +2860,7 @@ re_compile_fastmap (bufp) case succeed_n: /* Get to the number of times to succeed. */ - p += 2; + p += 2; /* Increment p past the n for when k != 0. */ EXTRACT_NUMBER_AND_INCR (k, p); @@ -2951,7 +2951,7 @@ re_search (bufp, string, size, startpos, range, regs) int size, startpos, range; struct re_registers *regs; { - return re_search_2 (bufp, NULL, 0, string, size, startpos, range, + return re_search_2 (bufp, NULL, 0, string, size, startpos, range, regs, size); } @@ -2959,17 +2959,17 @@ re_search (bufp, string, size, startpos, range, regs) /* Using the compiled pattern in BUFP->buffer, first tries to match the virtual concatenation of STRING1 and STRING2, starting first at index STARTPOS, then at STARTPOS + 1, and so on. - + STRING1 and STRING2 have length SIZE1 and SIZE2, respectively. - + RANGE is how far to scan while trying to match. RANGE = 0 means try only at STARTPOS; in general, the last start tried is STARTPOS + RANGE. - + In REGS, return the indices of the virtual concatenation of STRING1 and STRING2 that matched the entire BUFP->buffer and its contained subexpressions. - + Do not consider matching one past the index STOP in the virtual concatenation of STRING1 and STRING2. @@ -2996,7 +2996,7 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) /* Check for out-of-range STARTPOS. */ if (startpos < 0 || startpos > total_size) return -1; - + /* Fix up RANGE if it might eventually take us outside the virtual concatenation of STRING1 and STRING2. */ if (endpos < -1) @@ -3018,10 +3018,10 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) if (fastmap && !bufp->fastmap_accurate) if (re_compile_fastmap (bufp) == -2) return -2; - + /* Loop through the string, looking for a place to start matching. */ for (;;) - { + { /* If a fastmap is supplied, skip quickly over characters that cannot be the start of a match. If the pattern can match the null string, however, we don't need to skip characters; we want @@ -3038,7 +3038,7 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) lim = range - (size1 - startpos); d = (startpos >= size1 ? string2 - size1 : string1) + startpos; - + /* Written out as an if-else to avoid testing `translate' inside the loop. */ if (translate) @@ -3055,7 +3055,7 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) else /* Searching backwards. */ { register char c = (size1 == 0 || startpos >= size1 - ? string2[startpos - size1] + ? string2[startpos - size1] : string1[startpos]); if (!fastmap[(unsigned char) TRANSLATE (c)]) @@ -3072,21 +3072,21 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) startpos, regs, stop); if (val >= 0) return startpos; - + if (val == -2) return -2; advance: - if (!range) + if (!range) break; - else if (range > 0) + else if (range > 0) { - range--; + range--; startpos++; } else { - range++; + range++; startpos--; } } @@ -3098,8 +3098,8 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) onto the failure stack. Other register information, such as the starting and ending positions (which are addresses), and the list of inner groups (which is a bits list) are maintained in separate - variables. - + variables. + We are making a (strictly speaking) nonportable assumption here: that the compiler will pack our bit fields into something that fits into the type of `word', i.e., is something that fits into one item on the @@ -3187,7 +3187,7 @@ static int bcmp_translate _RE_ARGS((const char *s1, const char *s2, /* Test if at very beginning or at very end of the virtual concatenation of `string1' and `string2'. If only one string, it's `string2'. */ #define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) -#define AT_STRINGS_END(d) ((d) == end2) +#define AT_STRINGS_END(d) ((d) == end2) /* Test if D points to a character which is word-constituent. We have @@ -3250,7 +3250,7 @@ re_match (bufp, string, size, pos, regs) int size, pos; struct re_registers *regs; { - return re_match_2 (bufp, NULL, 0, string, size, pos, regs, size); + return re_match_2 (bufp, NULL, 0, string, size, pos, regs, size); } #endif /* not emacs */ @@ -3259,7 +3259,7 @@ re_match (bufp, string, size, pos, regs) the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 and SIZE2, respectively). We start matching at POS, and stop matching at STOP. - + If REGS is non-null and the `no_sub' field of BUFP is nonzero, we store offsets for the substring each group matched in REGS. See the documentation for exactly how many groups we fill. @@ -3290,7 +3290,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) /* Where we are in the data, and the end of the current string. */ const char *d, *dend; - + /* Where we are in the pattern, and the end of the pattern. */ unsigned char *p = bufp->buffer; register unsigned char *pend = p + bufp->used; @@ -3317,7 +3317,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) return, for use in backreferences. The number here includes an element for register zero. */ size_t num_regs = bufp->re_nsub + 1; - + /* The currently active registers. */ active_reg_t lowest_active_reg = NO_LOWEST_ACTIVE_REG; active_reg_t highest_active_reg = NO_HIGHEST_ACTIVE_REG; @@ -3344,15 +3344,15 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) matched any of the pattern so far this time through the reg_num-th subexpression. These two fields get reset each time through any loop their register is in. */ - register_info_type *reg_info = 0; + register_info_type *reg_info = 0; /* The following record the register info as found in the above - variables when we find a match better than any we've seen before. + variables when we find a match better than any we've seen before. This happens as we backtrack through the failure points, which in turn happens only if we have not yet matched the entire string. */ unsigned best_regs_set = false; const char **best_regstart = 0, **best_regend = 0; - + /* Logically, this is `best_regend[0]'. But we don't want to have to allocate space for that if we're not allocating space for anything else (see below). Also, we never need info about register 0 for @@ -3369,13 +3369,13 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) #ifdef DEBUG /* Counts the total number of registers pushed. */ - unsigned num_regs_pushed = 0; + unsigned num_regs_pushed = 0; #endif DEBUG_PRINT1 ("\n\nEntering re_match_2.\n"); - + INIT_FAIL_STACK (); - + /* Do not bother to initialize all the register variables if there are no groups in the pattern, as it takes a fair amount of time. If there are groups, we include space for register 0 (the whole @@ -3393,8 +3393,8 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) reg_dummy = REGEX_TALLOC (num_regs, const char *); reg_info_dummy = REGEX_TALLOC (num_regs, register_info_type); - if (!(regstart && regend && old_regstart && old_regend && reg_info - && best_regstart && best_regend && reg_dummy && reg_info_dummy)) + if (!(regstart && regend && old_regstart && old_regend && reg_info + && best_regstart && best_regend && reg_dummy && reg_info_dummy)) { FREE_VARIABLES (); return -2; @@ -3417,21 +3417,21 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) FREE_VARIABLES (); return -1; } - + /* Initialize subexpression text positions to -1 to mark ones that no start_memory/stop_memory has been seen for. Also initialize the register information struct. */ for (mcnt = 1; mcnt < num_regs; mcnt++) { - regstart[mcnt] = regend[mcnt] + regstart[mcnt] = regend[mcnt] = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE; - + REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE; IS_ACTIVE (reg_info[mcnt]) = 0; MATCHED_SOMETHING (reg_info[mcnt]) = 0; EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0; } - + /* We move `string1' into `string2' if the latter's empty -- but not if `string1' is null. */ if (size2 == 0 && string1 != NULL) @@ -3456,7 +3456,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) end_match_2 = string2 + stop - size1; } - /* `p' scans through the pattern as `d' scans through the data. + /* `p' scans through the pattern as `d' scans through the data. `dend' is the end of the input string that `d' points within. `d' is advanced into the following input string whenever necessary, but this happens before fetching; therefore, at the beginning of the @@ -3478,7 +3478,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) DEBUG_PRINT1 ("The string to match is: `"); DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2); DEBUG_PRINT1 ("'\n"); - + /* This loops over pattern commands. It exits by returning from the function if the match is complete, or it drops through if the match fails at this starting point in the input data. */ @@ -3489,16 +3489,16 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) if (p == pend) { /* End of pattern means we might have succeeded. */ DEBUG_PRINT1 ("end of pattern ... "); - + /* If we haven't matched the entire string, and we want the longest match, try backtracking. */ if (d != end_match_2) { DEBUG_PRINT1 ("backtracking.\n"); - + if (!FAIL_STACK_EMPTY ()) { /* More failure points to try. */ - boolean same_str_p = (FIRST_STRING_P (match_end) + boolean same_str_p = (FIRST_STRING_P (match_end) == MATCHING_IN_FIRST_STRING); /* If exceeds best match so far, save it. */ @@ -3508,20 +3508,20 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) { best_regs_set = true; match_end = d; - + DEBUG_PRINT1 ("\nSAVING match as best so far.\n"); - + for (mcnt = 1; mcnt < num_regs; mcnt++) { best_regstart[mcnt] = regstart[mcnt]; best_regend[mcnt] = regend[mcnt]; } } - goto fail; + goto fail; } /* If no failure points, don't restore garbage. */ - else if (best_regs_set) + else if (best_regs_set) { restore_best_regs: /* Restore best match. It may happen that `dend == @@ -3530,7 +3530,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) strings `x-' and `y-z-', if the two strings are not consecutive in memory. */ DEBUG_PRINT1 ("Restoring best registers.\n"); - + d = match_end; dend = ((d >= string1 && d <= end1) ? end_match_1 : end_match_2); @@ -3589,7 +3589,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) regs->end[0] = (MATCHING_IN_FIRST_STRING ? d - string1 : d - string2 + size1); } - + /* Go through the first `min (num_regs, regs->num_regs)' registers, since that is all we initialized. */ for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++) @@ -3602,7 +3602,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) regs->end[mcnt] = POINTER_TO_OFFSET (regend[mcnt]); } } - + /* If the regs structure we return has more elements than were in the pattern, set the extra elements to -1. If we (re)allocated the registers, this is the case, @@ -3618,8 +3618,8 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) nfailure_points_pushed - nfailure_points_popped); DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed); - mcnt = d - pos - (MATCHING_IN_FIRST_STRING - ? string1 + mcnt = d - pos - (MATCHING_IN_FIRST_STRING + ? string1 : string2 - size1); DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt); @@ -3709,7 +3709,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) p += 1 + *p; if (!not) goto fail; - + SET_REGS_MATCHED (); d++; break; @@ -3726,9 +3726,9 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) /* Find out if this group can match the empty string. */ p1 = p; /* To send to group_match_null_string_p. */ - + if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE) - REG_MATCH_NULL_STRING_P (reg_info[*p]) + REG_MATCH_NULL_STRING_P (reg_info[*p]) = group_match_null_string_p (&p1, pend, reg_info); /* Save the position in the string where we were the last time @@ -3739,7 +3739,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) ? REG_UNSET (regstart[*p]) ? d : regstart[*p] : regstart[*p]; - DEBUG_PRINT2 (" old_regstart: %d\n", + DEBUG_PRINT2 (" old_regstart: %d\n", POINTER_TO_OFFSET (old_regstart[*p])); regstart[*p] = d; @@ -3747,10 +3747,10 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) IS_ACTIVE (reg_info[*p]) = 1; MATCHED_SOMETHING (reg_info[*p]) = 0; - + /* This is the new highest active register. */ highest_active_reg = *p; - + /* If nothing was active before, this is the new lowest active register. */ if (lowest_active_reg == NO_LOWEST_ACTIVE_REG) @@ -3766,7 +3766,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) number, and the number of inner groups. */ case stop_memory: DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]); - + /* We need to save the string position the last time we were at this close-group operator in case the group is operated upon by a repetition operator, e.g., with `((a*)*(b*)*)*' @@ -3775,7 +3775,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) ? REG_UNSET (regend[*p]) ? d : regend[*p] : regend[*p]; - DEBUG_PRINT2 (" old_regend: %d\n", + DEBUG_PRINT2 (" old_regend: %d\n", POINTER_TO_OFFSET (old_regend[*p])); regend[*p] = d; @@ -3783,7 +3783,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) /* This register isn't active anymore. */ IS_ACTIVE (reg_info[*p]) = 0; - + /* If this was the only register active, nothing is active anymore. */ if (lowest_active_reg == highest_active_reg) @@ -3799,7 +3799,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) unsigned char r = *p - 1; while (r > 0 && !IS_ACTIVE (reg_info[r])) r--; - + /* If we end up at register zero, that means that we saved the registers as the result of an `on_failure_jump', not a `start_memory', and we jumped to past the innermost @@ -3815,7 +3815,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) else highest_active_reg = r; } - + /* If just failed to match something this time around with a group that's operated on by a repetition operator, try to force exit from the ``loop'', and restore the register @@ -3823,10 +3823,10 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) last match. */ if ((!MATCHED_SOMETHING (reg_info[*p]) || (re_opcode_t) p[-3] == start_memory) - && (p + 2) < pend) + && (p + 2) < pend) { boolean is_a_jump_n = false; - + p1 = p + 2; mcnt = 0; switch ((re_opcode_t) *p1++) @@ -3841,12 +3841,12 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) if (is_a_jump_n) p1 += 2; break; - + default: /* do nothing */ ; } p1 += mcnt; - + /* If the next operation is a jump backwards in the pattern to an on_failure_jump right before the start_memory corresponding to this stop_memory, exit from the loop @@ -3860,17 +3860,17 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) failed match, e.g., with `(a*)*b' against `ab' for regstart[1], and, e.g., with `((a*)*(b*)*)*' against `aba' for regend[3]. - + Also restore the registers for inner groups for, e.g., `((a*)(b*))*' against `aba' (register 3 would otherwise get trashed). */ - + if (EVER_MATCHED_SOMETHING (reg_info[*p])) { - unsigned r; - + unsigned r; + EVER_MATCHED_SOMETHING (reg_info[*p]) = 0; - + /* Restore this and inner groups' (if any) registers. */ for (r = *p; r < *p + *(p + 1); r++) { @@ -3879,7 +3879,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) /* xx why this test? */ if ((s_reg_t) old_regend[r] >= (s_reg_t) regstart[r]) regend[r] = old_regend[r]; - } + } } p1++; EXTRACT_NUMBER_AND_INCR (mcnt, p1); @@ -3889,7 +3889,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) goto fail; } } - + /* Move past the register number and the inner group count. */ p += 2; break; @@ -3906,16 +3906,16 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) /* Can't back reference a group which we've never matched. */ if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno])) goto fail; - + /* Where in input to try to start matching. */ d2 = regstart[regno]; - + /* Where to stop matching; if both the place to start and the place to stop matching are in the same string, then set to the place to stop, otherwise, for now have to use the end of the first string. */ - dend2 = ((FIRST_STRING_P (regstart[regno]) + dend2 = ((FIRST_STRING_P (regstart[regno]) == FIRST_STRING_P (regend[regno])) ? regend[regno] : end_match_1); for (;;) @@ -3939,16 +3939,16 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) /* How many characters left in this segment to match. */ mcnt = dend - d; - + /* Want how many consecutive characters we can match in one shot, so, if necessary, adjust the count. */ if (mcnt > dend2 - d2) mcnt = dend2 - d2; - + /* Compare that many; failure if mismatch, else move past them. */ - if (translate - ? bcmp_translate (d, d2, mcnt, translate) + if (translate + ? bcmp_translate (d, d2, mcnt, translate) : bcmp (d, d2, mcnt)) goto fail; d += mcnt, d2 += mcnt; @@ -3962,7 +3962,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) `newline_anchor' is set, after newlines. */ case begline: DEBUG_PRINT1 ("EXECUTING begline.\n"); - + if (AT_STRINGS_BEG (d)) { if (!bufp->not_bol) break; @@ -3983,7 +3983,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) { if (!bufp->not_eol) break; } - + /* We have to ``prefetch'' the next character. */ else if ((d == end1 ? *string2 : *d) == '\n' && bufp->newline_anchor) @@ -4017,7 +4017,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) then the . fails against the \n. But the next thing we want to do is match the \n against the \n; if we restored the string value, we would be back at the foo. - + Because this is used only in specific cases, we don't need to check all the things that `on_failure_jump' does, to make sure the right things get saved on the stack. Hence we don't @@ -4027,7 +4027,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) case; that seems worse than this. */ case on_failure_keep_string_jump: DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump"); - + EXTRACT_NUMBER_AND_INCR (mcnt, p); DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt); @@ -4037,7 +4037,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) /* Uses of on_failure_jump: - + Each alternative starts with an on_failure_jump that points to the beginning of the next alternative. Each alternative except the last ends with a jump that in effect jumps past @@ -4104,7 +4104,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) would have to backtrack because of (as in, e.g., `a*a') then we can change to pop_failure_jump, because we'll never have to backtrack. - + This is not true in the case of alternatives: in `(a|ab)*' we do need to backtrack to the `ab' alternative (e.g., if the string was `ab'). But instead of trying to @@ -4136,7 +4136,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) p1 = p + mcnt; /* p1[0] ... p1[2] are the `on_failure_jump' corresponding - to the `maybe_finalize_jump' of this case. Examine what + to the `maybe_finalize_jump' of this case. Examine what follows. */ if ((re_opcode_t) p1[3] == exactn && p1[5] != c) { @@ -4144,12 +4144,12 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", c, p1[5]); } - + else if ((re_opcode_t) p1[3] == charset || (re_opcode_t) p1[3] == charset_not) { int not = (re_opcode_t) p1[3] == charset_not; - + if (c < (unsigned char) (p1[4] * BYTEWIDTH) && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) not = !not; @@ -4198,7 +4198,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) } /* Note fall through. */ - + /* Unconditionally jump (without popping any failure points). */ case jump: unconditional_jump: @@ -4208,7 +4208,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) DEBUG_PRINT2 ("(to 0x%x).\n", p); break; - + /* We need this opcode so we can detect where alternatives end in `group_match_null_string_p' et al. */ case jump_past_alt: @@ -4245,7 +4245,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) /* Have to succeed matching what follows at least n times. After that, handle like `on_failure_jump'. */ - case succeed_n: + case succeed_n: EXTRACT_NUMBER (mcnt, p + 2); DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt); @@ -4266,8 +4266,8 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) goto on_failure; } break; - - case jump_n: + + case jump_n: EXTRACT_NUMBER (mcnt, p + 2); DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt); @@ -4276,13 +4276,13 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) { mcnt--; STORE_NUMBER (p + 2, mcnt); - goto unconditional_jump; + goto unconditional_jump; } /* If don't have to jump any more, skip over the rest of command. */ - else - p += 4; + else + p += 4; break; - + case set_number_at: { DEBUG_PRINT1 ("EXECUTING set_number_at.\n"); @@ -4327,13 +4327,13 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) if (PTR_CHAR_POS ((unsigned char *) d) >= point) goto fail; break; - + case at_dot: DEBUG_PRINT1 ("EXECUTING at_dot.\n"); if (PTR_CHAR_POS ((unsigned char *) d) != point) goto fail; break; - + case after_dot: DEBUG_PRINT1 ("EXECUTING after_dot.\n"); if (PTR_CHAR_POS ((unsigned char *) d) <= point) @@ -4386,7 +4386,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) SET_REGS_MATCHED (); d++; break; - + case notwordchar: DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n"); PREFETCH (); @@ -4396,7 +4396,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) d++; break; #endif /* not emacs */ - + default: abort (); } @@ -4421,7 +4421,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) if (p < pend) { boolean is_a_jump_n = false; - + /* If failed to a backwards jump that's part of a repetition loop, need to pop this failure point and use the next one. */ switch ((re_opcode_t) *p) @@ -4433,7 +4433,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) case jump: p1 = p + 1; EXTRACT_NUMBER_AND_INCR (mcnt, p1); - p1 += mcnt; + p1 += mcnt; if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n) || (!is_a_jump_n @@ -4464,10 +4464,10 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) /* We are passed P pointing to a register number after a start_memory. - + Return true if the pattern up to the corresponding stop_memory can match the empty string, and false otherwise. - + If we find the matching stop_memory, sets P to point to one past its number. Otherwise, sets P to an undefined byte less than or equal to END. @@ -4481,20 +4481,20 @@ group_match_null_string_p (p, end, reg_info) int mcnt; /* Point to after the args to the start_memory. */ unsigned char *p1 = *p + 2; - + while (p1 < end) { /* Skip over opcodes that can match nothing, and return true or false, as appropriate, when we get to one that can't, or to the matching stop_memory. */ - + switch ((re_opcode_t) *p1) { /* Could be either a loop or a series of alternatives. */ case on_failure_jump: p1++; EXTRACT_NUMBER_AND_INCR (mcnt, p1); - + /* If the next operation is not a jump backwards in the pattern. */ @@ -4508,7 +4508,7 @@ group_match_null_string_p (p, end, reg_info) /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6 /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3 - /exactn/1/c + /exactn/1/c So, we have to first go through the first (n-1) alternatives and then deal with the last one separately. */ @@ -4524,19 +4524,19 @@ group_match_null_string_p (p, end, reg_info) is, including the ending `jump_past_alt' and its number. */ - if (!alt_match_null_string_p (p1, p1 + mcnt - 3, + if (!alt_match_null_string_p (p1, p1 + mcnt - 3, reg_info)) return false; /* Move to right after this alternative, including the jump_past_alt. */ - p1 += mcnt; + p1 += mcnt; /* Break if it's the beginning of an n-th alternative that doesn't begin with an on_failure_jump. */ if ((re_opcode_t) *p1 != on_failure_jump) break; - + /* Still have to check that it's not an n-th alternative that starts with an on_failure_jump. */ p1++; @@ -4561,14 +4561,14 @@ group_match_null_string_p (p, end, reg_info) } /* if mcnt > 0 */ break; - + case stop_memory: assert (p1[1] == **p); *p = p1 + 2; return true; - - default: + + default: if (!common_op_match_null_string_p (&p1, end, reg_info)) return false; } @@ -4581,7 +4581,7 @@ group_match_null_string_p (p, end, reg_info) /* Similar to group_match_null_string_p, but doesn't deal with alternatives: It expects P to be the first byte of a single alternative and END one byte past the last. The alternative can contain groups. */ - + static boolean alt_match_null_string_p (p, end, reg_info) unsigned char *p, *end; @@ -4589,12 +4589,12 @@ alt_match_null_string_p (p, end, reg_info) { int mcnt; unsigned char *p1 = p; - + while (p1 < end) { - /* Skip over opcodes that can match nothing, and break when we get + /* Skip over opcodes that can match nothing, and break when we get to one that can't. */ - + switch ((re_opcode_t) *p1) { /* It's a loop. */ @@ -4603,8 +4603,8 @@ alt_match_null_string_p (p, end, reg_info) EXTRACT_NUMBER_AND_INCR (mcnt, p1); p1 += mcnt; break; - - default: + + default: if (!common_op_match_null_string_p (&p1, end, reg_info)) return false; } @@ -4615,8 +4615,8 @@ alt_match_null_string_p (p, end, reg_info) /* Deals with the ops common to group_match_null_string_p and - alt_match_null_string_p. - + alt_match_null_string_p. + Sets P to one after the op and its arguments, if any. */ static boolean @@ -4651,7 +4651,7 @@ common_op_match_null_string_p (p, end, reg_info) reg_no = *p1; assert (reg_no > 0 && reg_no <= MAX_REGNUM); ret = group_match_null_string_p (&p1, end, reg_info); - + /* Have to set this here in case we're checking a group which contains a group and a back reference to it. */ @@ -4661,7 +4661,7 @@ common_op_match_null_string_p (p, end, reg_info) if (!ret) return false; break; - + /* If this is an optimized succeed_n for zero times, make the jump. */ case jump: EXTRACT_NUMBER_AND_INCR (mcnt, p1); @@ -4673,7 +4673,7 @@ common_op_match_null_string_p (p, end, reg_info) case succeed_n: /* Get to the number of times to succeed. */ - p1 += 2; + p1 += 2; EXTRACT_NUMBER_AND_INCR (mcnt, p1); if (mcnt == 0) @@ -4686,7 +4686,7 @@ common_op_match_null_string_p (p, end, reg_info) return false; break; - case duplicate: + case duplicate: if (!REG_MATCH_NULL_STRING_P (reg_info[*p1])) return false; break; @@ -4706,7 +4706,7 @@ common_op_match_null_string_p (p, end, reg_info) /* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN bytes; nonzero otherwise. */ - + static int bcmp_translate (s1, s2, len, translate) const char *s1, *s2; @@ -4728,10 +4728,10 @@ bcmp_translate (s1, s2, len, translate) /* re_compile_pattern is the GNU regular expression compiler: it compiles PATTERN (of length SIZE) and puts the result in BUFP. Returns 0 if the pattern was valid, otherwise an error string. - + Assumes the `allocated' (and perhaps `buffer') and `translate' fields are set in BUFP on entry. - + We call regex_compile to do the actual compilation. */ const char * @@ -4741,23 +4741,23 @@ re_compile_pattern (pattern, length, bufp) struct re_pattern_buffer *bufp; { reg_errcode_t ret; - + /* GNU code is written to assume at least RE_NREGS registers will be set (and at least one extra will be -1). */ bufp->regs_allocated = REGS_UNALLOCATED; - + /* And GNU code determines whether or not to get register information by passing null for the REGS argument to re_match, etc., not by setting no_sub. */ bufp->no_sub = 0; - + /* Match anchors at newline. */ bufp->newline_anchor = 1; - + ret = regex_compile (pattern, length, re_syntax_options, bufp); return re_error_msg[(int) ret]; -} +} /* Entry points compatible with 4.2 BSD regex library. We don't define them if this is an Emacs or POSIX compilation. */ @@ -4772,7 +4772,7 @@ re_comp (s) const char *s; { reg_errcode_t ret; - + if (!s) { if (!re_comp_buf.buffer) @@ -4799,7 +4799,7 @@ re_comp (s) re_comp_buf.newline_anchor = 1; ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf); - + /* Yes, we're discarding `const' here. */ return (char *) re_error_msg[(int) ret]; } @@ -4856,7 +4856,7 @@ re_exec (s) int regcomp (preg, pattern, cflags) regex_t *preg; - const char *pattern; + const char *pattern; int cflags; { reg_errcode_t ret; @@ -4868,17 +4868,17 @@ regcomp (preg, pattern, cflags) preg->buffer = 0; preg->allocated = 0; preg->used = 0; - + /* Don't bother to use a fastmap when searching. This simplifies the REG_NEWLINE case: if we used a fastmap, we'd have to put all the characters after newlines into the fastmap. This way, we just try every character. */ preg->fastmap = 0; - + if (cflags & REG_ICASE) { unsigned i; - + preg->translate = (char *) malloc (CHAR_SET_SIZE); if (preg->translate == NULL) return (int) REG_ESPACE; @@ -4903,38 +4903,38 @@ regcomp (preg, pattern, cflags) preg->no_sub = !!(cflags & REG_NOSUB); - /* POSIX says a null character in the pattern terminates it, so we + /* POSIX says a null character in the pattern terminates it, so we can use strlen here in compiling the pattern. */ ret = regex_compile (pattern, strlen (pattern), syntax, preg); - + /* POSIX doesn't distinguish between an unmatched open-group and an unmatched close-group: both are REG_EPAREN. */ if (ret == REG_ERPAREN) ret = REG_EPAREN; - + return (int) ret; } /* regexec searches for a given pattern, specified by PREG, in the string STRING. - + If NMATCH is zero or REG_NOSUB was set in the cflags argument to `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at least NMATCH elements, and we set them to the offsets of the corresponding matched substrings. - + EFLAGS specifies `execution flags' which affect matching: if REG_NOTBOL is set, then ^ does not match at the beginning of the string; if REG_NOTEOL is set, then $ does not match at the end. - + We return 0 if we find a match and REG_NOMATCH if not. */ int regexec (preg, string, nmatch, pmatch, eflags) const regex_t *preg; - const char *string; - size_t nmatch; - regmatch_t pmatch[]; + const char *string; + size_t nmatch; + regmatch_t pmatch[]; int eflags; { int ret; @@ -4944,15 +4944,15 @@ regexec (preg, string, nmatch, pmatch, eflags) boolean want_reg_info = !preg->no_sub && nmatch > 0; private_preg = *preg; - + private_preg.not_bol = !!(eflags & REG_NOTBOL); private_preg.not_eol = !!(eflags & REG_NOTEOL); - + /* The user has told us exactly how many registers to return information about, via `nmatch'. We have to pass that on to the matching routines. */ private_preg.regs_allocated = REGS_FIXED; - + if (want_reg_info) { regs.num_regs = nmatch; @@ -4966,7 +4966,7 @@ regexec (preg, string, nmatch, pmatch, eflags) ret = re_search (&private_preg, string, len, /* start: */ 0, /* range: */ len, want_reg_info ? ®s : (struct re_registers *) 0); - + /* Copy the register information to the POSIX structure. */ if (want_reg_info) { @@ -5006,7 +5006,7 @@ regerror (errcode, preg, errbuf, errbuf_size) if (errcode < 0 || errcode >= (sizeof (re_error_msg) / sizeof (re_error_msg[0]))) - /* Only error codes returned by the rest of the code should be passed + /* Only error codes returned by the rest of the code should be passed to this routine. If we are given anything else, or if other regex code generates an invalid error code, then the program has a bug. Dump core so we can fix it. */ @@ -5020,7 +5020,7 @@ regerror (errcode, preg, errbuf, errbuf_size) msg = "Success"; msg_size = strlen (msg) + 1; /* Includes the null. */ - + if (errbuf_size != 0) { if (msg_size > errbuf_size) @@ -5045,7 +5045,7 @@ regfree (preg) if (preg->buffer != NULL) free (preg->buffer); preg->buffer = NULL; - + preg->allocated = 0; preg->used = 0; diff --git a/gnu/lib/libregex/regex.h b/gnu/lib/libregex/regex.h index 757dbacf7a28..462d883b3f58 100644 --- a/gnu/lib/libregex/regex.h +++ b/gnu/lib/libregex/regex.h @@ -49,7 +49,7 @@ typedef unsigned long reg_syntax_t; #define RE_BACKSLASH_ESCAPE_IN_LISTS (1L) /* If this bit is not set, then + and ? are operators, and \+ and \? are - literals. + literals. If set, then \+ and \? are operators and + and ? are literals. */ #define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) @@ -65,7 +65,7 @@ typedef unsigned long reg_syntax_t; ^ is an anchor if it is at the beginning of a regular expression or after an open-group or an alternation operator; $ is an anchor if it is at the end of a regular expression, or - before a close-group or an alternation operator. + before a close-group or an alternation operator. This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because POSIX draft 11.2 says that * etc. in leading positions is undefined. @@ -76,7 +76,7 @@ typedef unsigned long reg_syntax_t; /* If this bit is set, then special characters are always special regardless of where they are in the pattern. If this bit is not set, then special characters are special only in - some contexts; otherwise they are ordinary. Specifically, + some contexts; otherwise they are ordinary. Specifically, * + ? and intervals are only special when not after the beginning, open-group, or alternation operator. */ #define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) @@ -98,7 +98,7 @@ typedef unsigned long reg_syntax_t; #define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) /* If this bit is set, either \{...\} or {...} defines an - interval, depending on RE_NO_BK_BRACES. + interval, depending on RE_NO_BK_BRACES. If not set, \{, \}, {, and } are literals. */ #define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) @@ -123,7 +123,7 @@ typedef unsigned long reg_syntax_t; If not set, then \<digit> is a back-reference. */ #define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) -/* If this bit is set, then | is an alternation operator, and \| is literal. +/* If this bit is set, then | is an alternation operator, and \| is literal. If not set, then \| is an alternation operator, and | is literal. */ #define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) @@ -149,7 +149,7 @@ extern reg_syntax_t re_syntax_options; /* Define combinations of the above bits for the standard possibilities. (The [[[ comments delimit what gets put into the Texinfo file, so - don't delete them!) */ + don't delete them!) */ /* [[[begin syntaxes]]] */ #define RE_SYNTAX_EMACS 0 @@ -232,7 +232,7 @@ extern reg_syntax_t re_syntax_options; /* If this bit is set, then ignore case when matching. If not set, then case is significant. */ #define REG_ICASE (REG_EXTENDED << 1) - + /* If this bit is set, then anchors do not match at newline characters in the string. If not set, then anchors do match at newlines. */ @@ -271,7 +271,7 @@ typedef enum REG_EESCAPE, /* Trailing backslash. */ REG_ESUBREG, /* Invalid back reference. */ REG_EBRACK, /* Unmatched left bracket. */ - REG_EPAREN, /* Parenthesis imbalance. */ + REG_EPAREN, /* Parenthesis imbalance. */ REG_EBRACE, /* Unmatched \{. */ REG_BADBR, /* Invalid contents of \{\}. */ REG_ERANGE, /* Invalid range end. */ @@ -302,7 +302,7 @@ struct re_pattern_buffer unsigned long allocated; /* Number of bytes actually used in `buffer'. */ - unsigned long used; + unsigned long used; /* Syntax setting with which the pattern was compiled. */ reg_syntax_t syntax; @@ -346,7 +346,7 @@ struct re_pattern_buffer unsigned no_sub : 1; /* If set, a beginning-of-line anchor doesn't match at the - beginning of the string. */ + beginning of the string. */ unsigned not_bol : 1; /* Similarly for an end-of-line anchor. */ @@ -458,7 +458,7 @@ extern int re_match /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ -extern int re_match_2 +extern int re_match_2 _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, int length1, const char *string2, int length2, int start, struct re_registers *regs, int stop)); diff --git a/gnu/lib/libregex/test/Makefile b/gnu/lib/libregex/test/Makefile index 5a8656a76e9a..84ebfcb2211a 100644 --- a/gnu/lib/libregex/test/Makefile +++ b/gnu/lib/libregex/test/Makefile @@ -1,6 +1,6 @@ # Generated automatically from Makefile.in by configure. # Makefile for regex testing. -# +# # Copyright (C) 1992 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify @@ -46,7 +46,7 @@ test_o = test.o bsd-interf.o other.o tregress.o psx-basic.o psx-extend.o \ common_o = printchar.o upcase.o xmalloc.o $(malloc) # We have a lot of mallocs we can try when we run afoul of strange bugs. -malloc = +malloc = #malloc = # the libc malloc #malloc = g++malloc.o #malloc = debugmalloc.o @@ -81,7 +81,7 @@ fileregex: $(fileregex_o) cppregex: regexcpp.o $(common_o) $(test_o) main.o $(CC) -o $@ $(LDFLAGS) $^ $(LIBS) -regexcpp.o: regexcpp.c +regexcpp.o: regexcpp.c regexcpp.c: regex.c regexcpp.sed rm -f regexcpp.c @@ -145,25 +145,25 @@ dist: Makefile TAGS ln $(distfiles) $(distdir) # Automatically-generated dependencies below here. -alloca.o : alloca.c -bsd-interf.o : bsd-interf.c -debugmalloc.o : debugmalloc.c -emacsmalloc.o : emacsmalloc.c getpagesize.h -fileregex.o : fileregex.c .././regex.h -g++malloc.o : g++malloc.c //usr/include/stdio.h getpagesize.h -iregex.o : iregex.c .././regex.h -main.o : main.c test.h .././regex.h -malloc-test.o : malloc-test.c -other.o : other.c test.h .././regex.h -printchar.o : printchar.c -psx-basic.o : psx-basic.c test.h .././regex.h -psx-extend.o : psx-extend.c test.h .././regex.h -psx-generic.o : psx-generic.c test.h .././regex.h -psx-group.o : psx-group.c test.h .././regex.h -psx-interf.o : psx-interf.c test.h .././regex.h -psx-interv.o : psx-interv.c test.h .././regex.h -syntax.o : syntax.c .././regex.h -test.o : test.c test.h .././regex.h -tregress.o : tregress.c test.h .././regex.h -upcase.o : upcase.c -xmalloc.o : xmalloc.c +alloca.o : alloca.c +bsd-interf.o : bsd-interf.c +debugmalloc.o : debugmalloc.c +emacsmalloc.o : emacsmalloc.c getpagesize.h +fileregex.o : fileregex.c .././regex.h +g++malloc.o : g++malloc.c //usr/include/stdio.h getpagesize.h +iregex.o : iregex.c .././regex.h +main.o : main.c test.h .././regex.h +malloc-test.o : malloc-test.c +other.o : other.c test.h .././regex.h +printchar.o : printchar.c +psx-basic.o : psx-basic.c test.h .././regex.h +psx-extend.o : psx-extend.c test.h .././regex.h +psx-generic.o : psx-generic.c test.h .././regex.h +psx-group.o : psx-group.c test.h .././regex.h +psx-interf.o : psx-interf.c test.h .././regex.h +psx-interv.o : psx-interv.c test.h .././regex.h +syntax.o : syntax.c .././regex.h +test.o : test.c test.h .././regex.h +tregress.o : tregress.c test.h .././regex.h +upcase.o : upcase.c +xmalloc.o : xmalloc.c diff --git a/gnu/lib/libregex/test/Makefile.in b/gnu/lib/libregex/test/Makefile.in index b6a413384f08..fea1f10e1753 100644 --- a/gnu/lib/libregex/test/Makefile.in +++ b/gnu/lib/libregex/test/Makefile.in @@ -1,5 +1,5 @@ # Makefile for regex testing. -# +# # Copyright (C) 1992 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify @@ -80,7 +80,7 @@ fileregex: $(fileregex_o) cppregex: regexcpp.o $(common_o) $(test_o) main.o $(CC) -o $@ $(LDFLAGS) $^ $(LIBS) -regexcpp.o: regexcpp.c +regexcpp.o: regexcpp.c regexcpp.c: regex.c regexcpp.sed rm -f regexcpp.c @@ -144,25 +144,25 @@ dist: Makefile TAGS ln $(distfiles) $(distdir) # Automatically-generated dependencies below here. -alloca.o : alloca.c -bsd-interf.o : bsd-interf.c -debugmalloc.o : debugmalloc.c -emacsmalloc.o : emacsmalloc.c getpagesize.h -fileregex.o : fileregex.c .././regex.h -g++malloc.o : g++malloc.c //usr/include/stdio.h getpagesize.h -iregex.o : iregex.c .././regex.h -main.o : main.c test.h .././regex.h -malloc-test.o : malloc-test.c -other.o : other.c test.h .././regex.h -printchar.o : printchar.c -psx-basic.o : psx-basic.c test.h .././regex.h -psx-extend.o : psx-extend.c test.h .././regex.h -psx-generic.o : psx-generic.c test.h .././regex.h -psx-group.o : psx-group.c test.h .././regex.h -psx-interf.o : psx-interf.c test.h .././regex.h -psx-interv.o : psx-interv.c test.h .././regex.h -syntax.o : syntax.c .././regex.h -test.o : test.c test.h .././regex.h -tregress.o : tregress.c test.h .././regex.h -upcase.o : upcase.c -xmalloc.o : xmalloc.c +alloca.o : alloca.c +bsd-interf.o : bsd-interf.c +debugmalloc.o : debugmalloc.c +emacsmalloc.o : emacsmalloc.c getpagesize.h +fileregex.o : fileregex.c .././regex.h +g++malloc.o : g++malloc.c //usr/include/stdio.h getpagesize.h +iregex.o : iregex.c .././regex.h +main.o : main.c test.h .././regex.h +malloc-test.o : malloc-test.c +other.o : other.c test.h .././regex.h +printchar.o : printchar.c +psx-basic.o : psx-basic.c test.h .././regex.h +psx-extend.o : psx-extend.c test.h .././regex.h +psx-generic.o : psx-generic.c test.h .././regex.h +psx-group.o : psx-group.c test.h .././regex.h +psx-interf.o : psx-interf.c test.h .././regex.h +psx-interv.o : psx-interv.c test.h .././regex.h +syntax.o : syntax.c .././regex.h +test.o : test.c test.h .././regex.h +tregress.o : tregress.c test.h .././regex.h +upcase.o : upcase.c +xmalloc.o : xmalloc.c diff --git a/gnu/lib/libregex/test/alloca.c b/gnu/lib/libregex/test/alloca.c index c1ff22227f8e..d8b6748389d0 100644 --- a/gnu/lib/libregex/test/alloca.c +++ b/gnu/lib/libregex/test/alloca.c @@ -7,7 +7,7 @@ This implementation of the PWB library alloca() function, which is used to allocate space off the run-time stack so - that it is automatically reclaimed upon procedure exit, + that it is automatically reclaimed upon procedure exit, was inspired by discussions with J. Q. Johnson of Cornell. It should work under any C implementation that uses an diff --git a/gnu/lib/libregex/test/bsd-interf.c b/gnu/lib/libregex/test/bsd-interf.c index 56f9e2a2fe68..226a513b347f 100644 --- a/gnu/lib/libregex/test/bsd-interf.c +++ b/gnu/lib/libregex/test/bsd-interf.c @@ -10,7 +10,7 @@ test_berk_search (pattern, string) char *string; { const char *return_value = re_comp (pattern); - + if (return_value != 0) { printf ("This didn't compile: `%s'.\n", pattern); diff --git a/gnu/lib/libregex/test/debugmalloc.c b/gnu/lib/libregex/test/debugmalloc.c index 5c468e212439..6caeb651d37f 100644 --- a/gnu/lib/libregex/test/debugmalloc.c +++ b/gnu/lib/libregex/test/debugmalloc.c @@ -11,7 +11,7 @@ static unsigned trace = 0; #define TRACE3(s, e1, e2, e3) if (trace) fprintf (stderr, s, e1, e2, e3) #define TRACE4(s, e1, e2, e3, e4) \ if (trace) fprintf (stderr, s, e1, e2, e3, e4) - + typedef char *address; @@ -23,13 +23,13 @@ xsbrk (incr) { extern char *sbrk (); address ret = sbrk (incr); - + if (ret == (address) -1) { perror ("sbrk"); /* Actually, we should return NULL, not quit. */ abort (); } - + return ret; } @@ -40,16 +40,16 @@ typedef struct chunk_struct /* This is the size (in bytes) that has actually been actually allocated, not the size that the user requested. */ unsigned alloc_size; - + /* This is the size the user requested. */ unsigned user_size; - + /* Points to the next block in one of the lists. */ struct chunk_struct *next; - + /* Now comes the user's memory. */ address user_mem; - + /* After the user's memory is a constant. */ } *chunk; @@ -98,10 +98,10 @@ chunk_insert (chunk_list, new_c) chunk new_c; { chunk c = *chunk_list; /* old beginning of list */ - + TRACE3 (" Inserting 0x%x at the beginning of 0x%x, before 0x%x.\n", new_c, chunk_list, c); - + *chunk_list = new_c; new_c->next = c; } @@ -120,7 +120,7 @@ chunk_delete (chunk_list, dead_c) chunk prev_c = NULL; TRACE2 (" Deleting 0x%x from 0x%x:", dead_c, chunk_list); - + while (c != dead_c && c != NULL) { TRACE1 (" 0x%x", c); @@ -133,7 +133,7 @@ chunk_delete (chunk_list, dead_c) fprintf (stderr, "Chunk at 0x%x not found on list.\n", dead_c); abort (); } - + if (prev_c == NULL) { TRACE1 (".\n Setting head to 0x%x.\n", c->next); @@ -154,16 +154,16 @@ validate_list (chunk_list) chunk *chunk_list; { chunk c; - + TRACE1 (" Validating list at 0x%x:", chunk_list); - + for (c = *chunk_list; c != NULL; c = c->next) { assert (c->user_size < c->alloc_size); assert (memcmp (chunk_to_mem (c) + c->user_size, "Karl", 4)); TRACE2 (" 0x%x/%d", c, c->user_size); } - + TRACE (".\n"); } @@ -176,22 +176,22 @@ free_list_available (needed) unsigned needed; { chunk c; - + TRACE1 (" Checking free list for %d bytes:", needed); - + if (free_list == NULL) { return NULL; } - + c = free_list; - + while (c != NULL && USER_ALLOC (c) < needed) { TRACE2 (" 0x%x/%d", c, USER_ALLOC (c)); c = c->next; } - + TRACE1 ("\n Returning 0x%x.\n", c); return c; } @@ -205,14 +205,14 @@ malloc (n) { address new_mem; chunk c; - + TRACE1 ("Mallocing %d bytes.\n", n); validate_list (&free_list); validate_list (&alloc_list); - c = free_list_available (n); - + c = free_list_available (n); + if (c == NULL) { /* Nothing suitable on free list. Allocate a new chunk. */ TRACE (" not on free list.\n"); @@ -232,7 +232,7 @@ malloc (n) new_mem = chunk_to_mem (c); memcpy (new_mem + n, "Karl", 4); chunk_insert (&alloc_list, c); - + TRACE2 ("Malloc returning 0x%x (chunk 0x%x).\n", new_mem, c); return new_mem; } @@ -246,13 +246,13 @@ realloc (mem, n) void free (); chunk c = mem_to_chunk (mem); address new_mem; - + TRACE3 ("Reallocing %d bytes at 0x%x (chunk 0x%x).\n", n, mem, c); new_mem = malloc (n); memcpy (new_mem, mem, c->user_size); free (mem); - + return new_mem; } @@ -262,12 +262,12 @@ free (mem) address mem; { chunk c = mem_to_chunk (mem); - + TRACE2 ("Freeing memory at 0x%x (chunk at 0x%x).\n", mem, c); validate_list (&free_list); validate_list (&alloc_list); - + chunk_delete (&alloc_list, c); chunk_insert (&free_list, c); } diff --git a/gnu/lib/libregex/test/emacsmalloc.c b/gnu/lib/libregex/test/emacsmalloc.c index 6eee1fae1acb..ad7c4dac7b47 100644 --- a/gnu/lib/libregex/test/emacsmalloc.c +++ b/gnu/lib/libregex/test/emacsmalloc.c @@ -27,9 +27,9 @@ what you give them. Help stamp out software-hoarding! */ * * Nov 1983, Mike@BRL, Added support for 4.1C/4.2 BSD. * - * This is a very fast storage allocator. It allocates blocks of a small + * This is a very fast storage allocator. It allocates blocks of a small * number of different sizes, and keeps free lists of each size. Blocks - * that don't exactly fit are passed up to the next larger size. In this + * that don't exactly fit are passed up to the next larger size. In this * implementation, the available sizes are (2^n)-4 (or -16) bytes long. * This is designed for use in a program that uses vast quantities of * memory, but bombs when it runs out. To make it a little better, it @@ -297,21 +297,21 @@ morecore (nu) /* ask system for more memory */ if (warnfunction) switch (warnlevel) { - case 0: + case 0: if (siz > (lim_data / 4) * 3) { warnlevel++; (*warnfunction) ("Warning: past 75% of memory limit"); } break; - case 1: + case 1: if (siz > (lim_data / 20) * 17) { warnlevel++; (*warnfunction) ("Warning: past 85% of memory limit"); } break; - case 2: + case 2: if (siz > (lim_data / 20) * 19) { warnlevel++; @@ -691,31 +691,31 @@ malloc_mem_used () int size_used; size_used = 0; - + for (i = 0; i < 30; i++) { int allocation_size = 1 << (i + 3); struct mhead *p; - + size_used += nmalloc[i] * allocation_size; } return size_used; } -int +int malloc_mem_free () { int i; int size_unused; size_unused = 0; - + for (i = 0; i < 30; i++) { int allocation_size = 1 << (i + 3); struct mhead *p; - + for (p = nextf[i]; p ; p = CHAIN (p)) size_unused += allocation_size; } @@ -736,7 +736,7 @@ malloc_mem_free () get_lim_data () { extern long ulimit (); - + #ifdef ULIMIT_BREAK_VALUE lim_data = ULIMIT_BREAK_VALUE; #else diff --git a/gnu/lib/libregex/test/fileregex.c b/gnu/lib/libregex/test/fileregex.c index 2c27a0f5ddcd..ba8106218c89 100644 --- a/gnu/lib/libregex/test/fileregex.c +++ b/gnu/lib/libregex/test/fileregex.c @@ -21,7 +21,7 @@ main (argc, argv) const char *compile_ret; unsigned lineno = 1; unsigned nfound = 0; - + /* Actually, it might be useful to allow the data file to be standard input, and to specify the pattern on the command line. */ if (argc != 2) @@ -29,7 +29,7 @@ main (argc, argv) fprintf (stderr, "Usage: %s <filename>.\n", argv[0]); exit (1); } - + filename = argv[1]; f = fopen (filename, "r"); if (f == NULL) @@ -41,7 +41,7 @@ main (argc, argv) printf ("Pattern = ", pat); gets (pat); - + if (feof (stdin)) { putchar ('\n'); @@ -61,13 +61,13 @@ main (argc, argv) struct re_registers regs; int search_ret = re_search_2 (&buf, NULL, 0, line, len, 0, len, ®s, len); - + if (search_ret == -2) { fprintf (stderr, "%s:%d: re_search failed.\n", filename, lineno); exit (1); } - + nfound += search_ret != -1; lineno++; } diff --git a/gnu/lib/libregex/test/g++malloc.c b/gnu/lib/libregex/test/g++malloc.c index d55ce45643d3..88c181c556a0 100644 --- a/gnu/lib/libregex/test/g++malloc.c +++ b/gnu/lib/libregex/test/g++malloc.c @@ -1,6 +1,6 @@ -#define inline +#define inline -/* +/* Copyright (C) 1989 Free Software Foundation written by Doug Lea (dl@oswego.edu) @@ -19,7 +19,7 @@ GNU CC General Public License. A copy of this license is supposed to have been given to you along with GNU CC so you can know your rights and responsibilities. It should be in a file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. +and this notice must be preserved on all copies. */ @@ -92,7 +92,7 @@ and this notice must be preserved on all copies. avoid wasted iterations due to (1). */ -/* +/* A version of malloc/free/realloc tuned for C++ applications. Here's what you probably want to know first: @@ -101,11 +101,11 @@ and this notice must be preserved on all copies. and usually substantially less memory-wasteful than BSD/GNUemacs malloc. Generally, it is slower (by perhaps 20%) than bsd-style malloc - only when bsd malloc would waste a great deal of space in + only when bsd malloc would waste a great deal of space in fragmented blocks, which this malloc recovers; or when, by chance or design, nearly all requests are near the bsd malloc power-of-2 allocation bin boundaries, and as many chunks are - used as are allocated. + used as are allocated. It uses more space than bsd malloc only when, again by chance or design, only bsdmalloc bin-sized requests are malloced, or when @@ -117,8 +117,8 @@ and this notice must be preserved on all copies. deal with bsdmalloc's characteristics. But even here, the performance differences are slight. - - This malloc, like any other, is a compromised design. + + This malloc, like any other, is a compromised design. Chunks of memory are maintained using a `boundary tag' method as @@ -135,7 +135,7 @@ and this notice must be preserved on all copies. Available chunks are kept in doubly linked lists. The lists are maintained in an array of bins using a power-of-two method, except that instead of 32 bins (one for each 1 << i), there are 128: each - power of two is split in quarters. The use of very fine bin sizes + power of two is split in quarters. The use of very fine bin sizes closely approximates the use of one bin per actually used size, without necessitating the overhead of locating such bins. It is especially desirable in common C++ applications where large numbers @@ -169,8 +169,8 @@ and this notice must be preserved on all copies. on fronts of lists. All remaindered or consolidated chunks are placed on the rear. Correspondingly, searching within a bin starts at the front, but finding victims is from the back. All - of this approximates the effect of having 2 kinds of lists per - bin: returned chunks vs unallocated chunks, but without the overhead + of this approximates the effect of having 2 kinds of lists per + bin: returned chunks vs unallocated chunks, but without the overhead of maintaining 2 lists.) Deallocation (free) consists only of placing the chunk on @@ -203,14 +203,14 @@ and this notice must be preserved on all copies. The checks are fast enough to be made non-optional. The overwriting of parts of freed memory with the freelist pointers - can also be very effective (albeit in an annoying way) in helping + can also be very effective (albeit in an annoying way) in helping users track down dangling pointers. User overwriting of freed space will often result in crashes within malloc or free. - + These routines are also tuned to C++ in that free(0) is a noop and - a failed malloc automatically calls (*new_handler)(). + a failed malloc automatically calls (*new_handler)(). malloc(0) returns a pointer to something of the minimum allocatable size. @@ -276,7 +276,7 @@ extern void abort(); /* A good multiple to call sbrk with */ -#define SBRK_UNIT 4096 +#define SBRK_UNIT 4096 @@ -334,13 +334,13 @@ typedef struct malloc_bin* mbinptr; static inline unsigned int request2size(unsigned int request) { - return (request == 0) ? MINSIZE : - ((request + MALLOC_MIN_OVERHEAD + MALLOC_ALIGN_MASK) + return (request == 0) ? MINSIZE : + ((request + MALLOC_MIN_OVERHEAD + MALLOC_ALIGN_MASK) & ~(MALLOC_ALIGN_MASK)); } -static inline int aligned_OK(void* m) +static inline int aligned_OK(void* m) { return ((unsigned int)(m) & (MALLOC_ALIGN_MASK)) == 0; } @@ -355,9 +355,9 @@ static inline int aligned_OK(void* m) #define MAXBIN 120 /* 1 more than needed for 32 bit addresses */ -#define FIRSTBIN (&(av[0])) +#define FIRSTBIN (&(av[0])) -static struct malloc_bin av[MAXBIN] = +static struct malloc_bin av[MAXBIN] = { { { 0, &(av[0].hd), &(av[0].hd) }, 0 }, { { 0, &(av[1].hd), &(av[1].hd) }, 0 }, @@ -545,7 +545,7 @@ static void do_free_stats(const mchunkptr p) { ++n_frees; freed_mem += (p->size & ~(INUSE)); -} +} #endif @@ -557,7 +557,7 @@ static void do_free_stats(const mchunkptr p) static unsigned int gcd(unsigned int a, unsigned int b) { unsigned int tmp; - + if (b > a) { tmp = a; a = b; b = tmp; @@ -591,7 +591,7 @@ static inline unsigned int lcm(unsigned int x, unsigned int y) #define set_inuse(p) ((p)->size |= INUSE) #define clear_inuse(b) ((p)->size &= ~INUSE) - + /* operations on malloc_chunk addresses */ @@ -616,18 +616,18 @@ static inline void set_size(mchunkptr p, unsigned int sz) /* conversion from malloc headers to user pointers, and back */ -static inline void* chunk2mem(mchunkptr p) -{ +static inline void* chunk2mem(mchunkptr p) +{ void *mem; set_inuse(p); -mem = (void*)((char*)(p) + SIZE_SZ); +mem = (void*)((char*)(p) + SIZE_SZ); return mem; } /* xxxx my own */ -mchunkptr sanity_check(void* mem) -{ - mchunkptr p = (mchunkptr)((char*)(mem) - SIZE_SZ); +mchunkptr sanity_check(void* mem) +{ + mchunkptr p = (mchunkptr)((char*)(mem) - SIZE_SZ); /* a quick sanity check */ unsigned int sz = p->size & ~(INUSE); @@ -640,9 +640,9 @@ mchunkptr sanity_check(void* mem) -static inline mchunkptr mem2chunk(void* mem) -{ - mchunkptr p = (mchunkptr)((char*)(mem) - SIZE_SZ); +static inline mchunkptr mem2chunk(void* mem) +{ + mchunkptr p = (mchunkptr)((char*)(mem) - SIZE_SZ); /* a quick sanity check */ unsigned int sz = p->size & ~(INUSE); @@ -691,15 +691,15 @@ static inline void split(mchunkptr p, unsigned int offset) mchunkptr h = &(bn->hd); /* its head */ mchunkptr b = h->bk; /* old back element */ mchunkptr t = (mchunkptr)((char*)(p) + offset); /* remaindered chunk */ - + /* set size */ t->size = *((int*)((char*)(t) + room - SIZE_SZ)) = room; /* link up */ t->bk = b; t->fd = h; h->bk = b->fd = t; - + /* adjust maxbin (h == b means was empty) */ - if (h == b && bn > malloc_maxbin) malloc_maxbin = bn; + if (h == b && bn > malloc_maxbin) malloc_maxbin = bn; /* adjust size of chunk to be returned */ p->size = *((int*)((char*)(p) + offset - SIZE_SZ)) = offset; @@ -721,7 +721,7 @@ static inline void consollink(mchunkptr p) p->bk = b; p->fd = h; h->bk = b->fd = p; - if (h == b && bn > malloc_maxbin) malloc_maxbin = bn; + if (h == b && bn > malloc_maxbin) malloc_maxbin = bn; UPDATE_STATS(++n_avail); } @@ -737,7 +737,7 @@ static inline void frontlink(mchunkptr p) p->bk = h; p->fd = f; f->bk = h->fd = p; - if (h == f && bn > malloc_maxbin) malloc_maxbin = bn; + if (h == f && bn > malloc_maxbin) malloc_maxbin = bn; bn->dirty = 1; @@ -770,11 +770,11 @@ static mchunkptr malloc_from_sys(unsigned nb) mchunkptr p; unsigned int sbrk_size; int* ip; - + /* Minimally, we need to pad with enough space */ /* to place dummy size/use fields to ends if needed */ - sbrk_size = ((nb + SBRK_UNIT - 1 + SIZE_SZ + SIZE_SZ) + sbrk_size = ((nb + SBRK_UNIT - 1 + SIZE_SZ + SIZE_SZ) / SBRK_UNIT) * SBRK_UNIT; ip = (int*)(sbrk(sbrk_size)); @@ -789,8 +789,8 @@ static mchunkptr malloc_from_sys(unsigned nb) UPDATE_STATS ((++n_sbrks, sbrked_mem += sbrk_size)); - if (last_sbrk_end != &ip[-1]) - { + if (last_sbrk_end != &ip[-1]) + { /* It's either first time through or someone else called sbrk. */ /* Arrange end-markers at front & back */ @@ -802,14 +802,14 @@ static mchunkptr malloc_from_sys(unsigned nb) /* Note we can get away with only 1 word, not MINSIZE overhead here */ *ip++ = SIZE_SZ | INUSE; - + p = (mchunkptr)ip; - set_size(p,sbrk_size - (SIZE_SZ + SIZE_SZ)); - + set_size(p,sbrk_size - (SIZE_SZ + SIZE_SZ)); + } - else + else { - mchunkptr l; + mchunkptr l; /* We can safely make the header start at end of prev sbrked chunk. */ /* We will still have space left at the end from a previous call */ @@ -822,7 +822,7 @@ static mchunkptr malloc_from_sys(unsigned nb) /* Even better, maybe we can merge with last fragment: */ l = prev_chunk(p); - if (!inuse(l)) + if (!inuse(l)) { unlink(l); set_size(l, p->size + l->size); @@ -861,7 +861,7 @@ static mchunkptr malloc_find_space(unsigned int nb) /* first, re-adjust max used bin */ - while (malloc_maxbin >= FIRSTBIN && + while (malloc_maxbin >= FIRSTBIN && malloc_maxbin->hd.bk == &(malloc_maxbin->hd)) { malloc_maxbin->dirty = 0; @@ -895,7 +895,7 @@ static mchunkptr malloc_find_space(unsigned int nb) p = t; UPDATE_STATS (++n_consol); } - + while (!inuse(t = next_chunk(p))) /* consolidate forward */ { if (!consolidated) { consolidated = 1; unlink(p); } @@ -957,7 +957,7 @@ void* malloc(unsigned int bytes) { mchunkptr nextp = p->fd; /* save, in case of relinks */ int consolidated = 0; /* only unlink/relink if consolidated */ - + mchunkptr t; while (!inuse(t = prev_chunk(p))) /* consolidate backward */ @@ -969,7 +969,7 @@ void* malloc(unsigned int bytes) p = t; UPDATE_STATS (++n_consol); } - + while (!inuse(t = next_chunk(p))) /* consolidate forward */ { if (!consolidated) { consolidated = 1; unlink(p); } @@ -978,7 +978,7 @@ void* malloc(unsigned int bytes) set_size(p, p->size + t->size); UPDATE_STATS (++n_consol); } - + if (consolidated) { if (p->size >= nb) @@ -1017,7 +1017,7 @@ void* malloc(unsigned int bytes) found: /* Use what we found */ unlink(p); - split(p, nb); + split(p, nb); UPDATE_STATS(do_malloc_stats(p)); return chunk2mem(p); } @@ -1049,7 +1049,7 @@ void cfree(void *mem) { free(mem); } - + unsigned int malloc_usable_size(void* mem) { @@ -1057,7 +1057,7 @@ unsigned int malloc_usable_size(void* mem) return 0; else { - mchunkptr p = (mchunkptr)((char*)(mem) - SIZE_SZ); + mchunkptr p = (mchunkptr)((char*)(mem) - SIZE_SZ); unsigned int sz = p->size & ~(INUSE); if (p->size == sz || sz != *((int*)((char*)(p) + sz - SIZE_SZ))) return 0; @@ -1070,7 +1070,7 @@ unsigned int malloc_usable_size(void* mem) void* realloc(void* mem, unsigned int bytes) { - if (mem == 0) + if (mem == 0) return malloc(bytes); else { @@ -1081,7 +1081,7 @@ void* realloc(void* mem, unsigned int bytes) mchunkptr nxt; UPDATE_STATS((++n_reallocs, requested_mem += bytes-oldsize)); - + /* try to expand (even if already big enough), to clean up chunk */ while (!inuse(nxt = next_chunk(p))) @@ -1160,7 +1160,7 @@ void* memalign(unsigned int alignment, unsigned int bytes) /* and we've malloc'd enough total room */ ap = (mchunkptr)( (int)(ap) + align ); - gap += align; + gap += align; } if (gap + nb > p->size) /* can't happen unless chunk sizes corrupted */ @@ -1179,7 +1179,7 @@ void* memalign(unsigned int alignment, unsigned int bytes) /* also give back spare room at the end */ - split(p, nb); + split(p, nb); UPDATE_STATS(do_malloc_stats(p)); return chunk2mem(p); @@ -1196,7 +1196,7 @@ void* valloc(unsigned int bytes) if (malloc_pagesize == 0) malloc_pagesize = getpagesize(); return memalign (malloc_pagesize, bytes); } - + void malloc_stats() { @@ -1216,23 +1216,23 @@ void malloc_stats() if (n_mallocs != 0) fprintf(stderr, "mallocs = %10u total size = %10u\tave = %10u\n", n_mallocs, malloced_mem, malloced_mem/n_mallocs); - + if (n_frees != 0) fprintf(stderr, "frees = %10u total size = %10u\tave = %10u\n", n_frees, freed_mem, freed_mem/n_frees); - + if (n_mallocs-n_frees != 0) fprintf(stderr, "in use = %10u total size = %10u\tave = %10u\n", - n_mallocs-n_frees, malloced_mem-freed_mem, + n_mallocs-n_frees, malloced_mem-freed_mem, (malloced_mem-freed_mem) / (n_mallocs-n_frees)); if (max_inuse != 0) fprintf(stderr, "max in use= %10u total size = %10u\tave = %10u\n", max_inuse, max_used_mem, max_used_mem / max_inuse); - + if (n_avail != 0) fprintf(stderr, "available = %10u total size = %10u\tave = %10u\n", - n_avail, sbrked_mem - (malloced_mem-freed_mem), + n_avail, sbrked_mem - (malloced_mem-freed_mem), (sbrked_mem - (malloced_mem-freed_mem)) / n_avail); if (n_sbrks != 0) @@ -1246,13 +1246,13 @@ void malloc_stats() if (nm != 0) { - fprintf(stderr, "chunks scanned per malloc = %6.3f\n", + fprintf(stderr, "chunks scanned per malloc = %6.3f\n", n_malloc_chunks / nm); - fprintf(stderr, "bins scanned per malloc = %6.3f\n", + fprintf(stderr, "bins scanned per malloc = %6.3f\n", n_malloc_bins / nm); - fprintf(stderr, "splits per malloc = %6.3f\n", + fprintf(stderr, "splits per malloc = %6.3f\n", n_split / nm); - fprintf(stderr, "consolidations per malloc = %6.3f\n", + fprintf(stderr, "consolidations per malloc = %6.3f\n", n_consol / nm); } @@ -1282,7 +1282,7 @@ void malloc_stats() } } #endif /* MALLOC_STATS */ - + #endif /* NO_LIBGXX_MALLOC */ diff --git a/gnu/lib/libregex/test/iregex.c b/gnu/lib/libregex/test/iregex.c index 2346d441fcdb..1ff12b6f069f 100644 --- a/gnu/lib/libregex/test/iregex.c +++ b/gnu/lib/libregex/test/iregex.c @@ -42,7 +42,7 @@ main (argc, argv) /* Some C compilers don't like `char pat[500] = ""'. */ pat[0] = 0; - + printf ("Pattern (%s) = ", pat); gets (pat); scanstring (pat); @@ -71,7 +71,7 @@ main (argc, argv) if (i >= 0) print_regs (regs); putchar ('\n'); - + i = re_search (&buf, str, strlen (str), 0, strlen (str), ®s); printf ("Search value %d.\t", i); if (i >= 0) @@ -144,7 +144,7 @@ print_regs (regs) int i, end; printf ("Registers: "); - + if (regs.num_regs == 0 || regs.start[0] == -1) { printf ("(none)"); diff --git a/gnu/lib/libregex/test/main.c b/gnu/lib/libregex/test/main.c index 28ae31528579..da4536d10f17 100644 --- a/gnu/lib/libregex/test/main.c +++ b/gnu/lib/libregex/test/main.c @@ -20,27 +20,27 @@ main () test_posix_extended (); test_posix_interface (); break; - + case other_test: test_others (); break; - + case posix_basic_test: test_posix_basic (); break; - + case posix_extended_test: test_posix_extended (); break; - + case posix_interface_test: test_posix_interface (); break; - + case regress_test: test_regress (); break; - + default: fprintf (stderr, "Unknown test %d.\n", t); } diff --git a/gnu/lib/libregex/test/other.c b/gnu/lib/libregex/test/other.c index d2ceb3844883..1023fc659e34 100644 --- a/gnu/lib/libregex/test/other.c +++ b/gnu/lib/libregex/test/other.c @@ -6,7 +6,7 @@ void test_others () { struct re_registers regs; - + printf ("\nStarting non-POSIX tests.\n"); t = other_test; @@ -19,17 +19,17 @@ test_others () TEST_REGISTERS ("(a*)*ab", "ab", 0, 2, 0, 0, -1, -1); test_match ("(a*)*", ""); TEST_REGISTERS ("(a*)*ab", "ab", 0, 0, 0, 0, -1, -1); - + /* This tests finding the highest and lowest active registers. */ test_match ("(a(b)c(d(e)f)g)h(i(j)k(l(m)n)o)\\1\\2\\3\\4\\5\\6\\7\\8", "abcdefghijklmnoabcdefgbdefeijklmnojlmnm"); /* Test that \< and \> match at the beginning and end of the string. */ test_match ("\\<abc\\>", "abc"); - + /* May as well test \` and \' while we're at it. */ test_match ("\\`abc\\'", "abc"); - + #if 0 /* Test backreferencing and the fastmap -- which doesn't work. */ test_fastmap ("(a)*\\1", "a", 0, 0); @@ -37,9 +37,9 @@ test_others () /* But at least we shouldn't search improperly. */ test_search_return (-1, "(a)\\1", ""); - + re_set_syntax (RE_SYNTAX_EMACS); - + MATCH_SELF("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); MATCH_SELF ("a^"); MATCH_SELF ("a^b"); @@ -70,7 +70,7 @@ test_others () test_match ("a|{1}", "a"); test_match ("a|{1}", "{1}"); test_match ("({1})", "{1}"); - + test_match ("\\{", "{"); @@ -94,7 +94,7 @@ test_others () /* Test grouping. */ re_set_syntax (RE_NO_BK_PARENS); - + test_match ("()", ""); test_fastmap ("()", "", 0, 0); TEST_REGISTERS ("()", "", 0, 0, 0, 0, -1, -1); @@ -106,22 +106,22 @@ test_others () test_match ("(((((((((())))))))))", ""); test_fastmap ("(((((((((())))))))))", "", 0, 0); - + test_match ("()*", ""); TEST_REGISTERS ("()*", "", 0, 0, 0, 0, -1, -1); /* empty string */ test_match ("(())*", ""); re_set_syntax (RE_CONTEXT_INDEP_OPS); test_match ("*", ""); - + re_set_syntax (RE_INTERVALS | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES); test_match ("{1}", ""); /* Should remain an interval. */ MATCH_SELF ("{1"); /* Not a valid interval. */ - + re_set_syntax (RE_NEWLINE_ALT); test_match ("a\nb", "a"); test_match ("a\nb", "b"); - + re_set_syntax (RE_NO_BK_VBAR | RE_NO_BK_PARENS); test_match ("^a", "a"); test_match ("(^a)", "a"); @@ -129,11 +129,11 @@ test_others () test_match ("a$", "a"); test_match ("(a$)", "a"); test_match ("a$|b", "a"); - + /* You should be able to have empty alternatives if RE_NO_EMPTY_ALTS isn't set. */ re_set_syntax (RE_NO_BK_VBAR | RE_NO_BK_PARENS); - + test_match ("|", ""); test_match ("^|a", ""); test_match ("^|a", "a"); @@ -293,8 +293,8 @@ test_others () test_case_fold ("[!-`]", "A"); test_case_fold ("[!-`]", "a"); - - re_set_syntax (RE_CONTEXT_INDEP_OPS | RE_NO_BK_VBAR | RE_NO_BK_PARENS + + re_set_syntax (RE_CONTEXT_INDEP_OPS | RE_NO_BK_VBAR | RE_NO_BK_PARENS | RE_NO_BK_BRACES | RE_INTERVALS); valid_nonposix_pattern ("()^a"); valid_nonposix_pattern ("()\\1^a"); @@ -319,24 +319,24 @@ test_others () TEST_SEARCH ("^(^a)", "ab", 0, 2); TEST_SEARCH ("(a$)$", "ba", 0, 2); test_match ("a|$b", "$b"); - + /* Mike's curiosity item. */ re_set_syntax (RE_NO_BK_VBAR | RE_NO_BK_PARENS); test_all_registers ("(foo|foobar)(foo|bar)*\\1(foo|bar)*", "foobarfoobar", "", - 0, 12, 0, 3, 3, 6, 9, 12, -1, -1, -1, -1, -1, -1, -1, -1, + 0, 12, 0, 3, 3, 6, 9, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); /* Another one from Mike. */ test_match ("(foo|foobarfoo)(bar)*", "foobarfoo"); - + /* And another. */ test_match("(foo|foobar)(bar|barfoo)?\\1", "foobarfoobar"); - + re_set_syntax (RE_NO_BK_PARENS | RE_INTERVALS | RE_NO_BK_VBAR | RE_NO_BK_BRACES); /* xx get new ones from ext.*/ test_match ("((a{0,}{0,0}()\\3\\b\\B\\<\\>\\`\\')|b)*", "bb"); - test_all_registers ("((a{0,}{0,0}()\\3\\b\\B\\<\\>\\`\\')|b)*", "", "bb", + test_all_registers ("((a{0,}{0,0}()\\3\\b\\B\\<\\>\\`\\')|b)*", "", "bb", 0, 2, 1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); @@ -349,11 +349,11 @@ test_others () /* See generic_test.c and extended_test.c for more search tests. xx Not sure all these tests are represented in the search tests. */ - + re_set_syntax (RE_NO_BK_PARENS | RE_NO_BK_VBAR); - valid_nonposix_pattern + valid_nonposix_pattern ("(((((((((((((((((((((((((((((((((^a)))))))))))))))))))))))))))))))))"); - valid_nonposix_pattern + valid_nonposix_pattern ("(((((((((((((((((((((((((((((((((a$)))))))))))))))))))))))))))))))))"); valid_nonposix_pattern ("\\b\\B\\<\\>\\`\\'^a"); valid_nonposix_pattern ("a$\\b\\B\\<\\>\\`\\'"); @@ -413,7 +413,7 @@ test_others () RE_CONTEXT_INDEP_OPS. */ re_set_syntax (RE_CONTEXT_INDEP_OPS | RE_CONTEXT_INVALID_OPS - | RE_NO_BK_VBAR | RE_NO_BK_PARENS + | RE_NO_BK_VBAR | RE_NO_BK_PARENS | RE_NO_BK_BRACES | RE_INTERVALS); INVALID_PATTERN ("*"); INVALID_PATTERN ("^*"); @@ -440,9 +440,9 @@ test_others () are undefined as of draft 11.2. */ /* You can't have empty alternatives if RE_NO_EMPTY_ALTS is set. */ - + re_set_syntax (RE_NO_BK_VBAR | RE_NO_BK_PARENS | RE_NO_EMPTY_ALTS); - + INVALID_PATTERN ("|"); INVALID_PATTERN ("^|a"); INVALID_PATTERN ("a|"); @@ -463,7 +463,7 @@ test_others () #endif /* Test grouping. */ - test_match ("()", "a"); + test_match ("()", "a"); /* Test backslashed intervals that are CONTEXTly invalid if have nothing on which to operate. */ @@ -476,13 +476,13 @@ test_others () re_set_syntax (RE_BK_PLUS_QM); INVALID_PATTERN ("a*\\"); - + re_set_syntax (0); INVALID_PATTERN ("a*\\"); - + re_set_syntax (RE_BACKSLASH_ESCAPE_IN_LISTS); INVALID_PATTERN ("[\\"); - + #if 0 /* Empty groups are always ok now. (13 Sep 92) */ re_set_syntax (RE_NO_BK_VBAR | RE_NO_BK_PARENS | RE_NO_EMPTY_GROUPS); diff --git a/gnu/lib/libregex/test/psx-basic.c b/gnu/lib/libregex/test/psx-basic.c index 52535b6b3076..487c60432853 100644 --- a/gnu/lib/libregex/test/psx-basic.c +++ b/gnu/lib/libregex/test/psx-basic.c @@ -9,18 +9,18 @@ test_posix_basic () /* Intervals can only match up to RE_DUP_MAX occurences of anything. */ char dup_max_plus_one[6]; sprintf (dup_max_plus_one, "%d", RE_DUP_MAX + 1); - + printf ("\nStarting POSIX basic tests.\n"); t = posix_basic_test; - re_set_syntax (RE_SYNTAX_POSIX_MINIMAL_BASIC); - + re_set_syntax (RE_SYNTAX_POSIX_MINIMAL_BASIC); + test_posix_generic (); printf ("\nContinuing POSIX basic tests.\n"); /* Grouping tests that are not the same. */ - + test_should_match = false; invalid_pattern (REG_EPAREN, PARENS_TO_OPS ("a)")); @@ -31,7 +31,7 @@ test_posix_basic () test_match ("\\(^*\\)", "*"); test_match ("**", "***"); test_match ("***", "****"); - + MATCH_SELF ("{"); /* of extended... */ MATCH_SELF ("()"); /* also non-Posix. */ MATCH_SELF ("a+"); @@ -82,67 +82,67 @@ test_posix_basic () test_match ("\\(a\\)*\\1", "aa"); TEST_REGISTERS ("\\(a\\)*\\1", "aa", 0, 2, 0, 1, -1, -1); TEST_REGISTERS ("\\(a\\)*\\1", "xaax", 0, 0, -1, -1, -1, -1); - + test_match ("\\(\\(a\\)\\2b\\)*", "aab"); TEST_REGISTERS ("\\(\\(a\\)\\2b\\)*", "aab", 0, 3, 0, 3, 0, 1); TEST_REGISTERS ("\\(\\(a\\)\\2b\\)*", "xaabx", 0, 0, -1, -1, -1, -1); - + test_match ("\\(a*\\)*\\1", ""); test_match ("\\(a*\\)*\\1", "aa"); TEST_REGISTERS ("\\(a*\\)*\\1", "aa", 0, 2, 0, 1, -1, -1); TEST_REGISTERS ("\\(a*\\)*\\1", "xaax", 0, 0, 0, 0, -1, -1); - - test_match ("\\(a*\\)*\\1", ""); - test_match ("\\(a*\\)*\\1", "aa"); - test_match ("\\(\\(a*\\)*\\)*\\1", "aa"); + + test_match ("\\(a*\\)*\\1", ""); + test_match ("\\(a*\\)*\\1", "aa"); + test_match ("\\(\\(a*\\)*\\)*\\1", "aa"); test_match ("\\(ab*\\)*\\1", "abab"); TEST_REGISTERS ("\\(ab*\\)*\\1", "abab", 0, 4, 0, 2, -1, -1); TEST_REGISTERS ("\\(ab*\\)*\\1", "xababx", 0, 0, -1, -1, -1, -1); - test_match ("\\(a*\\)ab\\1", "aaba"); - TEST_REGISTERS ("\\(a*\\)ab\\1", "aaba", 0, 4, 0, 1, -1, -1); - TEST_REGISTERS ("\\(a*\\)ab\\1", "xaabax", 1, 5, 1, 2, -1, -1); + test_match ("\\(a*\\)ab\\1", "aaba"); + TEST_REGISTERS ("\\(a*\\)ab\\1", "aaba", 0, 4, 0, 1, -1, -1); + TEST_REGISTERS ("\\(a*\\)ab\\1", "xaabax", 1, 5, 1, 2, -1, -1); - test_match ("\\(a*\\)*ab\\1", "aaba"); - TEST_REGISTERS ("\\(a*\\)*ab\\1", "aaba", 0, 4, 0, 1, -1, -1); - TEST_REGISTERS ("\\(a*\\)*ab\\1", "xaabax", 1, 5, 1, 2, -1, -1); + test_match ("\\(a*\\)*ab\\1", "aaba"); + TEST_REGISTERS ("\\(a*\\)*ab\\1", "aaba", 0, 4, 0, 1, -1, -1); + TEST_REGISTERS ("\\(a*\\)*ab\\1", "xaabax", 1, 5, 1, 2, -1, -1); - test_match ("\\(\\(a*\\)b\\)*\\2", "abb"); + test_match ("\\(\\(a*\\)b\\)*\\2", "abb"); TEST_REGISTERS ("\\(\\(a*\\)b\\)*\\2", "abb", 0, 3, 2, 3, 2, 2); - TEST_REGISTERS ("\\(\\(a*\\)b\\)*\\2", "xabbx", 0, 0, -1, -1, -1, -1); + TEST_REGISTERS ("\\(\\(a*\\)b\\)*\\2", "xabbx", 0, 0, -1, -1, -1, -1); /* Different from above. */ - test_match ("\\(\\(a*\\)b*\\)*\\2", "aa"); + test_match ("\\(\\(a*\\)b*\\)*\\2", "aa"); TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "aa", 0, 2, 0, 1, 0, 1); - TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "xaax", 0, 0, 0, 0, 0, 0); + TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "xaax", 0, 0, 0, 0, 0, 0); - test_match ("\\(\\(a*\\)b*\\)*\\2", "aba"); + test_match ("\\(\\(a*\\)b*\\)*\\2", "aba"); TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "aba", 0, 3, 0, 2, 0, 1); - TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "xabax", 0, 0, 0, 0, 0, 0); + TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "xabax", 0, 0, 0, 0, 0, 0); test_match ("\\(\\(a*\\)b\\)*\\2", "aababa"); - TEST_REGISTERS ("\\(\\(a*\\)b\\)*\\2", "aababa", 0, 6, 3, 5, 3, 4); - TEST_REGISTERS ("\\(\\(a*\\)b\\)*\\2", "xaababax", 0, 0, -1, -1, -1, -1); + TEST_REGISTERS ("\\(\\(a*\\)b\\)*\\2", "aababa", 0, 6, 3, 5, 3, 4); + TEST_REGISTERS ("\\(\\(a*\\)b\\)*\\2", "xaababax", 0, 0, -1, -1, -1, -1); - test_match ("\\(\\(a*\\)b*\\)*\\2", "aabaa"); + test_match ("\\(\\(a*\\)b*\\)*\\2", "aabaa"); TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "aabaa", 0, 5, 0, 3, 0, 2); - TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "xaabaax", 0, 0, 0, 0, 0, 0); + TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "xaabaax", 0, 0, 0, 0, 0, 0); - test_match ("\\(\\(a*\\)b*\\)*\\2", "aabbaa"); + test_match ("\\(\\(a*\\)b*\\)*\\2", "aabbaa"); TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "aabbaa", 0, 6, 0, 4, 0, 2); - TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "xaabbaax", 0, 0, 0, 0, 0, 0); + TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "xaabbaax", 0, 0, 0, 0, 0, 0); - test_match ("\\(\\(a*\\)b*\\)*\\2", "abaabaa"); + test_match ("\\(\\(a*\\)b*\\)*\\2", "abaabaa"); TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "abaabaa", 0, 7, 2, 5, 2, 4); - TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "xaababaax", 0, 0, 0, 0, 0, 0); + TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2", "xaababaax", 0, 0, 0, 0, 0, 0); - test_match ("\\(\\(a*\\)b*\\)*a\\2", "aabaaa"); + test_match ("\\(\\(a*\\)b*\\)*a\\2", "aabaaa"); TEST_REGISTERS ("\\(\\(a*\\)b*a\\)*\\2", "aabaaa", 0, 6, 0, 3, 0, 2); - TEST_REGISTERS ("\\(\\(a*\\)b*a\\)*\\2", "xaabaax", 0, 0, -1, -1, -1, -1); + TEST_REGISTERS ("\\(\\(a*\\)b*a\\)*\\2", "xaabaax", 0, 0, -1, -1, -1, -1); - test_match ("\\(\\(a*\\)b*\\)*\\2a", "aabaaa"); + test_match ("\\(\\(a*\\)b*\\)*\\2a", "aabaaa"); TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2a", "aabaaa", 0, 6, 0, 3, 0, 2); - TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2a", "xaabaaax", 1, 7, 1, 4, 1, 3); + TEST_REGISTERS ("\\(\\(a*\\)b*\\)*\\2a", "xaabaaax", 1, 7, 1, 4, 1, 3); test_match ("\\(\\(a*\\)b\\)*\\2\\1", "abaabaaaab"); TEST_REGISTERS ("\\(\\(a*\\)b\\)*\\2\\1", "abaabaaaab", 0, 10, 2, 5, 2, 4); @@ -152,7 +152,7 @@ test_posix_basic () test_match ("\\(a*b\\)\\1", "abab"); test_match ("\\(a\\)\\1\\1", "aaa"); test_match ("\\(a\\(c\\)d\\)\\1\\2", "acdacdc"); - + test_match ("\\(a\\)\\1*", "aaa"); TEST_REGISTERS ("\\(a\\)\\1*", "aaa", 0, 3, 0, 1, -1, -1); TEST_REGISTERS ("\\(a\\)\\1*", "xaaax", 1, 4, 1, 2, -1, -1); @@ -186,15 +186,15 @@ test_posix_basic () /* Per POSIX D11.1, p. 125, leftmost longest match. */ - + test_match (PARENS_TO_OPS ("(ac*)c*d[ac]*\\1"), "acdacaaa"); - TEST_REGISTERS (PARENS_TO_OPS ("(ac*)c*d[ac]*\\1"), "acdacaaa", + TEST_REGISTERS (PARENS_TO_OPS ("(ac*)c*d[ac]*\\1"), "acdacaaa", 0, 8, 0, 1, -1, -1); /* Anchors become ordinary, sometimes. */ MATCH_SELF ("a^"); - MATCH_SELF ("$a"); - MATCH_SELF ("$^"); + MATCH_SELF ("$a"); + MATCH_SELF ("$^"); test_fastmap ("$a^", "$", 0, 0); test_match ("$^*", "$^^"); test_match ("\\($^\\)", "$^"); diff --git a/gnu/lib/libregex/test/psx-extend.c b/gnu/lib/libregex/test/psx-extend.c index 6f02d67b8219..14b8a5e217c1 100644 --- a/gnu/lib/libregex/test/psx-extend.c +++ b/gnu/lib/libregex/test/psx-extend.c @@ -13,15 +13,15 @@ test_posix_extended () printf ("\nStarting POSIX extended tests.\n"); t = posix_extended_test; - - re_set_syntax (RE_SYNTAX_POSIX_MINIMAL_EXTENDED); + + re_set_syntax (RE_SYNTAX_POSIX_MINIMAL_EXTENDED); test_posix_generic (); printf ("\nContinuing POSIX extended tests.\n"); /* Grouping tests that differ from basic's. */ - + test_should_match = true; MATCH_SELF ("a)"); @@ -74,8 +74,8 @@ test_posix_extended () MATCH_SELF ("a{}"); MATCH_SELF ("a{-1"); MATCH_SELF ("a{-1}"); - MATCH_SELF ("a{0"); - MATCH_SELF ("a{0,"); + MATCH_SELF ("a{0"); + MATCH_SELF ("a{0,"); MATCH_SELF (concat ("a{", dup_max_plus_one)); MATCH_SELF (concat (concat ("a{", dup_max_plus_one), ",")); MATCH_SELF ("a{1,0"); @@ -83,7 +83,7 @@ test_posix_extended () MATCH_SELF ("a{0,1"); test_match ("[a{0,1}]", "}"); test_match ("a{1,3}{-1}", "aaa{-1}"); - test_match (concat ("a{1,3}{", dup_max_plus_one), + test_match (concat ("a{1,3}{", dup_max_plus_one), concat ("aaa{", dup_max_plus_one)); test_match ("a{1,3}{2,1}", "aaa{2,1}"); test_match ("a{1,3}{1,2", "aaa{1,2"); @@ -96,7 +96,7 @@ test_posix_extended () test_match ("a??", "a"); test_match ("a?*", "a"); test_match ("a?+", "a"); - + test_match ("a{2}?", ""); test_match ("a{2}?", "aa"); test_match ("a{2}+", "aa"); @@ -104,21 +104,21 @@ test_posix_extended () test_match ("a{1}?*", ""); test_match ("a{1}?*", "aa"); - - test_match ("(a?){0,3}b", "aaab"); - test_fastmap ("(a?){0,3}b", "ab", 0, 0); - test_match ("(a+){0,3}b", "b"); - test_fastmap ("(a+){0,3}b", "ab", 0, 0); + + test_match ("(a?){0,3}b", "aaab"); + test_fastmap ("(a?){0,3}b", "ab", 0, 0); + test_match ("(a+){0,3}b", "b"); + test_fastmap ("(a+){0,3}b", "ab", 0, 0); test_match ("(a+){0,3}b", "ab"); - test_fastmap ("(a+){0,3}b", "ab", 0, 0); - test_match ("(a+){1,3}b", "aaab"); + test_fastmap ("(a+){0,3}b", "ab", 0, 0); + test_match ("(a+){1,3}b", "aaab"); test_match ("(a?){1,3}b", "aaab"); test_match ("\\\\{1}", "\\"); /* Extended only. */ test_match ("(a?)?", "a"); test_match ("(a?b)?c", "abc"); - test_match ("(a+)*b", "b"); + test_match ("(a+)*b", "b"); /* Alternatives. */ test_match ("a|b", "a"); test_match ("a|b", "b"); @@ -132,7 +132,7 @@ test_posix_extended () test_match ("(a|b|c)", "c"); test_match ("(a|b|c)*", "abccba"); - + test_match ("(a(b*))|c", "a"); /* xx do registers. */ test_match ("(a(b*))|c", "ab"); test_match ("(a(b*))|c", "c"); @@ -140,7 +140,7 @@ test_posix_extended () test_fastmap ("(a+?*|b)", "ab", 0, 0); test_match ("(a+?*|b)", "b"); TEST_REGISTERS ("(a+?*|b)", "b", 0, 1, 0, 1, -1, -1); - + test_fastmap ("(a+?*|b)*", "ab", 0, 0); test_match ("(a+?*|b)*", "bb"); TEST_REGISTERS ("(a+?*|b)*", "bb", 0, 2, 1, 2, -1, -1); @@ -165,7 +165,7 @@ test_posix_extended () test_fastmap ("(a+?*|b)c", "abc", 0, 0); test_match ("(a+?*|b)c", "bc"); TEST_REGISTERS ("(a+?*|b)c", "bc", 0, 2, 0, 1, -1, -1); - + test_fastmap ("(a+?*|b)*c", "abc", 0, 0); test_match ("(a+?*|b)*c", "bbc"); TEST_REGISTERS ("(a+?*|b)*c", "bbc", 0, 3, 1, 2, -1, -1); @@ -189,12 +189,12 @@ test_posix_extended () test_fastmap ("((a{0,}\\b\\<)|b)", "ab", 0, 0); test_match ("((a{0,}\\b\\<)|b)", "b"); - TEST_REGISTERS ("((a{0,}\\b\\<)|b)", "b", + TEST_REGISTERS ("((a{0,}\\b\\<)|b)", "b", 0, 1, 0, 1, 0, 0); test_fastmap ("((a{0,}\\b\\<)|b)*", "ab", 0, 0); test_match ("((a{0,}\\b\\<)|b)*", "b"); - TEST_REGISTERS ("((a{0,}\\b\\<)|b)*", "b", + TEST_REGISTERS ("((a{0,}\\b\\<)|b)*", "b", 0, 1, 0, 1, 0, 0); test_fastmap ("((a+?*{0,1}\\b\\<)|b)", "ab", 0, 0); @@ -251,7 +251,7 @@ test_posix_extended () /* `*' after group. */ - test_match ("(a*|b*)*c", "c"); + test_match ("(a*|b*)*c", "c"); TEST_REGISTERS ("(a*|b*)*c", "c", 0, 1, 0, 0, -1, -1); test_match ("(a*|b*)*c", "ac"); @@ -279,8 +279,8 @@ test_posix_extended () test_match ("(a*|b*)c", "aac"); TEST_REGISTERS ("(a*|b*)c", "aac", 0, 3, 0, 2, -1, -1); - /* Same as above, but with no `*'s in alternatives. - + /* Same as above, but with no `*'s in alternatives. + test_match ("(a|b)*c", "c"); /* `*' after group. */ TEST_REGISTERS ("(a|b)*c", "c", 0, 1, -1, -1, -1, -1); @@ -298,7 +298,7 @@ test_posix_extended () TEST_REGISTERS ("(a*|b*)c", "bbc", 0, 3, 0, 2, -1, -1); /* Complicated second alternative. */ - + test_match ("(a*|(b*)*)*c", "bc"); TEST_REGISTERS ("(a*|(b*)*)*c", "bc", 0, 2, 0, 1, 0, 1); @@ -335,9 +335,9 @@ test_posix_extended () valid_pattern ("(^$)"); /* These are the same (but valid) as those (invalid) in other_test.c. */ - valid_pattern + valid_pattern ("(((((((((((((((((((((((((((((((((a^)))))))))))))))))))))))))))))))))"); - valid_pattern + valid_pattern ("((((((((((((((((((((((((((((((((($a)))))))))))))))))))))))))))))))))"); valid_pattern ("\\(^a\\)"); valid_pattern ("a\\|^b"); @@ -724,7 +724,7 @@ test_posix_extended () valid_pattern ("(^a)(b|^c)|^d"); valid_pattern ("(^a)(b|c^)|^d"); valid_pattern ("(^a)(b|c)^|^d"); - + valid_pattern ("(a)(b$|c$)d$"); valid_pattern ("(a)(b|$c)$|d$"); valid_pattern ("(a)($b|c)$|d$"); @@ -1003,11 +1003,11 @@ test_posix_extended () TEST_SEARCH ("^(a)(b|c)|^d", "abe", 0, 3); TEST_SEARCH ("^(a)(b|c)|^d", "ace", 0, 3); TEST_SEARCH ("^(a)(b|c)|^d", "df", 0, 2); - + TEST_SEARCH ("(^a)(b|c)|^d", "abe", 0, 3); TEST_SEARCH ("(^a)(b|c)|^d", "ace", 0, 3); TEST_SEARCH ("(^a)(b|c)|^d", "df", 0, 2); - + TEST_SEARCH ("(a)(b|c)$|d$", "fab", 0, 3); TEST_SEARCH ("(a)(b|c)$|d$", "fac", 0, 3); TEST_SEARCH ("(a)(b|c)$|d$", "fd", 0, 2); @@ -1027,11 +1027,11 @@ test_posix_extended () TEST_SEARCH ("^d|^(b|c)(a)", "df", 0, 2); TEST_SEARCH ("^d|^(b|c)(a)", "baf", 0, 3); TEST_SEARCH ("^d|^(b|c)(a)", "caf", 0, 3); - + TEST_SEARCH ("^d|(^b|^c)(a)", "df", 0, 2); TEST_SEARCH ("^d|(^b|^c)(a)", "baf", 0, 3); TEST_SEARCH ("^d|(^b|^c)(a)", "caf", 0, 3); - + TEST_SEARCH ("d$|(b|c)(a$)", "fd", 0, 2); TEST_SEARCH ("d$|(b|c)(a$)", "fba", 0, 3); TEST_SEARCH ("d$|(b|c)(a$)", "fca", 0, 3); @@ -1112,13 +1112,13 @@ test_posix_extended () test_match ("(fooq|foo)(qbarx|bar)", "fooqbarx"); /* Take first alternative that does the longest match. */ - test_all_registers ("(fooq|(foo)|(fo))((qbarx)|(oqbarx)|bar)", "fooqbarx", - "", 0, 8, 0, 3, 0, 3, -1, -1, 3, 8, 3, 8, -1, -1, -1, -1, -1, -1, + test_all_registers ("(fooq|(foo)|(fo))((qbarx)|(oqbarx)|bar)", "fooqbarx", + "", 0, 8, 0, 3, 0, 3, -1, -1, 3, 8, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1); test_match ("(fooq|foo)*qbar", "fooqbar"); test_match ("(fooq|foo)*(qbar)", "fooqbar"); - test_match ("(fooq|foo)*(qbar)*", "fooqbar"); + test_match ("(fooq|foo)*(qbar)*", "fooqbar"); test_match ("(fooq|fo|o)*qbar", "fooqbar"); test_match ("(fooq|fo|o)*(qbar)", "fooqbar"); diff --git a/gnu/lib/libregex/test/psx-generic.c b/gnu/lib/libregex/test/psx-generic.c index 340e93875515..8e97f75b1037 100644 --- a/gnu/lib/libregex/test/psx-generic.c +++ b/gnu/lib/libregex/test/psx-generic.c @@ -12,7 +12,7 @@ test_posix_generic () if (omit_generic_tests) return; /* Tests somewhat in the order of P1003.2. */ - + /* Both posix basic and extended; should match. */ printf ("\nStarting generic POSIX tests.\n"); @@ -29,12 +29,12 @@ test_posix_generic () TEST_REGISTERS ("", "", 0, 0, -1, -1, -1, -1); TEST_SEARCH ("", "", 0, 0); TEST_SEARCH_2 ("", "", "", 0, 1, 0); - - MATCH_SELF ("abc"); - test_fastmap ("abc", "a", 0, 0); + + MATCH_SELF ("abc"); + test_fastmap ("abc", "a", 0, 0); TEST_REGISTERS ("abc", "abc", 0, 3, -1, -1, -1, -1); TEST_REGISTERS ("abc", "xabcx", 1, 4, -1, -1, -1, -1); - + test_match ("\\a","a"); test_match ("\\0", "0"); @@ -44,7 +44,7 @@ test_posix_generic () TEST_SEARCH_2 ("a", "a", "b", 0, 2, 2); TEST_SEARCH_2 ("b", "a", "b", 0, 2, 2); TEST_SEARCH_2 ("a", "a", "b", 1, -2, 2); - + test_match ("\n", "\n"); test_match ("a\n", "a\n"); test_match ("\nb", "\nb"); @@ -55,8 +55,8 @@ test_posix_generic () test_match ("a*", "aa"); test_fastmap ("a*", "a", 0, 0); TEST_REGISTERS ("a*", "aa", 0, 2, -1, -1, -1, -1); - - test_match ("a*b", "aab"); + + test_match ("a*b", "aab"); test_fastmap ("a*b", "ab", 0, 0); test_match ("a*ab", "aab"); @@ -80,9 +80,9 @@ test_posix_generic () test_match (".", "a"); TEST_REGISTERS (".", "a", 0, 1, -1, -1, -1, -1); test_match (".", "\004"); - test_match (".", "\n"); + test_match (".", "\n"); /* Valid bracket expressions. */ - test_match ("[ab]", "a"); + test_match ("[ab]", "a"); test_match ("[ab]", "b"); test_fastmap ("[ab]", "ab", 0, 0); TEST_REGISTERS ("[ab]", "a", 0, 1, -1, -1, -1, -1); @@ -92,7 +92,7 @@ test_posix_generic () test_match ("[^ab]", "c"); test_match ("[^a]", "\n"); - test_match ("[a]*a", "aa"); + test_match ("[a]*a", "aa"); test_match ("[[]", "["); test_match ("[]]", "]"); @@ -115,12 +115,12 @@ test_posix_generic () /* Collating, noncollating, equivalence classes aren't - implemented yet. */ - + implemented yet. */ + /* Character classes. */ - test_match ("[:alpha:]", "p"); - test_match ("[[:alpha:]]", "a"); + test_match ("[:alpha:]", "p"); + test_match ("[[:alpha:]]", "a"); test_match ("[[:alpha:]]", "z"); test_match ("[[:alpha:]]", "A"); test_match ("[[:alpha:]]", "Z"); @@ -172,10 +172,10 @@ test_posix_generic () test_match ("[a-]", "-"); /* Last */ test_match ("[a-]", "a"); test_match ("[--@]", "@"); /* First and starting point. */ - + test_match ("[%--a]", "%"); /* Ending point. */ test_match ("[%--a]", "-"); /* Ditto. */ - + test_match ("[a%--]", "%"); /* Both ending point and last. */ test_match ("[a%--]", "-"); test_match ("[%--a]", "a"); /* Ending point only. */ @@ -186,29 +186,29 @@ test_posix_generic () test_match ("[)-+--/]", "/"); test_match ("[[:digit:]-]", "-"); /* Concatenation ????*/ - test_match ("[ab][cd]", "ac"); + test_match ("[ab][cd]", "ac"); test_fastmap ("[ab][cd]", "ab", 0, 0); TEST_REGISTERS ("[ab][cd]", "ad", 0, 2, -1, -1, -1, -1); TEST_REGISTERS ("[ab][cd]", "xadx", 1, 3, -1, -1, -1, -1); - + /* Valid expression anchoring. */ test_match ("^a", "a"); test_fastmap ("^a", "a", 0, 0); TEST_REGISTERS ("^a", "ax", 0, 1, -1, -1, -1, -1); - + test_match ("^", ""); TEST_REGISTERS ("^", "", 0, 0, -1, -1, -1, -1); test_match ("$", ""); TEST_REGISTERS ("$", "", 0, 0, -1, -1, -1, -1); - + test_match ("a$", "a"); test_fastmap ("a$", "a", 0, 0); TEST_REGISTERS ("a$", "xa", 1, 2, -1, -1, -1, -1); - + test_match ("^ab$", "ab"); test_fastmap ("^ab$", "a", 0, 0); TEST_REGISTERS ("^a$", "a", 0, 1, -1, -1, -1, -1); - + test_fastmap ("^$", "", 0, 0); test_match ("^$", ""); TEST_REGISTERS ("^$", "", 0, 0, -1, -1, -1, -1); @@ -221,7 +221,7 @@ test_posix_generic () /* Two strings. */ test_match_2 ("ab", "a", "b"); TEST_REGISTERS_2 ("ab", "a", "b", 0, 2, -1, -1, -1, -1); - + test_match_2 ("a", "", "a"); test_match_2 ("a", "a", ""); test_match_2 ("ab", "a", "b"); @@ -235,8 +235,8 @@ test_posix_generic () test_should_match = false; /* Ordinary characters. */ - test_match ("abc", "ab"); - + test_match ("abc", "ab"); + TEST_SEARCH ("c", "ab", 0, 2); TEST_SEARCH ("c", "ab", 0, 2); TEST_SEARCH ("c", "ab", 1, -2); @@ -257,8 +257,8 @@ test_posix_generic () /* Invalid period. */ test_match (".", ""); /* Invalid bracket expressions. */ - test_match ("[ab]", "c"); - test_match ("[^b]", "b"); + test_match ("[ab]", "c"); + test_match ("[^b]", "b"); test_match ("[^]]", "]"); invalid_pattern (REG_EBRACK, "["); @@ -267,7 +267,7 @@ test_posix_generic () invalid_pattern (REG_EBRACK, "[]"); invalid_pattern (REG_EBRACK, "[]a"); invalid_pattern (REG_EBRACK, "a[]a"); - + test_match ("[:alpha:]", "q"); /* Character classes. */ test_match ("[[:alpha:]]", "2"); @@ -288,10 +288,10 @@ test_posix_generic () invalid_pattern (REG_ECTYPE, "[[:a:]]"); invalid_pattern (REG_ECTYPE, "[[:alpo:]]"); invalid_pattern (REG_ECTYPE, "[[:a:]"); - + test_match ("[a-z]", "2"); /* Invalid ranges. */ - test_match ("[^-a]", "-"); - test_match ("[^a-]", "-"); + test_match ("[^-a]", "-"); + test_match ("[^a-]", "-"); test_match ("[)-+--/]", "."); invalid_pattern (REG_ERANGE, "[z-a]"); /* Empty */ invalid_pattern (REG_ERANGE, "[a--]"); /* Empty */ diff --git a/gnu/lib/libregex/test/psx-interf.c b/gnu/lib/libregex/test/psx-interf.c index 8312d5e7d74a..80498fbe530c 100644 --- a/gnu/lib/libregex/test/psx-interf.c +++ b/gnu/lib/libregex/test/psx-interf.c @@ -7,7 +7,7 @@ #define ERROR_CODE_LENGTH 20 #define TEST_ERRBUF_SIZE 15 - + void test_compile (); @@ -64,50 +64,50 @@ init_pattern_buffer (pattern_buffer_ptr) void -test_compile (valid_pattern, error_code_expected, pattern, +test_compile (valid_pattern, error_code_expected, pattern, pattern_buffer_ptr, cflags) unsigned valid_pattern; int error_code_expected; const char *pattern; regex_t *pattern_buffer_ptr; int cflags; -{ +{ int error_code_returned; boolean error = false; char errbuf[TEST_ERRBUF_SIZE]; - + init_pattern_buffer (pattern_buffer_ptr); error_code_returned = regcomp (pattern_buffer_ptr, pattern, cflags); if (valid_pattern && error_code_returned) { printf ("\nShould have been a valid pattern but wasn't.\n"); - regerror (error_code_returned, pattern_buffer_ptr, errbuf, + regerror (error_code_returned, pattern_buffer_ptr, errbuf, TEST_ERRBUF_SIZE); printf ("%s", errbuf); error = true; } - + if (!valid_pattern && !error_code_returned) { printf ("\n\nInvalid pattern compiled as valid:\n"); error = true; } - + if (error_code_returned != error_code_expected) { char expected_error_string[ERROR_CODE_LENGTH]; char returned_error_string[ERROR_CODE_LENGTH]; - - get_error_string (error_code_expected, expected_error_string), + + get_error_string (error_code_expected, expected_error_string), get_error_string (error_code_returned, returned_error_string); - - printf (" Expected error code %s but got `%s'.\n", + + printf (" Expected error code %s but got `%s'.\n", expected_error_string, returned_error_string); error = true; } - + if (error) print_pattern_info (pattern, pattern_buffer_ptr); } @@ -121,7 +121,7 @@ test_nsub (sub_count, pattern, cflags) { regex_t pattern_buffer; - + test_compile (1, 0, pattern, &pattern_buffer, cflags); if (pattern_buffer.re_nsub != sub_count) @@ -132,7 +132,7 @@ instead.\n", sub_count, pattern_buffer.re_nsub); regfree (&pattern_buffer); } - + static void test_regcomp () @@ -140,9 +140,9 @@ test_regcomp () regex_t pattern_buffer; int cflags = 0; - + printf ("\nStarting regcomp tests.\n"); - + cflags = 0; test_compile (0, REG_ESUBREG, "\\(a\\)\\2", &pattern_buffer, cflags); test_compile (0, REG_EBRACE, "a\\{", &pattern_buffer, cflags); @@ -160,7 +160,7 @@ test_regcomp () test_nsub (1, "(a)", cflags); test_nsub (2, "((a))", cflags); test_nsub (2, "(a)(b)", cflags); - + cflags = REG_EXTENDED | REG_NOSUB; test_nsub (1, "(a)", cflags); @@ -197,13 +197,13 @@ test_pmatch (pattern, string, nmatch, pmatch, correct_pmatch, cflags) unsigned this_match; int error_code_returned; boolean found_nonmatch = false; - + test_compile (1, 0, pattern, &pattern_buffer, cflags); error_code_returned = regexec (&pattern_buffer, string, nmatch, pmatch, 0); - + if (error_code_returned == REG_NOMATCH) printf ("Matching failed in test_pmatch.\n"); - else + else { for (this_match = 0; this_match < nmatch; this_match++) { @@ -213,7 +213,7 @@ test_pmatch (pattern, string, nmatch, pmatch, correct_pmatch, cflags) printf ("\n"); printf ("Pmatch start %d wrong: was %d when should have \ -been %d.\n", this_match, pmatch[this_match].rm_so, +been %d.\n", this_match, pmatch[this_match].rm_so, correct_pmatch[this_match].rm_so); found_nonmatch = true; } @@ -223,7 +223,7 @@ been %d.\n", this_match, pmatch[this_match].rm_so, printf ("\n"); printf ("Pmatch end %d wrong: was %d when should have been \ -%d.\n", this_match, pmatch[this_match].rm_eo, +%d.\n", this_match, pmatch[this_match].rm_eo, correct_pmatch[this_match].rm_eo); found_nonmatch = true; } @@ -258,12 +258,12 @@ test_eflags (must_match_bol, must_match_eol, pattern, string, cflags, eflags) error_code_returned = regexec (&pattern_buffer, string, 0, 0, eflags); if (error_code_returned == REG_NOMATCH) - { + { /* If wasn't true that both 1) the anchored part of the pattern had to match this string and 2) this string was a proper substring... */ - if (!( (must_match_bol && (eflags & REG_NOTBOL)) + if (!( (must_match_bol && (eflags & REG_NOTBOL)) || (must_match_eol && (eflags & REG_NOTEOL)) )) { printf ("\nEflags test failed: didn't match when should have.\n"); @@ -271,7 +271,7 @@ test_eflags (must_match_bol, must_match_eol, pattern, string, cflags, eflags) } } else /* We got a match. */ - { + { /* If wasn't true that either 1) the anchored part of the pattern didn't have to match this string or 2) this string wasn't a proper substring... */ @@ -313,7 +313,7 @@ test_ignore_case (should_match, pattern, string, cflags) error_code_returned = regexec (&pattern_buffer, string, 0, 0, 0); if (should_match && error_code_returned == REG_NOMATCH) - { + { printf ("\nIgnore-case test failed:\n"); printf (" The string to match was: `%s'.\n", string); print_pattern_info (pattern, &pattern_buffer); @@ -340,7 +340,7 @@ test_newline (should_match, pattern, string, cflags) error_code_returned = regexec (&pattern_buffer, string, 0, 0, 0); if (should_match && error_code_returned == REG_NOMATCH) - { + { printf ("\nNewline test failed:\n"); printf (" The string to match was: `%s'.\n", string); print_pattern_info (pattern, &pattern_buffer); @@ -370,12 +370,12 @@ test_posix_match (should_match, pattern, string, cflags) error_code_returned = regexec (&pattern_buffer, string, 0, 0, 0); if (should_match && error_code_returned == REG_NOMATCH) - { + { printf ("\nShould have matched but didn't:\n"); was_error = true; } else if (!should_match && error_code_returned != REG_NOMATCH) - { + { printf ("\nShould not have matched but did:\n"); was_error = true; } @@ -397,23 +397,23 @@ test_regexec () regmatch_t correct_pmatch[3]; int cflags = 0; int eflags = 0; - + printf ("\nStarting regexec tests.\n"); cflags = REG_NOSUB; /* shouldn't look at any of pmatch. */ test_pmatch ("a", "a", 0, pmatch, correct_pmatch, cflags); - + /* Ask for less `pmatch'es than there are pattern subexpressions. (Shouldn't look at pmatch[2]. */ cflags = REG_EXTENDED; fill_pmatch (correct_pmatch, 0, 1, 0, 1, 100, 101); test_pmatch ("((a))", "a", 2, pmatch, correct_pmatch, cflags); - + /* Ask for same number of `pmatch'es as there are pattern subexpressions. */ cflags = REG_EXTENDED; fill_pmatch(correct_pmatch, 0, 1, 0, 1, -1, -1); test_pmatch ("(a)", "a", 2, pmatch, correct_pmatch, cflags); - + /* Ask for more `pmatch'es than there are pattern subexpressions. */ cflags = REG_EXTENDED; fill_pmatch (correct_pmatch, 0, 1, -1, -1, -1, -1); @@ -487,7 +487,7 @@ test_regexec () test_newline (true, "^a", "\na", cflags); test_newline (true, "a$", "a\n", cflags); - + /* Now test normal behavior. */ cflags = REG_EXTENDED; test_newline (true, "\n", "\n", cflags); @@ -508,11 +508,11 @@ test_regexec () /* Test that matches whole string only. */ cflags = 0; test_posix_match (true, "a", "a", cflags); - + /* Tests that match substrings. */ test_posix_match (true, "a", "ab", cflags); test_posix_match (true, "b", "ab", cflags); - + /* Test that doesn't match. */ test_posix_match (false, "a", "b", cflags); @@ -528,8 +528,8 @@ test_error_code_message (error_code, expected_error_message) char returned_error_message[TEST_ERRBUF_SIZE]; char error_code_string[ERROR_CODE_LENGTH]; size_t expected_error_message_length = strlen (expected_error_message) + 1; - size_t returned_error_message_length = regerror (error_code, 0, - returned_error_message, + size_t returned_error_message_length = regerror (error_code, 0, + returned_error_message, TEST_ERRBUF_SIZE); if (returned_error_message_length != expected_error_message_length) @@ -543,14 +543,14 @@ message `%s':\n", expected_error_message); expected_error_message_length, returned_error_message_length); } - if (strncmp (expected_error_message, returned_error_message, + if (strncmp (expected_error_message, returned_error_message, TEST_ERRBUF_SIZE - 1) != 0) { - - get_error_string (error_code, error_code_string), + + get_error_string (error_code, error_code_string), printf ("\n\n With error code %s (%d), expected error message:\n", error_code_string, error_code); - + printf (" `%s'\n", expected_error_message); printf (" but got:\n"); printf (" `%s'\n", returned_error_message); @@ -565,21 +565,21 @@ test_error_code_allocation (error_code, expected_error_message) { char *returned_error_message = NULL; char error_code_string[ERROR_CODE_LENGTH]; - size_t returned_error_message_length = regerror (error_code, 0, - returned_error_message, + size_t returned_error_message_length = regerror (error_code, 0, + returned_error_message, (size_t)0); returned_error_message = xmalloc (returned_error_message_length + 1); - - regerror (error_code, 0, returned_error_message, + + regerror (error_code, 0, returned_error_message, returned_error_message_length); - + if (strcmp (expected_error_message, returned_error_message) != 0) { - get_error_string (error_code, error_code_string), - - printf ("\n\n Testing error code allocation,\n"); - printf ("with error code %s (%d), expected error message:\n", + get_error_string (error_code, error_code_string), + + printf ("\n\n Testing error code allocation,\n"); + printf ("with error code %s (%d), expected error message:\n", error_code_string, error_code); printf (" `%s'\n", expected_error_message); printf (" but got:\n"); @@ -591,18 +591,18 @@ test_error_code_allocation (error_code, expected_error_message) static void test_regerror () { - test_error_code_message (REG_NOMATCH, "No match"); + test_error_code_message (REG_NOMATCH, "No match"); test_error_code_message (REG_BADPAT, "Invalid regular expression"); - test_error_code_message (REG_ECOLLATE, "Invalid collation character"); - test_error_code_message (REG_ECTYPE, "Invalid character class name"); - test_error_code_message (REG_EESCAPE, "Trailing backslash"); - test_error_code_message (REG_ESUBREG, "Invalid back reference"); - test_error_code_message (REG_EBRACK, "Unmatched [ or [^"); - test_error_code_message (REG_EPAREN, "Unmatched ( or \\("); - test_error_code_message (REG_EBRACE, "Unmatched \\{"); - test_error_code_message (REG_BADBR, "Invalid content of \\{\\}"); - test_error_code_message (REG_ERANGE, "Invalid range end"); - test_error_code_message (REG_ESPACE, "Memory exhausted"); + test_error_code_message (REG_ECOLLATE, "Invalid collation character"); + test_error_code_message (REG_ECTYPE, "Invalid character class name"); + test_error_code_message (REG_EESCAPE, "Trailing backslash"); + test_error_code_message (REG_ESUBREG, "Invalid back reference"); + test_error_code_message (REG_EBRACK, "Unmatched [ or [^"); + test_error_code_message (REG_EPAREN, "Unmatched ( or \\("); + test_error_code_message (REG_EBRACE, "Unmatched \\{"); + test_error_code_message (REG_BADBR, "Invalid content of \\{\\}"); + test_error_code_message (REG_ERANGE, "Invalid range end"); + test_error_code_message (REG_ESPACE, "Memory exhausted"); test_error_code_message (REG_BADRPT, "Invalid preceding regular expression"); test_error_code_message (REG_EEND, "Premature end of regular expression"); test_error_code_message (REG_ESIZE, "Regular expression too big"); @@ -615,10 +615,10 @@ test_posix_interface () { printf ("\nStarting POSIX interface tests.\n"); t = posix_interface_test; - + test_regcomp (); test_regexec (); test_regerror (); - + printf ("\nFinished POSIX interface tests.\n"); } diff --git a/gnu/lib/libregex/test/psx-interv.c b/gnu/lib/libregex/test/psx-interv.c index 6725c38d00b8..fcdf488cd85a 100644 --- a/gnu/lib/libregex/test/psx-interv.c +++ b/gnu/lib/libregex/test/psx-interv.c @@ -27,10 +27,10 @@ test_intervals () test_match (BRACES_TO_OPS ("a{1}"), "a"); test_match (BRACES_TO_OPS ("a{1,}"), "a"); - test_match (BRACES_TO_OPS ("a{1,}"), "aa"); + test_match (BRACES_TO_OPS ("a{1,}"), "aa"); test_match (BRACES_TO_OPS ("a{0,0}"), ""); test_match (BRACES_TO_OPS ("a{0,1}"), ""); - test_match (BRACES_TO_OPS ("a{0,1}"), "a"); + test_match (BRACES_TO_OPS ("a{0,1}"), "a"); test_match (BRACES_TO_OPS ("a{1,3}"), "a"); test_match (BRACES_TO_OPS ("a{1,3}"), "aa"); test_match (BRACES_TO_OPS ("a{1,3}"), "aaa"); @@ -68,7 +68,7 @@ test_intervals () test_match (BRACES_TO_OPS (PARENS_TO_OPS ("(a*){1,1}ab")), "aaaab"); TEST_REGISTERS (BRACES_TO_OPS (PARENS_TO_OPS ("(a*){1,1}ab")), "aaaab", 0, 5, 0, 3, -1, -1); - + test_match (BRACES_TO_OPS (".{0,3}b"), "b"); test_match (BRACES_TO_OPS (".{0,3}b"), "ab"); @@ -98,7 +98,7 @@ test_intervals () test_match (BRACES_TO_OPS ("a{1}*"), ""); test_match (BRACES_TO_OPS ("a{1}*"), "a"); test_match (BRACES_TO_OPS ("a{1}*"), "aa"); - + test_match (BRACES_TO_OPS ("a{1}{1}"), "a"); test_match (BRACES_TO_OPS ("a{1}{1}{1}"), "a"); @@ -108,25 +108,25 @@ test_intervals () test_match (BRACES_TO_OPS ("a{1}{1}*"), "a"); test_match (BRACES_TO_OPS ("a{1}{1}*"), "aa"); test_match (BRACES_TO_OPS ("a{1}{1}*"), "aaa"); - + test_match (BRACES_TO_OPS ("a{1}{2}"), "aa"); test_match (BRACES_TO_OPS ("a{2}{1}"), "aa"); test_should_match = false; - + test_match (BRACES_TO_OPS ("a{0}"), "a"); test_match (BRACES_TO_OPS ("a{0,}"), "b"); - test_match (BRACES_TO_OPS ("a{1}"), ""); + test_match (BRACES_TO_OPS ("a{1}"), ""); test_match (BRACES_TO_OPS ("a{1}"), "aa"); test_match (BRACES_TO_OPS ("a{1,}"), ""); test_match (BRACES_TO_OPS ("a{1,}"), "b"); - test_match (BRACES_TO_OPS ("a{0,0}"), "a"); + test_match (BRACES_TO_OPS ("a{0,0}"), "a"); test_match (BRACES_TO_OPS ("a{0,1}"), "aa"); test_match (BRACES_TO_OPS ("a{0,1}"), "b"); - test_match (BRACES_TO_OPS ("a{1,3}"), ""); + test_match (BRACES_TO_OPS ("a{1,3}"), ""); test_match (BRACES_TO_OPS ("a{1,3}"), "aaaa"); - test_match (BRACES_TO_OPS ("a{1,3}"), "b"); + test_match (BRACES_TO_OPS ("a{1,3}"), "b"); test_match (BRACES_TO_OPS (PARENS_TO_OPS ("(a){1,3}b")), "aaaab"); test_match (BRACES_TO_OPS (PARENS_TO_OPS ("(a*){1,3}b")), "bb"); test_match (BRACES_TO_OPS ("[a]{0,3}"), "aaaa"); diff --git a/gnu/lib/libregex/test/test.c b/gnu/lib/libregex/test/test.c index a8de23ef7429..74b43b2df7d7 100644 --- a/gnu/lib/libregex/test/test.c +++ b/gnu/lib/libregex/test/test.c @@ -55,32 +55,32 @@ boolean test_should_match; static void -set_all_registers (start0, end0, start1, end1, +set_all_registers (start0, end0, start1, end1, start2, end2, start3, end3, - start4, end4, start5, end5, + start4, end4, start5, end5, start6, end6, start7, end7, start8, end8, start9, end9, regs) - int start0; int end0; int start1; int end1; + int start0; int end0; int start1; int end1; int start2; int end2; int start3; int end3; - int start4; int end4; int start5; int end5; + int start4; int end4; int start5; int end5; int start6; int end6; int start7; int end7; - int start8; int end8; int start9; int end9; + int start8; int end8; int start9; int end9; struct re_registers *regs; { unsigned r; - - regs->start[0] = start0; regs->end[0] = end0; - regs->start[1] = start1; regs->end[1] = end1; - regs->start[2] = start2; regs->end[2] = end2; - regs->start[3] = start3; regs->end[3] = end3; - regs->start[4] = start4; regs->end[4] = end4; - regs->start[5] = start5; regs->end[5] = end5; - regs->start[6] = start6; regs->end[6] = end6; - regs->start[7] = start7; regs->end[7] = end7; - regs->start[8] = start8; regs->end[8] = end8; - regs->start[9] = start9; regs->end[9] = end9; + + regs->start[0] = start0; regs->end[0] = end0; + regs->start[1] = start1; regs->end[1] = end1; + regs->start[2] = start2; regs->end[2] = end2; + regs->start[3] = start3; regs->end[3] = end3; + regs->start[4] = start4; regs->end[4] = end4; + regs->start[5] = start5; regs->end[5] = end5; + regs->start[6] = start6; regs->end[6] = end6; + regs->start[7] = start7; regs->end[7] = end7; + regs->start[8] = start8; regs->end[8] = end8; + regs->start[9] = start9; regs->end[9] = end9; for (r = 10; r < regs->num_regs; r++) { regs->start[r] = -1; @@ -111,16 +111,16 @@ concat (s1, s2) /* We ignore the `can_be_null' argument. Should just be removed. */ -void +void general_test (pattern_should_be_valid, match_whole_string, pat, str1, str2, start, range, end, correct_fastmap, correct_regs, can_be_null) - unsigned pattern_should_be_valid; + unsigned pattern_should_be_valid; unsigned match_whole_string; const char *pat; char *str1, *str2; - int start, range, end; - char *correct_fastmap; + int start, range, end; + char *correct_fastmap; struct re_registers *correct_regs; int can_be_null; { @@ -138,8 +138,8 @@ general_test (pattern_should_be_valid, match_whole_string, unsigned invalid_pattern = 0; boolean internal_error_1 = false; boolean internal_error_2 = false; - - + + nonconst_buf.allocated = 8; nonconst_buf.buffer = xmalloc (nonconst_buf.allocated); nonconst_buf.fastmap = fastmap; @@ -147,7 +147,7 @@ general_test (pattern_should_be_valid, match_whole_string, assert (pat != NULL); r = re_compile_pattern (pat, strlen (pat), &nonconst_buf); - + /* Kludge: if we are doing POSIX testing, we really should have called regcomp, not re_compile_pattern. As it happens, the only way in which it matters is that re_compile_pattern sets the @@ -156,7 +156,7 @@ general_test (pattern_should_be_valid, match_whole_string, matching. */ if (t == posix_basic_test || t == posix_extended_test) nonconst_buf.newline_anchor = 0; - + invalid_pattern = r != NULL; if (!r) @@ -168,27 +168,27 @@ general_test (pattern_should_be_valid, match_whole_string, else { fastmap_internal_error = (re_compile_fastmap (&nonconst_buf) == -2); - + if (correct_fastmap) - nonconst_buf.fastmap_accurate = + nonconst_buf.fastmap_accurate = memcmp (nonconst_buf.fastmap, correct_fastmap, 1 << BYTEWIDTH) == 0; - + if (OK_TO_SEARCH) { old_buf = nonconst_buf; old_buf.buffer = (unsigned char *) xmalloc (nonconst_buf.used); memcpy (old_buf.buffer, nonconst_buf.buffer, nonconst_buf.used); - + /* If only one string is null, call re_match or re_search, - which is what the user would probably do. */ + which is what the user would probably do. */ if (str1 == NULL && str2 != NULL || str2 == NULL && str1 != NULL) { char *the_str = str1 == NULL ? str2 : str1; - + match_1 - = match_whole_string + = match_whole_string ? (r = re_match (&nonconst_buf, the_str, strlen (the_str), start, ®s)) == strlen (the_str) @@ -200,16 +200,16 @@ general_test (pattern_should_be_valid, match_whole_string, if (r == -2) internal_error_1 = true; } - else + else match_1 = 1; - + /* Also call with re_match_2 or re_search_2, as they might do this. (Also can check calling with either string1 or string2 or both null.) */ if (match_whole_string) { r = re_match_2 (&nonconst_buf, - str1, SAFE_STRLEN (str1), + str1, SAFE_STRLEN (str1), str2, SAFE_STRLEN (str2), start, ®s, end); match_2 = r == SAFE_STRLEN (str1) + SAFE_STRLEN (str2); @@ -217,7 +217,7 @@ general_test (pattern_should_be_valid, match_whole_string, else { r = re_search_2 (&nonconst_buf, - str1, SAFE_STRLEN (str1), + str1, SAFE_STRLEN (str1), str2, SAFE_STRLEN (str2), start, range, ®s, end); match_2 = r >= 0; @@ -225,16 +225,16 @@ general_test (pattern_should_be_valid, match_whole_string, if (r == -2) internal_error_2 = true; - + match = match_1 & match_2; - + if (correct_regs) { unsigned reg; if (regs_correct != NULL) free (regs_correct); - - regs_correct + + regs_correct = (unsigned *) xmalloc (regs.num_regs * sizeof (unsigned)); for (reg = 0; @@ -256,9 +256,9 @@ general_test (pattern_should_be_valid, match_whole_string, || (regs.start[reg] == -1 && regs.end[reg] == -1 && correct_regs->start[reg] == correct_regs->end[reg]) -#endif +#endif ; - + all_regs_correct &= regs_correct[reg]; } } @@ -268,15 +268,15 @@ general_test (pattern_should_be_valid, match_whole_string, if (fastmap_internal_error) printf ("\n\nInternal error in re_compile_fastmap:"); - + if (internal_error_1) { if (!fastmap_internal_error) printf ("\n"); - + printf ("\nInternal error in re_match or re_search:"); } - + if (internal_error_2) { if (!internal_error_1) @@ -285,11 +285,11 @@ general_test (pattern_should_be_valid, match_whole_string, printf ("\nInternal error in re_match_2 or re_search_2:"); } - if ((OK_TO_SEARCH && ((match && !test_should_match) + if ((OK_TO_SEARCH && ((match && !test_should_match) || (!match && test_should_match)) || (correct_regs && !all_regs_correct)) || !nonconst_buf.fastmap_accurate - || invalid_pattern + || invalid_pattern || !pattern_should_be_valid || internal_error_1 || internal_error_2 || verbose) @@ -324,8 +324,8 @@ general_test (pattern_should_be_valid, match_whole_string, if ((!(invalid_pattern && !pattern_should_be_valid)) || verbose) printf (" Pattern: `%s'.\n", pat); - - if (pattern_should_be_valid || verbose + + if (pattern_should_be_valid || verbose || internal_error_1 || internal_error_2) { printf(" Strings: "); @@ -335,7 +335,7 @@ general_test (pattern_should_be_valid, match_whole_string, if ((OK_TO_SEARCH || verbose || internal_error_1 || internal_error_2) && !invalid_pattern) { - if (memcmp (old_buf.buffer, nonconst_buf.buffer, + if (memcmp (old_buf.buffer, nonconst_buf.buffer, nonconst_buf.used) != 0 && !invalid_pattern) { @@ -346,16 +346,16 @@ general_test (pattern_should_be_valid, match_whole_string, } else printf ("\n Compiled pattern: "); - + print_compiled_pattern (&nonconst_buf); } if (correct_fastmap && (!nonconst_buf.fastmap_accurate || verbose)) { - printf ("\n The fastmap should have been: "); + printf ("\n The fastmap should have been: "); print_fastmap (correct_fastmap); - printf ("\n Fastmap: "); + printf ("\n Fastmap: "); print_fastmap (fastmap); printf ("\n Compiled pattern before matching: "); @@ -366,25 +366,25 @@ general_test (pattern_should_be_valid, match_whole_string, { unsigned this_reg; printf ("\n Incorrect registers:"); - + for (this_reg = 0; this_reg < regs.num_regs; this_reg++) { if (!regs_correct[this_reg]) { printf ("\n Register %d's start was %2d. ", this_reg, regs.start[this_reg]); - printf ("\tIt should have been %d.\n", + printf ("\tIt should have been %d.\n", correct_regs->start[this_reg]); printf (" Register %d's end was %2d. ", this_reg, regs.end[this_reg]); - printf ("\tIt should have been %d.\n", + printf ("\tIt should have been %d.\n", correct_regs->end[this_reg]); } } } } } - + if (nonconst_buf.buffer != NULL) free (nonconst_buf.buffer); @@ -396,7 +396,7 @@ general_test (pattern_should_be_valid, match_whole_string, free (regs_correct); } - + nonconst_buf.buffer = old_buf.buffer = NULL; regs_correct = NULL; regs.start = regs.end = NULL; @@ -419,17 +419,17 @@ test_search_return (match_start_wanted, pattern, string) num_times_called++; buf.allocated = 1; buf.buffer = xmalloc (buf.allocated); - + assert (pattern != NULL); buf.translate = 0; compile_return = re_compile_pattern (pattern, strlen (pattern), &buf); - + if (compile_return) { printf ("\n\nInvalid pattern in test_match_start:\n"); printf ("%s\n", compile_return); } - else + else { buf.fastmap = fastmap; match_start = re_search (&buf, string, strlen (string), @@ -453,8 +453,8 @@ test_search_return (match_start_wanted, pattern, string) for (this_char = 0; this_char < strlen (fastmap_string); this_char++)\ correct_fastmap[fastmap_string[this_char]] = !invert; \ correct_fastmap['\n'] = match_newline; \ - } - + } + void test_fastmap (pat, fastmap_string, invert, match_newline) @@ -463,7 +463,7 @@ test_fastmap (pat, fastmap_string, invert, match_newline) unsigned invert; unsigned match_newline; { - char correct_fastmap[(1 << BYTEWIDTH)]; + char correct_fastmap[(1 << BYTEWIDTH)]; SET_FASTMAP (); general_test (1, 0, pat, NULL, NULL, -1, 0, -1, correct_fastmap, 0, -1); @@ -471,25 +471,25 @@ test_fastmap (pat, fastmap_string, invert, match_newline) void -test_fastmap_search (pat, str, fastmap_string, invert, match_newline, +test_fastmap_search (pat, str, fastmap_string, invert, match_newline, can_be_null, start0, end0) - const char *pat; - char *str; + const char *pat; + char *str; char *fastmap_string; - unsigned invert; - unsigned match_newline; - int can_be_null; - int start0; + unsigned invert; + unsigned match_newline; + int can_be_null; + int start0; int end0; { - char correct_fastmap[(1 << BYTEWIDTH)]; + char correct_fastmap[(1 << BYTEWIDTH)]; struct re_registers correct_regs; correct_regs.num_regs = RE_NREGS; correct_regs.start = (int *) xmalloc (RE_NREGS * sizeof (int)); correct_regs.end = (int *) xmalloc (RE_NREGS * sizeof (int)); - - set_all_registers (start0, end0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + + set_all_registers (start0, end0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, &correct_regs); SET_FASTMAP (); general_test (1, 0, pat, str, NULL, 0, SAFE_STRLEN (str), SAFE_STRLEN (str), @@ -503,34 +503,34 @@ test_fastmap_search (pat, str, fastmap_string, invert, match_newline, void -test_all_registers (pat, str1, str2, - start0, end0, start1, end1, - start2, end2, start3, end3, - start4, end4, start5, end5, - start6, end6, start7, end7, +test_all_registers (pat, str1, str2, + start0, end0, start1, end1, + start2, end2, start3, end3, + start4, end4, start5, end5, + start6, end6, start7, end7, start8, end8, start9, end9) - char *pat; char *str1; char *str2; - int start0; int end0; int start1; int end1; - int start2; int end2; int start3; int end3; - int start4; int end4; int start5; int end5; - int start6; int end6; int start7; int end7; + char *pat; char *str1; char *str2; + int start0; int end0; int start1; int end1; + int start2; int end2; int start3; int end3; + int start4; int end4; int start5; int end5; + int start6; int end6; int start7; int end7; int start8; int end8; int start9; int end9; { struct re_registers correct_regs; - + if (omit_register_tests) return; - + correct_regs.num_regs = RE_NREGS; correct_regs.start = (int *) xmalloc (RE_NREGS * sizeof (int)); correct_regs.end = (int *) xmalloc (RE_NREGS * sizeof (int)); - set_all_registers (start0, end0, start1, end1, start2, end2, start3, end3, - start4, end4, start5, end5, start6, end6, start7, end7, + set_all_registers (start0, end0, start1, end1, start2, end2, start3, end3, + start4, end4, start5, end5, start6, end6, start7, end7, start8, end8, start9, end9, &correct_regs); - general_test (1, 0, pat, str1, str2, 0, - SAFE_STRLEN (str1) + SAFE_STRLEN (str2), - SAFE_STRLEN (str1) + SAFE_STRLEN (str2), + general_test (1, 0, pat, str1, str2, 0, + SAFE_STRLEN (str1) + SAFE_STRLEN (str2), + SAFE_STRLEN (str1) + SAFE_STRLEN (str2), NULL, &correct_regs, -1); free (correct_regs.start); @@ -547,8 +547,8 @@ invalid_pattern (error_code_expected, pattern) int cflags = re_syntax_options == RE_SYNTAX_POSIX_EXTENDED || re_syntax_options == RE_SYNTAX_POSIX_MINIMAL_EXTENDED - ? REG_EXTENDED : 0; - + ? REG_EXTENDED : 0; + test_compile (0, error_code_expected, pattern, &pattern_buffer, cflags); } @@ -561,8 +561,8 @@ valid_pattern (pattern) int cflags = re_syntax_options == RE_SYNTAX_POSIX_EXTENDED || re_syntax_options == RE_SYNTAX_POSIX_MINIMAL_EXTENDED - ? REG_EXTENDED : 0; - + ? REG_EXTENDED : 0; + test_compile (1, 0, pattern, &pattern_buffer, cflags); } @@ -578,7 +578,7 @@ delimiters_to_ops (source, left_delimiter, right_delimiter) boolean double_size = false; unsigned source_char; unsigned answer_char = 0; - + assert (source != NULL); switch (left_delimiter) @@ -608,7 +608,7 @@ delimiters_to_ops (source, left_delimiter, right_delimiter) answer = NULL; } - answer = (char *) xmalloc ((double_size + answer = (char *) xmalloc ((double_size ? strlen (source) << 1 : strlen (source)) + 1); @@ -618,7 +618,7 @@ delimiters_to_ops (source, left_delimiter, right_delimiter) { for (source_char = 0; source_char < strlen (source); source_char++) { - if (source[source_char] == left_delimiter + if (source[source_char] == left_delimiter || source[source_char] == right_delimiter) answer[answer_char++] = '\\'; @@ -626,14 +626,14 @@ delimiters_to_ops (source, left_delimiter, right_delimiter) } answer[answer_char] = 0; } - + return answer; } void print_pattern_info (pattern, pattern_buffer_ptr) - const char *pattern; + const char *pattern; regex_t *pattern_buffer_ptr; { printf (" Pattern: `%s'.\n", pattern); @@ -647,13 +647,13 @@ valid_nonposix_pattern (pattern) char *pattern; { struct re_pattern_buffer nonconst_buf; - + nonconst_buf.allocated = 0; nonconst_buf.buffer = NULL; nonconst_buf.translate = NULL; - + assert (pattern != NULL); - + if (re_compile_pattern (pattern, strlen (pattern), &nonconst_buf)) { printf ("Couldn't compile the pattern.\n"); @@ -667,13 +667,13 @@ compile_and_print_pattern (pattern) char *pattern; { struct re_pattern_buffer nonconst_buf; - + nonconst_buf.allocated = 0; nonconst_buf.buffer = NULL; - + if (re_compile_pattern (pattern, strlen (pattern), &nonconst_buf)) printf ("Couldn't compile the pattern.\n"); - + print_pattern_info (pattern, &nonconst_buf); } @@ -691,7 +691,7 @@ test_case_fold (pattern, string) assert (pattern != NULL); ret = re_compile_pattern (pattern, strlen (pattern), &nonconst_buf); - + if (ret) { printf ("\nShould have been a valid pattern but wasn't.\n"); @@ -699,8 +699,8 @@ test_case_fold (pattern, string) } else { - if (test_should_match - && re_match (&nonconst_buf, string, strlen (string), 0, 0) + if (test_should_match + && re_match (&nonconst_buf, string, strlen (string), 0, 0) != strlen (string)) { printf ("Match failed for case fold.\n"); @@ -727,7 +727,7 @@ test_match_n_times (n, pattern, string) buf.translate = 0; assert (pattern != NULL); - + r = re_compile_pattern (pattern, strlen (pattern), &buf); if (r) { @@ -738,14 +738,14 @@ test_match_n_times (n, pattern, string) { for (this_match = 1; this_match <= n; this_match++) match = (re_match (&buf, string, strlen (string), - 0, 0) + 0, 0) == strlen (string)); if (match && !test_should_match) printf ("\n\nMatched but shouldn't have:\n"); else if (!match && test_should_match) printf ("\n\nDidn't match but should have:\n"); - + if ((match && !test_should_match) || (!match && test_should_match)) { printf(" The string to match was: "); @@ -753,7 +753,7 @@ test_match_n_times (n, pattern, string) printf ("`%s' and ", string); else printf ("`'"); - + printf (" Pattern: %s.\n", pattern); printf (" Compiled pattern: %s.\n", pattern); print_compiled_pattern (&buf); @@ -762,17 +762,17 @@ test_match_n_times (n, pattern, string) } -void +void test_match_2 (pat, str1, str2) - const char *pat; - char *str1; + const char *pat; + char *str1; char *str2; { general_test (1, 1, pat, str1, str2, 0, 1, SAFE_STRLEN (str1) + SAFE_STRLEN (str2), NULL, 0, -1); } -void +void test_match (pat, str) const char *pat; char *str; diff --git a/gnu/lib/libregex/test/test.h b/gnu/lib/libregex/test/test.h index fb67126547cc..e367c936b3e6 100644 --- a/gnu/lib/libregex/test/test.h +++ b/gnu/lib/libregex/test/test.h @@ -39,21 +39,21 @@ extern test_type t; extern char *concat (char *, char *); -extern void general_test (unsigned pattern_should_be_valid, +extern void general_test (unsigned pattern_should_be_valid, unsigned match_whole_string, const char *pat, char *str1, char *str2, - int start, int range, int end, - char *correct_fastmap, + int start, int range, int end, + char *correct_fastmap, struct re_registers *correct_regs, int can_be_null); extern void init_pattern_buffer (regex_t *pattern_buffer_ptr); -extern void test_compile (unsigned valid_pattern, int error_code_expected, +extern void test_compile (unsigned valid_pattern, int error_code_expected, const char *pattern, regex_t *pattern_buffer_ptr, int cflags); -extern char *delimiter_to_ops (char *source, char left_delimiter, +extern char *delimiter_to_ops (char *source, char left_delimiter, char right_delimiter); @@ -61,18 +61,18 @@ extern void test_search_return (int, const char *, char *); extern void test_berk_search (const char *pattern, char *string); -extern void test_fastmap (const char *pat, char *fastmap_string, unsigned invert, +extern void test_fastmap (const char *pat, char *fastmap_string, unsigned invert, unsigned match_newline); extern void test_fastmap_search (const char *pat, char *str, char *fastmap_string, - unsigned invert, unsigned match_newline, + unsigned invert, unsigned match_newline, int can_be_null, int start0, int end0); -extern void test_all_registers (char *pat, char *str1, char *str2, - int start0, int end0, int start1, int end1, - int start2, int end2, int start3, int end3, - int start4, int end4, int start5, int end5, - int start6, int end6, int start7, int end7, +extern void test_all_registers (char *pat, char *str1, char *str2, + int start0, int end0, int start1, int end1, + int start2, int end2, int start3, int end3, + int start4, int end4, int start5, int end5, + int start6, int end6, int start7, int end7, int start8, int end8, int start9, int end9); extern void print_pattern_info (const char *pattern, regex_t *pattern_buffer_ptr); diff --git a/gnu/lib/libregex/test/tregress.c b/gnu/lib/libregex/test/tregress.c index 7858cac1502b..b6aa560f5299 100644 --- a/gnu/lib/libregex/test/tregress.c +++ b/gnu/lib/libregex/test/tregress.c @@ -11,7 +11,7 @@ itoa (i) int i; { char *a = xmalloc (21); /* sign + 19 digits (enough for 64 bits) + null */ - + sprintf (a, "%d", i); return a; } @@ -29,7 +29,7 @@ simple_fail (routine, pat, buf, str, ret) if (str && *str) fprintf (stderr, " String = %s\n", str); fprintf (stderr, " Pattern = %s\n", pat); print_compiled_pattern (buf); - + if (pause_at_error) { fprintf (stderr, "RET to continue: "); @@ -46,7 +46,7 @@ simple_compile (pat, buf) struct re_pattern_buffer *buf; { const char *ret = re_compile_pattern (pat, strlen (pat), buf); - + if (ret != NULL) simple_fail ("compile", pat, buf, NULL, ret); } @@ -58,13 +58,13 @@ simple_fastmap (pat) struct re_pattern_buffer buf; char fastmap[256]; int ret; - + buf.allocated = 0; buf.buffer = buf.translate = NULL; buf.fastmap = fastmap; - + simple_compile (pat, &buf); - + ret = re_compile_fastmap (&buf); if (ret != 0) simple_fail ("fastmap compile", pat, &buf, NULL, itoa (ret)); @@ -85,13 +85,13 @@ do_match (pat, str, expected) buf.allocated = 0; buf.buffer = buf.translate = buf.fastmap = NULL; - + simple_compile (pat, &buf); len = strlen (str); - + ret = re_match_2 (&buf, NULL, 0, str, len, 0, NULL, len); - + if (ret != expected) simple_fail ("match", pat, &buf, str, itoa (ret)); } @@ -107,13 +107,13 @@ simple_search (pat, str, correct_startpos) buf.allocated = 0; buf.buffer = buf.translate = buf.fastmap = NULL; - + simple_compile (pat, &buf); len = strlen (str); - + ret = re_search_2 (&buf, NULL, 0, str, len, 0, len, NULL, len); - + if (ret != correct_startpos) simple_fail ("match", pat, &buf, str, itoa (ret)); } @@ -128,8 +128,8 @@ test_regress () unsigned len; struct re_registers regs; int ret; - char *fastmap = xmalloc (256); - + char *fastmap = xmalloc (256); + buf.translate = NULL; buf.fastmap = NULL; buf.allocated = 0; @@ -145,10 +145,10 @@ test_regress () buf.translate = upcase; SIMPLE_MATCH ("[A-[]", "A"); buf.translate = NULL; - + /* meyering@cs.utexas.edu Nov 6 22:34:41 1992 */ simple_search ("\\w+", "a", 0); - + /* jimb@occs.cs.oberlin.edu 10 Sep 92 00:42:33 */ buf.translate = upcase; SIMPLE_MATCH ("[\001-\377]", "\001"); @@ -158,13 +158,13 @@ test_regress () /* mike@skinner.cs.uoregon.edu 1 Sep 92 01:45:22 */ SIMPLE_MATCH ("^^$", "^"); - + /* pclink@qld.tne.oz.au Sep 7 22:42:36 1992 */ re_set_syntax (RE_INTERVALS); SIMPLE_MATCH ("^a\\{3\\}$", "aaa"); SIMPLE_NONMATCH ("^a\\{3\\}$", "aa"); re_set_syntax (RE_SYNTAX_EMACS); - + /* pclink@qld.tne.oz.au, 31 Aug 92. (conjecture) */ re_set_syntax (RE_INTERVALS); simple_search ("a\\{1,3\\}b", "aaab", 0); @@ -173,14 +173,14 @@ test_regress () /* trq@dionysos.thphys.ox.ac.uk, 31 Aug 92. (simplified) */ simple_fastmap ("^.*\n[ ]*"); - + /* wind!greg@plains.NoDak.edu, 25 Aug 92. (simplified) */ re_set_syntax (RE_INTERVALS); SIMPLE_MATCH ("[a-zA-Z]*.\\{5\\}", "xN0000"); SIMPLE_MATCH ("[a-zA-Z]*.\\{5\\}$", "systemxN0000"); SIMPLE_MATCH ("\\([a-zA-Z]*\\).\\{5\\}$", "systemxN0000"); re_set_syntax (RE_SYNTAX_EMACS); - + /* jimb, 18 Aug 92. Don't use \000, so `strlen' (in our testing routines) will work. (This still tickles the bug jimb reported.) */ SIMPLE_MATCH ("[\001-\377]", "\001"); @@ -307,7 +307,7 @@ test_regress () /* jla's bug (with string-match), 5 Feb 92. */ TEST_SEARCH ("\\`[ \t\n]*", "jla@challenger (Joseph Arceneaux)", 0, 100); - + /* jwz@lucid.com, 8 March 1992 (re-search-forward). (His is the second.) These are not supposed to match. */ #if 0 @@ -335,7 +335,7 @@ References: <9203080736.AA05869@thalidomide.lucid>\n\ <9203081900.AA24794@titanic.lucid>", 0, 5000); #endif /* 0 [failed searches] */ - + /* macrakis' bugs. */ buf.translate = upcase; /* message of 24 Jan 91 */ if (re_compile_pattern ("[!-`]", 5, &buf) != NULL) @@ -355,7 +355,7 @@ References: <9203080736.AA05869@thalidomide.lucid>\n\ printf ("faofdx test, reg #1 wrong.\n"); if (regs.start[2] != 1 || regs.end[2] != 2) printf ("faofdx test, reg #2 wrong.\n"); - + TEST_REGISTERS ("\\(a\\)*a", "aaa", 0, 3, 1, 2, -1, -1); test_fastmap ("^\\([^ \n]+:\n\\)+\\([^ \n]+:\\)", " \n", 1, 0); @@ -412,7 +412,7 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:"); /* Dave G. bug: Reference to a subexpression which didn't match. Should fail. */ re_set_syntax (RE_NO_BK_PARENS | RE_NO_BK_VBAR); - test_match ("(ooooooooooone())-annnnnnnnnnnd-(twooooooooooo\\2)", + test_match ("(ooooooooooone())-annnnnnnnnnnd-(twooooooooooo\\2)", "ooooooooooone-annnnnnnnnnnd-twooooooooooo"); test_match ("(o|t)", "o"); test_match ("(o()|t)", "o"); @@ -424,23 +424,23 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:"); test_match ("(o()|t())-a-(t\\2|f\\3)", "o-a-t"); test_match ("(o()|t())-a-(t\\2|f\\3)", "t-a-f"); - test_should_match = 0; + test_should_match = 0; test_match ("(foo(bar)|second)\\2", "second"); test_match ("(o()|t())-a-(t\\2|f\\3)", "t-a-t"); test_match ("(o()|t())-a-(t\\2|f\\3)", "o-a-f"); re_set_syntax (RE_SYNTAX_EMACS); test_match ("\\(foo\\(bar\\)\\|second\\)\\2", "secondbar"); - test_match ("\\(one\\(\\)\\|two\\(\\)\\)-and-\\(three\\2\\|four\\3\\)", + test_match ("\\(one\\(\\)\\|two\\(\\)\\)-and-\\(three\\2\\|four\\3\\)", "one-and-four"); - test_match ("\\(one\\(\\)\\|two\\(\\)\\)-and-\\(three\\2\\|four\\3\\)", + test_match ("\\(one\\(\\)\\|two\\(\\)\\)-and-\\(three\\2\\|four\\3\\)", "two-and-three"); - + test_should_match = 1; re_set_syntax (RE_SYNTAX_EMACS); - test_match ("\\(one\\(\\)\\|two\\(\\)\\)-and-\\(three\\2\\|four\\3\\)", + test_match ("\\(one\\(\\)\\|two\\(\\)\\)-and-\\(three\\2\\|four\\3\\)", "one-and-three"); - test_match ("\\(one\\(\\)\\|two\\(\\)\\)-and-\\(three\\2\\|four\\3\\)", + test_match ("\\(one\\(\\)\\|two\\(\\)\\)-and-\\(three\\2\\|four\\3\\)", "two-and-four"); TEST_REGISTERS (":\\(.*\\)", ":/", 0, 2, 1, 2, -1, -1); diff --git a/gnu/lib/libregex/test/upcase.c b/gnu/lib/libregex/test/upcase.c index 5147b812aaae..a3c0fbce6119 100644 --- a/gnu/lib/libregex/test/upcase.c +++ b/gnu/lib/libregex/test/upcase.c @@ -1,7 +1,7 @@ /* Indexed by a character, gives the upper case equivalent of the character. */ -char upcase[0400] = +char upcase[0400] = { 000, 001, 002, 003, 004, 005, 006, 007, 010, 011, 012, 013, 014, 015, 016, 017, 020, 021, 022, 023, 024, 025, 026, 027, diff --git a/gnu/lib/libregex/test/xmalloc.c b/gnu/lib/libregex/test/xmalloc.c index 88be1a668bd3..aa1c6c44f7f5 100644 --- a/gnu/lib/libregex/test/xmalloc.c +++ b/gnu/lib/libregex/test/xmalloc.c @@ -9,8 +9,8 @@ void * xmalloc (size) unsigned size; { - char *new_mem = malloc (size); - + char *new_mem = malloc (size); + if (new_mem == NULL) { fprintf (stderr, "xmalloc: request for %u bytes failed.\n", size); |
