% bytecomp.sl	-*- SLang -*-
%
% !! WARNING: It is not a good idea to invoke this file directly.
%             Instead load it via preparse.sl.  This may be performed
%             in batch mode as:
%
%      jed -batch -n -l preparse
%
%

!if (is_defined ("Preprocess_Only"))
{
   variable Preprocess_Only = 0;
}

define jed_byte_compile_file (f)
{
   variable file;
   
   file = expand_jedlib_file(f);
   if (strlen (file))
     {
	% flush (strcat ("Processing ", file));
	byte_compile_file (file, Preprocess_Only);
     }
   else flush (strcat (f, " not found"));
}

#ifnexists __load__bytecomp__only__
$0 = _stkdepth ();

% list of file to byte compile:
# ifdef UNIX VMS
"mail.sl"; 
"iso-latin.sl";
%   "dispesc.sl";
# endif
# ifdef UNIX
"rmail.sl";
"sendmail.sl";
"mailalias.sl";
"mime.sl";
"perl.sl";
"compress.sl";
# endif
# ifdef IBMPC_SYSTEM
"dos437.sl"; "dos850.sl";  "brief.sl";
# endif
# ifdef XWINDOWS MOUSE
"mouse.sl";
# endif

# ifdef HAS_LINE_ATTR
"folding.sl";
# endif

if (is_defined ("KILL_ARRAY_SIZE")) 
{
   "yankpop.sl";
   "register.sl";
}
"minued.sl";
"history.sl";
"chglog.sl";
"wmark.sl";
"occur.sl";
"javamode.sl";
"modehook.sl";
"hooks.sl";
"nroff.sl";
"html.sl";
"idl.sl";
"shmode.sl";
"mousex.sl";
"abbrev.sl";
"abbrmisc.sl";
"dabbrev.sl";
"mutekeys.sl";
"bookmark.sl";
"replace.sl";
"srchmisc.sl";
"texcom.sl";
"tex.sl";
"bibtex.sl";
"latex.sl";
"latex209.sl";
"ltx-math.sl";
"binary.sl";
"isearch.sl";
"rot13.sl";
"tabs.sl";
"untab.sl";
"jedhelp.sl";
"ctags.sl";
"compile.sl";
"menu.sl";
"dired.sl";
"util.sl";
"syntax.sl";
"tmisc.sl";
"cmisc.sl";
"misc.sl";
"help.sl";
"cal.sl";
"man.sl";
"fortran.sl";
"dcl.sl";
"shell.sl";
"most.sl";
"info.sl";
"ispell.sl";
"sort.sl";
"regexp.sl";
"wordstar.sl";
"buf.sl";
"emacsmsc.sl";
"ide.sl";
"cmode.sl";
"slmode.sl";
"search.sl";
"linux.sl";
"textmode.sl";
"modeinfo.sl";
if (is_defined ("menu_create_menu_bar") == 1)   %  intrinsic fun
{
   "menus.sl";
   "popups.sl";
}
"mini.sl";
"edt.sl";
"emacs.sl";
"site.sl";

$0 = _stkdepth () - $0;
loop ($0)
{
   jed_byte_compile_file (());
}

% Now do color schemes
# ifndef VMS
static define do_color_schemes ()
{
   variable files = listdir (dircat (JED_ROOT, "lib/colors"));
   variable file;
   variable i;
   
   if (files == NULL)
     return;
   
   i = where (array_map (Int_Type, &string_match, files, "\\.sl$", 1));
   !if (length (i))
     return;
   files = files[i];
   
   foreach (files)
     {
	file = ();
	jed_byte_compile_file ("colors/" + file);
     }
}

do_color_schemes ();
# endif
#endif				       %  __load__bytecomp__only__

