about summary refs log tree commit diff stats
path: root/subx/apps/dquotes.subx
diff options
context:
space:
mode:
Diffstat (limited to 'subx/apps/dquotes.subx')
-rw-r--r--subx/apps/dquotes.subx23
1 files changed, 15 insertions, 8 deletions
diff --git a/subx/apps/dquotes.subx b/subx/apps/dquotes.subx
index 5e80edce..b89e9eba 100644
--- a/subx/apps/dquotes.subx
+++ b/subx/apps/dquotes.subx
@@ -1270,6 +1270,7 @@ test-emit-string-literal-data-handles-escape-sequences:
 # emit everything from a word except the initial datum
 emit-metadata:  # out : (address buffered-file), word : (address slice)
     # pseudocode
+    #   var slice = {0, word->end}
     #   curr = word->start
     #   while true
     #     if curr == word->end
@@ -1277,7 +1278,9 @@ emit-metadata:  # out : (address buffered-file), word : (address slice)
     #     if *curr == '/'
     #       break
     #     ++curr
-    #   write-slice-buffered(out, slice{curr, word->end})
+    #   slice->curr = curr
+    #   write-slice-buffered(out, slice)
+    #
     # . prolog
     55/push-EBP
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
@@ -1285,20 +1288,22 @@ emit-metadata:  # out : (address buffered-file), word : (address slice)
     50/push-EAX
     51/push-ECX
     52/push-EDX
