euphoria

changeset 5150:305d97ec0a2c struct

* merge trunk into struct branch
author Matt Lewis
date Sun Sep 11 17:03:37 2011 -0400 (20 months ago)
parents 9b81b286b459 34ac54b819b4
children 8c3f30446406
files Jamfile Jamrules bin/jam.exe docs/Jamfile docs/refman_2.txt source/Jamfile source/Makefile.gnu source/Makefile.wat source/memstruct.e source/msgtext.e source/traninit.e tests/Jamfile
line diff
     1.1 --- a/.hgignore	Fri Sep 02 10:12:05 2011 -0400
     1.2 +++ b/.hgignore	Sun Sep 11 17:03:37 2011 -0400
     1.3 @@ -28,11 +28,19 @@
     1.4  bin/euloc.exe
     1.5  bin/eushroud
     1.6  bin/eushroud.exe
     1.7 +bin/euso.a
     1.8 +bin/eusodbg.a
     1.9 +bin/euso.lib
    1.10 +bin/eusodbg.lib
    1.11  bin/eutest
    1.12  bin/eutest.exe
    1.13 +bin/mkver
    1.14 +bin/mkver.exe
    1.15 +docs/manual.txt
    1.16  packaging/win32/euphoria-.*exe
    1.17  source/config.gnu
    1.18  source/config.wat
    1.19 +source/eu.cfg
    1.20  source/Makefile
    1.21  tests/dump.edb
    1.22  tests/ecp.dat
    1.23 @@ -44,6 +52,7 @@
    1.24  ^build/.*
    1.25  ^build40/.*
    1.26  ^build_mingw/.*
    1.27 +^docs/out/.*
    1.28  ^source/.*res$
    1.29  ^source/mkver.o$
    1.30  ^source/build/.*
     2.1 --- a/Jamfile	Fri Sep 02 10:12:05 2011 -0400
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,108 +0,0 @@
     2.4 -#
     2.5 -# Jam build system for Euphoria
     2.6 -#
     2.7 -
     2.8 -SubDir TOP ;
     2.9 -
    2.10 -#
    2.11 -# Configuration
    2.12 -#
    2.13 -# Use: jam DEBUG=yes config to create/update config.jam
    2.14 -#
    2.15 -
    2.16 -CONFIG  ?= [ FDirName $(TOP) config.jam ] ;
    2.17 -if $(UNIX) {
    2.18 -    MANAGED_MEMORY_DEFAULT = off ;
    2.19 -} else {
    2.20 -    MANAGED_MEMORY_DEFAULT = on ;
    2.21 -}
    2.22 -
    2.23 -rule WriteConfig
    2.24 -{
    2.25 -    # Must quote filenames such as C:\Euphoria otherwise when reading them
    2.26 -    # back from the config file, \E will be interpreted as a special character
    2.27 -    # like \n.
    2.28 -
    2.29 -    BUILD_DIR on $(<) = $(BUILD_DIR:Q) ;
    2.30 -
    2.31 -    # Let the user see all the options as they may have simply changed one
    2.32 -    # value and left the others alone.
    2.33 -
    2.34 -    #Echo "" ;
    2.35 -    #Echo "Configuration settings:" ;
    2.36 -    #Echo "" ;
    2.37 -    #Echo "   BUILD_DIR=$(BUILD_DIR)" ;
    2.38 -    #Echo "   DEBUG=$(DEBUG)" ;
    2.39 -    #Echo "   MANAGED_MEMORY=$(MANAGED_MEMORY)" ;
    2.40 -    #Echo "" ;
    2.41 -}
    2.42 -
    2.43 -actions WriteConfig
    2.44 -{
    2.45 -    echo # Jam configuration file for Euphoria > $(CONFIG)
    2.46 -    echo BUILD_DIR ?= $(BUILD_DIR) ; >> $(CONFIG)
    2.47 -    echo DEBUG ?= $(DEBUG) ; >> $(CONFIG)
    2.48 -    echo MANAGED_MEMORY ?= $(MANAGED_MEMORY) ; >> $(CONFIG)
    2.49 -    
    2.50 -    echo =======================================
    2.51 -    echo Configuration Updated
    2.52 -    echo ---------------------
    2.53 -    echo   BUILD_DIR      : $(BUILD_DIR)
    2.54 -    echo   DEBUG          : $(DEBUG)
    2.55 -    echo   MANAGED_MEMORY : $(MANAGED_MEMORY)
    2.56 -    echo =======================================
    2.57 -    
    2.58 -    Exit ;
    2.59 -}
    2.60 -
    2.61 -if [ FileExists $(CONFIG) ]
    2.62 -{
    2.63 -    include $(CONFIG) ;
    2.64 -
    2.65 -    WriteConfig config ;
    2.66 -    
    2.67 -    #
    2.68 -    # Include our sub directory projects
    2.69 -    #
    2.70 -    
    2.71 -    SubInclude TOP source ;
    2.72 -    SubInclude TOP docs ;
    2.73 -    SubInclude TOP tests ;
    2.74 -
    2.75 -}
    2.76 -else
    2.77 -{
    2.78 -    Echo "ERROR: $(CONFIG) does not yet exist" ;
    2.79 -    Echo "" ;
    2.80 -    Echo "To create the $(CONFIG) file, use jam VARNAME=VALUE config" ;
    2.81 -    Echo "" ;
    2.82 -    Echo "Valid options are:" ;
    2.83 -    Echo "" ;
    2.84 -    Echo "  DEBUG=on|off       Enable/Disable debug mode (default: off)" ;
    2.85 -    Echo "  MANAGED_MEM=on|off Enable/Disable managed memory " ;
    2.86 -    Echo "                     (default: $(MANAGED_MEMORY_DEFAULT))" ;
    2.87 -    Echo "  BUILD_DIR=dir      Directory to build Euphoria and related " ;
    2.88 -    Echo "                     tools in (default: build)" ;
    2.89 -    Echo "" ;
    2.90 -    Echo "To create a default configuration file, simply run the command:" ;
    2.91 -    Echo "" ;
    2.92 -    Echo "  jam config" ;
    2.93 -    Echo "" ;
    2.94 -    Echo "Values can be changed at any time. Changing one value will not" ;
    2.95 -    Echo "affect other values. For instance, if you have a custom build" ;
    2.96 -    Echo "directory you can use jam DEBUG=on config and jam DEBUG=off config" ;
    2.97 -    Echo "to toggle the debug setting without affecting the previously set" ;
    2.98 -    Echo "custom build directory." ;
    2.99 -    Echo "" ;
   2.100 -    
   2.101 -    #
   2.102 -    # Setup our defaults. Anything the user supplies on the command line will
   2.103 -    # override these settings
   2.104 -    #
   2.105 -    
   2.106 -    DEBUG           ?= no ;
   2.107 -    MANAGED_MEMORY  ?= $(MANAGED_MEMORY_DEFAULT) ;
   2.108 -    BUILD_DIR       ?= [ FDirName $(TOP) build ] ;
   2.109 -    
   2.110 -    WriteConfig config ;
   2.111 -}
     3.1 --- a/Jamrules	Fri Sep 02 10:12:05 2011 -0400
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,240 +0,0 @@
     3.4 -#
     3.5 -# Jamrules contains rules that will be applicable to all
     3.6 -# Euphoria programs including user projects.
     3.7 -#
     3.8 -
     3.9 -#
    3.10 -# Ensure that a proper EUDIR is set
    3.11 -#
    3.12 -
    3.13 -if ! $(EUDIR)
    3.14 -{
    3.15 -    # The top of this Euphoria directory tree will be our EUDIR
    3.16 -    # since the user has not supplied one.
    3.17 -    EUDIR = $(TOP) ;
    3.18 -
    3.19 -    Echo "Warning: $(TOP) is used as the EUDIR since EUDIR was not set" ;
    3.20 -}
    3.21 -
    3.22 -#
    3.23 -# Setup some common executable names
    3.24 -#
    3.25 -
    3.26 -OUR_EUI_EXE = [ FDirName $(EUDIR) bin eui$(SUFEXE) ] ;
    3.27 -OUR_EUC_EXE = [ FDirName $(EUDIR) bin euc$(SUFEXE) ] ;
    3.28 -OUR_EUTEST_EXE = [ FDirName $(EUDIR) bin eutest$(SUFEXE) ] ;
    3.29 -
    3.30 -PATH_EUI_EXE = eui ;
    3.31 -PATH_EUC_EXE = euc ;
    3.32 -PATH_EUTEST_EXE = eutest ;
    3.33 -
    3.34 -#
    3.35 -# Setup our build commands
    3.36 -#
    3.37 -
    3.38 -BUILD_EUI_CMD = $(PATH_EUI_EXE) -i [ FDirName $(ROOT_DIR) include ]
    3.39 -    [ FDirName $(ROOT_DIR) source eu.ex ] ;
    3.40 -BUILD_EUC_CMD = $(PATH_EUI_EXE) -i [ FDirName $(ROOT_DIR) include ]
    3.41 -    [ FDirName $(ROOT_DIR) source ec.ex ] ;
    3.42 -
    3.43 -#
    3.44 -# Echo a variables content (single or list).
    3.45 -#
    3.46 -# This rule is helpful in various Jam debugging tasks. It has
    3.47 -# no real applicability outside of working with Jam.
    3.48 -#
    3.49 -
    3.50 -rule EchoVar
    3.51 -{
    3.52 -    local __i ;
    3.53 -    for __i in $(1)
    3.54 -    {
    3.55 -        echo $(__i) "=" [$($(__i))] ;
    3.56 -    }
    3.57 -}
    3.58 -
    3.59 -#
    3.60 -# Determine if a file exists. 1 is returned if it does, 0 is
    3.61 -# returned if it does not.
    3.62 -#
    3.63 -# Example:
    3.64 -#   if [ FileExists hello.txt ] = 0
    3.65 -#   {
    3.66 -#       Echo hello.txt exists ;
    3.67 -#   }
    3.68 -#
    3.69 -
    3.70 -rule FileExists
    3.71 -{
    3.72 -    local f ;
    3.73 -    f = [ Glob . : $(<) ] ;
    3.74 -    if $(f)
    3.75 -    {
    3.76 -        return 1 ;
    3.77 -    }
    3.78 -}
    3.79 -
    3.80 -#
    3.81 -# EuMain builds an executable from euphoria source
    3.82 -#
    3.83 -# Example:
    3.84 -#   EuMain hello : hello.ex ;
    3.85 -#
    3.86 -
    3.87 -rule EuWinMain
    3.88 -{
    3.89 -    local _s _t ;
    3.90 -
    3.91 -    # so 'jam foo' works when it's really foo.exe
    3.92 -
    3.93 -    # Add grist to file names
    3.94 -    # Add suffix to exe
    3.95 -
    3.96 -    _s = [ FGristFiles $(>) ] ;
    3.97 -    _t = [ FAppendSuffix $(<) : $(SUFEXE) ] ;
    3.98 -
    3.99 -    if $(_t) != $(<)
   3.100 -    {
   3.101 -        Depends $(<) : $(_t) ;
   3.102 -        NotFile $(<) ;
   3.103 -    }
   3.104 -
   3.105 -    Depends exe : $(_t) ;
   3.106 -    Depends $(_t) : $(_s) ;
   3.107 -
   3.108 -    # Setup the rules that will scan Euphoria source looking
   3.109 -    # for include statements, thus adding them as dependencies
   3.110 -    HDRRULE on $(_s) = HdrRule ;
   3.111 -    HDRSCAN on $(_s) = "^[^-\"\'\/]*include[ ]+([^ ]+.[ex])" ;
   3.112 -    HDRSEARCH on $(_s) = $(SEARCH_SOURCE:E) $(SUBDIRHDRS) $(HDRS) $(STDHDRS) ;
   3.113 -    HDRGRIST on $(_s) = $(HDRGRIST) ;
   3.114 -
   3.115 -    # Add our resulting executable to the clean target
   3.116 -    Clean clean : $(_t) ;
   3.117 -    
   3.118 -    MakeLocate $(_t) : $(BUILD_DIR) ;
   3.119 -
   3.120 -    Depends all : $(<) ;
   3.121 -    Depends $(<) : $(>) ;
   3.122 -    Depends $(<) : $(USER_LIBRARY)$(SUFLIB) ;
   3.123 -
   3.124 -    FINAL_OUTPUT on $(<) = [ FDirName $(BUILD_DIR) $(<) ] ;
   3.125 -    FINAL_BUILD_DIR on $(<) = [ FDirName $(BUILD_DIR) $(<).dir ] ;
   3.126 -    FINAL_USER_LIBRARY on $(<) = [ FDirName $(FINAL_BUILD_DIR) $(USER_LIBRARY) ] ;
   3.127 -
   3.128 -    Clean clean : $(FINAL_BUILD_DIR) ;
   3.129 -
   3.130 -    EuWinMain1 $(<) : $(>)  ;
   3.131 -}
   3.132 -
   3.133 -actions EuWinMain1
   3.134 -{
   3.135 -    $(BUILD_EUC_CMD) $(EUCFLAGS) -o $(FINAL_OUTPUT) -build-dir $(FINAL_BUILD_DIR) -keep -lib $(FINAL_USER_LIBRARY) $(>)
   3.136 -}
   3.137 -
   3.138 -rule EuMain
   3.139 -{
   3.140 -    EUCFLAGS on $(<) = $(EUCFLAGS) -con ;
   3.141 -
   3.142 -    EuWinMain $(<) : $(>) ;
   3.143 -}
   3.144 -
   3.145 -#
   3.146 -# Test a given file via the eutest program. The second parameter
   3.147 -# can be a single test filename or a list of file names.
   3.148 -#
   3.149 -# Example:
   3.150 -#   EuTest test_sequence : t_sequence.e ;
   3.151 -#   EuTest common_tests : t_cmdline.e t_math.e t_sequence.e ;
   3.152 -#
   3.153 -# Todo:
   3.154 -#   * Use the newly build eutest
   3.155 -#   * Use -ec and -exe to pass the newly build eui and euc
   3.156 -#
   3.157 -
   3.158 -rule EuTest
   3.159 -{
   3.160 -    if $(BUILD_EUTEST_EXE)
   3.161 -    {
   3.162 -        EUTEST_EXE on $(<) = $(BUILD_EUTEST_EXE) ;
   3.163 -    }
   3.164 -}
   3.165 -
   3.166 -actions EuTest
   3.167 -{
   3.168 -    $(EUTEST_EXE) $(>)
   3.169 -}
   3.170 -
   3.171 -#
   3.172 -# Test an entire directory of t_*.e files via the eutest program.
   3.173 -#
   3.174 -# Example:
   3.175 -#   EuTest tests : [ FDirName $(TOP) tests ] ;
   3.176 -#
   3.177 -# Todo:
   3.178 -#   * Use the newly build eutest
   3.179 -#   * Use -ec and -exe to pass the newly build eui and euc
   3.180 -#
   3.181 -
   3.182 -rule EuTestDir
   3.183 -{
   3.184 -    if $(BUILD_EUTEST_EXE)
   3.185 -    {
   3.186 -        EUTEST_EXE on $(<) = $(BUILD_EUTEST_EXE) ;
   3.187 -    }
   3.188 -}
   3.189 -
   3.190 -actions EuTestDir
   3.191 -{
   3.192 -    cd $(>)
   3.193 -    $(EUTEST_EXE)
   3.194 -}
   3.195 -
   3.196 -#
   3.197 -# A few rules to get eudoc and compile eudoc (if you retrieved the sources)
   3.198 -#
   3.199 -
   3.200 -rule GetEuDoc
   3.201 -{
   3.202 -    EUDOC_DIR on $(<) = [ FDirName $(TOP) source eudoc ] ;
   3.203 -    CREOLE_DIR on $(<) = [ FDirName $(TOP) source eudoc creole ] ;
   3.204 -}
   3.205 -
   3.206 -actions GetEuDoc
   3.207 -{
   3.208 -    svn co http://rapideuphoria.svn.sourceforge.net/svnroot/rapideuphoria/tools/eudoc/trunk $(EUDOC_DIR)
   3.209 -    svn co http://rapideuphoria.svn.sourceforge.net/svnroot/rapideuphoria/tools/creole/trunk $(CREOLE_DIR)
   3.210 -}
   3.211 -
   3.212 -EUDOC_SOURCE = [ Glob [ FDirName $(TOP) source eudoc ] : eudoc.ex ] ;
   3.213 -CREOLEHTML_SOURCE = [ Glob [ FDirName $(TOP) source eudoc creole ] : creolehtml.ex ] ;
   3.214 -
   3.215 -GetEuDoc get_eudoc ;
   3.216 -
   3.217 -#
   3.218 -# Generate documentation using eudoc
   3.219 -#
   3.220 -# Example:
   3.221 -#   EuDoc manual : manual.af : euphoria.txt : tmpl.html ;
   3.222 -#
   3.223 -
   3.224 -rule EuDoc
   3.225 -{
   3.226 -    if ! $(EUDOC_SOURCE)
   3.227 -    {
   3.228 -        Depends $(<) : get_eudoc ;
   3.229 -
   3.230 -        EUDOC_SOURCE = [ FDirName $(TOP) source eudoc eudoc.ex ] ;
   3.231 -        CREOLEHTML_SOURCE = [ FDirName $(TOP) source eudoc creole creolehtml.ex ] ;
   3.232 -    }
   3.233 -
   3.234 -    ASSEMBLY_FILE on $(<) = $(2) ;
   3.235 -    CREOLE_FILE on $(<) = $(3) ;
   3.236 -    TEMPLATE on $(<) = $(4) ;
   3.237 -}
   3.238 -
   3.239 -actions EuDoc
   3.240 -{
   3.241 -    $(PATH_EUI_EXE) $(EUDOC_SOURCE) -v -a $(ASSEMBLY_FILE) -o $(CREOLE_FILE)
   3.242 -    $(PATH_EUI_EXE) $(CREOLEHTML_SOURCE) -A=ON -t=$(TEMPLATE) -ohtml $(CREOLE_FILE)
   3.243 -}
     4.1 Binary file bin/jam.exe has changed
     5.1 --- a/docs/Jamfile	Fri Sep 02 10:12:05 2011 -0400
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,3 +0,0 @@
     5.4 -SubDir TOP docs ;
     5.5 -
     5.6 -EuDoc manual : manual.af : euphoria.txt : template.html ;
     6.1 --- a/docs/e2c.txt	Fri Sep 02 10:12:05 2011 -0400
     6.2 +++ b/docs/e2c.txt	Sun Sep 11 17:03:37 2011 -0400
     6.3 @@ -206,6 +206,17 @@
     6.4  specified platform, or, possibly a cross platform compiler, if you have
     6.5  one configured.
     6.6  
     6.7 +==== -arch - Set architecture
     6.8 +
     6.9 +The translator generally produces cross platform code.  However, the euphoria
    6.10 +source code may have different code for different architectures.  The default
    6.11 +is to use the architecture of the translator binary that is being used.  To
    6.12 +target a different architecture, you can use one of three supported architectures:
    6.13 +
    6.14 +* X86
    6.15 +* X86_64
    6.16 +* ARM
    6.17 +
    6.18  ==== -makefile / -makefile-partial - Using makefiles
    6.19  
    6.20  You can optionally have the translator create a makefile that you can use
     7.1 --- a/docs/man/euc.1	Fri Sep 02 10:12:05 2011 -0400
     7.2 +++ b/docs/man/euc.1	Sun Sep 11 17:03:37 2011 -0400
     7.3 @@ -166,6 +166,9 @@
     7.4  .TP
     7.5  Translator Options:
     7.6  .TP
     7.7 +.B \-arch name
     7.8 +Specify the target architecture: X86, X86_64, ARM
     7.9 +.TP
    7.10  .B \-builddir dir
    7.11  Generate/compile all file in the specified build directory
    7.12  .TP
     8.1 --- a/docs/refman_2.txt	Fri Sep 02 10:12:05 2011 -0400
     8.2 +++ b/docs/refman_2.txt	Sun Sep 11 17:03:37 2011 -0400
     8.3 @@ -2279,6 +2279,7 @@
     8.4  there is a built-in of the same name, Euphoria will not assume an override, and
     8.5  will choose the built-in. A warning will be generated whenever this happens.
     8.6  
     8.7 +@[deprecate|]
     8.8  === Deprecation
     8.9  
    8.10  Beginning in Euphoria 4.1, procedures and functions can be marked as deprecated.
    8.11 @@ -2759,6 +2760,25 @@
    8.12  * **BSD** - Platform is a BSD variant (FreeBSD, OpenBSD, NetBSD and OS X)
    8.13  * **UNIX** - Platform is any Unix
    8.14  
    8.15 +==== Architecture Definitions
    8.16 +
    8.17 +Chip architecture:
    8.18 +* **X86**
    8.19 +* **X86_64**
    8.20 +* **ARM**
    8.21 +
    8.22 +Size of pointers and euphoria objects.  This information can be derived from
    8.23 +the chip architecture, but is provided for convenience.
    8.24 +* **BITS32**
    8.25 +* **BITS64**
    8.26 +
    8.27 +Size of long integers.  On Windows, long integers are always 32 bits.  On other
    8.28 +platforms, long integers are the same size as pointers.  This information can
    8.29 +also be derived from a combination of other architecture and platform ifdefs,
    8.30 +but is provided for convenience.
    8.31 +* **LONG32**
    8.32 +* **LONG64**
    8.33 +
    8.34  ==== Application Definitions
    8.35  
    8.36  * **EUI** - Application is being interpreted by ##eui##.
     9.1 --- a/docs/release/4.1.0.txt	Fri Sep 02 10:12:05 2011 -0400
     9.2 +++ b/docs/release/4.1.0.txt	Sun Sep 11 17:03:37 2011 -0400
     9.3 @@ -20,4 +20,6 @@
     9.4    euphoria code into shared objects.
     9.5  * -lib-pic switch for translator to specify the PIC runtime library to be used
     9.6  * [[ticket:166]] get_integer{16,32} will return -1 on EOF.
     9.7 -
     9.8 +* Added [[:deprecate]] keyword
     9.9 +* Architecture ifdefs (X86, X86_64, ARM, BITS32, BITS64, LONG32, LONG64)
    9.10 +* -arch option for translator for cross translating
    9.11 \ No newline at end of file
    10.1 --- a/source/Jamfile	Fri Sep 02 10:12:05 2011 -0400
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,235 +0,0 @@
    10.4 -SubDir TOP source ;
    10.5 -
    10.6 -#
    10.7 -# Setup compiler specific flags
    10.8 -#
    10.9 -
   10.10 -if $(JAM_TOOLSET) = WATCOM
   10.11 -{
   10.12 -    CCFLAGS = /bt=nt /mf /w0 /zq /j /zp4 /fp5 /fpi87 /5r /otimra /s /ol /zp4 /dEWATCOM /dEOW ;
   10.13 -    EUCFLAGS = -wat ;
   10.14 -}
   10.15 -else if $(JAM_TOOLSET) = VISUALC
   10.16 -{
   10.17 -    CCFLAGS = -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DEMSVC ;
   10.18 -}
   10.19 -else if $(JAM_TOOLSET) = MINGW
   10.20 -{
   10.21 -    CCFLAGS = -w -ffast-math -O2 -Os -DEMINGW -mno-cygwin -mwindows ;
   10.22 -    EUCFLAGS = -gcc ;
   10.23 -}
   10.24 -else
   10.25 -{
   10.26 -    CCFLAGS = -w -ffast-math -O2 -Os ;
   10.27 -}
   10.28 -
   10.29 -CCFLAGS += -DHAVE_CONFIG_H ;
   10.30 -
   10.31 -#
   10.32 -# Setup platform specific flags
   10.33 -#
   10.34 -
   10.35 -if $(NT)
   10.36 -{
   10.37 -    CCFLAGS += /dEWINDOWS ;
   10.38 -}
   10.39 -else if $(UNIX)
   10.40 -{
   10.41 -    CCFLAGS += -DEUNIX ;
   10.42 -    if $(OS) = MACOSX
   10.43 -    {
   10.44 -        CCFLAGS += -DEBSD -DEBSD62 -DEOSX ;
   10.45 -    }
   10.46 -    else if $(OS) = FREEBSD
   10.47 -    {
   10.48 -        CCFLAGS += -DEBSD -DEBSD62 -DEFREEBSD ;
   10.49 -    }
   10.50 -    else if $(OS) = OPENBSD
   10.51 -    {
   10.52 -        CCFLAGS += -DEBSD -DEBSD62 -DEOPENBSD ;
   10.53 -    }
   10.54 -    else if $(OS) = NETBSD
   10.55 -    {
   10.56 -        CCFLAGS += -DEBSD -DEBSD62 -DENETBSD ;
   10.57 -    }
   10.58 -    else if $(OS) = LINUX
   10.59 -    {
   10.60 -        CCFLAGS += -DELINUX ;
   10.61 -    }
   10.62 -    else
   10.63 -    {
   10.64 -        Echo $(OS) is not supported by Euphoria ;
   10.65 -        Exit ;
   10.66 -    }
   10.67 -}
   10.68 -else
   10.69 -{
   10.70 -    Echo $(OS) is not supported by Euphoria ;
   10.71 -    Exit ;
   10.72 -}
   10.73 -
   10.74 -#
   10.75 -# Special flags for PCRE
   10.76 -#
   10.77 -
   10.78 -CCFLAGS += -DNO_RECURSE ;
   10.79 -
   10.80 -#
   10.81 -# Configuration Flags
   10.82 -#
   10.83 -
   10.84 -if $(MANAGED_MEMORY) = "on" {
   10.85 -    EUCFLAGS +=  -D EU_MANAGED_MEM ;
   10.86 -    CCFLAGS += -dMANAGED_MEM ;
   10.87 -}
   10.88 -
   10.89 -if $(DEBUG) = "on" {
   10.90 -    EUCFLAGS += -D DEBUG ;
   10.91 -    CCFLAGS += -dDEBUG ;
   10.92 -}
   10.93 -
   10.94 -#
   10.95 -# Generates be_ver.h
   10.96 -#
   10.97 -
   10.98 -BE_VER_H = [ FDirName $(BUILD_DIR) be_ver.h ] ;
   10.99 -BE_VER_CACHE = [ FDirName $(BUILD_DIR) be_ver.cache ] ;
  10.100 -
  10.101 -rule BeVer
  10.102 -{
  10.103 -    Clean clean : $(<) ;
  10.104 -    Depends $(>) : $(<) ;
  10.105 -	Depends $(<) : mkver ;
  10.106 -
  10.107 -	MKVER on $(<) = [ FDirName $(BUILD_DIR) mkver$(SUFEXE) ] ;
  10.108 -}
  10.109 -
  10.110 -actions BeVer
  10.111 -{
  10.112 -    $(MKVER) hg $(BE_VER_CACHE) $(BE_VER_H)
  10.113 -}
  10.114 -
  10.115 -#
  10.116 -# Generate the be_magic.c file
  10.117 -#
  10.118 -
  10.119 -rule MagicGet
  10.120 -{
  10.121 -    Depends $(<) : $(>) ;
  10.122 -    Clean clean : $(<) ;
  10.123 -    MakeLocate $(<) : [ FDirName $(BUILD_DIR) $(SOURCE_GRIST) ] ;
  10.124 -
  10.125 -    FINDJMP on $(<) = [ FDirName $(TOP) source findjmp.ex ] ;
  10.126 -}
  10.127 -
  10.128 -actions MagicGet
  10.129 -{
  10.130 -    eui $(FINDJMP) $(<) $(>)
  10.131 -}
  10.132 -
  10.133 -#
  10.134 -# Define a few variables containing our C source file listings
  10.135 -#
  10.136 -
  10.137 -PCRE_SOURCES = [ Glob [ FDirName $(TOP) source pcre ] : *.c ] ;
  10.138 -EU_LIB_SOURCE = be_alloc.c be_callc.c be_coverage.c be_decompress.c be_inline.c be_machine.c be_pcre.c
  10.139 -    be_runtime.c be_socket.c be_syncolor.c be_task.c be_w.c ;
  10.140 -EU_BACKEND_SOURCE = $(EU_LIB_SOURCE) be_execute.c be_main.c be_rterror.c be_symtab.c ;
  10.141 -
  10.142 -SEARCH_SOURCE += [ FDirName $(SUBDIR) pcre ] ;
  10.143 -SEARCH_SOURCE += [ FDirName $(BUILD_DIR) ] ;
  10.144 -
  10.145 -if $(JAM_TOOLSET) = WATCOM
  10.146 -{
  10.147 -    EU_BACKEND_SOURCE += be_magic.c ;
  10.148 -}
  10.149 -
  10.150 -#
  10.151 -# SOURCE_GRIST enables us to use the same source file
  10.152 -# with different compiler settings
  10.153 -#
  10.154 -# LOCATE_TARGET causes all built files to be located
  10.155 -# in a given directory
  10.156 -#
  10.157 -# MakeLocate causes the final output to be written to
  10.158 -# yet a different directory. This allows us to use
  10.159 -# LOCATE_TARGET to place all the .o/.obj files into
  10.160 -# a sub directory of the BUILD_DIR and the final
  10.161 -# resulting .a/.lib files directly into the BUILD_DIR
  10.162 -#
  10.163 -
  10.164 -#
  10.165 -# Build the mkver program
  10.166 -#
  10.167 -
  10.168 -LOCATE_TARGET = [ FDirName $(BUILD_DIR) ] ;
  10.169 -Main mkver : mkver.c ;
  10.170 -
  10.171 -#
  10.172 -# Build the eu.a/eu.lib file
  10.173 -#
  10.174 -
  10.175 -SOURCE_GRIST = eu ;
  10.176 -LOCATE_TARGET = [ FDirName $(BUILD_DIR) eu ] ;
  10.177 -BeVer $(BE_VER_H) : <eu>be_machine$(SUFOBJ) ;
  10.178 -MagicGet <eu>be_magic.c : <eu>be_execute$(SUFOBJ) ;
  10.179 -Library eu : $(EU_BACKEND_SOURCE) $(PCRE_SOURCES:BS) ;
  10.180 -MakeLocate eu$(SUFLIB) : $(BUILD_DIR) ;
  10.181 -InstallLib bin : eu$(SUFLIB) ;
  10.182 -
  10.183 -#
  10.184 -# Build a utility library of the backend. This saves us compiling
  10.185 -# time as it will be generated once and then linked into a few
  10.186 -# different binaries.
  10.187 -#
  10.188 -
  10.189 -SOURCE_GRIST = ebackend ;
  10.190 -LOCATE_TARGET = [ FDirName $(BUILD_DIR) ebackend ] ;
  10.191 -CCFLAGS += -DEBACKEND ;
  10.192 -Library ebackend : $(EU_BACKEND_SOURCE) $(PCRE_SOURCES:BS) ;
  10.193 -MakeLocate ebackend$(SUFLIB) : [ FDirName $(BUILD_DIR) ] ;
  10.194 -BeVer $(BE_VER_H) : <ebackend>be_machine$(SUFOBJ) ;
  10.195 -MagicGet <ebackend>be_magic.c : <ebackend>be_execute$(SUFOBJ) ;
  10.196 -
  10.197 -#
  10.198 -# Add the $(TOP)/include directory to the search path for source
  10.199 -# files. This way, automatic dependency scanning can find include
  10.200 -# files and cause our targets to recompile when they change.
  10.201 -#
  10.202 -
  10.203 -SEARCH_SOURCE += [ FDirName $(TOP) include ] ;
  10.204 -
  10.205 -SOURCE_GRIST = ;
  10.206 -
  10.207 -#
  10.208 -# Our actual build targets
  10.209 -#
  10.210 -
  10.211 -USER_LIBRARY = [ FDirName $(BUILD_DIR) ebackend ] ;
  10.212 -
  10.213 -EuMain eui : [ FDirName $(SUBDIR) int.ex ] ;
  10.214 -#EuWinMain euiw : [ FDirName $(SUBDIR) int.ex ] ;
  10.215 -#EuMain eub : [ FDirName $(SUBDIR) backend.ex ] ;
  10.216 -#EuWinMain eubw : [ FDirName $(SUBDIR) backend.ex ] ;
  10.217 -#
  10.218 -#InstallBin bin : eui euiw eub eubw ;
  10.219 -#
  10.220 -#USER_LIBRARY = eu ;
  10.221 -#
  10.222 -#EuMain euc : [ FDirName $(SUBDIR) ec.ex ] ;
  10.223 -#EuMain eutest : [ FDirName $(SUBDIR) eutest.ex ] ;
  10.224 -#
  10.225 -#InstallBin bin : euc eutest ;
  10.226 -#
  10.227 -#if $(EUDOC_SOURCE)
  10.228 -#{
  10.229 -#    EuMain eudoc : $(EUDOC_SOURCE) ;
  10.230 -#    InstallBin bin : eudoc ;
  10.231 -#}
  10.232 -#
  10.233 -#if $(CREOLEHTML_SOURCE)
  10.234 -#{
  10.235 -#    EuMain creolehtml : $(CREOLEHTML_SOURCE) ;
  10.236 -#    InstallBin bin : creolehtml ;
  10.237 -#}
  10.238 -
    11.1 --- a/source/Makefile.gnu	Fri Sep 02 10:12:05 2011 -0400
    11.2 +++ b/source/Makefile.gnu	Sun Sep 11 17:03:37 2011 -0400
    11.3 @@ -970,6 +970,7 @@
    11.4  	@$(ECHO) Translating $(EU_TARGET) to create $(EU_MAIN)
    11.5  	rm -f $(BUILDDIR)/$(OBJDIR)/{*.c,*.o}
    11.6  	(cd $(BUILDDIR)/$(OBJDIR);$(TRANSLATE) -nobuild $(CYPINCDIR) -$(XLTTARGETCC) $(RELEASE_FLAG) $(TARGETPLAT)  \
    11.7 +		-arch $(ARCH) \
    11.8  		-c $(CYPTRUNKDIR)/source/eu.cfg $(CYPTRUNKDIR)/source/$(EU_TARGET) )
    11.9  	
   11.10  endif
    12.1 --- a/source/Makefile.wat	Fri Sep 02 10:12:05 2011 -0400
    12.2 +++ b/source/Makefile.wat	Sun Sep 11 17:03:37 2011 -0400
    12.3 @@ -728,7 +728,7 @@
    12.4  	-$(RM) $(TRUNKDIR)\source\init-.c
    12.5  	-$(RM) $(TRUNKDIR)\source\main-.c
    12.6  	cd  $(BUILDDIR)\$(OBJDIR)
    12.7 -	$(EC) $(TRANSDEBUG) -nobuild $(TRANS_CC_FLAG) -plat $(OS) $(RELEASE_FLAG) $(MANAGED_FLAG) $(DOSEUBIN) $(INCDIR) -c $(BUILDDIR)\eu.cfg $(TRUNKDIR)\source\$(EU_TARGET)ex $(LIBTARGET)
    12.8 +	$(EC) $(TRANSDEBUG) -nobuild $(TRANS_CC_FLAG) -plat $(OS) -arch X86 $(RELEASE_FLAG) $(MANAGED_FLAG) $(DOSEUBIN) $(INCDIR) -c $(BUILDDIR)\eu.cfg $(TRUNKDIR)\source\$(EU_TARGET)ex $(LIBTARGET)
    12.9  	cd $(TRUNKDIR)\source
   12.10  
   12.11  $(BUILDDIR)\$(OBJDIR)\$(EU_TARGET)c : $(EU_TARGET)ex  $(BUILDDIR)\$(OBJDIR) $(EU_TRANSLATOR_FILES)
    13.1 --- a/source/be_socket.c	Fri Sep 02 10:12:05 2011 -0400
    13.2 +++ b/source/be_socket.c	Sun Sep 11 17:03:37 2011 -0400
    13.3 @@ -776,9 +776,12 @@
    13.4  	);
    13.5  	sendto_fntype sendtoPtr;
    13.6  	WSACleanup_fntype  WSAGetLastErrorPtr;
    13.7 -	
    13.8  	#ifndef __WATCOMC__
    13.9 -		typedef int (*WSAFDIsSet_fntype)(
   13.10 +		#ifndef PASCAL
   13.11 +		// MinGW uses this for PASCAL calling convention
   13.12 +		#define PASCAL
   13.13 +		#endif
   13.14 +		typedef int PASCAL (*WSAFDIsSet_fntype)(
   13.15  			SOCKET fd,
   13.16  			fd_set *set
   13.17  		);
   13.18 @@ -786,7 +789,7 @@
   13.19  		#undef FD_ISSET
   13.20  		#define FD_ISSET( p1, p2 )  (*WSAFDIsSetPtr)( (SOCKET)(p1), (fd_set *)(p2) )
   13.21  	#endif
   13.22 -	
   13.23 +
   13.24  	typedef u_short WSAAPI (*htons_fntype)(
   13.25  		__in  u_short hostshort
   13.26  	);
   13.27 @@ -1758,9 +1761,11 @@
   13.28  	}
   13.29  
   13.30  	result_p = NewS1(socks_pall->length);
   13.31 +	
   13.32  	for (i=1; i <= socks_pall->length; i++) {
   13.33 -		if (!IS_SOCKET(socks_pall->base[i]))
   13.34 +		if (!IS_SOCKET(socks_pall->base[i])){
   13.35  			RTFatal("fourth argument to select must be a sequence of sockets");
   13.36 +			}
   13.37  		tmp_socket = ATOM_INT_VAL(SEQ_PTR(socks_pall->base[i])->base[SOCK_SOCKET]);
   13.38  
   13.39  		RefDS(socks_pall->base[i]);
   13.40 @@ -1770,10 +1775,9 @@
   13.41  		tmp_sp->base[2] = FD_ISSET(tmp_socket, &readable) != 0;
   13.42  		tmp_sp->base[3] = FD_ISSET(tmp_socket, &writable) != 0;
   13.43  		tmp_sp->base[4] = FD_ISSET(tmp_socket, &errd) != 0;
   13.44 -
   13.45 +		
   13.46  		result_p->base[i] = MAKE_SEQ(tmp_sp);
   13.47  	}
   13.48 -
   13.49  	return MAKE_SEQ(result_p);
   13.50  }
   13.51  
    14.1 --- a/source/be_socket.h	Fri Sep 02 10:12:05 2011 -0400
    14.2 +++ b/source/be_socket.h	Sun Sep 11 17:03:37 2011 -0400
    14.3 @@ -1,5 +1,5 @@
    14.4  #ifndef BE_SOCKET_H_
    14.5 -#define BE_SOCKTET_H_
    14.6 +#define BE_SOCKET_H_
    14.7  
    14.8  #ifdef EWINDOWS
    14.9      #include <windows.h>
   14.10 @@ -53,4 +53,5 @@
   14.11  object eusock_accept(object x);
   14.12  object eusock_getsockopt(object x);
   14.13  object eusock_setsockopt(object x);
   14.14 -#endif
   14.15 +
   14.16 +#endif // BE_SOCKET_H_
    15.1 --- a/source/buildsys.e	Fri Sep 02 10:12:05 2011 -0400
    15.2 +++ b/source/buildsys.e	Sun Sep 11 17:03:37 2011 -0400
    15.3 @@ -434,6 +434,11 @@
    15.4  		abort(1)
    15.5  	end if
    15.6  	
    15.7 +	integer ptr_size = 4
    15.8 +	if TX86_64 then
    15.9 +		ptr_size = 8
   15.10 +	end if
   15.11 +	
   15.12  	switch compiler_type do
   15.13  		case COMPILER_GCC then
   15.14  			c_exe = "gcc"
   15.15 @@ -455,7 +460,7 @@
   15.16  				{ 4 * 8, adjust_for_build_file(get_eucompiledir()) })
   15.17  			elsedef
   15.18  				c_flags &= sprintf(" -c -w -fsigned-char -O2 -m%d -I%s -ffast-math",
   15.19 -				{ sizeof( C_POINTER ) * 8, adjust_for_build_file(get_eucompiledir()) })
   15.20 +				{ ptr_size * 8, adjust_for_build_file(get_eucompiledir()) })
   15.21  			end ifdef
   15.22  			
   15.23  			if TWINDOWS then
   15.24 @@ -471,7 +476,7 @@
   15.25  			ifdef EU4_0 then
   15.26  				l_flags = sprintf( " %s -m%d", { adjust_for_build_file(user_library), 4 * 8 })
   15.27  			elsedef			
   15.28 -				l_flags = sprintf( " %s -m%d", { adjust_for_build_file(user_library), sizeof( C_POINTER ) * 8 })
   15.29 +				l_flags = sprintf( " %s -m%d", { adjust_for_build_file(user_library), ptr_size * 8 })
   15.30  			end ifdef
   15.31  
   15.32  			if dll_option then
    16.1 --- a/source/memstruct.e	Fri Sep 02 10:12:05 2011 -0400
    16.2 +++ b/source/memstruct.e	Sun Sep 11 17:03:37 2011 -0400
    16.3 @@ -98,7 +98,7 @@
    16.4  					end if
    16.5  					
    16.6  				else
    16.7 -					CompileErr( 355 )
    16.8 +					CompileErr( 358 )
    16.9  				end if
   16.10  				-- reset the flags
   16.11  				pointer = 0
   16.12 @@ -108,14 +108,14 @@
   16.13  			case MS_SIGNED then
   16.14  				if signed != -1 then
   16.15  					-- error...multiple signed modifiers
   16.16 -					CompileErr( 355 )
   16.17 +					CompileErr( 358 )
   16.18  				end if
   16.19  				signed = 1
   16.20  			
   16.21  			case MS_UNSIGNED then
   16.22  				if signed != -1 then
   16.23  					-- error...multiple signed modifiers
   16.24 -					CompileErr( 355 )
   16.25 +					CompileErr( 358 )
   16.26  				end if
   16.27  				signed = 0
   16.28  				
   16.29 @@ -177,12 +177,12 @@
   16.30  					case MS_FLOAT, MS_DOUBLE, MS_EUDOUBLE then
   16.31  						if signed != - 1 then
   16.32  							-- can't have signed modifiers here
   16.33 -							CompileErr( 356 )
   16.34 +							CompileErr( 359 )
   16.35  						end if
   16.36  						
   16.37  						if long and tid != MS_DOUBLE then
   16.38  							-- long modifier only for doubles
   16.39 -							CompileErr( 357 )
   16.40 +							CompileErr( 360 )
   16.41  						elsif long then
   16.42  							tid = MS_LONGDOUBLE
   16.43  						end if
   16.44 @@ -208,7 +208,7 @@
   16.45  				pointer = 1
   16.46  				
   16.47  			case else
   16.48 -				CompileErr( 355 )
   16.49 +				CompileErr( 358 )
   16.50  		end switch
   16.51  	entry
   16.52  		tok = next_token()
   16.53 @@ -457,7 +457,7 @@
   16.54  		
   16.55  	elsif tok[T_ID] != MEMSTRUCT and tok[T_ID] != QUALIFIED_MEMSTRUCT then
   16.56  		-- something else
   16.57 -		CompileErr( 355 )
   16.58 +		CompileErr( 358 )
   16.59  	end if
   16.60  	
   16.61  	tok = next_token()
   16.62 @@ -539,11 +539,11 @@
   16.63  						if SymTab[member][S_MEM_POINTER] then
   16.64  							tok_match( MULTIPLY )
   16.65  						else
   16.66 -							CompileErr( 360 )
   16.67 +							CompileErr( 361 )
   16.68  						end if
   16.69  					elsif lhs then
   16.70  						-- assignment of primitives only!
   16.71 -						CompileErr( 361 )
   16.72 +						CompileErr( 362 )
   16.73  					end if
   16.74  					peek_member( members, member, ref, lhs, names )
   16.75  					-- re-emit the last member for serialization
   16.76 @@ -571,7 +571,7 @@
   16.77  					end if
   16.78  					member = resolve_member( tok[T_SYM], struct_sym )
   16.79  					if not member then
   16.80 -						CompileErr( 359, { tok[T_SYM], sym_name( struct_sym ) } )
   16.81 +						CompileErr( 362, { tok[T_SYM], sym_name( struct_sym ) } )
   16.82  					end if
   16.83  					emit_opnd( member )
   16.84  				end if
   16.85 @@ -600,7 +600,7 @@
   16.86  							peek_member( members, member, ref, lhs, names )
   16.87  							exit -- DONE!
   16.88  						else
   16.89 -							CompileErr( 360 )
   16.90 +							CompileErr( 363 )
   16.91  						end if
   16.92  					end if
   16.93  				end if
    17.1 --- a/source/msgtext.e	Fri Sep 02 10:12:05 2011 -0400
    17.2 +++ b/source/msgtext.e	Sun Sep 11 17:03:37 2011 -0400
    17.3 @@ -370,14 +370,17 @@
    17.4  	{352, "There is no watcom instalation under specified Watom Path [1]"},
    17.5  	{353, "Use a non-standard library when building a shared object"},
    17.6  	{354, "External debugger"},
    17.7 -	{355, "Expected to see a valid memory structure type" },
    17.8 -	{356, "Floating point data cannot have signed or unsigned modifiers"},
    17.9 -	{357, "Only 'double' floating point type can have the 'long' modifier"},
   17.10 -	{358, "Only 'int' or 'long' integers can have the 'long' modifier"},
   17.11 -	{359, "[1] is not a member of memstruct or memunion [2]"},
   17.12 -	{360, "Member is not a pointer or an embedded memstruct"},
   17.13 -	{361, "Cannot assign to a non-primitive, non-pointer memstruct" },
   17.14 -
   17.15 +	
   17.16 +	{355, "Use the -mno-cygwin flag with MinGW"},
   17.17 +	{356, "Specify the target architecture (X86, X86_64, ARM)"},
   17.18 +	{357, "Unknown architecture: [1].  Supported architectures are: [2]"},
   17.19 +	{358, "Expected to see a valid memory structure type" },
   17.20 +	{359, "Floating point data cannot have signed or unsigned modifiers"},
   17.21 +	{360, "Only 'double' floating point type can have the 'long' modifier"},
   17.22 +	{361, "Only 'int' or 'long' integers can have the 'long' modifier"},
   17.23 +	{362, "[1] is not a member of memstruct or memunion [2]"},
   17.24 +	{363, "Member is not a pointer or an embedded memstruct"},
   17.25 +	{364, "Cannot assign to a non-primitive, non-pointer memstruct" },
   17.26  	$
   17.27  }
   17.28  
    18.1 --- a/source/platform.e	Fri Sep 02 10:12:05 2011 -0400
    18.2 +++ b/source/platform.e	Sun Sep 11 17:03:37 2011 -0400
    18.3 @@ -12,6 +12,9 @@
    18.4  include std/os.e
    18.5  include std/text.e
    18.6  include std/io.e
    18.7 +include std/dll.e
    18.8 +
    18.9 +include msgtext.e
   18.10  
   18.11  public constant
   18.12  	ULINUX = LINUX,
   18.13 @@ -29,7 +32,11 @@
   18.14  	IBSD     = 0, TBSD     = 0,
   18.15  	IOSX     = 0, TOSX     = 0,
   18.16  	IOPENBSD = 0, TOPENBSD = 0,
   18.17 -	INETBSD  = 0, TNETBSD  = 0
   18.18 +	INETBSD  = 0, TNETBSD  = 0,
   18.19 +	IX86     = 0, TX86     = 0,
   18.20 +	IX86_64  = 0, TX86_64  = 0,
   18.21 +	IARM     = 0, TARM     = 0,
   18.22 +	$
   18.23  
   18.24  -- operating system:
   18.25  ifdef WINDOWS then
   18.26 @@ -79,6 +86,27 @@
   18.27  	public sequence HOSTNL = "\r\n" -- may change if cross-translating
   18.28  end ifdef
   18.29  
   18.30 +ifdef ARM then
   18.31 +	IARM = 1
   18.32 +elsifdef X86 then
   18.33 +	IX86 = 1
   18.34 +elsifdef X86_64 then
   18.35 +	IX86_64 = 1
   18.36 +elsedef
   18.37 +	-- building with earlier versions needs this:
   18.38 +	if sizeof( dll:C_POINTER ) = 4 then
   18.39 +		-- could technically be ARM here, but we'll default to the most common case:
   18.40 +		IX86 = 1
   18.41 +	else
   18.42 +		IX86_64 = 1
   18.43 +	end if
   18.44 +end ifdef
   18.45 +
   18.46 +TX86    = IX86
   18.47 +TX86_64 = IX86_64
   18.48 +TARM    = IARM
   18.49 +
   18.50 +
   18.51  integer ihost_platform = platform()
   18.52  public function host_platform()
   18.53  	return ihost_platform
   18.54 @@ -111,6 +139,32 @@
   18.55  	end if
   18.56  end procedure
   18.57  
   18.58 +public procedure set_target_arch( sequence arch )
   18.59 +	IX86    = 0
   18.60 +	TX86    = 0
   18.61 +	IX86_64 = 0
   18.62 +	TX86_64 = 0
   18.63 +	IARM    = 0
   18.64 +	TARM    = 0
   18.65 +	switch arch do
   18.66 +		case "X86", "IX86" then
   18.67 +			IX86    = 1
   18.68 +			TX86    = 1
   18.69 +		
   18.70 +		case "X86_64", "IX86_64" then
   18.71 +			IX86_64 = 1
   18.72 +			TX86_64 = 1
   18.73 +		
   18.74 +		case "ARM" then
   18.75 +			IARM = 1
   18.76 +			TARM = 1
   18.77 +		
   18.78 +		case else
   18.79 +			ShowMsg( 2, 357, { arch, "X86, X86_64, ARM" } )
   18.80 +			abort( 1 )
   18.81 +	end switch
   18.82 +end procedure
   18.83 +
   18.84  public function GetPlatformDefines(integer for_translator = 0)
   18.85  	sequence local_defines = {}
   18.86  
   18.87 @@ -180,6 +234,21 @@
   18.88  			local_defines &= {"UNIX", "BSD", "FREEBSD"}
   18.89  		end if
   18.90  	end if
   18.91 +	
   18.92 +	if (IX86 and not for_translator) or (TX86 and for_translator) then
   18.93 +		local_defines &= {"X86", "BITS32", "LONG32"}
   18.94 +	
   18.95 +	elsif (IX86_64 and not for_translator) or (TX86_64 and for_translator) then
   18.96 +		local_defines &= {"X86_64", "BITS64"}
   18.97 +		if (IWINDOWS and not for_translator) or (TWINDOWS and for_translator) then
   18.98 +			local_defines &= {"LONG32"}
   18.99 +		else
  18.100 +			local_defines &= {"LONG64"}
  18.101 +		end if
  18.102 +	elsif (IARM and not for_translator) or (TARM and for_translator) then
  18.103 +		local_defines &= {"ARM", "BITS32", "LONG64"}
  18.104 +	end if
  18.105 +	
  18.106  	-- So the translator knows what to strip from defines if translating
  18.107  	-- to a different platform
  18.108  	return { "_PLAT_START" } & local_defines & { "_PLAT_STOP" }
    19.1 --- a/source/traninit.e	Fri Sep 02 10:12:05 2011 -0400
    19.2 +++ b/source/traninit.e	Sun Sep 11 17:03:37 2011 -0400
    19.3 @@ -95,7 +95,8 @@
    19.4  	{ "makefile-partial", 0, GetMsgText(192,0), { } },
    19.5  	{ "silent",           0, GetMsgText(177,0), { } },
    19.6  	{ "verbose",	      0, GetMsgText(319,0), { } },
    19.7 -	{ "no-cygwin",        0, GetMsgText(351,0), { } },
    19.8 +	{ "no-cygwin",        0, GetMsgText(355,0), { } },
    19.9 +	{ "arch",             0, GetMsgText(356),   { HAS_PARAMETER, "architecture" } },
   19.10  	$
   19.11  }
   19.12  
   19.13 @@ -257,6 +258,9 @@
   19.14  			case "no-cygwin" then
   19.15  				mno_cygwin = 1
   19.16  			
   19.17 +			case "arch" then
   19.18 +				set_target_arch( upper( val ) )
   19.19 +			
   19.20  		end switch
   19.21  	end for
   19.22  
    20.1 --- a/tests/Jamfile	Fri Sep 02 10:12:05 2011 -0400
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,3 +0,0 @@
    20.4 -SubDir TOP tests ;
    20.5 -
    20.6 -EuTestDir test : $(SUBDIR) ;
    21.1 --- a/tests/t_ifdef.e	Fri Sep 02 10:12:05 2011 -0400
    21.2 +++ b/tests/t_ifdef.e	Sun Sep 11 17:03:37 2011 -0400
    21.3 @@ -121,6 +121,34 @@
    21.4  	test_fail("missed the elsifdef ABC or FOO")
    21.5  end ifdef -- zxy or qwe
    21.6  
    21.7 +include std/dll.e
    21.8 +ifdef X86 then
    21.9 +	test_equal("sizeof C_POINTER X86", 4, sizeof( C_POINTER ) )
   21.10 +elsifdef X86_64 then
   21.11 +	test_equal("sizeof C_POINTER X86_64", 8, sizeof( C_POINTER ) )
   21.12 +elsifdef ARM then
   21.13 +	test_equal("sizeof C_POINTER ARM", 4, sizeof( C_POINTER ) )
   21.14 +elsedef
   21.15 +	test_fail("no valid arch ifdef exists")
   21.16 +end ifdef
   21.17 +
   21.18 +ifdef BITS32 then
   21.19 +	test_equal("sizeof C_POINTER BITS32", 4, sizeof( C_POINTER ) )
   21.20 +elsifdef BITS64 then
   21.21 +	test_equal("sizeof C_POINTER BITS64", 8, sizeof( C_POINTER ) )
   21.22 +elsedef
   21.23 +	test_fail("no valid BITS ifdef exists")
   21.24 +end ifdef
   21.25 +
   21.26 +
   21.27 +ifdef LONG32 then
   21.28 +	test_equal("sizeof C_LONG", 4, sizeof( C_LONG ) )
   21.29 +elsifdef LONG64 then
   21.30 +	test_equal("sizeof C_LONG LONG64", 8, sizeof( C_LONG ) )
   21.31 +elsedef
   21.32 +	test_fail("no valid LONG ifdef exists")
   21.33 +end ifdef
   21.34 +
   21.35  -- ifdef then
   21.36  -- end ifdef
   21.37  -- 

SCM Home | OpenEuphoria.org Home