Moved xrepl to be part of bootloader directly.
This commit is contained in:
parent
314485edfb
commit
b0f266fad1
Makefile
racket
6
Makefile
6
Makefile
|
@ -66,7 +66,6 @@ ALL_PLT_SETUP_OPTIONS = $(JOB_OPTIONS) $(PLT_SETUP_OPTIONS)
|
|||
plain-in-place:
|
||||
$(MAKE) base
|
||||
$(MAKE) pkgs-catalog
|
||||
$(MAKE) rc-config
|
||||
$(RUN_RACO) pkg update $(UPDATE_PKGS_ARGS)
|
||||
$(RUN_RACO) pkg install $(INSTALL_PKGS_ARGS)
|
||||
$(RUN_RACO) setup --only-foreign-libs $(ALL_PLT_SETUP_OPTIONS)
|
||||
|
@ -75,7 +74,6 @@ plain-in-place:
|
|||
win32-in-place:
|
||||
$(MAKE) win32-base
|
||||
$(MAKE) win32-pkgs-catalog SRC_CATALOG="$(SRC_CATALOG)"
|
||||
$(MAKE) rc-config
|
||||
$(WIN32_RUN_RACO) pkg update $(UPDATE_PKGS_ARGS)
|
||||
$(WIN32_RUN_RACO) pkg install $(INSTALL_PKGS_ARGS)
|
||||
$(WIN32_RUN_RACO) setup --only-foreign-libs $(ALL_PLT_SETUP_OPTIONS)
|
||||
|
@ -346,16 +344,12 @@ WIN32_BUNDLE_RACO = $(WIN32_PLAIN_RACKET) $(BUNDLE_RACO_FLAGS)
|
|||
|
||||
PKGS_CATALOG = -U -G build/config -l- pkg/dirs-catalog --link --check-metadata
|
||||
PKGS_CONFIG = -U -G build/config racket/src/pkgs-config.rkt
|
||||
RC_CONFIG = -U -G build/config racket/src/rc-config.rkt
|
||||
|
||||
pkgs-catalog:
|
||||
$(RUN_RACKET) $(PKGS_CATALOG) racket/share/pkgs-catalog pkgs
|
||||
$(RUN_RACKET) $(PKGS_CONFIG) "$(DEFAULT_SRC_CATALOG)" "$(SRC_CATALOG)"
|
||||
$(RUN_RACKET) racket/src/pkgs-check.rkt racket/share/pkgs-catalog
|
||||
|
||||
rc-config:
|
||||
$(RUN_RACKET) $(RC_CONFIG)
|
||||
|
||||
COPY_PKGS_ARGS = PLAIN_RACKET="$(WIN32_PLAIN_RACKET)" SRC_CATALOG="$(SRC_CATALOG)"
|
||||
|
||||
win32-pkgs-catalog:
|
||||
|
|
8
racket/collects/racket/interactive.rkt
Normal file
8
racket/collects/racket/interactive.rkt
Normal file
|
@ -0,0 +1,8 @@
|
|||
#lang racket
|
||||
(when (collection-file-path "main.rkt" "xrepl"
|
||||
#:fail (lambda _ #f))
|
||||
(dynamic-require 'xrepl #f))
|
||||
|
||||
(let ([init-file (cleanse-path (find-system-path 'init-file))])
|
||||
(when (file-exists? init-file)
|
||||
(load init-file)))
|
|
@ -20,8 +20,6 @@ static void pre_filter_cmdline_arguments(int *argc, char ***argv);
|
|||
#endif
|
||||
|
||||
struct Scheme_Env;
|
||||
static char *get_gr_config_init_filename(struct Scheme_Env *env);
|
||||
static char *get_gr_init_filename(struct Scheme_Env *env);
|
||||
|
||||
#ifdef wx_xt
|
||||
# define PRE_FILTER_CMDLINE_ARGUMENTS
|
||||
|
@ -36,7 +34,7 @@ static void pre_filter_cmdline_arguments(int *argc, char ***argv);
|
|||
#define UNIX_INIT_FILENAME "~/.gracketrc"
|
||||
#define WINDOWS_INIT_FILENAME "%%HOMEDIRVE%%\\%%HOMEPATH%%\\gracketrc.rktl"
|
||||
#define MACOS9_INIT_FILENAME "PREFERENCES:gracketrc.rktl"
|
||||
#define GET_INIT_FILENAME get_gr_init_filename
|
||||
#define INIT_FILENAME_CONF_SYM "gui-interactive-file"
|
||||
#define GET_CONFIG_INIT_FILENAME get_gr_config_init_filename
|
||||
#if WIN32
|
||||
# define NEED_CONSOLE_PRINTF
|
||||
|
@ -65,52 +63,6 @@ static void pre_filter_cmdline_arguments(int *argc, char ***argv);
|
|||
|
||||
# include "../racket/main.c"
|
||||
|
||||
static char *get_gr_config_init_filename(Scheme_Env *env)
|
||||
{
|
||||
char *s, *s2;
|
||||
int len, i;
|
||||
|
||||
s = get_config_init_filename(env);
|
||||
if (s) {
|
||||
len = strlen(s);
|
||||
for (i = len - 8; i; i--) {
|
||||
if (!strncmp(s XFORM_OK_PLUS i, "racketrc", 8)) {
|
||||
s2 = (char *)malloc(len + 2);
|
||||
memcpy(s2, s, i);
|
||||
memcpy(s2 + i + 1, s + i, len - i + 1);
|
||||
s2[i] = 'g';
|
||||
s = s2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *get_gr_init_filename(Scheme_Env *env)
|
||||
{
|
||||
char *s, *s2;
|
||||
int len, i;
|
||||
|
||||
s = get_init_filename(env);
|
||||
if (s) {
|
||||
len = strlen(s);
|
||||
for (i = len - 8; i; i--) {
|
||||
if (!strncmp(s XFORM_OK_PLUS i, "racketrc", 8)) {
|
||||
s2 = (char *)malloc(len + 2);
|
||||
memcpy(s2, s, i);
|
||||
memcpy(s2 + i + 1, s + i, len - i + 1);
|
||||
s2[i] = 'g';
|
||||
s = s2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
/* Win32 handling */
|
||||
/***********************************************************************/
|
||||
|
|
|
@ -71,6 +71,10 @@
|
|||
'installation-name
|
||||
"development"
|
||||
'default-scope
|
||||
"installation")
|
||||
"installation"
|
||||
'interactive-file
|
||||
'racket/interactive
|
||||
'gui-interactive-file
|
||||
'racket/gui/interactive)
|
||||
o)
|
||||
(newline o))))
|
||||
|
|
|
@ -669,21 +669,11 @@ static int finish_cmd_line_run(FinishArgs *fa, Repl_Proc repl)
|
|||
|
||||
#ifndef DONT_LOAD_INIT_FILE
|
||||
if (fa->a->use_repl && !fa->a->no_init_file) {
|
||||
char *filename;
|
||||
|
||||
filename = GET_CONFIG_INIT_FILENAME(fa->global_env);
|
||||
if (filename) {
|
||||
filename = scheme_expand_filename(filename, -1, "startup", NULL, SCHEME_GUARD_FILE_EXISTS);
|
||||
if (scheme_file_exists(filename)) {
|
||||
scheme_load(filename);
|
||||
}
|
||||
}
|
||||
|
||||
filename = GET_INIT_FILENAME(fa->global_env);
|
||||
if (filename) {
|
||||
filename = scheme_expand_filename(filename, -1, "startup", NULL, SCHEME_GUARD_FILE_EXISTS);
|
||||
if (scheme_file_exists(filename))
|
||||
scheme_load(filename);
|
||||
Scheme_Object *a[2];
|
||||
a[0] = get_init_filename(fa->global_env, INIT_FILENAME_CONF_SYM);
|
||||
if (a[0]) {
|
||||
a[1] = scheme_false;
|
||||
scheme_dynamic_require(2, a);
|
||||
}
|
||||
}
|
||||
#endif /* DONT_LOAD_INIT_FILE */
|
||||
|
|
|
@ -97,9 +97,15 @@ extern BOOL WINAPI DllMain(HINSTANCE inst, ULONG reason, LPVOID reserved);
|
|||
/*========================================================================*/
|
||||
|
||||
#ifndef DONT_LOAD_INIT_FILE
|
||||
static char * get_config_init_filename(Scheme_Env *env)
|
||||
/*
|
||||
* Get the init filename for the system
|
||||
* * First look to see if <addon-dir>/interactive.rkt exists
|
||||
* * Otherwise check config file for location
|
||||
*/
|
||||
static Scheme_Object *get_init_filename(Scheme_Env *env,
|
||||
char *init_filename_sym)
|
||||
{
|
||||
Scheme_Object *f, *a[2];
|
||||
Scheme_Object *f, *a[2], *build_path;
|
||||
Scheme_Thread * volatile p;
|
||||
mz_jmp_buf * volatile save, newbuf;
|
||||
|
||||
|
@ -108,46 +114,44 @@ static char * get_config_init_filename(Scheme_Env *env)
|
|||
p->error_buf = &newbuf;
|
||||
|
||||
if(!scheme_setjmp(newbuf)) {
|
||||
build_path = scheme_builtin_value("build-path");
|
||||
|
||||
/* First test to see if user init file exists */
|
||||
f = scheme_builtin_value("find-system-path");
|
||||
a[0] = scheme_intern_symbol("addon-dir");
|
||||
a[0] = _scheme_apply(f, 1, a);
|
||||
a[1] = scheme_make_path("interactive.rkt");
|
||||
f = _scheme_apply(build_path, 2, a);
|
||||
if (SCHEME_PATHP(f)) {
|
||||
char *filename;
|
||||
filename = SCHEME_PATH_VAL(f);
|
||||
filename = scheme_expand_filename(filename, -1, "startup", NULL, SCHEME_GUARD_FILE_EXISTS);
|
||||
if(scheme_file_exists(f)) {
|
||||
p->error_buf = save;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
/* Failed, next check config.rkt fo system init file */
|
||||
f = scheme_builtin_value("find-main-config");
|
||||
a[0] = _scheme_apply(f, 0, NULL);
|
||||
a[1] = scheme_make_path("racketrc");
|
||||
f = scheme_builtin_value("build-path");
|
||||
f = _scheme_apply(f, 2, a);
|
||||
a[1] = scheme_make_path("config.rktd");
|
||||
f = _scheme_apply(build_path, 2, a);
|
||||
if (SCHEME_PATHP(f)) {
|
||||
Scheme_Object * port;
|
||||
port = scheme_open_input_file(SCHEME_PATH_VAL(f), "get-init-filename");
|
||||
f = scheme_read(port);
|
||||
scheme_close_input_port(port);
|
||||
if(SCHEME_HASHTRP(f)) {
|
||||
f = scheme_hash_tree_get(f, scheme_intern_symbol(init_filename_sym));
|
||||
if(f) {
|
||||
p->error_buf = save;
|
||||
return SCHEME_PATH_VAL(f);
|
||||
}
|
||||
}
|
||||
p->error_buf = save;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *get_init_filename(Scheme_Env *env)
|
||||
{
|
||||
Scheme_Object *f;
|
||||
Scheme_Thread * volatile p;
|
||||
mz_jmp_buf * volatile save, newbuf;
|
||||
|
||||
p = scheme_get_current_thread();
|
||||
save = p->error_buf;
|
||||
p->error_buf = &newbuf;
|
||||
|
||||
if (!scheme_setjmp(newbuf)) {
|
||||
f = scheme_builtin_value("find-system-path");
|
||||
if (f) {
|
||||
Scheme_Object *a[1];
|
||||
|
||||
a[0] = scheme_intern_symbol("init-file");
|
||||
|
||||
f = _scheme_apply(f, 1, a);
|
||||
|
||||
if (SCHEME_PATHP(f)) {
|
||||
p->error_buf = save;
|
||||
return SCHEME_PATH_VAL(f);
|
||||
return f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p->error_buf = save;
|
||||
|
||||
return NULL;
|
||||
|
@ -162,8 +166,7 @@ extern Scheme_Object *scheme_initialize(Scheme_Env *env);
|
|||
# define UNIX_INIT_FILENAME "~/.racketrc"
|
||||
# define WINDOWS_INIT_FILENAME "%%HOMEDIRVE%%\\%%HOMEPATH%%\\racketrc.rktl"
|
||||
# define MACOS9_INIT_FILENAME "PREFERENCES:racketrc.rktl"
|
||||
# define GET_CONFIG_INIT_FILENAME get_config_init_filename
|
||||
# define GET_INIT_FILENAME get_init_filename
|
||||
# define INIT_FILENAME_CONF_SYM "interactive-file"
|
||||
# define PRINTF printf
|
||||
# define PROGRAM "Racket"
|
||||
# define PROGRAM_LC "racket"
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
#lang racket/base
|
||||
|
||||
(require racket/format
|
||||
racket/path)
|
||||
|
||||
(define config-dir-path (build-path "racket" "etc"))
|
||||
(define config-rc-path (build-path config-dir-path "racketrc"))
|
||||
|
||||
(when (file-exists? config-rc-path)
|
||||
(call-with-input-file* config-rc-path
|
||||
(lambda (i)
|
||||
(define r (read i))
|
||||
(define xrepl?
|
||||
(equal? r
|
||||
'(when (collection-file-path "main.rkt" "xrepl"
|
||||
#:fail (lambda _ #f))
|
||||
(dynamic-require 'xrepl #f))))
|
||||
(unless xrepl?
|
||||
(error 'racketrc
|
||||
(~a "Global racketrc file exists, but is mismatched.\n"
|
||||
" possible solution: delete the racketrc file"))))))
|
||||
|
||||
(unless (file-exists? config-rc-path)
|
||||
(printf "Writing ~a\n" config-rc-path)
|
||||
(call-with-output-file*
|
||||
config-rc-path
|
||||
(lambda (o)
|
||||
(write '(when (collection-file-path "main.rkt" "xrepl"
|
||||
#:fail (lambda _ #f))
|
||||
(dynamic-require 'xrepl #f)) o)
|
||||
(newline o))))
|
Loading…
Reference in New Issue
Block a user