コード例 #1
0
    // external function to initiate the copying of data objects from one memory address to a destination.
    public void copyBytes(uint source, uint destination, memory destinationRegion, int count, Vector3 vertex, Color color, bool noFly)
    {
        //Debug.Log ("copyBytes from " + source.ToString ("x") + " to " + destination.ToString ("x") + " count "+count);

        /*
         * if(!inRange(source) || !destinationRegion.inRange(destination)){
         *      Debug.Log ("memory copyBytes address out of range "+source.ToString("x")+" to "+destination.ToString("x"));
         *      //Debug.Break ();
         *      return;
         * }
         */
        if (!noFly)
        {
            startup.pauseLabel("Memory Copy");
            startup.pause(false);
        }
        this.currentSource      = source;
        this.currentDestination = destination;
        this.vertex             = vertex;
        this.recentCubeScript   = null;
        this.currentCount       = count;
        this.origCount          = count;
        this.currentColor       = color;
        this.noFly             = noFly;
        this.destinationRegion = destinationRegion;
        //Debug.Log ("copyBytes "+count+" to " + currentDestination.ToString ("x") + " of " + destinationRegion.name);
        //Debug.Log ("copyBytes currentCount " + this.currentCount);
        // If a quick copy, don't wait until next frame because we may be skipping animation.
        if (noFly)
        {
            Update();
        }
    }
コード例 #2
0
 public static void removeRegion(uint address, int count)
 {
     if (pipeBehavior.sessionNumber == 0)
     {
         for (int i = 0; i < uninstantiated.Count; i++)
         {
             if (uninstantiated[i].address == address)
             {
                 uninstantiated.RemoveAt(i);
                 break;
             }
         }
     }
     else
     {
         memory region = findMemoryRegion(address);
         //TBD check count, handle partial giveback?
         if (region == null)
         {
             Debug.Log("manageControl found munmap of unmapped memory " + address.ToString("x"));
             Debug.Break();
             return;
         }
         region.remove();
         memoryRegions.Remove(region);
         Destroy(region.gameObject);
     }
 }
コード例 #3
0
    public static void doInit(pipeBehavior ps, string home)
    {
        //pipe1 = pipe1In;
        currentFunction = null;
        lineVector      = new Vector3[10000];
        zeroLine();
        GameObject memoryObject = GameObject.Find("Memory1");

        memoryScript  = (memory)memoryObject.GetComponent(typeof(memory));
        memoryRegions = new List <memory> ();
        memoryRegions.Add(memoryScript);
        //camera = GameObject.Find ("Main Camera");
        if (controlLine != null)
        {
            VectorLine.Destroy(ref controlLine);
        }
        controlLine = new VectorLine("myLines", lineVector, flowColor, null, 0.5f, LineType.Continuous);
        controlLine.maxDrawIndex = 0;
        lineElement = 0;
        pipeScript  = ps;
        if (pipeScript == null)
        {
            Debug.Log("pipeScript is null");
        }
        pipe1       = pipeScript.getPipe("pipe");
        breakpoints = new List <long> ();
        StreamReader reader = null;

        if (System.IO.File.Exists(home + "/breakpoints.txt"))
        {
            reader = new StreamReader(home + "/breakpoints.txt");
            Debug.Log("Found breakpoints");
        }
        else
        {
            Debug.Log("No breakpoint file in " + home);
        }
        if (reader != null)
        {
            string line;
            using (reader)
            {
                while ((line = reader.ReadLine()) != null)
                {
                    long value = long.Parse(line, System.Globalization.NumberStyles.HexNumber);
                    Debug.Log("add breakpoint at " + value.ToString("x"));
                    breakpoints.Add(value);
                }
            }
        }
        clockLabelString   = "0";
        currentCycleString = "0";
        numInstructions    = 0;
        currentClock       = 0;
        startClock         = 0;
        updateClock(0);
    }
コード例 #4
0
    static public void doInit()
    {
        uninstantiated = new List <region> ();
        GameObject memoryObject = GameObject.Find("Memory1");
        memory     memoryScript = (memory)memoryObject.GetComponent(typeof(memory));

        memoryRegions = new List <memory> ();
        memoryRegions.Add(memoryScript);
    }
コード例 #5
0
    // Use this for initialization
    void Awake()
    {
        transform.position = new Vector3(pipeX, pipeY, pipeZ);
        //pipe = getPipe ("pipe");
        pipe = gameObject;
        GameObject mem = GameObject.Find("Memory1");

        memoryScript     = (memory)mem.GetComponent(typeof(memory));
        baseBytesPerCube = memoryScript.bytesPerCube;
    }
