Enlightenment CVS committal
Author : doursse
Project : e17
Module : libs/embryo
Dir : e17/libs/embryo/src/bin
Modified Files:
Makefile.am embryo_cc_prefix.c embryo_cc_sc1.c
Log Message:
* add evil support and remove evil windows code
* correctly handle alloca include
* remove trailing spaces
===================================================================
RCS file: /cvs/e/e17/libs/embryo/src/bin/Makefile.am,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- Makefile.am 4 Nov 2007 09:44:15 -0000 1.8
+++ Makefile.am 21 Mar 2008 17:18:25 -0000 1.9
@@ -8,7 +8,8 @@
-I$(top_builddir) \
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
--DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\"
+-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
[EMAIL PROTECTED]@
bin_PROGRAMS = embryo_cc
@@ -29,7 +30,7 @@
embryo_cc_prefix.c \
embryo_cc_prefix.h
-embryo_cc_LDADD = -lm
+embryo_cc_LDADD = @EVIL_LIBS@ -lm
embryo_cc_DEPENDENCIES =
EXTRA_DIST = \
===================================================================
RCS file: /cvs/e/e17/libs/embryo/src/bin/embryo_cc_prefix.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- embryo_cc_prefix.c 25 Nov 2007 11:38:49 -0000 1.6
+++ embryo_cc_prefix.c 21 Mar 2008 17:18:25 -0000 1.7
@@ -17,92 +17,16 @@
#include <ctype.h>
#include <time.h>
#include <dirent.h>
-#ifdef _WIN32
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# undef WIN32_LEAN_AND_MEAN
-# include <stdlib.h>
-# include <stdio.h>
-# include <errno.h>
+#include <dlfcn.h> /* dlopen,dlclose,etc */
+#ifdef HAVE_EVIL
+# include <evil.h> /* for realpath */
#else
-# include <dlfcn.h> /* dlopen,dlclose,etc */
# include <pwd.h>
# include <grp.h>
# include <glob.h>
-#endif /* _WIN32 */
+#endif /* HAVE_E_WIN32 */
#include "embryo_cc_prefix.h"
-
-/* FIXME: that hack is a temporary one. That code will be in MinGW soon */
-#ifdef _WIN32
-
-#define RTLD_LAZY 1 /* lazy function call binding */
-#define RTLD_NOW 2 /* immediate function call binding */
-#define RTLD_GLOBAL 4 /* symbols in this dlopen'ed obj are visible
- to other dlopen'ed objs */
-
-static char *dlerr_ptr;
-static char dlerr_data[80];
-
-void *dlopen (const char *file, int mode)
-{
- HMODULE hmodule;
-
- hmodule = LoadLibrary(file);
- if (hmodule == NULL) {
- int error;
-
- error = GetLastError();
- sprintf(dlerr_data, "LoadLibraryEx returned %d.", error);
- dlerr_ptr = dlerr_data;
- }
- return hmodule;
-}
-
-int dlclose (void *handle)
-{
- if (FreeLibrary(handle)) {
- return 0;
- }
- else {
- int error;
-
- error = GetLastError();
- sprintf(dlerr_data, "FreeLibrary returned %d.", error);
- dlerr_ptr = dlerr_data;
- return -1;
- }
-}
-
-void *dlsym (void *handle, const char *name)
-{
- FARPROC fp;
-
- fp = GetProcAddress(handle, name);
- if (fp == NULL) {
- int error;
-
- error = GetLastError();
- sprintf(dlerr_data, "GetProcAddress returned %d.", error);
- dlerr_ptr = dlerr_data;
- }
- return fp;
-}
-
-char *dlerror (void)
-{
- if (dlerr_ptr != NULL) {
- dlerr_ptr = NULL;
- return dlerr_data;
- }
- else {
- return NULL;
- }
-}
-
-#define realpath(file_name, resolved_name) _fullpath((resolved_name),
(file_name), PATH_MAX)
-
-#endif /* _WIN32 */
/* local subsystem functions */
static int _e_prefix_share_hunt(void);
===================================================================
RCS file: /cvs/e/e17/libs/embryo/src/bin/embryo_cc_sc1.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- embryo_cc_sc1.c 24 Jan 2008 00:25:13 -0000 1.35
+++ embryo_cc_sc1.c 21 Mar 2008 17:18:25 -0000 1.36
@@ -20,8 +20,8 @@
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source
- * distribution.
- * Version: $Id: embryo_cc_sc1.c,v 1.35 2008/01/24 00:25:13 raster Exp $
+ * distribution.
+ * Version: $Id: embryo_cc_sc1.c,v 1.36 2008/03/21 17:18:25 doursse Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -36,12 +36,9 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#ifdef _WIN32
-# include <fcntl.h>
-# include <io.h>
-# include <share.h>
-# include <sys/stat.h>
-#endif /* _WIN32 */
+#ifdef HAVE_EVIL
+# include <evil.h>
+#endif /* HAVE_EVIL */
#include "embryo_cc_osdefs.h"
#include "embryo_cc_sc.h"
@@ -143,7 +140,7 @@
snprintf(argv0, _MAX_PATH, "%s/%s", pwd, argv[0]);
} /* if */
argv[0] = argv0; /* set location to new first parameter */
-
+
e_prefix_determine(argv0);
return sc_compile(argc, argv);
@@ -318,30 +315,15 @@
/* open the output file */
-#ifndef _WIN32
+#ifndef HAVE_EVIL
tmpdir = getenv("TMPDIR");
if (!tmpdir) tmpdir = "/tmp";
-
- snprintf(outfname, _MAX_PATH, "%s/embryo_cc.asm-tmp-XXXXXX", tmpdir);
- fd_out = mkstemp(outfname);
#else
- tmpdir = getenv("TMP");
- if (!tmpdir) tmpdir = getenv("TEMP");
- if (!tmpdir) tmpdir = getenv("USERPROFILE");
- if (!tmpdir) tmpdir = getenv("WINDIR");
- if (!tmpdir) error(101, "embryo_cc.asm-tmp-XXXXXX (unable to get a valid
temp path)");
+ tmpdir = evil_tmpdir_get();
+#endif /* ! HAVE_EVIL */
snprintf(outfname, _MAX_PATH, "%s/embryo_cc.asm-tmp-XXXXXX", tmpdir);
-# ifdef __MINGW32__
- if (!mktemp(outfname))
- error(101, outfname);
- fd_out = _sopen(outfname, _O_RDWR | _O_BINARY | _O_CREAT, _SH_DENYNO,
_S_IREAD | _S_IWRITE);
-# else
- if (_mktemp_s(outfname, _MAX_PATH))
- error(101, outfname);
- _sopen_s(&fd_out, outfname, _O_RDWR | _O_BINARY | _O_CREAT, _SH_DENYNO,
_S_IREAD | _S_IWRITE);
-# endif /* __MINGW32__ */
-#endif /* _WIN32 */
+ fd_out = mkstemp(outfname);
if (fd_out < 0)
error(101, outfname);
@@ -706,10 +688,10 @@
if ((ptr = strrchr(path, DIRSEP_CHAR)) != NULL
|| (ptr = strchr(path, ':')) != NULL)
{
- /* If there was no terminating "\" or ":",
+ /* If there was no terminating "\" or ":",
* the filename probably does not
* contain the path; so we just don't add it
- * to the list in that case
+ * to the list in that case
*/
*(ptr + 1) = '\0';
if (strlen(path) < (sizeof(path) - 1 - 7))
@@ -2139,7 +2121,7 @@
/* "declargs()" found the ")" */
if (!operatoradjust(opertok, sym, symbolname, tag))
sym->usage &= ~uDEFINE;
- /* for a native operator, also need to specify an "exported"
+ /* for a native operator, also need to specify an "exported"
* function name; for a native function, this is optional
*/
if (native)
@@ -2406,7 +2388,7 @@
result = a1->numdim == a2->numdim;
for (level = 0; result && level < a1->numdim; level++)
result = a1->dim[level] == a2->dim[level];
- /* ??? should also check contents of the default array
+ /* ??? should also check contents of the default array
* (these troubles go away in a 2-pass compiler that forbids
* double declarations, but Small currently does not forbid them)
*/
@@ -2433,8 +2415,8 @@
/* declargs()
*
- * This routine adds an entry in the local symbol table for each
- * argument found in the argument list.
+ * This routine adds an entry in the local symbol table for each
+ * argument found in the argument list.
* It returns the number of arguments.
*/
static int
@@ -2537,7 +2519,7 @@
if (sym->dim.arglist == 0)
error(103); /* insufficient memory */
sym->dim.arglist[argcnt] = arg;
- sym->dim.arglist[argcnt + 1].ident = 0; /* keep the
list
+ sym->dim.arglist[argcnt + 1].ident = 0; /* keep the list
* terminated */
}
else
@@ -2573,7 +2555,7 @@
(argcnt + 2) * sizeof(arginfo));
if (sym->dim.arglist == 0)
error(103); /* insufficient memory */
- sym->dim.arglist[argcnt + 1].ident = 0; /* keep the
list
+ sym->dim.arglist[argcnt + 1].ident = 0; /* keep the list
* terminated */
sym->dim.arglist[argcnt].ident = iVARARGS;
sym->dim.arglist[argcnt].hasdefault = FALSE;
@@ -2614,7 +2596,7 @@
int altidx;
/* Find the argument with the name mentioned after the "sizeof".
- * Note that we cannot use findloc here because we need the
+ * Note that we cannot use findloc here because we need the
* arginfo struct, not the symbol.
*/
ptr = arglist[idx].defvalue.size.symname;
@@ -2704,7 +2686,7 @@
lexpush(); /* initials() needs the "=" token again */
assert(numtags > 0);
/* for the moment, when a default value is given for the array,
- * all dimension sizes, except the last, must be non-zero
+ * all dimension sizes, except the last, must be non-zero
* (function initials() requires to know the major dimensions)
*/
for (level = 0; level < arg->numdim - 1; level++)
@@ -2813,7 +2795,7 @@
if (ident == iREFERENCE)
argsym->usage |= uREAD; /* because references are passed back */
if (fpublic)
- argsym->usage |= uREAD; /* arguments of public functions
+ argsym->usage |= uREAD; /* arguments of public functions
* are always "used" */
if (fconst)
argsym->usage |= uCONST;
@@ -3182,8 +3164,8 @@
/* statement - The Statement Parser
*
- * This routine is called whenever the parser needs to know what
- * statement it encounters (i.e. whenever program syntax requires a
+ * This routine is called whenever the parser needs to know what
+ * statement it encounters (i.e. whenever program syntax requires a
* statement).
*/
static void
@@ -3206,11 +3188,11 @@
/* lex() has set stmtindent */
if (lastindent != NULL && tok != tLABEL)
{
-#if 0
+#if 0
if (*lastindent >= 0 && *lastindent != stmtindent &&
!indent_nowarn && sc_tabsize > 0)
error(217); /* loose indentation */
-#endif
+#endif
*lastindent = stmtindent;
indent_nowarn = TRUE; /* if warning was blocked, re-enable it */
} /* if */
@@ -3534,10 +3516,10 @@
{
/* to avoid the "dangling else" error, we want a warning if the "else"
* has a lower indent than the matching "if" */
-#if 0
+#if 0
if (stmtindent < ifindent && sc_tabsize > 0)
error(217); /* loose indentation */
-#endif
+#endif
flab2 = getlabel();
if ((lastst != tRETURN) && (lastst != tGOTO))
jumplabel(flab2);
@@ -3632,7 +3614,7 @@
setlabel(wq[wqLOOP]); /* "continue" goes to this label: expr3 */
setline(fline, fcurrent);
/* Expressions 2 and 3 are reversed in the generated code:
- * expression 3 precedes expression 2.
+ * expression 3 precedes expression 2.
* When parsing, the code is buffered and marks for
* the start of each expression are insterted in the buffer.
*/
@@ -3646,7 +3628,7 @@
setlabel(skiplab); /*jump to this point after 1st expression */
if (matchtoken(';') == 0)
{
- test(wq[wqEXIT], FALSE, FALSE); /* expression 2
+ test(wq[wqEXIT], FALSE, FALSE); /* expression 2
*(jump to wq[wqEXIT] if false) */
needtoken(';');
} /* if */
@@ -3753,7 +3735,7 @@
/* nothing */ ;
if (cse != NULL && cse->value == val)
error(40, val); /* duplicate "case" label */
- /* Since the label is stored as a string in the
+ /* Since the label is stored as a string in the
* "constvalue", the size of an identifier must
* be at least 8, as there are 8
* hexadecimal digits in a 32-bit number.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs