Esempio n. 1
0
                                // GNUSyntax returns the GNU assembler syntax for the instruction, as defined by GNU binutils.
                                // This form typically matches the syntax defined in the ARM Reference Manual.
                                public static @string GNUSyntax(Inst inst)
                                {
                                    bytes.Buffer buf = default;
                                    var          op  = inst.Op.String();

                                    op = saveDot.Replace(op);
                                    op = strings.Replace(op, ".", "", -1L);
                                    op = strings.Replace(op, "_dot_", ".", -1L);
                                    op = strings.ToLower(op);
                                    buf.WriteString(op);
                                    @string sep = " ";

                                    foreach (var(i, arg) in inst.Args)
                                    {
                                        if (arg == null)
                                        {
                                            break;
                                        }

                                        var text = gnuArg(_addr_inst, i, arg);
                                        if (text == "")
                                        {
                                            continue;
                                        }

                                        buf.WriteString(sep);
                                        sep = ", ";
                                        buf.WriteString(text);
                                    }
                                    return(buf.String());
                                }
Esempio n. 2
0
 public printState(bool tparams = default, bytes.Buffer buf = default, byte last = default, slice <AST> inner = default, slice <AST> printing = default)
 {
     this.tparams  = tparams;
     this.buf      = buf;
     this.last     = last;
     this.inner    = inner;
     this.printing = printing;
 }
Esempio n. 3
0
 public state(fmt.State State = default, bytes.Buffer buf = default, bool printDetail = default, bool inDetail = default, bool needColon = default, bool needNewline = default)
 {
     this.State       = State;
     this.buf         = buf;
     this.printDetail = printDetail;
     this.inDetail    = inDetail;
     this.needColon   = needColon;
     this.needNewline = needNewline;
 }
Esempio n. 4
0
 public timeoutWriter(ResponseWriter w = default, Header h = default, bytes.Buffer wbuf = default, ref ptr <Request> req = default, sync.Mutex mu = default, bool timedOut = default, bool wroteHeader = default, long code = default)
 {
     this.w           = w;
     this.h           = h;
     this.wbuf        = wbuf;
     this.req         = req;
     this.mu          = mu;
     this.timedOut    = timedOut;
     this.wroteHeader = wroteHeader;
     this.code        = code;
 }
