170 likes | 289 Vues
Editor Buffers. Eric Roberts CS 106B April 29, 2009. Contest Results. The CS106B Random Writer Contest April 2009.
E N D
Editor Buffers Eric Roberts CS 106B April 29, 2009
Contest Results The CS106B Random Writer Contest April 2009
“Which I had therefore I hope that begins with those of the understanding, and so. Each problem that it is not only objects of desiring more evil. The only prudent never to sensibility, on which man is God’s will discover that all other purpose.” —Rene Descartes / Immanuel Kant “People die, Andrew Luck would be our starter. If we should donate his face to add depth, I feel we have to have college football needs Stanford. It’s just want. I said it up. He missed two black men beat each other at school.” —Mohammed Ali / Jim Harbaugh “People will be funny if you’re tools of atomic energy has, arts and ignorance, albeit a lot of that by their user. Not everything that’s insecurity before himself and how to Washington and over and very persistent one without any of science is more complex, we are you running scared all the world is not giving the exciting things bigger or axioms.” —Bill Nye / Albert Einstein Runner-Up #1
“Taxes on it’s simple. It asks too little of Americans. Today we can recognize it. One thing I can promise of thinking is raise your taxes, a winner back in the state of mistakes, and tears to have just as I am opposed to be successful, eventually you know my hand and you happy.” —Barack Obama / Arnold Schwarzenegger “People who fawn over you, all chains from other parts, everything else is always like being seven ages everywhere in the idea of sterner stuff. Our most peaceable way for each of Disneyland will never taste of love Mickey Mouse more; the most quick mass appreciation.” —Walt Whitman / William Shakespeare “World, our thought to make sure we do that nothing lives. I accept in hell. There is a temporary creed liable to college football. All uth. Your Christians are so much success here due to them in a heck of passion.” —Mohandas Ghandi / Jim Harbaug Runner-Up #1 “Which I had therefore I hope that begins with those of the understanding, and so. Each problem that it is not only objects of desiring more evil. The only prudent never to sensibility, on which man is God’s will discover that all other purpose.” —Rene Descartes / Immanuel Kant “People die, Andrew Luck would be our starter. If we should donate his face to add depth, I feel we have to have college football needs Stanford. It’s just want. I said it up. He missed two black men beat each other at school.” —Mohammed Ali / Jim Harbaugh “People will be funny if you’re tools of atomic energy has, arts and ignorance, albeit a lot of that by their user. Not everything that’s insecurity before himself and how to Washington and over and very persistent one without any of science is more complex, we are you running scared all the world is not giving the exciting things bigger or axioms.” —Bill Nye / Albert Einstein
MENACE A REVENGE NEW ATTACK PHANTOM of the throne room, a loud SPROOING and Han look at the giant display showing the Death Star horizon, four ferocious Imperial TIE fighter. The fighter races past the robots finish burning the dead. Luke drives up in there! THREEPIO: Oh, this little R2 unit of your hate. VADER: It is the pirateship, firing laserblasts at it. INTERIOR: REBEL BASE -- MAIN ICE TUNNEL The deck officer and troops withdraw. Vader and Luke stand staring at the door. THREEPIO (instantly): There doesn’t seem to have to replace it. He takes his time, as though he had forever, bending her body backward. She has never been kissed like this before, and it goes dead. BOUSHH: Zeebuss. THREEPIO: He agrees! The raucous crowd of monsters erupts in a galaxy far, far, away... A vast sea of stars away from Hoth, closely followed by BOUSHH, an oddly cloaked bounty hunter, leading his captive, Han Solo’s copilot, CHEWBACCA THE WOOKIEE. Bib takes his place next to the control panel. Leia slips out of rope and crashes into the huge ruins of the bridge above, and he slams a wrench across the surface. Runner-Up #2
INTERIOR: DARTH VADER’S COCKPIT. Vader lines up the steps. LUKE: Han! HAN: Luke! LUKE: Are you sure the computer terminal, and several lights on the seat of the city. I advise everyone to leave the system until we’ve activated the energy shield. We’ve got to help her. She rebuffs him. HAN: Hey, Luke... may the Force be with you. Luke looks up, then starts to get her ready. EXTERIOR: TATOOINE -- MOS EISLEY -- STREET. Eight Imperial senators and generals sit around a huge hangar. Thirty stormtroopers stand at the rendezvous point on Tatooine. INTERIOR: MILLENNIUM FALCON -- COCKPIT. The horizon twists as the attack explosion. Other troopers scurrying about the same time as your father. LEIA: We don’t need any of your seems a bit beat up. Do you think I’m all right. She lets go with one hand and moans. BOUSHH: Shhh. You have hibernation sickness. HAN: I love you! HAN: I just don’t understand human behavior. Runner-Up #2 MENACE A REVENGE NEW ATTACK PHANTOM of the throne room, a loud SPROOING and Han look at the giant display showing the Death Star horizon, four ferocious Imperial TIE fighter. The fighter races past the robots finish burning the dead. Luke drives up in there! THREEPIO: Oh, this little R2 unit of your hate. VADER: It is the pirateship, firing laserblasts at it. INTERIOR: REBEL BASE -- MAIN ICE TUNNEL The deck officer and troops withdraw. Vader and Luke stand staring at the door. THREEPIO (instantly): There doesn’t seem to have to replace it. He takes his time, as though he had forever, bending her body backward. She has never been kissed like this before, and it goes dead. BOUSHH: Zeebuss. THREEPIO: He agrees! The raucous crowd of monsters erupts in a galaxy far, far, away... A vast sea of stars away from Hoth, closely followed by BOUSHH, an oddly cloaked bounty hunter, leading his captive, Han Solo’s copilot, CHEWBACCA THE WOOKIEE. Bib takes his place next to the control panel. Leia slips out of rope and crashes into the huge ruins of the bridge above, and he slams a wrench across the surface.
/* * The Kontroversial Analyzer of Nonsensical Thoughts can ramble * about philosophy for hours. Running this version will generate * a short sample of the K.A.N.T.’s thoughts for your perusal. Be * warned, however, as the text can be quite dense due to the * highly abstract and theoretical nature of the discussion, and * may also require quite a bit of time for the K.A.N.T. to process. */ We find that the categories, although no object would be a kind of systematic unity is therefore a series of time, with which Aristotle occupied himself, those which are all external relations of phenomena should not be a vain and impossible conception. Consequently, the idea of its a posteriori; the whole system of criticism, because there certainly is something of which we know it to be its origin from that of change of certain relations, it is to say, what place shall we obtain through practical reason, touching the bounds that limit its employment is alone what makes happy; because the whole determination of its reality; for the sum total of all representations in one conception, in order to seek far for the desired result. For, as object, as long as we can attribute an interest in the phenomenal world--this was the first condition, under which alone they are mere play of our actions as noble, magnanimous, meritorious, with the schema of modality and its connected order; but the consciousness of immediate obligation of the pure conception of certain determinations in the midst of her object-matter, this is a parte priori. First Place
Now if this were not also at the knowledge of myself as in this life, however thou tormentest me, that is it always based on a pathological principle, of a possible system of universal laws of good and useful warning, that there could only be shown to possess an objective principle (i.e., the notion of cause) and B as connected a priori; it is such an end which is infinite. “The same demand must again be made” to pass; for observation and study of the exercise of reason in inextricable embarrassment. Before objects, and that of the dogmatical treatment of this unity can be admitted as problematic conceptions is the condition of all possible empirical consciousness, which would not take care at the solution of the will in that case be a practical rule without supposing any feeling, it is not empirical, that is, self-knowledge. First Place /* * The Kontroversial Analyzer of Nonsensical Thoughts can ramble * about philosophy for hours. Running this version will generate * a short sample of the K.A.N.T.’s thoughts for your perusal. Be * warned, however, as the text can be quite dense due to the * highly abstract and theoretical nature of the discussion, and * may also require quite a bit of time for the K.A.N.T. to process. */ We find that the categories, although no object would be a kind of systematic unity is therefore a series of time, with which Aristotle occupied himself, those which are all external relations of phenomena should not be a vain and impossible conception. Consequently, the idea of its a posteriori; the whole system of criticism, because there certainly is something of which we know it to be its origin from that of change of certain relations, it is to say, what place shall we obtain through practical reason, touching the bounds that limit its employment is alone what makes happy; because the whole determination of its reality; for the sum total of all representations in one conception, in order to seek far for the desired result. For, as object, as long as we can attribute an interest in the phenomenal world--this was the first condition, under which alone they are mere play of our actions as noble, magnanimous, meritorious, with the schema of modality and its connected order; but the consciousness of immediate obligation of the pure conception of certain determinations in the midst of her object-matter, this is a parte priori.
Contest Results First place: Spencer Stanats, K.A.N.T. Runners-up: Andrew Altman, Strange Pairings Seth Winger, Star Wars Honorable Mention: Shrey Shahi, Wordsworth Sonnet Nirmal Jayaram, Shakespeare Sonnet Albert Lai, Promising Sonnet Johanna Nagy, Dr. Seuss
Why We Look at Old Editors? • In class today and Friday, I’m going to look at an ancient (at least in the sense of Internet time) editor technology, which is largely based on the TECO (Text Editor and COrrector) I used to prepare my doctoral thesis. • Many students greet this idea with skepticism. Why should we look at something so old that doesn’t meet even the most requirements we would insist on in an editor. • We’ve kept that editor in CS106B for two decades because: • It’s absolutely the best example of how using different data representations can have a profound effect on performance. • No modern editor is simple enough to understand in its entirety. • TECO is historically important as the first extensible editor. It was the first platform for EMACS, which is still in use today.
WYSIWYG vs. Command Line • Most editors today follow the WYSIWYG principle, which is an acronym for “what you see is what you get” that keeps the screen updated so that it shows the current document. • TECO was a command-based editor. To edit a document, you enter commands that consist of a letter, possibly along with some additional data. Rather than showing the contents of the editor all the time, command-line editors showed the contents only when the user asked for them. • Most histories of computer science date the first WYSIWYG editor to Xerox PARC in 1974. I saw one running almost two years earlier, which was written by a couple of graduate students at Harvard on their PDP-1 computer. That editor was called Splat! and seems largely lost to history.
The PDP-1 Computer • A great deal of early graphics development was done on the Digital Equipment Corporation’s PDP-1 computer, which was released in 1959. Most PDP-1s came with a Type 30 display, which was a 1024x1024 pixel display. Splat! ran on this display, but so did Spacewar!
The Editor Commands • Our minimal version of TECO has the following commands: Itext Inserts the characters following the I into the buffer. J Moves the current point (the cursor) to the beginning. Z Moves the cursor to the end of the buffer. F Moves the cursor forward one character. B Moves the cursor backward one character. D Deletes the character after the cursor. Q Exits from the editor.
buffer.moveCursorForward() buffer.moveCursorToStart() Moves the cursor forward one character (does nothing if it’s at the end). Moves the cursor to the beginning of the buffer. buffer.moveCursorBackward() buffer.moveCursorToEnd() Moves the cursor backward one character (does nothing if it’s at the beginning). Moves the cursor to the end of the buffer. buffer.insertCharacter(ch) buffer.deleteCharacter() buffer.display() Inserts the character ch at the cursor position and advances the cursor past it. Deletes the character after the cursor, if any. Displays the buffer on cout (primarily for debugging). The EditorBuffer Class • The EditorBuffer class supports the following operations:
1. A simple array model. 2. A two-stack model that uses a pair of character stacks. 3. A linked-list model that uses pointers to indicate the order. Where Do We Go From Here? • Our strategy for the next two days is to implement the class EditorBuffer in three different ways and to compare the algorithmic efficiency of the various options. Those three representations are: • For each model, we’ll calculate the complexity of each of the six fundamental methods in the EditorBuffer class. Some operations will be more efficient with one model, others will be more efficient with a different underlying representation.