Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-spam!ames!amdahl!orandy From: orandy@amdahl.UUCP Newsgroups: comp.sys.amiga Subject: Initial posting of MandelVroom (6 of 8) Message-ID: <6768@amdahl.amdahl.com> Date: Tue, 19-May-87 21:24:06 EDT Article-I.D.: amdahl.6768 Posted: Tue May 19 21:24:06 1987 Date-Received: Thu, 21-May-87 02:53:56 EDT Organization: Amdahl Corporation, Sunnyvale, CA 94086 Lines: 937 Keywords: C. Heath's file name requester and diffs # This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # Makefile README README.1ST getfile.c getfile.diffs getfile.h safeclose.c safeclose.h standard.h testing.c echo x - Makefile cat > "Makefile" << '//E*O*F Makefile//' # The "testing" program is not needed by MandelVroom; I've left it in # the Makefile due to Charlie Heath's "no modifications" demand. If # you think that policy is as much of a pain in the ass as I do, write # Charlie at Microsmiths, Inc. testing: testing.o safeclose.o getfile.o ln testing.o safeclose.o getfile.o -lc32 testing.o: testing.c cc testing.c +l -s safeclose.o: safeclose.c cc safeclose.c +l -s getfile.o: getfile.c cc getfile.c +l -s //E*O*F Makefile// echo x - README cat > "README" << '//E*O*F README//' ReadMe for GetFile.Arc November 11, 1986 This archive includes the files needed for the Heath/Aegis file name requester. This material is copyright (c) 1986 by C. Heath of Microsmiths, Inc. Permission is granted to use these files in any way with the following exceptions: 1) The files shall not be posted on any telecommunications service, public or private, except for BIX until January 15, 1987. 2) The files may only be distributed in archive format, with no modifications. If you make any improvements on the file requester and would like to generally distribute them, please contact "cheath" on BIX, or write to: Microsmiths Inc, PO Box 561, Cambridge, MA 02140 3) The requester may be used in any commercial product, but must be in object code format. Permission is granted to Lattice, Inc, and to Manx, Inc, to include the source files in archive format. 4) These files are distributed "as is" and it is your sole responsibility to determine their fitness for use. My apologies for the lousy program structure and the compile time warnings - I didn't have time to clean things up. Hope this doesn't inconvenience too many folks. Thanks, and enjoy. ...cheath [Note: Charlie gave me explicit permission to include these files on one of my disks. Fred Fish, 26-Nov-86] //E*O*F README// echo x - README.1ST cat > "README.1ST" << '//E*O*F README.1ST//' This directory contains Charlie Heath's file name requester. It also contains a diffs file that has some changes I made. You should apply the diffs to Charlie's original getfile.c to create the getfile.c that I use in MandelVroom. The file name requester did have some problems working with a custom intuition screen, hence my changes. You must make the things in this directory before you make MandelVroom. //E*O*F README.1ST// echo x - getfile.c cat > "getfile.c" << '//E*O*F getfile.c//' /************************************************************************ req.c This file contains a general-purpose that will prompt the user for a filename input. The program actually uses a window instead of a 'Requester' for greater flexibility. It will take control of your window's IDCMP Port when called. *** This material is copyright (c) 1986 by C. Heath of Microsmiths, Inc. Permission is granted to use these files in any way with the following exceptions: 1) The files shall not be posted on any telecommunications service, public or private, except for BIX until January 15, 1987. 2) The files may only be distributed in archive format, with no modifications. If you make any improvements on the file requester and would like to generally distribute them, please contact "cheath" on BIX, or write to: Microsmiths Inc, PO Box 561, Cambridge, MA 02140 3) The requester may be used in any commercial product, but must be in object code format. You are free to make modifications for use in your product. Permission is granted to Lattice, Inc, and to Manx, Inc, to include the source files in archive format. Thank you, and enjoy. ...cheath ************************************************************************/ #include "standard.h" #include "safeclose.h" #define FAST register #define NL NULL extern char *dmore(), *dinit(); static struct FileLock *pdir = NL; static struct FileInfoBlock *dir_info; static struct Window *eW; /* Parent Window. Uck */ static struct TextAttr MyFont = {"topaz.font",TOPAZ_EIGHTY,FS_NORMAL,FPF_ROMFONT }; /* FGAD requires a few unique gadget-ids, origined at FGAD */ /* In the unlikely event this conflicts with any of your gadgets, */ /* change this equate to allow 16 contiguous unique ID's */ #define FGAD 0x76c0L #define FCHARS 32L /* Number of chars allowed in file name */ #define DIR_SIZ 50L /* Number of chars in a dir name... */ #define MAX_STR DIR_SIZ+2L #define DENTS 5L /* Number of entries on screen */ /* It's not as simple as changing 'DENTS'... */ #define DSIZE FCHARS+1L /* Size of a directory entry */ #define DBUFSIZ 3000L /* Number of bytes to allocate for all ents */ #define BCOL 1L /* Background color */ #define FCOL 2L /* Foreground color */ #define RHGHT 120L #define RWDTH 320L #define ZWDTH 270L static char ubuf[MAX_STR]; /* Undo buffer */ static struct dirent { struct dirent *next; BOOL isfile; char dE[DSIZE+2]; }; static struct dirent *FirstEntry; static struct dirent *NextEntry; static struct dirhead { struct dirent *next; }; static struct dirhead ListHead; static long curent,maxent; static BOOL more; static struct Window *wRq = NL; /* Requester window */ static struct RastPort *wRp; /* Requester "Hailing" prompt */ static struct IntuiText oTxt = {2,2,JAM1,10,11,NL, NL ,NL}; static struct IntuiText saydir = {0,1,JAM2,0,1,&MyFont,(UBYTE *)"(dir) ",NL}; static struct IntuiText rname[DENTS] = { /* File name list */ {2,1,JAM2,48,1,NL,NL, NL}, {2,1,JAM2,48,1,NL,NL, NL}, {2,1,JAM2,48,1,NL,NL, NL}, {2,1,JAM2,48,1,NL,NL, NL}, {2,1,JAM2,48,1,NL,NL, NL} }; /* Display for file name ... */ static SHORT oXY2[] = {-2,-2, RWDTH-78,-2, RWDTH-78,9, -2,9, -2,-2}; static struct Border thebd = {0,0, 2,3,JAM1, 5,oXY2, NL}; static struct IntuiText otxt = {2,2,JAM1,-40,0,&MyFont,(UBYTE *)"file",NL}; static struct StringInfo osx = { NL ,ubuf, NL,DSIZE,NL,NL,NL,NL,NL,NL,NL,NL,NL}; static struct Gadget ogx = { NL, 60,RHGHT-35,RWDTH-80 ,10, /* File name gadget */ GADGHCOMP, RELVERIFY , STRGADGET, (APTR)&thebd,NL,&otxt,NL,(APTR)&osx, FGAD+11,NL }; static struct Gadget oga = { &ogx, 10,70, ZWDTH,10, /* Gadgets For */ GADGHCOMP, RELVERIFY, BOOLGADGET, /* Directory entries */ NL,NL, &rname[4] ,NL,NL, FGAD+10,NL }; static struct Gadget og9 = {&oga, 10,60, ZWDTH,10, GADGHCOMP, RELVERIFY, BOOLGADGET, NL,NL, &rname[3] ,NL,NL, FGAD+9,NL }; struct Gadget og8 = {&og9, 10,50, ZWDTH,10, GADGHCOMP, RELVERIFY, BOOLGADGET, NL,NL, &rname[2] ,NL,NL, FGAD+8,NL }; static struct Gadget og7 = {&og8, 10,40, ZWDTH,10, GADGHCOMP, RELVERIFY, BOOLGADGET, NL,NL, &rname[1] ,NL,NL, FGAD+7,NL }; static struct Gadget og6 = {&og7, 10,30, ZWDTH,10, GADGHCOMP, RELVERIFY, BOOLGADGET, NL,NL, &rname[0] ,NL,NL, FGAD+6,NL }; /* Gadjets for requester */ static SHORT oXY3[] = {0,0, 50,0, 50,9, 0,9, 0,0}; static SHORT oXY4[] = {2,-2, 48,-2, 52,2, 52,7, 48,11, 2,11, -2,7, -2,2, 2,-2}; static struct Border obd2 = {0,0, 2,3,JAM1, 9,oXY4, NL}; static struct Border obd1 = {0,0, 3,2,JAM1, 5,oXY3, &obd2}; /* OTAY / CANCEL box */ static struct IntuiText ot1 = {0,0,JAM1,1,1,&MyFont,(UBYTE *)" OK ",NL}; static struct IntuiText ot2 = {0,0,JAM1,1,1,&MyFont,(UBYTE *)"Cancel",NL}; static struct IntuiText dtxt = {2,2,JAM1,-60,0,NL,(UBYTE *)"drawer",NL}; static struct StringInfo os5 = { NL ,ubuf, NL,DIR_SIZ,NL,NL,NL,NL,NL,NL,NL,NL,NL}; static struct Gadget og5 = { &og6, RWDTH/2-80,19,190,10, /* Directory */ GADGHCOMP, RELVERIFY, STRGADGET, NL,NL,&dtxt,NL,(APTR)&os5, FGAD+5,NL }; static struct Image cc_img; static struct PropInfo cc_prop = {AUTOKNOB | FREEVERT, 0,0, 0,0x1000,0,0,0,0,0,0 }; static struct Gadget og3 = { &og5,RWDTH-39,20,20,60, /* Scroll Bar */ GADGHCOMP,GADGIMMEDIATE | FOLLOWMOUSE, PROPGADGET, (APTR)&cc_img,NL,NL,NL,(APTR)&cc_prop,FGAD+3,NL }; static struct Gadget og2 = { &og3, RWDTH-70,RHGHT-20, 50,10, /* CANCEL */ GADGHCOMP, RELVERIFY, BOOLGADGET, (APTR)&obd1,NL, &ot2,NL,NL, FGAD+2,NL }; static struct Gadget og1 = { &og2, 20,RHGHT-20, 50,10, /* OTAY */ GADGHCOMP, /* Flags */ RELVERIFY, /* Activation */ BOOLGADGET, (APTR)&obd1,NL, /* GadgetRender, SelectRender */ &ot1,NL,NL, /* IntuiText, MutualExclude,SpecialInfo */ FGAD+1,NL }; /* Gadget Id, UserData */ /* Open a requester "Window" */ static struct NewWindow NewFiles = { 160, 30, RWDTH,RHGHT, BCOL,FCOL, NL, /* Fill in AFTER opening ... */ SMART_REFRESH | ACTIVATE | RMBTRAP | WINDOWDRAG, &og1,NL,NL, NL, NL, RWDTH,RHGHT,RWDTH,RHGHT, WBENCHSCREEN }; IMPORT struct Library *IntuitionBase; /*************************************************** * get_fname(window,screen,hail,ddef,ddir); * * Displays a window/requester that * gets a file name for device,directory,default file, extension * * Calling args: * window: Window making the request * screen: Screen, if NULL assummed workbench * hail: Text prompt at top of requester * ddef: Input default file-name. Has NO DIRECTORY OR EXTENSION. * ddir: Directory of file, may be null /* Set a file-requester with prompt 'hail' */ char *get_fname(cW,screen,hail,ddef,ddir) struct Window *cW; /* Calling Window */ struct Screen *screen; /* screen .... if null assumed workbench */ UBYTE *hail; /* Hailing prompt */ char *ddef; /* Proable file-name */ char *ddir; /* Directory in which to search */ { FAST struct IntuiMessage *imes; /* Wait for message in HERE */ FAST struct Gadget *igad; /* Get Gadjet Mumbo Jumbo */ FAST long i,class; FAST TEXT *pnam; FAST char *retval; FAST BOOL dir_flag; FAST BOOL keepon; if ( ! (eW = cW) ) return(NL); osx.Buffer = ddef; /* Set default file name */ os5.Buffer = ddir; /* Set default device name */ for ( i=0; iTitle; if ((dir_info = AllocMem((long)sizeof(struct FileInfoBlock),0L)) == NULL) return(NL); if (screen) /* User supplied a screen */ { NewFiles.Type = CUSTOMSCREEN; NewFiles.Screen = screen; } if ( ! (FirstEntry = (struct dirent *)AllocMem((long)DBUFSIZ,0L)) || ! (wRq = (struct Window *)OpenWindow( &NewFiles )) ) { if ( FirstEntry ) FreeMem(FirstEntry,(long)DBUFSIZ); /* notify("Can't Open Requester..."); */ FreeMem(dir_info,(long)sizeof(struct FileInfoBlock)); return(NL); } /* Set up directory, notify any errors... */ if ( pnam = (char *)dinit(ddir) ) notify(pnam); /* This optional line will activate a string gadget */ if ( IntuitionBase->lib_Version > 32 ) { ActivateGadget(&ogx,wRq,0L); } wRp = wRq->RPort; wRq->UserPort = eW->UserPort; ModifyIDCMP(wRq,(long)(MOUSEBUTTONS | GADGETDOWN | GADGETUP | MOUSEMOVE)); SetAPen(wRp,1L); RectFill(wRp,4L,10L,(long)(RWDTH-5),(long)(RHGHT-4)); oTxt.IText = hail; /* Set calling arg */ oTxt.LeftEdge = (RWDTH - IntuiTextLength(&oTxt)) >> 1L; PrintIText(wRp,&oTxt,0L,0L); RefreshGadgets(&og1,wRq,(long)NL); for ( retval= NL, keepon=TRUE; keepon ; ) { while ( ! (imes=(struct IntuiMessage *)GetMsg(wRq->UserPort)) ) { if ( dir_flag ) { i = (maxent-DENTS) * cc_prop.VertPot / MAXBODY; if ( i > (maxent-DENTS) ) i = maxent-DENTS; if ( i <0 ) i = 0; curent = i; cxxx(); dir_flag = FALSE; } if ( more ) { if (pnam = (char *)dmore()) /* Continue to read the directory */ notify(pnam); /* Yucko error */ if ( maxent <= DENTS ) dir_flag = TRUE; } else WaitPort(wRq->UserPort); } igad = (struct Gadget *)imes->IAddress; class = imes->Class; ReplyMsg(imes); switch (class) { case MOUSEMOVE: dir_flag = TRUE; break; case GADGETUP: case GADGETDOWN: switch ( i = igad->GadgetID) { case FGAD+6: case FGAD+7: case FGAD+8: case FGAD+9: case FGAD+10: /* Replace file or directory name */ pnam = rname[i - (FGAD+6)].IText; if ( rname[igad->GadgetID - (FGAD+6)].NextText == NL ) { RemoveGadget(wRq,&ogx); for (i=0; ifib_DirEntryType < 0L ) return("Bizzare Alert!!"); more = TRUE; return(dmore()); } static char *dmore() { FAST struct dirent *p_D = NextEntry; FAST struct dirent *ptr = (struct dirent *)&ListHead; FAST struct dirent *plink; FAST TEXT *p_mung; FAST long i; if ( ! more ) return(NL); if ( ExNext( pdir, dir_info ) ) { if ( (ULONG)p_D >= ((ULONG)FirstEntry + (ULONG)DBUFSIZ - (ULONG)sizeof(struct dirent)) ) { more = FALSE; return("Directory Truncated!"); } /* Here you can add a file/directory filter */ /* filename text string is at &p_D->dE[0 */ p_D->isfile = ( dir_info->fib_DirEntryType < 0L ); p_mung = &p_D->dE[0]; for ( i=0; ifib_FileName[i]) ) break; i = (long)p_mung; NextEntry = (struct dirent *)( (i+5L) & ~3L ); for ( i=maxent++; i>=0; i--) { if ( ! (plink = ptr->next) ) break; if ( alpha_lower(p_D,plink) ) break; ptr = plink; } p_D->next = plink; ptr->next = p_D; return(NL); } else return ( IoErr() == ERROR_NO_MORE_ENTRIES) ? (char *)(more = (long)NL) : "Error Reading Directory!!!"; } /* dedicated alphabetizing function for dmore() */ static alpha_lower(snew,sold) struct dirent *snew,*sold; { FAST struct dirent *pnew = snew; FAST TEXT *ps1,*ps2, c,d; if ( pnew->isfile == sold->isfile) { ps1 = &pnew->dE[0]; ps2 = &sold->dE[0]; while ( (c=*ps1++) ) { if ( c > (d=*ps2++) ) return(FALSE); else if ( c < d ) break; } return(TRUE); } return(pnew->isfile); } /* Display directory stuff */ static cxxx() { FAST long i,new; FAST long x,y; FAST struct dirent *ohboy = (struct dirent *)&ListHead; new = curent; for ( i=0; inext; y = 20L; for (i=0; inext; rname[i].IText = &ohboy->dE[0]; if ( ohboy->isfile ) PrintIText(wRp,&rname[i],10L,y); else { rname[i].LeftEdge = 48; PrintIText(wRp,&saydir,10L,y); PrintIText(wRp,&rname[i],10L,y); rname[i].NextText = &saydir; } x = wRp->cp_x; } if ( x < ZWDTH+10 ) RectFill(wRp,x,y,(long)(ZWDTH+10),(long)(y+8L)); } } /************************************************** * rfnam() * Combines dir, plus name into dir */ static rfnam(dir,fil_nam) char *dir,*fil_nam; { FAST char *pdst = dir; FAST char *psrc = fil_nam; FAST char c = ':'; while ( *pdst ) c = *pdst++; if ( c != ':') *pdst++ = '/'; while ( *pdst++ = *psrc++ ) ; } static struct IntuiText b_txt = {0,1,JAM2, 5,20,NL,NL, NL}; static struct IntuiText p_txt = {0,1,JAM2, 5,3,NL,"OK", NL}; /****************************************************************/ /* notify(txt) */ /* Prompts for Yes/No response */ static notify(txt) char *txt; { b_txt.IText = txt; AutoRequest(wRq,&b_txt,0L,&p_txt,0L,0L, (long)(IntuiTextLength(&b_txt)+50L),70L); } //E*O*F getfile.c// echo x - getfile.diffs cat > "getfile.diffs" << '//E*O*F getfile.diffs//' diff -c -w OGetFile/getfile.c GetFile/getfile.c *** OGetFile/getfile.c Tue May 19 01:45:05 1987 --- GetFile/getfile.c Mon May 18 23:58:30 1987 *************** *** 161,170 **** /* Open a requester "Window" */ static struct NewWindow NewFiles = { ! 160, 30, RWDTH,RHGHT, BCOL,FCOL, NL, /* Fill in AFTER opening ... */ SMART_REFRESH | ACTIVATE | RMBTRAP | WINDOWDRAG, &og1,NL,NL, NL, ! NL, RWDTH,RHGHT,RWDTH,RHGHT, WBENCHSCREEN }; IMPORT struct Library *IntuitionBase; --- 161,170 ---- /* Open a requester "Window" */ static struct NewWindow NewFiles = { ! 0, 0, RWDTH,RHGHT, BCOL,FCOL, NL, /* Fill in AFTER opening ... */ SMART_REFRESH | ACTIVATE | RMBTRAP | WINDOWDRAG, &og1,NL,NL, NL, ! NL, RWDTH,RHGHT,RWDTH,RHGHT, CUSTOMSCREEN }; IMPORT struct Library *IntuitionBase; *************** *** 223,234 **** if ( ! (FirstEntry = (struct dirent *)AllocMem((long)DBUFSIZ,0L)) || ! (wRq = (struct Window *)OpenWindow( &NewFiles )) ) { if ( FirstEntry ) FreeMem(FirstEntry,(long)DBUFSIZ); /* notify("Can't Open Requester..."); */ FreeMem(dir_info,(long)sizeof(struct FileInfoBlock)); return(NL); } - /* Set up directory, notify any errors... */ if ( pnam = (char *)dinit(ddir) ) notify(pnam); --- 223,237 ---- if ( ! (FirstEntry = (struct dirent *)AllocMem((long)DBUFSIZ,0L)) || ! (wRq = (struct Window *)OpenWindow( &NewFiles )) ) { + if (!FirstEntry) + notify("Can't Open first entry"); + if (!wRq) + notify("Can't Open new window"); if ( FirstEntry ) FreeMem(FirstEntry,(long)DBUFSIZ); /* notify("Can't Open Requester..."); */ FreeMem(dir_info,(long)sizeof(struct FileInfoBlock)); return(NL); } /* Set up directory, notify any errors... */ if ( pnam = (char *)dinit(ddir) ) notify(pnam); //E*O*F getfile.diffs// echo x - getfile.h cat > "getfile.h" << '//E*O*F getfile.h//' /*************************************************** * get_fname(window,screen,hail,ddef,ddir); * * Displays a window/requester that * gets a file name for device,directory,default file, extension * * Calling args: * window: Window making the request * screen: Screen, if NULL assummed workbench * hail: Text prompt at top of requester * ddef: Input default file-name. Has NO DIRECTORY OR EXTENSION. * ddir: Directory of file, may be null * * The basic call is: * * getfile(Window,Screen,Hailing_string,file_name,directory_name); * * Where: * Window is a pointer to your window * Screen is a pointer to your screen ... or (long)NULL if workbench * Hailing_string is a prompt displayed in the requester * file_name is a text array which will be altered by getfile, * it returns the file name. * directory_name is a text array altered by getfile, it * is the directory. * * The return value is either a pointer to your buffer, file_name, * or NULL if the user selected CANCEL. * * You must reserve two text areas for file and directory like so: * * #define FNAME_SIZE 33 * TEXT file_name[FNAME_SIZE + 1]; * TEXT dir_name[FNAME_SIZE + 2] **********************************************************************/ #ifndef GET_FNAME #define GET_FNAME #define FNAME_SIZE 33 extern char *get_fname(); #endif //E*O*F getfile.h// echo x - safeclose.c cat > "safeclose.c" << '//E*O*F safeclose.c//' /* CloseWindowSafely() * This module should be used whenever you are sharing an IDCMP * message port with more than one window. Rather than calling CloseWindow(), * you should use CloseWindowSafely(). This will keep Intuition from * Guru Meditation, and thus is considered a good thing. You should still * use CloseWindow for the very last window you close. * The reason this is needed, is because Intuition will re-claim * any outstanding messages for a window when the window is closed. But... * it can't take them out of your message port. Thus, you will receive * invalid messages and bad things will happen. Very bad things. * This code is a slightly condensed version of the same routine * written by Neil Katin of Amiga for the April '86 Commodore Developers * Newsletter, Amiga Mail (tm). */ /* #include #include #include #include #include #include */ #include "standard.h" void CloseWindowSafely( p_wind ) struct Window *p_wind; { register struct IntuiMessage *msg; register struct IntuiMessage *succ; register struct Window *win = p_wind; register struct MsgPort *mp = (struct MsgPort *)win->UserPort; Forbid(); msg = (struct IntuiMessage *)mp->mp_MsgList.lh_Head; while ( succ=(struct IntuiMessage *)msg->ExecMessage.mn_Node.ln_Succ ) { if ( msg->IDCMPWindow == win ) { Remove ( msg ); ReplyMsg( msg ); } msg = succ; } win->UserPort = NULL; ModifyIDCMP( win, 0L ); Permit(); CloseWindow( win ); } //E*O*F safeclose.c// echo x - safeclose.h cat > "safeclose.h" << '//E*O*F safeclose.h//' /* CloseWindowSafely() * This module should be used whenever you are sharing an IDCMP * message port with more than one window. Rather than calling CloseWindow(), * you should use CloseWindowSafely(). This will keep Intuition from * Guru Meditation, and thus is considered a good thing. You should still * use CloseWindow for the very last window you close. * The reason this is needed, is because Intuition will re-claim * any outstanding messages for a window when the window is closed. But... * it can't take them out of your message port. Thus, you will receive * invalid messages and bad things will happen. Very bad things. * This code is a slightly condensed version of the same routine * written by Neil Katin of Amiga for the April '86 Commodore Developers * Newsletter, Amiga Mail (tm). */ #ifndef SAFECLOSE #define SAFECLOSE /* CloseWindowSafely(window), window is pointer to struct Window */ extern void CloseWindowSafely(); #endif //E*O*F safeclose.h// echo x - standard.h cat > "standard.h" << '//E*O*F standard.h//' #include #include #include #include #include #ifdef MANX #include #endif //E*O*F standard.h// echo x - testing.c cat > "testing.c" << '//E*O*F testing.c//' #include #include #include #ifdef MANX #include #endif #define I_REV 31 #define G_REV 31 #define EWDTH 640 #define EHGHT 198 #define NL NULL struct IntuitionBase *IntuitionBase; struct GfxBase { int b; } *GfxBase; struct NewScreen TS = { 0,0,640,200,2, 1,2, HIRES, WBENCHSCREEN, 0L, 0L, 0L }; /* Used to open a Window */ struct NewWindow EdWindow = { 0,2,EWDTH,EHGHT-2, /* LeftEdge,TopEdge,Width,Height */ 1,2, /* DetailPen,BlockPen */ MENUPICK | NEWSIZE | REFRESHWINDOW | ACTIVEWINDOW | MOUSEBUTTONS | RAWKEY | MOUSEMOVE, WINDOWDRAG | WINDOWSIZING | SIMPLE_REFRESH | ACTIVATE | WINDOWDEPTH, NL,NL,"Window", /* FirstGadget, CheckMark, Title */ NL, /* Screen ( Null) */ NL, /* BitMap */ 150,45,32767,32767, /* MinW, MinH, MaxW, MaxH */ CUSTOMSCREEN }; /* Type */ main() { struct Window *eW; struct Screen *eS; struct Process *OurTask; struct Window *old_pr_WindowPtr; static char def_name[50] = "Meps"; static char def_dir[50] = "df1:"; if ( ! (IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library",(long)I_REV)) || ! (GfxBase =(struct GfxBase *)OpenLibrary("graphics.library",(long)G_REV)) ) { printf("Can't open libraries\n"); exit(20); } if ( ! (eS = (struct Screen *)OpenScreen(&TS)) ) { printf("Can't Open Screen!!!!!\n"); exit(22); } EdWindow.Screen = eS; if ( ! (eW =(struct Window *)OpenWindow(&EdWindow)) ) { CloseScreen(eS); printf("Can't open window...\n"); exit(21); } /* CAUTION!!! KNOW ABOUT pr_WindowPtr before you use it!!! */ OurTask = (struct Process *)FindTask(0L); old_pr_WindowPtr = OurTask->pr_WindowPtr; OurTask->pr_WindowPtr = eW; get_fname(eW,eS,"Nicht",def_name,def_dir); printf("File name is :%s\n",def_name); printf("Directory is :%s\n",def_dir); /* ALWAYS RESTORE pr_WindowPtr BEFORE CLOSING THE WINDOW!!! */ OurTask->pr_WindowPtr = old_pr_WindowPtr; CloseWindow(eW); CloseScreen(eS); CloseLibrary(GfxBase); CloseLibrary(IntuitionBase); } //E*O*F testing.c// echo Possible errors detected by \'wc\' [hopefully none]: temp=/tmp/shar$$ trap "rm -f $temp; exit" 0 1 2 3 15 cat > $temp <<\!!! 18 74 477 Makefile 32 214 1296 README 10 67 413 README.1ST 513 1878 15293 getfile.c 56 234 1939 getfile.diffs 46 197 1346 getfile.h 53 229 1662 safeclose.c 26 156 973 safeclose.h 9 15 186 standard.h 97 244 2140 testing.c 860 3308 25725 total !!! wc Makefile README README.1ST getfile.c getfile.diffs getfile.h safeclose.c safeclose.h standard.h testing.c | sed 's=[^ ]*/==' | diff -b $temp - exit 0 -- UUCP: orandy@amdahl.amdahl.com or: {sun,decwrl,hplabs,pyramid,ihnp4,seismo,oliveb,cbosgd}!amdahl!orandy DDD: 408-737-5481 USPS: Amdahl Corp. M/S 249, 1250 E. Arques Av, Sunnyvale, CA 94086 [ Any thoughts or opinions which may or may not have been expressed ] [ herein are my own. They are not necessarily those of my employer. ]