One Hat Cyber Team
Your IP :
216.73.216.216
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
Macaulay2
/
Core
/
View File Name :
startup.m2
-- -*- coding: utf-8 -*- -- Copyright 1993-2009 by Daniel R. Grayson -- layout.m2, includes the former contents of ../m2/startup.m2 -- this file gets incorporated into the executable file bin/M2 as the string 'startupString' -- we want to ignore the --datarootdir setting, whatever that means, so here we we mention it: ${prefix}/share interpreterDepth = loadDepth = errorDepth = 0 debuggingMode = true stopIfError = false notify = false debugWarningHashcode = null gotarg = arg -> any(commandLine, s -> s === arg) randomSeed = -- initializing this here so the startup is reproducible if gotarg "--no-randomize" then 0 else (currentTime() << 16) + processID() if gotarg "--notify" then notify = true if gotarg "--stop" then stopIfError = true if gotarg "--int" then handleInterrupts = false firstTime := class PackageDictionary === Symbol if firstTime then ( -- we do this bit *before* "debug Core", so that Core (the symbol, not the package), -- which may not be there yet, ends up in the right dictionary match = x -> null =!= regex x; assert' = x -> ( if class x =!= Boolean then error "assert: expected true or false"; if not x then error "assertion failed"); printerr = msg -> endl(printString(stderr, concatenate(loadDepth, "-- ", msg))); value = value'; -- TODO: is there a different way to get --no-core to work? -- PackageDictionary = new Dictionary; dictionaryPath = append(dictionaryPath, PackageDictionary); assert'( not isGlobalSymbol "Core" ); PackageDictionary#("Package$Core") = getGlobalSymbol(PackageDictionary, "Core"); ) -- we can't make this an else-clause, because then "Core" will be in the wrong dictionary disassemble ( () -> debug Core ) if not firstTime then debug Core -- we need access to the private symbols (we remove the Core private dictionary later.) toString := value' getGlobalSymbol if firstTime then "simpleToString" else "toString" local exe -- this next bit has to be *parsed* after the "debug" above, to prevent the symbols from being added to the User dictionary if firstTime then ( -- all global definitions here are set to read-only if notify then printerr("loading startup.m2 for the first time"); filesLoaded = new MutableHashTable; loadedFiles = new MutableHashTable; nobanner = false; texmacsmode = false; restarting = false; restarted = false; srcdirs = {}; markLoaded = (filepath, filetime, notify) -> ( filesLoaded#filepath = filetime; loadedFiles##loadedFiles = filepath; if notify then printerr("loaded ", filepath)); tryLoad = (filename, filepath, loadfun, notify) -> if fileExists filepath then ( filepath = realpath toAbsolutePath filepath; filetime := fileTime filepath; if notify then printerr("loading ", filename); ret := loadfun filepath; markLoaded(filepath, filetime, notify); (true, ret)) else (false, null); trySimpleLoad := (filename, filepath) -> first tryLoad(filename, filepath, simpleLoad, notify); normalPrompts = () -> ( lastprompt := ""; ZZ#{Standard,InputPrompt} = lineno -> concatenate(newline, lastprompt = concatenate(interpreterDepth:"i", toString lineno, " : ")); ZZ#{Standard,InputContinuationPrompt} = lineno -> #lastprompt; -- will print that many blanks, see interp.d symbol currentPrompts <- normalPrompts; -- this avoids the warning about redefining a function ); normalPrompts(); noPrompts = () -> ( ZZ#{Standard,InputPrompt} = lineno -> ""; ZZ#{Standard,InputContinuationPrompt} = lineno -> ""; symbol currentPrompts <- noPrompts; ); startFunctions = {}; addStartFunction = f -> ( startFunctions = append(startFunctions,f); f); runStartFunctions = () -> scan(startFunctions, f -> f()); endFunctions = {}; addEndFunction = f -> ( endFunctions = append(endFunctions,f); f); runEndFunctions = () -> ( save := endFunctions; endFunctions = {}; scan(save, f -> f()); endFunctions = save; ); simpleExit := exit; exit = ret -> ( runEndFunctions(); simpleExit ret ); File << Thing := File => (x,y) -> printString(x,toString y); File << Net := File << Symbol := File << String := printString; << Thing := x -> stdio << x; String | String := String => concatenate; Function _ Thing := Function => (f,x) -> y -> f splice (x,y); String | ZZ := String => (s,i) -> concatenate(s,toString i); ZZ | String := String => (i,s) -> concatenate(toString i,s); new HashTable from List := HashTable => (O,v) -> hashTable v; Manipulator = new Type of BasicList; Manipulator.synonym = "manipulator"; new Manipulator from Function := Manipulator => (Manipulator,f) -> new Manipulator from {f}; Manipulator Database := Manipulator File := Manipulator NetFile := (m,o) -> m#0 o; Manipulator Nothing := (m,null) -> null; File << Manipulator := File => (o,m) -> m#0 o; NetFile << Manipulator := File => (o,m) -> m#0 o; Nothing << Manipulator := (null,m) -> null; TeXmacsBegin = ascii 2; TeXmacsEnd = ascii 5; close = new Manipulator from close; closeIn = new Manipulator from closeIn; closeOut = new Manipulator from closeOut; flush = new Manipulator from flush; endl = new Manipulator from endl; Thing#{Standard,Print} = x -> ( << newline << concatenate(interpreterDepth:"o") << lineNumber << " = "; try << x; << newline << flush; ); first = x -> x#0; last = x -> x#-1; lines = x -> ( l := separate x; if l#-1 === "" then drop(l,-1) else l); re := "/"; -- /foo/bar if version#"operating system" === "MicrosoftWindows" then re = re | "|.:/"; -- "C:/FOO/BAR" re = re | "|\\$"; -- $www.uiuc.edu:80 re = re | "|!"; -- !date re = re | "|~"; -- ~user/foo/bar isAbsolutePathRegexp := "\\`(" | re | ")"; -- whether the path will work from any directory and get to the same file re = re | "|\\./"; -- ./foo/bar re = re | "|\\.\\./"; -- ../foo/bar isStablePathRegexp := "\\`(" | re | ")"; -- whether we should search only in the current directory (or current file directory) -- whether to search the path for an executable, based on execvp(3) isFixedExecPath = filename -> match("/", filename); isAbsolutePath = filename -> match(isAbsolutePathRegexp, filename); isStablePath = filename -> match(isStablePathRegexp, filename); concatPath = (dir, name) -> if isAbsolutePath name then name else concatenate( dir, if not match("/$", dir) then "/", name); toAbsolutePath = pth -> ( if ( pth =!= "stdio" and pth =!= "currentString" and not isAbsolutePath pth) then "/" | relativizeFilename("/", pth) else pth); use = x -> x; -- temporary, until methods.m2 Attributes = new MutableHashTable; -- values are hash tables with keys Symbol, String, Net (as symbols); replaces ReverseDictionary and PrintNames setAttribute = (val,attr,x) -> ( Attributes#val ??= new MutableHashTable )#attr = x; hasAnAttribute = (val) -> Attributes#?val; hasAttribute = (val,attr) -> Attributes#?val and Attributes#val#?attr; getAttribute = (val,attr) -> Attributes#val#attr; getAttributes = (attr0) -> ( r := new MutableHashTable; scan(values Attributes, tab -> scan(pairs tab, (attr,x) -> if attr === attr0 then r#x = true)); keys r); removeAttribute = (val,attr) -> ( a := Attributes#val; remove(a,attr); if #a === 0 then remove(Attributes,val); ); protect PrintNet; protect PrintNames; protect ReverseDictionary; globalAssign = (s,v) -> if v =!= value' s then ( X := class value' s; m := lookup(GlobalReleaseHook,X); if m =!= null then m(s,value' s); Y := class v; n := lookup(GlobalAssignHook,Y); if n =!= null then n(s,v); s <- v); globalAssignFunction = (X,x) -> ( if not instance(X,Symbol) then error("globalAssignFunction: expected a symbol: ", toString X); if not hasAttribute(x,ReverseDictionary) then setAttribute(x,ReverseDictionary,X); use x; ); globalReleaseFunction = (X,x) -> ( if not instance(X,Symbol) then error("globalAssignFunction: expected a symbol: ", toString X); if hasAttribute(x,ReverseDictionary) and getAttribute(x,ReverseDictionary) === X then removeAttribute(x,ReverseDictionary) ); globalAssignment = X -> ( if instance(X, VisibleList) then apply(X,globalAssignment) else if instance(X,Type) then ( X.GlobalAssignHook = globalAssignFunction; X.GlobalReleaseHook = globalReleaseFunction; ) else error "expected a type"; ); globalAssignment {Type,Function,GlobalDictionary,Manipulator}; scan((symbol true,symbol false,symbol stdio, symbol stderr), sym -> globalAssignFunction(sym, value' sym)); scan(dictionaryPath, dict -> ( scan(pairs dict, (nm,sym) -> ( x := value' sym; f := lookup(GlobalAssignHook, class x); if f =!= null then f(sym,x); )))); applicationDirectorySuffix = if version#"operating system" === "Darwin" then "Library/Application Support/Macaulay2/" else ".Macaulay2/"; applicationDirectory = () -> ( if getenv "HOME" =!= "" then ( getenv "HOME" | "/" | -- we allow the user to change applicationDirectorySuffix to a string or a function if instance(applicationDirectorySuffix, Function) then applicationDirectorySuffix() else applicationDirectorySuffix ) else error "environment variable HOME not set" ); initlayout := () -> ( if regex(".*/","/aa/bb") =!= {(0, 4)} or regex("a|b","a") =!= {(0,1)} or regex("^a+$"," \naaa\n ") =!= {(2,3)} or regex("$a","$a") =!= null or regex(".*","a\nb") =!= {(0, 1)} or replace("a","b","-a-a-") =!= "-b-b-" or select("a+","$&","aaa aaaa") =!= {"aaa","aaaa"} then error "regex regular expression library not working"; t := hashTable { "exec" => "${exec_prefix}/", "common" => "${prefix}/", "bin" => "${exec_prefix}/bin/", "lib" => "${exec_prefix}/lib/", "info" => "${prefix}/share/info/", "data" => "${prefix}/share/", "man" => "${prefix}/share/man/", "emacs" => "${prefix}/share/emacs/site-lisp/macaulay2/", "doc" => "${prefix}/share/doc/Macaulay2/", "packages" => "${prefix}/share/Macaulay2/", "docdir" => "${prefix}/share/doc/Macaulay2/", "libraries" => "${exec_prefix}/lib/Macaulay2/lib/", "programs" => "${exec_prefix}/libexec/Macaulay2/bin/", "program licenses" => "${exec_prefix}/libexec/Macaulay2/program-licenses/", "package" => "${prefix}/share/Macaulay2/PKG/", "factory gftables" => "${prefix}/share/Macaulay2/Core/factory/", "packagedoc" => "${prefix}/share/doc/Macaulay2/PKG/", "packageimages" => "${prefix}/share/doc/Macaulay2/PKG/images/", "packagetests" => "${prefix}/share/doc/Macaulay2/PKG/tests/", "packagehtml" => "${prefix}/share/doc/Macaulay2/PKG/html/", "packagecache" => "${exec_prefix}/lib/Macaulay2/PKG/cache/", "packagelib" => "${exec_prefix}/lib/Macaulay2/PKG/", "packageexampleoutput" => "${prefix}/share/doc/Macaulay2/PKG/example-output/" }; Layout = hashTable { 1 => applyValues( t, x -> replace("^\\$\\{(pre_)?(exec_)?prefix\\}/", "", x)), 2 => applyValues( t, x -> replace("^\\$\\{(pre_)?prefix\\}", "common", -- as in configure.ac replace("^\\$\\{(pre_)?exec_prefix\\}", version#"machine", x)))}; -- as in configure.ac finalPrefix = "/usr"; if last finalPrefix != "/" then finalPrefix = finalPrefix | "/"; ); initlayout(); ) pathsearch := (exe) -> ( if not isFixedExecPath exe then ( -- we search the path, but we don't do it the same way execvp does, too bad. PATH := separate(":", getenv "PATH" | ":.:/bin:/usr/bin"); PATH = apply(PATH, dir -> if dir === "" then "." else dir); exe = scan(PATH, dir -> if fileExists(dir | "/" | exe) then break(dir | "/" | exe))); exe) dir := s -> ( m := regex(".*/",s); if m === null or 0 === #m then "./" else substring(m#0#0,m#0#1-1,s)) base := s -> ( m := regex(".*/",s); if m === null or 0 === #m then s else substring(m#0#1, s)) exe = minimizeFilename ( -* -- this can be a reliable way to get the executable in linux -- but we don't want to use it because we don't want to chase symbolic links and it does that for us processExe := "/proc/self/exe"; if fileExists processExe and readlink processExe =!= null then readlink processExe else *- if isAbsolutePath commandLine#0 then commandLine#0 else if isStablePath commandLine#0 then concatenate(currentDirectory() | commandLine#0) else pathsearch commandLine#0) if not isAbsolutePath exe then exe = currentDirectory() | exe; exe = concatenate(realpath dir exe, base exe) if notify then printerr("executable = ", exe) -- called by M2version() initcurrentlayout := () -> ( issuffix := (s,t) -> t =!= null and s === substring(t,-#s); bindir = dir exe | "/"; currentLayout = ( -- see also currentLayoutTable if issuffix(Layout#2#"bin","/"|bindir) then Layout#2 else if issuffix(Layout#1#"bin","/"|bindir) then Layout#1 ); prefixDirectory = if currentLayout =!= null then realpath substring(bindir,0,#bindir-#currentLayout#"bin"); -- we use "realpath" to produce real paths, because Cygwin-style symbolic links are not understood by native Windows applications if notify then printerr("prefixDirectory = ", prefixDirectory); if readlink exe =!= null then ( exe2 := concatPath(realpath dir exe, readlink exe); bindir2 := dir exe2 | "/"; currentLayout2 := ( if issuffix(Layout#2#"bin",bindir2) then Layout#2 else if issuffix(Layout#1#"bin",bindir2) then Layout#1 ); ); prefixDirectory2 := if currentLayout2 =!= null then substring(bindir2,0,#bindir2-#currentLayout2#"bin"); if prefixDirectory2 =!= null and isDirectory(prefixDirectory2|currentLayout2#"packages") and (currentLayout === null or not isDirectory(prefixDirectory|currentLayout#"packages")) then ( prefixDirectory = prefixDirectory2; currentLayout = currentLayout2; prefixPath = { prefixDirectory }); usrDist := "usr-dist/"; topBuilddir = ( if issuffix(usrDist,prefixDirectory) then substring(prefixDirectory,0,#prefixDirectory-#usrDist) else if issuffix(usrDist,prefixDirectory2) then substring(prefixDirectory2,0,#prefixDirectory2-#usrDist)); if notify then printerr("topBuilddir = ", topBuilddir); topSrcdir = if topBuilddir =!= null and fileExists(topBuilddir|"srcdir") then ( sdir := first lines get(topBuilddir|"srcdir"); realpath concatPath(topBuilddir, sdir)); if notify then printerr("topSrcdir = ", topSrcdir); coredir = prefixDirectory | replace("PKG", "Core", currentLayout#"package"); if notify then printerr("coredir = ", coredir); ) prefixDirectory = null -- prefix directory, after installation, e.g., "/usr/local/" prefixPath = {} fullCopyright = false matchpart := (pat,i,s) -> substring_((regex(pat, s))#i) s notdir := s -> matchpart("[^/]*$",0,s) nocore = false noinitfile = false interpreter := commandInterpreter M2version := () -> ( initcurrentlayout(); trySimpleLoad("version.m2", coredir | "version.m2"); v := replace("^release-", "", version#"git description"); if version#"VERSION" == v -- stable release (at release tag) or version#"git branch" == "" then v else concatenate(v, 1, "(", version#"git branch", ")")) progname := notdir commandLine#0 usage := arg -> ( << "usage:" << newline << " " << progname << " [option ...] [file ...]" << newline << "options:" << newline << " --help print this brief help message and exit" << newline << " --no-backtrace print no backtrace after error" << newline << " --copyright display full copyright message" << newline << " --no-debug do not enter debugger upon error" << newline << " --debug n debug warning message n by signalling an error" << newline << " --int don't handle interrupts" << newline -- handled by M2lib.c << " --notify notify when loading files during initialization" << newline << " and when evaluating command line arguments" << newline << " --prefix DIR set prefixDirectory" << newline << " --print-width n set printWidth=n (the default is the window width)" << newline << " --restarted used internally to indicate this is a restart" << newline << " --read-only-files disallow file and socket creation and writing" << newline << " --script as first argument, interpret second argument as name of a script" << newline << " implies --stop, --no-debug, --silent and -q" << newline << " see scriptCommandLine" << newline << " --silent no startup banner" << newline << " --stop exit on error" << newline << " --texmacs TeXmacs session mode" << newline << " --version print version number and exit" << newline << " --webapp WebApp session mode" << newline << " --no-core don't load the Core" << newline << " --no-preload don't load the preloaded packages" << newline; << " --no-prompts print no input prompts" << newline; << " --no-randomize don't set the random number seed based on the date" << newline << " --no-readline don't use readline" << newline; << " --no-threads don't start any additional threads (or tasks)" << newline << " --no-time arrange for the current time to be always 0" << newline; << " --no-tty do not treat stdin and stdout as tty's" << newline << " -q don't load user's init.m2 file or use packages in home directory" << newline << " -E '...' evaluate expression '...' before initialization" << newline << " -e '...' evaluate expression '...' after initialization" << newline << " --srcdir '...' add top source or build tree '...' to initial path" << newline << " --check n run tests to level n" << newline << " n=1: basic tests" << newline << " n=2: test Core" << newline << " n=3: test all packages" << newline << "environment:" << newline << " EDITOR default text editor" << newline << " GC_INITIAL_HEAP_SIZE (gc: initial heap size in bytes)" << newline << " GC_PRINT_STATS (gc: turn on logging)" << newline << " GC_PRINT_VERBOSE_STATS (gc: turn on more verbose logging)" << newline << " GC_LOG_FILE (gc: name of log file)" << newline << " GC_DUMP_REGULARLY (gc: dump state regularly)" << newline << " GC_NPROCS (gc: number of threads to use, linux)" << newline ;) showMaps := () -> ( if version#"operating system" === "SunOS" then ( stack lines get ("!/usr/bin/pmap "|processID()) ) else if version#"operating system" === "Linux" and fileExists("/proc/"|toString processID()|"/maps") then ( stack lines get("/proc/"|toString processID()|"/maps") ) else "memory maps not available" ) phase := 1 obsolete := arg -> (stderr << "error: command line option " << arg << " is obsolete." << endl << endl; usage(); exit 1) replaced := (arg, x) -> (stderr << "error: command line option " << arg << " has been replaced with " << x << "." << endl << endl; usage(); exit 1) notyeterr := arg -> (stderr << "error: command line option " << arg << " has not been re-implemented yet."; << endl << endl; usage(); exit 1) notyet := arg -> if phase == 1 then (stderr << "warning: command line option " << arg << " has not been re-implemented yet." << endl << flush) action := hashTable { "-h" => arg -> (usage(); exit 0), "-mpwprompt" => notyeterr, "-n" => obsolete, "-q" => arg -> noinitfile = true, "-s" => obsolete, "-silent" => obsolete, "-tty" => notyet, "--copyright" => arg -> if phase == 1 then fullCopyright = true, "--help" => arg -> (usage(); exit 0), "--int" => arg -> arg, "--no-backtrace" => arg -> if phase == 1 then backtrace = false, "--no-debug" => arg -> debuggingMode = false, "--no-randomize" => arg -> arg, "--no-time" => arg -> arg, "--no-threads" => arg -> arg, "--no-preload" => arg -> arg, "--no-prompts" => arg -> if phase == 3 then noPrompts(), "--no-readline" => arg -> arg, -- handled in d/stdio.d "--no-setup" => arg -> replaced(arg, "--no-core"), "--no-core" => arg -> if phase == 1 then nocore = true, "--notify" => arg -> if phase <= 2 then notify = true, "--no-tty" => arg -> arg, -- handled in d/stdio.d "--read-only-files" => arg -> arg, -- handled in d/stdio.d "--script" => arg -> error "script option should be first argument, of two", "--silent" => arg -> nobanner = true, "--stop" => arg -> (if phase == 1 then stopIfError = true; debuggingMode = false;), -- see also M2lib.c and tokens.d "--restarted" => arg -> restarted = true, "--texmacs" => arg -> ( if phase == 1 then ( topLevelMode = global TeXmacs; printWidth = 80; ) else if phase == 3 then ( topLevelMode = global TeXmacs; printWidth = 80; ) else if phase == 4 then ( texmacsmode = true; topLevelMode = TeXmacs; addEndFunction(() -> if texmacsmode then ( if restarting then stderr << "Macaulay2 restarting..." << endl << endl << flush else ( stderr << "Macaulay2 exiting" << flush; << TeXmacsEnd << endl << flush))); ) ), "--version" => arg -> ( << M2version() << newline; exit 0; ), "--webapp" => arg -> ( printWidth=0; topLevelMode = global WebApp; ) }; argno := 1 valueNotify := arg -> ( if notify then printerr("evaluating command line argument ", toString argno, ": ", format arg); value' arg) action2 := hashTable { "--srcdir" => arg -> ( if phase == 2 then ( if isDirectory(arg | "/Macaulay2") then ( srcdirs = append(srcdirs, arg); topSrcdir = realpath arg) else ( stopIfError = true; error "--srcdir should contain a 'Macaulay2' subdirectory"))), "-E" => arg -> if phase == 3 then valueNotify arg, "-e" => arg -> if phase == 4 then valueNotify arg, "--print-width" => arg -> if phase == 3 then printWidth = value' arg, "--debug" => arg -> debugWarningHashcode = value' arg, "--prefix" => arg -> if phase == 1 or phase == 3 then ( prefixPath = { prefixDirectory = concatPath(arg, "") }), "--check" => arg -> if arg != "1" and arg != "2" and arg != "3" then ( stopIfError = true; error ("--check ",arg,": expected 1, 2, or 3")) else if phase == 1 and arg == "1" then ( stopIfError = true; runBasicTests(); exit 0) -- FIXME: doesn't work with --no-core else if phase == 4 and arg == "2" then ( argumentMode = defaultMode - SetCaptureErr - SetUlimit - if noinitfile then 0 else ArgQ; if runString(///check("Core", Verbose => true)///, Core, false) then exit 0 else exit 1 ) else if phase == 4 and arg == "3" then exit checkAllPackages() } scriptCommandLine = {} processCommandLineOptions := phase0 -> ( -- 3 passes phase = phase0; argno = 1; if commandLine#?1 and commandLine#1 == "--script" then ( if phase <= 2 then ( clearEcho stdio; debuggingMode = false; stopIfError = noinitfile = nobanner = true; ) else if phase == 4 then ( if not commandLine#?2 then error "script file name missing"; arg := commandLine#2; -- "load" uses "./" to mean relative to the current file's directory, but right now, the current file is startup.m2.in, -- which may not even be on the user's machine. So we convert it to an absolute path if match("^(\\./|\\../)",arg) then arg = toAbsolutePath arg; scriptCommandLine = drop(commandLine,2); if instance(value' global load, Function) then load arg else simpleLoad arg; exit 0)) else ( if notify then printerr("phase ", toString phase); while argno < #commandLine do ( arg = commandLine#argno; if action#?arg then action#arg arg else if action2#?arg then ( argno = argno + 1; if argno < #commandLine then action2#arg commandLine#argno else error("command line option ", arg, " missing argument") ) else if arg#0 == "-" then ( stderr << "error: unrecognized command line option: " << arg << endl; usage(); exit 1; ) else if phase == 4 then ( if not isStablePath arg and instance(load, Function) then load arg else simpleLoad arg; ); argno = argno+1; ); )) if firstTime then processCommandLineOptions 1 -- also calls initcurrentlayout() srcversion = M2version() if firstTime and not nobanner then ( if topLevelMode === TeXmacs then stderr << TeXmacsBegin << "verbatim:"; stderr << "Macaulay2, version " << srcversion << newline << flush; if topLevelMode === TeXmacs then stderr << TeXmacsEnd << flush) scan(commandLine, arg -> if arg === "-q" then noinitfile = true) homeDirectory = getenv "HOME" | "/" path = {} pkgpath = {} corepath = {} userpath = { applicationDirectory() | "code/", applicationDirectory() | "local/" | Layout#1#"packages" } if prefixDirectory =!= null then ( if topBuilddir =!= null then ( if topSrcdir =!= null then ( pkgpath = append(pkgpath, topSrcdir | "Macaulay2/packages/"); corepath = append(corepath, topSrcdir | "Macaulay2/m2/")); corepath = append(corepath, topBuilddir | "Macaulay2/m2/")); pkgpath = append(pkgpath, prefixDirectory | currentLayout#"packages"); corepath = append(corepath, prefixDirectory | replace("PKG", "Core", currentLayout#"package"))) if firstTime then normalPrompts() printWidth = fileWidth stdio processCommandLineOptions 2 -- just for path to core files and packages -- add source directories to the path, in the appropriate order corepath = join(apply(srcdirs, dir -> concatPath(dir, "Macaulay2/m2/")), corepath) pkgpath = join(apply(srcdirs, dir -> concatPath(dir, "Macaulay2/packages/")), pkgpath) path = select(join(corepath, pkgpath, path), isDirectory) -- a local way to use private global symbols after endPackage is called on Core core := nm -> value if nocore then getGlobalSymbol nm else Core#"private dictionary"#nm describePath = path -> ( if #path == 0 then printerr "file search path empty" else ( printerr "file search path directories:"; for d in path do printerr(" ", d))); loadCore = path -> ( if notify then describePath path; if not any(path, prefix -> trySimpleLoad("Core.m2", minimizeFilename(prefix | "Core.m2"))) then ( if not notify then describePath path; error "Core.m2 was not found on path")); -- Here the Core is loaded (loadDepth = 1; if firstTime and not nocore then loadCore path; loadDepth = 0) (loadDepth = 3; processCommandLineOptions 3; loadDepth = 0) (core "runStartFunctions")() loadDepth = 0; ( loadDepth = 3; processCommandLineOptions 4; n := 0; errorDepth = loadDepth = 3; n = interpreter(); if class n === ZZ and 0 <= n and n < 128 then exit n; if n === null then exit 0; debuggingMode = false; stopIfError = true; stderr << "error: can't interpret return value as an exit code" << endl; exit 1; ) -- Local Variables: -- compile-command: "make -C $M2BUILDDIR/Macaulay2/d startup.m2 all && make -C $M2BUILDDIR/Macaulay2/bin all " -- End: