/* ToolsMenu - Add tools to the Workbench Tools menu Copyright (C) 2015, 2018 Kim Fastrup Larsen This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either ver- sion 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be use- ful, but WITHOUT ANY WARRANTY; without even the implied war- ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public Li- cense along with this program. If not, see . The author can be contacted on */ #include #include #ifdef USE_PRAGMAS #include #endif #include "catalog.h" #define CATCOMP_BLOCK #include "strings.h" extern struct Library *LocaleBase; static APTR catalog; void open_catalog(STRPTR name) { if (LocaleBase != NULL) catalog = OpenCatalog(NULL, name, TAG_DONE); } STRPTR get_string(ULONG id) { LONG *l; UWORD *w; STRPTR built_in; l = (LONG *) CatCompBlock; while (*l != id) { w = (UWORD *) ((ULONG) l + 4); l = (LONG *) ((ULONG) l + (ULONG) *w + 6); } built_in = (STRPTR) ((ULONG) l + 6); return (catalog != NULL) ? GetCatalogStr(catalog,id,built_in) : built_in; } void close_catalog() { if (LocaleBase != NULL) { CloseCatalog(catalog); catalog = NULL; } }