Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

Commit

Permalink
push commit, started renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
GeneralGuy4872 committed Dec 5, 2019
1 parent 4d87b2a commit b8ce3e8
Show file tree
Hide file tree
Showing 7 changed files with 670 additions and 264 deletions.
Binary file removed src/.iwannaflycurses.messy.swn
Binary file not shown.
Binary file removed src/.iwannaflycurses.messy.swo
Binary file not shown.
50 changes: 50 additions & 0 deletions src/getlines.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
struct singlestringlistyp * singlegetline (char * path) {
FILE * openfile = fopen(path,"r");
char[BUFFERMAX] buffer;
struct singlestringlsityp * head;
struct singlestringlistyp * prev;
struct singlestringlistyp * this;
if (fgets(buffer,BUFFERMAX-1,openfile) != NULL) {
head = malloc(sizeof(struct singlestringlistyp));
head->next = NULL;
head->lineno = 1;
head->text = calloc(strlen(buffer) + 1,sizeof(char));
prev = head;
for (int n = 2;fgets(buffer,BUFFERMAX - 1,openfile) != NULL;n++) {
this = malloc(sizeof(struct singlestringlistyp));
prev->next = this;
this->next = NULL;
this->lineno = n;
this->text = calloc(strlen(buffer) + 1,sizeof(char));
prev = this;
}
return head;
}
else {
return NULL;
}
}

char ** singlegetlinearray (char * path,ushort nlines,ushort * skip) {
char ** output = calloc(nlines,sizeof(char *));
struct singlestringlistyp * line = singlegetline(path);
int nextskip = 0;
int x = 0;
if skip != NULL {
while ((x < nlines) && (line != NULL) && (skip[nextskip] != 0)) {
if (line->lineno != skip[nextskip]) {
output[x] = line->text;
}
else {
nextskip++;
}
line = line->next;
x++;}
}
while ((x < nlines) && (line != NULL)) {
output[x] = line->text;
line = line->next;
x++;}
return output;
}

Loading

0 comments on commit b8ce3e8

Please sign in to comment.