Changeset 78 for NEWT0/trunk
- Timestamp:
- 03/24/07 09:40:52 (20 months ago)
- Location:
- NEWT0/trunk
- Files:
-
- 2 added
- 2 removed
- 12 modified
-
Makefile.in (modified) (7 diffs)
-
configure (modified) (8 diffs)
-
configure.in (modified) (5 diffs)
-
contrib/NativeCalls/Makefile (deleted)
-
contrib/NativeCalls/Makefile.in (added)
-
contrib/NativeCalls/README (modified) (1 diff)
-
contrib/NewtObjC/Makefile (deleted)
-
contrib/NewtObjC/Makefile.in (added)
-
contrib/NewtObjC/NewtObjC.m (modified) (2 diffs)
-
ext/protoFILE/Makefile.in (modified) (2 diffs)
-
ext/protoREGEX/Makefile.in (modified) (2 diffs)
-
src/config.h.in (modified) (1 diff)
-
src/newt_core/NewtEnv.c (modified) (2 diffs)
-
src/newt_core/NewtFile.c (modified) (2 diffs)
-
src/newt_core/NewtObj.c (modified) (3 diffs)
-
src/newt_core/incs/NewtObj.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
NEWT0/trunk/Makefile.in
r56 r78 5 5 build = ./build 6 6 ext = ./ext 7 contrib = ./contrib 7 8 utils = $(srcdir)/utils 8 9 parser = $(srcdir)/parser … … 13 14 docdir = $(build)/html 14 15 15 16 DESTROOT = 16 17 CC = @CC@ 17 18 YACC = @YACC@ -d … … 25 26 LDSHARED = @LIBNEWT_LDSHARED@ 26 27 28 prefix = @prefix@ 29 exec_prefix = @exec_prefix@ 30 bindir = @bindir@ 31 sitedir = ${prefix}/lib/newt0 27 32 28 33 VPATH = $(core) … … 60 65 $(ext)/protoREGEX 61 66 67 CONTRIBLIBS = $(contrib)/NewtObjC \ 68 $(contrib)/NativeCalls 69 62 70 OBJS = $(MAINOBJ) $(UTILSOBJS) $(PARSEROBJS) $(COREOBJS) 63 71 … … 71 79 ### all 72 80 73 all: newt @MAKE_EXT@ 74 81 all: newt @MAKE_EXT@ @MAKE_CONTRIB@ 75 82 76 83 ### make directory … … 132 139 $(MAKE) -C $@ 133 140 141 contrib: $(CONTRIBLIBS) 142 143 $(CONTRIBLIBS):: 144 $(MAKE) -C $@ 134 145 135 146 ### strip (for win) … … 160 171 cd misc; doxygen doxygen.conf 161 172 173 ### INSTALL 174 175 .PHONY : install install_ext install_contrib 176 177 install_ext:: 178 @for subdir in $(NEWTLIBS); do \ 179 (cd $$subdir && $(MAKE) install) || exit 1; \ 180 done 181 182 install_contrib:: 183 @for subdir in $(CONTRIBLIBS); do \ 184 (cd $$subdir && $(MAKE) install) || exit 1; \ 185 done 186 187 install:: 188 install -m 755 $(NEWT) $(DESTDIR)$(bindir) 189 install -d -m 755 $(DESTDIR)$(sitedir) 190 test "x@MAKE_EXT@" = x || $(MAKE) install_ext 191 test "x@MAKE_CONTRIB@" = x || $(MAKE) install_contrib 162 192 163 193 ### TEST -
NEWT0/trunk/configure
r56 r78 312 312 #endif" 313 313 314 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT YACC LEX LEXLIB LEX_OUTPUT_ROOT AR ac_ct_AR RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CPP EGREP LIBOBJS NEWT_LDIMPORT NEWT_LDFLAGS LIBNEWT_LDSHARED LINK_NEWT_APP_ DLEXT MAKE_EXT LIBREGEX LTLIBOBJS'314 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT YACC LEX LEXLIB LEX_OUTPUT_ROOT AR ac_ct_AR RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CPP EGREP LIBOBJS NEWT_LDIMPORT NEWT_LDFLAGS LIBNEWT_LDSHARED LINK_NEWT_APP_ DLEXT MAKE_EXT MAKE_CONTRIB BINDIR sitedir libffidir LIBREGEX LTLIBOBJS' 315 315 ac_subst_files='' 316 316 … … 846 846 esac 847 847 cat <<\_ACEOF 848 849 Optional Packages: 850 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] 851 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) 852 --with-sitedir=DIR site libraries in DIR [PREFIX/lib/newt0] 853 --with-libffidir=DIR where libffi libraries can be found [PREFIX] 848 854 849 855 Some influential environment variables: … … 4870 4876 LIBNEWT_LDSHARED='$(CC) -dynamic -bundle -undefined suppress -flat_namespace' 4871 4877 DLEXT='dylib' 4878 MAKE_CONTRIB='contrib' 4872 4879 ;; 4873 4880 cygwin*|mingw*) … … 4918 4925 esac 4919 4926 4920 4921 4927 case "$HAVE_DLOPEN" in 4922 4928 yes) … … 4929 4935 esac 4930 4936 4931 4932 NEWT_LDFLAGS="$NEWT_LDFLAGS $LIBDL" 4937 test "x$prefix" = xNONE && prefix=$ac_default_prefix 4938 4939 4940 # Check whether --with-sitedir or --without-sitedir was given. 4941 if test "${with_sitedir+set}" = set; then 4942 withval="$with_sitedir" 4943 sitedir=$withval 4944 else 4945 sitedir='${prefix}/lib/newt0' 4946 fi; 4947 SITE_DIR="`eval \"echo ${sitedir}\"`" 4948 4949 4950 # Check whether --with-libffidir or --without-libffidir was given. 4951 if test "${with_libffidir+set}" = set; then 4952 withval="$with_libffidir" 4953 libffidir=$withval 4954 else 4955 libffidir='${prefix}' 4956 fi; 4933 4957 4934 4958 cat >>confdefs.h <<_ACEOF … … 4940 4964 _ACEOF 4941 4965 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 ac_config_files="$ac_config_files Makefile ext/protoFILE/Makefile ext/protoREGEX/Makefile" 4966 cat >>confdefs.h <<_ACEOF 4967 #define __LIBDIR__ "${SITE_DIR}" 4968 _ACEOF 4969 4970 4971 NEWT_LDFLAGS="$NEWT_LDFLAGS $LIBDL" 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 ac_config_files="$ac_config_files Makefile ext/protoFILE/Makefile ext/protoREGEX/Makefile contrib/NativeCalls/Makefile contrib/NewtObjC/Makefile" 4953 4987 4954 4988 cat >confcache <<\_ACEOF … … 5479 5513 "ext/protoFILE/Makefile" ) CONFIG_FILES="$CONFIG_FILES ext/protoFILE/Makefile" ;; 5480 5514 "ext/protoREGEX/Makefile" ) CONFIG_FILES="$CONFIG_FILES ext/protoREGEX/Makefile" ;; 5515 "contrib/NativeCalls/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/NativeCalls/Makefile" ;; 5516 "contrib/NewtObjC/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/NewtObjC/Makefile" ;; 5481 5517 "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; 5482 5518 *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 … … 5600 5636 s,@DLEXT@,$DLEXT,;t t 5601 5637 s,@MAKE_EXT@,$MAKE_EXT,;t t 5638 s,@MAKE_CONTRIB@,$MAKE_CONTRIB,;t t 5639 s,@BINDIR@,$BINDIR,;t t 5640 s,@sitedir@,$sitedir,;t t 5641 s,@libffidir@,$libffidir,;t t 5602 5642 s,@LIBREGEX@,$LIBREGEX,;t t 5603 5643 s,@LTLIBOBJS@,$LTLIBOBJS,;t t -
NEWT0/trunk/configure.in
r56 r78 103 103 LIBNEWT_LDSHARED='$(CC) -dynamic -bundle -undefined suppress -flat_namespace' 104 104 DLEXT='dylib' 105 MAKE_CONTRIB='contrib' 105 106 ;; 106 107 cygwin*|mingw*) … … 145 146 esac 146 147 147 148 148 case "$HAVE_DLOPEN" in 149 149 yes) … … 153 153 esac 154 154 155 test "x$prefix" = xNONE && prefix=$ac_default_prefix 155 156 156 NEWT_LDFLAGS="$NEWT_LDFLAGS $LIBDL" 157 AC_ARG_WITH(sitedir, 158 AS_HELP_STRING([--with-sitedir=DIR], 159 [site libraries in DIR [[PREFIX/lib/newt0]]]), 160 [sitedir=$withval], 161 [sitedir='${prefix}/lib/newt0']) 162 SITE_DIR="`eval \"echo ${sitedir}\"`" 163 164 AC_ARG_WITH(libffidir, 165 AS_HELP_STRING([--with-libffidir=DIR], 166 [where libffi libraries can be found [[PREFIX]]]), 167 [libffidir=$withval], 168 [libffidir='${prefix}']) 157 169 158 170 AC_DEFINE_UNQUOTED(__PLATFORM__, "$target_os") 159 171 AC_DEFINE_UNQUOTED(__DYLIBSUFFIX__, ".$DLEXT") 172 AC_DEFINE_UNQUOTED(__LIBDIR__, "${SITE_DIR}") 173 174 NEWT_LDFLAGS="$NEWT_LDFLAGS $LIBDL" 160 175 161 176 AC_SUBST(NEWT_LDIMPORT) … … 165 180 AC_SUBST(DLEXT) 166 181 AC_SUBST(MAKE_EXT) 182 AC_SUBST(MAKE_CONTRIB) 183 AC_SUBST(BINDIR) 184 AC_SUBST(sitedir) 185 AC_SUBST(libffidir) 167 186 168 187 AC_SUBST(LIBREGEX) … … 170 189 AC_CONFIG_FILES([Makefile 171 190 ext/protoFILE/Makefile 172 ext/protoREGEX/Makefile]) 191 ext/protoREGEX/Makefile 192 contrib/NativeCalls/Makefile 193 contrib/NewtObjC/Makefile]) 173 194 AC_OUTPUT -
NEWT0/trunk/contrib/NativeCalls/README
r31 r78 9 9 --------- 10 10 NativeCalls can be compiled using GNU Make and libffi. 11 It was compiled with libffi-20030921 available from the pyobjc project. 12 http://prdownloads.sourceforge.net/pyobjc/libffi-src-20030921.tar.gz?download 13 14 By default, NativeCalls considers that libffi is in /opt/local (as installed 15 by DarwinPorts). You can select another location with LIBFFI_PREFIX variable. 16 For example, if libffi was installed with --prefix=/home/pguyot/unix, you can 17 compile NativeCalls with: 18 make LIBFFI_PREFIX=/home/pguyot/unix 11 By default, configure (in trunk/) will configure the Makefile to use the libffi 12 that exists in ${prefix}. 19 13 20 14 Opening a library -
NEWT0/trunk/contrib/NewtObjC/NewtObjC.m
r31 r78 42 42 // NEWT/0 43 43 #include "NewtCore.h" 44 #include "config.h" 44 45 45 46 // NewtObjC … … 61 62 { 62 63 // Load the objc-runtime extension dynamic library. 63 if (!NSAddLibraryWithSearching("@executable_path/objc-runtime-x.dylib")) 64 if (!NSAddLibraryWithSearching("@loader_path/objc-runtime-x.dylib") // Tiger and higher. 65 && !NSAddLibraryWithSearching("@executable_path/objc-runtime-x.dylib") // In-place. 66 && !NSAddLibraryWithSearching(__LIBDIR__ "/objc-runtime-x.dylib")) // Installed path. 64 67 { 65 68 (void) NewtThrow(kNErrObjCRuntimeErr, NewtMakeString("Couldn't find objc-runtime-x.dylib", true)); -
NEWT0/trunk/ext/protoFILE/Makefile.in
r56 r78 9 9 objdir = $(build)/obj 10 10 11 prefix = @prefix@ 12 exec_prefix = @exec_prefix@ 13 sitedir = ${prefix}/lib/newt0 14 libdir = @libdir@ 11 15 12 16 CC = @CC@ … … 53 57 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(NEWTLIBNAME).c 54 58 59 install:: 60 install -d -m 755 $(DESTDIR)$(sitedir) 61 install -m 644 $(NEWTEXLIB) $(DESTDIR)$(sitedir) 62 55 63 clean: 56 64 rm -rf $(NEWTEXLIB) -
NEWT0/trunk/ext/protoREGEX/Makefile.in
r56 r78 12 12 prefix = @prefix@ 13 13 exec_prefix = @exec_prefix@ 14 sitedir = ${prefix}/lib/newt0 14 15 libdir = @libdir@ 15 16 … … 59 60 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(NEWTLIBNAME).c 60 61 62 install:: 63 install -d -m 755 $(DESTDIR)$(sitedir) 64 install -m 644 $(NEWTEXLIB) $(DESTDIR)$(sitedir) 65 61 66 clean: 62 67 rm -rf $(NEWTEXLIB) -
NEWT0/trunk/src/config.h.in
r56 r78 32 32 #undef __PLATFORM__ 33 33 #undef __DYLIBSUFFIX__ 34 #undef __LIBDIR__ 34 35 35 36 #undef __IPOD__ -
NEWT0/trunk/src/newt_core/NewtEnv.c
r68 r78 220 220 { 221 221 struct { 222 char * name; 223 newtRefVar slot; 224 char * defaultValue; 225 bool ispath; 222 char * name; 223 newtRefVar slot; 224 const char * defaultValue; 226 225 } envs[] = { 227 {"NEWTLIB", NSSYM0(NEWTLIB), NULL, true},228 {"PLATFORM", NSSYM(PLATFORM), __PLATFORM__ , false},229 {"DYLIBSUFFIX", NSSYM(DYLIBSUFFIX), __DYLIBSUFFIX__ , false},230 {NULL, kNewtRefUnbind, NULL , false}226 {"NEWTLIB", NSSYM0(NEWTLIB), __LIBDIR__ ":."}, 227 {"PLATFORM", NSSYM(PLATFORM), __PLATFORM__}, 228 {"DYLIBSUFFIX", NSSYM(DYLIBSUFFIX), __DYLIBSUFFIX__}, 229 {NULL, kNewtRefUnbind, NULL} 231 230 }; 232 231 … … 241 240 for (i = 0; envs[i].name != NULL; i++) 242 241 { 243 v = NewtGetEnv(envs[i].name); 244 245 if (NewtRefIsString(v)) 246 { 247 if (envs[i].ispath) 248 v = NcSplit(v, NewtMakeCharacter(':')); 249 250 NcSetSlot(proto, envs[i].slot, v); 251 } 252 else if (envs[i].defaultValue) 253 { 254 NcSetSlot(proto, envs[i].slot, NewtMakeString(envs[i].defaultValue, true)); 255 } 242 NcSetSlot(proto, envs[i].slot, NewtMakeString(envs[i].defaultValue, true)); 243 } 244 245 /* NEWTLIB is a special case, it can be overridden from the value in 246 the global variables. */ 247 v = NewtGetEnv("NEWTLIB"); 248 if (NewtRefIsString(v)) 249 { 250 v = NcSplit(v, NewtMakeCharacter(':')); 251 NcSetSlot(proto, NSSYM0(NEWTLIB), v); 252 } 253 else 254 { 255 newtRefVar default_newtlib_array[] = {NSSTR(__LIBDIR__), NSSTR(".")}; 256 newtRefVar default_newtlib = NewtMakeArray2( 257 kNewtRefNIL, 258 sizeof(default_newtlib_array) / sizeof(newtRefVar), 259 default_newtlib_array); 260 NcSetSlot(proto, NSSYM0(NEWTLIB), default_newtlib); 256 261 } 257 262 -
NEWT0/trunk/src/newt_core/NewtFile.c
r68 r78 537 537 newtRefVar path; 538 538 uint32_t len; 539 uint32_t nb_suffixes; 539 540 uint32_t i; 540 541 uint32_t j; … … 547 548 if (NewtRefIsNIL(newtlib)) 548 549 { 549 newtRefVar initPath[] = {NSSTR("."), NcGetGlobalVar(NSSYM0(_EXEDIR_))}; 550 550 newtRefVar initPath[] = {NSSTR(__LIBDIR__), NSSTR(".")}; 551 551 newtlib = NewtMakeArray2(kNewtRefNIL, sizeof(initPath) / sizeof(newtRefVar), initPath); 552 552 } 553 553 554 554 len = NewtLength(newtlib); 555 556 for (i = 0; i < len; i++) 555 nb_suffixes = sizeof(lib_exts) / sizeof(lib_exts[0]); 556 557 for (j = 0; j < nb_suffixes; j++) 557 558 { 558 dir = NewtGetArraySlot(newtlib, i); 559 NewtSetArraySlot(patharray, 0, NcJoinPath(dir, r)); 560 561 for (j = 0; j < sizeof(lib_exts) / sizeof(lib_exts[0]); j++) 559 NewtSetArraySlot(patharray, 1, lib_exts[j].ext); 560 561 for (i = 0; i <= len; i++) 562 562 { 563 NewtSetArraySlot(patharray, 1, lib_exts[j].ext); 564 path = NcStringer(patharray); 565 566 if (NewtFileExists(NewtRefToString(path))) 563 if (i == len) { 564 dir = NcGetGlobalVar(NSSYM0(_EXEDIR_)); 565 } else { 566 dir = NewtGetArraySlot(newtlib, i); 567 } 568 if (NewtRefIsString(dir)) 567 569 { 570 NewtSetArraySlot(patharray, 0, NcJoinPath(dir, r)); 571 path = NcStringer(patharray); 572 573 if (NewtFileExists(NewtRefToString(path))) 574 { 568 575 #ifdef HAVE_DLOPEN 569 if (lib_exts[j].type == typeDylib) 570 { 571 lib = NcLoadLib(path); 572 NcSetSlot(requires, sym, lib); 576 if (lib_exts[j].type == typeDylib) 577 { 578 lib = NcLoadLib(path); 579 NcSetSlot(requires, sym, lib); 580 } 581 else 582 #endif /* HAVE_DLOPEN */ 583 { 584 NcSetSlot(requires, sym, path); 585 NcLoad(path); 586 } 587 588 return sym; 573 589 } 574 else575 #endif /* HAVE_DLOPEN */576 {577 NcSetSlot(requires, sym, path);578 NcLoad(path);579 }580 581 return sym;582 590 } 583 591 } -
NEWT0/trunk/src/newt_core/NewtObj.c
r71 r78 33 33 static uint32_t NewtObjStringLength(newtObjRef obj); 34 34 static newtObjRef NewtObjStringSetLength(newtObjRef obj, uint32_t n); 35 static void NewtMakeInitSlots(newtRefArg r, uint32_t st, uint32_t n, uint32_t step, newtRefVar v[]);35 static void NewtMakeInitSlots(newtRefArg r, uint32_t st, uint32_t n, uint32_t step, const newtRefVar v[]); 36 36 static newtObjRef NewtObjSlotsSetLength(newtObjRef obj, uint32_t n, newtRefArg v); 37 37 static int NewtInt32Compare(newtRefArg r1, newtRefArg r2); … … 1433 1433 } 1434 1434 1435 void NewtMakeInitSlots(newtRefArg r, uint32_t st, uint32_t n, uint32_t step, newtRefVar v[])1435 void NewtMakeInitSlots(newtRefArg r, uint32_t st, uint32_t n, uint32_t step, const newtRefVar v[]) 1436 1436 { 1437 1437 if (v != NULL) … … 1461 1461 */ 1462 1462 1463 newtRef NewtMakeArray2(newtRefArg klass, uint32_t n, newtRefVar v[])1463 newtRef NewtMakeArray2(newtRefArg klass, uint32_t n, const newtRefVar v[]) 1464 1464 { 1465 1465 newtRefVar r; -
NEWT0/trunk/src/newt_core/incs/NewtObj.h
r68 r78 169 169 newtRef NewtMakeReal(double v); 170 170 newtRef NewtMakeArray(newtRefArg klass, uint32_t n); 171 newtRef NewtMakeArray2(newtRefArg klass, uint32_t n, newtRefVar v[]);171 newtRef NewtMakeArray2(newtRefArg klass, uint32_t n, const newtRefVar v[]); 172 172 newtRef NewtMakeMap(newtRefArg superMap, uint32_t n, newtRefVar v[]); 173 173 void NewtSetMapFlags(newtRefArg map, int32_t bit);
