Exemple #1
0
static int gwinit (int argc, char *argv[])
{
    register int        i;
    long		color;

    gw_def_win.nextp = NULL;

    /* map the virtual keys. */
    for (i = 0; gwkeys[i].label != 0; i++)
        if (gwkeys[i].cooked)
            mapinsert ((unsigned char *)gwkeys[i].rawin,
                       strlen ((char *)gwkeys[i].rawin),
                       (unsigned char *)gwkeys[i].cooked,
                       strlen ((char *)gwkeys[i].cooked),
                       (unsigned char *)gwkeys[i].label,
                       gwkeys[i].flags, NULL);

    /* set default values for options */
    optpreset (o_scrollbar (&gw_def_win), ElvTrue, OPT_REDRAW|OPT_HIDE);
    optpreset (o_toolbar (&gw_def_win), ElvTrue, OPT_REDRAW|OPT_HIDE);
    optpreset (o_statusbar (&gw_def_win), ElvTrue, OPT_REDRAW|OPT_HIDE);
    optpreset (o_menubar (&gw_def_win), ElvTrue, OPT_REDRAW|OPT_HIDE);
    optpreset (o_font (&gw_def_win), DEFAULT_FONT, OPT_REDRAW|OPT_HIDE);
    optpreset (o_propfont (&gw_def_win), DEFAULT_PROPFONT, OPT_REDRAW|OPT_HIDE);
    optpreset (o_titleformat (&gw_def_win), DEFAULT_TITLEFORMAT, OPT_HIDE);
    optpreset (o_scrollbgimage (&gw_def_win), ElvTrue, OPT_REDRAW|OPT_HIDE);

    /* install the global options */
    optinsert("win32", QTY(gw_optglob_desc), gw_optglob_desc, gw_optglob_val);

    /* install default options */
    optinsert("guiwin", NUM_OPTIONS, gw_opt_desc, (OPTVAL *)&gw_def_win.options);

    /* install the default printer */
    gw_get_default_printer ();

    /* install default "normal" colors. */
    colorinfo[COLOR_FONT_NORMAL].fg = color = GetSysColor(COLOR_WINDOWTEXT);
    colorinfo[COLOR_FONT_NORMAL].da.fg_rgb[0] = color & 0xff;
    colorinfo[COLOR_FONT_NORMAL].da.fg_rgb[1] = (color >> 8) & 0xff;
    colorinfo[COLOR_FONT_NORMAL].da.fg_rgb[2] = (color >> 16) & 0xff;
    colorinfo[COLOR_FONT_NORMAL].bg = color = GetSysColor(COLOR_WINDOW);
    colorinfo[COLOR_FONT_NORMAL].da.bg_rgb[0] = color & 0xff;
    colorinfo[COLOR_FONT_NORMAL].da.bg_rgb[1] = (color >> 8) & 0xff;
    colorinfo[COLOR_FONT_NORMAL].da.bg_rgb[2] = (color >> 16) & 0xff;
    colorinfo[COLOR_FONT_NORMAL].da.bits = COLOR_FG|COLOR_BG;

    /* locate the "guide" color */
    guidefont = colorfind("guide");

    return argc;
}
Exemple #2
0
/* initialize the PC BIOS interface. */
static int 
vio_init (int argc,     /* number of command-line arguments */
          char **argv)  /* values of command-line arguments */
{
  int  i;

  /* Choose font colors in the absence of user settings. */
  vc_term = vio_get_default_color ();
  
  vc_current = vc_term;
  vc_color = vc_term;
  vc_italic = 0xff;
  vc_underlined = 0xff;

  /* Dark if black or blue... */
  o_background = (VC_BG (vc_term) <= 1)? 'd': 'l';
  DPRINTF (("o_background: %x, %c\n", VC_BG (vc_term), o_background));

  /* change the terminal mode to cbreak/noecho */
  vio_resume (ElvTrue);

  /* try to get true screen size, from the operating system */
  vio_getsize ();

  /* pretend the cursor is in an impossible place, so we're guaranteed
   * to move it on the first vio_moveto() or vio_draw() call.
   */
  physx = physy = -100;

  /* map the arrow keys */
  for (i = 0; i < QTY (keys); i++)
    {
      if (keys[i].cooked != NULL && keys[i].rawin != NULL)
        {
          mapinsert (toCHAR (keys[i].rawin), (int)strlen (keys[i].rawin),
                     toCHAR (keys[i].cooked), (int)strlen (keys[i].cooked),
                     toCHAR (keys[i].label),
                     keys[i].flags, NULL);
        }
    }

  /* add the global options to the list known to :set */
  o_ttyunderline = ElvTrue;
  optinsert ("vio", QTY (goptdesc), goptdesc, &ttygoptvals.term);

  return argc;
}
Exemple #3
0
/* This function inializes the global options.  This can't be done in the
 * usual way, because the values are declared as a union, and C doesn't allow
 * unions to be initialized.
 */
