Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GSAT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
josc941e
GSAT
Commits
0b8764b1
Commit
0b8764b1
authored
11 months ago
by
Jonathan Schöbel
Browse files
Options
Downloads
Patches
Plain Diff
File: read author
parent
359a0c18
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gsat.geany
+3
-3
3 additions, 3 deletions
gsat.geany
src/lib/file.c
+30
-1
30 additions, 1 deletion
src/lib/file.c
tests/test_file.c
+4
-0
4 additions, 0 deletions
tests/test_file.c
with
37 additions
and
4 deletions
gsat.geany
+
3
−
3
View file @
0b8764b1
...
...
@@ -28,7 +28,7 @@ long_line_behaviour=1
long_line_column=72
[files]
current_page=1
2
current_page=1
9
FILE_NAME_0=309;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2FREADME;0;8
FILE_NAME_1=47;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2F.gitignore;0;8
FILE_NAME_2=1770;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Fconfigure.ac;0;8
...
...
@@ -41,14 +41,14 @@ FILE_NAME_8=4638;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fpr
FILE_NAME_9=881;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Fsrc%2Flib%2Flog.h;0;8
FILE_NAME_10=17855;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Fsrc%2Flib%2Fgrammar.c;0;8
FILE_NAME_11=6839;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Fsrc%2Flib%2Fgrammar.h;0;8
FILE_NAME_12=
935
7;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Fsrc%2Flib%2Ffile.c;0;8
FILE_NAME_12=
541
7;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Fsrc%2Flib%2Ffile.c;0;8
FILE_NAME_13=1457;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Fsrc%2Flib%2Ffile.h;0;8
FILE_NAME_14=1282;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Fsrc%2Flib%2Fword.c;0;8
FILE_NAME_15=908;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Fsrc%2Flib%2Fword.h;0;8
FILE_NAME_16=919;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Ftests%2FMakefile.am;0;8
FILE_NAME_17=0;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Ftests%2Fno_test.sh;0;8
FILE_NAME_18=51550;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Ftests%2Ftest_grammar.c;0;8
FILE_NAME_19=1
6783
;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Ftests%2Ftest_file.c;0;8
FILE_NAME_19=1
7158
;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Ftests%2Ftest_file.c;0;8
FILE_NAME_20=1731;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDocuments%2Fprojects%2Fprgm%2Flanguage%2FGSAT%2Ftests%2Ftest_word.c;0;8
[prjorg]
...
...
This diff is collapsed.
Click to expand it.
src/lib/file.c
+
30
−
1
View file @
0b8764b1
...
...
@@ -243,6 +243,11 @@ bool
File_read_start
(
struct
GR_File
*
file
,
/*@null@*/
/*@out@*/
struct
GR_Status
*
status
);
static
inline
bool
File_read_author
(
struct
GR_File
*
file
,
GR_Grammar
*
grammar
,
/*@null@*/
/*@out@*/
struct
GR_Status
*
status
);
static
inline
/*@null@*/
/*@only@*/
...
...
@@ -265,7 +270,8 @@ File_read (struct GR_File * file,
||
(
!
File_read_filetype
(
file
,
status
))
||
(
!
File_read_fileversion
(
file
,
status
))
||
(
!
File_read_name
(
file
,
grammar
,
status
))
||
(
!
File_read_start
(
file
,
status
)))
||
(
!
File_read_start
(
file
,
status
))
||
(
!
File_read_author
(
file
,
grammar
,
status
)))
{
GR_Grammar_free
(
grammar
);
File_close
(
file
,
status
);
...
...
@@ -513,3 +519,26 @@ File_read_start (struct GR_File * file,
return
TRUE
;
}
static
inline
bool
File_read_author
(
struct
GR_File
*
file
,
GR_Grammar
*
grammar
,
/*@null@*/
/*@out@*/
struct
GR_Status
*
status
)
{
if
(
NULL
==
file
->
file
)
{
set_status
(
status
,
E_STATE
,
2
,
"file not opened"
);
return
FALSE
;
}
/* read to RS */
if
(
!
read_to
(
file
,
RS
,
status
))
return
FALSE
;
/* overwrite RS with NUL */
file
->
buffer
[
file
->
index
-
1
]
=
'\0'
;
/* clear buffer */
file
->
index
=
0
;
return
GR_Grammar_set_author
(
grammar
,
file
->
buffer
,
status
);
}
This diff is collapsed.
Click to expand it.
tests/test_file.c
+
4
−
0
View file @
0b8764b1
...
...
@@ -681,6 +681,8 @@ START_TEST(test_file_read_no_status)
ck_assert_str_eq
(
"Deutsch_Kernsatz-jonathan"
,
GR_Grammar_raw_get_name
(
grammar
));
ck_assert_int_eq
(
0
,
file
->
start_index
);
ck_assert_str_eq
(
"Jonathan Schöbel"
,
GR_Grammar_raw_get_author
(
grammar
));
/* cleanup */
GR_File_free
(
file
);
...
...
@@ -709,6 +711,8 @@ START_TEST(test_file_read_with_status)
ck_assert_str_eq
(
"Deutsch_Kernsatz-jonathan"
,
GR_Grammar_raw_get_name
(
grammar
));
ck_assert_int_eq
(
0
,
file
->
start_index
);
ck_assert_str_eq
(
"Jonathan Schöbel"
,
GR_Grammar_raw_get_author
(
grammar
));
/* cleanup */
GR_File_free
(
file
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment