Compare commits

..

2 commits

Author SHA1 Message Date
Fedora Release Engineering
b24815cefc dist-git conversion 2010-07-29 16:27:34 +00:00
Jesse Keating
9d9dc268f2 Initialize branch F-13 for zaf 2010-02-17 03:35:29 +00:00
6 changed files with 17 additions and 345 deletions

View file

@ -1 +0,0 @@
1

View file

@ -1,5 +0,0 @@
summary: Basic smoke test
discover:
how: fmf
execute:
how: tmt

View file

@ -1,8 +0,0 @@
require:
- hyphen-af
- hyphen-zu
- hyphen-devel
- gcc
test: bash ./run_tests.sh
framework: shell

View file

@ -1,15 +0,0 @@
#!/bin/bash
set -e
gcc -Wall test-hyphen.c -o test-hyphen -lhyphen
echo "Test to hyphenate given word => woordafbreking"
echo "woordafbreking" | ./test-hyphen /usr/share/hyphen/hyph_af_ZA.dic /dev/stdin
echo ""
echo ""
echo "Test to give all possible ways to hyphenate the given word => woordafbreking"
echo ""woordafbreking | ./test-hyphen -d /usr/share/hyphen/hyph_af_ZA.dic /dev/stdin

View file

@ -1,212 +0,0 @@
/* This test file is part of upstream hyphen project */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "hyphen.h"
#define BUFSIZE 1000
void help() {
fprintf(stderr,"correct syntax is:\n");
fprintf(stderr,"example [-d | -dd] hyphen_dictionary_file file_of_words_to_check\n");
fprintf(stderr,"-o = use old algorithm (without non-standard hyphenation)\n");
fprintf(stderr,"-d = hyphenation with listing of the possible hyphenations\n");
fprintf(stderr,"-n = print hyphenation vector\n");
}
/* get a pointer to the nth 8-bit or UTF-8 character of the word */
char * hindex(char * word, int n, int utf8) {
int j = 0;
while (j < n) {
j++;
word++;
while (utf8 && ((((unsigned char) *word) >> 6) == 2)) word++;
}
return word;
}
/* list possible hyphenations with -dd option (example for the usage of the hyphenate2() function) */
void single_hyphenations(char * word, char * hyphen, char ** rep, int * pos, int * cut, int utf8) {
int i, k, j = 0;
char r;
for (i = 0; (i + 1) < strlen(word); i++) {
if (utf8 && ((((unsigned char) word[i]) >> 6) == 2)) continue;
if ((hyphen[j] & 1)) {
if (rep && rep[j]) {
k = hindex(word, j - pos[j] + 1, utf8) - word;
r = word[k];
word[k] = 0;
printf(" - %s%s", word, rep[j]);
word[k] = r;
printf("%s\n", hindex(word + k, cut[j], utf8));
} else {
k = hindex(word, j + 1, utf8) - word;
r = word[k];
word[k] = 0;
printf(" - %s=", word);
word[k] = r;
printf("%s\n", word + k);
}
}
j++;
}
}
int
main(int argc, char** argv)
{
HyphenDict *dict;
int df;
int wtc;
FILE* wtclst;
int k, n, i, j, c;
char buf[BUFSIZE + 1];
int nHyphCount;
char *hyphens;
char *lcword;
char *hyphword;
char hword[BUFSIZE * 2];
int arg = 1;
int optd = 1;
int optn = 0;
int optdd = 0;
char ** rep;
int * pos;
int * cut;
/* first parse the command line options */
/* arg1 - hyphen dictionary file, arg2 - file of words to check */
if (argv[arg]) {
if (strcmp(argv[arg], "-o") == 0) {
optd = 0;
arg++;
}
if (strcmp(argv[arg], "-n") == 0) {
optn = 1;
arg++;
}
if (argv[arg] && strcmp(argv[arg], "-d") == 0) {
optd = 1;
optdd = 1;
arg++;
}
}
if (argv[arg]) {
df = arg++;
} else {
help();
exit(1);
}
if (argv[arg]) {
wtc = arg++;
} else {
help();
exit(1);
}
/* load the hyphenation dictionary */
if ((dict = hnj_hyphen_load(argv[df])) == NULL) {
fprintf(stderr, "Couldn't find file %s\n", argv[df]);
fflush(stderr);
exit(1);
}
/* open the words to check list */
wtclst = fopen(argv[wtc],"r");
if (!wtclst) {
fprintf(stderr,"Error - could not open file of words to check\n");
exit(1);
}
/* now read each word from the wtc file */
while(fgets(buf,BUFSIZE,wtclst) != NULL) {
k = strlen(buf);
if (k && buf[k - 1] == '\n') buf[k - 1] = '\0';
if (k >=2 && buf[k - 2] == '\r') buf[k-- - 2] = '\0';
/* set aside some buffers to hold lower cased */
/* and hyphen information */
lcword = (char *) malloc(k+1);
hyphens = (char *)malloc(k+5);
/* basic ascii lower-case, not suitable for real-world usage*/
for (i = 0; i < k; ++i) {
lcword[i] = buf[i];
if ( (lcword[i] >= 'A') && (lcword[i] <= 'Z') )
lcword[i] += 32;
}
/* first remove any trailing periods */
n = k-1;
while((n >=0) && (lcword[n] == '.')) n--;
n++;
/* now actually try to hyphenate the word */
rep = NULL;
pos = NULL;
cut = NULL;
hword[0] = '\0';
if ((!optd && hnj_hyphen_hyphenate(dict, lcword, n-1, hyphens)) ||
(optd && hnj_hyphen_hyphenate2(dict, lcword, n-1, hyphens, hword, &rep, &pos, &cut))) {
free(hyphens);
free(lcword);
fprintf(stderr, "hyphenation error\n");
exit(1);
}
if (optn) fprintf(stderr, "%s\n", hyphens);
if (!optd) {
/* now backfill hyphens[] for any removed periods */
for (c = n; c < k; c++) hyphens[c] = '0';
hyphens[k] = '\0';
/* now create a new char string showing hyphenation positions */
/* count the hyphens and allocate space for the new hypehanted string */
nHyphCount = 0;
for (i = 0; i < n; i++)
if (hyphens[i]&1)
nHyphCount++;
hyphword = (char *) malloc(k+1+nHyphCount);
j = 0;
for (i = 0; i < n; i++) {
hyphword[j++] = buf[i];
if (hyphens[i]&1) {
hyphword[j++] = '-';
}
}
hyphword[j] = '\0';
fprintf(stdout,"%s\n",hyphword);
fflush(stdout);
free(hyphword);
} else {
fprintf(stdout,"%s\n", hword);
if (optdd) single_hyphenations(lcword, hyphens, rep, pos, cut, dict->utf8);
if (rep) {
for (i = 0; i < n - 1; i++) {
if (rep[i]) free(rep[i]);
}
free(rep);
free(pos);
free(cut);
}
}
free(hyphens);
free(lcword);
}
fclose(wtclst);
hnj_hyphen_free(dict);
return 0;
}

