about summary refs log tree commit diff stats
path: root/subx/028translate.cc
Commit message (Expand)AuthorAgeFilesLines
* switch to new syntax for segment headers in C++Kartik Agaram2019-05-181-4/+5
* 4987 - support `browse_trace` tool in SubXKartik Agaram2019-02-251-0/+3
* 4981 - no, go back to 3 phasesKartik Agaram2019-02-181-3/+4
* 4761Kartik Agaram2018-11-231-1/+1
* 4678Kartik Agaram2018-10-101-0/+2
* 4661Kartik Agaram2018-10-041-1/+1
* 4637 - subx: support multiple input filesKartik Agaram2018-10-011-1/+1
* 4624Kartik Agaram2018-09-301-11/+38
* 4620Kartik Agaram2018-09-301-1/+4
* 4551Kartik Agaram2018-09-201-0/+1
* 4532Kartik Agaram2018-09-011-28/+5
* 4531 - automatically compute segment addressesKartik Agaram2018-09-011-8/+32
* 4482Kartik Agaram2018-08-041-0/+159
#fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - 066stream.mu</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="none">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="minimal">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; }
body { font-family: monospace; color: #eeeeee; background-color: #080808; }
* { font-size: 1.05em; }
.Comment { color: #9090ff; }
.Constant { color: #00a0a0; }
.Special { color: #ff6060; }
.muControl { color: #c0a020; }
.muRecipe { color: #ff8700; }
-->
</style>

<script type='text/javascript'>
<!--

-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Comment"># new type to help incrementally read strings</span>
container stream [
  index:number
  data:address:array:character
]

<span class="muRecipe">recipe</span> new-stream [
  <span class="Constant">local-scope</span>
  result:address:stream<span class="Special"> &lt;- </span>new stream:type
  i:address:number<span class="Special"> &lt;- </span>get-address result:address:stream/deref, index:offset
  i:address:number/deref<span class="Special"> &lt;- </span>copy <span class="Constant">0:literal</span>
  d:address:address:array:character<span class="Special"> &lt;- </span>get-address result:address:stream/deref, data:offset
  d:address:address:array:character/deref<span class="Special"> &lt;- </span><span class="Constant">next-ingredient</span>
  <span class="muControl">reply</span> result:address:stream
]

<span class="muRecipe">recipe</span> rewind-stream [
  <span class="Constant">local-scope</span>
  in:address:stream<span class="Special"> &lt;- </span><span class="Constant">next-ingredient</span>
  x:address:number<span class="Special"> &lt;- </span>get-address in:address:stream/deref, index:offset
  x:address:number/deref<span class="Special"> &lt;- </span>copy <span class="Constant">0:literal</span>
  <span class="muControl">reply</span> in:address:stream/same-as-arg:0
]

<span class="muRecipe">recipe</span> read-line [
  <span class="Constant">local-scope</span>
  in:address:stream<span class="Special"> &lt;- </span><span class="Constant">next-ingredient</span>
  idx:address:number<span class="Special"> &lt;- </span>get-address in:address:stream/deref, index:offset
  s:address:array:character<span class="Special"> &lt;- </span>get in:address:stream/deref, data:offset
  next-idx:number<span class="Special"> &lt;- </span>find-next s:address:array:character, <span class="Constant">10:literal/newline</span>, idx:address:number/deref
  result:address:array:character<span class="Special"> &lt;- </span>string-copy s:address:array:character, idx:address:number/deref, next-idx:number
  idx:address:number/deref<span class="Special"> &lt;- </span>add next-idx:number, <span class="Constant">1:literal</span>  <span class="Comment"># skip newline</span>
  <span class="muControl">reply</span> result:address:array:character
]

<span class="muRecipe">recipe</span> end-of-stream? [
  <span class="Constant">local-scope</span>
  in:address:stream<span class="Special"> &lt;- </span><span class="Constant">next-ingredient</span>
  idx:number<span class="Special"> &lt;- </span>get in:address:stream/deref, index:offset
  s:address:array:character<span class="Special"> &lt;- </span>get in:address:stream/deref, data:offset
  len:number<span class="Special"> &lt;- </span>length s:address:array:character/deref
  result:boolean<span class="Special"> &lt;- </span>greater-or-equal idx:number, len:number
  <span class="muControl">reply</span> result:boolean
]
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->