putting llt_init in a separate file

This commit is contained in:
JeffBezanson 2010-01-06 20:27:04 +00:00
parent 219ffb7e63
commit 1649e64ad3
5 changed files with 44 additions and 32 deletions

View File

@ -2255,8 +2255,6 @@ static value_t argv_list(int argc, char *argv[])
return POP();
}
int locale_is_utf8;
extern value_t fl_file(value_t *args, uint32_t nargs);
int main(int argc, char *argv[])
@ -2266,8 +2264,6 @@ int main(int argc, char *argv[])
symbol_t *sym;
char fname_buf[1024];
locale_is_utf8 = u8_is_locale_utf8(setlocale(LC_ALL, ""));
lisp_init();
fname_buf[0] = '\0';
@ -2277,8 +2273,7 @@ int main(int argc, char *argv[])
}
strcat(fname_buf, "flisp.boot");
FL_TRY {
// install toplevel exception handler
FL_TRY { // toplevel exception handler
PUSH(cvalue_static_cstring(fname_buf));
PUSH(symbol(":read"));
value_t f = fl_file(&Stack[SP-2], 2);

View File

@ -3,7 +3,7 @@ CC = gcc
SRCS = bitvector.c hashing.c socket.c timefuncs.c dblprint.c ptrhash.c \
utf8.c ios.c operators.c cplxprint.c dirpath.c htable.c \
bitvector-ops.c fp.c int2str.c dump.c random.c bswap.c memalign.c \
swapreverse.c
swapreverse.c lltinit.c
OBJS = $(SRCS:%.c=%.o)
DOBJS = $(SRCS:%.c=%.do)
TARGET = libllt.a

View File

@ -76,28 +76,3 @@ u_int32_t memhash32(char* buf, size_t n)
hashlittle2(buf, n, &c, &b);
return c;
}
double D_PNAN;
double D_NNAN;
double D_PINF;
double D_NINF;
float F_PNAN;
float F_NNAN;
float F_PINF;
float F_NINF;
void llt_init()
{
randomize();
ios_init_stdstreams();
D_PNAN = strtod("+NaN",NULL);
D_NNAN = -strtod("+NaN",NULL);
D_PINF = strtod("+Inf",NULL);
D_NINF = strtod("-Inf",NULL);
F_PNAN = strtof("+NaN",NULL);
F_NNAN = -strtof("+NaN",NULL);
F_PINF = strtof("+Inf",NULL);
F_NINF = strtof("-Inf",NULL);
}

40
llt/lltinit.c Normal file
View File

@ -0,0 +1,40 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <math.h>
#include <locale.h>
#include "ieee754.h"
#include "dtypes.h"
#include "timefuncs.h"
#include "ios.h"
#include "random.h"
#include "utf8.h"
double D_PNAN;
double D_NNAN;
double D_PINF;
double D_NINF;
float F_PNAN;
float F_NNAN;
float F_PINF;
float F_NINF;
int locale_is_utf8;
void llt_init()
{
locale_is_utf8 = u8_is_locale_utf8(setlocale(LC_ALL, ""));
randomize();
ios_init_stdstreams();
D_PNAN = strtod("+NaN",NULL);
D_NNAN = -strtod("+NaN",NULL);
D_PINF = strtod("+Inf",NULL);
D_NINF = strtod("-Inf",NULL);
F_PNAN = strtof("+NaN",NULL);
F_NNAN = -strtof("+NaN",NULL);
F_PINF = strtof("+Inf",NULL);
F_NINF = strtof("-Inf",NULL);
}

View File

@ -14,6 +14,8 @@ typedef unsigned long long u_int64_t;
#endif
#endif
extern int locale_is_utf8;
/* is c the start of a utf8 sequence? */
#define isutf(c) (((c)&0xC0)!=0x80)