summary refs log tree commit diff stats
path: root/ranger/gui
Commit message (Collapse)AuthorAgeFilesLines
...
* keybuffer was made aware of prefixed numbershut2009-12-232-3/+8
|
* added primitive "throbber"hut2009-12-231-0/+3
|
* fixed / improved loaderhut2009-12-232-1/+2
|
* some clean upshut2009-12-224-6/+6
|
* (half-assed) implementation of parallel directory loaderhut2009-12-222-18/+33
|
* improved auto-previewshut2009-12-222-2/+20
|
* improved titlebar, shrinks if its too largehut2009-12-201-20/+169
|
* Added option for autoloading previews.hut2009-12-201-5/+11
| | | | If it is false, you have to enter the directory once to see a preview
* postpone directory previews if not loaded yethut2009-12-202-3/+19
|
* notification widgethut2009-12-184-4/+97
|
* UI.redraw now redraws widgets. old redraw is now redraw_windowhut2009-12-181-1/+7
|
* re-indented docstringshut2009-12-175-19/+27
|
* added history to consolehut2009-12-171-16/+45
|
* tons of stuffhut2009-12-172-12/+43
|
* fixed CD command / tab completionhut2009-12-151-12/+5
|
* Added console commands + tab completionhut2009-12-152-6/+62
|
* fine tuninghut2009-12-151-97/+105
|
* turned different console types into seperate subclasseshut2009-12-151-36/+46
|
* updated umlhut2009-12-151-1/+3
|
* cleanups, display link destinationshut2009-12-153-19/+45
|
* different way of squeezing the last columnhut2009-12-151-4/+14
|
* implemented statusbar widgethut2009-12-143-2/+150
|
* added an option for collapse_previewhut2009-12-141-1/+1
|
* "poke" widgets, expand last column if there's no previewhut2009-12-143-9/+55
|
* updated / added testshut2009-12-133-16/+36
|
* clean ups, commentshut2009-12-132-10/+17
|
* added docstrings everywherehut2009-12-135-28/+46
|
* fixed issues with scrolling/invalid mouse bstateshut2009-12-132-3/+13
|
* implemented FileListContainerhut2009-12-128-52/+105
|
* clean ups/fixeshut2009-12-122-16/+27
|
* clean upshut2009-12-112-7/+2
|
* Reorganization of gui/widget hierarchy and directory structurehut2009-12-1110-225/+318
|
* restructurationshut2009-12-112-5/+5
|
* moved commands from fm.py to actions.py, cleanupshut2009-12-111-5/+9
|
* Restructurationhut2009-12-106-14/+27
|
* random stuffhut2009-12-061-0/+1
|
* "SettingsAware", random cleanupshut2009-12-065-16/+17
|
* changing implementation of optionshut2009-12-062-3/+25
|
* implemented searchinghut2009-12-041-1/+9
|
* "openwith_quick" console mode addedhut2009-12-042-17/+143
|
* mime type support, integrated into colorschemeshut2009-12-032-1/+2
|
* implemented a console (without commands)hut2009-12-024-33/+165
|
* reduce ESCDELAYhut2009-12-021-0/+4
|
* fixed non-accessible directorieshut2009-12-022-7/+7
|
* scrollinghut2009-12-013-0/+29
|
* renamed api to helperhut2009-12-011-1/+1
| | | | since it had nothing to do with an api
* structural improvementshut2009-12-011-5/+6
|
* mouse supporthut2009-11-295-10/+77
|
* random improvementshut2009-11-293-7/+34
|
* implemented colorschemes.hut2009-11-295-73/+106
|
137'>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




                                                                            
       
                               
                                                                                 




                       


                                     













                                                                                            


                                                            


                                                                           








                                                                                           









                                                                                     
                              






                                                                                         

 

                                        
                               
       
                                      

                                    









                       
 


















                                                       

                           




                                            
                                                                    


                                                                                        
                          
                                                                 
                                                                                                             

                              
                                                                                                                     

   










                                           

                                              

             
 


                                                                            

                                             




                                      













                                                                                
//: Start allowing us to not specify precise addresses for the start of each
//: segment.
//: This gives up a measure of control in placing code and data.

:(scenario segment_name)
== code
05/add-to-EAX  0x0d0c0b0a/imm32
# code starts at 0x08048000 + p_offset, which is 0x54 for a single-segment binary
+load: 0x09000054 -> 05
+load: 0x09000055 -> 0a
+load: 0x09000056 -> 0b
+load: 0x09000057 -> 0c
+load: 0x09000058 -> 0d
+run: add imm32 0x0d0c0b0a to reg EAX
+run: storing 0x0d0c0b0a

//: Update the parser to handle non-numeric segment name.
//:
//: We'll also support repeated segments with non-numeric names.
//: When we encounter a new reference to an existing segment we'll *prepend*
//: the new data to existing data for the segment.

