TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: LARRY OLSON 72227,3467 (X)
from: Graham Trott 100115,1075
date: 1993-04-20 14:47:52
subject: #17920-#C_error_help

#: 17944 S12/OS9/68000 (OSK)
    20-Apr-93  14:47:52
Sb: #17920-#C_error_help
Fm: Graham Trott 100115,1075
To: LARRY OLSON 72227,3467 (X)

Larry --

Can I throw in a pennyworth or two?  It's not so difficult breaking up a
program; you quite often have to do it even when you're alreading using a
modular approach, as components get too big.

Simplest way is to start with procedures that are relatively self-contained
(that don't use too many static variables).  Take out a bunch of these, say all
the math ones into "mymath.c" and the string handlers into "mystrings.c" - get
the picture?  It's also a good idea to put all static variables into their own
program module - saves hunting later.  By the time you've done this, each
module will probably be down to a reasonable size.

Next thing is to create "mydefs.h".  Into this go all system #includes,
prototypes for all functions that are known outside their own modules, all
static variables (defined as extern), custom typedefs, etc.  Include this
header at the start of each of your program modules so every module has a
common frame of reference.

Lastly, the make file.  It looks something like this:

# Make file to produce "myprog"

RDIR     =  RELS
ODIR     =  CMDS

LIBDIR   =  /dd/LIB
CFLAGS   =  -ix

DEFDIR   =  /dd/DEFS
HFILES   =  $(DEFDIR)/stdio.h\
            $(DEFDIR)/ctype.h\
            $(DEFDIR)/modes.h\
            $(DEFDIR)/errno.h\
            mydefs.h

RFILES   =  $(RDIR)/myprog.r\
            $(RDIR)/mystatics.r\
            $(RDIR)/mymath.r\
            $(RDIR)/mystrings.r

$(ODIR)/myprog:  $(RFILES)
            cc $(CFLAGS) -fd=$(ODIR)/myprog $(RFILES)

$(RFILES):  $(HFILES)

Save it as "makefile", then all you need to type is "make" to do a full or
partial rebuild as necessary.  The script assumes makefile is in the same
directory as the source files.

-- GT

I just read on and see you've already solved the problem.  Oh well, my fault
for jumping in before finishing reading messages.  Might as well leave it in
now.

There are 2 Replies.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.