home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 5
/
FreshFish_July-August1994.bin
/
bbs
/
dev
/
cpump-1.7.lha
/
CPump-1.7
/
CPump17.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-04-04
|
26KB
|
1,002 lines
/*
* CPump.c: An Amiga Intuition-based C development environment.
* © Copyright 1992, 1993, David A. Faught, All rights reserved.
* This information is provided "as is"; no warranties are made.
* All use is at your own risk. No liability or responsibility is assumed.
* Version 1.7
*/
#define INTUITION_IOBSOLETE_H
#include <workbench/startup.h>
#include <intuition/screens.h>
#include <graphics/displayinfo.h>
#include <exec/libraries.h>
#include <exec/types.h>
#include <intuition/intuition.h>
#include <intuition/gadgetclass.h>
#include <libraries/gadtools.h>
#include <libraries/asl.h>
#include <dos/dostags.h>
#include <dos/var.h>
#ifndef pdc
#ifndef __GNUC__
#include <clib/exec_protos.h>
#include <clib/graphics_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/asl_protos.h>
#include <clib/alib_stdio_protos.h>
#endif
#endif
#ifdef __GNUC__
#include <tagdefs.h>
#endif
void exit ();
void main ();
void leave ();
void AddToCommand (), InitCommand ();
void MakeFileName (), GetFiles ();
void InEnv (), OutEnv ();
int GoRunCommand (), ZipRunCommand ();
void HandleButton1 (), HandleButton2 (), HandleButton3 ();
void HandleButton4 (), HandleButton5 (), HandleList1 ();
BOOL HandleGadgetEvent ();
BOOL HandleVanillaKey ();
struct Gadget *CreateAllGadgets ();
#define GAD_BUTTON1 1
#define GAD_CYCLE1 2
#define GAD_BUTTON2 3
#define GAD_CYCLE2 4
#define GAD_BUTTON3 5
#define GAD_CYCLE3 6
#define GAD_CHECK1 7
#define GAD_CHECK2 8
#define GAD_CHECK3 9
#define GAD_BUTTON4 10
#define GAD_CYCLE4 11
#define GAD_BUTTON5 12
#define GAD_STRING1 13
#define GAD_LISTVIEW1 14
#define EOS '\000'
struct TextAttr Topaz80 =
{
"topaz.font",
8,
0,
0,
};
UBYTE *vers = "$VER: CPump 1.7 (" __DATE__ ")";
extern struct Library *SysBase;
struct GfxBase *GfxBase = NULL;
struct IntuitionBase *IntuitionBase = NULL;
struct Library *GadToolsBase = NULL;
struct TextFont *font = NULL;
struct Screen *mysc = NULL;
struct Gadget *glist = NULL;
struct Window *mywin = NULL;
void *vi = NULL;
struct Library *AslBase;
struct WBArg *wbargs;
struct FileRequester *fr;
STRPTR OpenDests[] =
{
"RAM:",
"RAD:",
NULL,
};
STRPTR Editors[] =
{
"ED",
"DME",
"MEmacs",
"Textra",
NULL,
};
STRPTR CCTypes[] =
{
"DICE",
"PDC",
"LC",
"GCC",
"EC",
NULL,
};
STRPTR TestTypes[] =
{
"RUN",
"Debug",
"RX Debug",
NULL,
};
struct MinList ListView1List =
{
(struct Node *) 0l, (struct Node *) 0l, (struct Node *) 0l };
struct Node ListView1Nodes[] =
{
&ListView1Nodes[1], (struct Node *) & ListView1List.mlh_Head,
0, 0, "MuchMore",
&ListView1Nodes[2], &ListView1Nodes[0], 0, 0, "EdTag Bld",
&ListView1Nodes[3], &ListView1Nodes[1], 0, 0, "EdTag Cnt",
&ListView1Nodes[4], &ListView1Nodes[2], 0, 0, "EdErr",
&ListView1Nodes[5], &ListView1Nodes[3], 0, 0, "Delete",
&ListView1Nodes[6], &ListView1Nodes[4], 0, 0, "(ADocs)",
&ListView1Nodes[7], &ListView1Nodes[5], 0, 0, "Make",
&ListView1Nodes[8], &ListView1Nodes[6], 0, 0, "Make clean",
&ListView1Nodes[9], &ListView1Nodes[7], 0, 0, "Makemake #?.c",
&ListView1Nodes[10], &ListView1Nodes[8], 0, 0, "DW",
&ListView1Nodes[11], &ListView1Nodes[9], 0, 0, "Cref >Cref.lst",
&ListView1Nodes[12], &ListView1Nodes[10], 0, 0, "Calls >Calls.lst",
&ListView1Nodes[13], &ListView1Nodes[11], 0, 0, "Indent",
(struct Node *) & ListView1List.mlh_Tail, &ListView1Nodes[12],
0, 0, "Touch"};
ULONG x;
UWORD code1 = 0, code2 = 0, code3 = 0, code4 = 0, code5 = 0;
UWORD altsize[4] =
{510, 10, 130, 10};
char Command[200];
char *EndCommand = Command;
char filename[255], dirname[255] = "DF0:";
char retcode[10], envbuff[60];
BOOL terminated = FALSE;
BOOL Vchecked = FALSE, Cchecked = FALSE, Schecked = FALSE;
struct Gadget *cycle1, *cycle2, *cycle3, *cycle4;
struct Gadget *check1, *check2, *check3, *string1;
struct Gadget *text1, *text2;
void
main (void)
{
struct IntuiMessage *imsg;
struct Gadget *gad;
ULONG imsgClass;
UWORD imsgCode;
UWORD topborder;
if (!(AslBase = OpenLibrary ("asl.library", 36L)))
leave (20, "Requires V36 asl.library");
if (!(GfxBase = (struct GfxBase *)
OpenLibrary ("graphics.library", 36L)))
leave (20, "Requires V36 graphics.library");
if (!(IntuitionBase = (struct IntuitionBase *)
OpenLibrary ("intuition.library", 36L)))
leave (20, "Requires V36 intuition.library");
if (!(GadToolsBase = OpenLibrary ("gadtools.library", 36L)))
leave (20, "Requires V36 gadtools.library");
if (!(font = OpenFont (&Topaz80)))
leave (20, "Failed to open Topaz 80");
if (!(mysc = LockPubScreen (NULL)))
leave (20, "Couldn't lock default public screen");
if (!(vi = GetVisualInfo (mysc,
TAG_DONE)))
leave (20, "GetVisualInfo() failed");
InEnv ();
topborder = mysc->WBorTop + (mysc->Font->ta_YSize + 1);
ListView1List.mlh_Head = &ListView1Nodes[0];
ListView1List.mlh_TailPred = &ListView1Nodes[13];
if (!CreateAllGadgets (&glist, vi, topborder))
{
leave (20, "CreateAllGadgets() failed");
}
if (!(mywin = OpenWindowTags (NULL,
WA_Left, 220,
WA_Width, 420,
WA_InnerHeight, 72,
WA_Activate, TRUE,
WA_DragBar, TRUE,
WA_DepthGadget, TRUE,
WA_CloseGadget, TRUE,
WA_SizeGadget, FALSE,
WA_SimpleRefresh, TRUE,
WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_REFRESHWINDOW | \
IDCMP_VANILLAKEY | BUTTONIDCMP | LISTVIEWIDCMP,
WA_MinWidth, 0,
WA_MinHeight, 0,
WA_MaxWidth, 0,
WA_MaxHeight, 0,
WA_Zoom, altsize,
WA_Title, "CPump 1.7, ©1992-4 David A. Faught",
WA_Gadgets, glist,
TAG_DONE)))
leave (20, "OpenWindow() failed");
GT_RefreshWindow (mywin, NULL);
if (!(fr = (struct FileRequester *)
AllocAslRequestTags (ASL_FileRequest,
ASL_TopEdge, 0L, ASL_LeftEdge, 0L,
ASL_Height, 200L, ASL_Width, 320L,
ASL_Hail, (ULONG) "CPump",
ASL_Dir, (ULONG) dirname,
ASL_File, (ULONG) "source.c",
ASL_Pattern, (ULONG) "#?",
ASL_FuncFlags, FILF_MULTISELECT | FILF_PATGAD,
ASL_Window, mywin,
TAG_DONE)))
leave (20, "AllocAslRequestTags() failed");
while (!terminated)
{
Wait (1 << mywin->UserPort->mp_SigBit);
while ((!terminated) && (imsg = GT_GetIMsg (mywin->UserPort)))
{
imsgClass = imsg->Class;
imsgCode = imsg->Code;
gad = (struct Gadget *) imsg->IAddress;
GT_ReplyIMsg (imsg);
switch (imsgClass)
{
case IDCMP_GADGETDOWN:
case IDCMP_MOUSEMOVE:
case IDCMP_GADGETUP:
terminated = HandleGadgetEvent (mywin, gad, imsgCode);
break;
case IDCMP_VANILLAKEY:
terminated = HandleVanillaKey (mywin, imsgCode);
break;
case IDCMP_CLOSEWINDOW:
terminated = TRUE;
break;
case IDCMP_REFRESHWINDOW:
GT_BeginRefresh (mywin);
GT_EndRefresh (mywin, TRUE);
break;
}
}
}
OutEnv ();
leave (0, NULL);
}
void
leave (code, error)
int code;
STRPTR error;
{
if (fr)
{
FreeAslRequest (fr);
}
if (mywin)
{
CloseWindow (mywin);
}
if (GadToolsBase)
{
FreeVisualInfo (vi);
FreeGadgets (glist);
CloseLibrary (GadToolsBase);
}
if (mysc)
{
UnlockPubScreen (NULL, mysc);
}
if (font)
{
CloseFont (font);
}
if (IntuitionBase)
{
CloseLibrary (IntuitionBase);
}
if (GfxBase)
{
CloseLibrary (GfxBase);
}