Add tools to the Workbench Tools menu
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. ToolsMenu - Add tools to the Workbench Tools menu
  3. Copyright (C) 2015, 2018 Kim Fastrup Larsen
  4. This program is free software: you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License
  6. as published by the Free Software Foundation, either ver-
  7. sion 3 of the License, or (at your option) any later version.
  8. This program is distributed in the hope that it will be use-
  9. ful, but WITHOUT ANY WARRANTY; without even the implied war-
  10. ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. See the GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public Li-
  13. cense along with this program. If not, see
  14. <http://www.gnu.org/licenses/>.
  15. The author can be contacted on <kimflarsen@hotmail.com>
  16. */
  17. #include <exec/types.h>
  18. #include <clib/locale_protos.h>
  19. #ifdef USE_PRAGMAS
  20. #include <proto/locale.h>
  21. #endif
  22. #include "catalog.h"
  23. #define CATCOMP_BLOCK
  24. #include "strings.h"
  25. extern struct Library *LocaleBase;
  26. static APTR catalog;
  27. void open_catalog(STRPTR name)
  28. {
  29. if (LocaleBase != NULL)
  30. catalog = OpenCatalog(NULL, name, TAG_DONE);
  31. }
  32. STRPTR get_string(ULONG id)
  33. {
  34. LONG *l;
  35. UWORD *w;
  36. STRPTR built_in;
  37. l = (LONG *) CatCompBlock;
  38. while (*l != id) {
  39. w = (UWORD *) ((ULONG) l + 4);
  40. l = (LONG *) ((ULONG) l + (ULONG) *w + 6);
  41. }
  42. built_in = (STRPTR) ((ULONG) l + 6);
  43. return (catalog != NULL) ? GetCatalogStr(catalog,id,built_in) : built_in;
  44. }
  45. void close_catalog()
  46. {
  47. if (LocaleBase != NULL) {
  48. CloseCatalog(catalog);
  49. catalog = NULL;
  50. }
  51. }