Esempio n. 5
0
        /*
         * Helpers for building cmd/go and cmd/cgo.
         */

        // mkzdefaultcc writes zdefaultcc.go:
        //
        //    package main
        //    const defaultCC = <defaultcc>
        //    const defaultCXX = <defaultcxx>
        //    const defaultPkgConfig = <defaultpkgconfig>
        //
        // It is invoked to write cmd/go/internal/cfg/zdefaultcc.go
        // but we also write cmd/cgo/zdefaultcc.go
        private static void mkzdefaultcc(@string dir, @string file)
        {
            if (strings.Contains(file, filepath.FromSlash("go/internal/cfg")))
            {
                ref bytes.Buffer buf = ref heap(out ptr <bytes.Buffer> _addr_buf);
                fmt.Fprintf(_addr_buf, "// Code generated by go tool dist; DO NOT EDIT.\n");
                fmt.Fprintln(_addr_buf);
                fmt.Fprintf(_addr_buf, "package cfg\n");
                fmt.Fprintln(_addr_buf);
                fmt.Fprintf(_addr_buf, "const DefaultPkgConfig = `%s`\n", defaultpkgconfig);
                buf.WriteString(defaultCCFunc("DefaultCC", defaultcc));
                buf.WriteString(defaultCCFunc("DefaultCXX", defaultcxx));
                writefile(buf.String(), file, writeSkipSame);
                return;
            }
Esempio n. 6
0
 // Escape comment text for HTML. If nice is set,
 // also turn `` into &ldquo; and '' into &rdquo;.
 private static void commentEscape(io.Writer w, @string text, bool nice)
 {
     if (nice)
     {
         // In the first pass, we convert `` and '' into their unicode equivalents.
         // This prevents them from being escaped in HTMLEscape.
         text = convertQuotes(text);
         ref bytes.Buffer buf = ref heap(out ptr <bytes.Buffer> _addr_buf);
         template.HTMLEscape(_addr_buf, (slice <byte>)text);
         // Now we convert the unicode quotes to their HTML escaped entities to maintain old behavior.
         // We need to use a temp buffer to read the string back and do the conversion,
         // otherwise HTMLEscape will escape & to &amp;
         htmlQuoteReplacer.WriteString(w, buf.String());
         return;
     }
Esempio n. 7
0
File: mode.cs Progetto: zjmit/go2cs
                        public static @string String(this BuilderMode m)
                        {
                            bytes.Buffer buf = default;
                            if (m & GlobalDebug != 0L)
                            {
                                buf.WriteByte('D');
                            }

                            if (m & PrintPackages != 0L)
                            {
                                buf.WriteByte('P');
                            }

                            if (m & PrintFunctions != 0L)
                            {
                                buf.WriteByte('F');
                            }

                            if (m & LogSource != 0L)
                            {
                                buf.WriteByte('S');
                            }

                            if (m & SanityCheckFunctions != 0L)
                            {
                                buf.WriteByte('C');
                            }

                            if (m & NaiveForm != 0L)
                            {
                                buf.WriteByte('N');
                            }

                            if (m & BuildSerially != 0L)
                            {
                                buf.WriteByte('L');
                            }

                            return(buf.String());
                        }
Esempio n. 8
0
File: inst.cs Progetto: zjmit/go2cs
                                public static @string String(this Inst i)
                                {
                                    bytes.Buffer buf = default;
                                    buf.WriteString(i.Op.String());
                                    foreach (var(j, arg) in i.Args)
                                    {
                                        if (arg == null)
                                        {
                                            break;
                                        }

                                        if (j == 0L)
                                        {
                                            buf.WriteString(" ");
                                        }
                                        else
                                        {
                                            buf.WriteString(", ");
                                        }

                                        buf.WriteString(arg.String());
                                    }
                                    return(buf.String());
                                }
Esempio n. 9
0
 public Scanner(io.Reader src = default, array <byte> srcBuf = default, long srcPos = default, long srcEnd = default, long srcBufOffset = default, long line = default, long column = default, long lastLineLen = default, long lastCharLen = default, bytes.Buffer tokBuf = default, long tokPos = default, long tokEnd = default, int ch = default, Action <ptr <Scanner>, @string> Error = default, long ErrorCount = default, ulong Mode = default, ulong Whitespace = default, Func <int, long, bool> IsIdentRune = default, Position Position = default)
 {
     this.src           = src;
     this.srcBuf        = srcBuf;
     this.srcPos        = srcPos;
     this.srcEnd        = srcEnd;
     this.srcBufOffset  = srcBufOffset;
     this.line          = line;
     this.column        = column;
     this.lastLineLen   = lastLineLen;
     this.lastCharLen   = lastCharLen;
     this.tokBuf        = tokBuf;
     this.tokPos        = tokPos;
     this.tokEnd        = tokEnd;
     this.ch            = ch;
     this.Error         = Error;
     this.ErrorCount    = ErrorCount;
     this.Mode          = Mode;
     this.Whitespace    = Whitespace;
     this.IsIdentRune   = IsIdentRune;
     this.m_PositionRef = new ptr <Position>(Position);
 }
 public http2ClientConn(ref ptr<http2Transport> t = default, net.Conn tconn = default, ref ptr<tls.ConnectionState> tlsState = default, uint reused = default, bool singleUse = default, channel<object> readerDone = default, error readerErr = default, time.Duration idleTimeout = default, ref ptr<time.Timer> idleTimer = default, sync.Mutex mu = default, ref ptr<sync.Cond> cond = default, http2flow flow = default, http2flow inflow = default, bool closing = default, bool closed = default, bool wantSettingsAck = default, ref ptr<http2GoAwayFrame> goAway = default, @string goAwayDebug = default, map<uint, ptr<http2clientStream>> streams = default, uint nextStreamID = default, long pendingRequests = default, map<array<byte>, channel<object>> pings = default, ref ptr<bufio.Writer> bw = default, ref ptr<bufio.Reader> br = default, ref ptr<http2Framer> fr = default, time.Time lastActive = default, time.Time lastIdle = default, uint maxFrameSize = default, uint maxConcurrentStreams = default, ulong peerMaxHeaderListSize = default, uint initialWindowSize = default, bytes.Buffer hbuf = default, ref ptr<hpack.Encoder> henc = default, slice<slice<byte>> freeBuf = default, sync.Mutex wmu = default, error werr = default)
 {
     this.t = t;
     this.tconn = tconn;
     this.tlsState = tlsState;
     this.reused = reused;
     this.singleUse = singleUse;
     this.readerDone = readerDone;
     this.readerErr = readerErr;
     this.idleTimeout = idleTimeout;
     this.idleTimer = idleTimer;
     this.mu = mu;
     this.cond = cond;
     this.flow = flow;
     this.inflow = inflow;
     this.closing = closing;
     this.closed = closed;
     this.wantSettingsAck = wantSettingsAck;
     this.goAway = goAway;
     this.goAwayDebug = goAwayDebug;
     this.streams = streams;
     this.nextStreamID = nextStreamID;
     this.pendingRequests = pendingRequests;
     this.pings = pings;
     this.bw = bw;
     this.br = br;
     this.fr = fr;
     this.lastActive = lastActive;
     this.lastIdle = lastIdle;
     this.maxFrameSize = maxFrameSize;
     this.maxConcurrentStreams = maxConcurrentStreams;
     this.peerMaxHeaderListSize = peerMaxHeaderListSize;
     this.initialWindowSize = initialWindowSize;
     this.hbuf = hbuf;
     this.henc = henc;
     this.freeBuf = freeBuf;
     this.wmu = wmu;
     this.werr = werr;
 }
Esempio n. 11
0
 public http2serverConn(ref ptr <http2Server> srv = default, ref ptr <Server> hs = default, net.Conn conn = default, ref ptr <http2bufferedWriter> bw = default, Handler handler = default, context.Context baseCtx = default, ref ptr <http2Framer> framer = default, channel <object> doneServing = default, channel <http2readFrameResult> readFrameCh = default, channel <http2FrameWriteRequest> wantWriteFrameCh = default, channel <http2frameWriteResult> wroteFrameCh = default, channel <http2bodyReadMsg> bodyReadCh = default, channel <object> serveMsgCh = default, http2flow flow = default, http2flow inflow = default, ref ptr <tls.ConnectionState> tlsState = default, @string remoteAddrStr = default, http2WriteScheduler writeSched = default, http2goroutineLock serveG = default, bool pushEnabled = default, bool sawFirstSettings = default, bool needToSendSettingsAck = default, long unackedSettings = default, long queuedControlFrames = default, uint clientMaxStreams = default, uint advMaxStreams = default, uint curClientStreams = default, uint curPushedStreams = default, uint maxClientStreamID = default, uint maxPushPromiseID = default, map <uint, ptr <http2stream> > streams = default, int initialStreamSendWindowSize = default, int maxFrameSize = default, uint headerTableSize = default, uint peerMaxHeaderListSize = default, map <@string, @string> canonHeader = default, bool writingFrame = default, bool writingFrameAsync = default, bool needsFrameFlush = default, bool inGoAway = default, bool inFrameScheduleLoop = default, bool needToSendGoAway = default, http2ErrCode goAwayCode = default, ref ptr <time.Timer> shutdownTimer = default, ref ptr <time.Timer> idleTimer = default, bytes.Buffer headerWriteBuf = default, ref ptr <hpack.Encoder> hpackEncoder = default, sync.Once shutdownOnce = default)
 {
     this.srv                         = srv;
     this.hs                          = hs;
     this.conn                        = conn;
     this.bw                          = bw;
     this.handler                     = handler;
     this.baseCtx                     = baseCtx;
     this.framer                      = framer;
     this.doneServing                 = doneServing;
     this.readFrameCh                 = readFrameCh;
     this.wantWriteFrameCh            = wantWriteFrameCh;
     this.wroteFrameCh                = wroteFrameCh;
     this.bodyReadCh                  = bodyReadCh;
     this.serveMsgCh                  = serveMsgCh;
     this.flow                        = flow;
     this.inflow                      = inflow;
     this.tlsState                    = tlsState;
     this.remoteAddrStr               = remoteAddrStr;
     this.writeSched                  = writeSched;
     this.serveG                      = serveG;
     this.pushEnabled                 = pushEnabled;
     this.sawFirstSettings            = sawFirstSettings;
     this.needToSendSettingsAck       = needToSendSettingsAck;
     this.unackedSettings             = unackedSettings;
     this.queuedControlFrames         = queuedControlFrames;
     this.clientMaxStreams            = clientMaxStreams;
     this.advMaxStreams               = advMaxStreams;
     this.curClientStreams            = curClientStreams;
     this.curPushedStreams            = curPushedStreams;
     this.maxClientStreamID           = maxClientStreamID;
     this.maxPushPromiseID            = maxPushPromiseID;
     this.streams                     = streams;
     this.initialStreamSendWindowSize = initialStreamSendWindowSize;
     this.maxFrameSize                = maxFrameSize;
     this.headerTableSize             = headerTableSize;
     this.peerMaxHeaderListSize       = peerMaxHeaderListSize;
     this.canonHeader                 = canonHeader;
     this.writingFrame                = writingFrame;
     this.writingFrameAsync           = writingFrameAsync;
     this.needsFrameFlush             = needsFrameFlush;
     this.inGoAway                    = inGoAway;
     this.inFrameScheduleLoop         = inFrameScheduleLoop;
     this.needToSendGoAway            = needToSendGoAway;
     this.goAwayCode                  = goAwayCode;
     this.shutdownTimer               = shutdownTimer;
     this.idleTimer                   = idleTimer;
     this.headerWriteBuf              = headerWriteBuf;
     this.hpackEncoder                = hpackEncoder;
     this.shutdownOnce                = shutdownOnce;
 }
Esempio n. 12
0
 public printer(bytes.Buffer Buffer = default, slice <Comment> comment = default, long margin = default)
 {
     this.m_BufferRef = new ptr <bytes.Buffer>(Buffer);
     this.comment     = comment;
     this.margin      = margin;
 }
Esempio n. 13
0
 public intWriter(bytes.Buffer Buffer = default)
 {
     this.m_BufferRef = new ptr <bytes.Buffer>(Buffer);
 }
Esempio n. 14
0
 public Decoder(dynamicTable dynTab = default, Action <HeaderField> emit = default, bool emitEnabled = default, long maxStrLen = default, slice <byte> buf = default, bytes.Buffer saveBuf = default, bool firstField = default)
 {
     this.dynTab      = dynTab;
     this.emit        = emit;
     this.emitEnabled = emitEnabled;
     this.maxStrLen   = maxStrLen;
     this.buf         = buf;
     this.saveBuf     = saveBuf;
     this.firstField  = firstField;
 }
Esempio n. 15
0
 public conn(sync.Mutex mutex = default, io.ReadWriteCloser rwc = default, bytes.Buffer buf = default, header h = default)
 {
     this.mutex = mutex;
     this.rwc   = rwc;
     this.buf   = buf;
     this.h     = h;
 }
Esempio n. 16
0
File: gnu.cs Progetto: zjmit/go2cs
                                // GNUSyntax returns the GNU assembler syntax for the instruction, as defined by GNU binutils.
                                // This form typically matches the syntax defined in the Power ISA Reference Manual.
                                public static @string GNUSyntax(Inst inst, ulong pc)
                                {
                                    bytes.Buffer buf = default;
                                    // When there are all 0s, identify them as the disassembler
                                    // in binutils would.
                                    if (inst.Enc == 0L)
                                    {
                                        return(".long 0x0");
                                    }
                                    else if (inst.Op == 0L)
                                    {
                                        return("error: unknown instruction");
                                    }

                                    var PC = pc;
                                    // Special handling for some ops
                                    long    startArg = 0L;
                                    @string sep      = " ";

                                    switch (inst.Op.String())
                                    {
                                    case "bc":
                                        var bo = gnuArg(_addr_inst, 0L, inst.Args[0L], PC);
                                        var bi = inst.Args[1L];
                                        switch (bi.type())
                                        {
                                        case CondReg bi:
                                            if (bi >= CR0)
                                            {
                                                if (bi == CR0 && bo == "16")
                                                {
                                                    buf.WriteString("bdnz");
                                                }

                                                buf.WriteString(fmt.Sprintf("bc cr%d", bi - CR0));
                                            }

                                            var cr = bi / 4L;
                                            switch (bo)
                                            {
                                            case "4":
                                                var bit = condBitNeg[(bi - Cond0LT) % 4L];
                                                if (cr == 0L)
                                                {
                                                    buf.WriteString(fmt.Sprintf("b%s", bit));
                                                }
                                                else
                                                {
                                                    buf.WriteString(fmt.Sprintf("b%s cr%d,", bit, cr));
                                                    sep = "";
                                                }

                                                break;

                                            case "12":
                                                bit = condBit[(bi - Cond0LT) % 4L];
                                                if (cr == 0L)
                                                {
                                                    buf.WriteString(fmt.Sprintf("b%s", bit));
                                                }
                                                else
                                                {
                                                    buf.WriteString(fmt.Sprintf("b%s cr%d,", bit, cr));
                                                    sep = "";
                                                }

                                                break;

                                            case "8":
                                                bit = condBit[(bi - Cond0LT) % 4L];
                                                sep = "";
                                                if (cr == 0L)
                                                {
                                                    buf.WriteString(fmt.Sprintf("bdnzt %s,", bit));
                                                }
                                                else
                                                {
                                                    buf.WriteString(fmt.Sprintf("bdnzt cr%d,%s,", cr, bit));
                                                }

                                                break;

                                            case "16":
                                                if (cr == 0L && bi == Cond0LT)
                                                {
                                                    buf.WriteString("bdnz");
                                                }
                                                else
                                                {
                                                    buf.WriteString(fmt.Sprintf("bdnz cr%d,", cr));
                                                    sep = "";
                                                }

                                                break;
                                            }
                                            startArg = 2L;
                                            break;

                                        default:
                                        {
                                            var bi = bi.type();
                                            fmt.Printf("Unexpected bi: %d for bc with bo: %s\n", bi, bo);
                                            break;
                                        }
                                        }
                                        startArg = 2L;
                                        break;

                                    case "mtspr":
                                        var opcode = inst.Op.String();
                                        buf.WriteString(opcode[0L..2L]);
Esempio n. 17
0
 public pkgBuffer(ref ptr <Package> pkg = default, bool printed = default, bytes.Buffer Buffer = default)
 {
     this.pkg         = pkg;
     this.printed     = printed;
     this.m_BufferRef = new ptr <bytes.Buffer>(Buffer);
 }
Esempio n. 18
0
 public exporter(ref ptr <token.FileSet> fset = default, bytes.Buffer @out = default, map <@string, long> strIndex = default, map <ptr <types.Package>, long> pkgIndex = default, map <types.Type, long> typIndex = default, bool posInfoFormat = default, @string prevFile = default, long prevLine = default, long written = default, long indent = default)
 {
     this.fset          = fset;
     this.@out          = @out;
     this.strIndex      = strIndex;
     this.pkgIndex      = pkgIndex;
     this.typIndex      = typIndex;
     this.posInfoFormat = posInfoFormat;
     this.prevFile      = prevFile;
     this.prevLine      = prevLine;
     this.written       = written;
     this.indent        = indent;
 }
Esempio n. 19
0
 public encodeState(bytes.Buffer Buffer = default, array <byte> scratch = default, ulong ptrLevel = default)
 {
     this.m_BufferRef = new ptr <bytes.Buffer>(Buffer);
     this.scratch     = scratch;
     this.ptrLevel    = ptrLevel;
 }