summary refs log tree commit diff stats
path: root/data/apps.rb
blob: 1a9b65d05a8579c89769ef737904073ec97a671b (plain) (blame)
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
module Application
	def mplayer(rc)
		check rc

		rc.base_flags = 'd'

#		if rc.no_mode?
#			rc.mode = (rc.name =~ /720p/) ? 2 : 1
#		end

		case rc.mode
		when 0; "mplayer -fs -sid 0 #{~rc}"
		when 1; "mplayer -sid 0 #{~rc}"
		when 2; "mplayer -vm sdl -sid 0 #{~rc}"
		else nil end
	end

	def evince(rc)
		check rc
		"evince #{~rc}"
	end

	def feh(rc)
		check rc
		case rc.mode
		when 0; "feh #{~rc}"
		when 1; "feh --bg-scale #{rc.one}"
		when 2; "feh --bg-tile #{rc.one}"
		when 3; "feh --bg-center #{rc.one}"
		when 4; "gimp #{~rc}"
		when 5; "feh -F #{~rc}"
		else nil end
	end

	def interpreted_language(rc)
		check rc
		case rc.mode
		when 1; rc.first.executable? ? "#{rc.one}" : nil
		when 0; vi(rc)
		else nil end
	end

	def zsnes(rc)
		check rc
		"zsnes #{~rc.first}"
	end

	def vi(rc)
		commands = [
			'map h :quit<cr>',
			'map q h',
			'map H :unmap h<CR>:unmap H<CR>:unmap q<CR>',
		].map {|x| "+'#{x}'"}.join(' ')

		"vi #{commands} #{~rc}"
	end

	def javac(rc)
		"javac #{~rc}"
	end

	def java(rc)
		"java #{rc.files.map{|x| ~x.before_last('.')}.join(' ')}"
	end

	def firefox(rc)
		"firefox #{~rc}"
	end

	def make(rc)
		case rc.mode
		when 0; "make"
		when 1; "make install"
		when 2; "make clear"
		else nil end
	end
	
	def rake(rc)
		"rake"
	end
end
lt;vc@akkartik.com> 2020-07-10 23:41:34 -0700 committer Kartik Agaram <vc@akkartik.com> 2020-07-10 23:41:34 -0700 6630 - define type signatures for SubX functions' href='/akkartik/mu/commit/400.mu?h=hlt&id=c5a3f65502d6931a5fb888a5c5327c0659578a57'>c5a3f655 ^
cec5ef31 ^
c5a3f655 ^
b8d613e7 ^
1a1a1671 ^
91dc5814 ^


1a1a1671 ^
c5a3f655 ^
91dc5814 ^




01b72aa0 ^

91dc5814 ^

01b72aa0 ^
e2b55208 ^
01b72aa0 ^

e2b55208 ^
91dc5814 ^


c5a3f655 ^
eea6659a ^
c5a3f655 ^
86a12476 ^
1a1a1671 ^
91dc5814 ^
eea6659a ^


b625c630 ^

ef73cb78 ^



91dc5814 ^

71418907 ^

91dc5814 ^

5462619d ^
c79b93ca ^
307745bc ^
71e4f381 ^