121
zaf.spec
View file

@ -2,12 +2,12 @@ Name: zaf
Summary: South Africa hyphenation rules
%define upstreamid 20080714
Version: 0
Release: 0.34.%{upstreamid}svn%{?dist}
Release: 0.3.%{upstreamid}svn%{?dist}
Source: zaf-0-0.1.%{upstreamid}svn.tar.bz2
# Below URL is dead now, don't file any bugs for updating it.
Group: Applications/Text
URL: http://zaf.sourceforge.net/
#Hyphenation rules are already generated in upstream code
License: LGPL-2.1-or-later
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
License: LGPLv2+
BuildArch: noarch
%description
@ -15,6 +15,7 @@ South Africa hyphenation rules.
%package -n hyphen-af
Summary: Afrikaans hyphenation rules
Group: Applications/Text
Requires: hyphen
%description -n hyphen-af
@ -22,17 +23,19 @@ Afrikaans hyphenation rules.
%package -n hyphen-zu
Summary: Zulu hyphenation rules
Group: Applications/Text
Requires: hyphen
%description -n hyphen-zu
Zulu hyphenation rules.
%prep
%autosetup -n zaf
%setup -q -n zaf
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/hyphen
cp -p ./af/hyph/hyph_af_ZA.dic $RPM_BUILD_ROOT/%{_datadir}/hyphen
cp -p ./zu/hyph/hyph_zu_ZA.dic $RPM_BUILD_ROOT/%{_datadir}/hyphen
@ -44,118 +47,28 @@ for lang in $af_ZA_aliases; do
done
popd
%clean
rm -rf $RPM_BUILD_ROOT
%files -n hyphen-af
%doc af/CREDITS af/README
%license af/COPYING
%defattr(-,root,root,-)
%doc af/CREDITS af/COPYING af/README
%{_datadir}/hyphen/hyph_af*
%files -n hyphen-zu
%doc zu/CREDITS zu/README
%license zu/COPYING
%defattr(-,root,root,-)
%doc zu/CREDITS zu/COPYING zu/README
%{_datadir}/hyphen/hyph_zu*
%changelog
* Fri Jul 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.34.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
* Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.33.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.32.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.31.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.30.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.29.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.28.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri Feb 24 2023 Caolán McNamara <caolanm@redhat.com> - 0-0.27.20080714svn
- migrated to SPDX license
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.26.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.25.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.24.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.23.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Thu Jan 28 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.22.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.21.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.20.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.19.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.18.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.17.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Sun Jul 01 2018 Parag Nemade <pnemade AT fedoraproject DOT org> - 0-0.16.20080714svn
- Update to follow Fedora Packaging guidelines
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.15.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.14.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.13.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.12.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.11.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.10.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.9.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.8.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Tue Nov 06 2012 Caolán McNamara <caolanm@redhat.com> - 0-0.7.20080714svn
- clarify license
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.6.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.5.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.4.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.3.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.2.20080714svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Tue Jul 15 2008 Caolán McNamara <caolanm@redhat.com> - 0-0.1.20080714svn
* Tue Jul 15 2008 Caolan McNamara <caolanm@redhat.com> - 0-0.1.20080714svn
- latest version
* Fri Nov 23 2007 Caolán McNamara <caolanm@redhat.com> - 0-0.1.20071123svn
* Fri Nov 23 2007 Caolan McNamara <caolanm@redhat.com> - 0-0.1.20071123svn
- initial version