home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
EXAMPLES
/
DEMOFSAV.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-03-09
|
3KB
|
145 lines
/*
demofsav.c
jmd 6/89
C-scape 3.2 Example Program
Copyright (c) 1989, 1990 by Oakland Group, Inc.
ALL RIGHTS RESERVED.
This program demonstrates saving a sed to a screen file.
It saves the sed to the screen file "test.lnf"
with the screen name "test"
You can use the example program DEMOFLOD to load the screen.
Note: this version of this program is slightly more sophisticated
than the one mentioned in the C-scape manual. It contains an
embedded sed.
Revision History:
-----------------
1/10/90 jmd added bobs
6/06/90 jmd changed main to return an int
9/14/90 bkd changed to use exit(0) instead of return(0).
10/19/90 pmcm included ostdlib.h for exit(), added return(1)
12/01/90 ted prototyped main, except if Turbo C++.
12/04/90 ted restored "" includes for C-scape headers (not <> includes).
*/
#include <stdio.h>
#include "cscape.h"
#include "ostdlib.h" /* for exit() */
#include "sfile.h"
/* function symbol table */
fsyminit_struct my_list[] = {
{FSYM_CLASS},
{"sedwin_Class", (VOID_FPTR) sedwin_Class , NULL },
{FSYM_FIELDFUNCS },
{"bob_funcs", FNULL, (VOID *) &bob_funcs},
{"string_funcs", FNULL, (VOID *) &string_funcs},
{"cmoney_funcs", FNULL, (VOID *) &cmoney_funcs},
{FSYM_USER },
{FSYM_BORDER },
{"bd_prompt", (VOID_FPTR) bd_prompt, NULL},
{FSYM_MOUSE },
{FSYM_MOVEMETHOD },
{FSYM_EXPLODE },
{FSYM_SPECIAL },
{"spc_Embed", (VOID_FPTR) spc_Embed, NULL },
{FSYM_AUX },
{FSYM_LISTEND}
};
/* Turbo C++ complains if main is prototyped */
#ifndef TCP
int main(void);
#endif
int main(void)
{
menu_type menu, bmenu;
sed_type sed, bsed;
sfile_type sfile;
int i;
/* Initialize the display */
disp_Init(def_ModeText, FNULL);
/* Open the sfile */
sfile = sfile_Open("test.lnf", my_list);
/* Create the sed */
menu = menu_Open();
menu_Printf(menu, "\n Customer:\n\n Boat Name:\n\n Boat Cost:");
menu_Printf(menu, "@p[1,12]@f{customer}[@[21,#]]",
NULL, &string_funcs);
menu_Printf(menu, "@p[3,12]@f{boatname}[@[21,#]]",
NULL, &string_funcs);
menu_Printf(menu, "@p[5,12]@f{boatcost}[@[14,#]]",
NULL, &cmoney_funcs);
/* Generate bobbed sed */
bmenu = menu_Open();
for (i = 0; i < 10; i++) {
menu_Printf(bmenu, "@p[%d,0]%2d @fd[@[26,#]]", i, i,
NULL, &string_funcs, "Enter a sail type");
}
menu_Flush(bmenu);
bsed = sed_Open(bmenu);
sed_SetColors(bsed, 0x17, 0x17, 0x71);
sed_SetBorder(bsed, bd_prompt);
sed_SetBorderTitle(bsed, "Sail types purchased");
sed_SetPosition(bsed, 10, 21);
sed_SetHeight(bsed, 4);
sed_SetWidth(bsed, 30);
sed_SetSpecial(bsed, spc_Embed);
menu_Printf(menu, "@p[8,2]@f{list}b[]",
NULL, &bob_funcs, sed_CreateBob(bsed, BOB_DEPENDENT));
menu_Flush(menu);
sed = sed_Open(menu);
sed_SetColors(sed, 0x34, 0x30, 0x40);
sed_SetBorder(sed, bd_prompt);
sed_SetBorderTitle(sed, "Sails Tracker");
sed_SetPosition(sed, 2, 18);
sed_SetHeight(sed, 15);
sed_SetWidth(sed, 38);
/* Put the sed into the sfile */
sfile_SaveSed(sfile, sed, "test");
/* allocate variables for the sed so that we can use it */
sed_Alloc(sed);
sed_Repaint(sed);
sed_Go(sed);
sed_Close(sed);
sfile_Close(sfile);
disp_Close();
exit(0);
return(0);
}