예제 #1
0
파일: sort.cs 프로젝트: zjmit/go2cs
 // Float64sAreSorted tests whether a slice of float64s is sorted in increasing order
 // (not-a-number values are treated as less than other values).
 public static bool Float64sAreSorted(slice <double> a)
 {
     return(IsSorted(Float64Slice(a)));
 }
예제 #2
0
파일: forkpipe2.cs 프로젝트: zjmit/go2cs
 private static error forkExecPipe(slice <long> p)
 {
     return(error.As(Pipe2(p, O_CLOEXEC)) !);
 }
예제 #3
0
 public FuncType(slice <ptr <Type> > Params = default, ref ptr <Type> Result = default, ref ptr <ast.FuncType> Go = default)
 {
     this.Params = Params;
     this.Result = Result;
     this.Go     = Go;
 }
예제 #4
0
 public vdsoInfo(bool valid = default, System.UIntPtr loadAddr = default, System.UIntPtr loadOffset = default, ref ptr <array <elfSym> > symtab = default, ref ptr <array <byte> > symstrings = default, slice <uint> chain = default, slice <uint> bucket = default, uint symOff = default, bool isGNUHash = default, ref ptr <array <ushort> > versym = default, ref ptr <elfVerdef> verdef = default)
 {
     this.valid      = valid;
     this.loadAddr   = loadAddr;
     this.loadOffset = loadOffset;
     this.symtab     = symtab;
     this.symstrings = symstrings;
     this.chain      = chain;
     this.bucket     = bucket;
     this.symOff     = symOff;
     this.isGNUHash  = isGNUHash;
     this.versym     = versym;
     this.verdef     = verdef;
 }
