summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/c-pascal
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-05-17 16:18:42 +0000
committerKarl Berry <karl@freefriends.org>2010-05-17 16:18:42 +0000
commit23bb488bb028acf936fa4c2fce03649802515eb6 (patch)
tree00bfb4dfc21e90becb3c5f119bf348f372bad6f5 /Master/texmf-dist/doc/generic/c-pascal
parente679d4dd811dedc2b164b4ec19ba8053b2cae3ad (diff)
c-pascal update (long ago)
git-svn-id: svn://tug.org/texlive/trunk@18316 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic/c-pascal')
-rw-r--r--Master/texmf-dist/doc/generic/c-pascal/README.pol (renamed from Master/texmf-dist/doc/generic/c-pascal/readme.pol)6
-rw-r--r--Master/texmf-dist/doc/generic/c-pascal/demo2.tex41
-rw-r--r--Master/texmf-dist/doc/generic/c-pascal/prog/fib.py27
-rw-r--r--Master/texmf-dist/doc/generic/c-pascal/prog/sun.c2
-rw-r--r--Master/texmf-dist/doc/generic/c-pascal/readme.eng90
5 files changed, 73 insertions, 93 deletions
diff --git a/Master/texmf-dist/doc/generic/c-pascal/readme.pol b/Master/texmf-dist/doc/generic/c-pascal/README.pol
index baa1bb3c1f5..e86c9c47b9e 100644
--- a/Master/texmf-dist/doc/generic/c-pascal/readme.pol
+++ b/Master/texmf-dist/doc/generic/c-pascal/README.pol
@@ -45,7 +45,7 @@ W pliku cap_c.tex znajdują się definicje dwóch makr:
podział programu na mniejsze części, z których każda będzie ujęta
w komendy \BeginC ... \EndC.
- 2. \InsertC{nazwapliku}
+ 2. \InputC{nazwapliku}
Wstawia program w języku C z pliku zewnętrznego. Program zostanie
sformatowany jak w poprzednim przypadku. Przypomnienie dla pracujących
pod DOSem: w nazwie pliku wszystkie wtyłciachy należy zastąpić
@@ -64,7 +64,7 @@ on również dwa makra:
1. \BeginPascal ... \EndPascal
- 2. \InsertPascal{nazwapliku}
+ 2. \InputPascal{nazwapliku}
Działają one analogicznie. W przypadku \BeginPascal ... \EndPascal
obowiązują podobne ograniczenia na wielkość formatowanego programu.
@@ -78,6 +78,8 @@ można ją zmodyfikować.
---------
Czcionki używane do składania programów są zadeklarowane na początku
pliku cap_comm.tex. W razie potrzeby można je łatwo przedefiniować.
+Osoby używające czcionek PL zamiast CM będą musiały zmodyfikować dwie
+linie w tym pliku. Są one wyraźnie zaznaczone.
Uwaga
diff --git a/Master/texmf-dist/doc/generic/c-pascal/demo2.tex b/Master/texmf-dist/doc/generic/c-pascal/demo2.tex
index bd26d89b713..548ef8ee21b 100644
--- a/Master/texmf-dist/doc/generic/c-pascal/demo2.tex
+++ b/Master/texmf-dist/doc/generic/c-pascal/demo2.tex
@@ -1,4 +1,18 @@
\input cap
+\let\IdentifierColor=\Black
+\let\KeywordColor=\MidnightBlue
+\let\SpecialColor=\Black
+\let\SymbolColor=\Black
+\let\CommentColor=\Gray
+\let\TextColor=\ForestGreen
+\let\DirectiveColor=\Tan
+\SpaceSkip=1.3ex
+
+% Just for fun, you can use a cyrillic font for identifiers
+% Of course, any font can be changed just like in the non-color
+% version of cap.
+%\font\cirm=wncyi10\let\IdentifierFont=\cirm
+
A short program in C. It was inserted directly into the \TeX\ source file.
@@ -46,4 +60,31 @@ This one was imported from another file.
\medskip
\InputPascal{prog/guess.pas}
+\vfill\eject
+
+And now, my latest addition: programs written in Python. The first one
+is typed directly into the file.
+
+\medskip
+\BeginPython
+def fib(n):
+ """Calculates Fibonacci series.
+
+ It returns the first member of Fibonacci series larger than n"""
+ a,b=1,1
+ while b <= n:
+ a,b = b,a+b # see how we use multiple assignment?
+ return b
+
+fib(10)
+\EndPython
+
+\hrule
+\bigskip
+
+This one was imported from another file.
+
+\medskip
+\InputPython{prog/fib.py}
+
\bye
diff --git a/Master/texmf-dist/doc/generic/c-pascal/prog/fib.py b/Master/texmf-dist/doc/generic/c-pascal/prog/fib.py
new file mode 100644
index 00000000000..3c0bc3d8a23
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/c-pascal/prog/fib.py
@@ -0,0 +1,27 @@
+# Just a little test program
+from sys import stderr
+
+class FibSeries:
+ """Returns all the elements of Fibonacci series up to a given number.
+
+ Requires one parameter (the number we're going up to)."""
+
+
+ def __init__(self,number):
+ self.series=[1,1]
+ a,b=1,1
+
+ while b<number:
+ a,b=b,a+b
+ if b<number: self.series.append(b)
+
+ def writeout(self):
+ cnt=0
+ while cnt<len(self.series):
+ stderr.write(str(self.series[cnt])+" ")
+ cnt+=1
+ stderr.write("\n")
+
+meine = FibSeries(115)
+meine.writeout()
+
diff --git a/Master/texmf-dist/doc/generic/c-pascal/prog/sun.c b/Master/texmf-dist/doc/generic/c-pascal/prog/sun.c
index 889341b5b9d..28d25bfa5af 100644
--- a/Master/texmf-dist/doc/generic/c-pascal/prog/sun.c
+++ b/Master/texmf-dist/doc/generic/c-pascal/prog/sun.c
@@ -4,7 +4,7 @@
int months[]={0, 31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31};
char weekdays[7][15]={"Sunday", "Monday", "Tuesday", "Wednesday",
- "Thursday", "Friday", "Sunday"};
+ "Thursday", "Friday", "Saturday"};
/* this program calculates the latidude
where polar day begins/ends */
diff --git a/Master/texmf-dist/doc/generic/c-pascal/readme.eng b/Master/texmf-dist/doc/generic/c-pascal/readme.eng
deleted file mode 100644
index 170acaa2a54..00000000000
--- a/Master/texmf-dist/doc/generic/c-pascal/readme.eng
+++ /dev/null
@@ -1,90 +0,0 @@
-======================================================================
-
- CAP --- macro package for typesetting programs in C and Pascal
-
-======================================================================
-
-
- Contents
-----------
-This macro package consists of three files:
- cap_c.tex -- macros for typesetting programs in C
- cap_pas.tex -- macros for typesetting programs in Pascal
- cap_comm.tex -- helpful macros and declarations used for typesetting
- programs in both languages; this file does not contain
- any macros useful for a user
-
-
- Programs in C
----------------
-There are two macros available in the cap_c.tex file:
-
- 1. \BeginC ... \EndC
- Between these commands you may insert sorce code of any program
- written in the C language. The text of the program will be
- formatted using appropriate fonts. The macro recognises the
- following elements of a program:
- * keywords --- by default typeset in boldface
- * texts --- everything inside single quotes; by default slanted
- * comments --- both /*these...*/ and //these... , but not nested;
- italic typewriter
- * symbols --- operators, brackets, etc.; typewriter
- * compiler directives --- typeset using slanted typewriter font
- * identifiers --- everything that is none of the above; italic
- The macro does not change the layout of a program. All
- indentations are left as they are in the source program. No line
- breaks are inserted.
- NOTE: While compiling, the \BeginC ... \EndC macro reads the whole
- program into TeX's memory. Therefore, you may expect problems when
- typesetting huge programs in this way. In my configuration
- (emTeX under DOS) everything works fine if the program is not bigger
- than about 15KB. If you REALLY need to insert a vast program
- directly into your TeX source file you will have to split
- the program into smaller pieces, each inserted into a separate
- pair \BeginC ... \EndC.
-
- 2. \InsertC{filename}
- Inserts a C program from a separate file. The program is formatted
- as above. If you use DOS you need to remember that all backslashes
- in the pathname should be replaced by slashes.
- This macro has NO limitations for the size of the program --- it reads
- the file line by line, so TeX should never run out of memory.
-
-The list of keywords can be easily found in the cap_c.tex file. I do not
-guarantee that it is complete, so fell free to correct it if necessary.
-
-
- Programs in Pascal
---------------------
-In order to typeset programs in Pascal you need to \input the cap_pas.tex
-file. It contains two macros, as well:
-
- 1. \BeginPascal ... \EndPascal
-
- 2. \InsertPascal{filename}
-
-They work similarly. They recognise the same elements of a Pascal program.
-Both {this} and (*this*) kind of comment is accepted, but they cannot
-be nested. In case of \BeginPascal ... \EndPascal size limitations are
-similar as in C.
-
-The list of keywords was taken from Borland Delphi Help. If you need, you
-may modify it.
-
-
- Common
---------
-Fonts used to typeset programs are declared in the beginning of
-the cap_comm.tex file. They are easy to redefine if necessary.
-
-
- Note
-------
-If you modify aby of the files in any way, mark your changes, please.
-I do not want to take responsibility for other people's modifications.
-
-
-------------
-
- Michal Gulczynski
- mgulcz@we.tuniv.szczecin.pl