home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 106 / EnigmaAmiga106CD.iso / software / sviluppo / ahisrc / ahi / ahiprefs_cat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-09-11  |  6.5 KB  |  253 lines

  1. /****************************************************************
  2.    This file was created automatically by `FlexCat 1.9'
  3.    from "./ahiprefs.cd".
  4.  
  5.    Do NOT edit by hand!
  6. ****************************************************************/
  7.  
  8. /*
  9.     Include files and compiler specific stuff
  10. */
  11. #include <exec/memory.h>
  12. #include <libraries/locale.h>
  13. #include <libraries/iffparse.h>
  14.  
  15. #include <proto/exec.h>
  16. #include <proto/dos.h>
  17. #include <proto/locale.h>
  18. #include <proto/utility.h>
  19. #include <proto/iffparse.h>
  20.  
  21. #include <stdlib.h>
  22. #include <string.h>
  23.  
  24.  
  25.  
  26. #include "ahiprefs_Cat.h"
  27.  
  28.  
  29. /*
  30.     Variables
  31. */
  32. struct FC_String ahiprefs_Strings[63] = {
  33.     { (STRPTR) "\000Project", 0 },
  34.     { (STRPTR) "O\000Open...", 1 },
  35.     { (STRPTR) "A\000Save As...", 2 },
  36.     { (STRPTR) "?\000About...", 3 },
  37.     { (STRPTR) "Q\000Quit", 4 },
  38.     { (STRPTR) "\000Edit", 5 },
  39.     { (STRPTR) "D\000Reset To Defaults", 6 },
  40.     { (STRPTR) "L\000Last Saved", 7 },
  41.     { (STRPTR) "R\000Restore", 8 },
  42.     { (STRPTR) "\000Settings", 9 },
  43.     { (STRPTR) "I\000Create Icons?", 10 },
  44.     { (STRPTR) "\000Help", 11 },
  45.     { (STRPTR) "Help\000Help...", 12 },
  46.     { (STRPTR) "H\000AHI User's guide...", 13 },
  47.     { (STRPTR) "\000Concept Index...", 14 },
  48.     { (STRPTR) "Mode settings", 15 },
  49.     { (STRPTR) "Advanced settings", 16 },
  50.     { (STRPTR) "Unit %ld", 17 },
  51.     { (STRPTR) "Music unit", 18 },
  52.     { (STRPTR) "Mode ID\nRecording\nAuthor\nCopyright\nDriver\nVersion", 19 },
  53.     { (STRPTR) "Full duplex", 20 },
  54.     { (STRPTR) "Half duplex", 21 },
  55.     { (STRPTR) "Nope", 22 },
  56.     { (STRPTR) "Options", 23 },
  57.     { (STRPTR) "_Frequency", 24 },
  58.     { (STRPTR) "C_hannels", 25 },
  59.     { (STRPTR) "", 26 },
  60.     { (STRPTR) "_Volume", 27 },
  61.     { (STRPTR) "_Monitor", 28 },
  62.     { (STRPTR) "_Gain", 29 },
  63.     { (STRPTR) "Muted", 30 },
  64.     { (STRPTR) "_Input", 31 },
  65.     { (STRPTR) "No inputs", 32 },
  66.     { (STRPTR) "_Output", 33 },
  67.     { (STRPTR) "No outputs", 34 },
  68.     { (STRPTR) "Global options", 35 },
  69.     { (STRPTR) "_Debug level", 36 },
  70.     { (STRPTR) "_Echo", 37 },
  71.     { (STRPTR) "Surround in \"_Fast\" modes", 38 },
  72.     { (STRPTR) "CPU usage _limit", 39 },
  73.     { (STRPTR) "None", 40 },
  74.     { (STRPTR) "Low", 41 },
  75.     { (STRPTR) "High", 42 },
  76.     { (STRPTR) "Full", 43 },
  77.     { (STRPTR) "Enabled", 44 },
  78.     { (STRPTR) "Fast", 45 },
  79.     { (STRPTR) "Disabled", 46 },
  80.     { (STRPTR) "Enabled", 47 },
  81.     { (STRPTR) "Disabled", 48 },
  82.     { (STRPTR) "_Save", 49 },
  83.     { (STRPTR) "_Use", 50 },
  84.     { (STRPTR) "_Cancel", 51 },
  85.     { (STRPTR) "OK", 52 },
  86.     { (STRPTR) "AHI preferences", 53 },
  87.     { (STRPTR) "%s%s\nCopyright ©%s", 54 },
  88.     { (STRPTR) "Unable to open window.", 55 },
  89.     { (STRPTR) "Unable to allocate file requester.", 56 },
  90.     { (STRPTR) "Unable to find `%s'!", 57 },
  91.     { (STRPTR) "Unable to open `%s´ version %ld.", 58 },
  92.     { (STRPTR) "_Master volume", 59 },
  93.     { (STRPTR) "Without clipping", 60 },
  94.     { (STRPTR) "With clipping", 61 },
  95.     { (STRPTR) "Default anti-click time", 62 }
  96. };
  97.  
  98. STATIC struct Catalog *ahiprefsCatalog = NULL;
  99. #ifdef LOCALIZE_V20
  100. STATIC STRPTR ahiprefsStrings = NULL;
  101. STATIC ULONG ahiprefsStringsSize;
  102. #endif
  103.  
  104.  
  105. VOID CloseahiprefsCatalog(VOID)
  106.  
  107. {
  108.     if (ahiprefsCatalog) {
  109.     CloseCatalog(ahiprefsCatalog);
  110.     }
  111. #ifdef LOCALIZE_V20
  112.     if (ahiprefsStrings) {
  113.     FreeMem(ahiprefsStrings, ahiprefsStringsSize);
  114.     }
  115. #endif
  116. }
  117.  
  118.  
  119. VOID OpenahiprefsCatalog(VOID)
  120.  
  121. {
  122.     if (LocaleBase) {
  123.     if ((ahiprefsCatalog = OpenCatalog(NULL, (STRPTR) "ahiprefs.catalog",
  124.                      OC_BuiltInLanguage, "english",
  125.                      OC_Version, 4,
  126.                      TAG_DONE))) {
  127.         struct FC_String *fc;
  128.         int i;
  129.  
  130.         for (i = 0, fc = ahiprefs_Strings;  i < 63;  i++, fc++) {
  131.          fc->msg = GetCatalogStr(ahiprefsCatalog, fc->id, (STRPTR) fc->msg);
  132.         }
  133.     }
  134.     }
  135. }
  136.  
  137.  
  138. #ifdef LOCALIZE_V20
  139. VOID InitahiprefsCatalog(STRPTR language)
  140.  
  141. {
  142.     struct IFFHandle *iffHandle;
  143.  
  144.     /*
  145.     **  Use iffparse.library only, if we need to.
  146.     */
  147.     if (LocaleBase  ||  !IFFParseBase  ||  !language  ||
  148.     Stricmp(language, "english") == 0) {
  149.     return;
  150.     }
  151.  
  152.     if ((iffHandle = AllocIFF())) {
  153.     char path[128]; /* Enough to hold 4 path items (dos.library 3.1)    */
  154.     strcpy(path, "PROGDIR:Catalogs");
  155.     AddPart((STRPTR) path, language, sizeof(path));
  156.     AddPart((STRPTR) path, "ahiprefs.catalog", sizeof(path));
  157.     if (!(iffHandle->iff_Stream = Open((STRPTR) path, MODE_OLDFILE))) {
  158.         strcpy(path, "LOCALE:Catalogs");
  159.         AddPart((STRPTR) path, language, sizeof(path));
  160.         AddPart((STRPTR) path, language, sizeof(path));
  161.         iffHandle->iff_Stream = Open((STRPTR) path, MODE_OLDFILE);
  162.     }
  163.  
  164.     if (iffHandle->iff_Stream) {
  165.         InitIFFasDOS(iffHandle);
  166.         if (!OpenIFF(iffHandle, IFFF_READ)) {
  167.         if (!PropChunk(iffHandle, MAKE_ID('C','T','L','G'),
  168.                    MAKE_ID('S','T','R','S'))) {
  169.             struct StoredProperty *sp;
  170.             int error;
  171.  
  172.             for (;;) {
  173.             if ((error = ParseIFF(iffHandle, IFFPARSE_STEP))
  174.                    ==  IFFERR_EOC) {
  175.                 continue;
  176.             }
  177.             if (error) {
  178.                 break;
  179.             }
  180.  
  181.             if ((sp = FindProp(iffHandle, MAKE_ID('C','T','L','G'),
  182.                        MAKE_ID('S','T','R','S')))) {
  183.                 /*
  184.                 **  Check catalog and calculate the needed
  185.                 **  number of bytes.
  186.                 **  A catalog string consists of
  187.                 **      ID (LONG)
  188.                 **      Size (LONG)
  189.                 **      Bytes (long word padded)
  190.                 */
  191.                 LONG bytesRemaining;
  192.                 LONG *ptr;
  193.  
  194.                 ahiprefsStringsSize = 0;
  195.                 bytesRemaining = sp->sp_Size;
  196.                 ptr = (LONG *) sp->sp_Data;
  197.  
  198.                 while (bytesRemaining > 0) {
  199.                 LONG skipSize, stringSize;
  200.  
  201.                 ptr++;                  /*  Skip ID     */
  202.                 stringSize = *ptr++;
  203.                 skipSize = ((stringSize+3) >> 2);
  204.  
  205.                 ahiprefsStringsSize += stringSize+1;  /*  NUL */
  206.                 bytesRemaining -= 8 + (skipSize << 2);
  207.                 ptr += skipSize;
  208.                 }
  209.  
  210.                 if (!bytesRemaining  &&
  211.                 (ahiprefsStrings = AllocMem(ahiprefsStringsSize, MEMF_ANY))) {
  212.                 STRPTR sptr;
  213.  
  214.                 bytesRemaining = sp->sp_Size;
  215.                 ptr = (LONG *) sp->sp_Data;
  216.                 sptr = ahiprefsStrings;
  217.  
  218.                 while (bytesRemaining) {
  219.                     LONG skipSize, stringSize, id;
  220.                     struct FC_String *fc;
  221.                     int i;
  222.  
  223.                     id = *ptr++;
  224.                     stringSize = *ptr++;
  225.                     skipSize = ((stringSize+3) >> 2);
  226.  
  227.                     CopyMem(ptr, sptr, stringSize);
  228.                     bytesRemaining -= 8 + (skipSize << 2);
  229.                     ptr += skipSize;
  230.  
  231.                     for (i = 0, fc = ahiprefs_Strings;  i < 63;  i++, fc++) {
  232.                     if (fc->id == id) {
  233.                         fc->msg = sptr;
  234.                     }
  235.                     }
  236.  
  237.                     sptr += stringSize;
  238.                     *sptr++ = '\0';
  239.                 }
  240.                 }
  241.                 break;
  242.             }
  243.             }
  244.         }
  245.         CloseIFF(iffHandle);
  246.         }
  247.         Close(iffHandle->iff_Stream);
  248.     }
  249.     FreeIFF(iffHandle);
  250.     }
  251. }
  252. #endif
  253.