Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

tradução até 'ASCII and Unicode'.

  • Loading branch information...
commit f228b65796ba14ff0193ae4c83e77e8a85af5d1e 1 parent 6b00ba4
authored February 14, 2010

Showing 1 changed file with 85 additions and 27 deletions. Show diff stats Hide diff stats

  1. 112  pt/Chap01.tex
112  pt/Chap01.tex
@@ -628,11 +628,11 @@ \subsection{Palavras reservadas}
628 628
 \texttt{@list\_compras}, e assim por diante, ao vez de \texttt{\$a}, \texttt{\$b} 
629 629
 e \texttt{\%c}.\medskip
630 630
 
631  
-\noindent \textit{Statements and Statement Blocks}
  631
+\noindent \textit{Instruções e Blocos de Instrução}
632 632
 
633  
-\noindent If functions are the verbs of Perl, then \textbf{statements }are 
634  
-the sentences. Instead of a full stop, a statement in Perl usually ends 
635  
-with a semicolon, as we saw above:\medskip
  633
+\noindent Se as funções são os verbos de Perl, então \textbf{instruções (statements) } são as 
  634
+as sentenças. Em vez de um ponto, uma instrução em Perl normalmente termina
  635
+com um ponto e vírgula, como vimos abaixo:\medskip
636 636
 
637 637
 \noindent 
638 638
 
@@ -640,7 +640,7 @@ \subsection{Palavras reservadas}
640 640
 
641 641
 \noindent 
642 642
 
643  
-\noindent To print something again, we can add another statement:
  643
+\noindent Para imprimir alguma coisa novamente, então nós escrevemos outra instrução:
644 644
 
645 645
 \noindent 
646 646
 
@@ -652,15 +652,19 @@ \subsection{Palavras reservadas}
652 652
 
653 653
 \noindent 
654 654
 
655  
-\noindent There are times when you can get away without adding the semicolon, 
656  
-such as when it's absolutely clear to perl that the statement has finished. 
657  
-However, it is good practice to put a semicolon at the end of each statement. 
658  
-For example, you can miss out the final semicolon in the example above, 
659  
-without causing a problem. Missing out the first would be incorrect.\medskip
  655
+\noindent Há momentos em que você pode ir longe sem adicionar o ponto e vírgula, 
  656
+como quando é absolutamente claro para o perl quando a instrução foi concluída. 
  657
+No entanto, é boa prática colocar o ponto e vírgula no final de cada instrução. 
  658
+Por exemplo, você pode perder o ponto e vírgula final do exemplo acima, sem causar problema. 
  659
+Perdendo a primeira seria incorreto.\medskip
660 660
 
661 661
 \noindent 
662 662
 
663  
-\noindent We can also group together a bunch of statements into a \textbf{block }-- which is a bit like a paragraph -- by surrounding them with braces: \{\dots \}. We'll see later how blocks are used to specify a set of statements that must happen at a given time and also how they are used to limit the effects of a statement. Here's an example of a block:
  663
+\noindent Podemos agrupar um conjunto de instruções num  
  664
+\textbf{bloco }-- tal como um parágrafo -- delimitando com chaves: \{\dots \}. 
  665
+Veremos mais tarde como os blocos são usados para especificar um conjunto de 
  666
+instruções que deve acontecer em um determinado momento e também como eles são 
  667
+usados para limitar os efeitos de uma declaração. Aqui está um exemplo de um bloco:
664 668
 
665 669
 \noindent 
666 670
 
@@ -676,7 +680,9 @@ \subsection{Palavras reservadas}
676 680
 
677 681
 \noindent 
678 682
 
679  
-\noindent Do you notice how I've used indentation to separate the block from its surroundings? This is because, unlike paragraphs, you can put blocks inside of blocks, which makes it easier to see on what level things are happening. This:
  683
+\noindent Você observou como utilizamos os recuos (ou identação) para separar os blocos? 
  684
+Isto porque, ao contrário dos paragrafos, você pode colocar blocos dentro de blocos,
  685
+o que torna mais fácil ver em que nível as coisas estão acontecendo. Este:
680 686
 
681 687
 \noindent 
682 688
 
@@ -698,7 +704,7 @@ \subsection{Palavras reservadas}
698 704
 
699 705
 \noindent 
700 706
 
701  
-\noindent is easier to follow than this:
  707
+\noindent é mais fácil do quê:
702 708
 
703 709
 \noindent 
704 710
 
@@ -720,7 +726,13 @@ \subsection{Palavras reservadas}
720 726
 
721 727
 \noindent 
722 728
 
723  
-\noindent As well as braces to mark out the territory of a block of statements, you can use parentheses to mark out what you're giving a function. We call the set of things you give to a function the \textbf{arguments}, and we say that we \textbf{pass }the arguments to the function. For instance, you can pass a number of arguments to the print function by separating them with commas:
  729
+\noindent Bem como as chaves são utilizadas para demarcar o território de um bloco de instruções, 
  730
+você pode usar parênteses para marcar o que você está fornecendo a uma função. 
  731
