about summary refs log tree commit diff stats
path: root/config.arg.h
Commit message (Expand)AuthorAgeFilesLines
...
* personally I prefer 2px bordersAnselm R. Garbe2007-01-181-1/+1
* moved BORDERPX to config.*.hAnselm R. Garbe2007-01-171-0/+1
* s/444/555/g - enlightened selected backgroundAnselm R. Garbe2007-01-161-1/+1
* applied sanders patch of my configAnselm R. Garbe2007-01-161-3/+3
* implemented new color scheme accordingly to Sanders proposalAnselm R. Garbe2007-01-141-2/+2
* removed mode label stuffAnselm R. Garbe2007-01-141-1/+1
* nah the last change feels badAnselm R. Garbe2007-01-121-2/+2
* changed incnmaster shortcuts in config.arg.hAnselm R. Garbe2007-01-121-2/+2
* this looks better now ;)Anselm R. Garbe2007-01-111-7/+7
* switching to arabic tagsAnselm R. Garbe2007-01-111-3/+19
* implemented nmaster appearance in mode label (using %u)Anselm R. Garbe2007-01-081-1/+1
* changed status fgAnselm R. Garbe2007-01-081-1/+1
* using shorter tags, using mon instead of certAnselm R. Garbe2007-01-051-2/+2
* roman numerals suck badly, revertingAnselm R. Garbe2007-01-051-9/+1
* switching to roman tags, I need more tagsAnselm R. Garbe2007-01-051-1/+13
* I inc/decrease on the fly, feels betterAnselm R. Garbe2007-01-051-1/+1
* changed shortcuts to M-i and M-dAnselm R. Garbe2007-01-051-2/+2
* changed plus key to MODKEY-Shift-plus (US-layout restrictions ;)Anselm R. Garbe2007-01-051-1/+1
* I prefer two master windows by defaultAnselm R. Garbe2007-01-051-1/+1
* added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)Anselm R. Garbe2007-01-051-2/+2
* experimental version which allows master clients being increased/decreasedAnselm R. Garbe2007-01-051-0/+3
* switching bakc to my previous color favoritAnselm R. Garbe2007-01-041-3/+3
* using more thinkpad compliant colorsarg@mig292007-01-021-1/+1
* changed arg's color schemearg@mig292007-01-021-3/+3
* correctionsarg@mig292007-01-021-1/+1
* next version will contain updated copyright noticearg@mig292007-01-021-1/+1
* migrated arg's config.h to new dmenu command line optionsarg@mig292006-12-191-2/+2
* found compromise for fonts 2.6arg@mig292006-12-071-1/+1
* switching to uxterm again, I get kretze from this urxvt craparg@mig292006-12-071-1/+1
* making terminus more explicit a regular font (otherwise olique font might be ...arg@mig292006-12-051-1/+1
* darkening the fg colors somewhatarg@mig292006-12-011-2/+2
* removed viewall(), replaced with view(-1); added tag(-1) to tag a client with...arg@mig292006-11-301-1/+2
* returning to old Key structarg@mig292006-11-271-30/+29
* changing Key.func into Key.func[NFUNCS], this allows sequences execution of f...arg@mig292006-11-271-31/+32
* added togglefloat to hg tip (i consider this useful for some cases), using MO...arg@mig292006-11-271-0/+1
* using iso10646 explicitely in arg's config.harg@mig292006-11-211-1/+1
* nah reverting to my prev style, that's really the best 2.2arg@mig292006-11-181-6/+6
* applying aluminium style for arg's config.harg@mig292006-11-181-6/+6
* using a more blue-ish color...arg@mig292006-11-081-2/+2
* making the selected color more lightningarg@mig292006-11-081-1/+1
* renamed resizecol into resizemaster 2.1arg@mig292006-10-311-2/+2
* in a 1920x1200 setup 40 pixels of snap value are much better than 20arg@mig292006-10-301-1/+1
* added screen-border snapping in floating mode, feels quite wellarg@mig292006-10-301-0/+1
* stupid urxvt needs bg to highlight selections in a sane way, though that make...arg@mig292006-10-271-1/+1
* applied sander's config.*h nitpick patcharg@mig292006-10-261-4/+4
* forgot to use -tr, which actually prevents the ugly flicker (using xsetroot -...arg@mig292006-10-261-1/+1
* using MASTER 600 again, it is definately better, and using urxvtc for the mom...arg@mig292006-10-261-2/+2
* changing MASTER in config.arg.h from 600 to 550 per thousandarg@mig292006-10-261-1/+1
* my new 1920x1200 Z61p arrived, now I can use terminus in a sane way...arg@mig292006-10-261-1/+1
* using lsx instead of Jukka's shell constructAnselm R. Garbe2006-10-131-4/+3
aedf1ac'>e1792825 ^
e1792825 ^
e1792825 ^
bc643692 ^

e1792825 ^
7a2b4725 ^
bc643692 ^
e1792825 ^





7202d5b5 ^


e1792825 ^

e1792825 ^
7202d5b5 ^

1c404654 ^
e1792825 ^
1c404654 ^
bc643692 ^
37568004 ^
e1792825 ^
7202d5b5 ^

bc643692 ^
e1792825 ^
7202d5b5 ^
7a2b4725 ^
7202d5b5 ^
e1792825 ^
7a2b4725 ^
7202d5b5 ^
e1792825 ^
7a2b4725 ^
7202d5b5 ^
e1792825 ^
7202d5b5 ^






e1792825 ^

1c404654 ^

e1792825 ^
e1792825 ^







1c404654 ^
e1792825 ^
363be37f ^
e1792825 ^
1c404654 ^
e1792825 ^
363be37f ^
5b7a71b0 ^
e4630643 ^
e1792825 ^

1c404654 ^

e1792825 ^








1c404654 ^
e1792825 ^
363be37f ^
e1792825 ^
1c404654 ^
7202d5b5 ^



1c404654 ^
7202d5b5 ^
1c404654 ^
e4630643 ^



1c404654 ^
7202d5b5 ^



1c404654 ^
cfb142b9 ^
e1792825 ^

1066660e ^
e1792825 ^

1c404654 ^






7a2b4725 ^
e4630643 ^



7a2b4725 ^

e4630643 ^


7a2b4725 ^



5b7a71b0 ^
e4630643 ^
7a2b4725 ^
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239





                                                                                            
 
                                                
                       

                                            




                                       
                                                                               




                                             
                                                              

                                                
                                
                                                                                                           

                                                                         


                                                 
                                                                                        





                                             
                                                

                                                



                                                                                                                                                                                                                                    
                                            

                                                                                 




                                     
                    

                                        
                                             
                      
                               






                                        

                                                             


                                      
                    

                             
                                             






                                        
                             




                             

                                                                                                         











                                                                              
 
                                  
             

                                                                                       
   
                                                                                                     
                                             





                      


                              

 
          

                              
                              
                                             
                              
                               
                 
 

                                                                         
                        
                             
                                                                               
                                               
                              
                             
                                               
                              
                             
                                               
                              
                             






                                                                                      

                             

                                                                                   
 







                                                                                            
                              
                                        
                                                                                
                                                
                                     
                                                 
                                                                                                        
                                                             
                         

 

                                                                                  








                                                          
                             
                                        
                                                                              
                                                
                                    



                                                                         
                                                                   
                                                                                      
                                                                  



                                                                                                 
                                                                                                             



                                                   
                                                
                     

                                                           
                                                     

 






                                                             
                                     



                                                                                                   

                                                   


                                                                                                                                                        



                                                                                               
                                                               
                           
   
//: Continuations are a powerful primitive for constructing advanced kinds of
//: control *policies* like back-tracking. They're usually provided using a
//: primitive called 'call-cc': http://en.wikipedia.org/wiki/Call-with-current-continuation)
//: But in mu 'call-cc' is constructed out of a combination of two primitives:
//:   'current-continuation', which returns a continuation, and
//:   'continue-from', which takes a continuation to switch to.

//: todo: implement continuations in mu's memory
:(before "End Globals")
map<long long int, call_stack> Continuation;
long long int Next_continuation_id = 0;
:(before "End Setup")
Continuation.clear();
Next_continuation_id = 0;

:(before "End Mu Types Initialization")
type_ordinal continuation = Type_ordinal["continuation"] = Next_type_ordinal++;
Type[continuation].name = "continuation";

:(before "End Primitive Recipe Declarations")
CURRENT_CONTINUATION,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["current-continuation"] = CURRENT_CONTINUATION;
:(before "End Primitive Recipe Implementations")
case CURRENT_CONTINUATION: {
  // copy the current call stack
  Continuation[Next_continuation_id] = Current_routine->calls;  // deep copy because calls have no pointers
  // make sure calling the copy doesn't spawn the same continuation again
  ++Continuation[Next_continuation_id].front().running_step_index;
  products.resize(1);
  products.at(0).push_back(Next_continuation_id);
  ++Next_continuation_id;
  trace("current-continuation") << "new continuation " << Next_continuation_id << end();
  break;
}

:(before "End Primitive Recipe Declarations")
CONTINUE_FROM,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["continue-from"] = CONTINUE_FROM;
:(before "End Primitive Recipe Implementations")
case CONTINUE_FROM: {
  if (!scalar(ingredients.at(0))) {
    raise << current_recipe_name() << ": first ingredient of 'continue-from' should be a continuation id generated by 'current-continuation', but got " << current_instruction().ingredients.at(0).original_string << '\n' << end();
    break;
  }
  long long int c = ingredients.at(0).at(0);
  Current_routine->calls = Continuation[c];  // deep copy; calls have no pointers
  continue;  // skip rest of this instruction
}

:(scenario continuation)
# simulate a loop using continuations
recipe main [
  1:number <- copy 0
  2:continuation <- current-continuation
  {
    3:boolean <- greater-or-equal 1:number, 3
    break-if 3:boolean
    1:number <- add 1:number, 1
    continue-from 2:continuation  # loop
  }
]
+mem: storing 1 in location 1
+mem: storing 2 in location 1
+mem: storing 3 in location 1
-mem: storing 4 in location 1
# ensure every iteration doesn't copy the stack over and over
$current-continuation: 1

:(scenario continuation_inside_caller)
recipe main [
  1:number <- copy 0
  2:continuation <- loop-body
  {
    3:boolean <- greater-or-equal 1:number, 3
    break-if 3:boolean
    continue-from 2:continuation  # loop
  }
]

recipe loop-body [
  4:continuation <- current-continuation
  1:number <- add 1:number, 1
]
+mem: storing 1 in location 1
+mem: storing 2 in location 1
+mem: storing 3 in location 1
-mem: storing 4 in location 1

//:: A variant of continuations is the 'delimited' continuation that can be called like any other recipe.
//:
//: In mu, this is constructed out of two primitives:
//:
//:  * 'create-delimited-continuation' lays down a mark on the call
//:    stack and calls the provided function (it is sometimes called 'prompt')
//:  * 'reply-current-continuation' copies the top of the stack until the
//:    mark, and returns it as the response of create-delimited-continuation
//:    (which might be a distant ancestor on the call stack; intervening calls
//:    don't return)
//:
//: The resulting slice of the stack can now be called just like a regular
//: function.

:(scenario delimited_continuation)
recipe main [
  1:continuation <- create-delimited-continuation f:recipe 12  # 12 is an argument to f
  2:number <- copy 5
  {
    2:number <- call 1:continuation, 2:number  # 2 is an argument to g, the 'top' of the continuation
    3:boolean <- greater-or-equal 2:number, 8
    break-if 3:boolean
    loop
  }
]

recipe f [
  11:number <- next-ingredient
  12:number <- g 11:number
  reply 12:number
]

recipe g [
  21:number <- next-ingredient
  rewind-ingredients
  reply-delimited-continuation
  # calls of the continuation start from here
  22:number <- next-ingredient
  23:number <- add 22:number, 1
  reply 23:number
]
# first call of 'g' executes the part before reply-delimited-continuation
+mem: storing 12 in location 21
+run: 2:number <- copy 5
+mem: storing 5 in location 2
# calls of the continuation execute the part after reply-delimited-continuation
+run: 2:number <- call 1:continuation, 2:number
+mem: storing 5 in location 22
+mem: storing 6 in location 2
+run: 2:number <- call 1:continuation, 2:number
+mem: storing 6 in location 22
+mem: storing 7 in location 2
+run: 2:number <- call 1:continuation, 2:number
+mem: storing 7 in location 22
+mem: storing 8 in location 2
# first call of 'g' does not execute the part after reply-delimited-continuation
-mem: storing 12 in location 22
# calls of the continuation don't execute the part before reply-delimited-continuation
-mem: storing 5 in location 21
-mem: storing 6 in location 21
-mem: storing 7 in location 21
# termination
-mem: storing 9 in location 2

//: 'create-delimited-continuation' is like 'call' except it adds a 'reset' mark to
//: the call stack

:(before "End call Fields")
bool is_reset;
:(before "End call Constructor")
is_reset = false;

//: like call, but mark the current call as a 'reset' call before pushing the next one on it

:(before "End Primitive Recipe Declarations")
CREATE_DELIMITED_CONTINUATION,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["create-delimited-continuation"] = CREATE_DELIMITED_CONTINUATION;
:(before "End Primitive Recipe Implementations")
case CREATE_DELIMITED_CONTINUATION: {
  Current_routine->calls.front().is_reset = true;
  Current_routine->calls.push_front(call(Recipe_ordinal[current_instruction().ingredients.at(0).name]));
  ingredients.erase(ingredients.begin());  // drop the callee
  goto call_housekeeping;
}

//: save the slice of current call stack until the 'create-delimited-continuation'
//: call, and return it as the result.
//: todo: implement delimited continuations in mu's memory
:(before "End Globals")
map<long long int, call_stack> Delimited_continuation;
long long int Next_delimited_continuation_id = 0;
:(before "End Setup")
Delimited_continuation.clear();
Next_delimited_continuation_id = 0;

:(before "End Primitive Recipe Declarations")
REPLY_DELIMITED_CONTINUATION,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["reply-delimited-continuation"] = REPLY_DELIMITED_CONTINUATION;
:(before "End Primitive Recipe Implementations")
case REPLY_DELIMITED_CONTINUATION: {
  // first clear any existing ingredients, to isolate the creation of the
  // continuation from its calls
  Current_routine->calls.front().ingredient_atoms.clear();
  Current_routine->calls.front().next_ingredient_to_process = 0;
  // copy the current call stack until the most recent 'reset' call
  call_stack::iterator find_reset(call_stack& c);  // manual prototype containing '::'
  call_stack::iterator reset = find_reset(Current_routine->calls);
  if (reset == Current_routine->calls.end()) {
    raise << current_recipe_name() << ": couldn't find a 'reset' call to jump out to\n" << end();
    break;
  }
  Delimited_continuation[Next_delimited_continuation_id] = call_stack(Current_routine->calls.begin(), reset);
  while (Current_routine->calls.begin() != reset) {
    --Callstack_depth;
    Current_routine->calls.pop_front();
  }
  // return it as the result of the 'reset' call
  products.resize(1);
  products.at(0).push_back(Next_delimited_continuation_id);
  ++Next_delimited_continuation_id;
  break;  // continue to process rest of 'reset' call
}

:(code)
call_stack::iterator find_reset(call_stack& c) {
  for (call_stack::iterator p = c.begin(); p != c.end(); ++p)
    if (p->is_reset) return p;
  return c.end();
}

//: overload 'call' for continuations
:(after "Begin Call")
  if (!current_instruction().ingredients.at(0).properties.empty()
      && !current_instruction().ingredients.at(0).properties.at(0).second.empty()
      && current_instruction().ingredients.at(0).properties.at(0).second.at(0) == "continuation") {
    // copy multiple calls on to current call stack
    assert(scalar(ingredients.at(0)));
    if (Delimited_continuation.find(ingredients.at(0).at(0)) == Delimited_continuation.end()) {
      raise << current_recipe_name() << ": no such delimited continuation " << current_instruction().ingredients.at(0).original_string << '\n' << end();
    }
    const call_stack& new_calls = Delimited_continuation[ingredients.at(0).at(0)];
    for (call_stack::const_reverse_iterator p = new_calls.rbegin(); p != new_calls.rend(); ++p)
      Current_routine->calls.push_front(*p);
    ++current_step_index();  // skip past the reply-delimited-continuation
    ingredients.erase(ingredients.begin());  // drop the callee
    goto call_housekeeping;
  }