Skip to content

Commit

Permalink
Make it possible to compile PBRST on Windows (MSYS2/gcc)
Browse files Browse the repository at this point in the history
  • Loading branch information
kovben2004 committed Dec 25, 2024
1 parent 9a63aea commit 623e6d2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
1 change: 1 addition & 0 deletions books-wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

EXTERNC const char* lookupVerse1(const char* book, const char* info, const char* verse);
EXTERNC const char* greekToLatin1(const char* greek);
EXTERNC int addBibles1();
EXTERNC int find1(const char* text, const char* moduleName, int maxFound);

#endif // BOOKS_WRAPPER_H
52 changes: 33 additions & 19 deletions statements/pbrst.y
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,20 @@ void init_addbooks() {

%start brst_stmt

%code provides {
int yylex (void);
int yylex_destroy();
void yyerror (char *s, ...);
void check_rawposition_length(char *s);
void save_string_in_introduction(char *s);
void check_nt_passage(char *book, char *info, char *verse);
void check_ot_passage(char *book, char *info, char *verse);
void check_introduction_passage(char *passage, char *ay);
void check_cover(double cover);
void check_unique_prepare();
void check_fragment(char *passage, char *ay_nt, char *ay_ot);
}

%%

brst_stmt
Expand Down Expand Up @@ -292,8 +306,8 @@ opt_period
void
check_rawposition_length(char *s)
{
extern yylineno;
extern yycolumn;
extern int yylineno;
extern int yycolumn;
#ifdef IN_BIBREF
int from, to, length=-1;
if (strstr(s, "length") == NULL) {
Expand All @@ -318,8 +332,8 @@ check_rawposition_length(char *s)
void
save_string_in_introduction(char *s)
{
extern yylineno;
extern yycolumn;
extern int yylineno;
extern int yycolumn;
#ifdef IN_BIBREF
char *l;
l = greekToLatin1(s);
Expand All @@ -333,8 +347,8 @@ save_string_in_introduction(char *s)
void
check_nt_passage(char *book, char *info, char *verse)
{
extern yylineno;
extern yycolumn;
extern int yylineno;
extern int yycolumn;
#ifdef IN_BIBREF
init_addbooks();
char *l;
Expand All @@ -356,8 +370,8 @@ check_nt_passage(char *book, char *info, char *verse)
void
check_ot_passage(char *book, char *info, char *verse)
{
extern yylineno;
extern yycolumn;
extern int yylineno;
extern int yycolumn;
#ifdef IN_BIBREF
char *l;
l = lookupVerse1(info, book, verse);
Expand All @@ -381,8 +395,8 @@ check_ot_passage(char *book, char *info, char *verse)
void
check_introduction_passage(char *passage, char *ay)
{
extern yylineno;
extern yycolumn;
extern int yylineno;
extern int yycolumn;
#ifdef IN_BIBREF
char *l;
l = lookupVerse1(nt_info, nt_book, passage);
Expand Down Expand Up @@ -416,8 +430,8 @@ check_introduction_passage(char *passage, char *ay)

void
check_fragment(char *passage, char *ay_nt, char *ay_ot) {
extern yylineno;
extern yycolumn;
extern int yylineno;
extern int yycolumn;
#ifdef IN_BIBREF
char *ot_passage = malloc(strlen(ot_book) + 1 + strlen(ot_info) + 1 + strlen(ot_verse) + 1);
strcpy(ot_passage, ot_book);
Expand Down Expand Up @@ -468,16 +482,16 @@ check_fragment(char *passage, char *ay_nt, char *ay_ot) {
}

void check_unique_prepare() {
extern yylineno;
extern yycolumn;
extern int yylineno;
extern int yycolumn;
#ifdef IN_BIBREF
unique_prep = true;
#endif // IN_BIBREF
}

void check_cover(double cover) {
extern yylineno;
extern yycolumn;
extern int yylineno;
extern int yycolumn;
#ifdef IN_BIBREF
// Detecting intervals and the union of them:
fprintf(stdout, "%d,%d: debug: fragment intervals:", yylineno, yycolumn);
Expand Down Expand Up @@ -596,8 +610,8 @@ void check_cover(double cover) {
void
yyerror(char *s, ...)
{
extern yylineno;
extern yycolumn;
extern int yylineno;
extern int yycolumn;

va_list ap;
va_start(ap, s);
Expand All @@ -613,7 +627,7 @@ extern YY_BUFFER_STATE yy_scan_string(char * str);
extern void yy_delete_buffer(YY_BUFFER_STATE buffer);

int brst_scan_string(char *string) {
extern yycolumn;
extern int yycolumn;
// Reset data:
yycolumn = 0;
yylex_destroy();
Expand Down

0 comments on commit 623e6d2

Please sign in to comment.