mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
Remove dependency to CPP: removed stuff related to CPP calls
Now that the built-in parser has support for all the feature of CPP being used by WindowMaker's default menu, we can remove the stuff related to calling CPP: - code for preparing and running CPP; - compile-time option to de-activate the call to CPP; - command-line option
This commit is contained in:
committed by
Carlos R. Mafra
parent
4658f4f9a1
commit
139f912e61
@@ -368,9 +368,10 @@ If you're not sure, try renaming ~/GNUstep to ~/GNUtmp and then run wmaker.inst
|
|||||||
|
|
||||||
== The root menu contains only 2 entries. ("XTerm" and "Exit...")
|
== The root menu contains only 2 entries. ("XTerm" and "Exit...")
|
||||||
|
|
||||||
* Window Maker is not finding cpp (the C preprocessor). If your cpp is
|
* Window Maker could not read your menu definition file
|
||||||
not located in /lib/cpp, edit config.h and correct the path in
|
you should check wmaker's output for an error, it may be
|
||||||
CPP_PATH.
|
visible in the console or in the .xsession-errors file.
|
||||||
|
|
||||||
|
|
||||||
== checking lex output file root... configure: error: cannot find output from true; giving up
|
== checking lex output file root... configure: error: cannot find output from true; giving up
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ config.h: config-paths.h
|
|||||||
|
|
||||||
config-paths.h: Makefile
|
config-paths.h: Makefile
|
||||||
@echo "Generating $@"
|
@echo "Generating $@"
|
||||||
@echo '/* define to the path to cpp */' > $@
|
|
||||||
@echo '#define CPP_PATH "$(CPP_PATH)"' >> $@
|
|
||||||
@echo '' >> $@
|
|
||||||
@echo '/* gettext domain used for menu translations */' >> $@
|
@echo '/* gettext domain used for menu translations */' >> $@
|
||||||
@if test -z "$(menutextdomain)"; then \
|
@if test -z "$(menutextdomain)"; then \
|
||||||
echo '/* #undef MENU_TEXTDOMAIN "$(menutextdomain)" */' >> $@; \
|
echo '/* #undef MENU_TEXTDOMAIN "$(menutextdomain)" */' >> $@; \
|
||||||
|
|||||||
27
configure.ac
27
configure.ac
@@ -215,33 +215,6 @@ dnl Check for inotify
|
|||||||
dnl =================
|
dnl =================
|
||||||
AC_CHECK_HEADERS(sys/inotify.h, AC_DEFINE(HAVE_INOTIFY, 1, Check for inotify))
|
AC_CHECK_HEADERS(sys/inotify.h, AC_DEFINE(HAVE_INOTIFY, 1, Check for inotify))
|
||||||
|
|
||||||
dnl Check CPP
|
|
||||||
dnl =========
|
|
||||||
if test "x$CPP_PATH" = x; then
|
|
||||||
AC_PATH_PROG(CPP_PATH, cpp, notfound,
|
|
||||||
$PATH:/lib:/usr/bin:/bin:/usr/lib:/usr/ccs/lib)
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl Tell stupid Solaris cpp that the files it will process have C++ like syntax
|
|
||||||
dnl RedHat 5.x is broken too, so it won't make a symlink from cpp to the
|
|
||||||
dnl standard locations
|
|
||||||
dnl
|
|
||||||
if test "$CPP_PATH" = "/usr/ccs/lib/cpp" -o "$CPP_PATH" = "notfound" ; then
|
|
||||||
if test "$GCC" = "yes"; then
|
|
||||||
CPP_PATH="gcc -E -x c"
|
|
||||||
else
|
|
||||||
if test "$CPP_PATH" = "/usr/ccs/lib/cpp"; then
|
|
||||||
CPP_PATH="$CPP_PATH -B"
|
|
||||||
else
|
|
||||||
echo "cpp, the C preprocessor was not found in your system."
|
|
||||||
echo "Create a symbolic link from it to /lib/cpp and rerun configure"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
dnl =======================
|
dnl =======================
|
||||||
|
|||||||
@@ -436,7 +436,6 @@ typedef struct WPreferences {
|
|||||||
struct {
|
struct {
|
||||||
unsigned int nodock:1; /* don't display the dock */
|
unsigned int nodock:1; /* don't display the dock */
|
||||||
unsigned int noclip:1; /* don't display the clip */
|
unsigned int noclip:1; /* don't display the clip */
|
||||||
unsigned int nocpp:1; /* don't use cpp */
|
|
||||||
unsigned int noupdates:1; /* don't require ~/GNUstep (-static) */
|
unsigned int noupdates:1; /* don't require ~/GNUstep (-static) */
|
||||||
unsigned int noautolaunch:1; /* don't autolaunch apps */
|
unsigned int noautolaunch:1; /* don't autolaunch apps */
|
||||||
unsigned int norestore:1; /* don't restore session */
|
unsigned int norestore:1; /* don't restore session */
|
||||||
|
|||||||
@@ -64,10 +64,6 @@ Pixmap LoadIcon(WScreen *scr, char *path, char *mask, int title_height);
|
|||||||
int calcIntersectionArea(int x1, int y1, int w1, int h1,
|
int calcIntersectionArea(int x1, int y1, int w1, int h1,
|
||||||
int x2, int y2, int w2, int h2);
|
int x2, int y2, int w2, int h2);
|
||||||
|
|
||||||
#ifdef USECPP
|
|
||||||
char *MakeCPPArgs(char *path);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char * StrConcatDot(char *a, char *b);
|
char * StrConcatDot(char *a, char *b);
|
||||||
char * ExpandOptions(WScreen *scr, char *cmdline);
|
char * ExpandOptions(WScreen *scr, char *cmdline);
|
||||||
char * ShrinkString(WMFont *font, char *string, int width);
|
char * ShrinkString(WMFont *font, char *string, int width);
|
||||||
|
|||||||
10
src/main.c
10
src/main.c
@@ -491,9 +491,6 @@ static void print_help(void)
|
|||||||
puts(_("The Window Maker window manager for the X window system"));
|
puts(_("The Window Maker window manager for the X window system"));
|
||||||
puts("");
|
puts("");
|
||||||
puts(_(" -display host:dpy display to use"));
|
puts(_(" -display host:dpy display to use"));
|
||||||
#ifdef USECPP
|
|
||||||
puts(_(" --no-cpp disable preprocessing of configuration files"));
|
|
||||||
#endif
|
|
||||||
puts(_(" --no-dock do not open the application Dock"));
|
puts(_(" --no-dock do not open the application Dock"));
|
||||||
puts(_(" --no-clip do not open the workspace Clip"));
|
puts(_(" --no-clip do not open the workspace Clip"));
|
||||||
puts(_(" --no-autolaunch do not autolaunch applications"));
|
puts(_(" --no-autolaunch do not autolaunch applications"));
|
||||||
@@ -679,12 +676,9 @@ static int real_main(int argc, char **argv)
|
|||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
#ifdef USECPP
|
|
||||||
if (strcmp(argv[i], "-nocpp") == 0 || strcmp(argv[i], "--no-cpp") == 0) {
|
if (strcmp(argv[i], "-nocpp") == 0 || strcmp(argv[i], "--no-cpp") == 0) {
|
||||||
wPreferences.flags.nocpp = 1;
|
wwarning(_("option \"%s\" is deprecated, please remove it from your script"), argv[i]);
|
||||||
} else
|
} else if (strcmp(argv[i], "--for-real") == 0) {
|
||||||
#endif
|
|
||||||
if (strcmp(argv[i], "--for-real") == 0) {
|
|
||||||
wPreferences.flags.restarting = 0;
|
wPreferences.flags.restarting = 0;
|
||||||
} else if (strcmp(argv[i], "--for-real=") == 0) {
|
} else if (strcmp(argv[i], "--for-real=") == 0) {
|
||||||
wPreferences.flags.restarting = 1;
|
wPreferences.flags.restarting = 1;
|
||||||
|
|||||||
118
src/misc.c
118
src/misc.c
@@ -50,124 +50,6 @@
|
|||||||
/**** global variables *****/
|
/**** global variables *****/
|
||||||
extern WPreferences wPreferences;
|
extern WPreferences wPreferences;
|
||||||
|
|
||||||
#ifdef USECPP
|
|
||||||
static void putdef(char *line, char *name, char *value)
|
|
||||||
{
|
|
||||||
if (!value) {
|
|
||||||
wwarning(_("could not define value for %s for cpp"), name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
strcat(line, name);
|
|
||||||
strcat(line, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void putidef(char *line, char *name, int value)
|
|
||||||
{
|
|
||||||
char tmp[64];
|
|
||||||
snprintf(tmp, sizeof(tmp), "%i", value);
|
|
||||||
strcat(line, name);
|
|
||||||
strcat(line, tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *username(void)
|
|
||||||
{
|
|
||||||
char *tmp;
|
|
||||||
|
|
||||||
tmp = getlogin();
|
|
||||||
if (!tmp) {
|
|
||||||
struct passwd *user;
|
|
||||||
|
|
||||||
user = getpwuid(getuid());
|
|
||||||
if (!user) {
|
|
||||||
werror(_("could not get password entry for UID %i"), getuid());
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (!user->pw_name) {
|
|
||||||
return NULL;
|
|
||||||
} else {
|
|
||||||
return user->pw_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *MakeCPPArgs(char *path)
|
|
||||||
{
|
|
||||||
char buffer[MAXLINE], *buf, *line;
|
|
||||||
Visual *visual;
|
|
||||||
char *tmp;
|
|
||||||
|
|
||||||
line = wmalloc(MAXLINE);
|
|
||||||
*line = 0;
|
|
||||||
if ((buf = getenv("HOSTNAME")) != NULL) {
|
|
||||||
if (buf[0] == '(') {
|
|
||||||
wwarning(_("your machine is misconfigured. HOSTNAME is set to %s"), buf);
|
|
||||||
} else
|
|
||||||
putdef(line, " -DHOST=", buf);
|
|
||||||
} else if ((buf = getenv("HOST")) != NULL) {
|
|
||||||
if (buf[0] == '(') {
|
|
||||||
wwarning(_("your machine is misconfigured. HOST is set to %s"), buf);
|
|
||||||
} else
|
|
||||||
putdef(line, " -DHOST=", buf);
|
|
||||||
}
|
|
||||||
buf = username();
|
|
||||||
if (buf)
|
|
||||||
putdef(line, " -DUSER=", buf);
|
|
||||||
putidef(line, " -DUID=", getuid());
|
|
||||||
buf = XDisplayName(DisplayString(dpy));
|
|
||||||
putdef(line, " -DDISPLAY=", buf);
|
|
||||||
putdef(line, " -DWM_VERSION=", VERSION);
|
|
||||||
|
|
||||||
visual = DefaultVisual(dpy, DefaultScreen(dpy));
|
|
||||||
putidef(line, " -DVISUAL=", visual->class);
|
|
||||||
|
|
||||||
putidef(line, " -DDEPTH=", DefaultDepth(dpy, DefaultScreen(dpy)));
|
|
||||||
|
|
||||||
putidef(line, " -DSCR_WIDTH=", WidthOfScreen(DefaultScreenOfDisplay(dpy)));
|
|
||||||
putidef(line, " -DSCR_HEIGHT=", HeightOfScreen(DefaultScreenOfDisplay(dpy)));
|
|
||||||
|
|
||||||
/* put the dir where the menu is being read from to the
|
|
||||||
* search path */
|
|
||||||
if (path) {
|
|
||||||
tmp = wstrdup(path);
|
|
||||||
buf = strchr(tmp + 1, ' ');
|
|
||||||
if (buf) {
|
|
||||||
*buf = 0;
|
|
||||||
}
|
|
||||||
buf = strrchr(tmp, '/');
|
|
||||||
if (buf) {
|
|
||||||
*buf = 0; /* trunc filename */
|
|
||||||
putdef(line, " -I", tmp);
|
|
||||||
}
|
|
||||||
wfree(tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* this should be done just once, but it works this way */
|
|
||||||
strcpy(buffer, DEF_CONFIG_PATHS);
|
|
||||||
buf = strtok(buffer, ":");
|
|
||||||
|
|
||||||
do {
|
|
||||||
char fullpath[MAXLINE];
|
|
||||||
|
|
||||||
if (buf[0] != '~') {
|
|
||||||
strcpy(fullpath, buf);
|
|
||||||
} else {
|
|
||||||
/* home is statically allocated. Don't free it! */
|
|
||||||
char *home = wgethomedir();
|
|
||||||
|
|
||||||
strcpy(fullpath, home);
|
|
||||||
strcat(fullpath, &(buf[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
putdef(line, " -I", fullpath);
|
|
||||||
|
|
||||||
} while ((buf = strtok(NULL, ":")) != NULL);
|
|
||||||
|
|
||||||
#undef arg
|
|
||||||
return line;
|
|
||||||
}
|
|
||||||
#endif /* USECPP */
|
|
||||||
|
|
||||||
/* XFetchName Wrapper */
|
/* XFetchName Wrapper */
|
||||||
Bool wFetchName(Display *dpy, Window win, char **winname)
|
Bool wFetchName(Display *dpy, Window win, char **winname)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -939,37 +939,12 @@ static WMenu *readMenuFile(WScreen * scr, char *file_name)
|
|||||||
FILE *file = NULL;
|
FILE *file = NULL;
|
||||||
WMenuParser parser;
|
WMenuParser parser;
|
||||||
char *command, *params, *shortcut, *title;
|
char *command, *params, *shortcut, *title;
|
||||||
char cmd[MAXLINE];
|
|
||||||
#ifdef USECPP
|
|
||||||
char *args;
|
|
||||||
int cpp = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USECPP
|
|
||||||
if (!wPreferences.flags.nocpp) {
|
|
||||||
args = MakeCPPArgs(file_name);
|
|
||||||
if (!args) {
|
|
||||||
wwarning(_("could not make arguments for menu file preprocessor"));
|
|
||||||
} else {
|
|
||||||
snprintf(cmd, sizeof(cmd), "%s %s %s", CPP_PATH, args, file_name);
|
|
||||||
wfree(args);
|
|
||||||
file = popen(cmd, "r");
|
|
||||||
if (!file) {
|
|
||||||
werror(_("%s:could not open/preprocess menu file"), file_name);
|
|
||||||
} else {
|
|
||||||
cpp = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* USECPP */
|
|
||||||
|
|
||||||
if (!file) {
|
|
||||||
file = fopen(file_name, "rb");
|
file = fopen(file_name, "rb");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
werror(_("%s:could not open menu file"), file_name);
|
werror(_("%s:could not open menu file"), file_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
parser = WMenuParserCreate(file_name, file, DEF_CONFIG_PATHS);
|
parser = WMenuParserCreate(file_name, file, DEF_CONFIG_PATHS);
|
||||||
menu_parser_register_macros(parser);
|
menu_parser_register_macros(parser);
|
||||||
|
|
||||||
@@ -998,17 +973,7 @@ static WMenu *readMenuFile(WScreen * scr, char *file_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WMenuParserDelete(parser);
|
WMenuParserDelete(parser);
|
||||||
#ifdef USECPP
|
|
||||||
if (cpp) {
|
|
||||||
if (pclose(file) == -1) {
|
|
||||||
werror(_("error reading preprocessed menu data"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
|
||||||
#else
|
|
||||||
fclose(file);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
@@ -1023,11 +988,7 @@ static WMenu *readMenuPipe(WScreen * scr, char **file_name)
|
|||||||
char *command, *params, *shortcut, *title;
|
char *command, *params, *shortcut, *title;
|
||||||
char *filename;
|
char *filename;
|
||||||
char flat_file[MAXLINE];
|
char flat_file[MAXLINE];
|
||||||
char cmd[MAXLINE];
|
|
||||||
int i;
|
int i;
|
||||||
#ifdef USECPP
|
|
||||||
char *args;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
flat_file[0] = '\0';
|
flat_file[0] = '\0';
|
||||||
|
|
||||||
@@ -1037,31 +998,11 @@ static WMenu *readMenuPipe(WScreen * scr, char **file_name)
|
|||||||
}
|
}
|
||||||
filename = flat_file + (flat_file[1] == '|' ? 2 : 1);
|
filename = flat_file + (flat_file[1] == '|' ? 2 : 1);
|
||||||
|
|
||||||
#ifdef USECPP
|
|
||||||
if (!wPreferences.flags.nocpp) {
|
|
||||||
args = MakeCPPArgs(filename);
|
|
||||||
if (!args) {
|
|
||||||
wwarning(_("could not make arguments for menu file preprocessor"));
|
|
||||||
} else {
|
|
||||||
snprintf(cmd, sizeof(cmd), "%s | %s %s", filename, CPP_PATH, args);
|
|
||||||
|
|
||||||
wfree(args);
|
|
||||||
file = popen(cmd, "r");
|
|
||||||
if (!file) {
|
|
||||||
werror(_("%s:could not open/preprocess menu file"), filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* USECPP */
|
|
||||||
|
|
||||||
if (!file) {
|
|
||||||
file = popen(filename, "rb");
|
file = popen(filename, "rb");
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
werror(_("%s:could not open menu file"), filename);
|
werror(_("%s:could not open menu file"), filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
parser = WMenuParserCreate(flat_file, file, DEF_CONFIG_PATHS);
|
parser = WMenuParserCreate(flat_file, file, DEF_CONFIG_PATHS);
|
||||||
menu_parser_register_macros(parser);
|
menu_parser_register_macros(parser);
|
||||||
|
|
||||||
|
|||||||
@@ -38,11 +38,6 @@
|
|||||||
/* If you want the application icon to be highlighted when it has the focus */
|
/* If you want the application icon to be highlighted when it has the focus */
|
||||||
#define NEWAPPICON
|
#define NEWAPPICON
|
||||||
|
|
||||||
/* undefine it if you don't want your config files to be preprocessed by cpp */
|
|
||||||
#define USECPP
|
|
||||||
|
|
||||||
/* #define CPP_PATH @CPP_PATH@ */
|
|
||||||
|
|
||||||
/* support for XDND drop in the Dock. Experimental */
|
/* support for XDND drop in the Dock. Experimental */
|
||||||
/*#define XDND*/
|
/*#define XDND*/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user