On my daily commute to my office, my only companion are the various FM radio channels. Most of them were hyping the World Tobacco Day on the 31st of May which included how much a person would have spent if he smokes a few packets to the various health issues. All this was nice until on that same day, where there were a few ads on the same channels sponsored from a tobacco company enticing listeners on their new offerings! Oh what irony!
Inside a Text Editor Ever since my college days, after dabbling with vi and a few other editors, I always had an yearning to create my own. Now, I am still stuck with XEmacs and jEdit and had a chance to compile / study the sources and documentation of EMACS and a free editor component called Scintilla. Until now, I was under the the belief that text editors used a doubly linked list to represent the text in memory. The advantages of this approach being insertions and deletions are much more easier which is just a matter of just un-linking a node off the list. But the shortcomming is that they tend to fragment memory with each node or line take a bit of memory. The other alternative approach is to have a dynamic array which is a contiguous space of memory and can sometimes be directly written off to a file. The disadvantages are that insertion and deletion are costly and you need to reallocate quite frequently. While goint throug the source and documentation of text editors, I chanced ...
Comments