:(before "End Globals")
map</*name*/string, int> Segment_index;
bool Currently_parsing_named_segment = false;  // global to permit cross-layer communication
int Currently_parsing_segment_index = -1;  // global to permit cross-layer communication
:(before "End Reset")
Segment_index.clear();
Currently_parsing_named_segment = false;
Currently_parsing_segment_index = -1;

:(before "End Segment Parsing Special-cases(segment_title)")
if (!starts_with(segment_title, "0x")) {
  Currently_parsing_named_segment = true;
  if (!contains_key(Segment_index, segment_title)) {
    trace(99, "parse") << "new segment '" << segment_title << "'" << end();
    if (out.segments.empty() && segment_title != "code") {
      raise << "first segment must be 'code' but is '" << segment_title << "'\n" << end();
      return;
    }
    if (SIZE(out.segments) == 1 && segment_title != "data") {
      raise << "second segment must be 'data' but is '" << segment_title << "'\n" << end();
      return;
    }
    put(Segment_index, segment_title, SIZE(out.segments));
    out.segments.push_back(segment());
  }
  else {
    trace(99, "parse") << "prepending to segment '" << segment_title << "'" << end();
  }
  Currently_parsing_segment_index = get(Segment_index, segment_title);
}

:(before "End flush(p, lines) Special-cases")
if (Currently_parsing_named_segment) {
  assert(!p.segments.empty());
  trace(99, "parse") << "flushing to segment" << end();
  vector<line>& curr_segment_data = p.segments.at(Currently_parsing_segment_index).lines;
  curr_segment_data.insert(curr_segment_data.begin(), lines.begin(), lines.end());
  lines.clear();
  Currently_parsing_named_segment = false;
  Currently_parsing_segment_index = -1;
  return;
}

:(scenario repeated_segment_merges_data)
== code
05/add-to-EAX  0x0d0c0b0a/imm32
== code
2d/subtract-from-EAX  0xddccbbaa/imm32
+parse: new segment 'code'
+parse: prepending to segment 'code'
+load: 0x09000054 -> 2d
+load: 0x09000055 -> aa
+load: 0x09000056 -> bb
+load: 0x09000057 -> cc
+load: 0x09000058 -> dd
+load: 0x09000059 -> 05
+load: 0x0900005a -> 0a
+load: 0x0900005b -> 0b
+load: 0x0900005c -> 0c
+load: 0x0900005d -> 0d

:(scenario error_on_missing_segment_header)
% Hide_errors = true;
05/add-to-EAX 0/imm32
+error: input does not start with a '==' section header

:(scenario error_on_first_segment_not_code)
% Hide_errors = true;
== data
05 00 00 00 00
+error: first segment must be 'code' but is 'data'

:(scenario error_on_second_segment_not_data)
% Hide_errors = true;
== code
05/add-to-EAX 0/imm32
== bss
05 00 00 00 00
+error: second segment must be 'data' but is 'bss'

//: compute segment address

:(before "End Level-2 Transforms")
Transform.push_back(compute_segment_starts);

:(code)
void compute_segment_starts(program& p) {
  trace(99, "transform") << "-- compute segment addresses" << end();
  uint32_t p_offset = /*size of ehdr*/0x34 + SIZE(p.segments)*0x20/*size of each phdr*/;
  for (size_t i = 0;  i < p.segments.size();  ++i) {
    segment& curr = p.segments.at(i);
    if (curr.start == 0) {
      curr.start = CODE_SEGMENT + i*SPACE_FOR_SEGMENT + p_offset;
      trace(99, "transform") << "segment " << i << " begins at address 0x" << HEXWORD << curr.start << end();
    }
    p_offset += size_of(curr);
    assert(p_offset < SEGMENT_ALIGNMENT);  // for now we get less and less available space in each successive segment
  }
}

uint32_t size_of(const segment& s) {
  uint32_t sum = 0;
  for (int i = 0;  i < SIZE(s.lines);  ++i)
    sum += num_bytes(s.lines.at(i));
  return sum;
}

// Assumes all bitfields are packed.
uint32_t num_bytes(const line& inst) {
  uint32_t sum = 0;
  for (int i = 0;  i < SIZE(inst.words);  ++i)
    sum += size_of(inst.words.at(i));
  return sum;
}

int size_of(const word& w) {
  if (has_operand_metadata(w, "disp32") || has_operand_metadata(w, "imm32"))
    return 4;
  else if (has_operand_metadata(w, "disp16"))
    return 2;
  // End size_of(word w) Special-cases
  else
    return 1;
}

//: Dependencies:
//: - We'd like to compute segment addresses before setting up global variables,
//:   because computing addresses for global variables requires knowing where
//:   the data segment starts.
//: - We'd like to finish expanding labels before computing segment addresses,
//:   because it would make computing the sizes of segments more self-contained
//:   (num_bytes).
//:
//: Decision: compute segment addresses before expanding labels, by being
//: aware in this layer of certain operand types that will eventually occupy
//: multiple bytes.
//:
//: The layer to expand labels later hooks into num_bytes() to teach this
//: layer that labels occupy zero space in the binary.