home *** CD-ROM | disk | FTP | other *** search
-
- /*
-
- File object class definition for GCOOPE10
-
- released as PUBLIC DOMAIN 4/25/94 ported and modified 7/21/94
-
- */
-
-
-
- #define CLASS File
-
- #include "gcoope10.h"
- #include <stdio.h>
-
- object CLASS;
-
- extern object StdStream;
-
- USEGEN(addressOf);
-
-
- cmethod object m4New(object instance, const char * fnam, const char * mode)
- {
- if(NULL==makeInst(&instance)) return 0L;
- g(New)(ST(StdStream), fopen(fnam, mode));
- return instance;
- }
-
-
- cmethod object m4Kill(object instance)
- {
- FILE * handle;
-
- handle=((VDPTRRV)g)(GEN(addressOf))(instance);
- if(handle!=NULL)
- {
- fclose(handle);
- }
- g(Kill)(ST(StdStream));
- g(Kill)(Object, instance);
- return instance;
- }
-
-
- CLASS_INSTALL
- {
- if(END==(CLASS=g(New)(Class, 0, 0, StdStream, END))
- || addGMthd(CLASS, New, (method) m4New)
- || addGMthd(CLASS, Kill, (method) m4Kill)) return FUNCFAIL;
- else return FUNCOKAY;
- }