コード例 #6
0
        static void Main()
        {
            memory mem = new memory();

            mem.GetListElement( , , , );
            mem.SetListElement( , , , );

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
コード例 #7
0
    private static void createRegion(uint address, int count)
    {
        GameObject newMemory = Instantiate(Resources.Load("memoryPrefab")) as GameObject;

        newMemory.name = "mem" + address.ToString("x");
        Vector3 memPos = getOpenSpace();

        newMemory.transform.position = memPos;
        memory script      = (memory)newMemory.GetComponent(typeof(memory));
        uint   max_address = (uint)(address + count - 1);

        script.setRange(address, max_address);
        memoryRegions.Add(script);
    }
コード例 #8
0
 public void write(uint from, int count, memory region, Vector3 vertex)
 {
     memoryScript = region;
     if (memoryScript && !memoryScript.inRange(from))
     {
         Debug.Log("pipeBehavior write address out of range " + from.ToString("x"));
         //Debug.Break ();
         return;
     }
     this.currentAddr  = from;
     this.currentCount = count;
     this.vertex       = vertex;
     this.reading      = false;
 }
コード例 #9
0
 public bool addMemory(int memory)
 {
     try
     {
         DBModel dBModel = new DBModel();
         memory  m       = new memory();
         m.MEMORY1 = memory;
         dBModel.memories.Add(m);
         dBModel.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
コード例 #10
0
    // use the pipeBehavior class to write to the network
    static void doWrite(uint from, int count, Vector3 pt)
    {
        memory region = mmap.findMemoryRegion(from);

        if (region == null)
        {
            //if(!memoryScript.inRange(to)){
            Debug.Log("pipeBehavior write  address out of range " + from.ToString("x"));
            //Debug.Break();
            return;
        }
        //Debug.Log ("in doRead to " + to + " count " + count + " pt " + pt);
        pipeScript.write(from, count, region, pt);

        startup.pause(false);
        startup.pauseLabelString = "Network Write";
    }
コード例 #11
0
 public void read(uint to, int count, memory region, Vector3 vertex)
 {
     memoryScript = region;
     if (memoryScript && !memoryScript.inRange(to))
     {
         Debug.Log("pipeBehavior read  address out of range " + to.ToString("x"));
         //Debug.Break ();
         return;
     }
     this.currentAddr  = to;
     this.vertex       = vertex;
     this.reading      = true;
     this.currentCount = count;
     if (!connectionDone)
     {
         growTeamPipe();
         connectionDone = true;
     }
 }
コード例 #12
0
    /*
     * Instantiate network and memory objects and initialize project
     */
    void Awake()
    {
        //camera = GameObject.Find ("Main Camera");
        color1.a     = 0.4f;
        color2.a     = 0.4f;
        shader2      = Shader.Find("Transparent/VertexLit");
        cameraScript = (maxCamera)Camera.main.GetComponent(typeof(maxCamera));
        Debug.Log("i am awake\n");

        //pipe1 = Instantiate (Resources.Load ("networkPrefab")) as GameObject;
        pipe1      = Instantiate(Resources.Load("spherePrefab")) as GameObject;
        pipe1.name = "theNetwork";

        pipeScript = (pipeBehavior)pipe1.GetComponent(typeof(pipeBehavior));
        GameObject mem = GameObject.Find("Memory1");

        memoryScript           = (memory)mem.GetComponent(typeof(memory));
        mem.transform.position = memoryStart;
        mem.transform.rotation = Quaternion.Euler(memoryRotation);
        initProject(project);
    }
コード例 #13
0
    // use the pipeBehavior class to read from the network
    static void doRead(uint to, int count, Vector3 pt)
    {
        memory region = mmap.findMemoryRegion(to);

        if (region == null)
        {
            //if(!memoryScript.inRange(to)){
            //Debug.Log ("pipeBehavior read  address out of range "+to.ToString("x"));
            //Debug.Break ();
            return;
        }
        if (to < region.minDataAddress)
        {
            return;
        }
        //Debug.Log ("in doRead to " + to + " count " + count + " pt " + pt);
        pipeScript.read(to, count, region, pt);
        // stop processing instructions until the data completes its trip.
        // see dataBehavior and use of the "caboose" variable.
        startup.pause(false);
        startup.pauseLabelString = "Network Read";
    }
コード例 #14
0
    public static void doInit(string homePath, startup.instructions ins, pipeBehavior ps, memory ms)
    {
        home         = homePath;
        instructs    = ins;
        pipeScript   = ps;
        memoryScript = ms;
        bookmarkList = new List <string> ();
        string path = home + "/bookmarks/";

        System.IO.Directory.CreateDirectory(path);

        DirectoryInfo di = new DirectoryInfo(home + "/bookmarks/");

        FileInfo[] oldmarks = di.GetFiles();

        Array.Sort(oldmarks, (x, y) => StringComparer.OrdinalIgnoreCase.Compare(x.LastWriteTime, y.LastWriteTime));
        Debug.Log("num files in " + home + "/bookmarks/ is " + oldmarks.Length);
        for (int i = 0; i < oldmarks.Length; i++)
        {
            bookmarkList.Add(Path.GetFileNameWithoutExtension(oldmarks[i].Name));
        }
    }
コード例 #15
0
 public bool delMemory(int memory)
 {
     try
     {
         DBModel dBModel = new DBModel();
         memory  m       = dBModel.memories.Where(x => x.MEMORY1 == memory).FirstOrDefault();
         if (m != null)
         {
             dBModel.memories.Attach(m);
             dBModel.memories.Remove(m);
             dBModel.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
コード例 #16
0
 await destStream.WriteAsync(memory, token).ConfigureAwait(false);
コード例 #17
0
 convexWide.Initialize(new RawBuffer(memory, convexWide.InternalAllocationSize));
コード例 #18
0
 encoder(memory, value);
 ForEach(memory, action, 1);
コード例 #20
0
 accumulator += int.Parse(memory[currentInstruction][4..]);