www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/10/18:26:39

From: "Andrew Davidson" <andrew AT lemure DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: How do I set up predefined structures?
Date: Tue, 10 Aug 1999 03:03:30 +0100
Organization: Customer of Planet Online
Lines: 56
Message-ID: <7oo1aa$cmh$1@news7.svr.pol.co.uk>
NNTP-Posting-Host: modem-8.samarium.dialup.pol.co.uk
X-Trace: news7.svr.pol.co.uk 934250634 13009 62.136.30.136 (10 Aug 1999 02:03:54 GMT)
NNTP-Posting-Date: 10 Aug 1999 02:03:54 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm trying to set up a set of predefined structures for a C based emulator
I'm writing using GCC and Allegro. It's intended to allow easy definitions
of ROM loading information and the overall description of each of the ROM
sub-sets (there are 3 sub-sets in every game: program, tile, and sprite) is
NULL terminated because it can vary in length:

These make up the basic structures:

typedef struct rom_double {
    char *file1,*file2;
    int length;
}

typedef struct rom_triple {
    char *file1,*file2,*file3;
    int length;
};

struct rom_map {
    rom_double *program_roms;
    rom_triple *tile_roms;
    rom_double *sprite_roms;
};

As an example of a simple predefined structure:

struct rom_map game1_map = {
    {    /* program roms */
        {"progrom1a","progrom1b",65536},
        {"progrom2a","progrom2b",65536},
        {NULL, NULL, 0}
    },

    {    /* tile roms */
        {"tilerom1a","tilerom1b","tilerom1c",65536},
        {NULL, NULL, NULL, 0}
    },

    {    /* sprite roms */
        {"spriterom1a","spriterom1b",65536},
        {"spriterom2a","spriterom2b",65536},
        {"spriterom3a","spriterom3b",65536},
        {"spriterom4a","spriterom4b",65536},
        {NULL, NULL, 0}
    }
};


However, when I compile it tons of warnings are generated, so I'm obviously
doing something hideously wrong, but I can't see what.

Thanks for any help,

Andrew


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019