mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	Simplify and merge {config,theme}-dir.c
This commit is contained in:
		
							parent
							
								
									fc6fca6945
								
							
						
					
					
						commit
						f003abf608
					
				
					 20 changed files with 181 additions and 163 deletions
				
			
		
							
								
								
									
										6
									
								
								tools/dirs/Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								tools/dirs/Makefile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
CFLAGS  += -g -Wall -I../../include
 | 
			
		||||
CFLAGS  += `pkg-config --cflags glib-2.0`
 | 
			
		||||
LDFLAGS += `pkg-config --libs glib-2.0`
 | 
			
		||||
 | 
			
		||||
all:
 | 
			
		||||
	$(CC) $(CFLAGS) -o dir-list dir-list.c ../../src/common/dir.c $(LDFLAGS)
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								tools/dirs/dir-list
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tools/dirs/dir-list
									
										
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										12
									
								
								tools/dirs/dir-list.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								tools/dirs/dir-list.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
#include "common/dir.h"
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
	setenv("LABWC_DEBUG_DIR_CONFIG_AND_THEME", "1", 1);
 | 
			
		||||
	setenv("XDG_CONFIG_HOME", "/a:/bbb:/ccccc:/etc/foo", 1);
 | 
			
		||||
	printf("%s\n", config_dir());	
 | 
			
		||||
	printf("%s\n", theme_dir("Numix"));
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -6,14 +6,15 @@ ASAN_FLAGS = -O0 -fsanitize=address -fno-common -fno-omit-frame-pointer -rdynami
 | 
			
		|||
CFLAGS    += $(ASAN_FLAGS)
 | 
			
		||||
LDFLAGS   += $(ASAN_FLAGS) -fuse-ld=gold
 | 
			
		||||
LDFLAGS   += `xml2-config --libs`
 | 
			
		||||
LDFLAGS   += `pkg-config --cflags --libs glib-2.0 wayland-server xkbcommon`
 | 
			
		||||
LDFLAGS   += `pkg-config --cflags --libs glib-2.0 cairo pangocairo wayland-server xkbcommon`
 | 
			
		||||
 | 
			
		||||
PROGS = rcxml-print-nodenames
 | 
			
		||||
SRC = \
 | 
			
		||||
	rcxml-print-nodenames.c \
 | 
			
		||||
	../../src/config/rcxml.c \
 | 
			
		||||
	../../src/config/config-dir.c \
 | 
			
		||||
	../../src/common/dir.c \
 | 
			
		||||
	../../src/common/buf.c \
 | 
			
		||||
	../../src/common/font.c \
 | 
			
		||||
	../../src/config/keybind.c
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,7 @@ LDFLAGS   += -DWLR_USE_UNSTABLE
 | 
			
		|||
SRCS = \
 | 
			
		||||
	theme-helper.c \
 | 
			
		||||
	../../src/theme/theme.c \
 | 
			
		||||
	../../src/theme/theme-dir.c
 | 
			
		||||
	../../src/common/dir.c
 | 
			
		||||
 | 
			
		||||
all:
 | 
			
		||||
	gcc $(CFLAGS) -o theme-helper $(SRCS) $(LDFLAGS)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,8 +4,14 @@ LDFLAGS     += `pkg-config --cflags --libs cairo`
 | 
			
		|||
ASAN        += -fsanitize=address
 | 
			
		||||
 | 
			
		||||
PROGS        = xbm-tokenize xbm-parse
 | 
			
		||||
DEP_TOKENIZE = ../../src/common/buf.c ../../src/theme/xbm/tokenize.c
 | 
			
		||||
DEP_PARSE    = $(DEP_TOKENIZE) ../../src/theme/xbm/parse.c
 | 
			
		||||
 | 
			
		||||
DEP_TOKENIZE = \
 | 
			
		||||
	       ../../src/common/buf.c \
 | 
			
		||||
	       ../../src/theme/xbm/tokenize.c
 | 
			
		||||
 | 
			
		||||
DEP_PARSE    = $(DEP_TOKENIZE) \
 | 
			
		||||
	       ../../src/theme/xbm/parse.c \
 | 
			
		||||
	       ../../src/common/grab-file.c
 | 
			
		||||
 | 
			
		||||
all: $(PROGS)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@
 | 
			
		|||
#include <cairo.h>
 | 
			
		||||
 | 
			
		||||
#include "theme/xbm/parse.h"
 | 
			
		||||
#include "common/grab-file.h"
 | 
			
		||||
 | 
			
		||||
int main(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -14,12 +15,12 @@ int main(int argc, char **argv)
 | 
			
		|||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	char *buffer = xbm_read_file(argv[1]);
 | 
			
		||||
	char *buffer = grab_file(argv[1]);
 | 
			
		||||
	if (!buffer)
 | 
			
		||||
		exit(EXIT_FAILURE);
 | 
			
		||||
	tokens = xbm_tokenize(buffer);
 | 
			
		||||
	tokens = tokenize_xbm(buffer);
 | 
			
		||||
	free(buffer);
 | 
			
		||||
	struct pixmap pixmap = xbm_create_pixmap(tokens);
 | 
			
		||||
	struct pixmap pixmap = parse_xbm_tokens(tokens);
 | 
			
		||||
	free(tokens);
 | 
			
		||||
 | 
			
		||||
	cairo_surface_t *g_surface;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include "buf.h"
 | 
			
		||||
#include "common/buf.h"
 | 
			
		||||
#include "theme/xbm/tokenize.h"
 | 
			
		||||
 | 
			
		||||
/* Read file into buffer, because it's easier to tokenize that way */
 | 
			
		||||
| 
						 | 
				
			
			@ -41,7 +41,7 @@ int main(int argc, char **argv)
 | 
			
		|||
	char *buffer = read_file(argv[1]);
 | 
			
		||||
	if (!buffer)
 | 
			
		||||
		exit(EXIT_FAILURE);
 | 
			
		||||
	tokens = xbm_tokenize(buffer);
 | 
			
		||||
	tokens = tokenize_xbm(buffer);
 | 
			
		||||
	free(buffer);
 | 
			
		||||
	for (struct token *t = tokens; t->type; t++)
 | 
			
		||||
		printf("%s\n", t->name);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue