mirror of
https://github.com/rfivet/uemacs.git
synced 2025-02-20 06:57:11 -05:00
uemacs: convert typedef struct MC to struct magic.
Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
e1b2f459e2
commit
ebd4f2f1eb
4
edef.h
4
edef.h
@ -118,8 +118,8 @@ extern int matchoff;
|
||||
#if MAGIC
|
||||
extern short int magical;
|
||||
extern short int rmagical;
|
||||
extern MC mcpat[NPAT]; /* The magic pattern. */
|
||||
extern MC tapcm[NPAT]; /* The reversed magic patterni. */
|
||||
extern struct magic mcpat[NPAT]; /* The magic pattern. */
|
||||
extern struct magic tapcm[NPAT]; /* The reversed magic patterni. */
|
||||
extern RMC rmcpat[NPAT]; /* The replacement magic array. */
|
||||
#endif
|
||||
|
||||
|
2
efunc.h
2
efunc.h
@ -302,7 +302,7 @@ extern int forwsearch(int f, int n);
|
||||
extern int forwhunt(int f, int n);
|
||||
extern int backsearch(int f, int n);
|
||||
extern int backhunt(int f, int n);
|
||||
extern int mcscanner(MC *mcpatrn, int direct, int beg_or_end);
|
||||
extern int mcscanner(struct magic *mcpatrn, int direct, int beg_or_end);
|
||||
extern int scanner(const char *patrn, int direct, int beg_or_end);
|
||||
extern int eq(unsigned char bc, unsigned char pc);
|
||||
extern void savematch(void);
|
||||
|
@ -666,15 +666,15 @@ struct while_block {
|
||||
#define HIBYTE HICHAR >> 3
|
||||
|
||||
/* Typedefs that define the meta-character structure for MAGIC mode searching
|
||||
* (MC), and the meta-character structure for MAGIC mode replacment (RMC).
|
||||
* (struct magic), and the meta-character structure for MAGIC mode replacment (RMC).
|
||||
*/
|
||||
typedef struct {
|
||||
struct magic {
|
||||
short int mc_type;
|
||||
union {
|
||||
int lchar;
|
||||
char *cclmap;
|
||||
} u;
|
||||
} MC;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
short int mc_type;
|
||||
|
@ -128,8 +128,8 @@ int matchoff = 0;
|
||||
*/
|
||||
short int magical = FALSE;
|
||||
short int rmagical = FALSE;
|
||||
MC mcpat[NPAT]; /* the magic pattern */
|
||||
MC tapcm[NPAT]; /* the reversed magic pattern */
|
||||
struct magic mcpat[NPAT]; /* the magic pattern */
|
||||
struct magic tapcm[NPAT]; /* the reversed magic pattern */
|
||||
RMC rmcpat[NPAT]; /* the replacement magic array */
|
||||
|
||||
#endif
|
||||
|
26
search.c
26
search.c
@ -64,14 +64,14 @@
|
||||
#include "efunc.h"
|
||||
#include "line.h"
|
||||
|
||||
static int amatch(MC *mcptr, int direct, struct line **pcwline, int *pcwoff);
|
||||
static int amatch(struct magic *mcptr, int direct, struct line **pcwline, int *pcwoff);
|
||||
static int readpattern(char *prompt, char *apat, int srch);
|
||||
static int replaces(int kind, int f, int n);
|
||||
static int nextch(struct line **pcurline, int *pcuroff, int dir);
|
||||
static int mcstr(void);
|
||||
static int rmcstr(void);
|
||||
static int mceq(int bc, MC *mt);
|
||||
static int cclmake(char **ppatptr, MC *mcptr);
|
||||
static int mceq(int bc, struct magic *mt);
|
||||
static int cclmake(char **ppatptr, struct magic *mcptr);
|
||||
static int biteq(int bc, char *cclmap);
|
||||
static char *clearbits(void);
|
||||
static void setbit(int bc, char *cclmap);
|
||||
@ -283,11 +283,11 @@ int backhunt(int f, int n)
|
||||
* reset the "." to be at the start or just after the match string,
|
||||
* and (perhaps) repaint the display.
|
||||
*
|
||||
* MC *mcpatrn; pointer into pattern
|
||||
* struct magic *mcpatrn; pointer into pattern
|
||||
* int direct; which way to go.
|
||||
* int beg_or_end; put point at beginning or end of pattern.
|
||||
*/
|
||||
int mcscanner(MC *mcpatrn, int direct, int beg_or_end)
|
||||
int mcscanner(struct magic *mcpatrn, int direct, int beg_or_end)
|
||||
{
|
||||
struct line *curline; /* current line during scan */
|
||||
int curoff; /* position within current line */
|
||||
@ -351,12 +351,12 @@ int mcscanner(MC *mcpatrn, int direct, int beg_or_end)
|
||||
* recursive routine amatch() (for "anchored match") in
|
||||
* Kernighan & Plauger's "Software Tools".
|
||||
*
|
||||
* MC *mcptr; string to scan for
|
||||
* struct magic *mcptr; string to scan for
|
||||
* int direct; which way to go.
|
||||
* struct line **pcwline; current line during scan
|
||||
* int *pcwoff; position within current line
|
||||
*/
|
||||
static int amatch(MC *mcptr, int direct, struct line **pcwline, int *pcwoff)
|
||||
static int amatch(struct magic *mcptr, int direct, struct line **pcwline, int *pcwoff)
|
||||
{
|
||||
int c; /* character at current position */
|
||||
struct line *curline; /* current line during scan */
|
||||
@ -1085,14 +1085,14 @@ static int nextch(struct line **pcurline, int *pcuroff, int dir)
|
||||
*/
|
||||
static int mcstr(void)
|
||||
{
|
||||
MC *mcptr, *rtpcm;
|
||||
struct magic *mcptr, *rtpcm;
|
||||
char *patptr;
|
||||
int mj;
|
||||
int pchr;
|
||||
int status = TRUE;
|
||||
int does_closure = FALSE;
|
||||
|
||||
/* If we had metacharacters in the MC array previously,
|
||||
/* If we had metacharacters in the struct magic array previously,
|
||||
* free up any bitmaps that may have been allocated.
|
||||
*/
|
||||
if (magical)
|
||||
@ -1286,11 +1286,11 @@ static int rmcstr(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* mcclear -- Free up any CCL bitmaps, and MCNIL the MC search arrays.
|
||||
* mcclear -- Free up any CCL bitmaps, and MCNIL the struct magic search arrays.
|
||||
*/
|
||||
void mcclear(void)
|
||||
{
|
||||
MC *mcptr;
|
||||
struct magic *mcptr;
|
||||
|
||||
mcptr = &mcpat[0];
|
||||
|
||||
@ -1326,7 +1326,7 @@ void rmcclear(void)
|
||||
* Software Tools, this is the function omatch(), but i felt there
|
||||
* were too many functions with the 'match' name already.
|
||||
*/
|
||||
static int mceq(int bc, MC *mt)
|
||||
static int mceq(int bc, struct magic *mt)
|
||||
{
|
||||
int result;
|
||||
|
||||
@ -1377,7 +1377,7 @@ extern char *clearbits(void);
|
||||
* ppatptr is left pointing to the end-of-character-class character,
|
||||
* so that a loop may automatically increment with safety.
|
||||
*/
|
||||
static int cclmake(char **ppatptr, MC *mcptr)
|
||||
static int cclmake(char **ppatptr, struct magic *mcptr)
|
||||
{
|
||||
char *bmap;
|
||||
char *patptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user