Skip to content

Commit

Permalink
Move the text, attributes, and contraction tables into subdirectories…
Browse files Browse the repository at this point in the history
…. (dm)
  • Loading branch information
DaveMielke committed May 28, 2014
1 parent 55be271 commit 983b002
Show file tree
Hide file tree
Showing 163 changed files with 152 additions and 33 deletions.
25 changes: 15 additions & 10 deletions Programs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ ttb_translate.$O:
$(CC) $(LIBCFLAGS) -c $(SRC_DIR)/ttb_translate.c

check-text-tables: brltty-ttb$X
for file in $(SRC_TOP)$(TBL_DIR)/*.ttb; do LD_LIBRARY_PATH=$(BLD_DIR) ./brltty-ttb$X -T$(SRC_TOP)$(TBL_DIR) $$file; done
for file in $(SRC_TOP)$(TBL_DIR)/$(TEXT_TABLE_SUBDIRECTORY)/*$(TEXT_TABLE_EXTENSION); do LD_LIBRARY_PATH=$(BLD_DIR) ./brltty-ttb$X -T$(SRC_TOP)$(TBL_DIR) $$file; done

###############################################################################

Expand Down Expand Up @@ -725,11 +725,11 @@ screen-drivers:

###############################################################################

TEXT_TABLE_FILE = $(SRC_TOP)$(TBL_DIR)/$(TEXT_TABLE).ttb
TEXT_TABLE_FILE = $(SRC_TOP)$(TBL_DIR)/$(TEXT_TABLE_SUBDIRECTORY)/$(TEXT_TABLE)$(TEXT_TABLE_EXTENSION)
text.auto.h: $(TEXT_TABLE_FILE) tbl2hex$(X_FOR_BUILD)
./tbl2hex$(X_FOR_BUILD) -- $(TEXT_TABLE_FILE) >$@

ATTRIBUTES_TABLE_FILE = $(SRC_TOP)$(TBL_DIR)/$(ATTRIBUTES_TABLE).atb
ATTRIBUTES_TABLE_FILE = $(SRC_TOP)$(TBL_DIR)/$(ATTRIBUTES_TABLE_SUBDIRECTORY)/$(ATTRIBUTES_TABLE)$(ATTRIBUTES_TABLE_EXTENSION)
attr.auto.h: $(ATTRIBUTES_TABLE_FILE) tbl2hex$(X_FOR_BUILD)
./tbl2hex$(X_FOR_BUILD) -- $(ATTRIBUTES_TABLE_FILE) >$@

Expand Down Expand Up @@ -795,14 +795,16 @@ install-xbrlapi: xbrlapi$X install-program-directory install-gdm-autostart-direc

install-tables: $(INSTALL_TEXT_TABLES) $(INSTALL_ATTRIBUTES_TABLES) $(INSTALL_CONTRACTION_TABLES) install-key-tables install-help-files

install-text-tables: install-tables-directory
$(INSTALL_DATA) $(SRC_TOP)$(TBL_DIR)/*.tt[bi] $(INSTALL_TABLES_DIRECTORY)
install-text-tables: install-text-tables-directory
$(INSTALL_DATA) $(SRC_TOP)$(TBL_DIR)/$(TEXT_TABLE_SUBDIRECTORY)/*$(TEXT_TABLE_EXTENSION) $(INSTALL_TEXT_TABLES_DIRECTORY)
$(INSTALL_DATA) $(SRC_TOP)$(TBL_DIR)/$(TEXT_TABLE_SUBDIRECTORY)/*$(TEXT_SUBTABLE_EXTENSION) $(INSTALL_TEXT_TABLES_DIRECTORY)

install-attributes-tables: install-tables-directory
$(INSTALL_DATA) $(SRC_TOP)$(TBL_DIR)/*.at[bi] $(INSTALL_TABLES_DIRECTORY)
install-attributes-tables: install-attributes-tables-directory
$(INSTALL_DATA) $(SRC_TOP)$(TBL_DIR)/$(ATTRIBUTES_TABLE_SUBDIRECTORY)/*$(ATTRIBUTES_TABLE_EXTENSION) $(INSTALL_ATTRIBUTES_TABLES_DIRECTORY)

install-contraction-tables: install-tables-directory
$(INSTALL_DATA) $(SRC_TOP)$(TBL_DIR)/*.ct[bi] $(INSTALL_TABLES_DIRECTORY)
install-contraction-tables: install-contraction-tables-directory
$(INSTALL_DATA) $(SRC_TOP)$(TBL_DIR)/$(CONTRACTION_TABLE_SUBDIRECTORY)/*$(CONTRACTION_TABLE_EXTENSION) $(INSTALL_CONTRACTION_TABLES_DIRECTORY)
$(INSTALL_DATA) $(SRC_TOP)$(TBL_DIR)/$(CONTRACTION_TABLE_SUBDIRECTORY)/*$(CONTRACTION_SUBTABLE_EXTENSION) $(INSTALL_CONTRACTION_TABLES_DIRECTORY)

install-key-tables: install-tables-directory
$(INSTALL_DATA) $(SRC_TOP)$(TBL_DIR)/*.kt[bi] $(INSTALL_TABLES_DIRECTORY)
Expand Down Expand Up @@ -902,7 +904,10 @@ uninstall-programs:
-rm -f $(INSTALL_GDM_AUTOSTART_DIRECTORY)/xbrlapi.desktop

uninstall-tables:
-rm -f $(INSTALL_TABLES_DIRECTORY)/*.[tack]t[bi]
-rm -f -r $(INSTALL_TEXT_TABLES_DIRECTORY)
-rm -f -r $(INSTALL_ATTRIBUTES_TABLES_DIRECTORY)
-rm -f -r $(INSTALL_CONTRACTION_TABLES_DIRECTORY)
-rm -f $(INSTALL_TABLES_DIRECTORY)/*.[k]t[bi]
-rm -f $(INSTALL_TABLES_DIRECTORY)/brl-*.txt
-[ ! -d $(INSTALL_WRITABLE_DIRECTORY) ] || rmdir $(INSTALL_WRITABLE_DIRECTORY)
-[ ! -d $(INSTALL_TABLES_DIRECTORY) ] || rmdir $(INSTALL_TABLES_DIRECTORY)
Expand Down
11 changes: 10 additions & 1 deletion Programs/atb_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,14 @@ ensureAttributesTableExtension (const char *path) {

char *
makeAttributesTablePath (const char *directory, const char *name) {
return makeFilePath(directory, name, ATTRIBUTES_TABLE_EXTENSION);
char *subdirectory = makePath(directory, ATTRIBUTES_TABLE_SUBDIRECTORY);

if (subdirectory) {
char *file = makeFilePath(subdirectory, name, ATTRIBUTES_TABLE_EXTENSION);

free(subdirectory);
if (file) return file;
}

return NULL;
}
11 changes: 10 additions & 1 deletion Programs/ctb_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,5 +705,14 @@ ensureContractionTableExtension (const char *path) {

char *
makeContractionTablePath (const char *directory, const char *name) {
return makeFilePath(directory, name, CONTRACTION_TABLE_EXTENSION);
char *subdirectory = makePath(directory, CONTRACTION_TABLE_SUBDIRECTORY);

if (subdirectory) {
char *file = makeFilePath(subdirectory, name, CONTRACTION_TABLE_EXTENSION);

free(subdirectory);
if (file) return file;
}

return NULL;
}
25 changes: 17 additions & 8 deletions Programs/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "parse.h"

typedef struct {
const char *directory;
char *directory;
const char *extension;
const char *pattern;
char *initial;
Expand Down Expand Up @@ -531,7 +531,7 @@ static const MenuItemMethods menuItemMethods_files = {
MenuItem *
newFilesMenuItem (
Menu *menu, const MenuString *name,
const char *directory, const char *extension,
const char *directory, const char *subdirectory, const char *extension,
const char *initial, int none
) {
FileData *files;
Expand All @@ -540,7 +540,6 @@ newFilesMenuItem (
char *pattern;

memset(files, 0, sizeof(*files));
files->directory = directory;
files->extension = extension;
files->none = !!none;

Expand All @@ -554,12 +553,22 @@ newFilesMenuItem (

if ((files->initial = *initial? ensureFileExtension(initial, extension): strdup(""))) {
if ((files->current = strdup(files->initial))) {
MenuItem *item = newMenuItem(menu, &files->setting, name);
if (subdirectory) {
files->directory = makePath(directory, subdirectory);
} else if (!(files->directory = strdup(directory))) {
logMallocError();
}

if (files->directory) {
MenuItem *item = newMenuItem(menu, &files->setting, name);

if (item) {
item->methods = &menuItemMethods_files;
item->data.files = files;
return item;
}

if (item) {
item->methods = &menuItemMethods_files;
item->data.files = files;
return item;
free(files->directory);
}

free(files->current);
Expand Down
2 changes: 1 addition & 1 deletion Programs/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extern MenuItem *newBooleanMenuItem (Menu *menu, unsigned char *setting, const M

extern MenuItem *newFilesMenuItem (
Menu *menu, const MenuString *name,
const char *directory, const char *extension,
const char *directory, const char *subdirectory, const char *extension,
const char *initial, int none
);

Expand Down
6 changes: 3 additions & 3 deletions Programs/menu_prefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,20 +1020,20 @@ makePreferencesMenu (void) {

{
NAME(strtext("Text Table"));
ITEM(newFilesMenuItem(tablesSubmenu, &itemName, opt_tablesDirectory, TEXT_TABLE_EXTENSION, opt_textTable, 0));
ITEM(newFilesMenuItem(tablesSubmenu, &itemName, opt_tablesDirectory, TEXT_TABLE_SUBDIRECTORY, TEXT_TABLE_EXTENSION, opt_textTable, 0));
CHANGED(TextTable);
}

{
NAME(strtext("Attributes Table"));
ITEM(newFilesMenuItem(tablesSubmenu, &itemName, opt_tablesDirectory, ATTRIBUTES_TABLE_EXTENSION, opt_attributesTable, 0));
ITEM(newFilesMenuItem(tablesSubmenu, &itemName, opt_tablesDirectory, ATTRIBUTES_TABLE_SUBDIRECTORY, ATTRIBUTES_TABLE_EXTENSION, opt_attributesTable, 0));
CHANGED(AttributesTable);
}

#ifdef ENABLE_CONTRACTED_BRAILLE
{
NAME(strtext("Contraction Table"));
ITEM(newFilesMenuItem(tablesSubmenu, &itemName, opt_tablesDirectory, CONTRACTION_TABLE_EXTENSION, opt_contractionTable, 1));
ITEM(newFilesMenuItem(tablesSubmenu, &itemName, opt_tablesDirectory, CONTRACTION_TABLE_SUBDIRECTORY, CONTRACTION_TABLE_EXTENSION, opt_contractionTable, 1));
CHANGED(ContractionTable);
}
#endif /* ENABLE_CONTRACTED_BRAILLE */
Expand Down
11 changes: 10 additions & 1 deletion Programs/ttb_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,16 @@ ensureTextTableExtension (const char *path) {

char *
makeTextTablePath (const char *directory, const char *name) {
return makeFilePath(directory, name, TEXT_TABLE_EXTENSION);
char *subdirectory = makePath(directory, TEXT_TABLE_SUBDIRECTORY);

if (subdirectory) {
char *file = makeFilePath(subdirectory, name, TEXT_TABLE_EXTENSION);

free(subdirectory);
if (file) return file;
}

return NULL;
}

static int
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ $1="`echo "${$1}" | sed -e 's/^ *//' -e 's/ *$//'`"
AC_DEFUN([BRLTTY_VAR_EXPAND], [dnl
eval '$1="'"$2"'"'])

AC_DEFUN([BRLTTY_DEFINE_STRING], [dnl
AC_SUBST([$1], [$2])
AC_DEFINE([$1], ["$2"], [Define this to be a string containing $3.])
])

AC_DEFUN([BRLTTY_DEFINE_EXPANDED], [dnl
BRLTTY_VAR_EXPAND([brltty_expanded], [$2])
AC_DEFINE_UNQUOTED([$1], ["${brltty_expanded}"], [$3])])
Expand Down
12 changes: 12 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ INSTALL_TABLES_DIRECTORY = $(INSTALL_ROOT)$(TABLES_DIRECTORY)
install-tables-directory:
$(INSTALL_DIRECTORY) $(INSTALL_TABLES_DIRECTORY)

INSTALL_TEXT_TABLES_DIRECTORY = $(INSTALL_TABLES_DIRECTORY)/$(TEXT_TABLE_SUBDIRECTORY)
install-text-tables-directory:
$(INSTALL_DIRECTORY) $(INSTALL_TEXT_TABLES_DIRECTORY)

INSTALL_ATTRIBUTES_TABLES_DIRECTORY = $(INSTALL_TABLES_DIRECTORY)/$(ATTRIBUTES_TABLE_SUBDIRECTORY)
install-attributes-tables-directory:
$(INSTALL_DIRECTORY) $(INSTALL_ATTRIBUTES_TABLES_DIRECTORY)

INSTALL_CONTRACTION_TABLES_DIRECTORY = $(INSTALL_TABLES_DIRECTORY)/$(CONTRACTION_TABLE_SUBDIRECTORY)
install-contraction-tables-directory:
$(INSTALL_DIRECTORY) $(INSTALL_CONTRACTION_TABLES_DIRECTORY)

INSTALL_LOCALE_DIRECTORY = $(INSTALL_ROOT)$(localedir)
install-locale-directory:
$(INSTALL_DIRECTORY) $(INSTALL_LOCALE_DIRECTORY)
Expand Down
43 changes: 35 additions & 8 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -504,17 +504,44 @@ extern "C" {
/* Define this if the function atspi_get_a11y_bus exists in atspi2. */
#undef HAVE_ATSPI_GET_A11Y_BUS

#define TEXT_TABLE_EXTENSION ".ttb"
#define TEXT_SUBTABLE_EXTENSION ".tti"
/* Define this to be a string containing the subdirectory for text tables. */
#undef TEXT_TABLE_SUBDIRECTORY

#define ATTRIBUTES_TABLE_EXTENSION ".atb"
#define ATTRIBUTES_SUBTABLE_EXTENSION ".ati"
/* Define this to be a string containing the extension for text tables. */
#undef TEXT_TABLE_EXTENSION

#define CONTRACTION_TABLE_EXTENSION ".ctb"
#define CONTRACTION_SUBTABLE_EXTENSION ".cti"
/* Define this to be a string containing the extension for text subtables. */
#undef TEXT_SUBTABLE_EXTENSION

#define KEY_TABLE_EXTENSION ".ktb"
#define KEY_SUBTABLE_EXTENSION ".kti"
/* Define this to be a string containing the subdirectory for attributes tables. */
#undef ATTRIBUTES_TABLE_SUBDIRECTORY

/* Define this to be a string containing the extension for attributes tables. */
#undef ATTRIBUTES_TABLE_EXTENSION

/* Define this to be a string containing the extension for attributes subtables. */
#undef ATTRIBUTES_SUBTABLE_EXTENSION

/* Define this to be a string containing the subdirectory for contraction tables. */
#undef CONTRACTION_TABLE_SUBDIRECTORY

/* Define this to be a string containing the extension for contraction tables. */
#undef CONTRACTION_TABLE_EXTENSION

/* Define this to be a string containing the extension for contraction subtables. */
#undef CONTRACTION_SUBTABLE_EXTENSION

/* Define this to be a string containing the subdirectory for keyboard key tables. */
#undef KEYBOARD_KEY_TABLE_SUBDIRECTORY

/* Define this to be a string containing the subdirectory for braille device key tables. */
#undef BRAILLE_KEY_TABLE_SUBDIRECTORY

/* Define this to be a string containing the extension for key tables. */
#undef KEY_TABLE_EXTENSION

/* Define this to be a string containing the extension for key subtables. */
#undef KEY_SUBTABLE_EXTENSION

#ifdef __cplusplus
}
Expand Down
17 changes: 17 additions & 0 deletions config.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,23 @@ GDM_AUTOSTART_DIRECTORY = @gdm_autostart_directory@

MANUAL_DIRECTORIES = @brltty_manual_directories@

TEXT_TABLE_SUBDIRECTORY = @TEXT_TABLE_SUBDIRECTORY@
TEXT_TABLE_EXTENSION = @TEXT_TABLE_EXTENSION@
TEXT_SUBTABLE_EXTENSION = @TEXT_SUBTABLE_EXTENSION@

ATTRIBUTES_TABLE_SUBDIRECTORY = @ATTRIBUTES_TABLE_SUBDIRECTORY@
ATTRIBUTES_TABLE_EXTENSION = @ATTRIBUTES_TABLE_EXTENSION@
ATTRIBUTES_SUBTABLE_EXTENSION = @ATTRIBUTES_SUBTABLE_EXTENSION@

CONTRACTION_TABLE_SUBDIRECTORY = @CONTRACTION_TABLE_SUBDIRECTORY@
CONTRACTION_TABLE_EXTENSION = @CONTRACTION_TABLE_EXTENSION@
CONTRACTION_SUBTABLE_EXTENSION = @CONTRACTION_SUBTABLE_EXTENSION@

KEYBOARD_KEY_TABLE_SUBDIRECTORY = @KEYBOARD_KEY_TABLE_SUBDIRECTORY@
BRAILLE_KEY_TABLE_SUBDIRECTORY = @BRAILLE_KEY_TABLE_SUBDIRECTORY@
KEY_TABLE_EXTENSION = @KEY_TABLE_EXTENSION@
KEY_SUBTABLE_EXTENSION = @KEY_SUBTABLE_EXTENSION@

BRAILLE_DRIVER_CODES = @brltty_item_codes_braille@
BRAILLE_DRIVER_NAMES = @brltty_item_names_braille@
BRAILLE_INTERNAL_DRIVER_CODES = @brltty_internal_codes_braille@
Expand Down
17 changes: 17 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,23 @@ BRLTTY_ARG_REQUIRED(
[tables_directory], ["${sysconfdir}/${PACKAGE_TARNAME}"]
)

BRLTTY_DEFINE_STRING([TEXT_TABLE_SUBDIRECTORY], [Text], [the subdirectory for text tables])
BRLTTY_DEFINE_STRING([TEXT_TABLE_EXTENSION], [.ttb], [the extension for text tables])
BRLTTY_DEFINE_STRING([TEXT_SUBTABLE_EXTENSION], [.tti], [the extension for text subtables])

BRLTTY_DEFINE_STRING([ATTRIBUTES_TABLE_SUBDIRECTORY], [Attributes], [the subdirectory for attributes tables])
BRLTTY_DEFINE_STRING([ATTRIBUTES_TABLE_EXTENSION], [.atb], [the extension for attributes tables])
BRLTTY_DEFINE_STRING([ATTRIBUTES_SUBTABLE_EXTENSION], [.ati], [the extension for attributes subtables])

BRLTTY_DEFINE_STRING([CONTRACTION_TABLE_SUBDIRECTORY], [Contraction], [the subdirectory for contraction tables])
BRLTTY_DEFINE_STRING([CONTRACTION_TABLE_EXTENSION], [.ctb], [the extension for contraction tables])
BRLTTY_DEFINE_STRING([CONTRACTION_SUBTABLE_EXTENSION], [.cti], [the extension for contraction subtables])

BRLTTY_DEFINE_STRING([KEYBOARD_KEY_TABLE_SUBDIRECTORY], [Keyboard], [the subdirectory for keyboard key tables])
BRLTTY_DEFINE_STRING([BRAILLE_KEY_TABLE_SUBDIRECTORY], [Braille], [the subdirectory for braille device key tables])
BRLTTY_DEFINE_STRING([KEY_TABLE_EXTENSION], [.ktb], [the extension for key tables])
BRLTTY_DEFINE_STRING([KEY_SUBTABLE_EXTENSION], [.kti], [the extension for key subtables])

BRLTTY_ARG_REQUIRED(
[manpage-directory], [DIRECTORY],
[path to directory containing manual pages],
Expand Down

0 comments on commit 983b002

Please sign in to comment.