internal IronSchemeLanguageProvider(ScriptDomainManager x)
            : base(x)
        {
            ScriptDomainManager.Options.DynamicStackTraceSupport = false;

              Runtime.Closure.ConsFromArray = Runtime.Cons.FromArray;
              Runtime.Closure.ConsStarFromArray = delegate(object[] args) { return Builtins.ToImproper(Cons.FromArray(args)); };
              Runtime.Closure.Unspecified = Builtins.Unspecified;
              Runtime.Closure.ArrayFromCons = Builtins.ListToVector;

              Initialize();

              // only register when done
              x.RegisterLanguageProvider("IronScheme", "IronScheme.Hosting.IronSchemeLanguageProvider", ".sps", ".ss", ".sls");
        }
Example #2
0
 internal ScriptEnvironment(ScriptDomainManager manager)
 {
     Debug.Assert(manager != null);
     _manager = manager;
 }
        /// <summary>
        /// Creates a new local <see cref="ScriptDomainManager"/> unless it already exists. 
        /// Returns either <c>true</c> and the newly created environment initialized according to the provided setup information
        /// or <c>false</c> and the existing one ignoring the specified setup information.
        /// </summary>
        internal static bool TryCreateLocal(out ScriptDomainManager manager)
        {
            bool new_created = false;

            if (_singleton == null) {

                lock (_singletonLock) {
                    if (_singleton == null) {
                        ScriptDomainManager singleton = new ScriptDomainManager();
                        Utilities.MemoryBarrier();
                        _singleton = singleton;
                        new_created = true;
                    }
                }

            }

            manager = _singleton;
            return new_created;
        }
            /// <summary>
            /// Must not be called under a lock as it can potentially call a user code.
            /// </summary>
            /// <exception cref="MissingTypeException"><paramref name="languageId"/></exception>
            /// <exception cref="InvalidImplementationException">The language provider's implementation failed to instantiate.</exception>
            public LanguageProvider LoadProvider(ScriptDomainManager manager)
            {
                if (_provider == null) {

                    if (_type == null) {
                        try {
                            _type = ScriptDomainManager.CurrentManager.PAL.LoadAssembly(_assemblyName).GetType(_typeName, true);
                        } catch (Exception e) {
                            throw new MissingTypeException(MakeAssemblyQualifiedName(_assemblyName, _typeName), e);
                        }
                    }

                    lock (manager._languageProvidersLock) {
                        manager._languageTypes[_type.AssemblyQualifiedName] = this;
                    }

                    // needn't to be locked, we can create multiple LPs:
                    LanguageProvider provider = ReflectionUtils.CreateInstance<LanguageProvider>(_type, manager);
                    Utilities.MemoryBarrier();
                    _provider = provider;
                }
                return _provider;
            }
Example #5
0
 public ToyLanguageProvider(ScriptDomainManager manager) : base(manager) { }