コード例 #1
0
        public static void SetupProlog2()
        {
            try
            {
#if USE_IKVM
                if (!JplDisabled)
                {
                    JPL.setNativeLibraryDir(SwiHomeDir + "/bin");
                    try
                    {
                        JPL.loadNativeLibrary();
                    }
                    catch (Exception e)
                    {
                        WriteException(e);
                        JplDisabled = true;
                    }
                    if (!JplDisabled)
                    {
                        SafelyRun(() => jpl.fli.Prolog.initialise());
                    }
                }
                SafelyRun(TestClassLoader);
#endif
                //if (IsPLWin) return;
                try
                {
                    if (!PlEngine.IsInitialized)
                    {
                        String[] param = { "-q" }; // suppressing informational and banner messages
                        PlEngine.Initialize(param);
                    }
                    if (IsPLWin)
                    {
                        return;
                    }
                    if (!PlEngine.IsStreamFunctionReadModified)
                    {
                        PlEngine.SetStreamReader(Sread);
                    }
                    PlQuery.PlCall("nl.");
                }
                catch (Exception e)
                {
                    WriteException(e);
                    PlCsDisabled = true;
                }
                //                PlAssert("jpl:jvm_ready");
                //                PlAssert("module_transparent(jvm_ready)");
            }
            catch (Exception exception)
            {
                WriteException(exception);
                return;
            }
        }
コード例 #2
0
ファイル: Tracker.cs プロジェクト: segmond/swicli
        private static int PlObject(uint TermRef, object o)
        {
            var tag = object_to_tag(o);

            AddTagged(TermRef, tag);
            return(libpl.PL_succeed);

#if plvar_pins
            PlRef oref;
            if (!objectToPlRef.TryGetValue(o, out oref))
            {
                objectToPlRef[o] = oref = new PlRef();
                oref.Value       = o;
                oref.CSType      = o.GetType();
                oref.Tag         = tag;
                lock (atomToPlRef)
                {
                    PlRef oldValue;
                    if (atomToPlRef.TryGetValue(tag, out oldValue))
                    {
                        Warn("already a value for tag=" + oldValue);
                    }
                    atomToPlRef[tag] = oref;
                }
#if PLVARBIRTH
                Term jplTerm = JPL.newJRef(o);
                oref.JPLRef = jplTerm;

                Int64 ohandle = TopOHandle++;
                oref.OHandle = ohandle;
                // how do we track the birthtime?
                var plvar = oref.Variable = PlTerm.PlVar();
                lock (termToObjectPins)
                {
                    PlRef oldValue;
                    if (termToObjectPins.TryGetValue(ohandle, out oldValue))
                    {
                        Warn("already a value for ohandle=" + oldValue);
                    }
                    termToObjectPins[ohandle] = oref;
                }
                //PL_put_integer
                oref.Term = comp("$cli_object", new PlTerm((long)ohandle), plvar);
#else
                oref.Term = comp("@", PlTerm.PlAtom(tag));
#endif
                return(-1);    // oref.Term;
            }
            else
            {
                oref.Term = comp("@", PlTerm.PlAtom(tag));
                return(-1);    // oref.Term;
            }
#endif
        }
コード例 #3
0
ファイル: IKVMClassLoader.cs プロジェクト: swi-to-yap/swicli
 private static string clasPathOf(JPL jpl1)
 {
     string s = null;
     var cl = jpl1.getClass().getClassLoader();
     if (cl != null)
     {
         var r = cl.getResource(".");
         if (r != null)
         {
             s = r.getFile();
         }
         else
         {
             var a = jpl1.GetType().Assembly;
             if (a != null)
             {
                 s = a.Location;
             }
         }
     }
     return s;
 }