home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
CSSRC
/
SDSAVE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-11-01
|
2KB
|
98 lines
/*
sdload.c
% sfile_LoadSed, sf_loadsed, sf_savesed
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, removed ifdef'd stuff
11/06/89 jmd removed DoRaw Macro
12/17/89 jdc fixed attrs
3/28/90 jmd ansi-fied
8/08/90 jdc moved aux function down to window level
11/01/90 ted put (void) in arg list of sedwin_SaveInit.
*/
#include "sed.h"
#include "sfile.h"
#include "sfilpriv.h"
#include "sedwinod.h"
#include "ufuncobj.h"
#include "teddecl.h"
OSTATIC objreq_func (sdwinreq_save);
void sedwin_SaveInit(void)
{
sdwinreq_savefptr = sdwinreq_save;
win_SaveInit();
ufunc_SaveInit();
}
boolean sfile_SaveSed(sfile_type sfile, sed_type sed, char *name)
{
sedwin_SaveInit();
return(sfile_SaveObj(sfile, sed, name));
}
static int sdwinreq_save(VOID *objdata, int msg, VOID *indata, VOID *outdata)
{
sed_type sed;
sfile_type sfile;
bfile_type bfile;
char *s[3], *sbuf;
sed = sedod_GetSelf((sedwin_od *)objdata);
sfile = (sfile_type)indata;
if (!win_Class(&((sedwin_od *)objdata)->wd, msg, indata, outdata)) {
return(FALSE);
}
bfile = sfile->bfile;
sbuf = sfile->buf;
/* menu info: */
if (!sf_savemenu(sfile, sed_GetMenu(sed))) {
return(FALSE);
}
/* sed info:
* label, back, reg, sel, hireg, hisel,
* move method, special, ox
*/
/* if there is an funcname iarray pull names that way,
* else search off func directly
*/
if (menu_GetFuncNameA(sed_GetMenu(sed)) == NULL) {
s[0] = (sed_GetMoveMethod(sed) == FNULL) ? "" : sfile_FindMoveMethodName(sfile, sed_GetMoveMethod(sed));
s[1] = (sed_GetSpecial(sed) == FNULL) ? "" : sfile_FindSpecialName(sfile, sed_GetSpecial(sed));
}
else {
s[0] = sed_GetMoveMethodName(sed, sfile);
s[1] = sed_GetSpecialName(sed, sfile);
}
/* aux function moved down to the window level */
s[2] = "";
sprintf(sbuf, "%d %d %d %d %d %d\n%s\n%s\n%s\n",
sed_GetLabel(sed), (int)win_GetAttr(sed), (int)sed_GetRegAttr(sed),
(int)sed_GetSelAttr(sed), (int)sed_GetHiRegAttr(sed),
(int)sed_GetHiSelAttr(sed),
fsym_NullCheck(s[0]), fsym_NullCheck(s[1]), s[2]);
if (!bfile_Write(bfile, sbuf, strlen(sbuf))) {
return(FALSE);
}
return(TRUE);
}