-    # ECX = word
-    8b/copy                         1/mod/*+disp8   5/rm32/EBP    .           .             .           1/r32/ECX   0xc/disp8       .                 # copy *(EBP+12) to ECX
-    # end/EDX = word->end
-    8b/copy                         1/mod/*+disp8   1/rm32/ECX    .           .             .           2/r32/EDX   4/disp8         .                 # copy *(ECX+4) to EDX
+    53/push-EBX
+    56/push-ESI
+    # ESI = word
+    8b/copy                         1/mod/*+disp8   5/rm32/EBP    .           .             .           6/r32/ESI   0xc/disp8       .                 # copy *(EBP+12) to ESI
     # curr/ECX = word->start
-    8b/copy                         0/mod/indirect  1/rm32/ECX    .           .             .           1/r32/ECX   .               .                 # copy *ECX to ECX
-    # clear out EAX
+    8b/copy                         0/mod/indirect  6/rm32/ESI    .           .             .           1/r32/ECX   .               .                 # copy *ESI to ECX
+    # end/EDX = word->end
+    8b/copy                         1/mod/*+disp8   6/rm32/ESI    .           .             .           2/r32/EDX   4/disp8         .                 # copy *(ESI+4) to EDX
+    # EAX = 0
     b8/copy-to-EAX  0/imm32
 $emit-metadata:skip-datum-loop:
     # if (curr == end) return
     39/compare                      3/mod/direct    1/rm32/ECX    .           .             .           2/r32/EDX   .               .                 # compare ECX and EDX
     74/jump-if-equal  $emit-metadata:end/disp8
     # if (*curr == '/') break
-    8a/copy-byte                    0/mod/indirect  1/rm32/ECX    .           .             .           0/r32/EAX   .               .                 # copy *ECX to EAX
+    8a/copy-byte                    0/mod/indirect  1/rm32/ECX    .           .             .           0/r32/AL    .               .                 # copy byte at *ECX to AL
     3d/compare-EAX-and  0x2f/imm32
     74/jump-if-equal  $emit-metadata:break/disp8
     # ++curr
@@ -1318,6 +1323,8 @@ $emit-metadata:break:
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           0x10/imm32      .                 # add to ESP
 $emit-metadata:end:
     # . restore registers
+    5e/pop-to-ESI
+    5b/pop-to-EBX
     5a/pop-to-EDX
     59/pop-to-ECX
     58/pop-to-EAX
-11-25 11:04:14 -0800 committer Kartik K. Agaram <vc@akkartik.com> 2016-11-25 11:04:41 -0800 3687' href='/akkartik/mu/commit/update_html?h=hlt&id=ccae45851f729ada29391e7497cf8e4c9796ff8c'>ccae4585 ^
f5465e12 ^


9a7e1a0f ^



f40b079c ^


9a7e1a0f ^





f40b079c ^
9a7e1a0f ^










201458e3 ^
97eb971b ^

8a92572d ^
9a7e1a0f ^









97eb971b ^
fdfe34de ^
9a7e1a0f ^
fdfe34de ^
9a7e1a0f ^

201458e3 ^


9a7e1a0f ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
           

                        

      
                               
           
                                                   


                                                

                                                                    


                                                                          
                                                                       



                                                                              

                                                                    

                                                                                                                          

                                                                                                                   
                                                                                           
                                                                                         
 





                                                                                           


                                 



                      


              





                                                                         
 










                                               
 

                       
                      









                                          
      
           
                                           
   

                                               


                


                      
#!/bin/bash
# Regenerate html files.

set -e

# convert a single file to html
process() {
  vim -c "set number" -c TOhtml -c write -c qall $1

  sed -i 's,<title>\~/mu/,<title>Mu - ,' $1.html
  sed -i 's,\.html</title>,</title>,' $1.html
  sed -i 's/^\* { \(.*\) }/* { font-size: 12pt; \1 }/g' $1.html
  sed -i 's/^body { \(.*\) }/body { font-size: 12pt; \1 }/g' $1.html
  # turn most code grey
  sed -i 's/#eeeeee/#aaaaaa/g' $1.html
  # ..so that we can use white for cross-links (underlining only on hover)
  sed -i '/^body {/ a  a:hover { text-decoration: underline; }' $1.html
  sed -i '/^body {/ a  a { color:#eeeeee; text-decoration: none; }' $1.html
  # line numbers are darker still
  sed -i 's/^\.LineNr .*/.LineNr { color: #444444; }/' $1.html  # line numbers
  # tweak contrast for remaining colors
  sed -i 's/^\.Constant .*/.Constant { color: #00a0a0; }/' $1.html
  sed -i 's/^\.muControl .*/.muControl { color: #c0a020; }/' $1.html
  # real links in comments continue to be the usual blue
  sed -i 's/^\.Comment .*/.Comment { color: #9090ff; }\n.Comment a { color:#0000ee; text-decoration:underline; }/' $1.html
  sed -i 's/^\.Delimiter .*/.Delimiter { color: #800080; }/' $1.html  # not meant to be read; can be lower-contrast
  sed -i 's/^\.PreProc .*/.PreProc { color: #800080; }/' $1.html  # not meant to be read; can be lower-contrast
  sed -i 's/^\.Identifier .*/.Identifier { color: #c0a020; }/' $1.html  # same as muControl
  sed -i 's/^\.Special .*/.Special { color: #c00000; }/' $1.html  # same as traceAbsent..

  # switch unicode characters around in the rendered html
  #   the ones we have in the source files render double-wide in html
  #   the ones we want in the html cause iTerm2 to slow down in alt-tabbing for some reason
  # the following commands give us the best of both worlds
  sed -i -e 's/┈/╌/g' -e 's/┊/╎/g' $1.html

  mv -i $1.html html/`dirname $1`
}

( cd linkify; build; )

  rm html/*.cc.html
  for f in *.cc
  do
    process $f
  done
  ctags -x *.cc  |grep -v "^operator \| member \| variable "  > /tmp/tags
  linkify/linkify /tmp/tags html/*.cc.html
  for f in html/*.cc.html
  do
    mv $f.out $f
  done

  rm html/[0-9]*.mu.html
  for f in [0-9]*.mu
  do
    process $f
  done
  ctags -x [0-9]*.mu  > /tmp/tags
  linkify/linkify /tmp/tags html/[0-9]*.mu.html
  for f in html/[0-9]*.mu.html
  do
    mv $f.out $f
  done

  for f in [a-zA-Z]*.mu
  do
    rm -f html/$f.html
    process $f
    ctags -x [0-9]*.mu $f  > /tmp/tags
    linkify/linkify /tmp/tags html/$f.html
    mv html/$f.html.out html/$f.html
  done

  rm html/edit/*.html
  for f in edit/*.mu
  do
    process $f
  done
  ( cd edit
    ctags -x ../[0-9]*.mu *.mu  > /tmp/tags
  )
  linkify/linkify /tmp/tags html/edit/*.mu.html
  for f in html/edit/*.mu.html
  do
    mv $f.out $f
  done

rm /tmp/tags
( cd linkify; clean; )