예제 #5
0
파일: main.cs 프로젝트: zjmit/go2cs
 private static (slice <byte>, error) gofmtFile(ptr <ast.File> _addr_f)
 {
     slice <byte> _p0 = default;
     error        _p0 = default !;
예제 #6
0
 public LineFollow3D(Node parent = default, slice <Vector3> points = default, bool doLoop = default, CSGBox cube = default, float speed = default, float currentDistance = default, slice <float> lineDistances = default)
 {
     this.parent          = parent;
     this.points          = points;
     this.doLoop          = doLoop;
     this.cube            = cube;
     this.speed           = speed;
     this.currentDistance = currentDistance;
     this.lineDistances   = lineDistances;
 }
예제 #7
0
 public blocksByStart(slice <ProfileBlock> value) => m_value = value;
예제 #8
0
 // SearchStrings searches for x in a sorted slice of strings and returns the index
 // as specified by Search. The return value is the index to insert x if x is not
 // present (it could be len(a)).
 // The slice must be sorted in ascending order.
 //
 public static long SearchStrings(slice <@string> a, @string x)
 {
     return(Search(len(a), i => a[i] >= x));
 }
예제 #9
0
        // Convenience wrappers for common cases.

        // SearchInts searches for x in a sorted slice of ints and returns the index
        // as specified by Search. The return value is the index to insert x if x is
        // not present (it could be len(a)).
        // The slice must be sorted in ascending order.
        //
        public static long SearchInts(slice <long> a, long x)
        {
            return(Search(len(a), i => a[i] >= x));
        }
예제 #10
0
 public tester(bool race = default, bool listMode = default, bool rebuild = default, bool failed = default, bool keepGoing = default, bool compileOnly = default, @string runRxStr = default, ref ptr <regexp.Regexp> runRx = default, bool runRxWant = default, slice <@string> runNames = default, @string banner = default, @string lastHeading = default, bool cgoEnabled = default, bool partial = default, bool haveTime = default, slice <distTest> tests = default, long timeoutScale = default, slice <ptr <work> > worklist = default)
 {
     this.race         = race;
     this.listMode     = listMode;
     this.rebuild      = rebuild;
     this.failed       = failed;
     this.keepGoing    = keepGoing;
     this.compileOnly  = compileOnly;
     this.runRxStr     = runRxStr;
     this.runRx        = runRx;
     this.runRxWant    = runRxWant;
     this.runNames     = runNames;
     this.banner       = banner;
     this.lastHeading  = lastHeading;
     this.cgoEnabled   = cgoEnabled;
     this.partial      = partial;
     this.haveTime     = haveTime;
     this.tests        = tests;
     this.timeoutScale = timeoutScale;
     this.worklist     = worklist;
 }
예제 #11
0
 // SearchFloat64s searches for x in a sorted slice of float64s and returns the index
 // as specified by Search. The return value is the index to insert x if x is not
 // present (it could be len(a)).
 // The slice must be sorted in ascending order.
 //
 public static long SearchFloat64s(slice <double> a, double x)
 {
     return(Search(len(a), i => a[i] >= x));
 }
예제 #12
0
 public TypeRepr(@string Repr = default, slice <object> FormatArgs = default)
 {
     this.Repr       = Repr;
     this.FormatArgs = FormatArgs;
 }
예제 #13
0
파일: dir_plan9.cs 프로젝트: zjmit/go2cs
 private static (slice <FileInfo>, error) readdir(this ptr <File> _addr_file, long n)
 {
     slice <FileInfo> _p0  = default;
     error            _p0  = default !;
예제 #14
0
파일: sort.cs 프로젝트: zjmit/go2cs
 // StringsAreSorted tests whether a slice of strings is sorted in increasing order.
 public static bool StringsAreSorted(slice <@string> a)
 {
     return(IsSorted(StringSlice(a)));
 }
예제 #15
0
 private static (slice <route.Message>, error) interfaceMessages(long ifindex)
 {
     slice <route.Message> _p0 = default;
     error _p0 = default !;
예제 #16
0
 public ancestorInfo(slice <System.UIntPtr> pcs = default, long goid = default, System.UIntPtr gopc = default)
 {
     this.pcs  = pcs;
     this.goid = goid;
     this.gopc = gopc;
 }
예제 #17
0
 public Replacer(sync.Once once = default, replacer r = default, slice <@string> oldnew = default)
 {
     this.once   = once;
     this.r      = r;
     this.oldnew = oldnew;
 }
예제 #18
0
 public Scanner(io.Reader r = default, SplitFunc split = default, long maxTokenSize = default, slice <byte> token = default, slice <byte> buf = default, long start = default, long end = default, error err = default, long empties = default, bool scanCalled = default, bool done = default)
 {
     this.r            = r;
     this.split        = split;
     this.maxTokenSize = maxTokenSize;
     this.token        = token;
     this.buf          = buf;
     this.start        = start;
     this.end          = end;
     this.err          = err;
     this.empties      = empties;
     this.scanCalled   = scanCalled;
     this.done         = done;
 }
예제 #19
0
 private static void printSlice(slice <@int> s)
 {
     fmt.Printf("len=%d cap=%d %v\n", len(s), cap(s), s);
 }
예제 #20
0
        //sysnb    pipe(p *[2]_C_int) (err error)

        public static error Pipe(slice <long> p)
        {
            error err = default !;
예제 #21
0
 public profBuf(profAtomic r = default, profAtomic w = default, ulong overflow = default, ulong overflowTime = default, uint eof = default, System.UIntPtr hdrsize = default, slice <ulong> data = default, slice <unsafe.Pointer> tags = default, profIndex rNext = default, slice <ulong> overflowBuf = default, note wait = default)
예제 #22
0
파일: cgo_unix.cs 프로젝트: zjmit/go2cs
 private static (slice <@string>, error, bool) cgoLookupHost(context.Context ctx, @string name)
 {
     slice <@string> hosts     = default;
     error           err       = default !;
예제 #23
0
 public ret(slice <@string> addrs = default, error err = default)
 {
     this.addrs = addrs;
     this.err   = err;
 }
예제 #24
0
 private delegate(long, error) WriteByVal(T value, slice <byte> p);
 public InterfaceMulticastAddrMessage(IfmaMsghdr Header = default, slice <byte> Data = default)
 {
     this.Header = Header;
     this.Data   = Data;
 }
예제 #26
0
 private delegate(long, error) WriteByRef(ref T value, slice <byte> p);
예제 #27
0
        // Return the minimum value seen for the zone CPU cap, or 0 if no cap is
        // detected.
        private static ulong getcpucap()
        {
            // The resource control block is an opaque object whose size is only
            // known to libc.  In practice, given the contents, it is unlikely to
            // grow beyond 8KB so we'll use a static buffer of that size here.
            const long rblkmaxsize = (long)8L * 1024L;

            if (rctlblk_size() > rblkmaxsize)
            {
                return(0L);
            }

            // The "zone.cpu-cap" resource control, as described in
            // resource_controls(5), "sets a limit on the amount of CPU time that
            // can be used by a zone.  The unit used is the percentage of a single
            // CPU that can be used by all user threads in a zone, expressed as an
            // integer."  A C string of the name must be passed to getrctl(2).
            slice <byte> name = (slice <byte>) "zone.cpu-cap\x00";

            // To iterate over the list of values for a particular resource
            // control, we need two blocks: one for the previously read value and
            // one for the next value.
            array <byte> rblk0    = new array <byte>(rblkmaxsize);
            array <byte> rblk1    = new array <byte>(rblkmaxsize);
            var          rblk     = _addr_rblk0[0L];
            var          rblkprev = _addr_rblk1[0L];

            uint  flag   = _RCTL_FIRST;
            ulong capval = 0L;

            while (true)
            {
                if (getrctl(@unsafe.Pointer(_addr_name[0L]), @unsafe.Pointer(rblkprev), @unsafe.Pointer(rblk), flag) != 0L)
                {
                    // The end of the sequence is reported as an ENOENT
                    // failure, but determining the CPU cap is not critical
                    // here.  We'll treat any failure as if it were the end
                    // of sequence.
                    break;
                }

                var lflags = rctlblk_get_local_flags(@unsafe.Pointer(rblk));
                var action = rctlblk_get_local_action(@unsafe.Pointer(rblk));
                if ((lflags & _RCTL_LOCAL_MAXIMAL) == 0L && action == _RCTL_LOCAL_DENY)
                {
                    // This is a finite (not maximal) value representing a
                    // cap (deny) action.
                    var v = rctlblk_get_value(@unsafe.Pointer(rblk));
                    if (capval == 0L || capval > v)
                    {
                        capval = v;
                    }
                }

                // Swap the blocks around so that we can fetch the next value
                var t = rblk;
                rblk     = rblkprev;
                rblkprev = t;
                flag     = _RCTL_NEXT;
            }


            return(capval);
        }
예제 #28
0
 public (long, error) Write(slice <byte> p) => s_WriteByRef?.Invoke(ref this, p) ?? s_WriteByVal?.Invoke(this, p) ?? Writer?.Write(p) ?? throw new PanicException(RuntimeErrorPanic.NilPointerDereference);
예제 #29
0
 public onePassMachine(inputs inputs = default, slice <long> matchcap = default)
 {
     this.inputs   = inputs;
     this.matchcap = matchcap;
 }
예제 #30
0
파일: sort.cs 프로젝트: zjmit/go2cs
 // IntsAreSorted tests whether a slice of ints is sorted in increasing order.
 public static bool IntsAreSorted(slice <long> a)
 {
     return(IsSorted(IntSlice(a)));
 }