ack/util/ack/ack.h
George Koehler 36f16b0cb8 Cut down some clang warnings
Edit C code to reduce warnings from clang.  Most warnings are for
implicit declarations of functions, but some warnings want me to add
parentheses or curly braces, or to cast arguments for printf().

Make a few other changes, like declaring float_cst() in h/con_float to
be static, and using C99 bool in ego/ra/makeitems.c and
ego/share/makecldef.c.  Such changes don't silence warnings; I make
such changes while I silence warnings in the same file.  In
float_cst(), rename parameter `str` to `float_str`, so it doesn't
share a name with the global variable `str`.

Remove `const` from `newmodule(const char *)` in mach/proto/as to
silence a warning.  I wrongly added the `const` in d347207.

For warnings about implicit declarations of functions, the fix is to
declare the function before calling it.  For example, my OpenBSD
system needs <sys/wait.h> to declare wait().

In util/int, add "whatever.h" to declare more functions.  Remove old
declarations from "mem.h", to prefer the newer declarations of the
same functions in "data.h" and "stack.h".
2019-10-30 18:36:38 -04:00

100 lines
2.8 KiB
C

/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#ifndef NORCSID
#define RCS_ACK "$Id$"
#endif
#include <stdlib.h> /* size_t, free() */
/****************************************************************************/
/* User settable options */
/****************************************************************************/
#define FRONTENDS "fe" /* The front-end definitions */
#define TMPNAME "Ack_%x" /* Naming of temp. files */
/****************************************************************************/
/* Internal mnemonics, should not be tinkered with */
/****************************************************************************/
/* The names of some string variables */
#define HOME "EM"
#define RTS "RTS"
#define HEAD "HEAD"
#define TAIL "TAIL"
#define SRC "SOURCE"
#define LIBVAR "LNAME"
#define SUFFIX "SUFFIX"
/* Intended for flags, possibly in bit fields */
#define YES 1
#define NO 0
#define MAYBE 2
#define SUFCHAR '.' /* Start of SUFFIX in file name */
#define SPACE ' '
#define TAB '\t'
#define EQUAL '='
#define S_VAR '{' /* Start of variable */
#define C_VAR '}' /* End of variable */
#define A_VAR '?' /* Variable alternative */
#define BSLASH '\\' /* Backslash */
#define STAR '*' /* STAR */
#define C_IN '<' /* Token specifying input */
#define C_OUT '>' /* Token specifying output */
#define S_EXPR '(' /* Start of expression */
#define C_EXPR ')' /* End of expression */
#define M_EXPR ':' /* Middle of two suffix lists */
#define T_EXPR '=' /* Start of tail */
#define NO_SCAN 0200 /* Bit set in character to defeat recogn. */
typedef struct
{
char* p_path; /* points to the full pathname */
int p_keeps : 1; /* The string should be thrown when unused */
int p_keep : 1; /* The file should be thrown away after use */
} path;
#define p_cont(elem) ((path*)l_content(elem))
/* Own routines */
/* files.h */
extern void rmtemps(void);
/* rmach.c */
extern void setlist(char*);
/* svars.c */
extern void setsvar(char*, char*);
extern void setpvar(char*, char* (*)(void));
extern char* getvar(const char*);
/* util.c */
extern char* ack_basename(const char*);
extern char* skipblank(char*);
extern char* firstblank(char*);
extern void fatal(const char*, ...);
extern void vprint(const char*, ...);
extern void fuerror(const char*, ...);
extern void werror(const char*, ...);
extern void error(const char*, ...);
extern void quit(int);
extern char* keeps(const char*);
#define throws(str) free(str)
extern void* getcore(size_t);
extern void* changecore(void*, size_t);
#define freecore(area) free(area)
#define DEBUG 1 /* Allow debugging of Ack */
#ifndef DEBUG
#define debug 0 /* To surprise all these 'if ( debug ) 's */
#else
extern int debug;
#endif