a43bd859 ^
6f65b65f ^

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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

                                                   


                                                                                                                                                                                     

                                                            
                                          
                                                              
 


                               

                                                
 
      

                                                                               
 


                                              


                                   
                                    
 

                                                                                            
                                                                                                 
 


                    
                                                      


                                  
                              
                   
                            
 


                                 
         

                                    
                                                                                    
                                                                                      
                                                                                          
                                                                                                  
                                                                                         
                                                                                                    
                                                     



                                                                                       
                                                             
                                                                       
                                                  
                                                  
                                                                                                          
                                            
                                                                                                              
                                                 
                                                                 
                                               


                                                                            
                                        
                                                  




                                                                                

                                                                                

                                                                  
                                                        
                                                                                                       

                                                                                                  
                                           


                                                                                 
                                                        
                
                                                                                                     
                                                       
                                                
                                               


                                                       

                                                                                                   



                                                                   

                                                      

                                                                           

                                                     
 
                                                           
                                                                         


                                                                                  
                                                                                              

                                                           
# screen
sig pixel-on-real-screen x: int, y: int, color: int
sig draw-grapheme-on-real-screen g: grapheme, x: int, y: int, color: int, background-color: int -> _/eax: int
sig draw-grapheme-on-screen-array screen-data: (addr array byte), g: grapheme, x: int, y: int, color: int, background-color: int, screen-width: int, screen-height: int -> _/eax: int
sig wide-grapheme? g: grapheme -> _/eax: boolean
sig cursor-position-on-real-screen -> _/eax: int, _/ecx: int
sig set-cursor-position-on-real-screen x: int, y: int
sig draw-cursor-on-real-screen g: grapheme
sig color-rgb color: int -> _/ecx: int, _/edx: int, _/ebx: int

# timer
sig timer-counter -> _/eax: int

# keyboard
sig read-key kbd: (addr keyboard) -> _/eax: byte

# disk
sig read-ata-disk disk: (addr disk), lba: int, n: int, out: (addr stream byte)
sig write-ata-disk disk: (addr disk), lba: int, n: int, out: (addr stream byte)

# mouse
sig read-mouse-event -> _/eax: int, _/ecx: int

# tests
sig count-test-failure
sig num-test-failures -> _/eax: int
sig running-tests? -> _/eax: boolean

sig string-equal? s: (addr array byte), benchmark: (addr array byte) -> _/eax: boolean
sig string-starts-with? s: (addr array byte), benchmark: (addr array byte) -> _/eax: boolean
sig check-strings-equal s: (addr array byte), expected: (addr array byte), msg: (addr array byte)

# debugging
sig check-stack
sig show-stack-state
sig debug-print x: (addr array byte), fg: int, bg: int
sig debug-print? -> _/eax: boolean
sig turn-on-debug-print
sig turn-off-debug-print
sig abort e: (addr array byte)
sig dump-call-stack
sig heap-bound -> _/eax: int

sig count-event
sig count-of-events -> _/eax: int

