about summary refs log tree commit diff stats
Commit message (Expand)AuthorAgeFilesLines
* test: add js & layout testsbptato2024-04-2187-2/+1457
* layout: do not use parent computed values in root fragmentbptato2024-04-211-19/+11
* dom: fix property event handler settersbptato2024-04-212-23/+52
* js: fix some incorrect defineProperty usagebptato2024-04-214-7/+7
* js: override default toString tag of globalbptato2024-04-211-1/+5
* base64: rewrite btoa toobptato2024-04-212-5/+41
* base64: rewrite atobbptato2024-04-211-6/+65
* layout: slightly refactor layoutInlinebptato2024-04-211-40/+42
* layout: flex item margin fixesbptato2024-04-201-25/+34
* layout: fix double padding in flexbptato2024-04-201-2/+4
* dom: sort attributesbptato2024-04-201-21/+30
* buffer: fix switch from charset decoder to UTF-8 validatorbptato2024-04-201-1/+3
* dom: add isSameNode, isEqualNodebptato2024-04-201-0/+54
* sandbox: allow syscalls for epoll Nim selectorsbptato2024-04-201-0/+4
* layout: fix a list style positioning bugbptato2024-04-201-2/+2
* layout: float sizing fixesbptato2024-04-191-8/+21
* http: fix sandbox violation in readFromStdinbptato2024-04-192-3/+5
* twtstr: remove pointless checks in parseIntImplbptato2024-04-191-5/+3
* url, twtstr: correct number parsingbptato2024-04-185-68/+75
* sandbox: seccomp support on Linuxbptato2024-04-1814-50/+302
* layout: accept inline-flex in iflushbptato2024-04-171-1/+1
* strwidth: return alpha for underscore in vi wordsbptato2024-04-171-1/+1
* Update code stylebptato2024-04-1777-2689/+2821
* term: save/restore title after "set title"bptato2024-04-161-2/+12
* url: fix flipped comparisonbptato2024-04-161-1/+1
* layout: fix list-item positioningbptato2024-04-162-3/+12
* url: refactorbptato2024-04-161-186/+187
* js: remove automatic function -> closure conversionbptato2024-04-159-107/+75
* Update todobptato2024-04-151-18/+17
* layout: remove ListItemBox, handle inline-flex correctlybptato2024-04-153-91/+65
* quickjs: fix member accesses for non-decimal number literalsbptato2024-04-141-1/+2
* dom: use pointers instead of numerical ids for collectionsbptato2024-04-141-10/+9
* dom: add onclick attribute supportbptato2024-04-144-53/+112
* Fix endianness handling in `js_dataview_getValue` / `js_dataview_setValue`Charlie Gordon2024-04-141-8/+8
* Improve error handlingCharlie Gordon2024-04-141-8/+17
* Improve `JSON.stringify`Charlie Gordon2024-04-141-39/+43
* Use more explicit magic values for array methodsCharlie Gordon2024-04-141-26/+24
* Simplify redundant initializers for `JS_NewBool()`Charlie Gordon2024-04-141-18/+17
* Fix compilation with -DCONFIG_BIGNUMCharlie Gordon2024-04-142-32/+43
* Improve Date.parse, small fixesCharlie Gordon2024-04-143-58/+81
* Revert bignum build fixesbptato2024-04-142-10/+0
* utils: polyfill addr/unsafeAddr distinction in Nim 2+bptato2024-04-142-0/+19
* layout: height fixesbptato2024-04-121-41/+22
* Update readmebptato2024-04-121-5/+27
* bind_unix, connect_unix: add string.h includebptato2024-04-122-0/+2
* dom: fix missing attribute reflection for <button>bptato2024-04-111-0/+1
* renderdocument: do not layout with styledRoot == nilbptato2024-04-111-1/+4
* twtstr: remove isAscii, simplify onlyWhitespacebptato2024-04-102-12/+3
* url: use AsciiDigit, not Digitsbptato2024-04-101-5/+5
* twtstr: remove pointless lookup tablesbptato2024-04-101-18/+10
ame.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 */
# Playing with emitting cool textures.
#
# To run (on Linux):
#   $ git clone https://github.com/akkartik/mu
#   $ cd mu
#   $ ./translate texture.mu
#   $ ./a.elf > a.ppm

fn main -> _/ebx: int {
#?   var width/esi: int <- copy 0x190  # 400
#?   var height/edi: int <- copy 0xe1  # 225; aspect ratio 16:9
  var width/esi: int <- copy 0xff
  var height/edi: int <- copy 0xff
  print-string 0/screen, "P3\n"
  print-int32-decimal 0/screen, width
  print-string 0/screen, " "
  print-int32-decimal 0/screen, height
  print-string 0/screen, "\n"
  print-string 0/screen, "255\n"  # color depth
  var row/ecx: int <- copy 0
  {
    compare row, height
    break-if->=
    var col/edx: int <- copy 0
    {
      compare col, width
      break-if->=
      # r
      var tmp/eax: int <- copy col
      tmp <- multiply row
      tmp <- and 0x7f
      tmp <- add 0x80
      tmp <- copy 0xff
      print-int32-decimal 0/screen, tmp
      print-string 0/screen, " "
      # g
      tmp <- copy row
      tmp <- multiply col
      tmp <- and 0x7f
      tmp <- add 0x80
#?       tmp <- copy 0xcf
      print-int32-decimal 0/screen, tmp
      print-string 0/screen, " "
      # b
      tmp <- copy row
      tmp <- multiply col
      tmp <- and 0x7f
      tmp <- add 0x80
      print-int32-decimal 0/screen, tmp
      print-string 0/screen, "\n"
      col <- increment
      loop
    }
    row <- increment
    loop
  }
  return 0
}