+Chamamos o conjunto de coisas que você dá para uma função de \textbf{argumentos}, 
  732
+e dizemos que \textbf{passamos} os argumentos para a função. Por exemplo, você pode 
  733
+passar uma série de argumentos para a função \textit{print}, separando-os 
  734
+com vírgulas:
  735
+
724 736
 
725 737
 \noindent 
726 738
 
@@ -728,7 +740,7 @@ \subsection{Palavras reservadas}
728 740
 
729 741
 \noindent 
730 742
 
731  
-\noindent The print function happily takes as many arguments as it can, and it gives us the expected answer:
  743
+\noindent A função \textit{print} recebe todos os argumentos fornecido, e retorna a resposta desejada:
732 744
 
733 745
 \noindent 
734 746
 
@@ -736,7 +748,7 @@ \subsection{Palavras reservadas}
736 748
 
737 749
 \noindent 
738 750
 
739  
-\noindent Surrounding the arguments with brackets clears things up a bit:
  751
+\noindent Delimitar os argumentos com parênteses torna as coisas mais claras :
740 752
 
741 753
 \noindent 
742 754
 
@@ -744,7 +756,7 @@ \subsection{Palavras reservadas}
744 756
 
745 757
 \noindent 
746 758
 
747  
-\noindent We can also limit the amount of arguments we pass by moving the brackets:
  759
+\noindent Também podemos limitar a quantidade de argumentos que passamos movendo parênteses:
748 760
 
749 761
 \noindent 
750 762
 
@@ -752,7 +764,7 @@ \subsection{Palavras reservadas}
752 764
 
753 765
 \noindent 
754 766
 
755  
-\noindent We only pass three arguments, so they're the ones that get printed:
  767
+\noindent Nos passamos apenas três argumentos, então o resultado que teremos:
756 768
 
757 769
 \noindent 
758 770
 
@@ -760,11 +772,17 @@ \subsection{Palavras reservadas}
760 772
 
761 773
 \noindent 
762 774
 
763  
-\noindent What happens to the others? Well, we didn't give perl instructions, so nothing happens.
  775
+\noindent O que ocorreu com os outros? Bem, nós não passamos as instruções, então nada ocorreu.
764 776
 
765 777
 \noindent 
766 778
 
767  
-\noindent In the cases where semicolons or brackets are optional, the important thing to do is to use your judgment. Sometimes code will look perfectly clear without the brackets, but when you've got a complicated statement and you need to be sure of which arguments belong to which function, putting in the brackets can clarify your work. Always aim to help the readers of your code, and remember that these reader will more than likely include you.
  779
+\noindent Nos casos em que ponto e a vírgula ou parênteses são opcionais, a 
  780
+coisa  mais importante a fazer é usar o seu julgamento. Às vezes, o código ficará 
  781
+perfeitamente claro, sem os parênteses, mas quando você tem uma instrução 
  782
+complexa e você precisa ter certeza de quais argumentos pertencem a qual 
  783
+função, utilizar os parênteses pode esclarecer o seu trabalho. Sempre 
  784
+com objectivo de facilitar a leitura do seu código, e lembre-se 
  785
+que estes leitor mais do que provavelmente inclui você.
768 786
 
769 787
 \noindent 
770 788
 
@@ -772,27 +790,60 @@ \section{ASCII and Unicode}
772 790
 
773 791
 \noindent 
774 792
 
775  
-\noindent Computers are, effectively, lumps of sand and metal. They don't know much about the world. They don't understand words or symbols or letters. They do, however, know how to count. As far as a computer is concerned, everything is a number, and every character, albeit a letter or a symbol, is represented by a number in a sequence. This is called a 'character set', and the character set that computers predominantly use these days is called the 'ASCII' sequence. If you're interested, you can find the complete ASCII character set in Appendix F for reference.
  793
+\noindent Computers are, effectively, lumps of sand and metal. 
  794
+They don't know much about the world. They don't understand words 
  795
+or symbols or letters. They do, however, know how to count. As far 
  796
+as a computer is concerned, everything is a number, and every character, 
  797
+albeit a letter or a symbol, is represented by a number in a sequence. 
  798
+This is called a 'character set', and the character set that computers 
  799
+predominantly use these days is called the 'ASCII' sequence. If you're 
  800
+interested, you can find the complete ASCII character set in 
  801
+Appendix F for reference.
776 802
 
777 803
 \noindent 
778 804
 
779  
-\noindent The ASCII sequence consists of 256 characters, running from character number 0 (all computers, and plenty of computer users, start counting from zero) to character number 255. The letter 'E', for instance, is number 69 in the sequence, and a plus sign (+) is number 43. 255 is a key number for computers and computer programmers alike, because it's the largest number you can store in one 'byte'.
  805
+\noindent The ASCII sequence consists of 256 characters, running from 
  806
+character number 0 (all computers, and plenty of computer users, start 
  807
+counting from zero) to character number 255. The letter 'E', for instance, 
  808
