10 static void ins_sura(struct txtwin
*tw
, struct quran
*quran
,
11 struct quran
*trans
, int sura
)
14 int start
= sura_start(sura
);
15 int ayas
= sura_ayas(sura
);
17 for (i
= 0; i
< ayas
; i
++) {
18 int juz
= juz_start(sura
, i
+ 1);
19 enum sajda sajda
= sajda_kind(sura
, i
+ 1);
21 sprintf(buf
, "%d\n", juz
);
22 txtwin_append(tw
, buf
, "juz");
24 quran_aya(quran
, buf
, LENGTH(buf
), start
+ i
);
25 txtwin_append(tw
, buf
, "quran");
26 sprintf(buf
, " %d ", i
+ 1);
27 txtwin_append(tw
, buf
, "num");
28 if (sajda
!= SAJDA_NONE
) {
29 char *s
= sajda
== SAJDA_RECOM
? "*" : "**";
30 txtwin_append(tw
, s
, "sajda");
33 quran_aya(trans
, buf
, LENGTH(buf
), start
+ i
);
34 txtwin_append(tw
, "\n", NULL
);
35 txtwin_append(tw
, buf
, "trans");
37 txtwin_append(tw
, "\n\n", NULL
);
41 static void set_tags(struct txtwin
*tw
)
44 for (i
= 0; i
< LENGTH(styles
); i
++)
45 txtwin_tag(tw
, styles
[i
].name
, styles
[i
].fg
,
46 styles
[i
].bg
, styles
[i
].font
);
53 struct quran
*trans
= NULL
;
55 quran
= quran_alloc(QURAN_PATH
);
57 trans
= quran_alloc(TRANS_PATH
);
59 ins_sura(tw
, quran
, trans
, sura
);
68 static char *version
=
70 "Copyright (C) 2009 Ali Gholami Rudi\n"
71 "You can redistribute and/or modify cnoor under the terms\n"
72 "of GNU General Public License. For more information, see\n"
73 "the file named COPYING.\n";
75 int main(int argc
, char **argv
)
78 if (argc
== 1 || !strcmp(argv
[1], "-h")) {
79 printf("usage: %s sura_number\n", argv
[0]);
82 if (!strcmp(argv
[1], "-v")) {
87 if (sura
<= 0 || sura
> 114) {
88 fprintf(stderr
, "cnoor: invalid sura number\n");
91 txtwin_gtk_init(argc
, argv
);