Exemplo n.º 1
0
        private void LoadBuiltins()
        {
            Assembly asm = typeof(FoxPro.Hosting.FoxProEngine).Assembly;

            object[] attributes = asm.GetCustomAttributes(typeof(FoxProModuleAttribute), false);
            foreach (FoxProModuleAttribute pma in attributes)
            {
                if (pma.type == typeof(FoxPro.Modules.Builtin))
                {
                    global.AddType(pma.name, builtins);
                }
                else
                {
                    global.AddFoxProType(pma.name, pma.type);
                }
            }
            global.AddFoxProType("sys", typeof(FoxPro.Runtime.SystemState));
            global.AddFoxProType("clr", typeof(FoxPro.Modules.ClrModule));
        }
Exemplo n.º 2
0
        private void LoadTypes(Assembly assembly)
        {
            Type[] types = assembly.GetExportedTypes();

            foreach (Type type in types)
            {
                ReflectedModule scope = global;
                string[]        ns    = type.Namespace.Split('.');
                string          full  = "";
                bool            dot   = false;
                foreach (string n in ns)
                {
                    full  = dot ? full + "." + n : n;
                    dot   = true;
                    scope = scope.EnsureNamespace(full, SymbolTable.StringToId(n));
                }
                scope.AddType(type);
            }
        }