void optglobinit()
{
	int	i;
	char	*envval;

	assert(QTY(ogdesc) == QTY_GLOBAL_OPTS);
#ifdef FEATURE_LPR
	assert(QTY(lpdesc) == QTY_LP_OPTS);
#endif

	/* set each option to a reasonable default */
	optpreset(o_blksize, BLKSIZE, OPT_LOCK|OPT_HIDE);
	optpreset(o_blkhash, BLKHASH, OPT_HIDE);
	optpreset(o_blkcache, BLKCACHE, OPT_HIDE);
	optpreset(o_blkgrow, BLKGROW, OPT_HIDE);
	optflags(o_blkfill) = OPT_LOCK|OPT_HIDE;
	optflags(o_blkhit) = OPT_LOCK|OPT_HIDE;
	optflags(o_blkmiss) = OPT_LOCK|OPT_HIDE;
	optflags(o_blkwrite) = OPT_LOCK|OPT_HIDE;
	optpreset(o_version, toCHAR(VERSION), OPT_LOCK|OPT_HIDE);
	optpreset(o_bitsperchar, 8 * sizeof(CHAR), OPT_LOCK|OPT_HIDE);
	optpreset(o_os, toCHAR(OSNAME), OPT_LOCK|OPT_HIDE);
	optflags(o_gui) = OPT_LOCK|OPT_HIDE;
	optflags(o_session) = OPT_LOCK|OPT_HIDE;
	optflags(o_recovering) = OPT_HIDE;
	o_magic = ElvTrue;
	optpreset(o_magicchar, toCHAR("^$.[*"), OPT_HIDE);
	optpreset(o_magicname, ElvFalse, OPT_HIDE);
	optpreset(o_magicperl, ElvFalse, OPT_HIDE);
	o_prompt = ElvTrue;
	o_autoprint = ElvTrue;
	o_remap = ElvTrue;
	o_report = 5;
	optpreset(o_modeline, ElvFalse, OPT_UNSAFE);
	optpreset(o_modelines, 5, OPT_HIDE);
#ifdef OSSHELLENV
	optpreset(o_shell, toCHAR(getenv(OSSHELLENV)), OPT_HIDE | OPT_UNSAFE);
#else
	optpreset(o_shell, toCHAR(getenv("SHELL")), OPT_HIDE | OPT_UNSAFE);
#endif
	if (!o_shell)
		o_shell = toCHAR(OSSHELL);
	o_tagstack = ElvTrue;
	o_tagkind = ElvFalse;
	o_taglibrary = ElvFalse;
	o_warn = ElvTrue;
	o_window = 12;
	o_wrapscan = ElvTrue;
	optpreset(o_initialstate,'v', OPT_HIDE | OPT_NODFLT); /* vi */
	o_keytime = 3;
	o_usertime = 15;
	optflags(o_exitcode) = OPT_HIDE;
	optpreset(o_security, 'n', OPT_HIDE|OPT_UNSAFE|OPT_NODFLT); /* normal */
	optflags(o_tempsession) = OPT_HIDE;
	optflags(o_newsession) = OPT_HIDE;
	optpreset(o_nearscroll, 10, OPT_HIDE);
	optflags(o_previousfile) = OPT_HIDE|OPT_LOCK;
	optflags(o_previousfileline) = OPT_HIDE|OPT_LOCK;
	optflags(o_previouscommand) = OPT_HIDE|OPT_LOCK;
	optflags(o_previoustag) = OPT_HIDE|OPT_LOCK;
	optflags(o_tagprg) = OPT_HIDE|OPT_UNSAFE;
	o_optimize = ElvTrue;
	optpreset(o_pollfrequency, 20, OPT_HIDE);
	optflags(o_sentenceend) = OPT_HIDE;
	optflags(o_sentencequote) = OPT_HIDE;
	optpreset(o_sentencegap, 2, OPT_HIDE);
	if (!o_directory)
		o_directory = toCHAR(getenv("TMP"));
#ifdef OSDIRECTORY
	if (!o_directory)
		o_directory = toCHAR(OSDIRECTORY);
#endif
	o_errorbells = ElvTrue;
	optpreset(o_nonascii, 'm', OPT_HIDE); /* most */
	optflags(o_digraph) = OPT_HIDE;
	optpreset(o_sync, ElvFalse, OPT_HIDE);
	optflags(o_autoselect) = OPT_HIDE;
	optflags(o_defaultreadonly) = OPT_HIDE;
	optflags(o_exrefresh) = OPT_HIDE;
	optflags(o_verbose) = OPT_HIDE;
	optflags(o_anyerror) = OPT_HIDE;
	optflags(o_program) = OPT_HIDE;
	optpreset(o_mesg, ElvTrue, OPT_HIDE);
	optpreset(o_maptrace, 'o', OPT_HIDE); /* off */
	optpreset(o_maplog, 'o', OPT_HIDE); /* off */
	o_timeout = ElvTrue;
	optpreset(o_matchchar, toCHAR("[]{}()"), OPT_HIDE);
	optpreset(o_show, toCHAR("spell/tag,region"), OPT_HIDE);
	o_writeeol = 's'; /* same */
	optpreset(o_binary, ElvFalse, OPT_HIDE);
	optpreset(o_saveregexp, ElvTrue, OPT_HIDE);
	optpreset(o_hardtabs, 8, OPT_HIDE);
	optpreset(o_redraw, ElvFalse, OPT_HIDE);
	optpreset(o_true, msgtranslate("True"), OPT_HIDE|OPT_FREE);
	optpreset(o_false, msgtranslate("False"), OPT_HIDE|OPT_FREE);
	optpreset(o_animation, 3, OPT_HIDE);
	optpreset(o_completebinary, ElvFalse, OPT_HIDE);
	optpreset(o_optionwidth, 24, OPT_HIDE);
	optpreset(o_smarttab, ElvFalse, OPT_HIDE);
	optpreset(o_smartcase, ElvFalse, OPT_HIDE);
	optpreset(o_hlsearch, ElvFalse, OPT_HIDE);
	o_incsearch = ElvFalse;
	optpreset(o_spelldict, NULL, OPT_HIDE | OPT_UNSAFE);
	optpreset(o_spellsuffix, NULL, OPT_HIDE);
	optpreset(o_locale, NULL, OPT_HIDE);
	optpreset(o_mkexrcfile, NULL, OPT_HIDE);
	optpreset(o_prefersyntax, 'n', OPT_HIDE); /* never */
	optpreset(o_eventignore, NULL, OPT_HIDE);
	optpreset(o_eventerrors, ElvFalse, OPT_HIDE);
	optpreset(o_tweaksection, ElvTrue, OPT_HIDE);
	optpreset(o_listchars, toCHAR("eol:$"), OPT_HIDE);
#ifdef FEATURE_LISTCHARS
	(void)dmnlistchars('<', -1L, 0, NULL, NULL);
#endif
	optpreset(o_cleantext, toCHAR("long"), OPT_HIDE);
	optpreset(o_filenamerules, toCHAR("tilde,dollar,paren,wildcard,special,space"), OPT_HIDE);

	/* Set the "home" option from $HOME */
	envval = getenv("HOME");
	if (envval)
	{
		if (optflags(o_home) & OPT_FREE)
			safefree(o_home);
		o_home = toCHAR(envval);
	}
	else if (!o_home)
	{
		o_home = toCHAR(".");
	}
	optflags(o_home) |= OPT_HIDE | OPT_UNSAFE;

	/* Set the "previousdir" option from $OLDPWD */
	envval = getenv("OLDPWD");
	if (envval)
		o_previousdir = toCHAR(envval);
	else
		o_previousdir = toCHAR(".");
	optflags(o_previousdir) |= OPT_HIDE;

	/* Set the "tags" option from $TAGPATH */
	o_tags = toCHAR(getenv("TAGPATH"));
	if (!o_tags)
	{
		o_tags = toCHAR("tags");
	}

	/* Set the "background" option from $ELVISBG */
	envval = getenv("ELVISBG");
	if (!envval || (strcmp(envval, "dark") && strcmp(envval, "light")))
		envval = "dark";
	optpreset(o_background, *envval, OPT_HIDE|OPT_NODFLT);

	/* Generate the default elvispath value. */
	envval = getenv("ELVISPATH");
	if (envval)
	{
		if (optflags(o_elvispath) & OPT_FREE)
			safefree(o_elvispath);
		o_elvispath = toCHAR(envval);
	}
	else if (!o_elvispath)
	{
		o_elvispath = toCHAR(OSLIBPATH);
	}
	optflags(o_elvispath) |= OPT_HIDE | OPT_UNSAFE;

	/* Generate the default sessionpath value. */
	envval = getenv("SESSIONPATH");
	if (envval)
	{
		if (optflags(o_sessionpath) & OPT_FREE)
			safefree(o_sessionpath);
		o_sessionpath = toCHAR(envval);
	}
	else if (!o_sessionpath)
	{
#ifdef OSSESSIONPATH
		o_sessionpath = toCHAR(OSSESSIONPATH);
#else
		o_sessionpath = toCHAR("~:.");
#endif
	}
	optflags(o_sessionpath) |= (OPT_HIDE | OPT_LOCK);

#ifdef FEATURE_LPR
	/* initialize the printing options */
# ifdef OSLPTYPE
	optpreset(o_lptype, toCHAR(OSLPTYPE), OPT_HIDE);
# else
	optpreset(o_lptype, toCHAR("dumb"), OPT_HIDE);
# endif
	optpreset(o_lpcrlf, ElvFalse, OPT_HIDE);
	optpreset(o_lpout, toCHAR(OSLPOUT), OPT_HIDE | OPT_UNSAFE);
	optpreset(o_lpcolumns, 80, OPT_HIDE);
	optpreset(o_lpwrap, ElvTrue, OPT_HIDE);
	optpreset(o_lplines, 60, OPT_HIDE);
	optpreset(o_lpconvert, ElvFalse, OPT_HIDE);
	optpreset(o_lpformfeed, ElvFalse, OPT_HIDE);
	optpreset(o_lpoptions, NULL, OPT_HIDE);
	optpreset(o_lpnumber, ElvFalse, OPT_HIDE);
	optpreset(o_lpheader, ElvTrue, OPT_HIDE);
	optpreset(o_lpcolor, ElvFalse, OPT_HIDE);
	optpreset(o_lpcontrast, 50, OPT_HIDE);
#endif /* FEATURE_LPR */

	/* inform the options code about these options */
	optinsert("global", QTY(ogdesc), ogdesc, optglob);
#ifdef FEATURE_LPR
	optinsert("lp", QTY(lpdesc), lpdesc, lpval);
#endif

#ifndef NO_USERVARS
	/* initialize user variables */
	for (i = 0; i < QTY(userdesc); i++)
	{
		optflags(optuser[i]) = OPT_HIDE;
	}
	optinsert("user", QTY(userdesc), userdesc, optuser);
#endif
}