diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-22 14:33:37 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-22 14:33:37 +0000 |
commit | b501a54cf959bc549810fb24ca6f9584dc5c9cf3 (patch) | |
tree | b78fbbc5c0f6959529f2553e3bbb83b077eaa17c /dmake/mac | |
parent | 17e0108b4e8d91f9acfe376ee231418830392460 (diff) |
initial import
Diffstat (limited to 'dmake/mac')
-rw-r--r-- | dmake/mac/arlib.c | 56 | ||||
-rw-r--r-- | dmake/mac/bogus.c | 99 | ||||
-rw-r--r-- | dmake/mac/config.mk | 44 | ||||
-rw-r--r-- | dmake/mac/dirbrk.c | 42 | ||||
-rw-r--r-- | dmake/mac/directry.c | 264 | ||||
-rw-r--r-- | dmake/mac/dompwmak | 67 | ||||
-rw-r--r-- | dmake/mac/environ.c | 231 | ||||
-rw-r--r-- | dmake/mac/eold.c | 119 | ||||
-rw-r--r-- | dmake/mac/main.c | 43 | ||||
-rw-r--r-- | dmake/mac/make.sh | 107 | ||||
-rw-r--r-- | dmake/mac/make_mac.sh | 105 | ||||
-rw-r--r-- | dmake/mac/public.h | 172 | ||||
-rw-r--r-- | dmake/mac/rmprq.c | 38 | ||||
-rw-r--r-- | dmake/mac/ruletab.c | 43 | ||||
-rw-r--r-- | dmake/mac/startup.h | 28 | ||||
-rw-r--r-- | dmake/mac/sysintf.h | 42 | ||||
-rw-r--r-- | dmake/mac/template.mk | 7 | ||||
-rw-r--r-- | dmake/mac/tempnam.c | 65 | ||||
-rw-r--r-- | dmake/mac/tomacfil.c | 38 |
19 files changed, 1610 insertions, 0 deletions
diff --git a/dmake/mac/arlib.c b/dmake/mac/arlib.c new file mode 100644 index 000000000000..2f06bca68f9e --- /dev/null +++ b/dmake/mac/arlib.c @@ -0,0 +1,56 @@ +/* RCS $Id: arlib.c,v 1.1.1.1 2000-09-22 15:33:26 hr Exp $ +-- +-- SYNOPSIS +-- Library access code. +-- +-- DESCRIPTION +-- This implementation uses the library timestamp inplace of the +-- library member timestamp. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include "extern.h" + +PUBLIC time_t +seek_arch(name, lib) +char* name; +char* lib; +{ + static int warned = FALSE; + + if (!warned && !(Glob_attr&A_SILENT)) + warned = TRUE, + Warning("Can't extract library member timestamp;\n\ + using library timestamp instead."); + return (Do_stat(lib, NULL, NULL, TRUE)); +} + +PUBLIC int +touch_arch(name, lib) +char* name; +char* lib; +{ + static int warned = FALSE; + + if (!warned && !(Glob_attr&A_SILENT)) + warned = TRUE, + Warning("Can't update library member timestamp;\n\ + touching library instead."); + return (Do_touch(lib, NULL, NULL)); +} + diff --git a/dmake/mac/bogus.c b/dmake/mac/bogus.c new file mode 100644 index 000000000000..efd7d39b9470 --- /dev/null +++ b/dmake/mac/bogus.c @@ -0,0 +1,99 @@ +/* RCS $Id: bogus.c,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- +-- SYNOPSIS +-- Write the shell of subroutines we can't or don't +-- need to implement +-- +-- DESCRIPTION +-- dmake uses a couple of functions which I am either unable to figure out +-- how to implement or which are not needed. The shells of these routines +-- are in this file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include "extern.h" + + + +/* + * tzset() is a Microsoft "extension" to ANSI C. It sets global + * variables telling if we are in dayling savings time, the time + * zone, and difference between the current time and GMT. + * None of these globals are used by dmake, so this routine is + * not needed + */ +PUBLIC void +tzset () +{ +} + + + +/* + * Add an environmental variable that child processes can use. + * Since MPW currently doesn't allow child processes, this isn't + * needed. + */ +PUBLIC int +putenv (char *pEnvString) +{ + return (0); +} + + + +/* + * Execute a child process. This may be able to be done with + * the MPW system() call someday, but cannot be done currently. + */ +PUBLIC int +runargv (CELLPTR target, int ignore, int, + int last, int shell, char *pCmd) +{ + static int warned = FALSE; + + if (!warned && !(Glob_attr & A_SILENT)) { + warned = TRUE; + Fatal ("Can't execute any targets: use '-n' option."); + } /* if */ + + return (0); +} /* int runargv () */ + + + +/* + * Wait for the child process to complete. Only needed to be implemented + * if we could executing multiple processes at once. + */ +PUBLIC int +Wait_for_child(int abort_flg, int pid) +{ + return (1); +} + + + +/* + * Do any cleanup for any processes when we quit. + */ +PUBLIC void +Clean_up_processes() +{ +} diff --git a/dmake/mac/config.mk b/dmake/mac/config.mk new file mode 100644 index 000000000000..2a6806cff159 --- /dev/null +++ b/dmake/mac/config.mk @@ -0,0 +1,44 @@ +# This is an OS Mac specific configuration file +# It assumes that OBJDIR, TARGET and DEBUG are previously defined. +# It defines CFLAGS, LDARGS, CPPFLAGS, STARTUPFILE, LDOBJS +# It augments SRC, OBJDIR, TARGET, CFLAGS, LDLIBS +# + +STARTUPFILE = :$(OS):startup.mk + +CPPFLAGS = $(CFLAGS) +LDOBJS = $(CSTARTUP) :$(OBJDIR):{$(<:f)} +LDARGS = $(LDFLAGS) -o $@ $(LDOBJS) $(LDLIBS) + +# Debug flags +DB_CFLAGS = -sym on +DB_LDFLAGS = -sym on +DB_LDLIBS = + +# NO Debug flags +NDB_CFLAGS = -sym off +NDB_LDFLAGS = -sym off +NDB_LDLIBS = + +# Local configuration modifications for CFLAGS. +CFLAGS += -I :$(OS) -d _MPW -s $(<:b) +LDFLAGS += -w -c 'MPS ' -t MPST + +# Since we writing out what files we want to execute, we can't use .SETDIR +# to specify the files to compile in the Mac directory. +# Instead, we copy the files to the (top-level) current directory and compile +# them there. +%.c : ":$(OS):%.c" + duplicate -y $< $@ + +# Common Mac source files. +OS_SRC = arlib.c bogus.c dirbrk.c directry.c environ.c main.c rmprq.c \ + ruletab.c tempnam.c tomacfil.c +.IF $(SHELL) != mwp + .SETDIR=$(OS) : $(OS_SRC) +.ENDIF +SRC += $(OS_SRC) + +# Set source dirs so that we can find files named in this +# config file. +.SOURCE.h : $(OS) diff --git a/dmake/mac/dirbrk.c b/dmake/mac/dirbrk.c new file mode 100644 index 000000000000..c584ad22cad1 --- /dev/null +++ b/dmake/mac/dirbrk.c @@ -0,0 +1,42 @@ +/* RCS $Id: dirbrk.c,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- +-- SYNOPSIS +-- Define the directory separator string. +-- +-- DESCRIPTION +-- Define this string for any character that may appear in a path name +-- and can be used as a directory separator. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include "extern.h" + +/* mac only uses ':' */ +char* DirBrkStr = ":"; + +/* +** Return TRUE if the name is the full specification of a path name to a file +** starting at the root of the file system, otherwise return FALSE +*/ +PUBLIC int +If_root_path(name) +char *name; +{ + return( (strchr(name, ':') != NIL(char)) && + (name[0] != ':') ); +} diff --git a/dmake/mac/directry.c b/dmake/mac/directry.c new file mode 100644 index 000000000000..b1d452d073ba --- /dev/null +++ b/dmake/mac/directry.c @@ -0,0 +1,264 @@ +/* RCS $Id: directry.c,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- +-- SYNOPSIS +-- Fake directory and file functions for the Mac +-- +-- DESCRIPTION +-- This file contains implementations for some ANSI standard routines dmake +-- uses which are not otherwise available for the mac. +-- +-- Assume we are using at least 128K ROMS. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include <Errors.h> +#include <Files.h> +#include <OSUtils.h> +#include <StdLib.h> +#include <Strings.h> +/* + * We now include LowMem.h instead of SysEqu.h as LowMem.h is what Apple recommends + * we use. + */ +#include <LowMem.h> +#include "extern.h" + + + +/* + * Implementation of stat function for dmake on the mac. + * + * Many fields aren't filled in, and the times are seconds from 1/1//1904, + * but it should be enough for dmake (I think we only need st_mtime and + * st_mode's S_IFDIR set correctly). + */ +PUBLIC int +stat(pPath, pStat) +char *pPath; +struct stat *pStat; +{ + CInfoPBRec infoPB; + OSErr err; + int retVal; + + infoPB.hFileInfo.ioCompletion = NULL; + infoPB.hFileInfo.ioNamePtr = c2pstr (pPath); + infoPB.hFileInfo.ioVRefNum = 0; + infoPB.hFileInfo.ioFDirIndex = 0; + infoPB.hFileInfo.ioDirID = 0; + err = PBGetCatInfo(&infoPB, FALSE); + p2cstr ((StringPtr) pPath); + + if (err == noErr) { + pStat->st_mtime = (time_t) infoPB.hFileInfo.ioFlMdDat; + pStat->st_ctime = (time_t) infoPB.hFileInfo.ioFlCrDat; + pStat->st_mode = S_IREAD | S_IEXEC; + + /* If it is a directory ... */ + if (infoPB.hFileInfo.ioFlAttrib & 0x10) { + pStat->st_size = infoPB.dirInfo.ioDrNmFls; + pStat->st_mode |= S_IFDIR; + } else { + pStat->st_size = infoPB.hFileInfo.ioFlLgLen; + pStat->st_mode |= S_IFREG; + } /* if ... else */ + + /* If it is writeable */ + if ((infoPB.hFileInfo.ioFlAttrib & 0x1) == 0) { + pStat->st_mode |= S_IWRITE; + } /* if */ + + retVal = 0; + + } else { + retVal = -1; + } /* if ... else */ + + return (retVal); +} /* PUBLIC int stat () */ + + + +/* + * Return the current working directory, or NULL if there is an error. + */ +PUBLIC char * +getcwd(char *pPath, size_t pathSize) +{ + DirInfo dirInfo; + OSErr err; + Str255 dirName; + char *pBeginName; + char *pC; + size_t len; + size_t spaceForColon; + + /* Set up the info for the PBGetCatInfo() calls */ + dirInfo.ioCompletion = NULL; + dirInfo.ioNamePtr = dirName; + dirInfo.ioVRefNum = 0; + dirInfo.ioFDirIndex = -1; + dirInfo.ioDrDirID = 0; + pBeginName = pPath + pathSize - 1; + spaceForColon = 0; /* Make sure we don't have an end colon on the name */ + + /* + * Keep going up the directory path until the end is reached or an error + * occurs. Ideally, we would check for errors at every level and stop + * when we received an fnfErr (File Not Found), but it appears that there + * are some problems with network volumes. (During testing, I received + * a paramErr (No Default Volume) beyond the top level.) Thus, to keep it + * simple, I assume any error past the first directory indicates we have + * seen all directories. + */ + while (TRUE) { + err = PBGetCatInfo ((CInfoPBPtr) &dirInfo, FALSE); + len = ((size_t)(unsigned char) dirName[0]); + if ((err == noErr) && (len < pBeginName - pPath)) { + p2cstr (dirName); + pBeginName -= len + spaceForColon; + strcpy (pBeginName, (char *)dirName); + /* Note that strcpy() adds the '\0' at the end of + the first directory for us */ + if (spaceForColon == 1) { + pBeginName[len] = ':'; + } else { + /* The end of the string shouldn't have a ':' */ + spaceForColon = 1; + } /* if */ + + /* Set up for the next call to PBGetCatInfo() with + the parent's directory ID */ + dirInfo.ioDrDirID = dirInfo.ioDrParID; + + } else if (spaceForColon == 1) { + /* We got past the top-level directory */ + break; + + } else { + /* We either have an error when looking at the first directory + or have run out of room. */ + return (NULL); + } /* if ... elses */ + } /* while */ + + /* Now copy the directory string to the beginning of the path string. + (It's possible the directory already starts at the beginning of the + string, but this is unlikely and doesn't hurt anything if it does, + so we don't bother to check for it.) */ + pC = pPath; + while ((*(pC++) = *(pBeginName++)) != '\0') + ; + + return (pPath); +} /* PUBLIC char *getcwd () */ + + + +/* + * Change the directory to a new default directory. + * + * Return 0 if successful, or -1 if there is an error. + */ +PUBLIC int +chdir(char *pPath) +{ + WDPBRec WDPB; + VolumeParam vParam; + OSErr err; + int result; + char *pC; + char c; + + /* Set up the directory */ + c2pstr (pPath); + WDPB.ioCompletion = NULL; + WDPB.ioNamePtr = (unsigned char *)pPath; + WDPB.ioVRefNum = 0; + WDPB.ioWDProcID = 0; + WDPB.ioWDDirID = 0; + err = PBOpenWD (&WDPB, FALSE); + /* Restore path to a C-type string in case the caller wants + to use it after this call. */ + p2cstr ((unsigned char *)pPath); + if (err != noErr) { + return (-1); + } /* if */ + + /* Set up the volume if necessary */ + if (*pPath != ':') { + for (pC = pPath + 1; (*pC != ':') && (*pC != '\0'); ++pC) + ; + c = *pC; + *pC = '\0'; + vParam.ioCompletion = NULL; + vParam.ioNamePtr = c2pstr (pPath); + vParam.ioVRefNum = WDPB.ioVRefNum; + err = PBSetVol ((ParmBlkPtr) &vParam, FALSE); + p2cstr ((unsigned char *)pPath); + *pC = c; + result = ((err == noErr) ? 0 : -1); + + } else { + result = 0; + } /* if ... else */ + + return (result); +} /* PUBLIC int chdir () */ + + + +/* + * Change the modification time for the file to the current time. + * + * The normal version of utime can set the modification time to any + * time, this function aborts the function if this is tried. + * + * We return 0 if the modification time was updated and -1 if there + * was an error. + */ +PUBLIC int +utime(char *pPath, time_t *pTimes) +{ + CInfoPBRec infoPB; + OSErr err; + + if (pTimes != NULL) { + Fatal ("SUBROUTINE SHORTCOMING: utime cannot take a utimbuf struct"); + } /* if */ + + /* Get the old info */ + infoPB.hFileInfo.ioCompletion = NULL; + infoPB.hFileInfo.ioNamePtr = c2pstr (pPath); + infoPB.hFileInfo.ioVRefNum = 0; + infoPB.hFileInfo.ioFDirIndex = 0; + infoPB.hFileInfo.ioDirID = 0; + err = PBGetCatInfo (&infoPB, FALSE); + if (err != noErr) { + p2cstr ((StringPtr) pPath); + return (-1); + } /* if */ + + /* Change the modification time and set the new info */ + GetDateTime (&(infoPB.hFileInfo.ioFlMdDat)); + infoPB.hFileInfo.ioDirID = 0; + err = PBSetCatInfo (&infoPB, FALSE); + p2cstr ((StringPtr) pPath); + return ((err == noErr) ? 0 : -1); +} /* PUBLIC int utime () */ diff --git a/dmake/mac/dompwmak b/dmake/mac/dompwmak new file mode 100644 index 000000000000..c71ed12ca16d --- /dev/null +++ b/dmake/mac/dompwmak @@ -0,0 +1,67 @@ +newfolder objects +c -I. -I :mac -d _MPW -s infer -sym off -o :objects:infer.c.o infer.c +c -I. -I :mac -d _MPW -s make -sym off -o :objects:make.c.o make.c +c -I. -I :mac -d _MPW -s stat -sym off -o :objects:stat.c.o stat.c +c -I. -I :mac -d _MPW -s expand -sym off -o :objects:expand.c.o expand.c +c -I. -I :mac -d _MPW -s dmstring -sym off -o :objects:dmstring.c.o dmstring.c +c -I. -I :mac -d _MPW -s hash -sym off -o :objects:hash.c.o hash.c +c -I. -I :mac -d _MPW -s dag -sym off -o :objects:dag.c.o dag.c +c -I. -I :mac -d _MPW -s dmake -sym off -o :objects:dmake.c.o dmake.c +c -I. -I :mac -d _MPW -s path -sym off -o :objects:path.c.o path.c +c -I. -I :mac -d _MPW -s imacs -sym off -o :objects:imacs.c.o imacs.c +c -I. -I :mac -d _MPW -s sysintf -sym off -o :objects:sysintf.c.o sysintf.c +c -I. -I :mac -d _MPW -s parse -sym off -o :objects:parse.c.o parse.c +c -I. -I :mac -d _MPW -s getinp -sym off -o :objects:getinp.c.o getinp.c +c -I. -I :mac -d _MPW -s quit -sym off -o :objects:quit.c.o quit.c +c -I. -I :mac -d _MPW -s state -sym off -o :objects:state.c.o state.c +c -I. -I :mac -d _MPW -s basename -sym off -o :objects:basename.c.o basename.c +c -I. -I :mac -d _MPW -s dmdump -sym off -o :objects:dmdump.c.o dmdump.c +c -I. -I :mac -d _MPW -s macparse -sym off -o :objects:macparse.c.o macparse.c +c -I. -I :mac -d _MPW -s rulparse -sym off -o :objects:rulparse.c.o rulparse.c +c -I. -I :mac -d _MPW -s percent -sym off -o :objects:percent.c.o percent.c +c -I. -I :mac -d _MPW -s function -sym off -o :objects:function.c.o function.c +duplicate -y :mac:arlib.c arlib.c +c -I. -I :mac -d _MPW -s arlib -sym off -o :objects:arlib.c.o arlib.c +delete arlib.c +duplicate -y :mac:bogus.c bogus.c +c -I. -I :mac -d _MPW -s bogus -sym off -o :objects:bogus.c.o bogus.c +delete bogus.c +duplicate -y :mac:dirbrk.c dirbrk.c +c -I. -I :mac -d _MPW -s dirbrk -sym off -o :objects:dirbrk.c.o dirbrk.c +delete dirbrk.c +duplicate -y :mac:directry.c directry.c +c -I. -I :mac -d _MPW -s directry -sym off -o :objects:directry.c.o directry.c +delete directry.c +duplicate -y :mac:environ.c environ.c +c -I. -I :mac -d _MPW -s environ -sym off -o :objects:environ.c.o environ.c +delete environ.c +duplicate -y :mac:main.c main.c +c -I. -I :mac -d _MPW -s main -sym off -o :objects:main.c.o main.c +delete main.c +duplicate -y :mac:rmprq.c rmprq.c +c -I. -I :mac -d _MPW -s rmprq -sym off -o :objects:rmprq.c.o rmprq.c +delete rmprq.c +duplicate -y :mac:ruletab.c ruletab.c +c -I. -I :mac -d _MPW -s ruletab -sym off -o :objects:ruletab.c.o ruletab.c +delete ruletab.c +duplicate -y :mac:tempnam.c tempnam.c +c -I. -I :mac -d _MPW -s tempnam -sym off -o :objects:tempnam.c.o tempnam.c +delete tempnam.c +duplicate -y :mac:tomacfil.c tomacfil.c +c -I. -I :mac -d _MPW -s tomacfil -sym off -o :objects:tomacfil.c.o tomacfil.c +delete tomacfil.c +Set p1 ":objects:infer.c.o :objects:make.c.o :objects:stat.c.o :objects:expand.c.o" +Set p2 ":objects:dmstring.c.o :objects:hash.c.o :objects:dag.c.o :objects:dmake.c.o" +Set p3 ":objects:path.c.o :objects:imacs.c.o :objects:sysintf.c.o :objects:parse.c.o" +Set p4 ":objects:getinp.c.o :objects:quit.c.o :objects:state.c.o :objects:basename.c.o" +Set p5 ":objects:dmdump.c.o :objects:macparse.c.o :objects:rulparse.c.o" +Set p6 ":objects:percent.c.o :objects:function.c.o :objects:arlib.c.o :objects:bogus.c.o" +Set p7 ":objects:dirbrk.c.o :objects:directry.c.o :objects:environ.c.o :objects:main.c.o" +Set p8 ":objects:rmprq.c.o :objects:ruletab.c.o :objects:tempnam.c.o" +Set p9 ":objects:tomacfil.c.o Micah:MPW:Libraries:CLibraries:CSANELib.o" +Set p10 "Micah:MPW:Libraries:CLibraries:Math.o" +Set p11 "Micah:MPW:Libraries:CLibraries:StdCLib.o" +Set p12 "Micah:MPW:Libraries:Libraries:Runtime.o" +Set p13 "Micah:MPW:Libraries:Libraries:Interface.o Micah:MPW:Libraries:Libraries:Toollibs.o" +link -w -c 'MPS ' -t MPST -sym off -o dmake {p1} {p2} {p3} {p4} {p5} {p6} {p7} {p8} {p9} {p10} {p11} {p12} {p13} +duplicate :mac:startup.mk startup.mk diff --git a/dmake/mac/environ.c b/dmake/mac/environ.c new file mode 100644 index 000000000000..b9bd6d014da9 --- /dev/null +++ b/dmake/mac/environ.c @@ -0,0 +1,231 @@ +/* RCS $Id: environ.c,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- +-- SYNOPSIS +-- Set up and free for environ +-- +-- DESCRIPTION +-- This file contains routines that will fill in and dispose of the +-- list of environmental variables in the environ global variable. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include "extern.h" + +/* The char used to replace the equal signs in environmental variable names. */ +const char kEqualReplace = '_'; + +/* Maximum size of a "name=value" environmental string, including the ending '\0'. + Larger environmental variables will be clipped before dmake sees them. + (Caution: When I tested the program, the Mac or dmake trashed memory + when environmental variables of >4K were read in. I looked around a bit + and couldn't find out the exact cause, so I simply made this variable. + The memory trashing may be related to the value for MAXLINELENGTH.) */ +const int kMaxEnvLen = 1024; + + +/* The list of environmental variables in the form "name=value". + (Once make_env() has been called.) */ +char **environ = NULL; + +/* Characters replaced during make_env() */ +struct ReplaceChar { + char *fpPos; + char fC; + struct ReplaceChar *fpNext; +}; /* struct ReplaceChar */ +struct ReplaceChar *gpReplaceList = NULL; + + +void AddReplace (char *pReplacePos); + + + +/* + * Set up the environmental variables in a format used by + * the environ global variable. + * + * environ has already been set to main's envp argument when + * this suboroutine is called. We assume that envp is a copy + * MPW makes for this process' use alone, so we can modify it + * below. + */ +PUBLIC void +make_env() +{ + char **ppCurEnv; + char *pCurPos; +#if 0 + char **ppMacEnv; + char *pMacPos; + + if (!gMECalled) { + gMECalled = TRUE; + +environ = MALLOC (1, char *); +*environ = NULL; +#endif +#if 0 +{ + int numenv; + int len; + int firstnil; + + numenv = 1; + ppMacEnv = environ; + while (*(ppMacEnv++) != NULL) { + ++numenv; + } /* while */ + + ppMacEnv = environ; + if ((environ = MALLOC (numenv, char *)) == NULL) { + No_ram (); + } /* if */ + +numenv = 80; + for (ppCurEnv = environ; (numenv-- > 0) && (*ppMacEnv != NULL); ++ppCurEnv, ++ppMacEnv) { + pMacPos = *ppMacEnv; + len = strlen (pMacPos) + 1; + len += strlen (pMacPos + len) + 1; +#define MAXLEN 4098 +if (len > MAXLEN) len = MAXLEN; + if ((*ppCurEnv = MALLOC (len, char)) == NULL) { + No_ram (); + } /* if */ + + firstnil = TRUE; + for (pCurPos = *ppCurEnv; ((pCurPos - *ppCurEnv) < MAXLEN - 1); ++pCurPos, ++pMacPos) { + if (*pMacPos == '=') { + *pCurPos = gEqualReplace; + + } else if (*pMacPos == '\0') { + if (firstnil) { + *pCurPos = '='; + firstnil = FALSE; + } else { + *pCurPos = *pMacPos; + break; + } /* if ... else */ + + } else { + *pCurPos = *pMacPos; + } /* if ... elses */ + } /* for */ +firstnil = FALSE; + } /* for */ + *ppCurEnv = NULL; +} +#endif +{ + int firstnil; + + /* Get rid of any equal signs in any environmental name, and put + equal signs between the names and their values */ + for (ppCurEnv = environ; *ppCurEnv != NULL; ++ppCurEnv) { + + firstnil = TRUE; + for (pCurPos = *ppCurEnv; + ((pCurPos - *ppCurEnv < kMaxEnvLen - 1) && + ((*pCurPos != '\0') || firstnil)); + ++pCurPos) { + if (*pCurPos == '=') { + AddReplace (pCurPos); + *pCurPos = kEqualReplace; + + } else if (*pCurPos == '\0') { + AddReplace (pCurPos); + *pCurPos = '='; + firstnil = FALSE; + } /* if ... else if */ + } /* for */ + + /* If the environtmental variable was too large ... */ + if (*pCurPos != '\0') { + AddReplace (pCurPos); + *pCurPos = '\0'; + if (firstnil) { + AddReplace (--pCurPos); + *pCurPos = '='; + } /* if */ + } /* if */ + } /* for */ +} +#if 0 + } /* if */ +#endif +} /* PUBLIC void make_env () */ + + +/* + * The character at pReplacePos is about to be replaced. Remember the + * old value so we can restore it when we're done. + */ +void AddReplace (char *pReplacePos) { + struct ReplaceChar *pReplaceChar; + + if ((pReplaceChar = MALLOC (1, struct ReplaceChar)) == NULL) { + No_ram (); + } /* if */ + pReplaceChar->fpPos = pReplacePos; + pReplaceChar->fC = *pReplacePos; + pReplaceChar->fpNext = gpReplaceList; + gpReplaceList = pReplaceChar; +} /* void AddReplace () */ + + +/* + * Restore the old environmental variables to the way they looked before + * the make_env() call, on the unlikely chance that something else will look + * at our copy of the environmental variables during the program execution. + * + */ +PUBLIC void +free_env() +{ + struct ReplaceChar *pReplaceChar; + + while (gpReplaceList != NULL) { + pReplaceChar = gpReplaceList; + gpReplaceList = pReplaceChar->fpNext; + + *(pReplaceChar->fpPos) = pReplaceChar->fC; + + FREE (pReplaceChar); + } /* while */ + +#if 0 + char **ppCurEnv; + char *pCurPos; + + if (!gFECalled) { + gFECalled = TRUE; + +//FREE (environ); +environ = NULL; +#endif +#if 0 + /* Restore the environment list to what it was before we + read it in. */ + for (ppCurEnv = environ; *ppCurEnv != NULL; ++ppCurEnv) { + for (pCurPos = *ppCurEnv; *pCurPos != '='; ++pCurPos) + ; + *pCurPos = '\0'; + } /* for */ + } /* if */ +#endif +} /* PUBLIC void free_env () */ diff --git a/dmake/mac/eold.c b/dmake/mac/eold.c new file mode 100644 index 000000000000..5c389c5851db --- /dev/null +++ b/dmake/mac/eold.c @@ -0,0 +1,119 @@ +/* RCS $Id: eold.c,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- +-- SYNOPSIS +-- Set up and free for environ +-- +-- DESCRIPTION +-- This file contains routines that will fill in and dispose of the +-- list of environmental variables in the environ global variable. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include "extern.h" + + +/* + * Keep track of any environmental variables that have '='s in their + * name. + */ +struct EqualPos { + char *fpPos; + struct equalsign *fpNext; +} /* struct EqualPos */ + +struct EqualPos *gpEqualList; + +/* + * The character used to replae the equal signs. + */ +const char gEqualReplace = '_'; + + + +/* + * Set up the environmental variables in a format used by + * the environ global variable. + * + * environ has already been set to main's envp argument when + * this suboroutine is called. + */ +void main_env () { + char **ppCurEnv; + char *pCurPos; + struct equalpos *pNewEqual; + + gpEqualList = NULL; + + for (ppCurEnv = environ; *ppCurEnv != NULL; ++ppCurEnv) { + for (pCurPos = *ppCurEnv; *pCurPos != '\0'; ++pCurPos) { + if (*pCurPos == '=') { + if ((pNewEqual = + (struct EqualPos *) malloc (sizeof (struct EqualPos))) == + NULL) { + fputs ("Out of Memory", stderr); + exit (EXIT_FAILURE); + } /* if */ + pNewEqual->fpPos = pCurPos; + pNewEqual->fpNext = gpEqualList; + gpEqualList = pNewEqual; + + *pCurPos = gEqualReplace; + } /* if */ + } /* for */ + + *pCurPos = '='; + } /* for */ +} /* void main_env () */ + + + +/* + * Reset the environmental variables so they look like they did + * before the main_env() call. + * + * environ has already been set to main's envp argument when + * this suboroutine is called. + */ +void main_env () { + char **ppCurEnv; + char *pCurPos; + struct equalpos *pNewEqual; + + gpEqualList = NULL; + + for (ppCurEnv = environ; *ppCurEnv != NULL; ++ppCurEnv) { + for (pCurPos = *ppCurEnv; *pCurPos != '\0'; ++pCurPos) { + if (*pCurPos == '=') { + if ((pNewEqual = + (struct EqualPos *) malloc (sizeof (struct EqualPos))) == + NULL) { + fputs ("Out of Memory", stderr); + exit (EXIT_FAILURE); + } /* if */ + pNewEqual->fpPos = pCurPos; + pNewEqual->fpNext = gpEqualList; + gpEqualList = pNewEqual; + + *pCurPos = gEqualReplace; + } /* if */ + } /* for */ + + *pCurPos = '='; + } /* for */ +} /* void main_env () */ diff --git a/dmake/mac/main.c b/dmake/mac/main.c new file mode 100644 index 000000000000..53cc7d7cd9fe --- /dev/null +++ b/dmake/mac/main.c @@ -0,0 +1,43 @@ +/* RCS $Id: main.c,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- +-- SYNOPSIS +-- The real main function +-- +-- DESCRIPTION +-- In order to get the third argument to main(), which is a list of +-- environmental variables, we have #defined main to dmakemain, +-- and put the real main here. +-- +-- The environmental variables are placed in the environ global variable +-- and set up for processing by dmake in make_env(). +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include "extern.h" + + + +/* + * Put envp in environ and call dmake's main(). + */ +#undef main +void main(int argc, char **argv, char **envp) { + environ = envp; + dmakemain (argc, argv); +} /* void main () */ diff --git a/dmake/mac/make.sh b/dmake/mac/make.sh new file mode 100644 index 000000000000..fc2b8db02b0f --- /dev/null +++ b/dmake/mac/make.sh @@ -0,0 +1,107 @@ +# +# $Id: make.sh,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +# +# This MPW script builds the dmake executable using the Metroworks PPC compiler +# and linker. The resulting dmake binary will only run on the PPC platform. +# +# To execute this script, you will need the following tools: +# - MacOS 8 or later +# - CodeWarrior for MacOS Release 5 or later +# +# To run this script, you need to open the MPW Shell that is bundled with CodeWarrior. +# If you have another instance of MPW installed other than the one bundled with +# CodeWarrior, you may encounter problems. Once you open the MPW Shell that is bundled +# with CodeWarrior, you will need to set MPW's working directory to the "dmake" +# directory (the directory above the directory that this script is in). Then, execute +# this script from the MPW Worksheet by typing the following command: +# +# :mac:make.sh +# +set Exit 1 +if ( "{0}" != ':mac:make.sh' ) + Echo "You cannot run this script from the current directory." + Echo "To run this script, you need to be in the "dmake" directory and then" + Echo "execute the following command: ":mac:make.sh"" + Exit +end +if ( ! `Exists -d objects` ) + NewFolder :objects +end +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle infer.c +Move -y infer.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle make.c +Move -y make.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle stat.c +Move -y stat.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle expand.c +Move -y expand.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle dmstring.c +Move -y dmstring.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle hash.c +Move -y hash.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle dag.c +Move -y dag.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle dmake.c +Move -y dmake.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle path.c +Move -y path.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle imacs.c +Move -y imacs.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle sysintf.c +Move -y sysintf.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle parse.c +Move -y parse.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle getinp.c +Move -y getinp.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle quit.c +Move -y quit.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle state.c +Move -y state.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle dmdump.c +Move -y dmdump.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle macparse.c +Move -y macparse.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle rulparse.c +Move -y rulparse.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle percent.c +Move -y percent.c.o :objects +# Note that function.c needs to have __useAppleExts__ defined. Otherwise, it won't link. +MWCPPC -o : -ansi off -I :mac -d _MPW -d __useAppleExts__ -sym off -proto ignoreoldstyle function.c +Move -y function.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:arlib.c +Move -y arlib.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:bogus.c +Move -y bogus.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:dirbrk.c +Move -y dirbrk.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:directry.c +Move -y directry.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:environ.c +Move -y environ.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:main.c +Move -y main.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:rmprq.c +Move -y rmprq.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:ruletab.c +Move -y ruletab.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:tempnam.c +Move -y tempnam.c.o :objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:tomacfil.c +Move -y tomacfil.c.o :objects +MWLinkPPC -w -c 'MPS ' -t MPST -sym off -xm m -o dmake :objects:infer.c.o :objects:make.c.o + :objects:stat.c.o :objects:expand.c.o :objects:dmstring.c.o :objects:hash.c.o + :objects:dag.c.o :objects:dmake.c.o :objects:path.c.o :objects:imacs.c.o + :objects:sysintf.c.o :objects:parse.c.o :objects:getinp.c.o :objects:quit.c.o + :objects:state.c.o :objects:dmdump.c.o :objects:macparse.c.o :objects:rulparse.c.o + :objects:percent.c.o :objects:function.c.o :objects:arlib.c.o :objects:bogus.c.o + :objects:dirbrk.c.o :objects:directry.c.o :objects:environ.c.o :objects:main.c.o + :objects:rmprq.c.o :objects:ruletab.c.o :objects:tempnam.c.o :objects:tomacfil.c.o + "{SharedLibraries}StdCLib" + "{SharedLibraries}InterfaceLib" + "{PPCLibraries}StdCRuntime.o" + "{PPCLibraries}PPCCRuntime.o" + "{PPCLibraries}PPCToolLibs.o" +if ( `Exists -f :startup:config.mk` ) + SetFile -a l :startup:config.mk +end +Duplicate -y :mac:template.mk :startup:config.mk diff --git a/dmake/mac/make_mac.sh b/dmake/mac/make_mac.sh new file mode 100644 index 000000000000..9e6c4cc54949 --- /dev/null +++ b/dmake/mac/make_mac.sh @@ -0,0 +1,105 @@ +# +# $Id: make_mac.sh,v 1.1.1.1 2000-09-22 15:33:26 hr Exp $ +# +# This MPW script builds the dmake executable using the Metroworks PPC compiler +# and linker. The resulting dmake binary will only run on the PPC platform. +# +# To execute this script, you will need the following tools: +# - MacOS 8 or later +# - CodeWarrior for MacOS Release 5 or later +# +# To run this script, you need to open the MPW Shell that is bundled with CodeWarrior. +# If you have another instance of MPW installed other than the one bundled with +# CodeWarrior, you may encounter problems. Once you open the MPW Shell that is bundled +# with CodeWarrior, you will need to set MPW's working directory to the "dmake" +# directory (the directory above the directory that this script is in). Then, execute +# this script from the MPW Worksheet by typing the following command: +# +# :mac:make_mac.sh +# +set Exit 1 +if ( "{0}" != ':mac:make_mac.sh' ) + Echo "You cannot run this script from the current directory." + Echo "To run this script, you need to be in the "dmake" directory and then" + Echo "execute the following command: ":mac:make_mac.sh"" + Exit +end +if ( ! `Exists -d objects` ) + NewFolder objects +end +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle infer.c +Move -y infer.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle make.c +Move -y make.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle stat.c +Move -y stat.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle expand.c +Move -y expand.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle dmstring.c +Move -y dmstring.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle hash.c +Move -y hash.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle dag.c +Move -y dag.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle dmake.c +Move -y dmake.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle path.c +Move -y path.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle imacs.c +Move -y imacs.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle sysintf.c +Move -y sysintf.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle parse.c +Move -y parse.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle getinp.c +Move -y getinp.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle quit.c +Move -y quit.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle state.c +Move -y state.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle dmdump.c +Move -y dmdump.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle macparse.c +Move -y macparse.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle rulparse.c +Move -y rulparse.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle percent.c +Move -y percent.c.o objects +# Note that function.c needs to have __useAppleExts__ defined. Otherwise, it won't link. +MWCPPC -o : -ansi off -I :mac -d _MPW -d __useAppleExts__ -sym off -proto ignoreoldstyle function.c +Move -y function.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:arlib.c +Move -y arlib.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:bogus.c +Move -y bogus.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:dirbrk.c +Move -y dirbrk.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:directry.c +Move -y directry.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:environ.c +Move -y environ.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:main.c +Move -y main.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:rmprq.c +Move -y rmprq.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:ruletab.c +Move -y ruletab.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:tempnam.c +Move -y tempnam.c.o objects +MWCPPC -o : -ansi off -I :mac -d _MPW -sym off -proto ignoreoldstyle :mac:tomacfil.c +Move -y tomacfil.c.o objects +MWLinkPPC -w -c 'MPS ' -t MPST -sym off -xm m -o dmake :objects:infer.c.o :objects:make.c.o + :objects:stat.c.o :objects:expand.c.o :objects:dmstring.c.o :objects:hash.c.o + :objects:dag.c.o :objects:dmake.c.o :objects:path.c.o :objects:imacs.c.o + :objects:sysintf.c.o :objects:parse.c.o :objects:getinp.c.o :objects:quit.c.o + :objects:state.c.o :objects:dmdump.c.o :objects:macparse.c.o :objects:rulparse.c.o + :objects:percent.c.o :objects:function.c.o :objects:arlib.c.o :objects:bogus.c.o + :objects:dirbrk.c.o :objects:directry.c.o :objects:environ.c.o :objects:main.c.o + :objects:rmprq.c.o :objects:ruletab.c.o :objects:tempnam.c.o :objects:tomacfil.c.o + "{SharedLibraries}StdCLib" + "{SharedLibraries}InterfaceLib" + "{PPCLibraries}StdCRuntime.o" + "{PPCLibraries}PPCCRuntime.o" + "{PPCLibraries}PPCToolLibs.o" +SetFile -a l :startup:config.mk +Duplicate -y :mac:template.mk :startup:config.mk diff --git a/dmake/mac/public.h b/dmake/mac/public.h new file mode 100644 index 000000000000..31cc8fa62d49 --- /dev/null +++ b/dmake/mac/public.h @@ -0,0 +1,172 @@ +/* RCS $Id: public.h,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +void main ANSI((int, char **, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +int Do_cmnd ANSI((char *, int, int, CELLPTR, int, int, int)); +char ** Pack_argv ANSI((int, int, char *)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)())); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *, int)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI(()); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char*, char*)); +int touch_arch ANSI((char*, char*)); +//void tzset () {}/PUBLIC int putenv (char *pEnvString) {return (0); }/ ANSI(()); +void tzset ANSI(()); +int Wait_for_child ANSI((int ,int )); +void Clean_up_processes ANSI(()); +int If_root_path ANSI((char *)); +int stat ANSI((char *, struct stat *)); +char *getcwd ANSI((char *,size_t )); +int chdir ANSI((char *)); +int utime ANSI((char *,time_t *)); +void make_env ANSI(()); +void free_env ANSI(()); +void Remove_prq ANSI((CELLPTR)); +char *tempnam ANSI((char *,char *)); + +#endif diff --git a/dmake/mac/rmprq.c b/dmake/mac/rmprq.c new file mode 100644 index 000000000000..424b9a060009 --- /dev/null +++ b/dmake/mac/rmprq.c @@ -0,0 +1,38 @@ +/* RCS $Id: rmprq.c,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- +-- SYNOPSIS +-- Remove prerequisites code. +-- +-- DESCRIPTION +-- This code is different for The Mac and for UNIX and parallel make +-- architectures since the parallel case requires the rm's to be +-- run in parallel, whereas The Mac guarantees to run them sequentially. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include "extern.h" + +PUBLIC void +Remove_prq( tcp ) +CELLPTR tcp; +{ + tcp->ce_flag &= ~(F_MADE|F_VISITED); + tcp->ce_time = 0L; + + Make( tcp, tcp ); +} diff --git a/dmake/mac/ruletab.c b/dmake/mac/ruletab.c new file mode 100644 index 000000000000..d970b6eb9848 --- /dev/null +++ b/dmake/mac/ruletab.c @@ -0,0 +1,43 @@ +/* RCS $Id: ruletab.c,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- +-- SYNOPSIS +-- Default initial configuration of dmake. +-- +-- DESCRIPTION +-- Define here the initial set of rules that are defined before +-- dmake performs any processing. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +/* These are control macros for dmake that MUST be defined at some point + * if they are NOT dmake will not work! These are default definitions. They + * may be overridden inside the .STARTUP makefile, they are here + * strictly so that dmake can parse the STARTUP makefile */ + +static char *_rules[] = { + "MAXLINELENGTH := 4094", + "MAXPROCESSLIMIT := 1", + "MAXPROCESS := 1", + ".IMPORT .IGNORE: DMAKEROOT SOLARVER UPD INPATH OS UPDMINOREXT", + ".MAKEFILES : makefile.mk Makefile makefile", + ".SOURCE : .NULL", +#include "startup.h" + 0 }; + +char **Rule_tab = _rules; /* for sundry reasons in Get_environment() */ + diff --git a/dmake/mac/startup.h b/dmake/mac/startup.h new file mode 100644 index 000000000000..f4d18a5d6506 --- /dev/null +++ b/dmake/mac/startup.h @@ -0,0 +1,28 @@ +/* RCS $Id: startup.h,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- +-- SYNOPSIS +-- Default value of MAKESTARTUP. +-- +-- DESCRIPTION +-- Default value is used if the environment variable is not +-- defined. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +"MAKESTARTUP := $(DMAKEROOT):startup.mk", + diff --git a/dmake/mac/sysintf.h b/dmake/mac/sysintf.h new file mode 100644 index 000000000000..f7ef353a343a --- /dev/null +++ b/dmake/mac/sysintf.h @@ -0,0 +1,42 @@ +/* RCS $Id: sysintf.h,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- +-- SYNOPSIS +-- Assorted bits of system interface +-- +-- DESCRIPTION +-- This file is used to abstract away some of the functions in +-- sysintf.c. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ +#define DMSTAT stat +#define VOID_LCACHE(l,m) +#define Hook_std_writes(A) +#define GETPID 1 +#define DMSTRLWR(A,B) + +/* for directory cache */ +#define CacheStat(A,B) really_dostat(A,&buf) + +/* +** standard C items +*/ + +/* +** Mac interface standard items +*/ +#define getswitchar() '-' diff --git a/dmake/mac/template.mk b/dmake/mac/template.mk new file mode 100644 index 000000000000..0cf10289c826 --- /dev/null +++ b/dmake/mac/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= mac + OSRELEASE *:= + OSENVIRONMENT *:= diff --git a/dmake/mac/tempnam.c b/dmake/mac/tempnam.c new file mode 100644 index 000000000000..ee86ccb6a0a2 --- /dev/null +++ b/dmake/mac/tempnam.c @@ -0,0 +1,65 @@ +/* RCS $Id: tempnam.c,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- +-- SYNOPSIS +-- Fake tempnam function for the mac +-- +-- DESCRIPTION +-- Get a temporary file name. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + + +#include "extern.h" +#include <StdIO.h> +#include <String.h> + + + +/* + * Try to open a temporary file in the given directory (if non-NULL) + * with the given prefix (if non-NULL). + * + * We ignore the directory argument. + */ +PUBLIC char * +tempnam(char *pDir, char * pPrefix) +{ + char *pName; + char *pFullName; + + pName = tmpnam ((char *) NULL); + + /* Assume that if the name returned by tmpnam is not being used, + the name with the prefix is also not being used. */ + pFullName = MALLOC (((pPrefix != NULL) ? strlen (pPrefix) : 0) + + strlen (pName) + 1, char); + + /* Copy in the name if we successfully allocated space for it. */ + if (pFullName != NULL) { + if (pPrefix != NULL) { + strcpy (pFullName, pPrefix); + } else { + *pFullName = '\0'; + } /* if ... else */ + + strcat (pFullName, pName); + } /* if */ + + return (pFullName); +} /* PUBLIC char *tempnam () */ diff --git a/dmake/mac/tomacfil.c b/dmake/mac/tomacfil.c new file mode 100644 index 000000000000..d5f1ea72a496 --- /dev/null +++ b/dmake/mac/tomacfil.c @@ -0,0 +1,38 @@ +/* RCS $Id: tomacfil.c,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $ +-- +-- SYNOPSIS +-- Routines to change unix file names to mac file names +-- +-- DESCRIPTION +-- Dmake sometimes assumes that files have '/' as a directory parameter in some makefiles. +-- This works, even on DOS, but not on the Mac. In fact, on the Mac, you can't even do a +-- a simple switch of ':' for '/' because all other the Mac has decided to reverse the use +-- of a first-character directory delimiter to mean a relative path rather than absolute path. +-- (i.e., ':test:b' means directory test is relative to the current directory, rather than +-- a top-level directory. Thus, this file attempts to do the directory conversion behind +-- the back of the rest of the program. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +/* This file no longer contains an override to the fopen() function as we now accept only + * Mac style path names + */ +#include <Files.h> + +#include "extern.h" |