Home » Archimedes archive » Acorn User » AU 1997-01 B.adf » Features » Arcade/!Popcorn/c/FindRes

Arcade/!Popcorn/c/FindRes

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-01 B.adf » Features
Filename: Arcade/!Popcorn/c/FindRes
Read OK:
File size: 015B bytes
Load address: 0000
Exec address: 0000
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
#include <string.h>

#include "Popcorn:h.Popcorn"

void **Popcorn_FindResource(char *res_name)
{
  int       c = 0;

  while (c != resource_free)
  {
    if (strcmp(resource[c]->file, res_name) == 0)
    {
/*       printf("%X %s", resource[c]->addr, resource[c]->file); */
      return(&(resource[c]->addr));
    }
    c++;
  }

  return(NULL);
}
00000000  23 69 6e 63 6c 75 64 65  20 3c 73 74 72 69 6e 67  |#include <string|
00000010  2e 68 3e 0a 0a 23 69 6e  63 6c 75 64 65 20 22 50  |.h>..#include "P|
00000020  6f 70 63 6f 72 6e 3a 68  2e 50 6f 70 63 6f 72 6e  |opcorn:h.Popcorn|
00000030  22 0a 0a 76 6f 69 64 20  2a 2a 50 6f 70 63 6f 72  |"..void **Popcor|
00000040  6e 5f 46 69 6e 64 52 65  73 6f 75 72 63 65 28 63  |n_FindResource(c|
00000050  68 61 72 20 2a 72 65 73  5f 6e 61 6d 65 29 0a 7b  |har *res_name).{|
00000060  0a 20 20 69 6e 74 20 20  20 20 20 20 20 63 20 3d  |.  int       c =|
00000070  20 30 3b 0a 0a 20 20 77  68 69 6c 65 20 28 63 20  | 0;..  while (c |
00000080  21 3d 20 72 65 73 6f 75  72 63 65 5f 66 72 65 65  |!= resource_free|
00000090  29 0a 20 20 7b 0a 20 20  20 20 69 66 20 28 73 74  |).  {.    if (st|
000000a0  72 63 6d 70 28 72 65 73  6f 75 72 63 65 5b 63 5d  |rcmp(resource[c]|
000000b0  2d 3e 66 69 6c 65 2c 20  72 65 73 5f 6e 61 6d 65  |->file, res_name|
000000c0  29 20 3d 3d 20 30 29 0a  20 20 20 20 7b 0a 2f 2a  |) == 0).    {./*|
000000d0  20 20 20 20 20 20 20 70  72 69 6e 74 66 28 22 25  |       printf("%|
000000e0  58 20 25 73 22 2c 20 72  65 73 6f 75 72 63 65 5b  |X %s", resource[|
000000f0  63 5d 2d 3e 61 64 64 72  2c 20 72 65 73 6f 75 72  |c]->addr, resour|
00000100  63 65 5b 63 5d 2d 3e 66  69 6c 65 29 3b 20 2a 2f  |ce[c]->file); */|
00000110  0a 20 20 20 20 20 20 72  65 74 75 72 6e 28 26 28  |.      return(&(|
00000120  72 65 73 6f 75 72 63 65  5b 63 5d 2d 3e 61 64 64  |resource[c]->add|
00000130  72 29 29 3b 0a 20 20 20  20 7d 0a 20 20 20 20 63  |r));.    }.    c|
00000140  2b 2b 3b 0a 20 20 7d 0a  0a 20 20 72 65 74 75 72  |++;.  }..  retur|
00000150  6e 28 4e 55 4c 4c 29 3b  0a 7d 0a                 |n(NULL);.}.|
0000015b