Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
easea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Arnaud Kress
easea
Commits
60fdcb6c
Commit
60fdcb6c
authored
Jan 03, 2011
by
Frédéric Krüger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout d'une fonction custom pour le strndup pour MAC
parent
ca98311c
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1187 additions
and
843 deletions
+1187
-843
EaseaLex.cpp
EaseaLex.cpp
+925
-839
EaseaLex.h
EaseaLex.h
+2
-2
EaseaLex.l
EaseaLex.l
+86
-0
Makefile
Makefile
+2
-2
examples/sphere/sphere.ez
examples/sphere/sphere.ez
+172
-0
No files found.
EaseaLex.cpp
View file @
60fdcb6c
This diff is collapsed.
Click to expand it.
EaseaLex.h
View file @
60fdcb6c
...
...
@@ -3,7 +3,7 @@
#include <clex.h>
#line
67
"EaseaLex.l"
#line
153
"EaseaLex.l"
// forward references
class
CEASEAParser
;
...
...
@@ -60,7 +60,7 @@ protected:
virtual
int
yyaction
(
int
action
);
public:
#line
82
"EaseaLex.l"
#line
168
"EaseaLex.l"
protected:
CSymbolTable
*
pSymbolTable
;
// the symbol table
...
...
EaseaLex.l
View file @
60fdcb6c
...
...
@@ -19,6 +19,92 @@ Centre de Math�matiques Appliqu�es
#else
#include <unistd.h>
#endif
#ifdef __APPLE__
/* Mac OS X don't have strndup even if _GNU_SOURCE is defined */
char *strndup (const char *s, size_t n){
size_t len = strlen (s);
char *ret;
if (len <= n)
return strdup (s);
ret = (char *)malloc(n + 1);
strncpy(ret, s, n);
ret[n] = '\0';
return ret;
}
ssize_t getline (char **lineptr, size_t *n, FILE *fp){
ssize_t result;
size_t cur_len = 0;
if (lineptr == NULL || n == NULL || fp == NULL){
errno = EINVAL;
return -1;
}
if (*lineptr == NULL || *n == 0){
*n = 120;
*lineptr = (char *) malloc (*n);
if (*lineptr == NULL){
result = -1;
goto end;
}
}
for (;;){
int i;
i = getc (fp);
if (i == EOF){
result = -1;
break;
}
/* Make enough space for len+1 (for final NUL) bytes. */
if (cur_len + 1 >= *n){
size_t needed_max = SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
size_t needed = 2 * *n + 1; /* Be generous. */
char *new_lineptr;
if (needed_max < needed)
needed = needed_max;
if (cur_len + 1 >= needed){
result = -1;
goto end;
}
new_lineptr = (char *) realloc (*lineptr, needed);
if (new_lineptr == NULL){
result = -1;
goto end;
}
*lineptr = new_lineptr;
*n = needed;
}
(*lineptr)[cur_len] = i;
cur_len++;
if (i == '\n')
break;
}
(*lineptr)[cur_len] = '\0';
result = cur_len ? (ssize_t) cur_len : result;
end:
return result;
}
#endif
/* getline implementation is copied from glibc. */
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
#endif
#ifndef SSIZE_MAX
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
#endif
#include "debug.h"
#include <iostream>
#include <sstream>
...
...
Makefile
View file @
60fdcb6c
...
...
@@ -81,9 +81,9 @@ endif
EaseaParse.o
:
EaseaParse.cpp EaseaLex.cpp
$(CPPC)
$(CPPFLAGS)
$<
-o
$@
-c
2>/dev/null
$(CPPC)
$(CPPFLAGS)
$<
-o
$@
-c
#
2>/dev/null
EaseaLex.o
:
EaseaLex.cpp
$(CPPC)
$(CPPFLAGS)
$<
-o
$@
-c
2>/dev/null
$(CPPC)
$(CPPFLAGS)
$<
-o
$@
-c
#
2>/dev/null
%.o
:
%.cpp
...
...
examples/sphere/sphere.ez
0 → 100644
View file @
60fdcb6c
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment