about summary refs log blame commit diff stats
path: root/linux/408float.mu
blob: d1c0483634780804dee1f297912ffb3448527b69 (plain) (tree)






















                                                          
# Some quick-n-dirty ways to create floats.

fn fill-in-rational _out: (addr float), nr: int, dr: int {
  var out/edi: (addr float) <- copy _out
  var result/xmm0: float <- convert nr
  var divisor/xmm1: float <- convert dr
  result <- divide divisor
  copy-to *out, result
}

fn fill-in-sqrt _out: (addr float), n: int {
  var out/edi: (addr float) <- copy _out
  var result/xmm0: float <- convert n
  result <- square-root result
  copy-to *out, result
}

fn rational nr: int, dr: int -> _/xmm0: float {
  var result/xmm0: float <- convert nr
  var divisor/xmm1: float <- convert dr
  result <- divide divisor
  return result
}
='#n67'>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



























                                                          

                                            



                                             
                                                         
                                                                                



                                            
                                                                     
 





                                                    












                                               

                                               
                                                
                                                 
                                                 
                                                    


                                                      
 









                                            



                                               







                                               
                                   
from ranger.gui.colorscheme import ColorScheme
from ranger.gui.color import *

class Default(ColorScheme):
	def use(self, context):
		fg, bg, attr = default_colors

		if context.reset:
			pass

		elif context.in_display:
			if context.selected:
				attr = reverse
			else:
				attr = normal

			if context.empty or context.error:
				bg = red

			if context.media:
				if context.image:
					fg = yellow
				else:
					fg = magenta

			if context.container:
				fg = red

#			if context.document:
#				fg = default

			if context.directory:
				fg = blue

			elif context.executable and not \
					any((context.media, context.container)):
				attr |= bold
				fg = green

			if context.link:
				fg = context.good and cyan or magenta

			if context.maindisplay:
				if context.selected:
					attr |= bold
				if context.marked:
					attr |= bold
					fg = yellow

		elif context.in_titlebar:
			attr |= bold

			if context.hostname:
				fg = green

			elif context.directory:
				fg = blue

			elif context.link:
				fg = cyan

		elif context.in_statusbar:
			if context.permissions:
				if context.good:
					fg = cyan
				elif context.bad:
					fg = magenta
			if context.marked:
				attr |= bold | reverse
				fg = yellow

		elif context.in_notify:
			attr |= reverse
#			if context.good:
#				bg = cyan
#			else:
#				bg = red
#			if context.message:
#				attr |= bold
#				fg = white

		if context.text:
			if context.highlight:
				attr |= reverse

		if context.in_pman:
			if context.title:
				attr |= reverse
				fg = cyan

			if context.selected:
				attr |= reverse

		return fg, bg, attr