home *** CD-ROM | disk | FTP | other *** search
- /*
- ufncload.c
-
- % ufuncreq_load
-
- C-scape 3.2
- Copyright (c) 1988-1990 by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 10/25/89 jmd added static to definition
- 3/28/90 jmd ansi-fied
- 4/16/90 jdc renamed _bfile_gets to bf_gets
- 5/02/90 jdc preened
- 11/01/90 ted put (void) in arg list of ufunc_LoadInit.
- 1/02/90 jdc fixed handle = -1 initialization
- */
-
- #include "sed.h"
- #include "ufuncobj.h"
- #include "ufuncod.h"
- #include "sfile.h"
- #include "sfilpriv.h"
-
- OSTATIC objreq_func (ufuncreq_load);
-
- void ufunc_LoadInit(void)
- {
- ufuncreq_loadfptr = ufuncreq_load;
- }
-
- ufunc_fptr ufunc_unresolved_fptr = FNULL;
-
- static int ufuncreq_load(VOID *objdata, int msg, VOID *indata, VOID *outdata)
- /*
- sfile load code for ufunc object
- */
- {
- int handle;
- ufuncopen_struct ufuncopen;
- sfile_type sfile;
- bob_type bob;
-
- oak_notused(outdata);
- oak_notused(msg);
-
- sfile = (sfile_type)indata;
- bob = ufuncod_GetSelf((ufunc_od *)objdata);
-
- /* ufunc info:
- idata, ufunc name
- */
- if (bf_gets(sfile->bfile, sfile->buf, SFILE_BUFLEN, '\0') == 0) {
- return(FALSE);
- }
- ufuncopen.idata = atoi(sfile->buf);
-
- if (bf_gets(sfile->bfile, sfile->buf, SFILE_BUFLEN, '\0') == 0) {
- return(FALSE);
- }
-
- if (strcmp(sfile->buf, FSYM_NULLSTR) == 0) {
- ufuncopen.ufunc = FNULL;
- handle = -1;
- }
- else if ((ufuncopen.ufunc = sfile_FindUserFunc(sfile, sfile->buf, &handle)) == FNULL) {
- ufuncopen.ufunc = ufunc_unresolved_fptr;
- }
-
- if (handle == -1) {
- handle = sfile_PutUserFunc(sfile, sfile->buf, ufuncopen.ufunc);
- }
- ufuncbob_SetFuncHandle(bob, handle);
-
- return(obj_Do(bob, OBJM_INIT, &ufuncopen, NULL));
- }
-