Init
This commit is contained in:
commit
6411beae7c
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*~
|
5
CHANGELOG.md
Normal file
5
CHANGELOG.md
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
<a name="0.9.0"></a>
|
||||
## 0.9.0
|
||||
|
||||
First official release
|
11
Jenkinsfile
vendored
Normal file
11
Jenkinsfile
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
pipeline {
|
||||
|
||||
node ('tau2013z') {
|
||||
|
||||
stage ('build-pdf') {
|
||||
sh """
|
||||
bash build.sh
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
61
README.md
Normal file
61
README.md
Normal file
@ -0,0 +1,61 @@
|
||||
Template for AMU thesis
|
||||
=======================
|
||||
|
||||
The template itself is in the `{{cookiecutter.thesis_type}}-{{cookiecutter.thesis_surname}}`.
|
||||
|
||||
In order to generate a project from the template:
|
||||
|
||||
* install cookiecutter
|
||||
* find a cookiecutter-applica-pypackage release applicable (usually the latest release/tag listed at <https://git.wmi.amu.edu.pl/filipg/cookiecutter-amu-thesis>), say VERSION
|
||||
* run: `cookiecutter https://git.wmi.amu.edu.pl/filipg/cookiecutter-amu-thesis.git --checkout VERSION`
|
||||
|
||||
Interoperation with Overleaf
|
||||
----------------------------
|
||||
|
||||
Overleaf handles git but it's very cr*ppy. It's better to upload a
|
||||
package to Overleaf first:
|
||||
|
||||
1. Create a project locally.
|
||||
2. Run `make`
|
||||
3. Run `make source-pack`
|
||||
4. Upload the zip file to Overleaf.
|
||||
5. Copy project to some other place.
|
||||
5. Clone the repo from Overleaf: `git clone https://git.overleaf.com/FUNNY-OVERLEAF-CODE PAPERID-paper`
|
||||
6. Set remotes:
|
||||
|
||||
```
|
||||
git remote add overleaf https://git.overleaf.com/FUNNY-OVERLEAF-CODE
|
||||
git remote set-url origin git@git.wmi.amu.edu.pl:YOURID/YOUR-GITLAB-REPO
|
||||
```
|
||||
|
||||
7. Set credential helper so that stupid Overleaf won't ask about
|
||||
password: `git config credential.helper "cache --timeout=10000000"`
|
||||
8. Unfortunately, Overleaf will discard hidden files (`.*`) when a zip
|
||||
is uploaded, also file permissions will be somewhat broken (did I
|
||||
tell you how much I hate Overleaf?)
|
||||
9. … so you need to copy `.cookiecutter.yml` file and re-apply the template (`cookiecutter https://git.wmi.amu.edu.pl/filipg/cookiecutter-amu-thesis.git --checkout VERSION --output-dir .. --config-file .cookiecutter.yml --no-input --overwrite-if-exists`)
|
||||
10. Re-commit the files (including recovered `.*` files).
|
||||
11. Push the repo to Overleaf (fortunately, the `.*` will be treated
|
||||
correctly when this is done by git): `git push overleaf master`
|
||||
12. Push the repo to GitLab. `git push origin master`
|
||||
13. Set the Overleaf git remote in `helpers/vars`
|
||||
14. Now you can synchronize between GitLab repo and Overleaf manually or using `helpers/synchro.sh` script
|
||||
|
||||
Updating package with updated template
|
||||
--------------------------------------
|
||||
|
||||
To keep your codebase in sync with template you need to occasionally reapply the template.
|
||||
Here's how:
|
||||
|
||||
* find a cookiecutter-amu-thesis release/tag applicable, say VERSION
|
||||
* (do *not* refer to master in your projects!)
|
||||
* go to project root
|
||||
* run: `cookiecutter https://git.wmi.amu.edu.pl/filipg/cookiecutter-amu-thesis.git --checkout VERSION --output-dir .. --config-file .cookiecutter.yml --no-input --overwrite-if-exists`
|
||||
* check changes with git
|
||||
|
||||
### Releasing a new version of the template
|
||||
|
||||
* add an item to `CHANGELOG.md`
|
||||
* in case of breaking changes (_M_ is incremented) describe clearly
|
||||
what actions are to be taken in `CHANGELOG.md`
|
||||
* tag master with the version
|
6
cookiecutter.json
Normal file
6
cookiecutter.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"thesis_type": "msc",
|
||||
"thesis_surname": "iksinski",
|
||||
"thesis_author": "Jan Iksiński",
|
||||
"thesis_title": "Przykładowa praca"
|
||||
}
|
10
hooks/post_gen_project.sh
Executable file
10
hooks/post_gen_project.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
if [ -e .git ]; then
|
||||
git checkout README.md main.tex abstract.tex preamble.tex appendix.tex metadata.tex bibliography.bib helpers/vars
|
||||
else
|
||||
git init
|
||||
git add --all
|
||||
git commit -m 'init'
|
||||
git remote add origin git@git.wmi.amu.edu.pl:{{cookiecutter.amu_id}}/{{cookiecutter.thesis_type}}-{{cookiecutter.thesis_surname}}.git
|
||||
fi
|
6
hooks/pre_gen_project.sh
Executable file
6
hooks/pre_gen_project.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
if [[ -e .git && ! -z "$(git status --untracked-files=no --porcelain)" ]]; then
|
||||
>&2 echo "Uncommited changes, commit your changes first"
|
||||
exit 1
|
||||
fi
|
@ -0,0 +1,6 @@
|
||||
default_context:
|
||||
thesis_type: '{{ cookiecutter.thesis_type }}'
|
||||
thesis_surname: '{{ cookiecutter.thesis_surname }}'
|
||||
thesis_author: '{{ cookiecutter.thesis_author }}'
|
||||
thesis_title: '{{ cookiecutter.thesis_title }}'
|
||||
amu_id: '{{ cookiecutter.amu_id }}'
|
150
{{cookiecutter.thesis_type}}-{{cookiecutter.thesis_surname}}/.gitignore
vendored
Normal file
150
{{cookiecutter.thesis_type}}-{{cookiecutter.thesis_surname}}/.gitignore
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# pycharm configs
|
||||
.idea
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
|
||||
#Intellij
|
||||
vcs.xml
|
||||
|
||||
# data generated by parser
|
||||
/data
|
||||
|
||||
# autogenerated
|
||||
/docs/source/reference/
|
||||
|
||||
# docs output
|
||||
/docs/build/
|
||||
|
||||
# Caches
|
||||
/.cache
|
||||
|
||||
# Emacs
|
||||
\#*\#
|
||||
.\#*
|
||||
|
||||
# JetBrains
|
||||
.idea
|
||||
|
||||
# Temporary
|
||||
*~
|
||||
|
||||
*.aux
|
||||
*.nav
|
||||
*.toc
|
||||
*.log
|
||||
*.out
|
||||
*.blg
|
||||
*.bbl
|
||||
*.synctex.gz
|
||||
*.fdb_latexmk
|
||||
*.fls
|
||||
*.prv
|
||||
/auto
|
||||
{{cookiecutter.thesis_surname}}.pdf
|
||||
{{cookiecutter.thesis_surname}}.zip
|
||||
autozoil-log.txt
|
||||
stats.txt
|
||||
abstract.txt
|
@ -0,0 +1,42 @@
|
||||
SHELL=/bin/bash
|
||||
|
||||
THESIS_ID={{cookiecutter.thesis_surname}}
|
||||
|
||||
all: $(THESIS_ID).pdf stats.txt
|
||||
|
||||
source-pack: $(THESIS_ID).zip
|
||||
|
||||
CONTENT_TEX_SOURCES=$(filter-out $(THESIS_ID).tex metadata.tex preamble.tex, $(wildcard *.tex))
|
||||
|
||||
CURRENT_DIR=$(shell pwd)
|
||||
AUTOZOIL_DIR?=/opt/autozoil
|
||||
|
||||
CONTENT_TEX_SOURCES_WITH_DIR := $(addprefix $(CURRENT_DIR)/, $(CONTENT_TEX_SOURCES))
|
||||
SCOREFILES=$(shell perl extract-score-files.pl $(CONTENT_TEX_SOURCES))
|
||||
|
||||
clean_latex_stuff=rm -rf *.aux *.nav *.toc *.log *.out *.blg *.bbl autozoil-log.txt $(THESIS_ID).pdf $(THESIS_ID).zip
|
||||
|
||||
stats.txt: $(THESIS_ID).pdf helpers/stats.sh
|
||||
bash helpers/stats.sh $< > $@
|
||||
cat $@
|
||||
|
||||
$(THESIS_ID).pdf: $(THESIS_ID).tex preamble.tex metadata.tex $(CONTENT_TEX_SOURCES) bibliography.bib $(SCOREFILES)
|
||||
pdflatex $<
|
||||
bibtex $(THESIS_ID)
|
||||
pdflatex $<
|
||||
pdflatex $<
|
||||
|
||||
scores/%.txt:
|
||||
mkdir -p scores
|
||||
curl "https://gonito.net/api/txt/score/"$* -o $@
|
||||
|
||||
autozoil-log.txt: $(CONTENT_TEX_SOURCES)
|
||||
cd $(AUTOZOIL_DIR) && set -o pipefail && ./autozoil --locale en_US $(CONTENT_TEX_SOURCES_WITH_DIR) --alt-log-file $(CURRENT_DIR)/$(THESIS_ID).log | tee $(CURRENT_DIR)/$@
|
||||
|
||||
$(THESIS_ID).zip:
|
||||
$(clean_latex_stuff)
|
||||
rm -rf *~
|
||||
zip -r $@ . -x '*.git*' '*.zip'
|
||||
|
||||
clean:
|
||||
$(clean_latex_stuff)
|
@ -0,0 +1 @@
|
||||
Master's thesis
|
@ -0,0 +1,17 @@
|
||||
{% raw %}
|
||||
%
|
||||
% Załączniki (opcjonalnie):
|
||||
\appendix
|
||||
\chapter{Tytuł załącznika jeden}
|
||||
|
||||
Treść załącznika jeden. Treść załącznika jeden. Treść załącznika jeden
|
||||
Treść załącznika jeden. Treść załącznika jeden.
|
||||
Treść załącznika
|
||||
jeden\index{żółw}\index{źdźbło}\index{zebra}.
|
||||
|
||||
\chapter{Tytuł załącznika dwa}
|
||||
|
||||
Treść załącznika dwa. Treść załącznika dwa. Treść załącznika dwa
|
||||
Treść załącznika dwa. Treść załącznika dwa.
|
||||
Treść załącznika dwa\index{system XML}.
|
||||
{% endraw %}
|
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker run -v $(pwd):/link -it loxygen/autozoil /opt/autozoil/autozoil --locale en_US /link/main.tex --alt-log-file /link/{{cookiecutter.thesis_surname}}.log
|
File diff suppressed because it is too large
Load Diff
3
{{cookiecutter.thesis_type}}-{{cookiecutter.thesis_surname}}/build.sh
Executable file
3
{{cookiecutter.thesis_type}}-{{cookiecutter.thesis_surname}}/build.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
make
|
3
{{cookiecutter.thesis_type}}-{{cookiecutter.thesis_surname}}/check.sh
Executable file
3
{{cookiecutter.thesis_type}}-{{cookiecutter.thesis_surname}}/check.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
make autozoil-log.txt
|
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
|
||||
my %found = ();
|
||||
|
||||
for my $filepath (@ARGV) {
|
||||
open(my $ih, '<', $filepath);
|
||||
binmode($ih, ':utf8');
|
||||
|
||||
while (my $line=<$ih>) {
|
||||
while ($line =~ m<\\gonito(?:barescore|score|entry)\{([^\}]+)\}>g) {
|
||||
$found{$1} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
close($ih);
|
||||
}
|
||||
|
||||
print join(" ", map { "scores/${_}.txt" } sort keys %found);
|
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
pdftotext "$1" - | grep '[^[:space:]]' | egrep '[a-zA-Z]{2}' | perl -pne 's/\f//g;'
|
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
here_dir=$(dirname "$0")
|
||||
echo $here_dir
|
||||
|
||||
pdf_file="$1"
|
||||
|
||||
if [[ "$pdf_file" == "" ]]
|
||||
then
|
||||
>&2 echo "no file given"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
perl -e 'print "PHYSICAL PAGES\tCHARACTERS WITH SPACES\tSTANDARD PAGES\n"'
|
||||
pages=$(pdfinfo "$1" | perl -ne 'print "$1\n" if /Pages:\s+(\d+)/')
|
||||
chars=$(bash $here_dir/pdf-to-plain-text.sh "$1" | wc -m)
|
||||
spages=$(echo "scale=1; $chars / 1800.0" | bc)
|
||||
echo "$pages $chars $spages"
|
@ -0,0 +1,24 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
. helpers/vars
|
||||
|
||||
if [[ "$OVERLEAF_GIT_URL" == "" ]]
|
||||
then
|
||||
>&2 echo "Please set OVERLEAF_GIT_URL in `helpers/vars`"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -e .git && ! -z "$(git status --untracked-files=no --porcelain)" ]]; then
|
||||
>&2 echo "Uncommited changes, commit your changes first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git remote add overleaf "$OVERLEAF_GIT_URL" || git remote set-url overleaf "$OVERLEAF_GIT_URL"
|
||||
|
||||
git config credential.helper "cache --timeout=10000000"
|
||||
|
||||
git pull origin master
|
||||
git pull overleaf master
|
||||
|
||||
git push overleaf master
|
||||
git push origin master
|
@ -0,0 +1,2 @@
|
||||
# to be included with .
|
||||
OVERLEAF_GIT_URL=
|
@ -0,0 +1,4 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
cp hooks/pre-push .git/hooks/pre-push
|
||||
chmod 700 .git/hooks/pre-push
|
@ -0,0 +1,59 @@
|
||||
{% raw %}
|
||||
%
|
||||
% Wstęp
|
||||
\introduction
|
||||
|
||||
Aczkolwiek w~ciągu ostatnich lat skład tekstu wspomagany
|
||||
komputerowo całkowicie wyeliminował stosowanie tradycyjnych technik
|
||||
drukarskich, to podobny \code{Gimmel\dbr ::Parser\dbr::ElementSpecification}, proces w~przypadku publikacji elektronicznych
|
||||
czyli publikacji, które w~ogóle nie wykorzystują papieru, a~nośnikem
|
||||
informacji staje się ekran komputera nie jest obserwowany.
|
||||
|
||||
Formatowanie wizualne, powstało z~myślą o~przygotowaniu publikacji do
|
||||
druku i~dlatego nie może sprostać nowym potrzebom, które stwarza
|
||||
postęp techniki. Coraz większą rolę odgrywają dziś elektroniczne
|
||||
repozytoria, bazy danych, publikacje na CD-Romach oraz WWW. Wypływa
|
||||
też stąd ważny wniosek, że tworzenie dokumentów według paradygmatu
|
||||
WYSIWYG nie jest efektywne i~stopniowo należy oczekiwać powstawania,
|
||||
wdrażania i~rozpowszechniania się systemów opartych na paradygmacie
|
||||
\emph{formatowania strukturalnego}.
|
||||
|
||||
W~dokumencie formatowanym strukturalnie oznaczana jest struktura
|
||||
dokumentu a~nie określany jego wygląd. Zwróćmy uwagę, że układ
|
||||
graficzny jest pochodną struktury, tj. nadajemy jednolity wygląd
|
||||
tytułom rozdziałów, śródtytułów, przypisów, jednakowo wyróżniamy
|
||||
wyliczenia itp. Układ graficzny jak już wspominano może ulegać zmianie
|
||||
(np. wraz z~rozpowszechnianiem się nowych technologii wydawniczych)
|
||||
ale treść i~struktura raczej nie, np. Biblia Gutenberga widziana z~tej
|
||||
perspektywy nie zmieniła się wcale.
|
||||
|
||||
% Na końcu tytułów, śródtytułów, tytułów rysunków i tabel
|
||||
% _nie_ umieszcza się kropki
|
||||
\chapter{Wprowadzenie do standardów SGML/XML}
|
||||
|
||||
\code{<student id="10">}
|
||||
\\\\
|
||||
\code{//BBB[normalize-space(text()) = "czwarty"]}
|
||||
|
||||
SGML~\cite{Goldfarb} jest to \emph{metajęzyk} służący do opisywania
|
||||
struktury i~zawartości dokumentów (standard ISO 8879). Do
|
||||
podstawowych zalet takiego podejścia należy:
|
||||
\begin{itemize}
|
||||
\item
|
||||
jest to międzynarodowy
|
||||
standard dostępny na wielu platformach sprzętowo{\dywiz}systemowych;
|
||||
\item
|
||||
jest to
|
||||
język opisu \emph{każdego\/} dokumentu, o~praktycznie nieograniczonych
|
||||
możliwościach (\emph{rozszerzalność\/})
|
||||
\item
|
||||
umożliwia powtórne
|
||||
wykorzystywanie dokumentów, także w sposób inny od poprzedniego
|
||||
(np. tradycyjna książka i~dokument multimedialny utworzony z~tego
|
||||
samego dokumentu SGML-owego).
|
||||
\end{itemize}
|
||||
\lstset{emph={square},emphstyle=\color{red}}
|
||||
\begin{lstlisting}
|
||||
square
|
||||
\end{lstlisting}
|
||||
{% endraw %}
|
@ -0,0 +1,27 @@
|
||||
{% raw %}
|
||||
% Opcjonalnie identyfikator dokumentu (drukowany tylko z włączoną opcją `brudnopis'):
|
||||
\nrwersji {0.1}
|
||||
|
||||
% Dane autora(ów):
|
||||
\author {Walenty Szczęsny}
|
||||
\nralbumu {rr000000001}
|
||||
\email {walenty@szczesny.com.pl}
|
||||
|
||||
\author {Monika A.~Szczęsna-Woś}
|
||||
\nralbumu {rr000000002}
|
||||
|
||||
% Tytuł pracy:
|
||||
\title {Dokumenty strukturalne: teoria i~zastosowania}
|
||||
|
||||
% Kierunek, tj. katedra/instytut promotora:
|
||||
\kierunek {Informatyka Ekonomiczna}
|
||||
|
||||
% Rok obrony:
|
||||
\date {2001}
|
||||
|
||||
% Jeżeli nie podano miejsca zostanie wpisany `Sopot'
|
||||
\miejsce {Wejherowo}
|
||||
|
||||
% Tytuł naukowy, imię i nazwisko promotora:
|
||||
\opiekun {dra hab. Jan Kowalski}
|
||||
{% endraw %}
|
@ -0,0 +1,5 @@
|
||||
{% raw %}
|
||||
%
|
||||
% Miejsce na deklaracje własnych poleceń:
|
||||
\newcommand{\filename}[1]{\texttt{#1}}
|
||||
{% endraw %}
|
26
{{cookiecutter.thesis_type}}-{{cookiecutter.thesis_surname}}/uam-wmi-msc/.gitignore
vendored
Normal file
26
{{cookiecutter.thesis_type}}-{{cookiecutter.thesis_surname}}/uam-wmi-msc/.gitignore
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
ext/plmindex/plmindex
|
||||
sample/sample.aux
|
||||
sample/sample.bbl
|
||||
sample/sample.blg
|
||||
sample/sample.brf
|
||||
sample/sample.idx
|
||||
sample/sample.ind
|
||||
sample/sample.lof
|
||||
sample/sample.log
|
||||
sample/sample.lot
|
||||
sample/sample.out
|
||||
sample/sample.pdf
|
||||
sample/sample.toc
|
||||
*~
|
||||
*.aux
|
||||
*.bbl
|
||||
*.blg
|
||||
*.brf
|
||||
*.idx
|
||||
*.ind
|
||||
*.lof
|
||||
*.log
|
||||
*.lot
|
||||
*.out
|
||||
*.toc
|
||||
{{cookiecutter.thesis_surname}}.pdf
|
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
check()
|
||||
{
|
||||
if [[ "$CHECK" == "1" ]]
|
||||
then
|
||||
bash ./check.sh $MGRDIR
|
||||
fi
|
||||
}
|
||||
|
||||
# pomocniczy skrypt generujący daną pracę magisterską z czystej kopii z repozytorium
|
||||
|
||||
if [[ "$1" == "--check" ]]
|
||||
then
|
||||
shift
|
||||
echo "will be checking"
|
||||
CHECK=1
|
||||
fi
|
||||
|
||||
MGRDIR=$1
|
||||
|
||||
if [[ ! -d "$MGRDIR" ]]
|
||||
then
|
||||
echo "unknown name: $MGRDIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(cd ext/plmindex ; make) && (cd $MGRDIR ; make) && check
|
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
MGRDIR="$1"
|
||||
HEREDIR=`pwd`
|
||||
FULLMGRDIR="$HEREDIR/$MGRDIR"
|
||||
AUTOZOIL=${AUTOZOIL:-../autozoil}
|
||||
|
||||
if [[ "$MGRDIR" == "" ]]
|
||||
then
|
||||
echo "no directory given!!!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "AUTOZOIL IN '$AUTOZOIL'"
|
||||
cd $AUTOZOIL
|
||||
|
||||
if [[ ! -d "$FULLMGRDIR" ]]
|
||||
then
|
||||
echo "no directory for '$FULLMGRDIR'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SOURCE_FILE_PREFIX=`basename $MGRDIR`
|
||||
|
||||
FILES_TO_CHECK=`ls $FULLMGRDIR/*.tex | grep -v '.*-form.tex'`
|
||||
|
||||
echo "CHECKING: $FILES_TO_CHECK"
|
||||
|
||||
PERL5LIB=. perl autozoil.pl --locale ${AUTOZOIL_LOCALE:-pl_PL} $FILES_TO_CHECK --format xml --source-file-prefix "${SOURCE_FILE_PREFIX}/" > $FULLMGRDIR/autozoil.xml || exit 0
|
@ -0,0 +1,40 @@
|
||||
CC = gcc
|
||||
O = .o
|
||||
X =
|
||||
|
||||
XCFLAGS= -unsigned-char -O2 -g -pedantic -DDEFAULT_LANGUAGE=PL_latin2
|
||||
LIBS =
|
||||
|
||||
CFLAGS= $(XCFLAGS)
|
||||
LDFLAGS = -g
|
||||
|
||||
HDRS = mkind.h scanid.h scanst.h
|
||||
|
||||
MAKEFILE = makefile.gcc
|
||||
|
||||
OBJS = genind$(O) qsort$(O) mkind$(O) scanid$(O) scanst$(O) \
|
||||
sortid$(O) decode_n$(O) language$(O)
|
||||
|
||||
SRCS = genind.c mkind.c scanid.c scanst.c qsort.c sortid.c decode_n.c\
|
||||
language.c
|
||||
|
||||
PROGRAM = plmindex
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $*.c
|
||||
|
||||
$(PROGRAM): $(OBJS) $(MAKEFILE)
|
||||
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||
rm *.o
|
||||
|
||||
genind$(O): genind.c mkind.h
|
||||
mkind$(O): mkind.c mkind.h
|
||||
qsort$(O): qsort.c mkind.h
|
||||
scanid$(O): scanid.c mkind.h scanid.h
|
||||
scanst$(O): scanst.c mkind.h scanst.h
|
||||
sortid$(O): sortid.c mkind.h
|
||||
language$(O): pl_maz.h pl_iso2.h us_eng.h pl_1250.h pl_852.h mkind.h
|
||||
mkind.h: myctype.h
|
||||
clean:
|
||||
rm plmindex
|
||||
|
@ -0,0 +1,197 @@
|
||||
#include "mkind.h"
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
|
||||
Local char_u *myconcat(char_u *, const char_u *);
|
||||
Local void get_jed(int *lll, long licz);
|
||||
Local char_u *dec_text(Logical flag, int *zzz, char_u *text);
|
||||
|
||||
#define EOS '\0'
|
||||
|
||||
Local int tab_jed[5],
|
||||
tab_tys[5],
|
||||
tab_mil[5];
|
||||
|
||||
|
||||
Public char_u *
|
||||
Decode_Number(const long liczba)
|
||||
|
||||
{
|
||||
|
||||
long licz;
|
||||
char_u *text;
|
||||
|
||||
if(liczba >= 1000000000L)
|
||||
{
|
||||
fprintf(stderr, "Number to big");
|
||||
exit(1);
|
||||
}
|
||||
if((text = (char_u *)malloc(strlen("") + 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can`t allocate memory");
|
||||
exit(1);
|
||||
}
|
||||
*text = EOS;
|
||||
get_jed(tab_jed, liczba);
|
||||
if(tab_jed[3] > 0)
|
||||
get_jed(tab_tys, tab_jed[3]);
|
||||
if(tab_jed[4] > 0)
|
||||
get_jed(tab_mil, tab_jed[4]);
|
||||
|
||||
if(tab_jed[4] > 0)
|
||||
{
|
||||
text = dec_text(False, tab_mil, text);
|
||||
if(tab_mil[0] < 5 &&
|
||||
(tab_mil[0] > 1 || (tab_mil[1] == 0 && tab_mil[2] == 0)))
|
||||
{
|
||||
text = myconcat(text,
|
||||
(*multilanguage[Language].decode->mil)[tab_mil[0]]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
text = myconcat(text, (*multilanguage[Language].decode->mil)[5]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
}
|
||||
if(tab_jed[3] > 0)
|
||||
{
|
||||
text = dec_text(False, tab_tys, text);
|
||||
if(tab_tys[0] < 5 &&
|
||||
(tab_tys[0] > 1 || (tab_tys[1] == 0 && tab_tys[2] == 0)))
|
||||
{
|
||||
text = myconcat(text,
|
||||
(*multilanguage[Language].decode->tys)[tab_tys[0]]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
text = myconcat(text, (*multilanguage[Language].decode->tys)[5]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
}
|
||||
text = dec_text(True, tab_jed, text);
|
||||
return(text);
|
||||
}
|
||||
|
||||
Local void
|
||||
get_jed(int *lll, long licz)
|
||||
|
||||
{
|
||||
char *buffer;
|
||||
int ii,
|
||||
kk;
|
||||
|
||||
if((buffer = (char *)malloc(10)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can`t allocate memory");
|
||||
exit(1);
|
||||
}
|
||||
sprintf(buffer, "%ld", licz);
|
||||
|
||||
ii = strlen(buffer);
|
||||
free(buffer);
|
||||
|
||||
for(kk = 0; kk < ii;)
|
||||
{
|
||||
if(licz < 10L)
|
||||
{
|
||||
lll[0] = licz;
|
||||
kk++;
|
||||
}
|
||||
else if(licz < 100L)
|
||||
{
|
||||
if(licz < 20L)
|
||||
{
|
||||
lll[0] = licz;
|
||||
kk++;
|
||||
}
|
||||
else
|
||||
{
|
||||
lll[1] = licz / 10;
|
||||
licz = licz - lll[1] * 10;
|
||||
kk++;
|
||||
}
|
||||
}
|
||||
else if(licz < 1000L)
|
||||
{
|
||||
lll[2] = licz / 100L;
|
||||
licz = licz - lll[2] * 100L;
|
||||
kk++;
|
||||
}
|
||||
else if(licz < 1000000L)
|
||||
{
|
||||
lll[3] = licz / 1000L;
|
||||
licz = licz - lll[3] * 1000L;
|
||||
kk++;
|
||||
}
|
||||
else if(licz < 1000000000L)
|
||||
{
|
||||
lll[4] = licz / 1000000L;
|
||||
licz = licz - lll[4] * 1000000L;
|
||||
kk += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Local char_u *
|
||||
dec_text(Logical flag, int *zzz, char_u *text)
|
||||
|
||||
{
|
||||
if(zzz[2] > 0)
|
||||
{
|
||||
text = myconcat(text,
|
||||
(*multilanguage[Language].decode->setki)[zzz[2]]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
if(zzz[1] > 0)
|
||||
{
|
||||
text = myconcat(text,
|
||||
(*multilanguage[Language].decode->dies)[zzz[1] - 1]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
if(zzz[0] > 0 && (flag || (zzz[0] != 1 || (zzz[1] > 0 || zzz[2] > 0))))
|
||||
{
|
||||
text = myconcat(text,
|
||||
(*multilanguage[Language].decode->jedn)[zzz[0]]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
return(text);
|
||||
}
|
||||
|
||||
Local char_u *
|
||||
myconcat(char_u *str, const char_u *addstr)
|
||||
|
||||
{
|
||||
char *tmp_str;
|
||||
|
||||
if((tmp_str = (char *)malloc(strlen((char *)str) +
|
||||
strlen((char *)addstr) + 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can`t allocate memory");
|
||||
exit(1);
|
||||
}
|
||||
strcpy(tmp_str, (char *)str);
|
||||
strcat(tmp_str, (char *)addstr);
|
||||
free(str);
|
||||
return((char_u *)tmp_str);
|
||||
}
|
||||
|
||||
#ifdef D_DEBUG
|
||||
|
||||
void
|
||||
main(int argc, char *argv[])
|
||||
|
||||
{
|
||||
long num;
|
||||
|
||||
if(argc < 2)
|
||||
{
|
||||
fprintf(stderr, "liczba <liczba>\n");
|
||||
exit(1);
|
||||
}
|
||||
num = atol(argv[1]);
|
||||
printf("%s\n", Decode_Number(num));
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,196 @@
|
||||
#include "mkind.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
Local char_u *myconcat(char_u *, const char_u *);
|
||||
Local void get_jed(int *lll, long licz);
|
||||
Local char_u *dec_text(Logical flag, int *zzz, char_u *text);
|
||||
|
||||
#define EOS '\0'
|
||||
|
||||
Local int tab_jed[5],
|
||||
tab_tys[5],
|
||||
tab_mil[5];
|
||||
|
||||
|
||||
Public char_u *
|
||||
Decode_Number(const long liczba)
|
||||
|
||||
{
|
||||
|
||||
long licz;
|
||||
char_u *text;
|
||||
|
||||
if(liczba >= 1000000000L)
|
||||
{
|
||||
fprintf(stderr, "Number to big");
|
||||
exit(1);
|
||||
}
|
||||
if((text = (char_u *)malloc(strlen("") + 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can`t allocate memory");
|
||||
exit(1);
|
||||
}
|
||||
*text = EOS;
|
||||
get_jed(tab_jed, liczba);
|
||||
if(tab_jed[3] > 0)
|
||||
get_jed(tab_tys, tab_jed[3]);
|
||||
if(tab_jed[4] > 0)
|
||||
get_jed(tab_mil, tab_jed[4]);
|
||||
|
||||
if(tab_jed[4] > 0)
|
||||
{
|
||||
text = dec_text(False, tab_mil, text);
|
||||
if(tab_mil[0] < 5 &&
|
||||
(tab_mil[0] > 1 || (tab_mil[1] == 0 && tab_mil[2] == 0)))
|
||||
{
|
||||
text = myconcat(text,
|
||||
(*multilanguage[Language].decode->mil)[tab_mil[0]]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
text = myconcat(text, (*multilanguage[Language].decode->mil)[5]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
}
|
||||
if(tab_jed[3] > 0)
|
||||
{
|
||||
text = dec_text(False, tab_tys, text);
|
||||
if(tab_tys[0] < 5 &&
|
||||
(tab_tys[0] > 1 || (tab_tys[1] == 0 && tab_tys[2] == 0)))
|
||||
{
|
||||
text = myconcat(text,
|
||||
(*multilanguage[Language].decode->tys)[tab_tys[0]]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
text = myconcat(text, (*multilanguage[Language].decode->tys)[5]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
}
|
||||
text = dec_text(True, tab_jed, text);
|
||||
return(text);
|
||||
}
|
||||
|
||||
Local void
|
||||
get_jed(int *lll, long licz)
|
||||
|
||||
{
|
||||
char *buffer;
|
||||
int ii,
|
||||
kk;
|
||||
|
||||
if((buffer = (char *)malloc(10)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can`t allocate memory");
|
||||
exit(1);
|
||||
}
|
||||
sprintf(buffer, "%ld", licz);
|
||||
|
||||
ii = strlen(buffer);
|
||||
free(buffer);
|
||||
|
||||
for(kk = 0; kk < ii;)
|
||||
{
|
||||
if(licz < 10L)
|
||||
{
|
||||
lll[0] = licz;
|
||||
kk++;
|
||||
}
|
||||
else if(licz < 100L)
|
||||
{
|
||||
if(licz < 20L)
|
||||
{
|
||||
lll[0] = licz;
|
||||
kk++;
|
||||
}
|
||||
else
|
||||
{
|
||||
lll[1] = licz / 10;
|
||||
licz = licz - lll[1] * 10;
|
||||
kk++;
|
||||
}
|
||||
}
|
||||
else if(licz < 1000L)
|
||||
{
|
||||
lll[2] = licz / 100L;
|
||||
licz = licz - lll[2] * 100L;
|
||||
kk++;
|
||||
}
|
||||
else if(licz < 1000000L)
|
||||
{
|
||||
lll[3] = licz / 1000L;
|
||||
licz = licz - lll[3] * 1000L;
|
||||
kk++;
|
||||
}
|
||||
else if(licz < 1000000000L)
|
||||
{
|
||||
lll[4] = licz / 1000000L;
|
||||
licz = licz - lll[4] * 1000000L;
|
||||
kk += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Local char_u *
|
||||
dec_text(Logical flag, int *zzz, char_u *text)
|
||||
|
||||
{
|
||||
if(zzz[2] > 0)
|
||||
{
|
||||
text = myconcat(text,
|
||||
(*multilanguage[Language].decode->setki)[zzz[2]]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
if(zzz[1] > 0)
|
||||
{
|
||||
text = myconcat(text,
|
||||
(*multilanguage[Language].decode->dies)[zzz[1] - 1]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
if(zzz[0] > 0 && (flag || (zzz[0] != 1 || (zzz[1] > 0 || zzz[2] > 0))))
|
||||
{
|
||||
text = myconcat(text,
|
||||
(*multilanguage[Language].decode->jedn)[zzz[0]]);
|
||||
text = myconcat(text, (char_u *)" ");
|
||||
}
|
||||
return(text);
|
||||
}
|
||||
|
||||
Local char_u *
|
||||
myconcat(char_u *str, const char_u *addstr)
|
||||
|
||||
{
|
||||
char *tmp_str;
|
||||
|
||||
if((tmp_str = (char *)malloc(strlen((char *)str) +
|
||||
strlen((char *)addstr) + 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can`t allocate memory");
|
||||
exit(1);
|
||||
}
|
||||
strcpy(tmp_str, (char *)str);
|
||||
strcat(tmp_str, (char *)addstr);
|
||||
free(str);
|
||||
return((char_u *)tmp_str);
|
||||
}
|
||||
|
||||
#ifdef D_DEBUG
|
||||
|
||||
void
|
||||
main(int argc, char *argv[])
|
||||
|
||||
{
|
||||
long num;
|
||||
|
||||
if(argc < 2)
|
||||
{
|
||||
fprintf(stderr, "liczba <liczba>\n");
|
||||
exit(1);
|
||||
}
|
||||
num = atol(argv[1]);
|
||||
printf("%s\n", Decode_Number(num));
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,516 @@
|
||||
/*
|
||||
*
|
||||
* This file is part of
|
||||
* MakeIndex - A formatter and format independent index processor
|
||||
*
|
||||
* Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
|
||||
* Copyright (C) 1988 by Olivetti Research Center
|
||||
* Copyright (C) 1987 by Regents of the University of California
|
||||
*
|
||||
* Author:
|
||||
* Pehong Chen
|
||||
* Chen & Harrison International Systems, Inc.
|
||||
* Palo Alto, California
|
||||
* USA
|
||||
* (phc@renoir.berkeley.edu or chen@orc.olivetti.com)
|
||||
*
|
||||
* Contributors:
|
||||
* Please refer to the CONTRIB file that comes with this release
|
||||
* for a list of people who have contributed to this and/or previous
|
||||
* release(s) of MakeIndex.
|
||||
*
|
||||
* All rights reserved by the copyright holders. See the copyright
|
||||
* notice distributed with this software for a complete description of
|
||||
* the conditions under which it is made available.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mkind.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#if sun /* avoid conflict with symbol in */
|
||||
/* /usr/lang/SC1.0/include/CC/stdlib.h */
|
||||
#define end the_end
|
||||
#endif
|
||||
|
||||
Local FIELD_PTR curr = NULL;
|
||||
Local FIELD_PTR prev = NULL;
|
||||
Local FIELD_PTR begin = NULL;
|
||||
Local FIELD_PTR end = NULL;
|
||||
Local FIELD_PTR range_ptr;
|
||||
Local int level = 0;
|
||||
Local int prev_level = 0;
|
||||
Local unsigned char *encap = NULL;
|
||||
Local unsigned char *prev_encap = NULL;
|
||||
Local Logical in_range = False;
|
||||
Local Logical encap_range = False;
|
||||
Local char buff[2 * ARGUMENT_MAX];
|
||||
Local char line[2 * ARGUMENT_MAX]; /* output buffer */
|
||||
Local int ind_lc = 0; /* overall line count */
|
||||
Local int ind_ec = 0; /* erroneous line count */
|
||||
Local int ind_indent;
|
||||
|
||||
Local void Ind_Error (const char *F, ...);
|
||||
Local void flush_line (int print);
|
||||
Local void insert_page (void);
|
||||
Local int make_entry (int n);
|
||||
Local void make_item (unsigned char* term);
|
||||
Local void new_entry (void);
|
||||
Local void old_entry (void);
|
||||
Local int page_diff (struct KFIELD *a, struct KFIELD *b);
|
||||
Local void put_header (unsigned char let);
|
||||
Local void wrap_line (int print);
|
||||
|
||||
Public void
|
||||
gen_ind(VOID_ARG)
|
||||
|
||||
{
|
||||
int n;
|
||||
int tmp_lc;
|
||||
|
||||
Message("Generating output file %s...", ind_fn);
|
||||
fputs(preamble, ind_fp);
|
||||
ind_lc += prelen;
|
||||
if(init_page)
|
||||
insert_page();
|
||||
|
||||
/* reset counters for putting out dots */
|
||||
idx_dc = 0;
|
||||
for(n = 0; n < idx_gt; n++)
|
||||
{
|
||||
if(idx_key[n]->type != DUPLICATE)
|
||||
if(make_entry(n))
|
||||
{
|
||||
idx_dot = True;
|
||||
if(idx_dc++ == 0)
|
||||
Message(DOT);
|
||||
if(idx_dc == DOT_MAX)
|
||||
idx_dc = 0;
|
||||
}
|
||||
}
|
||||
tmp_lc = ind_lc;
|
||||
if(in_range)
|
||||
{
|
||||
curr = range_ptr;
|
||||
Ind_Error("Unmatched range opening operator %c.\n", idx_ropen);
|
||||
}
|
||||
prev = curr;
|
||||
flush_line(True);
|
||||
fputs(delim_t, ind_fp);
|
||||
fputs(postamble, ind_fp);
|
||||
tmp_lc = ind_lc + postlen;
|
||||
if(ind_ec == 1)
|
||||
Message("done (%d %s, %d %s).\n", tmp_lc, "lines written", ind_ec,
|
||||
"warning");
|
||||
else
|
||||
Message("done (%d %s, %d %s).\n", tmp_lc, "lines written", ind_ec,
|
||||
"warnings");
|
||||
}
|
||||
|
||||
|
||||
Local int
|
||||
make_entry(int n)
|
||||
|
||||
{
|
||||
unsigned char let;
|
||||
|
||||
/* determine current and previous pointer */
|
||||
prev = curr;
|
||||
curr = idx_key[n];
|
||||
/* check if current entry is in range */
|
||||
|
||||
if((*curr->encap == idx_ropen) || (*curr->encap == idx_rclose))
|
||||
encap = &(curr->encap[1]);
|
||||
else
|
||||
encap = curr->encap;
|
||||
|
||||
/* determine the current nesting level */
|
||||
if(n == 0)
|
||||
{
|
||||
prev_level = level = 0;
|
||||
let = *curr->sf[0];
|
||||
put_header(let);
|
||||
make_item(EMPTY_STRING);
|
||||
}
|
||||
else
|
||||
{
|
||||
prev_level = level;
|
||||
for(level = 0; level < FIELD_MAX; level++)
|
||||
if(STRNEQ(curr->sf[level], prev->sf[level]) ||
|
||||
STRNEQ(curr->af[level], prev->af[level]))
|
||||
break;
|
||||
if(level < FIELD_MAX)
|
||||
new_entry();
|
||||
else
|
||||
old_entry();
|
||||
}
|
||||
|
||||
if(*curr->encap == idx_ropen)
|
||||
if(in_range)
|
||||
Ind_Error("Extra range opening operator %c.\n", idx_ropen);
|
||||
else
|
||||
{
|
||||
in_range = True;
|
||||
range_ptr = curr;
|
||||
}
|
||||
else if(*curr->encap == idx_rclose)
|
||||
if(in_range)
|
||||
{
|
||||
in_range = False;
|
||||
if(STRNEQ(&(curr->encap[1]), EMPTY_STRING) &&
|
||||
STRNEQ(prev_encap, &(curr->encap[1])))
|
||||
Ind_Error("Range closing operator has an " \
|
||||
"inconsistent encapsulator %s.\n", &(curr->encap[1]));
|
||||
}
|
||||
else
|
||||
Ind_Error("Unmatched range closing operator %c.\n", idx_rclose);
|
||||
else if((*curr->encap != EOS) &&
|
||||
STRNEQ(curr->encap, prev_encap) && in_range)
|
||||
Ind_Error("Inconsistent page encapsulator %s within range.\n",
|
||||
curr->encap);
|
||||
return(1);
|
||||
}
|
||||
|
||||
Local void
|
||||
make_item(unsigned char *term)
|
||||
|
||||
{
|
||||
int i;
|
||||
|
||||
if(level > prev_level)
|
||||
{
|
||||
/* ascending level */
|
||||
if(*curr->af[level] == EOS)
|
||||
sprintf(line, "%s%s%s", term, item_u[level], curr->sf[level]);
|
||||
else
|
||||
sprintf(line, "%s%s%s", term, item_u[level], curr->af[level]);
|
||||
ind_lc += ilen_u[level];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* same or descending level */
|
||||
if(*curr->af[level] == EOS)
|
||||
sprintf(line, "%s%s%s", term, item_r[level], curr->sf[level]);
|
||||
else
|
||||
sprintf(line, "%s%s%s", term, item_r[level], curr->af[level]);
|
||||
ind_lc += ilen_r[level];
|
||||
}
|
||||
|
||||
i = level + 1;
|
||||
while(i < FIELD_MAX && *curr->sf[i] != EOS)
|
||||
{
|
||||
fputs(line, ind_fp);
|
||||
if(*curr->af[i] == EOS)
|
||||
sprintf(line, "%s%s", item_x[i], curr->sf[i]);
|
||||
else
|
||||
sprintf(line, "%s%s", item_x[i], curr->af[i]);
|
||||
ind_lc += ilen_x[i];
|
||||
level = i; /* Added at 2.11 <brosig@gmdzi.gmd.de> */
|
||||
i++;
|
||||
}
|
||||
|
||||
ind_indent = 0;
|
||||
strcat(line, delim_p[level]);
|
||||
begin = end = curr;
|
||||
prev_encap = encap;
|
||||
}
|
||||
|
||||
Local void
|
||||
new_entry(VOID_ARG)
|
||||
|
||||
{
|
||||
unsigned char let;
|
||||
FIELD_PTR ptr;
|
||||
|
||||
if(in_range)
|
||||
{
|
||||
ptr = curr;
|
||||
curr = range_ptr;
|
||||
Ind_Error("Unmatched range opening operator %c.\n", idx_ropen);
|
||||
in_range = False;
|
||||
curr = ptr;
|
||||
}
|
||||
flush_line(True);
|
||||
|
||||
/* beginning of a new group? */
|
||||
|
||||
if(((curr->group != ALPHA) && (curr->group != prev->group) &&
|
||||
(prev->group == SYMBOL)) || ((curr->group == ALPHA) &&
|
||||
((let = TOLOWER(curr->sf[0][0])) !=
|
||||
(TOLOWER(prev->sf[0][0])))))
|
||||
{
|
||||
fputs(delim_t, ind_fp);
|
||||
fputs(group_skip, ind_fp);
|
||||
ind_lc += skiplen;
|
||||
/* beginning of a new letter? */
|
||||
put_header(let);
|
||||
make_item(EMPTY_STRING);
|
||||
}
|
||||
else
|
||||
make_item((unsigned char *)delim_t);
|
||||
}
|
||||
|
||||
Local void
|
||||
old_entry(VOID_ARG)
|
||||
|
||||
{
|
||||
int diff;
|
||||
|
||||
/* current entry identical to previous one: append pages */
|
||||
|
||||
diff = page_diff(end, curr);
|
||||
|
||||
if((prev->type == curr->type) && (diff != -1) &&
|
||||
(((diff == 0) && (prev_encap != NULL) && STREQ(encap, prev_encap)) ||
|
||||
(merge_page && (diff == 1) &&
|
||||
(prev_encap != NULL) && STREQ(encap, prev_encap)) || in_range))
|
||||
{
|
||||
end = curr;
|
||||
/* extract in-range encaps out */
|
||||
|
||||
if(in_range && (*curr->encap != EOS) &&
|
||||
(*curr->encap != idx_rclose) && STRNEQ(curr->encap, prev_encap))
|
||||
{
|
||||
sprintf(buff, "%s%s%s%s%s", encap_p, curr->encap,
|
||||
encap_i, curr->lpg, encap_s);
|
||||
wrap_line(False);
|
||||
}
|
||||
if(in_range)
|
||||
encap_range = True;
|
||||
}
|
||||
else
|
||||
{
|
||||
flush_line(False);
|
||||
if((diff == 0) && (prev->type == curr->type))
|
||||
Ind_Error("Conflicting entries: multiple encaps for the same " \
|
||||
"page under same key.\n");
|
||||
else if(in_range && (prev->type != curr->type))
|
||||
Ind_Error("Illegal range formation: starting & ending pages are " \
|
||||
"of different types.\n");
|
||||
else if(in_range && (diff == -1))
|
||||
Ind_Error("Illegal range formation: starting & ending pages " \
|
||||
"cross chap/sec breaks.\n");
|
||||
begin = end = curr;
|
||||
prev_encap = encap;
|
||||
}
|
||||
}
|
||||
|
||||
Local int
|
||||
#if STDC
|
||||
page_diff(FIELD_PTR a, FIELD_PTR b)
|
||||
# else
|
||||
page_diff(a, b)
|
||||
FIELD_PTR a;
|
||||
FIELD_PTR b;
|
||||
#endif
|
||||
|
||||
{
|
||||
short i;
|
||||
|
||||
if(a->count != b->count)
|
||||
return(-1);
|
||||
for(i = 0; i < a->count - 1; i++)
|
||||
if(a->npg[i] != b->npg[i])
|
||||
return(-1);
|
||||
return(b->npg[b->count - 1] - a->npg[a->count - 1]);
|
||||
}
|
||||
|
||||
Local void
|
||||
put_header(unsigned char let)
|
||||
|
||||
{
|
||||
if(headings_flag != 0)
|
||||
{
|
||||
fputs(heading_pre, ind_fp);
|
||||
ind_lc += headprelen;
|
||||
switch(curr->group)
|
||||
{
|
||||
case SYMBOL:
|
||||
if(headings_flag > 0)
|
||||
fputs(symhead_pos, ind_fp);
|
||||
else
|
||||
fputs(symhead_neg, ind_fp);
|
||||
break;
|
||||
case ALPHA:
|
||||
if(headings_flag > 0)
|
||||
fputc(TOUPPER(let), ind_fp);
|
||||
else
|
||||
fputc(TOLOWER(let), ind_fp);
|
||||
break;
|
||||
default:
|
||||
if(headings_flag > 0)
|
||||
fputs(numhead_pos, ind_fp);
|
||||
else
|
||||
fputs(numhead_neg, ind_fp);
|
||||
break;
|
||||
}
|
||||
fputs(heading_suf, ind_fp);
|
||||
ind_lc += headsuflen;
|
||||
}
|
||||
}
|
||||
|
||||
/* changes for 2.12 (May 20, 1993) by Julian Reschke (jr@ms.maus.de):
|
||||
Use keywords suffix_2p, suffix_3p or suffix_mp for one, two or
|
||||
multiple page ranges (when defined) */
|
||||
|
||||
Local void
|
||||
#if STDC
|
||||
flush_line(int print)
|
||||
# else
|
||||
flush_line(print)
|
||||
int print;
|
||||
#endif
|
||||
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
if((tmp = (char *) calloc(1, sizeof(buff))) == NULL)
|
||||
Fatal("Not enough core...abort.\n");
|
||||
if(page_diff(begin, end) != 0)
|
||||
if(encap_range || (page_diff(begin, prev) > (*suffix_2p ? 0 : 1)))
|
||||
{
|
||||
int diff = page_diff(begin, end);
|
||||
|
||||
if((diff == 1) && *suffix_2p)
|
||||
sprintf(buff, "%s%s", begin->lpg, suffix_2p);
|
||||
else if((diff == 2) && *suffix_3p)
|
||||
sprintf(buff, "%s%s", begin->lpg, suffix_3p);
|
||||
else if((diff >= 2) && *suffix_mp)
|
||||
sprintf(buff, "%s%s", begin->lpg, suffix_mp);
|
||||
else
|
||||
sprintf(buff, "%s%s%s", begin->lpg, delim_r, end->lpg);
|
||||
|
||||
encap_range = False;
|
||||
}
|
||||
else
|
||||
sprintf(buff, "%s%s%s", begin->lpg, delim_n, end->lpg);
|
||||
else
|
||||
{
|
||||
encap_range = False; /* might be true from page range on same page */
|
||||
strcpy(buff, begin->lpg);
|
||||
}
|
||||
|
||||
if(*prev_encap != EOS)
|
||||
{
|
||||
strcpy(tmp, buff);
|
||||
sprintf(buff, "%s%s%s%s%s", encap_p, prev_encap, encap_i, tmp, encap_s);
|
||||
}
|
||||
wrap_line(print);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
Local void
|
||||
#if STDC
|
||||
wrap_line(int print)
|
||||
# else
|
||||
< |