cvs commit: de-docproj/books/developers-handbook/x86 chapter.sgml

From: Fabian Borschel <seirei(at)doc.bsdgroup.de>
Date: Fri, 21 Sep 2007 21:38:20 GMT

seirei 2007-09-21 21:38:20 UTC

  FreeBSD German Documentation Repository

  Modified files:
    books/developers-handbook/x86 chapter.sgml
  Log:
  Kapitel 12.11 uebersetzt.
  Gesendet von: Paul Keller
  
  Revision Changes Path
  1.16 +493 -551 de-docproj/books/developers-handbook/x86/chapter.sgml
  
  Index: chapter.sgml
  ===================================================================
  RCS file: /home/cvs/de-docproj/books/developers-handbook/x86/chapter.sgml,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -I$FreeBSDde.*$ -r1.15 -r1.16
  --- chapter.sgml 21 Sep 2007 19:22:39 -0000 1.15
  +++ chapter.sgml 21 Sep 2007 21:38:20 -0000 1.16
  @@ -2158,339 +2158,298 @@
       </sect2>
     </sect1>
   
  -<sect1 id="x86-files">
  -<title>Working with Files</title>
  + <sect1 id="x86-files">
  + <title>Arbeiten mit Dateien</title>
   
  -<para>
  -We have already done some basic file work: We know how
  -to open and close them, how to read and write them using
  -buffers. But &unix; offers much more functionality when it
  -comes to files. We will examine some of it in this section,
  -and end up with a nice file conversion utility.
  -</para>
  -
  -<para>
  -Indeed, let us start at the end, that is, with the file
  -conversion utility. It always makes programming easier
  -when we know from the start what the end product is
  -supposed to do.
  -</para>
  -
  -<para>
  -One of the first programs I wrote for &unix; was
  -<ulink url="ftp://ftp.int80h.org/unix/tuc/"><application>tuc</application></ulink>,
  -a text-to-&unix; file converter. It converts a text
  -file from other operating systems to a &unix; text file.
  -In other words, it changes from different kind of line endings
  -to the newline convention of &unix;. It saves the output
  -in a different file. Optionally, it converts a &unix; text
  -file to a <acronym>DOS</acronym> text file.
  -</para>
  -
  -<para>
  -I have used <application>tuc</application> extensively, but always
  -only to convert from some other <acronym>OS</acronym>
  -to &unix;, never the other way. I have always wished
  -it would just overwrite the file instead of me having
  -to send the output to a different file. Most of the time,
  -I end up using it like this:
  -</para>
  + <para>Wir haben bereits einfache Arbeiten mit Dateien gemacht:
  + Wir wissen wie wir sie &ouml;ffnen und schliessen, oder wie
  + man sie mit Hilfe von Buffern liest und schreibt. Aber &unix;
  + bietet viel mehr Funktionalit&auml;t wenn es um Dateien geht.
  + Wir werden einige von ihnen in dieser Sektion untersuchen und
  + dann mit einem netten Datei Konvertierungs Werkzeug
  + abschliessen.</para>
  +
  + <para>In der Tat, Lasst uns am Ende beginnen, also mit dem Datei
  + Konvertierungs Werkzeug. Es macht Programmieren immer einfacher,
  + wenn wir bereits am Anfang wissen was das End Produkt bezwecken
  + soll.</para>
  +
  + <para>Eines der ersten Programme die ich f&uuml;r &unix; schrieb
  + war <ulink url="ftp://ftp.int80h.org/unix/tuc/"><application>
  + tuc</application></ulink>, ein Text-Zu-&unix; Datei Konvertierer.
  + Es konvertiert eine Text Datei von einem anderen Betriebssystem
  + zu einer &unix; Text Datei. Mit anderen Worten, es &auml;ndert
  + die verschiedenen Arten von Zeilen Begrenzungen zu der Zeilen
  + Begrenzungs Konvention von &unix;. Es speichert die Ausgabe in
  + einer anderen Datei. Optional konvertiert es eine &unix; Text
  + Datei zu einer <acronym>DOS</acronym> Text Datei.</para>
  +
  + <para>Ich habe <application>tuc</application> sehr oft benutzt,
  + aber nur von irgendeinem anderen <acronym>OS</acronym> nach
  + &unix; zu konvertieren, niemals anders herum. Ich habe mir immer
  + gew&uuml;nscht das die Datei einfach &uuml;berschrieben wird
  + anstatt das ich die Ausgabe in eine andere Datei senden muss.
  + Meistens, habe ich diesen Befehl verwendet:</para>
   
  -<screen>&prompt.user; <userinput>tuc <replaceable>myfile tempfile</replaceable></userinput>
  + <screen>&prompt.user; <userinput>tuc <replaceable>myfile tempfile</replaceable></userinput>
   &prompt.user; <userinput>mv <replaceable>tempfile myfile</replaceable></userinput></screen>
   
  -<para>
  -It would be nice to have a <application>ftuc</application>,
  -i.e., <emphasis>fast tuc</emphasis>, and use it like this:
  -</para>
  -
  -<screen>&prompt.user; <userinput>ftuc <replaceable>myfile</replaceable></userinput></screen>
  -
  -<para>
  -In this chapter, then, we will write
  -<application>ftuc</application> in assembly language
  -(the original <application>tuc</application>
  -is in C), and study various
  -file-oriented kernel services in the process.
  -</para>
  -
  -<para>
  -At first sight, such a file conversion is very
  -simple: All you have to do is strip the carriage
  -returns, right?
  -</para>
  -
  -<para>
  -If you answered yes, think again: That approach will
  -work most of the time (at least with <acronym>MS
  -DOS</acronym> text files), but will fail occasionally.
  -</para>
  -
  -<para>
  -The problem is that not all non &unix; text files end their
  -line with the carriage return / line feed sequence. Some
  -use carriage returns without line feeds. Others combine several
  -blank lines into a single carriage return followed by several
  -line feeds. And so on.
  -</para>
  -
  -<para>
  -A text file converter, then, must be able to handle
  -any possible line endings:
  -</para>
  -
  -<itemizedlist>
  -<listitem>
  -<para>
  -carriage return / line feed
  -</para>
  -</listitem>
  -
  -<listitem>
  -<para>
  -carriage return
  -</para>
  -</listitem>
  -
  -<listitem>
  -<para>
  -line feed / carriage return
  -</para>
  -</listitem>
  -
  -<listitem>
  -<para>
  -line feed
  -</para>
  -</listitem>
  -
  -</itemizedlist>
  -<para>
  -It should also handle files that use some kind of a
  -combination of the above (e.g., carriage return followed
  -by several line feeds).
  -</para>
  -
  -<sect2 id="x86-finite-state-machine">
  -<title>Finite State Machine</title>
  -
  -<para>
  -The problem is easily solved by the use of a technique
  -called <emphasis>finite state machine</emphasis>, originally developed
  -by the designers of digital electronic circuits. A
  -<emphasis>finite state machine</emphasis> is a digital circuit
  -whose output is dependent not only on its input but on
  -its previous input, i.e., on its state. The microprocessor
  -is an example of a <emphasis>finite state machine</emphasis>: Our
  -assembly language code is assembled to machine language in which
  -some assembly language code produces a single byte
  -of machine language, while others produce several bytes.
  -As the microprocessor fetches the bytes from the memory
  -one by one, some of them simply change its state rather than
  -produce some output. When all the bytes of the op code are
  -fetched, the microprocessor produces some output, or changes
  -the value of a register, etc.
  -</para>
  -
  -<para>
  -Because of that, all software is essentially a sequence of state
  -instructions for the microprocessor. Nevertheless, the concept
  -of <emphasis>finite state machine</emphasis> is useful in software design as well.
  -</para>
  -
  -<para>
  -Our text file converter can be designed as a <emphasis>finite state machine</emphasis> with three
  -possible states. We could call them states 0-2,
  -but it will make our life easier if we give them symbolic names:
  -</para>
  -
  -<itemizedlist>
  -<listitem>
  -<para>
  -<symbol>ordinary
  -</symbol></para>
  -</listitem>
  -
  -<listitem>
  -<para>
  -<symbol>cr

----------------------------------------------
Diff block truncated. (Max lines = 200)
----------------------------------------------

To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-cvs-doc" in the body of the message
Received on Fri 21 Sep 2007 - 23:40:03 CEST

search this site