+is number 69 in the sequence, and a plus sign (+) is number 43. 255 is a 
  809
+key number for computers and computer programmers alike, because it's the 
  810
+largest number you can store in one 'byte'.
780 811
 
781 812
 \noindent 
782 813
 
783  
-\noindent The big problem with ASCII is that it's American. Well, that's not entirely the problem; the real reason is that it's not particularly useful for people who don't use the Roman alphabet. What used to happen was that particular languages would stick their own alphabet in the upper range of the sequence, between 128 and 255. Of course, we then ended up with plenty of variants that weren't quite ASCII, and the whole point of standardization was lost.
  814
+\noindent The big problem with ASCII is that it's American. Well, that's 
  815
+not entirely the problem; the real reason is that it's not particularly 
  816
+useful for people who don't use the Roman alphabet. What used to happen 
  817
+was that particular languages would stick their own alphabet in the upper 
  818
+range of the sequence, between 128 and 255. Of course, we then ended up 
  819
+with plenty of variants that weren't quite ASCII, and the whole point of 
  820
+standardization was lost.
784 821
 
785 822
 \noindent 
786 823
 
787  
-\noindent Worse still, if you've got a language like Chinese or Japanese that has hundreds or thousands of characters, then you really can't fit them into a mere 256. This meant that programmers had to forget about ASCII altogether and build their own systems using pairs of numbers to refer to one character.
  824
+\noindent Worse still, if you've got a language like Chinese or Japanese 
  825
+that has hundreds or thousands of characters, then you really can't fit 
  826
+them into a mere 256. This meant that programmers had to forget about 
  827
+ASCII altogether and build their own systems using pairs of numbers to 
  828
+refer to one character.
788 829
 
789 830
 \noindent 
790 831
 
791  
-\noindent To fix this, \textbf{Unicode }was developed by a number of computer companies, standards organizations, and bibliographic interests. It is currently maintained and developed by the Unicode Consortium, an organization in California. They have also produced a couple of new character sets, UTF8 and UTF16. UTF8 uses two bytes instead of one, so it can contain 65536 characters, which is enough for most people. You can learn more about Unicode at http://www.unicode.org/
  832
+\noindent To fix this, \textbf{Unicode }was developed by a number of computer 
  833
+companies, standards organizations, and bibliographic interests. It is currently 
  834
+maintained and developed by the Unicode Consortium, an organization in California. 
  835
+They have also produced a couple of new character sets, UTF8 and UTF16. UTF8 uses 
  836
+two bytes instead of one, so it can contain 65536 characters, which is enough for 
  837
+most people. You can learn more about Unicode at http://www.unicode.org/
792 838
 
793 839
 \noindent 
794 840
 
795  
-\noindent Perl 5.6 introduces Unicode support. Previously, you could print any data that you were capable of producing in your editor or from external sources. However, the functions to translate between lower and upper case wouldn't necessarily work with Greek letters without a lot of support from your operating system. Now, if you have Unicode data, you can consider a single Japanese \textit{kana }to be one character instead of two. So, if you use a Unicode editor for your programming:
  841
+\noindent Perl 5.6 introduces Unicode support. Previously, you could print any 
  842
+data that you were capable of producing in your editor or from external sources. 
  843
+However, the functions to translate between lower and upper case wouldn't necessarily 
  844
+work with Greek letters without a lot of support from your operating system. Now, 
  845
+if you have Unicode data, you can consider a single Japanese \textit{kana }to be 
  846
+one character instead of two. So, if you use a Unicode editor for your programming:
796 847
 
797 848
 \noindent 
798 849
 
@@ -808,7 +859,14 @@ \subsection{Escape Sequences}
808 859
 
809 860
 \noindent 
810 861
 
811  
-\noindent So, UTF8 gives us 65536 characters, and ASCII gives us 256 characters, but on the average keyboard, there only a hundred or so keys. Even using the shift keys, there will still be some characters that you aren't going to be able to type. There'll also be some things that you don't want to stick in the middle of your program, because they would make it messy or confusing. However, you'll want to refer to some of these characters in strings that you output. Perl provides us with mechanisms called 'escape sequences' as an alternative way of getting to them. We've already seen the use of \textbackslash n to start a new line. Here are the more common escape sequences:
  862
+\noindent So, UTF8 gives us 65536 characters, and ASCII gives us 256 characters, but 
  863
+on the average keyboard, there only a hundred or so keys. Even using the shift keys, 
  864
+there will still be some characters that you aren't going to be able to type. There'll 
  865
+also be some things that you don't want to stick in the middle of your program, because 
  866
+they would make it messy or confusing. However, you'll want to refer to some of these 
  867
+characters in strings that you output. Perl provides us with mechanisms called 'escape 
  868
+sequences' as an alternative way of getting to them. We've already seen the use of 
  869
+\textbackslash n to start a new line. Here are the more common escape sequences:
812 870
 
813 871
 \noindent 
814 872
 

0 notes on commit f228b65

Please sign in to comment.
Something went wrong with that request. Please try again.