home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
LNF
/
LNF.C
next >
Wrap
C/C++ Source or Header
|
1990-12-24
|
10KB
|
290 lines
/*
lnf.c
% The Look & Feel 3.2 main module
Includes symbol table listing for linked-in functions,
and keyboard/operation assignment table.
Look & Feel 3.2
Copyright (c) 1989-1990, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
11/01/89 jdc added sdouble_funcs to funcs list
3/30/90 jmd ansi-fied
4/17/90 jdc added help filename to lnf_Open args
4/19/90 jdc added radio_funcs to list
5/04/90 jdc added novalidate_funcs
5/09/90 jdc cleaned up
5/11/90 jdc fixed mark_funcs type
8/08/90 jmd made main an int
8/24/90 jdc switched to lnfmenu.h scheme
8/31/90 jdc improved the COM_ scheme
9/21/90 pmcm made lnffsym_list OGLOBAL
9/24/90 jmd added code for ctrl break, UNIX meta keys
9/26/90 pmcm made help hxd OGLOBAL
10/08/90 bkd call exit instead of return at end of main.
10/16/90 jmd removed ROLO, added TCP stuff
10/18/90 jmd added ver_ident
10/19/90 pmcm made ver_ident OGLOBAL
10/30/90 jsm Changed <> to "" on non-system includes
10/30/90 pmcm removed obsolete cntrl-meta-key set (ctrl-x by default,now)
12/24/90 pmcm /jdc, added blwin_Class background window to disp_Init
*/
#include <stdio.h>
#include "cscape.h"
#include "sfile.h"
#include "sled.h" /* for sleds */
#include "msys.h" /* for ufuncobj.h and msys funcs */
#include "teddecl.h" /* ted funcs */
#include "fnfunc.h" /* string funcs */
#include "helpdecl.h" /* hx_struct (help init data) */
#include "lnfsys.h" /* for LNF system functions */
#include "scancode.h"
#include "sedpriv.h" /* for sed_ReallyGo */
#include "ostdlib.h" /* has prototype for exit() */
#ifdef TC
# define CBREAK
#endif
#ifdef TCP
# define CBREAK
#endif
/* include control break handler for Turbo C */
#ifdef CBREAK
# include <dos.h>
#endif
#ifndef TCP
int main(int argc, char *argv[]); /* Prototype for main */
#endif
int lnf_Beep(VOID *sdata, int idata);
/* Global string for "version" identifier in about box */
#ifdef OAK_RATIONAL
OGLOBAL char *ver_ident = "Rational 16/M";
#else
OGLOBAL char *ver_ident = NULL;
#endif
/* -------------------------------------------------------------------------- */
/* This is the Look & Feel symbol table. All functions that are
to be actually linked into lnf.exe should be included under the
appropriate category in the list below.
To include a new function, you must include an entry for it in
the symbol table (below). All field functions must have their
variable type included (with an embedded terminating '\0' character)
BEFORE the field function's name. This tells Look & Feel what variable
type the field should have. The field function category is preceded
with the FSYM_TYPENFFUNCS tag (not the usual FSYM_FIELDFUNCS tag). This
tag indicates that the list is being used by lnf.exe and contains
variable type information. Use "void" for field functions that
have no variable (like menu_funcs).
Any symbol that is preceded by an underbar character '_' will be
suppressed from Look & Feel popup lists. There are several such
"system" functions in the list below.
*/
OGLOBAL fsyminit_struct lnffsym_list[] = {
{FSYM_CLASS}, /* class functions */
{"sedwin_Class", (VOID_FPTR)lnfsed_Class, NULL },
{"sledwin_Class", (VOID_FPTR)lnfsled_Class, NULL },
{"ufunc_Class", (VOID_FPTR)ufunc_Class, NULL },
{FSYM_TYPENFFUNCS}, /* field functions */
{"char *\0alpha_funcs", FNULL, (VOID *) &alpha_funcs },
{"void\0bob_funcs", FNULL, (VOID *) &bob_funcs },
{"char *\0char_funcs", FNULL, (VOID *) &char_funcs },
{"boolean *\0check_funcs", FNULL, (VOID *) &check_funcs },
{"void\0click_funcs", FNULL, (VOID *) &click_funcs },
{"long *\0clong_funcs", FNULL, (VOID *) &clong_funcs },
{"long *\0cmoney_funcs", FNULL, (VOID *) &cmoney_funcs },
{"struct tm *\0date_funcs", FNULL, (VOID *) &date_funcs },
{"char *\0digit_funcs", FNULL, (VOID *) &digit_funcs },
{"double *\0double_funcs", FNULL, (VOID *) &double_funcs },
{"void\0framer_funcs", FNULL, (VOID *) &framer_funcs },
{"void\0gmenu_funcs", FNULL, (VOID *) &gmenu_funcs },
{"int *\0hex_funcs", FNULL, (VOID *) &hex_funcs },
{"int *\0int_funcs", FNULL, (VOID *) &int_funcs },
{"char *\0list_funcs", FNULL, (VOID *) &list_funcs },
{"long *\0long_funcs", FNULL, (VOID *) &long_funcs },
{"boolean *\0mark_funcs", FNULL, (VOID *) &mark_funcs },
{"void\0menu_funcs", FNULL, (VOID *) &menu_funcs },
{"long *\0money_funcs", FNULL, (VOID *) &money_funcs },
{"char *\0nowrite_funcs", FNULL, (VOID *) &nowrite_funcs },
{"int *\0pint_funcs", FNULL, (VOID *) &pint_funcs },
{"long *\0plong_funcs", FNULL, (VOID *) &plong_funcs },
{"boolean *\0radio_funcs", FNULL, (VOID *) &radio_funcs },
{"int *\0range_funcs", FNULL, (VOID *) &range_funcs },
{"char *\0secure_funcs", FNULL, (VOID *) &secure_funcs },
{"double *\0sdouble_funcs", FNULL, (VOID *) &sdouble_funcs },
{"float *\0sfloat_funcs", FNULL, (VOID *) &sfloat_funcs },
{"int *\0sint_funcs", FNULL, (VOID *) &sint_funcs },
{"long *\0slong_funcs", FNULL, (VOID *) &slong_funcs },
{"void\0slug_funcs", FNULL, (VOID *) &slug_funcs },
{"char *\0string_funcs", FNULL, (VOID *) &string_funcs },
{"char *\0ted_funcs", FNULL, (VOID *) &ted_funcs },
{"struct tm *\0time_funcs", FNULL, (VOID *) &time_funcs },
{"int *\0togint_funcs", FNULL, (VOID *) &togint_funcs },
{"char *\0toggle_funcs", FNULL, (VOID *) &toggle_funcs },
{"char *\0xstring_funcs", FNULL, (VOID *) &xstring_funcs },
{"boolean *\0yesno_funcs", FNULL, (VOID *) &yesno_funcs },
/* system functions */
{"boolean *\0_lnf_funcs", FNULL, (VOID *) &lnf_funcs },
{"char *\0_lnfdir_funcs", FNULL, (VOID *) &lnfdir_funcs },
{"char *\0_lnffile_funcs", FNULL, (VOID *) &lnffile_funcs },
{"int *\0_lnfhex_funcs", FNULL, (VOID *) &lnfhex_funcs },
{"int *\0_lnfint_funcs", FNULL, (VOID *) &lnfint_funcs },
{"int *\0_lnflong_funcs", FNULL, (VOID *) &lnflong_funcs },
{FSYM_MOVEMETHOD}, /* move methods */
{"ted_Follow", (VOID_FPTR) ted_Follow, NULL },
{"ted_Past", (VOID_FPTR) ted_Past, NULL },
{FSYM_EXPLODE}, /* explode functions */
{"exp_std", (VOID_FPTR) exp_std, NULL },
{"exp_BeamMeUp", (VOID_FPTR) exp_BeamMeUp, NULL },
{FSYM_SPECIAL}, /* special functions */
{"spc_Embed", (VOID_FPTR) spc_Embed, NULL },
{"spc_EmbedTed", (VOID_FPTR) spc_EmbedTed, NULL },
{"spc_Abort", (VOID_FPTR) spc_Abort, NULL },
{"spc_Sled", (VOID_FPTR) spc_Sled, NULL },
{"inter_field_grid",(VOID_FPTR) inter_field_grid, NULL },
/* system functions */
{"_spc_ListPopup", (VOID_FPTR) spc_ListPopup, NULL },
{"_spc_FieldEdit", (VOID_FPTR) spc_FieldEdit, NULL },
{"_spc_FileBox", (VOID_FPTR) spc_FileBox, NULL },
{FSYM_BORDER}, /* border functions */
{"bd_mouse", (VOID_FPTR) bd_mouse, NULL },
{"bd_mouse2", (VOID_FPTR) bd_mouse2, NULL },
{"bd_prompt", (VOID_FPTR) bd_prompt, NULL },
{"bd_bar", (VOID_FPTR) bd_bar, NULL },
{"bd_box", (VOID_FPTR) bd_box, NULL },
{"bd_boxlight", (VOID_FPTR) bd_boxlight, NULL },
{"bd_plain", (VOID_FPTR) bd_plain, NULL },
{"bd_title", (VOID_FPTR) bd_title, NULL },
{"bd_std", (VOID_FPTR) bd_std, NULL },
{"bd_null", (VOID_FPTR) bd_null, NULL },
{"bd_1", (VOID_FPTR) bd_1, NULL },
{"bd_2", (VOID_FPTR) bd_2, NULL },
{"bd_123", (VOID_FPTR) bd_123, NULL },
{"bd_sidebar", (VOID_FPTR) bd_sidebar, NULL },
{"bd_head", (VOID_FPTR) bd_head, NULL },
{"bd_xref", (VOID_FPTR) bd_xref, NULL },
{FSYM_MOUSE}, /* mouse handlers */
{"sedmou_Click", (VOID_FPTR) sedmou_Click, NULL },
{"sedmou_Track", (VOID_FPTR) sedmou_Track, NULL },
{"sedmou_GreedyClick", (VOID_FPTR) sedmou_GreedyClick, NULL },
{"sedmou_GreedyTrack", (VOID_FPTR) sedmou_GreedyTrack, NULL },
{"sedmou_Framer", (VOID_FPTR) sedmou_Framer, NULL },
{FSYM_AUX}, /* auxiliary functions */
{"aux_Top", (VOID_FPTR) aux_Top, NULL },
/* system functions */
{"_aux_FileBox", (VOID_FPTR) aux_FileBox, NULL },
{"_aux_FieldBox", (VOID_FPTR) aux_FieldBox, NULL },
{"_aux_CodeBox", (VOID_FPTR) aux_CodeBox, NULL },
{"_aux_SymBox", (VOID_FPTR) aux_SymBox, NULL },
{"_aux_EditBox", (VOID_FPTR) aux_EditBox, NULL },
{FSYM_USER}, /* user function */
{"lnf_Beep", (VOID_FPTR) lnf_Beep, NULL },
{FSYM_LISTEND}
};
/* -------------------------------------------------------------------------- */
/* help data (colors & border)
*/
OGLOBAL struct hx_struct hxd = { 0x13, 0x1e, 0x50, 0x13, bd_head};
/* -------------------------------------------------------------------------- */
/* This is the main() function of Look & Feel. Here we initialize the
display and the mouse and then start Look & Feel. The command line
arguments, argc and argv, are passed through to lnf_Open().
*/
/* control break handler for Turbo C */
#ifdef CBREAK
int c_break(void);
int c_break(void)
{
return(1);
}
#endif
int main(int argc, char *argv[])
{
/* set control break handler for Turbo C */
#ifdef CBREAK
ctrlbrk(c_break);
#endif
/* create blank window for reference in placing menubar, promptbar,
* and mouprompt beneath all other windows
*/
disp_Init(def_ModeText, blwin_Class);
hard_InitMouse(); /* Turn on the mouse */
sedwin_MouseInit(); /* Turn on sedwin mouse */
loaddefault_funcs = &popbob_funcs;
/* command line, config file, and help file */
lnf_Open(argc, argv, "lnf.oak", "lnf.hlp");
lnf_Go();
disp_Close();
oak_Close();
help_Close();
exit(0);
return(0);
}
/* -------------------------------------------------------------------------- */
/* This is a sample user function. */
int lnf_Beep(VOID *sdata, int idata)
/*
A sample user function for LNF.
beeps the speaker using the value passed by idata
Audible values are between 300 and 5000.
*/
{
oak_notused(sdata); /* Keeps compiler from warning we don't use 'sdata' */
if (idata > 0) {
hard_Speaker(idata, 10);
}
return(0);
}