📄 r2util.h
字号:
/*=========================================================================*/
/* UNIT : @(#)r2util.h 2.3 - 08/04/99 */
/*=========================================================================*/
/* PURPOSE: General use routines. */
/* */
/* UNIT : r2util.c */
/*--------------------------------------------------------------------*/
#ifndef __R2UTIL_H
#define __R2UTIL_H
#ifndef __R2ANALYZ_H
#include "r2analyz.h"
#endif
#ifndef __R2_H
#include"r2.h"
#endif
#include <stdio.h>
#define EXIT_SUCCESS 0
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 2
#endif
#define MAXLINE 256
extern int gTALK;
extern STRING gRECON2[ MAXDIR ];
extern void AbortMsg(
STRING *msg
);
extern OUTPUT_MODE GetOutputMode(
clinput *CLInput /* Cmd line arguments */
);
extern void SplitPath(
char *path, /* Path to be parsed */
char *name /* Name portion of path */
);
extern void SetTalk(
clinput *CLInput /* Cmd line arguments */
);
extern void Usage();
extern void NullStruct(
clinput *CLInput /* Cmd line arguments */
);
typedef enum {FAIL, SUCCEED} RESULT;
extern int getRecordType(FILE *testFile, char * cval);
extern RESULT getSwitchValue(FILE *testFile, long *sval,
int linenum, char * r2t_file);
extern RESULT getLine(FILE *testFile, int *lnum, int linenum, char * r2t_file);
extern RESULT getComment(char name[MAXLINE], FILE *testFile, int linenum,
char * r2t_file);
extern RESULT getName(char name[MAXLINE], int *lenName, int linenum,
FILE *testFile, char * r2t_file);
extern int EvalValueType(FILE *testFile, char *R2srcFile, int *lnum,
char *cval, long *sval, char name[MAXLINE],
int *lenName, int linenum);
/* The Item, Node, and Tree are used to incorperate a Binary tree in */
/* r2analyz. The purpose of the Tree is to limit the amount of string*/
/* compasisons during the analisis of the *.r2t files */
typedef struct item
{
int size;
int nodenum;
char tfl;
char file[MAXLINE];
} Item;
typedef struct node
{
Item item;
struct node *last;
struct node *left;
struct node *right;
} Node;
typedef struct tree
{
int nodenum;
Node *root;
Node *last;
} Tree;
/* Passing the index number of the file to be located with the */
/* Binary Tree stucture will return the filename */
extern char *SeekOut(int nodenum, Tree *ptree);
/* Will be called by AddItem to locate the file name in the tree */
/* Will return the valid index number */
int SeekIn(Item pi, Node *root, Tree *ptree);
/* Will return an index number, regardless if the index was used */
/* before or not. */
extern int AddItem(Item pi, Tree *ptree);
/* Will create a node to enter into the binary tree. It aslo */
/* initializes the node with valid data */
Node *MakeNode(Item pi);
/* Initializes the Binary Tree */
extern void InitTree(Tree *ptree);
/* Will release the allocated memory from the binary tree back to */
/* the operating system */
extern RESULT FreeTree(Tree *ptree);
/* Commonly used commands within SeekItem */
Node *WorkTree(Item pi, Tree *ptree);
#endif /* __R2UTIL_H */
/*====================================================================*/
/* EOF : r2util.h */
/*====================================================================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -