Hi all,
I must have had too much time, as I have partly rewritten mcview. The patch is quite large and changes many things. However, I have tested it with all available types of data sources (see the code for explanation), and it seems to work.
http://www.roland-illig.de/tmp/viewer.patch
Here are the major improvements:
* Dropped mmap support.
* Don't load large files completely into memory.
* Grouped all variables that have to do with the data source management.
* Made every variable have only one purpose. (Before, you could never be sure what the view->data field contained, as it was used for keeping the error message as well as the mmapped file and the data of the non-mmapped file.)
* Provided a clean interface for the get_byte() function, as well as four different implementations of it.
* Added assertions to guarantee that the code is only used in situations where it is meant to be used.
* First steps to supporting 64-bit files. (Mainly through consistent use of the appropriate data types.)
Perhaps you may worry about the fact that my patch makes the file 119 lines longer, but I hope the code becomes more readable and maintainable.
Of course, there are many things that don't work yet or that can be improved. I will work on them, perhaps by first marking the relevant places with FIXMEs. Things that don't work nicely at the moment are:
* Initialization of a WView object. (I'd like to have a function that initializes _every_ field to a sensible default value; "constructor".)
* Destruction of a WView object. (The counterpart to the constructor. Cleans up the object and frees it.)
* Cursor movement in all display modes (textview, textwrap, hexview, hexedit, rawmode, nroffmode, ...) should be rewritten in cleaner code.
* Support for 64-bit files still needs much work.
Roland
_______________________________________________ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel