summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--def.h21
-rw-r--r--main.c24
-rw-r--r--parse.c24
3 files changed, 36 insertions, 33 deletions
diff --git a/def.h b/def.h
index 9cbbe61..d1d97f2 100644
--- a/def.h
+++ b/def.h
@@ -52,7 +52,7 @@ in this Software without prior written authorization from The Open Group.
#define TRUE 1
#define FALSE 0
-/* the following must match the directives table in main.c */
+/* the following must match the directives table in parse.c */
#define IF 0
#define IFDEF 1
#define IFNDEF 2
@@ -137,23 +137,22 @@ struct filepointer {
#include <stdlib.h>
+/* main.c */
int match(const char *str, const char *const *list);
-char *base_name(const char *file);
char *getnextline(struct filepointer *fp);
-struct symtab **slookup(const char *symbol, struct inclist *file);
-struct symtab **isdefined(const char *symbol, struct inclist *file,
- struct inclist **srcfile);
-struct symtab **fdefined(const char *symbol, struct inclist *file,
- struct inclist **srcfile);
struct filepointer *getfile(const char *file);
+void freefile(struct filepointer *fp);
+
+/* include.c */
void included_by(struct inclist *ip, struct inclist *newfile);
struct inclist *newinclude(const char *newfile, const char *incstring,
const char *incpath);
void inc_clean(void);
struct inclist *inc_path(const char *file, const char *include, int type);
-void freefile(struct filepointer *fp);
-
+/* parse.c */
+struct symtab **isdefined(const char *symbol, struct inclist *file,
+ struct inclist **srcfile);
void define2(const char *name, const char *val, struct inclist *file);
void define(char *def, struct inclist *file);
void undefine(const char *symbol, struct inclist *file);
@@ -161,15 +160,18 @@ int find_includes(struct filepointer *filep,
struct inclist *file, struct inclist *file_red,
int recursion, boolean failOK);
+/* pr.c */
void recursive_pr_include(struct inclist *head,
const char *file, const char *base);
void add_include(struct filepointer *filep,
struct inclist *file, struct inclist *file_red,
const char *include, int type, boolean failOK);
+/* cppsetup.c */
int cppsetup(const char *filename, const char *line,
struct filepointer *filep, struct inclist *inc);
+/* main.c */
extern void fatalerr(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2) _X_NORETURN;
extern void warning(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2);
extern void warning1(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2);
@@ -180,7 +182,6 @@ extern struct inclist *inclistnext;
extern struct inclist maininclist;
extern const char *includedirs[];
extern const char **includedirsnext;
-extern const char *const directives[];
extern char *notdotdot[];
extern const char *objprefix;
diff --git a/main.c b/main.c
index 2ede1bd..cffa27b 100644
--- a/main.c
+++ b/main.c
@@ -63,28 +63,7 @@ int _debugmask;
#define DASH_INC_PRE "#include \""
#define DASH_INC_POST "\""
-const char *ProgramName;
-
-const char *const directives[] = {
- "if",
- "ifdef",
- "ifndef",
- "else",
- "endif",
- "define",
- "undef",
- "include",
- "line",
- "pragma",
- "error",
- "ident",
- "sccs",
- "elif",
- "eject",
- "warning",
- "include_next",
- NULL
-};
+static const char *ProgramName;
#include "imakemdep.h"
@@ -112,6 +91,7 @@ boolean show_where_not = FALSE;
boolean warn_multiple = FALSE;
static void setfile_cmdinc(struct filepointer *filep, long count, char **list);
+static char *base_name(const char *file);
static void redirect(const char *line, const char *makefile);
static void _X_NORETURN
diff --git a/parse.c b/parse.c
index 92431ea..cb6d133 100644
--- a/parse.c
+++ b/parse.c
@@ -31,8 +31,30 @@ static int deftype(char *line, struct filepointer *filep,
int parse_it);
static int zero_value(char *filename, char *exp, struct filepointer *filep,
struct inclist *file_red);
+static struct symtab **slookup(const char *symbol, struct inclist *file);
static boolean merge2defines(struct inclist *file1, struct inclist *file2);
+static const char *const directives[] = {
+ "if",
+ "ifdef",
+ "ifndef",
+ "else",
+ "endif",
+ "define",
+ "undef",
+ "include",
+ "line",
+ "pragma",
+ "error",
+ "ident",
+ "sccs",
+ "elif",
+ "eject",
+ "warning",
+ "include_next",
+ NULL
+};
+
static int
gobble(struct filepointer *filep, struct inclist *file,
struct inclist *file_red)
@@ -245,7 +267,7 @@ deftype(char *line, struct filepointer *filep,
return (ret);
}
-struct symtab **
+static struct symtab **
fdefined(const char *symbol, struct inclist *file, struct inclist **srcfile)
{
struct symtab **val;