# streams
sig clear-stream f: (addr stream _)
sig rewind-stream f: (addr stream _)
sig stream-data-equal? f: (addr stream byte), s: (addr array byte) -> _/eax: boolean
sig streams-data-equal? a: (addr stream byte), b: (addr stream byte) -> _/eax: boolean
sig check-stream-equal f: (addr stream byte), s: (addr array byte), msg: (addr array byte)
sig check-streams-data-equal s: (addr stream _), expected: (addr stream _), msg: (addr array byte)
sig next-stream-line-equal? f: (addr stream byte), s: (addr array byte) -> _/eax: boolean
sig check-next-stream-line-equal f: (addr stream byte), s: (addr array byte), msg: (addr array byte)
sig write f: (addr stream byte), s: (addr array byte)
sig try-write f: (addr stream byte), s: (addr array byte) -> _/eax: boolean
# probably a bad idea; I definitely want to discourage its use for streams of non-bytes
sig stream-size f: (addr stream byte) -> _/eax: int
sig space-remaining-in-stream f: (addr stream byte) -> _/eax: int
sig write-stream f: (addr stream byte), s: (addr stream byte)
sig write-stream-immutable f: (addr stream byte), s: (addr stream byte)
sig read-byte s: (addr stream byte) -> _/eax: byte
sig peek-byte s: (addr stream byte) -> _/eax: byte
sig append-byte f: (addr stream byte), n: int  # really just a byte, but I want to pass in literal numbers
#sig to-hex-char in/eax: int -> out/eax: int
sig append-byte-hex f: (addr stream byte), n: int  # really just a byte, but I want to pass in literal numbers
sig write-int32-hex f: (addr stream byte), n: int
sig write-int32-hex-bits f: (addr stream byte), n: int, bits: int
sig hex-int? in: (addr slice) -> _/eax: boolean
sig parse-hex-int in: (addr array byte) -> _/eax: int
sig parse-hex-int-from-slice in: (addr slice) -> _/eax: int
#sig parse-hex-int-helper start: (addr byte), end: (addr byte) -> _/eax: int
sig hex-digit? c: byte -> _/eax: boolean
#sig from-hex-char in/eax: byte -> out/eax: nibble
sig parse-decimal-int in: (addr array byte) -> _/eax: int
sig parse-decimal-int-from-slice in: (addr slice) -> _/eax: int
sig parse-decimal-int-from-stream in: (addr stream byte) -> _/eax: int
#sig parse-decimal-int-helper start: (addr byte), end: (addr byte) -> _/eax: int
sig decimal-size n: int -> _/eax: int
#sig allocate ad: (addr allocation-descriptor), n: int, out: (addr handle _)
#sig allocate-raw ad: (addr allocation-descriptor), n: int, out: (addr handle _)
sig lookup h: (handle _T) -> _/eax: (addr _T)
sig handle-equal? a: (handle _T), b: (handle _T) -> _/eax: boolean
sig copy-handle src: (handle _T), dest: (addr handle _T)
#sig allocate-region ad: (addr allocation-descriptor), n: int, out: (addr handle allocation-descriptor)
#sig allocate-array ad: (addr allocation-descriptor), n: int, out: (addr handle _)
sig copy-array ad: (addr allocation-descriptor), src: (addr array _T), out: (addr handle array _T)
#sig zero-out start: (addr byte), size: int
sig slice-empty? s: (addr slice) -> _/eax: boolean
sig slice-equal? s: (addr slice), p: (addr array byte) -> _/eax: boolean
sig slice-starts-with? s: (addr slice), head: (addr array byte) -> _/eax: boolean
sig write-slice out: (addr stream byte), s: (addr slice)
# bad name alert
sig slice-to-string ad: (addr allocation-descriptor), in: (addr slice), out: (addr handle array byte)
sig write-int32-decimal out: (addr stream byte), n: int
sig decimal-digit? c: grapheme -> _/eax: boolean
sig to-decimal-digit in: grapheme -> _/eax: int
# bad name alert
# next-word really tokenizes
# next-raw-word really reads whitespace-separated words
sig next-word line: (addr stream byte), out: (addr slice)  # merges '#' comments into a single word
sig next-raw-word line: (addr stream byte), out: (addr slice)  # does not merge '#' comments
sig skip-chars-matching in: (addr stream byte), delimiter: byte
sig skip-chars-matching-whitespace in: (addr stream byte)
sig skip-chars-not-matching in: (addr stream byte), delimiter: byte
sig skip-chars-not-matching-whitespace in: (addr stream byte)
sig stream-empty? s: (addr stream _) -> _/eax: boolean
sig stream-full? s: (addr stream _) -> _/eax: boolean
sig stream-to-array in: (addr stream _), out: (addr handle array _)
sig unquote-stream-to-array in: (addr stream _), out: (addr handle array _)
sig stream-first s: (addr stream byte) -> _/eax: byte
sig stream-final s: (addr stream byte) -> _/eax: byte

#sig copy-bytes src: (addr byte), dest: (addr byte), n: int
sig copy-array-object src: (addr array _), dest-ah: (addr handle array _)
sig array-equal? a: (addr array int), b: (addr array int) -> _/eax: boolean
sig parse-array-of-ints s: (addr array byte), out: (addr handle array int)
sig parse-array-of-decimal-ints s: (addr array byte), out: (addr handle array int)
sig check-array-equal a: (addr array int), expected: (addr array byte), msg: (addr array byte)

sig integer-divide a: int, b: int -> _/eax: int, _/edx: int