diff options
98 files changed, 6933 insertions, 4718 deletions
diff --git a/INSTALL-CROSS.md b/INSTALL-CROSS.md new file mode 120000 index 0000000000..9e7743b9de --- /dev/null +++ b/INSTALL-CROSS.md @@ -0,0 +1 @@ +xcomp/README.md
\ No newline at end of file diff --git a/INSTALL-WIN32.md b/INSTALL-WIN32.md new file mode 100644 index 0000000000..f59a8ece67 --- /dev/null +++ b/INSTALL-WIN32.md @@ -0,0 +1,781 @@ +How to Build Erlang/OTP on Windows +================================== + +Table of Contents +----------------- + +1. Introduction +2. Frequently Asked Questions +3. Tools you Need and Their Environment +4. The Shell Environment +5. Building and Installing +6. Development +7. Final Words +8. Copyright and License + +Introduction +------------ + +This file describes how to build the Erlang emulator and the OTP +libraries on Windows. The instructions apply to versions of Windows +supporting the Cygwin emulated gnuish environment for Windows. We've +built on the following platforms: Windows 2000 Professional, Windows +2003 server, Windows XP Home/Professional, and Windows Vista. Any +Windows95'ish platform will surely get you into trouble, what I'm not +sure of, but it certainly will... + +The procedure described uses Cygwin as a build environment, you run +the bash shell in Cygwin and uses gnu make/configure/autoconf etc to +do the build. The emulator C-source code is, however, mostly compiled +with Microsoft Visual C++(tm), producing a native Windows binary. This +is the same procedure as we use to build the pre-built binaries. The +fact that we use VC++ and not gcc is explained further in the FAQ +section. + +I describe the build procedure to make it possible for open source +customers to build the emulator, given that they have the needed +tools. The binary Windows releases is still a preferred alternative if +one does not have Microsoft's development tools and/or don't want to +install Cygwin. + +To use Cygwin, one needs basic experience from a Unix environment, if +one does not know how to set environment variables, run programs etc +in a Unix environment, one will be quite lost in the Cygwin +ditto. I can unfortunately not teach all the world how to use +Cygwin and bash, neither how to install Cygwin nor perform basic tasks +on a computer. Please refer to other documentation on the net for +help, or use the binary release instead if you have problems using the +tools. + +However, if you feel comfortable with the environment and build +system, and have all the necessary tools, you have a great opportunity +to make the Erlang/OTP distribution for Windows better. Please submit +any suggestions and patches to the appropriate [mailing lists] [1] to let +them find their way into the next version of Erlang. If making changes +to the build system (like makefiles etc) please bear in mind that the +same makefiles are used on Unix/VxWorks/OSEDelta, so that your changes +don't break other platforms. That of course goes for C-code too, system +specific code resides in the `$ERL_TOP/erts/emulator/sys/win32` and +`$ERL_TOP/erts/etc/win32` directories mostly. The +`$ERL_TOP/erts/emulator/beam directory` is for common code. + +Before the R9C release of Erlang/OTP, the Windows release was built +partly on a Unix (Solaris) box and partly on a Windows box, using Perl +hacks to communicate and sync between the two machines. R9C was the +first release ever built solely on Windows, where no Unix machine is +needed at all. Now we've used this build procedure for a couple of +releases, and it has worked fine for us. Still, there might be all +sorts of troubles on different machines and with different +setups. I'll try to give hints wherever I've encountered difficulties, +but please share your experiences by using the [`erlang-questions`] [1] +mailing list. I cannot of course help everyone with all +their problems, please try to solve the problems and submit +solutions/workarounds. Remember, it's all about sharing, not about +demanding... + +Lets go then, I'll start with a little FAQ, based on in house questions +and misunderstandings. + + +Frequently Asked Questions +-------------------------- + +* Q: So, now I can build Erlang using GCC on Windows? + + A: No, unfortunately not. You'll need Microsoft's Visual C++ still, a + Bourne-shell script (cc.sh) wraps the Visual C++ compiler and runs it + from within the Cygwin environment. All other tools needed to build + Erlang are free-ware/open source, but not the C compiler. + +* Q: Why haven't you got rid of VC++ then, you `******`? + + A: Well, partly because it's a good compiler - really! Actually it's + been possible in late R11-releases to build using mingw instead of + visual C++ (you might see the remnants of that in some scripts and + directories). Unfortunately the development of the SMP version for + Windows broke the mingw build and we chose to focus on the VC++ build + as the performance has been much better in the VC++ versions. The + mingw build will be back, but as long as VC++ gives better + performance, the commercial build will be a VC++ one. + +* Q: OK, VC++ you need, but now you've started to demand a very recent + (and expensive) version of Visual studio, not the old and stable VC++ + 6.0 that was used in earlier versions. Why? + + A: The SMP version of Erlang needs features in the Visual Studio 2005. + Can't live without them. Besides the new compiler gives the Erlang + emulator a ~40% performance boost(!) + +* Q: Can/will I build a Cygwin binary with the procedure you describe? + + A: No, the result will be a pure Windows binary, and as far as I know, + it's not possible to make a Cygwin binary yet. That is of course + something desirable, but there are still some problems with the + dynamic linking (dynamic Erlang driver loading) as well as the TCP/IP + emulation in Cygwin, which, I'm sure of, will improve, but still has + some problems. Fixing those problems might be easy or might be hard. + I suggest you try yourself and share your experience. No one would be + happier if a simple ./configure && make would produce a fully fledged + Cygwin binary. Ericsson does however not pay me to do a Cygwin port, so + such a port would have to happen in spare time, which is a limited + resource... + +* Q: Hah, I saw you, you used GCC even though you said you didn't! + + A: OK, I admit, one of the files is compiled using Cygwin's GCC and + the resulting object code is then converted to MS VC++ compatible coff + using a small C hack. It's because that particular file, `beam_emu.c` + benefits immensely from being able to use the GCC labels-as-values + extension, which boosts emulator performance by up to 50%. That does + unfortunately not (yet) mean that all of OTP could be compiled using + GCC, that particular source code does not do anything system specific + and actually is adopted to the fact that GCC is used to compile it on + Windows. + +* Q: So now there's a MS VC++ project file somewhere and I can build OTP + using the nifty VC++ GUI? + + A: No, never. The hassle of keeping the project files up to date and + do all the steps that constitute an OTP build from within the VC++ GUI + is simply not worth it, maybe even impossible. A VC++ project + file for Erlang/OTP will never happen, at least I will never make + one. Clicking around in super-multi-tab'd dialogs to add a file or + compiler option when it's so much easier in a makefile is simply not + my style. + +* Q: So how does it all work then? + + A: Cygwin is the environment, which closely resembles the environments + found on any Unix machine. It's almost like you had a virtual Unix + machine inside Windows. Configure, given certain parameters, then + creates makefiles that are used by the Cygwin gnu-make to built the + system. Most of the actual compilers etc are not, however, Cygwin + tools, so I've written a couple of wrappers (Bourne-shell scripts), + which reside in `$ERL_TOP/etc/win32/cygwin_tools` and they all do + conversion of parameters and switches common in the Unix environment + to fit the native Windows tools. Most notable is of course the paths, + which in Cygwin are Unix-like paths with "forward slashes" (/) and no + drive letters, the Cygwin specific command `cygpath` is used for most + of the path conversions. Luckily most compilers accept forward slashes + instead of backslashes as path separators, one still have to get the + drive letters etc right, though. The wrapper scripts are not general + in the sense that, for example, cc.sh would understand and translates + every possible gcc option and passes correct options to cl.exe. The + principle is that the scripts are powerful enough to allow building of + Erlang/OTP, no more, no less. They might need extensions to cope with + changes during the development of Erlang, that's one of the reasons I + made them into shell-scripts and not Perl-scripts, I believe they are + easier to understand and change that way. I might be wrong though, + cause another reason I didn't write them in Perl is because I've never + liked Perl and my Perl code is no pleasant reading... + + In `$ERL_TOP`, there is a script called `otp_build`, that script handles + the hassle of giving all the right parameters to `configure`/`make` and + also helps you set up the correct environment variables to work with + the Erlang source under Cygwin. + +* Q: You use and need Cygwin, but then you haven't taken the time to + port Erlang to the Cygwin environment but instead focus on your + commercial release, is that really ethical? + + A: No, not really, but see this as a step in the right direction. I'm + aiming at GCC compiled emulators and a Cygwin version, but I really + need to do other things as well... In time, but don't hold your + breath... + +* Q: Can I build something that looks exactly as the commercial release? + + A: Yes, we use the exactly same build procedure. + +* Q: Which version of Cygwin and other tools do you use then? + + A: For Cygwin we try to use the latest releases available when + building. What versions you use shouldn't really matter, I try to + include workarounds for the bugs I've found in different Cygwin + releases, please help me to add workarounds for new Cygwin-related + bugs as soon as you encounter them. Also please do submit bug reports + to the appropriate Cygwin developers. The Cygwin GCC we used for R13B + was version 3.4.4. We used VC++ 8.0 (i.e. Visual studio 2005 SP1), + Sun's JDK 1.5.0\_17, NSIS 2.37, and Win32 OpenSSL 0.9.8e. Please read + the next section for details on what you need. + +* Q: Can you help me setup X in Cygwin? + + A: No, unfortunately I haven't got time to help with Cygwin related + user problems, please read Cygwin related web sites, newsgroups and + mailing lists. + +* Q: Why is the instruction so long? Is it really that complicated? + + A: Partly it's long because I babble too much, partly because I've + described as much as I could about the installation of the needed + tools. Once the tools are installed, building is quite easy. I also + have tried to make this instruction understandable for people with + limited Unix experience. Cygwin is a whole new environment to some + Windows users, why careful explanation of environment variables etc + seemed to be in place. The short story, for the experienced and + impatient is: + + * Get and install complete Cygwin (latest) + + * (Buy and) Install Microsoft Visual studio 2005 and SP1 (or higher) + + * Get and install Sun's JDK 1.4.2 + + * Get and install NSIS 2.01 or higher (up to 2.30 tried and working) + + * Get and install OpenSSL 0.9.7c or higher + + * Get and unpack wxWidgets-2.8.9 or higher to `/opt/local/pgm` inside + cygwin. + * Open `/cygwin/opt/local/pgm/wxWidgets-2.8.9/build/msw/wx.dsw` + * Enable `wxUSE_GLCANVAS`, `wxUSE_POSTSCRIPT` and + `wxUSE_GRAPHICS_CONTEXT` in `include/wx/msw/setup.h` + * Build all unicode release (and unicode debug) packages + * Open `/cygwin/opt/local/pgm/wxWidgets-2.8.9/contrib/build/stc/stc.dsw` + * Build the unicode release (and unicode debug) packages + + * Get the Erlang source distribution (from + <http://www.erlang.org/download.html>) and unpack with Cygwin's `tar`. + + * Set `ERL_TOP` to where you unpacked the source distribution + + * `$ cd $ERL_TOP` + + * Get (from <http://www.erlang.org/download/tcltk85_win32_bin.tar.gz>) + and unpack the prebuilt TCL/TK binaries for windows with cygwin tar, + standing in `$ERL_TOP` + + * Modify PATH and other environment variables so that all these tools + are runnable from a bash shell. Still standing in `$ERL_TOP`, issue + the following commands: + + $ eval `./otp_build env_win32` + $ ./otp_build autoconf + $ ./otp_build configure + $ ./otp_build boot -a + $ ./otp_build release -a + $ ./otp_build installer_win32 + $ release/win32/otp_win32_<OTP version> /S + + Voila! `Start->Programs->Erlang OTP <OTP version>->Erlang` starts the Erlang + Windows shell. + + +Tools you Need and Their Environment +------------------------------------ + +You need some tools to be able to build Erlang/OTP on Windows. Most +notably you'll need Cygwin and Microsoft VC++, but you also might want +a Java compiler, the NSIS install system and OpenSSL. Only VC++ costs +money, but then again it costs a lot of money, I know... +Well' here's the list: + +* Cygwin, the very latest is usually best. Get all the development + tools and of course all the basic ditto. In fact getting the complete + package might be a good idea, as you'll start to love Cygwin after a + while if you're accustomed to Unix. Make sure to get jar and also make + sure *not* to install a Cygwin'ish Java... The Cygwin jar command is + used but Sun's Java compiler and virtual machine... + + URL: <http://www.cygwin.com> + + Get the installer from the web site and use that to install + Cygwin. Be sure to have fair privileges. If you're on a NT domain you + should consider running `mkpasswd -d` and `mkgroup -d` after the + installation to get the user databases correct. See their respective + manual pages. + + When you start you first bash shell, you will get an awful prompt. You + might also have a `PATH` environment variable that contains backslashes + and such. Edit `$HOME/.profile` and `$HOME/.bashrc` to set fair prompts + and set a correct PATH. Also do a `export SHELL` in `.profile`. For some + non-obvious reason the environment variable `$SHELL` is not exported in + bash. Also note that `.profile` is run at login time and `.bashrc` when + sub shells are created. You'll need to explicitly source `.bashrc` from + `.profile` if you want the commands there to be run at login time (like + setting up aliases, shell functions and the like). I personally + usually do like this at the end of `.profile`: + + ENV=$HOME/.bashrc + export ENV + . $ENV + + You might also, if you're a hard core type of person at least, want to + setup X-windows (XFree86), that might be as easy as running startx + from the command prompt and it might be much harder. Use Google to + find help... + + If you don't use X-windows, you might want to setup the Windows + console window by selecting properties in the console system menu + (upper left corner of the window, the Cygwin icon in the title + bar). Especially setting a larger screen buffer size (lines) is useful + as it gets you a scrollbar so you can see whatever error messages + that might appear... + + If you want to use (t)csh instead of bash you're on your own, I + haven't tried and know of no one that has. I expect + that you use bash in all shell examples. + +* Microsoft Visual Studio 2005 SP1. Please don't skip the service + pack! The installer might update your environment so that you can run + the `cl` command from the bash prompt, then again it might + not... There is always a BAT file in VC\Bin under the installation + directory (default `C:\Program Files\Microsoft Visual Studio 8`) called + `VCVARS32.BAT`. Either add the environment settings in that file to the + global environment settings in Windows or add the corresponding BASH + environment settings to your `.profile`/`.bashrc`. For example, in my case + I could add the following to `.profile` + + #Visual C++ Root directory as Cygwin style pathname + VCROOT=/cygdrive/c/Program\ Files/Microsoft\ Visual\ Studio 8 + + # Visual C++ Root directory as Windows style pathname + WIN_VCROOT="C:\\Program Files\\Microsoft Visual Studio 8" + + # The PATH variable should be Cygwin'ish + PATH=$VCROOT/Common7/IDE:$VCROOT/VC/BIN:$VCROOT/Common7/Tools:\ + $VCROOT/Common7/Tools/bin:$VCROOT/VC/PlatformSDK/bin:$VCROOT/SDK/v2.0/bin:\ + $VCROOT/VC/VCPackages:$PATH + + # Lib and INCLUDE should be Windows'ish + # Note that semicolon (;) is used to separate Windows style paths but + # colon (:) to separate Cygwin ditto! + + LIBPATH=$WIN_VCROOT\\VC\\ATLMFC\\LIB + + LIB=$WIN_VCROOT\\VC\\ATLMFC\\LIB\;$WIN_VCROOT\\VC\\LIB\;\ + $WIN_VCROOT\\VC\\PlatformSDK\\lib\;$WIN_VCROOT\\SDK\\v2.0\\lib + + INCLUDE=$WIN_VCROOT\\VC\\ATLMFC\\INCLUDE\;$WIN_VCROOT\\VC\\INCLUDE\;\ + $WIN_VCROOT\\VC\\PlatformSDK\\include + + export PATH LIB INCLUDE + + Make a simple hello world and try to compile it with the `cl` command + from within bash. If that does not work, your environment needs + fixing. Also remember to fix up the PATH environment, especially old + Erlang installations might have inserted quoted paths that Cygwin does + not understand. Remove or correct such paths. There should be no + backslashes in your path environment variable in Cygwin bash, but LIB + and INCLUDE should contain Windows style paths with semicolon, + drive letters and backslashes. + + If you wish to use Visual Studio 2008, a couple things need to be tweaked, + namely the fact that some of the SDK stuff is installed in (by default) + `C:\Program Files\Microsoft SDKs\v6.0A` . Just ensure that that + `C:\Program Files\Microsoft SDKs\v6.0A\Lib` is in `LIB` and + `C:\Program Files\Microsoft SDKs\v6.0A\Include` is in `INCLUDE`. A symptom + of not doing this is errors about finding kernel32.lib and windows.h. + + Additionally, if you encounter errors about mc.exe not being found, you must + install the entire Windows SDK (the partial SDK included in visual studio + apparently does not include it). After installing it you'll want to add + something like: `/c/cygdrive/Program\ Files/Microsoft\ SDKs/v7.0/bin` to + your `PATH` to allow the environment to find mc.exe. The next Visual Studio + (2010) is expected to include this tool. + +* Sun's Java JDK 1.5.0 or higher. Our Java code (jinterface, ic) is + written for JDK 1.5.0. Get it for Windows and install it, the JRE is + not enough. If you don't care about Java, you can skip this step, the + result will be that jinterface is not built. + + URL: <http://java.sun.com> + + Add javac *LAST* to your path environment in bash, in my case this means: + + PATH="$PATH:/cygdrive/c/Program Files/Java/jdk1.5.0_17/bin" + + No `CLASSPATH` or anything is needed. Type `javac` at the bash prompt + and you should get a list of available Java options. Make sure by + typing `which java` that you use the Java you installed. Note however that + Cygwin's `jar.exe` is used, that's why the JDK bin-directory should be + added last in the `PATH`. + +* Nullsoft NSIS installer system. You need this to build the self + installing package. It's a free open source installer that's much + nicer to use than the commercial Wise and Install shield + installers. This is the installer we use for commercial releases as + well from R9C an on. + + URL: <http://www.nullsoft.com/free/nsis> + + Install the lot, especially the modern user interface components, as + it's definitely needed. Put `makensis` in your path, in my case: + + PATH=/cygdrive/c/Program\ Files/NSIS:$PATH + + type makensis at the bash prompt and you should get a list of options + if everything is OK. + +* OpenSSL for Windows. This is if you want the SSL and crypto + applications to compile (and run). Go to <http://www.openssl.org>, click + on the `Related` link and then on the `Binaries` link (upper right + corner of the page last time I looked), you can then reach the + "Shining Lights Productions" Web site for Windows binaries + distributions. Get the latest or 0.9.7c if you get trouble with the + latest. It's a nifty installer. The rest should be handled by + `configure`, you needn't put anything in the path or anything. + + If you want to build openssl for windows yourself (which might be + possible, as you wouldn't be reading this if you weren't a + compile-it-yourself person), you either have to put the resulting + DLL's in your path or in the windows system directory and either + specify where you put the includes etc with the configure-parameter + `--with-ssl=<cygwin path to the root>` or put your installation directly + under `c:\OpenSSL`. The directory structure under the installation root + for OpenSSL is expected to be one with subdirectories named `include`, + `bin` and `lib`, possibly with a `VC` subdirectory of `lib` containing + the actual `.lib` files. Note that the cygwin distributed OpenSSL cannot be + used, it results in cygwin depending binaries and it has unix style + archives (`.a`, not `.lib`). + +* Building with wxWidgets. Download wxWidgets-2.8.9 or higher patch + release (2.9.* is a developer release which currently does not work + with wxErlang). + + Install or unpack it to `DRIVE:/PATH/cygwin/opt/local/pgm` + Open from explorer (i.e. by double clicking the file) + `C:\cygwin\opt\local\pgm\wxMSW-2.8.10\build\msw\wx.dsw` + In Microsoft Visual Studio, click File/Open/File, locate and + open: `C:\cygwin\opt\local\pgm\wxMSW-2.8.10\include\wx\msw\setup.h` + enable `wxUSE_GLCANVAS`, `wxUSE_POSTSCRIPT` and `wxUSE_GRAPHICS_CONTEXT` + Build it by clicking Build/Batch Build and select all unicode release + (and unicode debug) packages. + + Open `C:\cygwin\opt\local\pgm\wxMSW-2.8.10\contrib/build/stc/stc.dsw` + and batch build all unicode packages. + +* The Erlang source distribution (from <http://www.erlang.org/download.html>). + The same as for Unix platforms. Preferably use tar from within Cygwin to + unpack the source tar.gz (`tar zxf otp_src_R13B04.tar.gz`). + + set the environment ERL_TOP to point to the root directory of the + source distribution. Let's say I stood in `$HOME/src` and unpacked + `otp_src_R13B04.tar.gz`, I then add the following to `.profile`: + + ERL_TOP=$HOME/src/otp_src_R13B04 + export $ERL_TOP + +* The TCL/TK binaries. You could compile Tcl/Tk for windows yourself, + but you can get a stripped down version from our website which is + suitable to include in the final binary package. If you want to supply + tcl/tk yourself, read the instructions about how the tcl/tk tar file + used in the build is constructed under `$ERL_TOP/lib/gs/tcl`. The easy + way is to download <http://www.erlang.org/download/tcltk85_win32_bin.tar.gz> + and unpack it standing in the `$ERL_TOP` directory. This will create the + file `win32.tar.gz` in `$ERL_TOP/lib/gs/tcl/binaries`. + + One last alternative is to create a file named `SKIP` in the + `$ERL_TOP/lib/gs/` after configure is run, but that will give you an + erlang system without gs (which might be okay as you probably will use + wx anyway). + +The Shell Environment +--------------------- + +So, if you have followed the instructions above, when you start a bash +shell, you should have an INCLUDE environment with a Windows style +path, a LIB environment variable also in Windows style, and finally a +PATH that let's you reach cl, makensis, javac etc from the +command prompt (use `which cl` etc to verify from bash). + +You should also have an `ERL_TOP` environment variable that is *Cygwin +style*, and points to a directory containing, among other files, the +script `otp_build`. + +A final massage of the environment is needed, and that is done by +the script `$ERL_TOP/otp_build`. Start bash and do the following, note +the "back-ticks" (\`), can be quite hard to get on some keyboards, but +pressing the back-tick key followed by the space bar might do it... + + $ cd $ERL_TOP + $ eval `./otp_build env_win32` + +If you're unable to produce back-ticks on your keyboard, you can use +the ksh variant: + + $ cd $ERL_TOP + $ eval $(./otp_build env_win32) + +This should do the final touch to the environment and building should +be easy after this. You could run `./otp_build env_win32` without +`eval` just to see what it does, and to see that the environment it +sets seems OK. The path is cleaned of spaces if possible (using DOS +style short names instead), the variables `OVERRIDE_TARGET`, `CC`, `CXX`, +`AR` and `RANLIB` are set to their respective wrappers and the directories +`$ERL_TOP/erts/etc/win32/cygwin_tools/vc` and +`$ERL_TOP/erts/etc/win32/cygwin_tool` are added first in the PATH. + +Try now a `which erlc`. That should result in the erlc wrapper script +(which does not have the .sh extension, for reasons best kept +untold...). It should reside in `$ERL_TOP/erts/etc/win32/cygwin_tools`. +You could also try `which cc.sh`, which `ar.sh` etc. + +Now you're ready to build... + + +Building and Installing +----------------------- + +Now it's assumed that you have executed `` eval `./otp_build env_win32` `` +for this particular shell... + +Building is easiest using the `otp_build` script. That script takes care +of running configure, bootstrapping etc on Windows in a simple +way. The `otp_build` script is the utility we use ourselves to build on +different platforms and it therefore contains code for all sorts of +platforms. The principle is, however, that for non-Unix platforms, one +uses `./otp_build env_<target>` to set up environment and then the +script knows how to build on the platform "by itself". You've already +run `./otp_build env_win32` in the step above, so now it's mostly like +we build on any platform. OK, here are then steps; Assuming you will +want to build a full installation executable with NSIS, you can omit +`<installation directory>` and the release will be copied to +`$ERL_TOP/release/win32`: and there is where the packed self installing +executable will reside too. + + $ ./otp_build autoconf # Ignore the warning blob about versions of autoconf + $ ./otp_build configure <optional configure options> + $ ./otp_build boot -a + $ ./otp_build release -a <installation directory> + $ ./otp_build installer_win32 <installation directory> # optional + +Now you will have a file called `otp_win32_R12B.exe` in the +`<installation directory>`, i.e. `$ERL_TOP/release/win32`. + +Lets get into more detail: + +`$ ./otp_build autoconf` - This step rebuilds the configure scripts to +work correctly in the cygwin environment. In an ideal world, this +would not be needed, but alas, we have encountered several +incompatibilities between our distributed configure scripts (generated +on a Linux platform) and the cygwin environment over the +years. Running autoconf on cygwin ensures that the configure scripts +are generated in a cygwin-compatible way and that they will work well +in the next step. + +`$ ./otp_build configure` - This runs the newly generated configure scripts +with options making configure behave nicely. The target machine type is +plainly `win32`, so a lot of the configure-scripts recognize this +awkward target name and behave accordingly. The CC variable also makes +the compiler be cc.sh, which wraps MSVC++, so all configure tests +regarding the C compiler gets to run the right compiler. A lot of the +tests are not needed on Windows, but I thought it best to run the +whole configure anyway. The only configure option you might want to +supply is `--with-ssl`, which might be needed if you have built your own +openssl distribution. The Shining Lights distribution should be found +automatically by configure, if that fails, add a `--with-ssl=<dir>` that +specifies the root directory of your OpenSSL installation. + +`$ ./otp_build boot -a` - This uses the bootstrap directory (shipped +with the source, `$ERL_TOP/bootstrap`) to build a complete OTP +system. It first builds an emulator and sets up a minimal OTP system +under `$ERL_TOP/bootstrap`, then starts to compile the different OTP +compilers to make the `$ERL_TOP/bootstrap` system potent enough to be +able to compile all Erlang code in OTP. Then, all Erlang and C code +under `$ERL_TOP/lib` is built using the bootstrap system, giving a +complete OTP system (although not installed). When this is done, one +can run Erlang from within the source tree, just type `$ERL_TOP/bin/erl` +and you should have a prompt. If you omit the -a flag, you'll get a +smaller system, that might be useful during development. Now +exit from Erlang and start making a release of the thing: + +`$ ./otp_build release -a` - Builds a commercial release tree from the +source tree, default is to put it in `$ERL_TOP/release/win32`, you can +give any directory as parameter (Cygwin style), but it doesn't really matter +if you're going to build a self extracting installer too. You could of +course build release to the final directory and then run `./Install.exe` +standing in the directory where the release was put, that will create +a fully functional OTP installation. But let's make the nifty +installer: + +`$ ./otp_build installer_win32` - Create the self extracting installer +executable. The executable `otp_win32_<OTP version>.exe` will be placed +in the top directory of the release created in the previous step. If +no release directory is specified, the release is expected to have +been built to `$ERL_TOP/release/win32`, which also will be the place +where the installer executable will be placed. If you specified some +other directory for the release (i.e. +`./otp_build release -a /tmp/erl_release`), you're expected to give the +same parameter here, (i.e. `./otp_build installer_win32 /tmp/erl_release`). +You need to have a full NSIS installation and `makensis.exe` in your +path for this to work of course. Once you have created the installer, +you can run it to install Erlang/OTP in the regular way, just run the +executable and follow the steps in the installation wizard. To get all +default settings in the installation without any questions asked, you +run the executable with the parameter `/S` (capital S). like in: + + $ cd $ERL_TOP + $ release/win32/otp_win32_R13B04 /S + ... + +and after a while Erlang will have been installed in +`C:\Program Files\erl5.7.5`, with shortcuts in the menu etc. + +*NOTE* Beginning with R9C, the Windows installer does *not* add Erlang +to the system wide path. If one wants to have Erlang in the path, one +has to add it by hand. + +The necessary setup of an Erlang installation is actually done by the +program `Install.exe`, which resides in the release top. That program +creates `.ini`-files and copies the correct boot scripts. If one has +the correct directory tree (like after a `./otp_build release -a`), only +the running of Install.exe is necessary to get a fully functional +OTP. What the self extracting installer adds is (of course) the +possibility to distribute the binary easily, together with adding +shortcuts to the Windows start menu. There is also some adding of +entries in the registry, to associate `.erl` and `.beam` files with Erlang +and get nifty icons, but that's not something you'll really need to +run Erlang. The registry is also used to store uninstall information, +but if one has not used the self extracting installer, one cannot +(need not) do any uninstall, one just scratches the release directory +and everything is gone. Erlang/OTP does not *need* to put anything +in the Windows registry at all, and does not if you don't use the self +extracting installer. In other words the installer is pure cosmetics. + + +Development +----------- + +Once the system is built, you might want to change it. Having a test +release in some nice directory might be useful, but you also can run +Erlang from within the source tree. The target `local_setup`, makes +the program `$ERL_TOP/bin/erl.exe` usable and it also uses all the OTP +libraries in the source tree. + +If you hack the emulator, you can then build the emulator executable +by standing in `$ERL_TOP/erts/emulator` and do a simple + + $ make opt + +Note that you need to have run ``(cd $ERL_TOP && eval `./otp_build env_win32`)`` +in the particular shell before building anything on Windows. After +doing a make opt you can test your result by running `$ERL_TOP/bin/erl`. +If you want to copy the result to a release directory (say +`/tmp/erl_release`), you do this (still in `$ERL_TOP/erts/emulator`) + + $ make TESTROOT=/tmp/erl_release release + +That will copy the emulator executables. + +To make a debug build of the emulator, you need to recompile both +`beam.dll` (the actual runtime system) and `erlexec.dll`. Do like this + + $ cd $ERL_TOP + $ rm bin/win32/erlexec.dll + $ cd erts/emulator + $ make debug + $ cd ../etc + $ make debug + +and sometimes + + $ cd $ERL_TOP + $ make local_setup + +So now when you run `$ERL_TOP/erl.exe`, you should have a debug compiled +emulator, which you will see if you do a: + + 1> erlang:system_info(system_version). + +in the erlang shell. If the returned string contains `[debug]`, you +got a debug compiled emulator. + +To hack the erlang libraries, you simply do a `make opt` in the +specific "applications" directory, like: + + $ cd $ERL_TOP/lib/stdlib + $ make opt + +or even in the source directory... + + $ cd $ERL_TOP/lib/stdlib/src + $ make opt + +Note that you're expected o have a fresh Erlang in your path when +doing this, preferably the plain R13B04 you have built in the previous +steps. You could also add `$ERL_TOP/bootstrap/bin` to your `PATH` before +rebuilding specific libraries, that would give you a good enough +Erlang system to compile any OTP erlang code. Setting up the path +correctly is a little bit tricky, you still need to have +`$ERL_TOP/erts/etc/win32/cygwin_tools/vc` and +`$ERL_TOP/erts/etc/win32/cygwin_tools` *before* the actual emulator +in the path. A typical setting of the path for using the bootstrap +compiler would be: + + $ export PATH=$ERL_TOP/erts/etc/win32/cygwin_tools/vc:$ERL_TOP/erts/etc/win32/cygwin_tools:$ERL_TOP/bootstrap/bin:$PATH + +That should make it possible to rebuild any library without hassle... + +If you want to copy a library (an application) newly built, to a +release area, you do like with the emulator: + + $ cd $ERL_TOP/lib/stdlib + $ make TESTROOT=/tmp/erlang_release release + +Remember that: + +* Windows specific C-code goes in the `$ERL_TOP/erts/emulator/sys/win32`, + `$ERL_TOP/erts/emulator/drivers/win32` or `$ERL_TOP/erts/etc/win32`. + +* Windows specific erlang code should be used conditionally and the + host OS tested in *runtime*, the exactly same beam files should be + distributed for every platform! So write code like: + + case os:type() of + {win32,_} -> + do_windows_specific(); + Other -> + do_fallback_or_exit() + end, + +That's basically all you need to get going. + +Final Words +----------- +My hope is that the possibility to build the whole system on Windows +will open up for free development on this platform too. There are many +things one might want to do better in the Windows version, like the +window-style command prompt as well as pure Cygwin porting. Although i +realize it's a much larger step to start building on Windows (with all +the software you need) than for instance on Linux, I sincerely hope +that some of you will make the effort and start submitting Windows +friendly patches. + +The first build system for Erlang using Cygwin on Windows was created +by Per Bergkvist. I haven't used his build system, but it's rumored to +be good. The idea to do this came from his work, so credit is well +deserved. + +Of course this would have been completely impossible without the +excellent Cygwin package. The guys at Cygnus solutions and Redhat +deserves a huge THANKS! as well as all the other people in the free +software community who have helped in creating the magnificent +software that constitutes Cygwin. + +Good luck and Happy Hacking, +Patrik, OTP + +Copyright and License +--------------------- + +> %CopyrightBegin% +> +> Copyright Ericsson AB 2003-2010. All Rights Reserved. +> +> The contents of this file are subject to the Erlang Public License, +> Version 1.1, (the "License"); you may not use this file except in +> compliance with the License. You should have received a copy of the +> Erlang Public License along with this software. If not, it can be +> retrieved online at http://www.erlang.org/. +> +> Software distributed under the License is distributed on an "AS IS" +> basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +> the License for the specific language governing rights and limitations +> under the License. +> +> %CopyrightEnd% + + + [1]: http://www.erlang.org/faq.html "mailing lists" diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000000..1bc0df9fd8 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,661 @@ +Building and Installing Erlang/OTP +================================== + +Please read the whole file before attempting to build and install Erlang/OTP. +You can find more information about Open Source Erlang/OTP at: + + <http://www.erlang.org/> + +The source code for Erlang/OTP can also be found in a Git repository: + + <http://github.com/erlang/otp> + +Portability +----------- + +Erlang/OTP should be possible to build from source on any Unix system, +including Mac OS X. This document describes how to native compile Erlang/OTP +on Unix. For detailed instructions on how to + +* cross compile Erlang/OTP, see the [`$ERL_TOP/INSTALL-CROSS.md`] [1] + document. + +* build Erlang/OTP on Windows, see the [`$ERL_TOP/INSTALL-WIN32.md`] [2] + document. + + Binary releases for Windows can be found at + <http://www.erlang.org/download.html>. + +However, you are in any case advised to read this document first, since it +covers building Erlang/OTP in general as well as other important information. + +Daily Build and Test +-------------------- +At Ericsson we have a "Daily Build and Test" that runs on: + +* Solaris 8, 9 + * Sparc32 + * Sparc64 +* Solaris 10 + * Sparc32 + * Sparc64 + * x86 +* SuSE Linux/GNU 9.4, 10.1 + * x86 +* SuSE Linux/GNU 10.0, 10.1 + * x86 + * x86_64 +* SuSE Linux/GNU 11.0 + * x86_64 +* Gentoo Linux/GNU 1.12.11.1 + * x86 +* MontaVista Linux/GNU 4.0.1 + * PowerPC +* FreeBSD 7.1 + * x86 +* Mac OS X 10.4.11 (Tiger), 10.5.8 (Leopard), 10.6.0 (Snow Leopard) + * x86 +* Windows XP SP3, 2003, Vista, 7 + * x86 + +We also have the following "Daily Cross Builds": + +* SuSE Linux/GNU 10.1 x86 -> SuSE Linux/GNU 10.1 x86_64 +* SuSE Linux/GNU 10.1 x86_64 -> Linux/GNU TILEPro64 + +and the following "Daily Cross Build Tests": + +* SuSE Linux/GNU 10.1 x86_64 + +Versions Known *not* to Work +---------------------------- + +* Suse linux 9.1 is shipped with a patched GCC version 3.3.3, having the + rpm named `gcc-3.3.3-41`. That version has a serious optimization bug + that makes it unusable for building the Erlang emulator. Please + upgrade GCC to a newer version before building on Suse 9.1. Suse Linux + Enterprise edition 9 (SLES9) has `gcc-3.3.3-43` and is not affected. + +* `gcc-4.3.0` has a serious optimizer bug. It produces an Erlang emulator + that will crash immediately. The bug is supposed to be fixed in + `gcc-4.3.1`. + +* FreeBSD had a bug which caused `kqueue`/`poll`/`select` to fail to detect + that a `writev()` on a pipe has been made. This bug should have been fixed + in FreeBSD 6.3 and FreeBSD 7.0. NetBSD and DragonFlyBSD probably have or + have had the same bug. More information can be found at: + + * <http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/sys_pipe.c> + * <http://lists.freebsd.org/pipermail/freebsd-arch/2007-September/006790.html> + +* `getcwd()` on Solaris 9 can cause an emulator crash. If you have + async-threads enabled you can increase the stack size of the + async-threads as a temporary workaround. See the `+a` command-line + argument in the documentation of `erl(1)`. Without async-threads the + emulator is not as vulnerable to this bug, but if you hit it without + async-threads the only workaround available is to enable async-threads + and increase the stack size of the async-threads. Sun has however + released patches that fixes the issue: + + > Problem Description: 6448300 large mnttab can cause stack overrun + > during Solaris 9 getcwd + + More information can be found at: + + * <http://sunsolve.sun.com/search/document.do?assetkey=1-21-112874-40-1&searchclause=6448300> + * <http://sunsolve.sun.com/search/document.do?assetkey=1-21-114432-29-1&searchclause=6448300> + +Required Utilities +------------------ + +These are the tools you will need in order to unpack and build Erlang/OTP. + +### Unpacking ### + +* GNU unzip, or a modern uncompress. +* A TAR program that understands the GNU TAR format for long filenames + (such as GNU TAR). + +### Building ### + +* GNU make +* GNU C compiler +* Perl 5 +* GNU m4 -- If hipe (native code) support is enabled. +* ncurses (or termcap or termlib) -- The development headers and libraries + are needed, often known as ncurses-devel. (Use --without-termcap to build + without any of these libraries. Only the old shell (without any line + editing) can be used.) +* OpenSSL -- Optional, but needed for building the Erlang/OTP applications + `ssl` and `crypto`. You need the "development package" of OpenSSL, i.e. + including the header files. For building the application `ssl` the OpenSSL + binary command program `openssl` is also needed. + At least version 0.9.7 of OpenSSL is required. +* Sun Java jdk-1.5.0 or higher -- Optional but needed for building the + Erlang/OTP application `jinterface` and parts of `ic` and `orber`. We + have also tested IBM's JDK 1.5.0. +* X Windows -- Optional, but development headers and libraries are needed + to build the Erlang/OTP application `gs` on Unix/Linux. +* `sed` -- There seem to be some problems with some of the `sed` version on + Solaris. Make sure `/bin/sed` or `/usr/bin/sed` is used on the Solaris + platform. +* Flex -- Optional, headers and libraries are needed to build the flex + scanner for the `megaco` application on Unix/Linux. + +If you are building in a Git working directory you also have to have a GNU +`autoconf` of at least version 2.59. Autoconf is however not needed if you +build an unmodified version of the released source. + +### Installing ### + +* An `install` program that can take multiple file names. + +How to Build and Install Erlang/OTP +----------------------------------- + +The following instructions are for building using the source tar ball. + +The variable `$ERL_TOP` will be mentioned a lot of times. It refers to +the top directory in the source tree. More information about `$ERL_TOP` +can be found in the "`make` and `$ERL_TOP`" section below. If you are +building in git you probably want to take a look at the "Building in Git" +section below before proceeding. + +### Unpacking ### + +Step 1: Start by unpacking the Erlang/OTP distribution file with your GNU +compatible TAR program. + + $ gunzip -c otp_src_R13B04.tar.gz | tar xf - + $ zcat otp_src_R13B04.tar.gz | tar xf - + + +Step 2: Now cd into the base directory (`$ERL_TOP`). + + $ cd otp_src_R13B04 + +### Configuring ### + +Step 3: On some platforms Perl may behave strangely if certain locales are +set, so optionally you may need to set the LANG variable: + + # Bourne shell + $ LANG=C; export LANG + +or + + # C-Shell + $ setenv LANG C + +Step 4: Run the following commands to configure the build: + + $ ./configure [ options ] + +By default, Erlang/OTP will be installed in `/usr/local/{bin,lib/erlang,man/man1}`. +To instead install in `<BaseDir>/{bin,lib/erlang,man/man1}`, use the +`--prefix=<BaseDir>` option. + +If you upgraded the source with some patch you may need to clean up +from previous builds before the new build. Do a `make clean`; see +"Caveats" below. + +### Building ### + +Step 5: Build the Erlang/OTP package. + + $ make + +### Installing ### + +Step 6: Install then Erlang/OTP package + + $ make install + +### A Closer Look at the individual Steps ### + +Let us go through them in some detail. + +#### Configuring #### + +Step 4 runs a configuration script created by the GNU autoconf utility, which +checks for system specific features and then creates a number of makefiles. + +The configure script allows you to customize a number of parameters; +type `./configure --help` or `./configure --help=recursive` for details. +`./configure --help=recursive` will give help for all `configure` scripts in +all applications. + +One of the things you can specify is where Erlang/OTP should be installed: by +default Erlang/OTP will be installed in `/usr/local/{bin,lib/erlang,man/man1}`; +to keep the same structure but install in a different place, `<Dir>` say, +use the `--prefix` argument like this: `./configure --prefix=<Dir>`. + +Some of the available `configure` options are: + + * `--prefix=PATH`: Specify installation prefix. + * `--{enable,disable}-threads`: Thread support (enabled by default if + possible) + * `--{enable,disable}-smp-support`: SMP support (enabled by default if + possible) + * `--{enable,disable}-kernel-poll`: Kernel poll support (enabled by default + if possible) + * `--{enable,disable}-hipe`: HiPE support (enabled by default on supported + platforms) + * `--disable-erlang-mandir`: No private Erlang mandir, i.e., the common + mandir under `--prefix`, or `--mandir` will be used + * `--enable-darwin-universal`: Build universal binaries on darwin i386. + * `--enable-darwin-64bit`: Build 64bit binaries on darwin + * `--enable-m64-build`: Build 64bit binaries using the -m64 flag to (g)cc + * `--enable-m32-build`: Build 32bit binaries using the -m32 flag to (g)cc + * `--{with,without}-termcap`: termcap (without implies that only the old + Erlang shell can be used) + * `--with-javac=JAVAC`: Specify Java compiler to use + * `--{with,without}-javac`: Java compiler (without implies that the + `jinterface` application won't be built). + * `--{enable,disable}-dynamic-ssl-lib`: Dynamic OpenSSL libraries + * `--{enable,disable}-shared-zlib`: Shared zlib library + * `--with-ssl=PATH`: Specify location of OpenSSL include and lib + * `--{with,without}-ssl`: OpenSSL (without implies that the `crypto`, `ssh`, + and `ssl` won't be built) + +If you or your system has special requirements please read the +Makefile for additional configuration information. + +#### Building #### + +Step 5 builds the Erlang/OTP system. On a fast computer, this will take about +5 minutes. After completion of this step, you should have a working +Erlang/OTP system which you can try by typing `bin/erl`. This should start +up Erlang/OTP and give you a prompt. + +#### Installing #### + +Step 6 is optional. It installs Erlang/OTP at a standardized location (if you +change your mind about where you wish to install you can rerun step 4, +without having to do step 5 again). + +##### Alternative Installation Procedures ##### + +* Staged install using [`DESTDIR`] [3]. You can perform the install + phase in a temporary directory and later move the installation into + its correct location by use of the `DESTDIR` variable: + + $ make DESTDIR=<tmp install dir> install + + The installation will be created in a location prefixed by `$DESTDIR`. + It can, however, not be run from there. It needs to be moved into the + correct location before it can be run. If `DESTDIR` have not been set + but `INSTALL_PREFIX` has been set, `DESTDIR` will be set to + `INSTALL_PREFIX`. Note that `INSTALL_PREFIX` in pre R13B04 was buggy + and behaved as `EXTRA_PREFIX` (see below). There are lots of areas of + use for an installation procedure using `DESTDIR`, e.g. when creating + a package, cross compiling, etc. Here is an example where the + installation should be located under `/opt/local`: + + $ ./configure --prefix=/opt/local + $ make + $ make DESTDIR=/tmp/erlang-build install + $ cd /tmp/erlang-build/opt/local + $ # gnu-tar is used in this example + $ tar -zcf /home/me/my-erlang-build.tgz * + $ su - + Password: ***** + $ cd /opt/local + $ tar -zxf /home/me/my-erlang-build.tgz + +* Install using the `release` target. Instead of doing `make install` you + can create the installation in whatever directory you like using the + `release` target and run the `Install` script yourself. `RELEASE_ROOT` + is used for specifying the directory where the installation should be + created. This is what by default ends up under `/usr/local/lib/erlang` + if you do the install using `make install`. All installation paths + provided in the `configure` phase are ignored, as well as `DESTDIR`, + and `INSTALL_PREFIX`. If you want links from a specific `bin` directory + to the installation you have to set those up yourself. An example where + Erlang/OTP should be located at `/home/me/OTP`: + + $ ./configure + $ make + $ make RELEASE_ROOT=/home/me/OTP release + $ cd /home/me/OTP + $ ./Install -minimal /home/me/OTP + $ mkdir -p /home/me/bin + $ cd /home/me/bin + $ ln -s /home/me/OTP/bin/erl erl + $ ln -s /home/me/OTP/bin/erlc erlc + $ ln -s /home/me/OTP/bin/escript escript + ... + + The `Install` script should currently be invoked as follows in the + directory where it resides (the top directory): + + $ ./Install [-cross] [-minimal|-sasl] <ERL_ROOT> + + where: + + * `-minimal` Creates an installation that starts up a minimal amount + of applications, i.e., only `kernel` and `stdlib` are started. The + minimal system is normally enough, and is what `make install` uses. + * `-sasl` Creates an installation that also starts up the `sasl` + application. + * `-cross` For cross compilation. Informs the install script that it + is run on the build machine. + * `<ERL_ROOT>` - The absolute path to the Erlang installation to use + at run time. This is often the same as the current working directory, + but does not have to be. It can follow any other path through the + file system to the same directory. + + If neither `-minimal`, nor `-sasl` is passed as argument you will be + prompted. + +* Test install using `EXTRA_PREFIX`. The content of the `EXTRA_PREFIX` + variable will prefix all installation paths when doing `make install`. + Note that `EXTRA_PREFIX` is similar to `DESTDIR`, but it does *not* have + the same effect as `DESTDIR`. The installation can and have to be run + from the location specified by `EXTRA_PREFIX`. That is, it can be useful + if you want to try the system out, running test suites, etc, before doing + the real install without `EXTRA_PREFIX`. + +### Symbolic Links in `--bindir` ### + +When doing `make install` and the default installation prefix is used, +relative symbolic links will be created from `/usr/local/bin` to all public +Erlang/OTP executables in `/usr/local/lib/erlang/bin`. The installation phase +will try to create relative symbolic links as long as `--bindir` and the +Erlang bin directory, located under `--libdir`, both have `--exec-prefix` as +prefix. Where `--exec-prefix` defaults to `--prefix`. `--prefix`, +`--exec-prefix`, `--bindir`, and `--libdir` are all arguments that can be +passed to `configure`. One can force relative, or absolute links by passing +`BINDIR_SYMLINKS=relative|absolute` as arguments to `make` during the install +phase. Note that such a request might cause a failure if the request cannot +be satisfied. + +### Building in Git ### + +When building in a Git working directory you also have to have a GNU `autoconf` +of at least version 2.59 on your system. This since you need to generate the +`configure` scripts before you can start building. + +The `configure` scripts are generated by invoking `./otp_build autoconf` in +the `$ERL_TOP` directory. The `configure` scripts also have to be regenerated +when a `configure.in` or `aclocal.m4` file has been modified. Note that when +checking out a branch a `configure.in` or `aclocal.m4` file may change +content, and you may therefore have to regenerate the `configure` scripts +when checking out a branch. Regenerated `configure` scripts imply that you +have to run `configure` and build again. + +Note that running `./otp_build autoconf` is **not** needed when building an +unmodified version the released source. + +Other useful information can be found at our github wiki: +<http://wiki.github.com/erlang/otp> + +Pre-built Source Tree +--------------------- + +The source tree is delivered with a lot of platform independent +build results already pre-built. If you want to remove these pre-built +files, invoke `./otp_build remove_prebuilt_files` from the `$ERL_TOP` +directory. After you have done this, you can build exactly the same way +as before, but the build process will take a much longer time. + +*NOTE*: Doing `make clean` in an arbitrary directory of the source tree, +may remove files needed for bootstrapping the build. Doing +`./otp_build save_bootstrap` from the `$ERL_TOP` directory before +doing `make clean` will ensure that it will be possible to build after +doing `make clean`. `./otp_build save_bootstrap` will be invoked +automatically when `make` is invoked from `$ERL_TOP` with either the +`clean` target, or the default target. It is also automatically invoked +if `./otp_build remove_prebuilt_files` is invoked. + +`make` and `$ERL_TOP` +--------------------- + +All the makefiles in the entire directory tree use the environment +variable `ERL_TOP` to find the absolute path of the installation. The +`configure` script will figure this out and set it in the top level +Makefile (which, when building, it will pass on). However, when +developing it is sometimes convenient to be able to run make in a +subdirectory. To do this you must set the `ERL_TOP` variable +before you run make. + +For example, assume your GNU make program is called `make` and you +want to rebuild the application `STDLIB`, then you could do: + + $ cd lib/stdlib; env ERL_TOP=<Dir> make + +where `<Dir>` would be what you find `ERL_TOP` is set to in the top level +Makefile. + +Support for SMP (Symmetric Multi Processing) +-------------------------------------------- + +An emulator with SMP support will be built by default on most platforms +if a usable POSIX thread library or native Windows threads is found. + +You can force building of an SMP emulator, by using +`./configure --enable-smp-support`. However, if configure does not +automatically enable SMP support, the build is very likely to fail. + +Use `./configure --disable-smp-support` if you for some reason do not +want to have the emulator with SMP support built. + +If SMP support is enabled, support for threaded I/O will also be turned on +(also in the emulator without SMP support). + +The `erl` command will automatically start the SMP emulator if the +computer has more than one logical processor. You can force a start +of the emulator with SMP support by passing `-smp enable` as +command line arguments to erl, and you can force a start of the +emulator without SMP support by passing `-smp disable`. + +How to install the Erlang/OTP documentation +------------------------------------------- + +For some graphical tools to find the on-line help you have to install +the HTML documentation on top of the installed OTP applications, i.e. + + $ cd <PrefixDir>/lib/erlang + $ gunzip -c otp_html_R<XY>B-<Z>.tar.gz | tar xf - + +For `erl -man <page>` to work the Unix manual pages have to be +installed in the same way, i.e. + + $ cd <PrefixDir>/lib/erlang + $gunzip -c otp_man_R<XY>B-<Z>.tar.gz | tar xf - + + +GS (Graphic System) +------------------- + +GS now Tcl/Tk 8.4. It will be searched for when starting GS. + +Using HiPE +---------- + +HiPE supports the following system configurations: + +* x86: All 32-bit and 64-bit mode processors should work. + + * Linux: Fedora Core is supported. Both 32-bit and 64-bit modes are + supported. + + NPTL glibc is strongly preferred, or a LinuxThreads + glibc configured for "floating stacks". Old non-floating + stacks glibcs have a fundamental problem that makes HiPE + support and threads support mutually exclusive. + + * Solaris: Solaris 10 (32-bit and 64-bit) and 9 (32-bit) are supported. + The build requires a version of the GNU C compiler (gcc) + that has been configured to use the GNU assembler (gas). + Sun's x86 assembler is emphatically **not** supported. + + * FreeBSD: FreeBSD 6.1 and 6.2 in 32-bit and 64-bit modes should work. + + * MacOSX/Darwin: Darwin 9.8.0 in 32-bit mode should work. + +* PowerPC: All 32-bit 6xx/7xx(G3)/74xx(G4) processors should work. 32-bit + mode on 970 (G5) and POWER5 processors should work. + + * Linux (Yellow Dog) and Mac OSX 10.4 are supported. + +* SPARC: All UltraSPARC processors running 32-bit user code should work. + + * Solaris 9 is supported. The build requires a `gcc` that has been + configured to use Sun's assembler and linker. Using the GNU assembler + but Sun's linker has been known to cause problems. + + * Linux (Aurora) is supported. + +* ARM: ARMv5TE (i.e. XScale) processors should work. Both big-endian and + little-endian modes are supported. + + * Linux is supported. + +HiPE is automatically enabled on the following systems: + +* x86 in 32-bit mode: Linux, Solaris, FreeBSD +* x86 in 64-bit mode: Linux, Solaris, FreeBSD +* PowerPC: Linux, MacOSX +* SPARC: Linux +* ARM: Linux + +On other supported systems you need to `./configure --enable-hipe`. + +If you are running on a platform supporting HiPE and if you have not disabled +HiPE, you can compile a module into native code like this from the Erlang +shell: + + 1> c(Module, native). + +or + + 1> c(Module, [native|OtherOptions]). + +Using the erlc program, write like this: + + $ erlc +native Module.erl + +The native code will be placed into the beam file and automatically loaded +when the beam file is loaded. + +To add hipe options, write like this from the Erlang shell: + + 1> c(Module, [native,{hipe,HipeOptions}|MoreOptions]). + +Use hipe:help_options/0 to print out the available options. + + 1> hipe:help_options(). + +Mac OS X (Darwin) +----------------- + +We test Mac OS X 10.4.11 (Tiger) and Mac OS X 10.5.x (Leopard) in our daily +builds (but only on Intel processors). + +Make sure that the command `hostname` returns a valid fully qualified host +name (this is configured in `/etc/hostconfig`). + +If you develop linked-in drivers (shared library) you need to link using +`gcc` and the flags `-bundle -flat_namespace -undefined suppress`. You also +include `-fno-common` in `CFLAGS` when compiling. Use `.so` as the library +suffix. + +Universal 32bit binaries can be built on an Intel Mac using the +`--enable-darwin-universal` configure option. There still may occur +problems with certain applications using this option, but the base +system should run smoothly. + +When building universal binaries on a PowerPC Mac (at least on Tiger), +you must point out a suitable SDK that contains universal binaries. +For instance, to build universal binaries for Tiger (10.4): + + $ CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk" \ + LDFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk" \ + ./configure --enable-darwin-universal + +Also, if you run Leopard, but want to build for Tiger, you must do by +setting the `MACOSX_DEPLOYMENT_TARGET` environmental variable. + + $ export MACOSX_DEPLOYMENT_TARGET=10.4 + +Experimental support for 64bit x86 darwin binaries can be enabled +using the `--enable-darwin-64bit` configure flag. The 64bit binaries are +best built and run on Leopard, but most of the system also works on +Tiger (Tiger's 64bit libraries are, however, limited; therefore e.g. `odbc`, +`crypto`, `ssl` etc. are not supported in Tiger). 64bit PPC binaries are not +supported and we have no plans to add such support (no machines to +test on). + +Universal binaries and 64bit binaries are mutually exclusive options. + +How to Build a Debug Enabled Erlang RunTime System +-------------------------------------------------- + +After completing all the normal building steps described above a debug +enabled runtime system can be built. To do this you have to change +directory to `$ERL_TOP/erts/emulator`. + +In this directory execute: + + $ make debug FLAVOR=$FLAVOR + +where `$FLAVOR` is either `plain` or `smp`. The flavor options will +produce a beam.debug and beam.smp.debug executable respectively. The +files are installed along side with the normal (opt) versions `beam.smp` +and `beam`. + +To start the debug enabled runtime system execute: + + $ $ERL_TOP/bin/cerl -debug + +The debug enabled runtime system features lock violation checking, +assert checking and various sanity checks to help a developer ensure +correctness. Some of these features can be enabled on a normal beam +using appropriate configure options. + +There are other types of runtime systems that can be built as well +using the similar steps just described. + + $ make $TYPE FLAVOR=$FLAVOR + +where `$TYPE` is `opt`, `gcov`, `gprof`, `debug`, `valgrind`, or `lcnt`. +These different beam types are useful for debugging and profiling +purposes. + +Authors +------- +Authors are mostly listed in the application's `AUTHORS` files, +that is `$ERL_TOP/lib/*/AUTHORS` and `$ERL_TOP/erts/AUTHORS`, +not in the individual source files. + +Copyright and License +--------------------- + +> %CopyrightBegin% +> +> Copyright Ericsson AB 1998-2010. All Rights Reserved. +> +> The contents of this file are subject to the Erlang Public License, +> Version 1.1, (the "License"); you may not use this file except in +> compliance with the License. You should have received a copy of the +> Erlang Public License along with this software. If not, it can be +> retrieved online at http://www.erlang.org/. +> +> Software distributed under the License is distributed on an "AS IS" +> basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +> the License for the specific language governing rights and limitations +> under the License. +> +> %CopyrightEnd% + +More Information +---------------- + +More information can be found at <http://www.erlang.org>. + + + + [1]: INSTALL-CROSS.html "$ERL_TOP/INSTALL-CROSS.md" + [2]: INSTALL-WIN32.html "$ERL_TOP/INSTALL-WIN32.md" + [3]: http://www.gnu.org/prep/standards/html_node/DESTDIR.html "DESTDIR" diff --git a/Makefile.in b/Makefile.in index 2dcc89144d..be49761490 100644 --- a/Makefile.in +++ b/Makefile.in @@ -392,16 +392,55 @@ endif # --------------------------------------------------------------- # Target only used when building commercial ERTS patches # --------------------------------------------------------------- -release_docs docs: +release_docs docs: html_readmes ifeq ($(OTP_SMALL_BUILD),true) - cd $(ERL_TOP)/lib && $(MAKE) TESTROOT=$(RELEASE_ROOT) $@ + cd $(ERL_TOP)/lib && \ + ERL_TOP=$(ERL_TOP) $(MAKE) TESTROOT=$(RELEASE_ROOT) $@ else - cd $(ERL_TOP)/lib && $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) $@ - cd $(ERL_TOP)/lib/dialyzer && $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) $@ + cd $(ERL_TOP)/lib && \ + ERL_TOP=$(ERL_TOP) $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) $@ + cd $(ERL_TOP)/lib/dialyzer && \ + ERL_TOP=$(ERL_TOP) $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) $@ endif - cd $(ERL_TOP)/erts && $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) $@ - cd $(ERL_TOP)/system/doc && $(MAKE) TESTROOT=$(RELEASE_ROOT) $@ - + cd $(ERL_TOP)/erts && \ + ERL_TOP=$(ERL_TOP) $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) $@ + cd $(ERL_TOP)/system/doc && \ + ERL_TOP=$(ERL_TOP) $(MAKE) TESTROOT=$(RELEASE_ROOT) $@ + +.PHONY: html_readmes clean_html_readmes + +HTML_READMES = INSTALL.html INSTALL-WIN32.html INSTALL-CROSS.html + +html_readmes: $(HTML_READMES) + +clean_html_readmes: + rm -f $(HTML_READMES) + +%.html: %.md + echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" > $@ + echo "<html xmlns:fn=\"http://www.w3.org/2005/02/xpath-functions\"><head>" >> $@ + echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" >> $@ + echo "<style type=\"text/css\">" >> $@ + echo "body {" >> $@ + echo " margin: 4em 4em 4em 4em;" >> $@ + echo " background: white;" >> $@ + echo " font-family: Verdana, Arial, Helvetica, sans-serif;" >> $@ + echo "}" >> $@ + echo "code { font-family: courier;font-weight: normal}" >> $@ + echo "a:link { color: blue; text-decoration: none }" >> $@ + echo "a:active { color: blue; text-decoration: none }" >> $@ + echo "a:visited { color: blue; text-decoration: none }" >> $@ + echo "</style><title>" >> $@ + cat $< | sed -n "s/[ ]*\([^ ].*[^ ]\)[ ]*/\1/p;/[ ]*[^ ][ ]*/q" >> $@ + echo "</title></head><body>" >> $@ +ifneq ($(MD2HTML),) + $(MD2HTML) $< >> $@ +else + echo "<pre>" >> $@ + cat $< | sed "s|\&|\&\;|g;s|\"|\"\;|g;s|<|\<\;|g;s|>|\>\;|g" >> $@ + echo "</pre>" >> $@ +endif + echo "</body></html>" >> $@ # ---------------------------------------------------------------------- ERLANG_EARS=$(BOOTSTRAP_ROOT)/bootstrap/erts @@ -988,7 +1027,7 @@ $(IBIN_DIR): # Clean targets # -clean: check_recreate_primary_bootstrap +clean: check_recreate_primary_bootstrap clean_html_readmes rm -f *~ *.bak config.log config.status prebuilt.files ibin/* find . -type f -name SKIP -print | xargs $(RM) cd erts && ERL_TOP=$(ERL_TOP) $(MAKE) clean diff --git a/README b/README deleted file mode 100644 index 9622b2d676..0000000000 --- a/README +++ /dev/null @@ -1,562 +0,0 @@ -=========================================================================== - OpenSource Erlang/OTP -=========================================================================== - -Please read the whole file before attempting to build and install Erlang. -You can find more information about Open Source Erlang at: - - http://www.erlang.org/ - -The source code for Erlang/OTP can also be found in a Git repository: - - http://github.com/erlang/otp - -%CopyrightBegin% - -Copyright Ericsson AB 1998-2010. All Rights Reserved. - -The contents of this file are subject to the Erlang Public License, -Version 1.1, (the "License"); you may not use this file except in -compliance with the License. You should have received a copy of the -Erlang Public License along with this software. If not, it can be -retrieved online at http://www.erlang.org/. - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -the License for the specific language governing rights and limitations -under the License. - -%CopyrightEnd% - -Portability ------------ - -Erlang/OTP should be possible to build from source on any Unix -system, including Mac OS X. - -Instructions for building from source on Windows are in the file README.win32. -Binary releases for Windows can be found at http://www.erlang.org/ - -At Ericsson we have a "Daily Build and Test" that runs on: - - Operating system Versions - ----------------------------------------------------------- - Solaris/Sparc32 8, 9, 10 - Solaris/Sparc64 10 - Solaris/x86 10 - Linux/Suse x86 9.4, 10.1 - Linux/Suse x86_64 10.0, 10.1, 11.0 - FreeBSD x86 7.1 - Mac OS X/Intel 10.4.11 (Tiger), 10.5.8 (Leopard) - Windows XP SP3, 2003, Vista - -We have also done some testing on Mac OS 10.6.0 (Snow Leopard). - -Versions known *not* to work -------------------------------------- - -Suse linux 9.1 is shipped with a patched GCC version 3.3.3, having the -rpm named gcc-3.3.3-41. That version has a serious optimization bug -that makes it unusable for building the Erlang emulator. Please -upgrade GCC to a newer version before building on Suse 9.1. Suse Linux -Enterprise edition 9 (SLES9) has gcc-3.3.3-43 and is not affected. - -gcc-4.3.0 has a serious optimizer bug. It produces an Erlang emulator -that will crash immediately. The bug is supposed to be fixed in gcc-4.3.1. - -FreeBSD had a bug which caused kqueue/poll/select to fail to detect -that a writev() on a pipe has been made. This bug should have been fixed -in FreeBSD 6.3 and FreeBSD 7.0. NetBSD and DragonFlyBSD probably have or -have had the same bug. More information can be found at: - * http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/sys_pipe.c - * http://lists.freebsd.org/pipermail/freebsd-arch/2007-September/006790.html - -getcwd() on Solaris 9 can cause an emulator crash. If you have async-threads -enabled you can increase the stack size of the async-threads as a temporary -workaround. See the +a command-line argument in the documentation of erl(1). -Without async-threads the emulator isn't as vulnerable to this bug, but if -you hit it without async-threads the only workaround available is to enable -async-threads and increase the stack size of the async-threads. Sun has -however released patches that fixes the issue: - -Problem Description: 6448300 large mnttab can cause stack overrun during -Solaris 9 getcwd - -More information can be found at: - * http://sunsolve.sun.com/search/document.do?assetkey=1-21-112874-40-1&searchclause=6448300 - * http://sunsolve.sun.com/search/document.do?assetkey=1-21-114432-29-1&searchclause=6448300 - -Required utilities ------------------- - -These are the tools you will need in order to unpack and build Erlang/OTP. - -Unpacking - - * GNU unzip, or a modern uncompress. - * A TAR program that understands the GNU TAR format for long filenames (such -as GNU TAR). - -Compiling - - * GNU make - * GNU C compiler - * Perl 5 - * GNU m4 -- If hipe (native code) support is enabled. - * ncurses (or termcap or termlib) -- The development headers and libraries - are needed, often known as ncurses-devel. (Use --without-termcap to build - without any of these libraries. Only the old shell (without any line - editing) can be used.) - * OpenSSL -- Optional, but needed for building the Erlang/OTP applications - 'ssl' and 'crypto'. You need the "development package" of OpenSSL, i.e. - including the header files. For building the application 'ssl' the OpenSSL - binary command program 'openssl' is also needed. - At least version 0.9.7 of OpenSSL is required. - * Sun Java jdk-1.5.0 or higher -- Optional but needed for building the - Erlang/OTP application 'jinterface' and parts of 'ic' and 'orber'. We - have also tested IBM's JDK 1.5.0. - * X Windows -- Optional, but development headers and libraries are needed - to build the Erlang/OTP application 'gs' on Unix/Linux. - * sed -- There seem to be some problems with some of the 'sed' version on - Solaris. Make sure "/bin/sed" or "/usr/bin/sed" is used on the Solaris - platform. - * Flex -- Optional, headers and libraries are needed to build the flex - scanner for the megaco application on Unix/Linux. - -Installing - - * An 'install' program that can take multiple file names. - -How to build and install Erlang/OTP ------------------------------------ - -If you are building in a Git repository, see - - http://wiki.github.com/erlang/otp - -The following instructions are for building using the source tar ball. - -Step 1: Start by unpacking the Erlang/OTP distribution file with your GNU -compatible TAR program. - - $ gunzip -c otp_src_R13B03.tar.gz | tar xf - - $ zcat otp_src_R13B03.tar.gz | tar xf - - -Step 2: Now cd into the base directory. - - $ cd otp_src_R13B03 - -Step 3: On some platforms Perl may behave strangely if certain locales are -set, so optionally you may need to set the LANG variable: - - # Bourne shell - $ LANG=C; export LANG -or - # C-Shell - $ setenv LANG C - -Step 4: Run the following commands to configure the build: - - $ ./configure [ options ] - -By default, Erlang/OTP will be installed in /usr/local/{bin,lib/erlang,man/man1}. -To instead install in <BaseDir>/{bin,lib/erlang,man/man1}, use the --prefix=<BaseDir> -option. - -If you upgraded the source with some patch you may need to clean up -from previous builds before the new build. Do a "make clean"; see -"Caveats" below. - -Step 5: Build the Erlang/OTP package. - - $ make - -Step 6: Install then Erlang/OTP package - - $ make install - -Let's go through them in some detail: - -Step 4 runs a configuration script created by the GNU autoconf utility, which -checks for system specific features and then creates a number of makefiles. - -The configure script allows you to customize a number of parameters; -type "./configure --help" for details. - -One of the things you can specify is where Erlang/OTP should be installed: by -default Erlang/OTP will be installed in /usr/local/{bin,lib/erlang,man/man1}; -to keep the same structure but install in a different place, <Dir> say, -use the --prefix argument like this: -"./configure --prefix=<Dir>". - -This step will also configure any additional libraries unpacked in step 3 -(if you didn't add any of the extra libraries configure will issue a warning -saying that there is no configuration information in lib; this warning can -safely be ignored). - -You can also specify where the OpenSSL include and library files are -located, or alternatively disable the use of SSL and Crypto. -(The details can be found by typing './configure --help'.) - -Other options are: - - --enable-smp-support See the next section. - - --disable-smp-support See the next section. - - --disable-threads Disable support for threaded I/O; - this option also disables building of the SMP - emulator. (See the next section.) - - --enable-threads Enable support for threaded I/O. - (This is the default if SMP support is enabled. - See the next section.) - - --disable-hipe Disable HiPE (High-Performance Erlang). - HiPE will automatically be enabled on supported - platforms. - -Step 5 builds the Erlang/OTP system. On a fast computer, this will take about -5 minutes. After completion of this step, you should have a working -Erlang/OTP system which you can try by typing "bin/erl". This should start -up Erlang/OTP and give you a prompt. - -Step 6 is optional. It installs Erlang/OTP at a standardized location (if you -change your mind about where you wish to install you can rerun step 4, -without having to do step 5 again). - -Alternative installation procedures: -* Staged install using DESTDIR. You can perform the install phase in a - temporary directory and later move the installation into its correct location - by use of the DESTDIR variable: 'make DESTDIR=<tmp install dir> install' - The installation will be created in a location prefixed by $DESTDIR. It - can, however, not be run from there. It needs to be moved into the correct - location before it can be run. If DESTDIR have not been set but INSTALL_PREFIX - has been set, DESTDIR will be set to INSTALL_PREFIX. Note that INSTALL_PREFIX - in pre R13B04 was buggy and behaved as EXTRA_PREFIX (see below). There are - lots of areas of use for an installation procedure using DESTDIR, e.g. when - creating a package, cross compiling, etc. Here is an example where the - installation should be located under /opt/local: - $ ./configure --prefix=/opt/local - $ make - $ mkdir /tmp/erlang-build - $ make DESTDIR=/tmp/erlang-build install - $ cd /tmp/erlang-build/opt/local - $ # gnu-tar is used in this example - $ tar -zcf /home/me/my-erlang-build.tgz * - $ su - - Password: ***** - $ cd /opt/local - $ tar -zxf /home/me/my-erlang-build.tgz -* Test install using EXTRA_PREFIX. Note that EXTRA_PREFIX is similar to - DESTDIR, but it does not have the same effect as DESTDIR. The EXTRA_PREFIX - variable will prefix all installation paths, and the installation can and - have to be run from there. That is, it can be useful if you want to try the - system out, running test suites, etc, before doing the real install without - EXTRA_PREFIX. -* Install using the `release' target. Instead of doing `make install' you can - creat the installation in whatever directory you like using the `release' - target and run the `Install' script yourself. RELEASE_ROOT is used for - specifying the directory where the installation should be created. This is - what by default ends up under `/usr/local/lib/erlang' if you do the install - using `make install'. All installation paths provided in the `configure' - phase are ignored, as well as DESTDIR, and INSTALL_PREFIX. If you want links - from a specific `bin' directory to the installation you have to set those up - yourself. An example where Erlang/OTP should be located at /home/me/OTP: - $ ./configure - $ make - $ make RELEASE_ROOT=/home/me/OTP release - $ cd /home/me/OTP - $ ./Install -minimal /home/me/OTP - $ mkdir -p /home/me/bin - $ cd /home/me/bin - $ ln -s /home/me/OTP/bin/erl erl - $ ln -s /home/me/OTP/bin/erlc erlc - $ ln -s /home/me/OTP/bin/escript escript - ... - The `Install' script should currently be invoked as follows in the - directory where it resides: - `./Install [-cross] [-minimal|-sasl] <ERL_ROOT>' - where: - -minimal - Creates an installation that starts up a minimal amount - of applications, i.e., only kernel and stdlib are started. - The minimal system is normally enough. - -sasl - Creates an installation that also starts up the sasl - application. - -cross - For cross compilation. Informs the install script that it - is run on the build machine. - <ERL_ROOT> - The absolute path to the Erlang installation to use at run - time. This is often the same as the current working - directory, but does not have to be. It can follow any other - path through the file system to the same directory. - - If neither -minimal, nor -sasl is passed as argument you will be prompted. - -When doing `make install' and the default installation prefix is used, relative -symbolic links will be created from /usr/local/bin to all public executables in -the Erlang installation. The installation phase will try to create relative -symbolic links as long as `--bindir' and the Erlang bin directory, located under -`--libdir', both have `--exec-prefix' as prefix. Where `--exec-prefix' -defaults to `--prefix'. `--prefix', `--exec-prefix', `--bindir', and `--libdir' -are all arguments that can be passed to `configure'. One can however force -relative, or absolute links by passing BINDIR_SYMLINKS=relative|absolute -as arguments to make during the install phase. Note that such a request might -cause a failure if the request cannot be satisfied. - -The source tree is delivered with a lot of platform independent -build results already pre-built. If you want to remove these pre-built -files, invoke './otp_build remove_prebuilt_files' from the $ERL_TOP -directory. After you have done this, you can build exactly the same way -as before, but the build process will take a much longer time. - -NOTE: Doing 'make clean' in an arbitrary directory of the source tree, -may remove files needed for bootstrapping the build. Doing -'./otp_build save_bootstrap' from the $ERL_TOP directory before -doing 'make clean' will ensure that it will be possible to build after -doing 'make clean'. './otp_build save_bootstrap' will be invoked -automatically when 'make' is invoked from ERL_TOP with either the -clean target, or the default target. It is also automatically invoked -if './otp_build remove_prebuilt_files' is invoked. - -If you or your system has special requirements please read the -Makefile for additional configuration information. - -Cross compiling Erlang/OTP --------------------------- -The support for cross compiling Erlang/OTP is in its early stage of -development, and should be considered as experimental. For more -information see: $ERL_TOP/xcomp/README - -How to build a debug enabled Erlang runtime system --------------------------------------------------- - -After completing all the normal building steps described above a debug -enabled runtime system can be built. To do this you have to change -directory to $ERL_TOP/erts/emulator. - -In this directory execute: - - make debug FLAVOR=$FLAVOR - -where $FLAVOR is either "plain" or "smp". The flavor options will -produce a beam.debug and beam.smp.debug executable respectively. The -files are installed along side with the normal (opt) versions beam.smp -and beam. - -To start the debug enabled runtime system execute: - - $ERL_TOP/bin/cerl -debug - -The debug enabled runtime system features lock violation checking, -assert checking and various sanity checks to help a developer ensure -correctness. Some of these features can be enabled on a normal beam -using appropriate configure options. - -There are other types of runtime systems that can be built as well -using the similar steps just described. - - make $TYPE FLAVOR=$FLAVOR - -where $TYPE is opt, gcov, gprof, debug, valgrind, lcnt. These -different beam types are useful for debugging and profiling purposes. - - -Support for SMP (Symmetric Multi Processing) --------------------------------------------- - -An emulator with SMP support will be built by default on most platforms -if a usable POSIX thread library or native Windows threads is found. - -You can force building of an SMP emulator, by using -"./configure --enable-smp-support". However, if configure doesn't -automatically enable SMP support, the build is very likely to fail. - -Use "./configure --disable-smp-support" if you for some reason don't -want to have the emulator with SMP support built. - -If SMP support is enabled, support for threaded I/O will also be turned on -(also in the emulator without SMP support). - -The 'erl' command will automatically start the SMP emulator if the -computer has more than one logical processor. You can force a start -of the emulator with SMP support by passing '-smp enable' as -command line arguments to erl, and you can force a start of the -emulator without SMP support by passing '-smp disable'. - -How to install the Erlang/OTP documentation -------------------------------------------- - -For some graphical tools to find the on-line help you have to install -the HTML documentation on top of the installed OTP applications, i.e. - - $ cd <PrefixDir>/lib/erlang - $ gunzip -c otp_html_R<XY>B-<Z>.tar.gz | tar xf - - -For "erl -man <page>" to work the Unix manual pages have to be -installed in the same way, i.e. - - $ cd <PrefixDir>/lib/erlang - $gunzip -c otp_man_R<XY>B-<Z>.tar.gz | tar xf - - - -GS (Graphic System) -------------------- - -GS now Tcl/Tk 8.4. It will be searched for when starting GS. - -Using HiPE ----------- - -HiPE supports the following system configurations: - -x86: - All 32-bit and 64-bit mode processors should work. - - Linux: - Fedora Core is supported. - Both 32-bit and 64-bit modes are supported. - - NPTL glibc is strongly preferred, or a LinuxThreads - glibc configured for "floating stacks". Old non-floating - stacks glibcs have a fundamental problem that makes HiPE - support and threads support mutually exclusive. - - Solaris: - Solaris 10 (32-bit and 64-bit) and 9 (32-bit) are supported. - - The build requires a version of the GNU C compiler (gcc) - that has been configured to use the GNU assembler (gas). - Sun's x86 assembler is emphatically /not/ supported. - - FreeBSD: - FreeBSD 6.1 and 6.2 in 32-bit and 64-bit modes should work. - - MacOSX/Darwin: - Darwin 9.8.0 in 32-bit mode should work. - -PowerPC: - All 32-bit 6xx/7xx(G3)/74xx(G4) processors should work. 32-bit mode on - 970 (G5) and POWER5 processors should work. - - Linux (Yellow Dog) and Mac OSX 10.4 are supported. - -SPARC: - All UltraSPARC processors running 32-bit user code should work. - - Solaris 9 and Linux (Aurora) are supported. - - On Solaris the build requires a gcc that has been configured to use Sun's - assembler and linker. Using the GNU assembler but Sun's linker has been - known to cause problems. - -ARM: - ARMv5TE (i.e. XScale) processors should work. Both big-endian and - little-endian modes are supported. - - Linux is supported. - -HiPE is automatically enabled on the following systems: - x86 in 32-bit mode: Linux, Solaris, FreeBSD - x86 in 64-bit mode: Linux, Solaris, FreeBSD - PowerPC: Linux, MacOSX - SPARC: Linux - ARM: Linux - -On other supported systems you need to "./configure --enable-hipe". - -If you are running on a platform supporting HiPE and if you have not disabled -HiPE, you can compile a module into native code like this from the Erlang -shell: - - 1> c(Module, native). - -or - - 1> c(Module, [native|OtherOptions]). - -Using the erlc program, write like this: - - $ erlc +native Module.erl - -The native code will be placed into the beam file and automatically loaded -when the beam file is loaded. - -To add hipe options, write like this from the Erlang shell: - - 1> c(Module, [native,{hipe,HipeOptions}|MoreOptions]). - -Use hipe:help_options/0 to print out the available options. - - 1> hipe:help_options(). - -Mac OS X (Darwin) ------------------ - -We test Mac OS X 10.4.11 (Tiger) and Mac OS X 10.5.x (Leopard) in our daily -builds (but only on Intel processors). - -Make sure that the command "hostname" returns a valid fully qualified host -name (this is configured in "/etc/hostconfig"). - -If you develop linked-in drivers (shared library) you need to link -using "gcc" and the flags '-bundle -flat_namespace -undefined -suppress'. You also include '-fno-common' in CFLAGS when -compiling. Use ".so" as the library suffix. - -Universal 32bit binaries can be built on an Intel Mac using the -'--enable-darwin-universal' configure option. There still may occur -problems with certain applications using this option, but the base -system should run smoothly. - -When building universal binaries on a PowerPC Mac (at least on Tiger), -you must point out a suitable SDK that contains universal binaries. -For instance, to build universal binaries for Tiger (10.4): - - $ CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk" \ - LDFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk" \ - ./configure --enable-darwin-universal - -Also, if you run Leopard, but want to build for Tiger, you must do by setting the MACOSX_DEPLOYMENT_TARGET environmental variable. - - $ export MACOSX_DEPLOYMENT_TARGET=10.4 - -Experimental support for 64bit x86 darwin binaries can be enabled -using the '--enable-darwin-64bit' configure flag. The 64bit binaries are -best built and run on Leopard, but most of the system also works on -Tiger (Tiger's 64bit libraries are, however, limited; therefore e.g. odbc, -crypto, ssl etc. are not supported in Tiger). 64bit PPC binaries are not -supported and we have no plans to add such support (no machines to -test on). - -Universal binaries and 64bit binaries are mutually exclusive options. - -Make and the variable "ERL_TOP" -------------------------------- - -All the makefiles in the entire directory tree use the environment -variable ERL_TOP to find the absolute path of the installation. The -configure script will figure this out and set it in the top level -Makefile (which, when building, it will pass on). However, when -developing it is sometimes convenient to be able to run make in a -subdirectory. To do this you must set the ERL_TOP variable -before you run make. - -For example, assume your GNU make program is called "make" and you -want to rebuild the application STDLIB, then you could do: - - $ cd lib/stdlib; env ERL_TOP=<Dir> make - -where <Dir> would be what you find ERL_TOP is set to in the top level -Makefile. - -Authors -------- -Authors are mostly listed in the application's AUTHORS files, -that is $ERL_TOP/lib/*/AUTHORS and $ERL_TOP/erts/AUTHORS, -not in the individual source files. - - -More Information ----------------- - -More information can be found at http://www.erlang.org/. diff --git a/README.md b/README.md new file mode 100644 index 0000000000..c38f097b0f --- /dev/null +++ b/README.md @@ -0,0 +1,76 @@ +Erlang/OTP +========== + +**Erlang** is a programming language used to build massively scalable soft +real-time systems with requirements on high availability. Some of its +uses are in telecom, banking, e-commerce, computer telephony and +instant messaging. Erlang's runtime system has built-in support for +concurrency, distribution and fault tolerance. + +**OTP** is set of Erlang libraries and design principles providing +middle-ware to develop these systems. It includes its own distributed +database, applications to interface towards other languages, debugging +and release handling tools. + +More information can be found at [erlang.org] [1]. + +Building and Installing +----------------------- + +Information on building and installing Erlang/OTP can be found +in the `INSTALL.md` document. + +Contributing to Erlang/OTP +-------------------------- + +Here are the [instructions for submitting patches] [2]. + +In short: + +* We prefer to receive proposed updates via email on the + [`erlang-patches`] [3] mailing list rather than through a pull request. + Pull requests are not practical because we have a strict policy never to + merge any untested changes to the development branch (the only exception + being **obviously** correct changes, such as corrections of typos). + +* We merge all proposed updates to the `pu` (*proposed updates*) branch, + typically within one working day. + +* At least once a day, the contents of the `pu` branch will be built on + several platforms (Linux, Solaris, Mac OS X, Windows, and so on) and + automatic test suites will be run. We will email you if any problems are + found. + +* If a proposed change builds and passes the tests, it will be reviewed + by one or more members of the Erlang/OTP team at Ericsson. The reviewer + may suggest improvements that are needed before the change can be accepted + and merged. + +* Once or twice a week, a status email called "What's cooking in Erlang/OTP" + will be sent to the [`erlang-patches`] [3] mailing list. + +Copyright and License +--------------------- + +> %CopyrightBegin% +> +> Copyright Ericsson AB 2010. All Rights Reserved. +> +> The contents of this file are subject to the Erlang Public License, +> Version 1.1, (the "License"); you may not use this file except in +> compliance with the License. You should have received a copy of the +> Erlang Public License along with this software. If not, it can be +> retrieved online at http://www.erlang.org/. +> +> Software distributed under the License is distributed on an "AS IS" +> basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +> the License for the specific language governing rights and limitations +> under the License. +> +> %CopyrightEnd% + + + + [1]: http://www.erlang.org + [2]: http://wiki.github.com/erlang/otp/submitting-patches + [3]: http://www.erlang.org/faq.html diff --git a/README.win32 b/README.win32 deleted file mode 100644 index 6fd14b23dc..0000000000 --- a/README.win32 +++ /dev/null @@ -1,763 +0,0 @@ -How to build Erlang/OTP on Windows. ------------------------------------ -Table of contents - -1. Introduction -2. Answers to some "frequently asked questions" -3. Tools you need and their environment -4. The shell environment -5. Building and installing -6. Development -7. Final words - -%CopyrightBegin% - -Copyright Ericsson AB 2003-2009. All Rights Reserved. - -The contents of this file are subject to the Erlang Public License, -Version 1.1, (the "License"); you may not use this file except in -compliance with the License. You should have received a copy of the -Erlang Public License along with this software. If not, it can be -retrieved online at http://www.erlang.org/. - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -the License for the specific language governing rights and limitations -under the License. - -%CopyrightEnd% - - - -Introduction ------------- - -This file describes how to build the Erlang emulator and the OTP -libraries on Windows. The instructions apply to versions of Windows -supporting the Cygwin emulated gnuish environment for Windows. We've -built on the following platforms: Windows 2000 Professional, Windows -2003 server, Windows XP Home/Professional, and Windows Vista. Any -Windows95'ish platform will surely get you into trouble, what I'm not -sure of, but it certainly will... - -The procedure described uses Cygwin as a build environment, you run -the bash shell in Cygwin and uses gnu make/configure/autoconf etc to -do the build. The emulator C-source code is, however, mostly compiled -with Microsoft Visual C++(tm), producing a native Windows binary. This -is the same procedure as we use to build the pre-built binaries. The -fact that we use VC++ and not gcc is explained further in the FAQ -section. - -I describe the build procedure to make it possible for open source -customers to build the emulator, given that they have the needed -tools. The binary Windows releases is still a preferred alternative if -one does not have Microsoft's development tools and/or don't want to -install Cygwin. - -To use Cygwin, one needs basic experience from a Unix environment, if -one does not know how to set environment variables, run programs etc -in a Unix environment, one will be quite lost in the Cygwin -ditto. I can unfortunately not teach all the world how to use -Cygwin and bash, neither how to install Cygwin nor perform basic tasks -on a computer. Please refer to other documentation on the net for -help, or use the binary release instead if you have problems using the -tools. - -However, if you feel comfortable with the environment and build -system, and have all the necessary tools, you have a great opportunity -to make the Erlang/OTP distribution for Windows better. Please submit -any suggestions and patches to the appropriate mailing lists (see -http://www.erlang.org) to let them find their way into the next -version of Erlang. If making changes to the build system (like -makefiles etc) please bear in mind that the same makefiles are used on -Unix/VxWorks/OSEDelta, so that your changes don't break other -platforms. That of course goes for C-code too, system specific code -resides in the $ERL_TOP/erts/emulator/sys/win32 and $ERL_TOP/erts/etc/win32 -directories mostly. The $ERL_TOP/erts/emulator/beam directory is for -common code. - -Before the R9C release of Erlang/OTP, the Windows release was built -partly on a Unix (Solaris) box and partly on a Windows box, using Perl -hacks to communicate and sync between the two machines. R9C was the -first release ever built solely on Windows, where no Unix machine is -needed at all. Now we've used this build procedure for a couple of -releases, and it has worked fine for us. Still, there might be all -sorts of troubles on different machines and with different -setups. I'll try to give hints wherever I've encountered difficulties, -but please share your experiences by using the mailing list [email protected]. I cannot of course help everyone with all -their problems, please try to solve the problems and submit -solutions/workarounds. Remember, it's all about sharing, not about -demanding... - -Lets go then, I'll start with a little FAQ, based on in house questions -and misunderstandings. - - -Answers to "frequently asked questions" ---------------------------------------- - -Q: So, now I can build Erlang using GCC on Windows? - -A: No, unfortunately not. You'll need Microsoft's Visual C++ still, a -Bourne-shell script (cc.sh) wraps the Visual C++ compiler and runs it -from within the Cygwin environment. All other tools needed to build -Erlang are free-ware/open source, but not the C compiler. - -Q: Why haven't you got rid of VC++ then, you ****** - -A: Well, partly because it's a good compiler - really! Actually it's -been possible in late R11-releases to build using mingw instead of -visual C++ (you might see the remnants of that in some scripts and -directories). Unfortunately the development of the SMP version for -Windows broke the mingw build and we chose to focus on the VC++ build -as the performance has been much better in the VC++ versions. The -mingw build will be back, but as long as VC++ gives better -performance, the commercial build will be a VC++ one. - -Q: OK, VC++ you need, but now you've started to demand a very recent -(and expensive) version of Visual studio, not the old and stable VC++ -6.0 that was used in earlier versions. Why? - -A: The SMP version of Erlang needs features in the Visual Studio -2005. Can't live without them. Besides the new compiler gives the -Erlang emulator a ~40% performance boost(!) - -Q: Can/will I build a Cygwin binary with the procedure you describe? - -A: No, the result will be a pure Windows binary, and as far as I know, -it's not possible to make a Cygwin binary yet. That is of course -something desirable, but there are still some problems with the -dynamic linking (dynamic Erlang driver loading) as well as the TCP/IP -emulation in Cygwin, which, I'm sure of, will improve, but still has -some problems. Fixing those problems might be easy or might be hard. -I suggest you try yourself and share your experience. No one would be -happier if a simple ./configure && make would produce a fully fledged -Cygwin binary. Ericsson does however not pay me to do a Cygwin port, so -such a port would have to happen in spare time, which is a limited resource... - -Q: Hah, I saw you, you used GCC even though you said you didn't! - -A: OK, I admit, one of the files is compiled using Cygwin's GCC and -the resulting object code is then converted to MS VC++ compatible coff -using a small C hack. It's because that particular file, beam_emu.c -benefits immensely from being able to use the GCC labels-as-values -extension, which boosts emulator performance by up to 50%. That does -unfortunately not (yet) mean that all of OTP could be compiled using -GCC, that particular source code does not do anything system specific -and actually is adopted to the fact that GCC is used to compile it on -Windows. - -Q: So now there's a MS VC++ project file somewhere and I can build OTP -using the nifty VC++ GUI! - -A: No, never. The hassle of keeping the project files up to date and -do all the steps that constitute an OTP build from within the VC++ GUI -is simply not worth it, maybe even impossible. A VC++ project -file for Erlang/OTP will never happen, at least I will never make -one. Clicking around in super-multi-tab'd dialogs to add a file or -compiler option when it's so much easier in a makefile is simply not -my style. - -Q: So how does it all work then? - -A: Cygwin is the environment, which closely resembles the environments -found on any Unix machine. It's almost like you had a virtual Unix -machine inside Windows. Configure, given certain parameters, then -creates makefiles that are used by the Cygwin gnu-make to built the -system. Most of the actual compilers etc are not, however, Cygwin -tools, so I've written a couple of wrappers (Bourne-shell scripts), -which reside in $ERL_TOP/etc/win32/cygwin_tools and they all do -conversion of parameters and switches common in the Unix environment -to fit the native Windows tools. Most notable is of course the paths, -which in Cygwin are Unix-like paths with "forward slashes" (/) and no -drive letters, the Cygwin specific command 'cygpath' is used for most -of the path conversions. Luckily most compilers accept forward slashes -instead of backslashes as path separators, one still have to get the -drive letters etc right, though. The wrapper scripts are not general -in the sense that, for example, cc.sh would understand and translates -every possible gcc option and passes correct options to cl.exe. The -principle is that the scripts are powerful enough to allow building of -Erlang/OTP, no more, no less. They might need extensions to cope with -changes during the development of Erlang, that's one of the reasons I -made them into shell-scripts and not Perl-scripts, I believe they are -easier to understand and change that way. I might be wrong though, -cause another reason I didn't write them in Perl is because I've never -liked Perl and my Perl code is no pleasant reading... - -In $ERL_TOP, there is a script called otp_build, that script handles -the hassle of giving all the right parameters to configure/make and -also helps you set up the correct environment variables to work with -the Erlang source under Cygwin. - -Q: You use and need Cygwin, but then you haven't taken the time to -port Erlang to the Cygwin environment but instead focus on your -commercial release, is that really ethical? - -A: No, not really, but see this as a step in the right direction. I'm -aiming at GCC compiled emulators and a Cygwin version, but I really -need to do other things as well... In time, but don't hold your -breath... - -Q: Can I build something that looks exactly as the commercial release. - -A: Yes, we use the exactly same build procedure. - -Q: Which version of Cygwin and other tools do you use then? - -A: For Cygwin we try to use the latest releases available when -building. What versions you use shouldn't really matter, I try to -include workarounds for the bugs I've found in different Cygwin -releases, please help me to add workarounds for new Cygwin-related -bugs as soon as you encounter them. Also please do submit bug reports -to the appropriate Cygwin developers. The Cygwin GCC we used for R13B -was version 3.4.4. We used VC++ 8.0 (i.e. Visual studio 2005 SP1), -Sun's JDK 1.5.0_17, NSIS 2.37, and Win32 OpenSSL 0.9.8e. Please read -the next section for details on what you need. - -Q: Can you help me setup X in Cygwin? - -A: No, unfortunately I haven't got time to help with Cygwin related -user problems, please read Cygwin related web sites, newsgroups and -mailing lists. - -Q: Why is the instruction so long? Is it really that complicated? - -A: Partly it's long because I babble too much, partly because I've -described as much as I could about the installation of the needed -tools. Once the tools are installed, building is quite easy. I also -have tried to make this instruction understandable for people with -limited Unix experience. Cygwin is a whole new environment to some -Windows users, why careful explanation of environment variables etc -seemed to be in place. The short story, for the experienced and -impatient is: - -* Get and install complete Cygwin (latest) -* (Buy and) Install Microsoft Visual studio 2005 and SP1 (or higher) -* Get and install Sun's JDK 1.4.2 -* Get and install NSIS 2.01 or higher (up to 2.30 tried and working) -* Get and install OpenSSL 0.9.7c or higher -* Get and unpack wxWidgets-2.8.9 or higher to /opt/local/pgm inside cygwin - - open /cygwin/opt/local/pgm/wxWidgets-2.8.9/build/msw/wx.dsw - - enable wxUSE_GLCANVAS, wxUSE_POSTSCRIPT and wxUSE_GRAPHICS_CONTEXT - in include/wx/msw/setup.h - - build all unicode release (and unicode debug) packages - - open /cygwin/opt/local/pgm/wxWidgets-2.8.9/contrib/build/stc/stc.dsw - - build the unicode release (and unicode debug) packages -* Get and unpack the erlang source distribution with Cygwin's tar. -* set ERL_TOP to where you unpacked the source distribution -* $ cd $ERL_TOP -* Get (from http://www.erlang.org/download/tcltk85_win32_bin.tar.gz) -and unpack the prebuilt TCL/TK binaries for windows with cygwin tar, -standing in $ERL_TOP -* Modify PATH and other environment variables so that all these tools -are runnable from a bash shell. Still standing in $ERL_TOP, issue the following -commands: -$ eval `./otp_build env_win32` -$ ./otp_build autoconf -$ ./otp_build configure -$ ./otp_build boot -a -$ ./otp_build release -a -$ ./otp_build installer_win32 -$ release/win32/otp_win32_<OTP version> /S - -Voila! "Start->Programs->Erlang OTP <OTP version>->Erlang" starts the Erlang -Windows shell. - - -Tools you need and their environment ------------------------------------- - -You need some tools to be able to build Erlang/OTP on Windows. Most -notably you'll need Cygwin and Microsoft VC++, but you also might want -a Java compiler, the NSIS install system and OpenSSL. Only VC++ costs -money, but then again it costs a lot of money, I know... -Well' here's the list: - -* Cygwin, the very latest is usually best. Get all the development -tools and of course all the basic ditto. In fact getting the complete -package might be a good idea, as you'll start to love Cygwin after a -while if you're accustomed to Unix. Make sure to get jar and also make -sure *not* to install a Cygwin'ish Java... The Cygwin jar command is -used but Sun's Java compiler and virtual machine... - -URL: http://www.cygwin.com - -- get the installer from the web site and use that to install -Cygwin. Be sure to have fair privileges. If you're on a NT domain you -should consider running "mkpasswd -d" and "mkgroup -d" after the -installation to get the user databases correct. See their respective -manual pages. - -When you start you first bash shell, you will get an awful prompt. You -might also have a PATH environment variable that contains backslashes -and such. Edit $HOME/.profile and $HOME/.bashrc to set fair prompts -and set a correct PATH. Also do a "export SHELL" in .profile. For some -non-obvious reason the environment variable $SHELL is not exported in -bash. Also note that .profile is run at login time and .bashrc when -sub shells are created. You'll need to explicitly source .bashrc from -.profile if you want the commands there to be run at login time (like -setting up aliases, shell functions and the like). I personally -usually do like this at the end of .profile: ------------------- -ENV=$HOME/.bashrc -export ENV -. $ENV ----------------- - -You might also, if you're a hard core type of person at least, want to -setup X-windows (XFree86), that might be as easy as running startx -from the command prompt and it might be much harder. Use Google to -find help... - -If you don't use X-windows, you might want to setup the Windows -console window by selecting properties in the console system menu -(upper left corner of the window, the Cygwin icon in the title -bar). Especially setting a larger screen buffer size (lines) is useful -as it gets you a scrollbar so you can see whatever error messages -that might appear... - -If you want to use (t)csh instead of bash you're on your own, I -haven't tried and know of no one that has. I expect -that you use bash in all shell examples. - -* Microsoft Visual Studio 2005 SP1. Please don't skip the service -pack! The installer might update your environment so that you can run -the 'cl' command from the bash prompt, then again it might -not... There is always a BAT file in VC\Bin under the installation -directory (default C:\Program Files\Microsoft Visual Studio 8) called -VCVARS32.BAT. Either add the environment settings in that file to the -global environment settings in Windows or add the corresponding BASH -environment settings to your .profile/.bashrc. For example, in my case -I could add the following to .profile ------------------------------------------------------------- -#Visual C++ Root directory as Cygwin style pathname -VCROOT=/cygdrive/c/Program\ Files/Microsoft\ Visual\ Studio 8 - -# Visual C++ Root directory as Windows style pathname -WIN_VCROOT="C:\\Program Files\\Microsoft Visual Studio 8" - -# The PATH variable should be Cygwin'ish -PATH=$VCROOT/Common7/IDE:$VCROOT/VC/BIN:$VCROOT/Common7/Tools:\ -$VCROOT/Common7/Tools/bin:$VCROOT/VC/PlatformSDK/bin:$VCROOT/SDK/v2.0/bin:\ -$VCROOT/VC/VCPackages:$PATH - -# Lib and INCLUDE should be Windows'ish -# Note that semicolon (;) is used to separate Windows style paths but -# colon (:) to separate Cygwin ditto! - -LIBPATH=$WIN_VCROOT\\VC\\ATLMFC\\LIB - -LIB=$WIN_VCROOT\\VC\\ATLMFC\\LIB\;$WIN_VCROOT\\VC\\LIB\;\ -$WIN_VCROOT\\VC\\PlatformSDK\\lib\;$WIN_VCROOT\\SDK\\v2.0\\lib - -INCLUDE=$WIN_VCROOT\\VC\\ATLMFC\\INCLUDE\;$WIN_VCROOT\\VC\\INCLUDE\;\ -$WIN_VCROOT\\VC\\PlatformSDK\\include - -export PATH LIB INCLUDE --------------------------------------------------------------- - -Make a simple hello world and try to compile it with the 'cl' command -from within bash. If that does not work, your environment needs -fixing. Also remember to fix up the PATH environment, especially old -Erlang installations might have inserted quoted paths that Cygwin does -not understand. Remove or correct such paths. There should be no -backslashes in your path environment variable in Cygwin bash, but LIB -and INCLUDE should contain Windows style paths with semicolon, -drive letters and backslashes. - -If you wish to use Visual Studio 2008, a couple things need to be tweaked, -namely the fact that some of the SDK stuff is installed in (by default) -C:\Program Files\Microsoft SDKs\v6.0A . Just ensure that that -C:\Program Files\Microsoft SDKs\v6.0A\Lib is in LIB and -C:\Program Files\Microsoft SDKs\v6.0A\Include is in INCLUDE. A symptom of not -doing this is errors about finding kernel32.lib and windows.h. - -Additionally, if you encounter errors about mc.exe not being found, you must -install the entire Windows SDK (the partial SDK included in visual studio -apparently does not include it). After installing it you'll want to add -something like: /c/cygdrive/Program\ Files/Microsoft\ SDKs/v7.0/bin to your -PATH to allow the environment to find mc.exe. The next Visual Studio (2010) is -expected to include this tool. - -* Sun's Java JDK 1.5.0 or higher. Our Java code (jinterface, ic) is -written for JDK 1.5.0. Get it for Windows and install it, the JRE is -not enough. If you don't care about Java, you can skip this step, the -result will be that jinterface is not built. - -URL: http://java.sun.com - -Add javac *LAST* to your path environment in bash, in my case this means: --------------------------------------------------------------- -PATH="$PATH:/cygdrive/c/Program Files/Java/jdk1.5.0_17/bin" --------------------------------------------------------------- -No CLASSPATH or anything is needed. Type "javac" at the bash prompt -and you should get a list of available Java options. Make sure by -typing "which java" that you use the Java you installed. Note however that -Cygwin's jar.exe is used, that's why the JDK bin-directory should be -added last in the PATH. - -* Nullsoft NSIS installer system. You need this to build the self -installing package. It's a free open source installer that's much -nicer to use than the commercial Wise and Install shield -installers. This is the installer we use for commercial releases as -well from R9C an on. -URL: http://www.nullsoft.com/free/nsis -Install the lot, especially the modern user interface components, as -it's definitely needed. Put "makensis" in your path, in my case: --------------------------------------------------------------- -PATH=/cygdrive/c/Program\ Files/NSIS:$PATH --------------------------------------------------------------- -type makensis at the bash prompt and you should get a list of options -if everything is OK. - -* OpenSSL for Windows. This is if you want the SSL and crypto -applications to compile (and run). Go to http://www.openssl.org, click -on the "Related" link and then on the "Binaries" link (upper right -corner of the page last time I looked), you can then reach the -"Shining Lights Productions" Web site for Windows binaries -distributions. Get the latest or 0.9.7c if you get trouble with the -latest. It's a nifty installer. The rest should be handled by -configure, you needn't put anything in the path or anything. - -If you want to build openssl for windows yourself (which might be -possible, as you wouldn't be reading this if you weren't a -compile-it-yourself person), you either have to put the resulting -DLL's in your path or in the windows system directory and either -specify where you put the includes etc with the configure-parameter ---with-ssl=<cygwin path to the root> or put your installation directly -under c:\OpenSSL. The directory structure under the installation root -for OpenSSL is expected to be one with subdirectories named "include", -"bin" and "lib", possibly with a "VC" subdirectory of "lib" containing -the actual .lib files. Note that the cygwin distributed OpenSSL cannot be -used, it results in cygwin depending binaries and it has unix style -archives (.a, not .lib). - -* Building with wxWidgets. Download wxWidgets-2.8.9 or higher patch -release (2.9.* is a developer release which currently does not work -with wxErlang). -Install or unpack it to DRIVE:/PATH/cygwin/opt/local/pgm -Open from explorer (i.e. by double clicking the file) -C:\cygwin\opt\local\pgm\wxMSW-2.8.10\build\msw\wx.dsw -In Microsoft Visual Studio, click File/Open/File, locate and -open: C:\cygwin\opt\local\pgm\wxMSW-2.8.10\include\wx\msw\setup.h -enable wxUSE_GLCANVAS, wxUSE_POSTSCRIPT and wxUSE_GRAPHICS_CONTEXT -Build it by clicking Build/Batch Build and select all unicode release -(and unicode debug) packages. -Open C:\cygwin\opt\local\pgm\wxMSW-2.8.10\contrib/build/stc/stc.dsw -and batch build all unicode packages. - -* The Erlang source distribution. The same as for Unix -platforms. Preferably use tar from within Cygwin to unpack the source -tar.gz (tar zxf otp_src_R13B03.tar.gz). - -set the environment ERL_TOP to point to the root directory of the -source distribution. Let's say I stood in $HOME/src and unpacked -otp_src_R13B03.tar.gz, I then add the following to .profile: --------------------------------------------------------- -ERL_TOP=$HOME/src/otp_src_R13B03 -export $ERL_TOP --------------------------------------------------------- - -* The TCL/TK binaries. You could compile Tcl/Tk for windows yourself, -but you can get a stripped down version from our website which is -suitable to include in the final binary package. If you want to supply -tcl/tk yourself, read the instructions about how the tcl/tk tar file -used in the build is constructed under $ERL_TOP/lib/gs/tcl. The easy -way is to download -http://www.erlang.org/download/tcltk85_win32_bin.tar.gz and unpack it -standing in the $ERL_TOP directory. This will create the file -win32.tar.gz in $ERL_TOP/lib/gs/tcl/binaries. - -One last alternative is to create a file named 'SKIP' in the -$ERL_TOP/lib/gs/ after configure is run, but that will give you an -erlang system without gs (which might be okay as you probably will use -wx anyway). - -The shell environment ---------------------- - -So, if you have followed the instructions above, when you start a bash -shell, you should have an INCLUDE environment with a Windows style -path, a LIB environment variable also in Windows style, and finally a -PATH that let's you reach cl, makensis, javac etc from the -command prompt (use "which cl" etc to verify from bash). - -You should also have an ERL_TOP environment variable that is *Cygwin -style*, and points to a directory containing, among other files, the -script "otp_build". - -A final massage of the environment is needed, and that is done by -the script $ERL_TOP/otp_build. Start bash and do the following, note -the "back-ticks" (`), can be quite hard to get on some keyboards, but -pressing the back-tick key followed by the space bar might do it... - ------------------------- -$ cd $ERL_TOP -$ eval `./otp_build env_win32` ------------------------- -If you're unable to produce back-ticks on your keyboard, you can use -the ksh variant: ------------------------- -$ cd $ERL_TOP -$ eval $(./otp_build env_win32) ------------------------- - -This should do the final touch to the environment and building should -be easy after this. You could run "./otp_build env_win32" without -"eval" just to see what it does, and to see that the environment it -sets seems OK. The path is cleaned of spaces if possible (using DOS -style short names instead), the variables OVERRIDE_TARGET, CC, CXX, AR -and RANLIB are set to their respective wrappers and the directories -$ERL_TOP/erts/etc/win32/cygwin_tools/vc and -$ERL_TOP/erts/etc/win32/cygwin_tool are added first in the PATH. - -Try now a "which erlc". That should result in the erlc wrapper script -(which does not have the .sh extension, for reasons best kept -untold...). It should reside in $ERL_TOP/erts/etc/win32/cygwin_tools. -You could also try "which cc.sh", which "ar.sh" etc. - -Now you're ready to build... - - -Building and installing ------------------------ -Now it's assumed that you have executed "eval `./otp_build env_win32`" -for this particular shell... - -Building is easiest using the otp_build script. That script takes care -of running configure, bootstrapping etc on Windows in a simple -way. The otp_build script is the utility we use ourselves to build on -different platforms and it therefore contains code for all sorts of -platforms. The principle is, however, that for non-Unix platforms, one -uses "./otp_build env_<target>" to set up environment and then the -script knows how to build on the platform "by itself". You've already -run "./otp_build env_win32" in the step above, so now it's mostly like -we build on any platform. OK, here are then steps; Assuming you will -want to build a full installation executable with NSIS, you can omit -<installation directory> and the release will be copied to -$ERL_TOP/release/win32: and there is where the packed self installing -executable will reside too. - -$ ./otp_build autoconf # Ignore the warning blob about versions of autoconf -$ ./otp_build configure <optional configure options> -$ ./otp_build boot -a -$ ./otp_build release -a <installation directory> -$ ./otp_build installer_win32 <installation directory> # optional - -Now you will have a file called otp_win32_R12B.exe in the <installation -directory>, i.e. $ERL_TOP/release/win32. - -Lets get into more detail: - -$ ./otp_build autoconf - This step rebuilds the configure scripts to -work correctly in the cygwin environment. In an ideal world, this -would not be needed, but alas, we have encountered several -incompatibilities between our distributed configure scripts (generated -on a Linux platform) and the cygwin environment over the -years. Running autoconf on cygwin ensures that the configure scripts -are generated in a cygwin-compatible way and that they will work well -in the next step. - -$ ./otp_build configure - This runs the newly generated configure scripts -with options making configure behave nicely. The target machine type is -plainly "win32", so a lot of the configure-scripts recognize this -awkward target name and behave accordingly. The CC variable also makes -the compiler be cc.sh, which wraps MSVC++, so all configure tests -regarding the C compiler gets to run the right compiler. A lot of the -tests are not needed on Windows, but I thought it best to run the -whole configure anyway. The only configure option you might want to -supply is --with-ssl, which might be needed if you have built your own -openssl distribution. The Shining Lights distribution should be found -automatically by configure, if that fails, add a --with-ssl=<dir> that -specifies the root directory of your OpenSSL installation. - -$ ./otp_build boot -a - This uses the bootstrap directory (shipped -with the source, $ERL_TOP/bootstrap) to build a complete OTP -system. It first builds an emulator and sets up a minimal OTP system -under $ERL_TOP/bootstrap, then starts to compile the different OTP -compilers to make the $ERL_TOP/bootstrap system potent enough to be -able to compile all Erlang code in OTP. Then, all Erlang and C code -under $ERL_TOP/lib is built using the bootstrap system, giving a -complete OTP system (although not installed). When this is done, one -can run Erlang from within the source tree, just type $ERL_TOP/bin/erl -and you should have a prompt. If you omit the -a flag, you'll get a -smaller system, that might be useful during development. Now -exit from Erlang and start making a release of the thing: - -$ ./otp_build release -a - Builds a commercial release tree from the -source tree, default is to put it in $ERL_TOP/release/win32, you can -give any directory as parameter (Cygwin style), but it doesn't really matter -if you're going to build a self extracting installer too. You could of -course build release to the final directory and then run ./Install.exe -standing in the directory where the release was put, that will create -a fully functional OTP installation. But let's make the nifty -installer: - -$ ./otp_build installer_win32 - Create the self extracting installer -executable. The executable otp_win32_<OTP version>.exe will be placed -in the top directory of the release created in the previous step. If -no release directory is specified, the release is expected to have -been built to $ERL_TOP/release/win32, which also will be the place -where the installer executable will be placed. If you specified some -other directory for the release (i.e. -./otp_build release -a /tmp/erl_release), you're expected to give the -same parameter here, (i.e. ./otp_build installer_win32 /tmp/erl_release). -You need to have a full NSIS installation and makensis.exe in your -path for this to work of course. Once you have created the installer, -you can run it to install Erlang/OTP in the regular way, just run the -executable and follow the steps in the installation wizard. To get all -default settings in the installation without any questions asked, you -run the executable with the parameter "/S" (capital S). like in: ------------------------------------------------------- -$ cd $ERL_TOP -$ release/win32/otp_win32_R13B03 /S -..... ------------------------------------------------------- -- and after a while Erlang will have been installed in -C:\Program Files\erl5.7.4, with shortcuts in the menu etc. - -*NOTE* Beginning with R9C, the Windows installer does *not* add Erlang -to the system wide path. If one wants to have Erlang in the path, one -has to add it by hand. - -The necessary setup of an Erlang installation is actually done by the -program Install.exe, which resides in the release top. That program -creates ".ini-files" and copies the correct boot scripts. If one has -the correct directory tree (like after a ./otp_build release -a), only -the running of Install.exe is necessary to get a fully functional -OTP. What the self extracting installer adds is (of course) the -possibility to distribute the binary easily, together with adding -shortcuts to the Windows start menu. There is also some adding of -entries in the registry, to associate .erl and .beam files with Erlang -and get nifty icons, but that's not something you'll really need to -run Erlang. The registry is also used to store uninstall information, -but if one has not used the self extracting installer, one cannot -(need not) do any uninstall, one just scratches the release directory -and everything is gone. Erlang/OTP does not *need* to put anything -in the Windows registry at all, and does not if you don't use the self -extracting installer. In other words the installer is pure cosmetics. - - -Development ------------ - -Once the system is built, you might want to change it. Having a test -release in some nice directory might be useful, but you also can run -Erlang from within the source tree. The target 'local_setup', makes -the program $ERL_TOP/bin/erl.exe usable and it also uses all the OTP -libraries in the source tree. - -If you hack the emulator, you can then build the emulator executable -by standing in $ERL_TOP/erts/emulator and do a simple - -$ make opt - -Note that you need to have run (cd $ERL_TOP && eval `./otp_build env_win32`) -in the particular shell before building anything on Windows. After -doing a make opt you can test your result by running $ERL_TOP/bin/erl. -If you want to copy the result to a release directory (say -/tmp/erl_release), you do this (still in $ERL_TOP/erts/emulator) - -$ make TESTROOT=/tmp/erl_release release - -That will copy the emulator executables. - -To make a debug build of the emulator, you need to recompile both -beam.dll (the actual runtime system) and erlexec.dll. Do like this - -$ cd $ERL_TOP -$ rm bin/win32/erlexec.dll -$ cd erts/emulator -$ make debug -$ cd ../etc -$ make debug - -- and sometimes - -$ cd $ERL_TOP -$ make local_setup - -So now when you run $ERL_TOP/erl.exe, you should have a debug compiled -emulator, which you will see if you do a: - -1> erlang:system_info(system_version). - -- in the erlang shell. If the returned string contains "[debug]", you -got a debug compiled emulator. - -To hack the erlang libraries, you simply do a "make opt" in the -specific "applications" directory, like: - -$ cd $ERL_TOP/lib/stdlib -$ make opt - -- or even in the source directory... - -$ cd $ERL_TOP/lib/stdlib/src -$ make opt - -Note that you're expected o have a fresh Erlang in your path when -doing this, preferably the plain R13B03 you have built in the previous -steps. You could also add $ERL_TOP/bootstrap/bin to your PATH before -rebuilding specific libraries, that would give you a good enough -Erlang system to compile any OTP erlang code. Setting up the path -correctly is a little bit tricky, you still need to have -$ERL_TOP/erts/etc/win32/cygwin_tools/vc and -$ERL_TOP/erts/etc/win32/cygwin_tools *before* the actual emulator -in the path. A typical setting of the path for using the bootstrap -compiler would be: - -$ export PATH=$ERL_TOP/erts/etc/win32/cygwin_tools/vc:$ERL_TOP/erts/etc/win32/cygwin_tools:$ERL_TOP/bootstrap/bin:$PATH - -That should make it possible to rebuild any library without hassle... - -If you want to copy a library (an application) newly built, to a -release area, you do like with the emulator: - -$ cd $ERL_TOP/lib/stdlib -$ make TESTROOT=/tmp/erlang_release release - -Remember that: - -- Windows specific C-code goes in the -$ERL_TOP/erts/emulator/sys/win32, $ERL_TOP/erts/emulator/drivers/win32 -or $ERL_TOP/erts/etc/win32. - -- Windows specific erlang code should be used conditionally and the -host OS tested in *runtime*, the exactly same beam files should be -distributed for every platform! So write code like: - -case os:type() of - {win32,_} -> - do_windows_specific(); - Other -> - do_fallback_or_exit() -end, - -That's basically all you need to get going. - -Final words ------------ -My hope is that the possibility to build the whole system on Windows -will open up for free development on this platform too. There are many -things one might want to do better in the Windows version, like the -window-style command prompt as well as pure Cygwin porting. Although i -realize it's a much larger step to start building on Windows (with all -the software you need) than for instance on Linux, I sincerely hope -that some of you will make the effort and start submitting Windows -friendly patches. - -The first build system for Erlang using Cygwin on Windows was created -by Per Bergkvist. I haven't used his build system, but it's rumored to -be good. The idea to do this came from his work, so credit is well -deserved. - -Of course this would have been completely impossible without the -excellent Cygwin package. The guys at Cygnus solutions and Redhat -deserves a huge THANKS! as well as all the other people in the free -software community who have helped in creating the magnificent -software that constitutes Cygwin. - -Good luck and Happy Hacking, -Patrik, OTP diff --git a/TAR.include b/TAR.include index 78be579869..27b10d6243 100644 --- a/TAR.include +++ b/TAR.include @@ -1,8 +1,10 @@ AUTHORS EPLICENCE Makefile.in -README -README.win32 +README.md +INSTALL.md +INSTALL-CROSS.md +INSTALL-WIN32.md configure.in aclocal.m4 otp_build diff --git a/erts/aclocal.m4 b/erts/aclocal.m4 index 8052b2d67d..3d935b7295 100644 --- a/erts/aclocal.m4 +++ b/erts/aclocal.m4 @@ -826,8 +826,11 @@ case "$THR_LIB_NAME" in AC_CHECK_FUNC(pthread_spin_lock, \ AC_DEFINE(ETHR_HAVE_PTHREAD_SPIN_LOCK, 1, \ [Define if you have the pthread_spin_lock function.])) + test "$force_linux_pthread_rwlocks" = "yes" || { + force_linux_pthread_rwlocks=no + } case "$force_linux_pthread_rwlocks-$host_os" in - yes-linux*) # Writers may get starved + no-linux*) # Writers may get starved # TODO: write a test that tests the implementation ;; *) diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml index 7a2ab375d1..bb741c7836 100644 --- a/erts/doc/src/erl.xml +++ b/erts/doc/src/erl.xml @@ -131,9 +131,8 @@ see <seealso marker="kernel:app">app(4)</seealso> and <seealso marker="kernel:application">application(3)</seealso>.</p> </item> - <tag><c><![CDATA[-args_file FileName]]></c></tag> + <tag><marker id="args_file"><c><![CDATA[-args_file FileName]]></c></marker></tag> <item> - <marker id="args_file"></marker> <p>Command line arguments are read from the file <c><![CDATA[FileName]]></c>. The arguments read from the file replace the '<c><![CDATA[-args_file FileName]]></c>' flag on the resulting command line.</p> @@ -197,9 +196,8 @@ <seealso marker="kernel:app">app(4)</seealso> and <seealso marker="kernel:application">application(3)</seealso>.</p> </item> - <tag><c><![CDATA[-connect_all false]]></c></tag> + <tag><marker id="connect_all"><c><![CDATA[-connect_all false]]></c></marker></tag> <item> - <marker id="connect_all"></marker> <p>If this flag is present, <c><![CDATA[global]]></c> will not maintain a fully connected network of distributed Erlang nodes, and then global name registration cannot be used. See @@ -282,9 +280,8 @@ <p>Makes <c><![CDATA[init]]></c> write some debug information while interpreting the boot script.</p> </item> - <tag><c><![CDATA[-instr]]></c>(emulator flag)</tag> + <tag><marker id="instr"><c><![CDATA[-instr]]></c>(emulator flag)</marker></tag> <item> - <marker id="instr"></marker> <p>Selects an instrumented Erlang runtime system (virtual machine) to run, instead of the ordinary one. When running an instrumented runtime system, some resource usage data can be @@ -431,9 +428,8 @@ flag and those running with the <c><![CDATA[-name]]></c> flag, as node names must be unique in distributed Erlang systems.</p> </item> - <tag><c><![CDATA[-smp [enable|auto|disable]]]></c></tag> + <tag><marker id="smp"><c><![CDATA[-smp [enable|auto|disable]]]></c></marker></tag> <item> - <marker id="smp"></marker> <p><c>-smp enable</c> and <c>-smp</c> starts the Erlang runtime system with SMP support enabled. This may fail if no runtime system with SMP support is available. <c>-smp auto</c> starts @@ -462,9 +458,8 @@ <p><c><![CDATA[erl]]></c> invokes the code for the Erlang emulator (virtual machine), which supports the following flags:</p> <taglist> - <tag><c><![CDATA[+a size]]></c></tag> + <tag><marker id="async_thread_stack_size"><c><![CDATA[+a size]]></c></marker></tag> <item> - <marker id="async_thread_stack_size"></marker> <p>Suggested stack size, in kilowords, for threads in the async-thread pool. Valid range is 16-8192 kilowords. The default suggested stack size is 16 kilowords, i.e, 64 @@ -478,9 +473,8 @@ suggestion, and it might even be ignored on some platforms.</p> </item> - <tag><c><![CDATA[+A size]]></c></tag> + <tag><marker id="async_thread_pool_size"><c><![CDATA[+A size]]></c></marker></tag> <item> - <marker id="async_thread_pool_size"></marker> <p>Sets the number of threads in async thread pool, valid range is 0-1024. Default is 0.</p> </item> @@ -550,23 +544,20 @@ <p>Enables auto load tracing, displaying info while loading code.</p> </item> - <tag><c><![CDATA[+MFlag Value]]></c></tag> + <tag><marker id="erts_alloc"><c><![CDATA[+MFlag Value]]></c></marker></tag> <item> - <marker id="erts_alloc"></marker> <p>Memory allocator specific flags, see <seealso marker="erts_alloc">erts_alloc(3)</seealso> for further information.</p> </item> - <tag><c><![CDATA[+P Number]]></c></tag> + <tag><marker id="max_processes"><c><![CDATA[+P Number]]></c></marker></tag> <item> - <marker id="max_processes"></marker> <p>Sets the maximum number of concurrent processes for this system. <c><![CDATA[Number]]></c> must be in the range 16..134217727. Default is 32768.</p> </item> - <tag><c><![CDATA[+R ReleaseNumber]]></c></tag> + <tag><marker id="compat_rel"><c><![CDATA[+R ReleaseNumber]]></c></marker></tag> <item> - <marker id="compat_rel"></marker> <p>Sets the compatibility mode.</p> <p>The distribution mechanism is not backwards compatible by default. This flags sets the emulator in compatibility mode @@ -592,9 +583,8 @@ <item> <p>Force ets memory block to be moved on realloc.</p> </item> - <tag><c><![CDATA[+S Schedulers:SchedulerOnline]]></c></tag> + <tag><marker id="+S"><c><![CDATA[+S Schedulers:SchedulerOnline]]></c></marker></tag> <item> - <marker id="+S"></marker> <p>Sets the amount of scheduler threads to create and scheduler threads to set online when SMP support has been enabled. Valid range for both values are 1-1024. If the @@ -615,9 +605,8 @@ <item> <p>Scheduling specific flags.</p> <taglist> - <tag>+sbt BindType</tag> + <tag><marker id="+sbt"><c>+sbt BindType</c></marker></tag> <item> - <marker id="+sbt"></marker> <p>Set scheduler bind type. Currently valid <c>BindType</c>s: </p> <taglist> @@ -672,9 +661,8 @@ <seealso marker="erlang#system_flag_scheduler_bind_type">erlang:system_flag(scheduler_bind_type, SchedulerBindType)</seealso>. </p> </item> - <tag><c>+sct CpuTopology</c></tag> + <tag><marker id="+sct"><c>+sct CpuTopology</c></marker></tag> <item> - <marker id="+sct"></marker> <list type="bulleted"> <item><c><![CDATA[<Id> = integer(); when 0 =< <Id> =< 65535]]></c></item> <item><c><![CDATA[<IdRange> = <Id>-<Id>]]></c></item> @@ -791,21 +779,18 @@ </item> </taglist> </item> - <tag><c><![CDATA[+sss size]]></c></tag> + <tag><marker id="sched_thread_stack_size"><c><![CDATA[+sss size]]></c></marker></tag> <item> - <marker id="sched_thread_stack_size"></marker> <p>Suggested stack size, in kilowords, for scheduler threads. Valid range is 4-8192 kilowords. The default stack size is OS dependent.</p> </item> - <tag><c><![CDATA[+t size]]></c></tag> + <tag><marker id="+t"><c><![CDATA[+t size]]></c></marker></tag> <item> - <marker id="+t"></marker> <p>Set the maximum number of atoms the VM can handle. Default is 1048576.</p> </item> - <tag><c><![CDATA[+T Level]]></c></tag> + <tag><marker id="+T"><c><![CDATA[+T Level]]></c></marker></tag> <item> - <marker id="+T"></marker> <p>Enables modified timing and sets the modified timing level. Currently valid range is 0-9. The timing of the runtime system will change. A high level usually means a greater change than diff --git a/erts/doc/src/erl_driver.xml b/erts/doc/src/erl_driver.xml index 63108f41f0..5061230a33 100644 --- a/erts/doc/src/erl_driver.xml +++ b/erts/doc/src/erl_driver.xml @@ -171,8 +171,8 @@ asynchronous function calls, using a thread pool provided by Erlang. There is also a select call, that can be used for asynchronous drivers.</item> - <tag>Multi-threading</tag> - <item><marker id="multi_threading"></marker> + <tag><marker id="multi_threading">Multi-threading</marker></tag> + <item> <p>A POSIX thread like API for multi-threading is provided. The Erlang driver thread API only provide a subset of the functionality provided by the POSIX thread API. The subset provided is @@ -245,9 +245,8 @@ <item>A driver can add and later remove drivers.</item> <tag>Monitoring processes</tag> <item>A driver can monitor a process that does not own a port.</item> - <tag>Version management</tag> + <tag><marker id="version_management">Version management</marker></tag> <item> - <marker id="version_management"></marker> <p>Version management is enabled for drivers that have set the <seealso marker="driver_entry#extended_marker">extended_marker</seealso> field of their diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index c013d96fc4..2e55f13ed5 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -36,24 +36,26 @@ <description> <warning><p>The NIF concept was introduced in R13B03 as an EXPERIMENTAL feature. The interfaces may be changed in any way - in coming releases. The API is still sparse and contains only - the most basic functions to read and write Erlang terms. - </p><p><em>R13B04</em>: The function prototypes of the NIFs - have changed to expect <c>argc</c> and <c>argv</c> - arguments. The arity of a NIF is by that no longer limited to - 3.</p> - <p>enif_get_data renamed as enif_priv_data.</p> + in coming releases. The plan is however to lift the experimental label and + maintain interface backward compatibility from R14B.</p> + <p>Incompatible changes in <em>R13B04</em>:</p> + <list> + <item>The function prototypes of the NIFs have changed to expect <c>argc</c> and <c>argv</c> + arguments. The arity of a NIF is by that no longer limited to 3.</item> + <item><c>enif_get_data</c> renamed as <c>enif_priv_data</c>.</item> + <item><c>enif_make_string</c> got a third argument for character encoding.</item> + </list> </warning> <p>A NIF library contains native implementation of some functions - of an erlang module. The native implemented functions (NIFs) are + of an Erlang module. The native implemented functions (NIFs) are called like any other functions without any difference to the caller. Each NIF must also have an implementation in Erlang that will be invoked if the function is called before the NIF library has been successfully loaded. A typical such stub implementation is to throw an exception. But it can also be used as a fallback implementation if the NIF library is not implemented for some - architecture.</p> + architecture.</p> <p>A minimal example of a NIF library can look like this:</p> <p/> <code type="none"> @@ -62,7 +64,7 @@ static ERL_NIF_TERM hello(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { - return enif_make_string(env, "Hello world!"); + return enif_make_string(env, "Hello world!", ERL_NIF_LATIN1); } static ErlNifFunc nif_funcs[] = @@ -73,7 +75,7 @@ static ErlNifFunc nif_funcs[] = ERL_NIF_INIT(niftest,nif_funcs,NULL,NULL,NULL,NULL) </code> - <p>and the erlang module would have to look something like + <p>and the Erlang module would have to look something like this:</p> <p/> <code type="none"> @@ -107,16 +109,20 @@ ok the new directive <seealso marker="doc/reference_manual:code_loading#on_load">on_load</seealso> to automatically load the NIF library when the module is loaded.</p> + <note><p>A NIF must be exported or used locally by the module (or both). + An unused local stub function will be optimized away by the compiler + causing loading of the NIF library to fail.</p> + </note> <p>A loaded NIF library is tied to the Erlang module code version that loaded it. If the module is upgraded with a new version, the - new code will have to load its own NIF library (or maybe choose not + new Erlang code will have to load its own NIF library (or maybe choose not to). The new code version can however choose to load the exact same NIF library as the old code if it wants to. Sharing the same dynamic library will mean that static data defined by the library will be shared as well. To avoid unintentionally shared static data, each Erlang module code can keep its own private data. This private data can be set when the NIF library is loaded and - then retrieved by calling <seealso marker="erl_nif#enif_priv_data">enif_priv_data()</seealso>.</p> + then retrieved by calling <seealso marker="#enif_priv_data">enif_priv_data()</seealso>.</p> <p>There is no way to explicitly unload a NIF library. A library will be automatically unloaded when the module code that it belongs to is purged by the code server. A NIF library will also be unloaded if it is replaced @@ -131,7 +137,7 @@ ok <taglist> <tag>Read and write Erlang terms</tag> <item><p>Any Erlang terms can be passed to a NIF as function arguments and - be returned as function return value. The terms are of C-type <c>ERL_NIF_TERM</c> + be returned as function return values. The terms are of C-type <c>ERL_NIF_TERM</c> and can only be read or written using API functions. Most functions to read the content of a term are prefixed <c>enif_get_</c> and usually return true (or false) if the term was of the expected type (or not). @@ -139,45 +145,98 @@ ok return the created <c>ERL_NIF_TERM</c>. There are also some functions to query terms, like <c>enif_is_atom</c>, <c>enif_is_identical</c> and <c>enif_compare</c>.</p></item> + <tag>Binaries</tag> + <item><p>Terms of type binary are accessed with the help of the struct type + <seealso marker="#ErlNifBinary">ErlNifBinary</seealso> + that contains a pointer (<c>data</c>) to the raw binary data and the length + (<c>size</c>) of the data in bytes. Both <c>data</c> and <c>size</c> are + read-only and should only be written using calls to API functions. + Instances of <c>ErlNifBinary</c> are however always allocated by the user + (usually as local variables).</p> + <p>The raw data pointed to by <c>data</c> is only mutable after a call to + <seealso marker="#enif_alloc_binary">enif_alloc_binary</seealso>. + All other functions that operates on a binary will leave the data as read-only. + A mutable binary allocated with <c>enif_alloc_binary</c> must in the end + either be freed with <seealso marker="#enif_release_binary">enif_release_binary</seealso> + or made read-only by transferring it to an Erlang term with + <seealso marker="#enif_make_binary">enif_make_binary</seealso>. + But it does not have do happen in the same NIF call. Read-only binaries + does not have to be released.</p> + <p>Binaries are sequences of whole bytes. Bitstrings with an arbitrary + bit length have no support yet.</p> + </item> <tag>Resource objects</tag> - <item><p>Resource objects are a way to return pointers to native data - structures from a NIF in a safe way. A resource object is just a block - of memory allocated with <seealso marker="erl_nif#enif_alloc_resource">enif_alloc_resource()</seealso>. + <item><p>The use of resource objects is a way to return pointers to + native data structures from a NIF in a safe way. A resource object is + just a block of memory allocated with + <seealso marker="#enif_alloc_resource">enif_alloc_resource()</seealso>. A handle ("safe pointer") to this memory block can then be returned to Erlang by the use of - <seealso marker="erl_nif#enif_make_resource">enif_make_resource()</seealso>. + <seealso marker="#enif_make_resource">enif_make_resource()</seealso>. The term returned by <c>enif_make_resource</c> is totally opaque in nature. It can be stored and passed between processses on the same node, but the only real end usage is to pass it back as argument to a NIF. - The NIF can then do <seealso marker="erl_nif#enif_get_resource">enif_get_resource()</seealso> + The NIF can then do <seealso marker="#enif_get_resource">enif_get_resource()</seealso> and get back a pointer to the memory block that is guaranteed to still be valid. A resource object will not be deallocated until the last handle term has been garbage collected by the VM and the resource has been - released with <seealso marker="erl_nif#enif_release_resource">enif_release_resource()</seealso> + released with <seealso marker="#enif_release_resource">enif_release_resource()</seealso> (not necessarily in that order).</p> <p>All resource objects are created as instances of some <em>resource type</em>. - This makes resources from different modules or applications to be distinguishable. + This makes resources from different modules to be distinguishable. A resource type is created by calling - <seealso marker="erl_nif#enif_open_resource_type">enif_open_resource_type()</seealso> + <seealso marker="#enif_open_resource_type">enif_open_resource_type()</seealso> when a library is loaded. Objects of that resource type can then later be allocated and <c>enif_get_resource</c> verifies that the resource is of the expected type. - A resource type can have a destructor function that is automatically - called when resources of that type are released (by either the garbage - collector or <c>enif_release_resource</c>). Resource types also support - upgrade in runtime by allowing a loaded NIF library to takeover an already - existing resource type and thereby "inherit" all existing objects of that type. - The destructor of the new library will thereafter be called for the inherited - objects and the library with the old destructor function can be safely - unloaded. Resource types are uniquely identified by a supplied name string. + A resource type can have a user supplied destructor function that is + automatically called when resources of that type are released (by either + the garbage collector or <c>enif_release_resource</c>). Resource types + are uniquely identified by a supplied name string.</p> + <p>Resource types support upgrade in runtime by allowing a loaded NIF + library to takeover an already existing resource type and thereby + "inherit" all existing objects of that type. The destructor of the new + library will thereafter be called for the inherited objects and the + library with the old destructor function can be safely unloaded. Existing + resource objects, of a module that is upgraded, must either be deleted + or taken over by the new NIF library. The unloading of a library will be + postponed as long as it exists resource objects with a destructor + function in the library. </p> + <p>Here is a template example of how to create and return a resource object.</p> + <p/> + <code type="none"> + ERL_NIF_TERM term; + MyStruct* ptr = enif_alloc_resource(env, my_resource_type, sizeof(MyStruct)); + + /* initialize struct ... */ + + term = enif_make_resource(env, ptr); + + if (keep_a_reference_of_our_own) { + /* store 'ptr' in static variable, private data or other resource object */ + } + else { + enif_release_resource(env, obj); + /* resource now only owned by "Erlang" */ + } + return term; +} +</code> + </item> <tag>Threads and concurrency</tag> <item><p>A NIF is thread-safe without any explicit synchronization as - long as it acts as a pure function and only operates on the supplied - arguments. As soon as you access a shared state either through static - variables or <seealso marker="erl_nif#enif_priv_data">enif_priv_data</seealso> - you need to supply your own explicit synchronization.</p> + long as it acts as a pure function and only reads the supplied + arguments. As soon as you write towards a shared state either through + static variables or <seealso marker="#enif_priv_data">enif_priv_data</seealso> + you need to supply your own explicit synchronization. Resource objects + will also require synchronization if you treat them as mutable.</p> <p>The library initialization callbacks <c>load</c>, <c>reload</c> and - <c>upgrade</c> are all thread-safe even for shared state data.</p></item> + <c>upgrade</c> are all thread-safe even for shared state data.</p> + <p>Avoid doing lengthy work in NIF calls as that may degrade the + responsiveness of the VM. NIFs are called directly by the same scheduler + thread that executed the calling Erlang code. The calling scheduler will thus + be blocked from doing any other work until the NIF returns.</p> + </item> </taglist> </section> <section> @@ -203,7 +262,9 @@ ok and there is no previously loaded library for this module.</p> <p><c>*priv_data</c> can be set to point to some private data that the library needs in able to keep a state between NIF - calls. <c>enif_priv_data()</c> will return this pointer.</p> + calls. <c>enif_priv_data()</c> will return this pointer. + <c>*priv_data</c> will be initialized to NULL when <c>load</c> is + called.</p> <p><c>load_info</c> is the second argument to <seealso marker="erlang#load_nif-2">erlang:load_nif/2</seealso>.</p> <p>The library will fail to load if <c>load</c> returns @@ -229,7 +290,8 @@ ok <p>Works the same as <c>load</c>. The only difference is that <c>*old_priv_data</c> already contains the value set by the last call to <c>load</c> or <c>reload</c> for the old module - code. It is allowed to write to both *priv_data and *old_priv_data.</p> + code. <c>*priv_data</c> will be initialized to NULL when <c>upgrade</c> + is called. It is allowed to write to both *priv_data and *old_priv_data.</p> <p>The library will fail to load if <c>upgrade</c> returns anything other than 0 or if <c>upgrade</c> is NULL.</p> </item> @@ -237,7 +299,8 @@ ok <tag><marker id="unload"/>void (*unload)(ErlNifEnv* env, void* priv_data)</tag> <item><p><c>unload</c> is called when the module code that the NIF library belongs to is purged as old. New code - of the same module may or may not exist.</p> + of the same module may or may not exist. Note that <c>unload</c> is not + called for a replaced library as a consequence of <c>reload</c>.</p> </item> </taglist> @@ -328,7 +391,7 @@ typedef enum { </item> <tag><marker id="ErlNifSysInfo"/>ErlNifSysInfo</tag> <item> - <p>Used by <seealso marker="erl_nif#enif_system_info">enif_system_info</seealso> + <p>Used by <seealso marker="#enif_system_info">enif_system_info</seealso> to return information about the runtime system. Contains currently the exact same content as <seealso marker="erl_driver#ErlDrvSysInfo">ErlDrvSysInfo</seealso>.</p> </item> @@ -346,9 +409,9 @@ typedef enum { <desc><p>Allocate a new binary of size of <c>size</c> bytes. Initialize the structure pointed to by <c>bin</c> to refer to the allocated binary. The binary must either be released by - <seealso marker="erl_nif#enif_release_binary">enif_release_binary()</seealso> - or ownership transferred to an erlang term with - <seealso marker="erl_nif#enif_make_binary">enif_make_binary()</seealso>. + <seealso marker="#enif_release_binary">enif_release_binary()</seealso> + or ownership transferred to an Erlang term with + <seealso marker="#enif_make_binary">enif_make_binary()</seealso>. An allocated (and owned) <c>ErlNifBinary</c> can be kept between NIF calls.</p> <p>Return false if allocation failed.</p> @@ -437,7 +500,9 @@ typedef enum { <func><name><ret>int</ret><nametext>enif_get_resource(ErlNifEnv* env, ERL_NIF_TERM term, ErlNifResourceType* type, void** objp)</nametext></name> <fsummary>Get the pointer to a resource object</fsummary> <desc><p>Set <c>*objp</c> to point to the resource object referred to by <c>term</c>. - Return false if <c>term</c> is not a handle to a resource object of type <c>type</c>.</p></desc> + The pointer is valid until the calling NIF returns and should not be released.</p> + <p>Return false if <c>term</c> is not a handle to a resource object + of type <c>type</c>.</p></desc> </func> <func><name><ret>int</ret><nametext>enif_get_string(ErlNifEnv* env, ERL_NIF_TERM list, char* buf, unsigned size, @@ -446,11 +511,11 @@ typedef enum { <desc><p>Write a null-terminated string, in the buffer pointed to by <c>buf</c> with size <c>size</c>, consisting of the characters in the string <c>list</c>. The characters are written using encoding - <c>encode</c>. Return the number of bytes written - (including terminating null character), or <c>-size</c> if the - string was truncated due to buffer space, or 0 if <c>list</c> - is not a string that can be encoded with <c>encode</c> or - if <c>size</c> was less than 1. + <seealso marker="#ErlNifCharEncoding">encode</seealso>. + Return the number of bytes written (including terminating null + character), or <c>-size</c> if the string was truncated due to + buffer space, or 0 if <c>list</c> is not a string that can be + encoded with <c>encode</c> or if <c>size</c> was less than 1. The written string is always null-terminated unless buffer <c>size</c> is less than 1.</p></desc> </func> @@ -577,7 +642,7 @@ typedef enum { <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list9(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e9)</nametext></name> <fsummary>Create a list term.</fsummary> <desc><p>Create an ordinary list term with length indicated by the - function name. Prefere these functions (macros) over the variadic + function name. Prefer these functions (macros) over the variadic <c>enif_make_list</c> to get compile time error if the number of arguments does not match.</p></desc> </func> @@ -601,9 +666,9 @@ typedef enum { <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_resource(ErlNifEnv* env, void* obj)</nametext></name> <fsummary>Create an opaque handle to a resource object</fsummary> <desc><p>Create an opaque handle to a memory managed resource object - obtained by <seealso marker="erl_nif#enif_alloc_resource">enif_alloc_resource</seealso>. + obtained by <seealso marker="#enif_alloc_resource">enif_alloc_resource</seealso>. No ownership transfer is done, the resource object still needs to be released by - <seealso marker="erl_nif#enif_release_resource">enif_release_resource</seealso>.</p> + <seealso marker="#enif_release_resource">enif_release_resource</seealso>.</p> <p>Note that the only defined behaviour when using of a resource term in an Erlang program is to store it and send it between processes on the same node. Other operations such as matching or <c>term_to_binary</c> @@ -612,7 +677,7 @@ typedef enum { <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_string(ErlNifEnv* env, const char* string, ErlNifCharEncoding encoding)</nametext></name> <fsummary>Create a string.</fsummary> <desc><p>Create a list containing the characters of the - null-terminated string <c>string</c> with encoding <c>encoding</c>.</p></desc> + null-terminated string <c>string</c> with encoding <seealso marker="#ErlNifCharEncoding">encoding</seealso>.</p></desc> </func> <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_sub_binary(ErlNifEnv* env, ERL_NIF_TERM bin_term, unsigned pos, unsigned size)</nametext></name> @@ -640,7 +705,7 @@ typedef enum { <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple9(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e9)</nametext></name> <fsummary>Create a tuple term.</fsummary> <desc><p>Create a tuple term with length indicated by the - function name. Prefere these functions (macros) over the variadic + function name. Prefer these functions (macros) over the variadic <c>enif_make_tuple</c> to get compile time error if the number of arguments does not match.</p></desc> </func> @@ -686,7 +751,7 @@ typedef enum { ErlNifResourceDtor* dtor, ErlNifResourceFlags flags, ErlNifResourceFlags* tried)</nametext></name> <fsummary>Create or takeover a resource type</fsummary> <desc><p>Create or takeover a resource type identified by the string - <c>name</c> and give it the destructor function pointed to by <c>dtor</c>. + <c>name</c> and give it the destructor function pointed to by <seealso marker="#ErlNifResourceDtor">dtor</seealso>. Argument <c>flags</c> can have the following values:</p> <taglist> <tag><c>ERL_NIF_RT_CREATE</c></tag> @@ -706,8 +771,8 @@ typedef enum { On failure, return <c>NULL</c> and set <c>*tried</c> to <c>flags</c>. It is allowed to set <c>tried</c> to <c>NULL</c>.</p> <p>Note that <c>enif_open_resource_type</c> is only allowed to be called in the three callbacks - <seealso marker="erl_nif#load">load</seealso>, <seealso marker="erl_nif#reload">reload</seealso> - and <seealso marker="erl_nif#upgrade">upgrade</seealso>.</p> + <seealso marker="#load">load</seealso>, <seealso marker="#reload">reload</seealso> + and <seealso marker="#upgrade">upgrade</seealso>.</p> </desc> </func> <func><name><ret>void*</ret><nametext>enif_priv_data(ErlNifEnv* env)</nametext></name> diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index d4fd8c8c9f..46f8df4683 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -3474,9 +3474,8 @@ os_prompt%</pre> <p>This changes the minimum binary virtual heap size for the calling process.</p> </item> - <tag><c>process_flag(priority, Level)</c></tag> + <tag><marker id="process_flag_priority"><c>process_flag(priority, Level)</c></marker></tag> <item> - <marker id="process_flag_priority"></marker> <p>This sets the process priority. <c>Level</c> is an atom. There are currently four priority levels: <c>low</c>, <c>normal</c>, <c>high</c>, and <c>max</c>. The default @@ -4788,9 +4787,8 @@ true</pre> <c>ContextSwitches</c> is the total number of context switches since the system started.</p> </item> - <tag><c>exact_reductions</c></tag> + <tag><marker id="statistics_exact_reductions"><c>exact_reductions</c></marker></tag> <item> - <marker id="statistics_exact_reductions"></marker> <p>Returns <c>{Total_Exact_Reductions, Exact_Reductions_Since_Last_Call}</c>.</p> <p><em>NOTE:</em><c>statistics(exact_reductions)</c> is @@ -4810,9 +4808,8 @@ true</pre> through ports, and <c>Output</c> is the total number of bytes output to ports.</p> </item> - <tag><c>reductions</c></tag> + <tag><marker id="statistics_reductions"><c>reductions</c></marker></tag> <item> - <marker id="statistics_reductions"></marker> <p>Returns <c>{Total_Reductions, Reductions_Since_Last_Call}</c>.</p> <p><em>NOTE:</em> From erts version 5.5 (OTP release R11B) @@ -4983,9 +4980,8 @@ true</pre> <p>Sets the maximum depth of call stack back-traces in the exit reason element of <c>'EXIT'</c> tuples.</p> </item> - <tag><c>erlang:system_flag(cpu_topology, CpuTopology)</c></tag> + <tag><marker id="system_flag_cpu_topology"><c>erlang:system_flag(cpu_topology, CpuTopology)</c></marker></tag> <item> - <marker id="system_flag_cpu_topology"></marker> <p>Sets the user defined <c>CpuTopology</c>. The user defined CPU topology will override any automatically detected CPU topology. By passing <c>undefined</c> as <c>CpuTopology</c> @@ -5047,9 +5043,8 @@ true</pre> <seealso marker="#spawn_opt/4">spawn_opt/N</seealso> or <seealso marker="#process_flag/2">process_flag/2</seealso>. </p> </item> - <tag><c>erlang:system_flag(multi_scheduling, BlockState)</c></tag> + <tag><marker id="system_flag_multi_scheduling"><c>erlang:system_flag(multi_scheduling, BlockState)</c></marker></tag> <item> - <marker id="system_flag_multi_scheduling"></marker> <p><c>BlockState = block | unblock</c></p> <p>If multi-scheduling is enabled, more than one scheduler thread is used by the emulator. Multi-scheduling can be @@ -5083,9 +5078,8 @@ true</pre> <seealso marker="#system_info_multi_scheduling_blockers">erlang:system_info(multi_scheduling_blockers)</seealso>, and <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>.</p> </item> - <tag><c>erlang:system_flag(scheduler_bind_type, How)</c></tag> + <tag><marker id="system_flag_scheduler_bind_type"><c>erlang:system_flag(scheduler_bind_type, How)</c></marker></tag> <item> - <marker id="system_flag_scheduler_bind_type"></marker> <p>Controls if and how schedulers are bound to logical processors.</p> <p>When <c>erlang:system_flag(scheduler_bind_type, How)</c> is @@ -5212,9 +5206,8 @@ true</pre> <seealso marker="#system_flag_cpu_topology">erlang:system_flag(cpu_topology, CpuTopology)</seealso>. </p> </item> - <tag><c>erlang:system_flag(schedulers_online, SchedulersOnline)</c></tag> + <tag><marker id="system_flag_schedulers_online"><c>erlang:system_flag(schedulers_online, SchedulersOnline)</c></marker></tag> <item> - <marker id="system_flag_schedulers_online"></marker> <p>Sets the amount of schedulers online. Valid range is <![CDATA[1 <= SchedulerId <= erlang:system_info(schedulers)]]>. </p> @@ -5252,9 +5245,8 @@ true</pre> <p>Returns various information about the current system (emulator) as specified by <c>Type</c>:</p> <taglist> - <tag><c>allocated_areas</c></tag> + <tag><marker id="system_info_allocated_areas"><c>allocated_areas</c></marker></tag> <item> - <marker id="system_info_allocated_areas"></marker> <p>Returns a list of tuples with information about miscellaneous allocated memory areas.</p> <p>Each tuple contains an atom describing type of memory as @@ -5274,9 +5266,8 @@ true</pre> in the total amount of memory allocated by the emulator see <seealso marker="#memory/0">erlang:memory/0,1</seealso>.</p> </item> - <tag><c>allocator</c></tag> + <tag><marker id="system_info_allocator"><c>allocator</c></marker></tag> <item> - <marker id="system_info_allocator"></marker> <p>Returns <c>{Allocator, Version, Features, Settings}.</c></p> <p>Types:</p> <list type="bulleted"> @@ -5317,9 +5308,8 @@ true</pre> <p>See also "System Flags Effecting erts_alloc" in <seealso marker="erts:erts_alloc#flags">erts_alloc(3)</seealso>.</p> </item> - <tag><c>alloc_util_allocators</c></tag> + <tag><marker id="system_info_alloc_util_allocators"><c>alloc_util_allocators</c></marker></tag> <item> - <marker id="system_info_alloc_util_allocators"></marker> <p>Returns a list of the names of all allocators using the ERTS internal <c>alloc_util</c> framework as atoms. For more information see the @@ -5328,9 +5318,8 @@ true</pre> erts_alloc(3)</seealso> documentation. </p> </item> - <tag><c>{allocator, Alloc}</c></tag> + <tag><marker id="system_info_allocator_tuple"><c>{allocator, Alloc}</c></marker></tag> <item> - <marker id="system_info_allocator_tuple"></marker> <p>Returns information about the specified allocator. As of erts version 5.6.1 the return value is a list of <c>{instance, InstanceNo, InstanceInfo}</c> tuples @@ -5366,9 +5355,8 @@ true</pre> values. The first value is memory pool size and the second value used memory size.</p> </item> - <tag><c>{allocator_sizes, Alloc}</c></tag> + <tag><marker id="system_info_allocator_sizes"><c>{allocator_sizes, Alloc}</c></marker></tag> <item> - <marker id="system_info_allocator_sizes"></marker> <p>Returns various size information for the specified allocator. The information returned is a subset of the information returned by @@ -5402,9 +5390,8 @@ true</pre> line flag <c>+R</c>, see <seealso marker="erts:erl#compat_rel">erl(1)</seealso>.</p> </item> - <tag><c>cpu_topology</c></tag> + <tag><marker id="system_info_cpu_topology"><c>cpu_topology</c></marker></tag> <item> - <marker id="system_info_cpu_topology"></marker> <p>Returns the <c>CpuTopology</c> which currently is used by the emulator. The CPU topology is used when binding schedulers to logical processors. The CPU topology used is the user defined @@ -5677,9 +5664,8 @@ true</pre> <seealso marker="erts:erl#+T">erl(1)</seealso> command for more information on modified timing.</p> </item> - <tag><c>multi_scheduling</c></tag> + <tag><marker id="system_info_multi_scheduling"><c>multi_scheduling</c></marker></tag> <item> - <marker id="system_info_multi_scheduling"></marker> <p>Returns <c>disabled</c>, <c>blocked</c>, or <c>enabled</c>. A description of the return values:</p> <taglist> @@ -5708,9 +5694,8 @@ true</pre> <seealso marker="#system_info_multi_scheduling_blockers">erlang:system_info(multi_scheduling_blockers)</seealso>, and <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>.</p> </item> - <tag><c>multi_scheduling_blockers</c></tag> + <tag><marker id="system_info_multi_scheduling_blockers"><c>multi_scheduling_blockers</c></marker></tag> <item> - <marker id="system_info_multi_scheduling_blockers"></marker> <p>Returns a list of <c>PID</c>s when multi-scheduling is blocked; otherwise, the empty list. The <c>PID</c>s in the list is <c>PID</c>s of the processes currently @@ -5721,9 +5706,8 @@ true</pre> <seealso marker="#system_info_multi_scheduling">erlang:system_info(multi_scheduling)</seealso>, and <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>.</p> </item> - <tag><c>otp_release</c></tag> + <tag><marker id="system_info_otp_release"><c>otp_release</c></marker></tag> <item> - <marker id="system_info_otp_release"></marker> <p>Returns a string containing the OTP release number.</p> </item> <tag><c>process_count</c></tag> @@ -5747,9 +5731,8 @@ true</pre> information see the <seealso marker="erts:crash_dump">"How to interpret the Erlang crash dumps"</seealso> chapter in the ERTS User's Guide.</p> </item> - <tag><c>scheduler_bind_type</c></tag> + <tag><marker id="system_info_scheduler_bind_type"><c>scheduler_bind_type</c></marker></tag> <item> - <marker id="system_info_scheduler_bind_type"></marker> <p>Returns information on how user has requested schedulers to be bound or not bound.</p> <p><em>NOTE:</em> Even though user has requested @@ -5764,9 +5747,8 @@ true</pre> <seealso marker="#system_info_scheduler_bindings">erlang:system_info(scheduler_bindings)</seealso>. </p> </item> - <tag><c>scheduler_bindings</c></tag> + <tag><marker id="system_info_scheduler_bindings"><c>scheduler_bindings</c></marker></tag> <item> - <marker id="system_info_scheduler_bindings"></marker> <p>Returns information on currently used scheduler bindings.</p> <p>A tuple of a size equal to @@ -5788,18 +5770,16 @@ true</pre> <seealso marker="#system_info_schedulers_online">erlang:system_info(schedulers_online)</seealso>. </p> </item> - <tag><c>scheduler_id</c></tag> + <tag><marker id="system_info_scheduler_id"><c>scheduler_id</c></marker></tag> <item> - <marker id="system_info_scheduler_id"></marker> <p>Returns the scheduler id (<c>SchedulerId</c>) of the scheduler thread that the calling process is executing on. <c>SchedulerId</c> is a positive integer; where <c><![CDATA[1 <= SchedulerId <= erlang:system_info(schedulers)]]></c>. See also <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>.</p> </item> - <tag><c>schedulers</c></tag> + <tag><marker id="system_info_schedulers"><c>schedulers</c></marker></tag> <item> - <marker id="system_info_schedulers"></marker> <p>Returns the number of scheduler threads used by the emulator. Scheduler threads online schedules Erlang processes and Erlang ports, and execute Erlang code @@ -5815,9 +5795,8 @@ true</pre> <seealso marker="#system_info_multi_scheduling">erlang:system_info(multi_scheduling)</seealso>, and and <seealso marker="#system_info_multi_scheduling_blockers">erlang:system_info(multi_scheduling_blockers)</seealso>.</p> </item> - <tag><c>schedulers_online</c></tag> + <tag><marker id="system_info_schedulers_online"><c>schedulers_online</c></marker></tag> <item> - <marker id="system_info_schedulers_online"></marker> <p>Returns the amount of schedulers online. The scheduler identifiers of schedulers online satisfy the following relationship: @@ -5850,9 +5829,8 @@ true</pre> with thread support; otherwise, <c>false</c> is returned.</p> </item> - <tag><c>thread_pool_size</c></tag> + <tag><marker id="system_info_thread_pool_size"><c>thread_pool_size</c></marker></tag> <item> - <marker id="system_info_thread_pool_size"></marker> <p>Returns the number of async threads in the async thread pool used for asynchronous driver calls (<seealso marker="erts:erl_driver#driver_async">driver_async()</seealso>) @@ -5865,9 +5843,8 @@ true</pre> <c>get_tcw</c> in "Match Specifications in Erlang", <seealso marker="erts:match_spec#get_tcw">ERTS User's Guide</seealso>.</p> </item> - <tag><c>version</c></tag> + <tag><marker id="system_info_version"><c>version</c></marker></tag> <item> - <marker id="system_info_version"></marker> <p>Returns a string containing the version number of the emulator.</p> </item> @@ -6477,9 +6454,8 @@ true</pre> the current function cannot be determined, then the last element <c>Arity</c> is 0.</p> </item> - <tag><c>{trace, Pid, gc_start, Info}</c></tag> + <tag><marker id="gc_start"><c>{trace, Pid, gc_start, Info}</c></marker></tag> <item> - <marker id="gc_start"></marker> <p>Sent when garbage collection is about to be started. <c>Info</c> is a list of two-element tuples, where the first element is a key, and the second is the value. diff --git a/erts/doc/src/erts_alloc.xml b/erts/doc/src/erts_alloc.xml index d51e5b3ea4..51a4a2bca0 100644 --- a/erts/doc/src/erts_alloc.xml +++ b/erts/doc/src/erts_alloc.xml @@ -4,7 +4,7 @@ <cref> <header> <copyright> - <year>2002</year><year>2009</year> + <year>2002</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>erts_alloc</title> @@ -122,7 +122,7 @@ size (<seealso marker="#M_lmbcs">lmbcs</seealso>), the smallest multiblock carrier size (<seealso marker="#M_smbcs">smbcs</seealso>), and the multiblock carrier growth stages - (<seealso marker="#M_smbcs">mbcgs</seealso>) parameters. If + (<seealso marker="#M_mbcgs">mbcgs</seealso>) parameters. If <c>nc</c> is the current number of multiblock carriers (the main multiblock carrier excluded) managed by an allocator, the size of the next <c>mseg_alloc</c> multiblock carrier allocated by @@ -229,29 +229,25 @@ <p>The following flags are available for configuration of <c>mseg_alloc</c>:</p> <taglist> - <tag><c><![CDATA[+MMamcbf <size>]]></c></tag> - <item> <marker id="MMamcbf"></marker> - + <tag><marker id="MMamcbf"><c><![CDATA[+MMamcbf <size>]]></c></marker></tag> + <item> Absolute max cache bad fit (in kilobytes). A segment in the memory segment cache is not reused if its size exceeds the requested size with more than the value of this parameter. Default value is 4096. </item> - <tag><c><![CDATA[+MMrmcbf <ratio>]]></c></tag> - <item> <marker id="MMrmcbf"></marker> - + <tag><marker id="MMrmcbf"><c><![CDATA[+MMrmcbf <ratio>]]></c></marker></tag> + <item> Relative max cache bad fit (in percent). A segment in the memory segment cache is not reused if its size exceeds the requested size with more than relative max cache bad fit percent of the requested size. Default value is 20.</item> - <tag><c><![CDATA[+MMmcs <amount>]]></c></tag> - <item> <marker id="MMmcs"></marker> - + <tag><marker id="MMmcs"><c><![CDATA[+MMmcs <amount>]]></c></marker></tag> + <item> Max cached segments. The maximum number of memory segments stored in the memory segment cache. Valid range is 0-30. Default value is 5.</item> - <tag><c><![CDATA[+MMcci <time>]]></c></tag> - <item> <marker id="MMcci"></marker> - + <tag><marker id="MMcci"><c><![CDATA[+MMcci <time>]]></c></marker></tag> + <item> Cache check interval (in milliseconds). The memory segment cache is checked for segments to destroy at an interval determined by this parameter. Default value is 1000.</item> @@ -259,26 +255,23 @@ <p>The following flags are available for configuration of <c>fix_alloc</c>:</p> <taglist> - <tag><c>+MFe true</c></tag> - <item> <marker id="MFe"></marker> - + <tag><marker id="MFe"><c>+MFe true</c></marker></tag> + <item> Enable <c>fix_alloc</c>. Note: <c>fix_alloc</c> cannot be disabled.</item> </taglist> <p>The following flags are available for configuration of <c>sys_alloc</c>:</p> <taglist> - <tag><c>+MYe true</c></tag> - <item> <marker id="MYe"></marker> - + <tag><marker id="MYe"><c>+MYe true</c></marker></tag> + <item> Enable <c>sys_alloc</c>. Note: <c>sys_alloc</c> cannot be disabled.</item> - <tag><c>+MYm libc</c></tag> - <item> <marker id="MYm"></marker> -<c>malloc</c> library to use. Currently only + <tag><marker id="MYm"><c>+MYm libc</c></marker></tag> + <item> + <c>malloc</c> library to use. Currently only <c>libc</c> is available. <c>libc</c> enables the standard <c>libc</c> malloc implementation. By default <c>libc</c> is used.</item> - <tag><c><![CDATA[+MYtt <size>]]></c></tag> - <item> <marker id="MYtt"></marker> - + <tag><marker id="MYtt"><c><![CDATA[+MYtt <size>]]></c></marker></tag> + <item> Trim threshold size (in kilobytes). This is the maximum amount of free memory at the top of the heap (allocated by <c>sbrk</c>) that will be kept by <c>malloc</c> (not @@ -289,9 +282,8 @@ trim threshold is 128. <em>Note:</em> This flag will only have any effect when the emulator has been linked with the GNU C library, and uses its <c>malloc</c> implementation.</item> - <tag><c><![CDATA[+MYtp <size>]]></c></tag> - <item> <marker id="MYtp"></marker> - + <tag><marker id="MYtp"><c><![CDATA[+MYtp <size>]]></c></marker></tag> + <item> Top pad size (in kilobytes). This is the amount of extra memory that will be allocated by <c>malloc</c> when <c>sbrk</c> is called to get more memory from the operating @@ -308,43 +300,37 @@ subsystem identifier, only the specific allocator identified will be effected:</p> <taglist> - <tag><c><![CDATA[+M<S>as bf|aobf|gf|af]]></c></tag> - <item> <marker id="M_as"></marker> - + <tag><marker id="M_as"><c><![CDATA[+M<S>as bf|aobf|gf|af]]></c></marker></tag> + <item> Allocation strategy. Valid strategies are <c>bf</c> (best fit), <c>aobf</c> (address order best fit), <c>gf</c> (good fit), and <c>af</c> (a fit). See <seealso marker="#strategy">the description of allocation strategies</seealso> in "the <c>alloc_util</c> framework" section.</item> - <tag><c><![CDATA[+M<S>asbcst <size>]]></c></tag> - <item> <marker id="M_asbcst"></marker> - + <tag><marker id="M_asbcst"><c><![CDATA[+M<S>asbcst <size>]]></c></marker></tag> + <item> Absolute singleblock carrier shrink threshold (in kilobytes). When a block located in an <c>mseg_alloc</c> singleblock carrier is shrunk, the carrier will be left unchanged if the amount of unused memory is less than this threshold; otherwise, the carrier will be shrunk. See also <seealso marker="#M_rsbcst">rsbcst</seealso>.</item> - <tag><c><![CDATA[+M<S>e true|false]]></c></tag> - <item> <marker id="M_e"></marker> - + <tag><marker id="M_e"><c><![CDATA[+M<S>e true|false]]></c></marker></tag> + <item> Enable allocator <c><![CDATA[<S>]]></c>.</item> - <tag><c><![CDATA[+M<S>lmbcs <size>]]></c></tag> - <item> <marker id="M_lmbcs"></marker> - + <tag><marker id="M_lmbcs"><c><![CDATA[+M<S>lmbcs <size>]]></c></marker></tag> + <item> Largest (<c>mseg_alloc</c>) multiblock carrier size (in kilobytes). See <seealso marker="#mseg_mbc_sizes">the description on how sizes for mseg_alloc multiblock carriers are decided</seealso> in "the <c>alloc_util</c> framework" section.</item> - <tag><c><![CDATA[+M<S>mbcgs <ratio>]]></c></tag> - <item> <marker id="M_mbcgs"></marker> - + <tag><marker id="M_mbcgs"><c><![CDATA[+M<S>mbcgs <ratio>]]></c></marker></tag> + <item> (<c>mseg_alloc</c>) multiblock carrier growth stages. See <seealso marker="#mseg_mbc_sizes">the description on how sizes for mseg_alloc multiblock carriers are decided</seealso> in "the <c>alloc_util</c> framework" section.</item> - <tag><c><![CDATA[+M<S>mbsd <depth>]]></c></tag> - <item> <marker id="M_mbsd"></marker> - + <tag><marker id="M_mbsd"><c><![CDATA[+M<S>mbsd <depth>]]></c></marker></tag> + <item> Max block search depth. This flag has effect only if the good fit strategy has been selected for allocator <c><![CDATA[<S>]]></c>. When the good fit strategy is used, free @@ -353,47 +339,41 @@ search depth sets a limit on the maximum number of blocks to inspect in a free list during a search for suitable block satisfying the request.</item> - <tag><c><![CDATA[+M<S>mmbcs <size>]]></c></tag> - <item> <marker id="M_mmbcs"></marker> - + <tag><marker id="M_mmbcs"><c><![CDATA[+M<S>mmbcs <size>]]></c></marker></tag> + <item> Main multiblock carrier size. Sets the size of the main multiblock carrier for allocator <c><![CDATA[<S>]]></c>. The main multiblock carrier is allocated via <c><![CDATA[sys_alloc]]></c> and is never deallocated.</item> - <tag><c><![CDATA[+M<S>mmmbc <amount>]]></c></tag> - <item> <marker id="M_mmmbc"></marker> - + <tag><marker id="M_mmmbc"><c><![CDATA[+M<S>mmmbc <amount>]]></c></marker></tag> + <item> Max <c>mseg_alloc</c> multiblock carriers. Maximum number of multiblock carriers allocated via <c>mseg_alloc</c> by allocator <c><![CDATA[<S>]]></c>. When this limit has been reached, new multiblock carriers will be allocated via <c>sys_alloc</c>.</item> - <tag><c><![CDATA[+M<S>mmsbc <amount>]]></c></tag> - <item> <marker id="M_mmsbc"></marker> - + <tag><marker id="M_mmsbc"><c><![CDATA[+M<S>mmsbc <amount>]]></c></marker></tag> + <item> Max <c>mseg_alloc</c> singleblock carriers. Maximum number of singleblock carriers allocated via <c>mseg_alloc</c> by allocator <c><![CDATA[<S>]]></c>. When this limit has been reached, new singleblock carriers will be allocated via <c>sys_alloc</c>.</item> - <tag><c><![CDATA[+M<S>ramv <bool>]]></c></tag> - <item> <marker id="M_ramv"></marker> - + <tag><marker id="M_ramv"><c><![CDATA[+M<S>ramv <bool>]]></c></marker></tag> + <item> Realloc always moves. When enabled, reallocate operations will more or less be translated into an allocate, copy, free sequence. This often reduce memory fragmentation, but costs performance. </item> - <tag><c><![CDATA[+M<S>rmbcmt <ratio>]]></c></tag> - <item> <marker id="M_rmbcmt"></marker> - + <tag><marker id="M_rmbcmt"><c><![CDATA[+M<S>rmbcmt <ratio>]]></c></marker></tag> + <item> Relative multiblock carrier move threshold (in percent). When a block located in a multiblock carrier is shrunk, the block will be moved if the ratio of the size of the returned memory compared to the previous size is more than this threshold; otherwise, the block will be shrunk at current location.</item> - <tag><c><![CDATA[+M<S>rsbcmt <ratio>]]></c></tag> - <item> <marker id="M_rsbcmt"></marker> - + <tag><marker id="M_rsbcmt"><c><![CDATA[+M<S>rsbcmt <ratio>]]></c></marker></tag> + <item> Relative singleblock carrier move threshold (in percent). When a block located in a singleblock carrier is shrunk to a size smaller than the value of the @@ -401,32 +381,28 @@ the block will be left unchanged in the singleblock carrier if the ratio of unused memory is less than this threshold; otherwise, it will be moved into a multiblock carrier. </item> - <tag><c><![CDATA[+M<S>rsbcst <ratio>]]></c></tag> - <item> <marker id="M_rsbcst"></marker> - + <tag><marker id="M_rsbcst"><c><![CDATA[+M<S>rsbcst <ratio>]]></c></marker></tag> + <item> Relative singleblock carrier shrink threshold (in percent). When a block located in an <c>mseg_alloc</c> singleblock carrier is shrunk, the carrier will be left unchanged if the ratio of unused memory is less than this threshold; otherwise, the carrier will be shrunk. See also <seealso marker="#M_asbcst">asbcst</seealso>.</item> - <tag><c><![CDATA[+M<S>sbct <size>]]></c></tag> - <item> <marker id="M_sbct"></marker> - + <tag><marker id="M_sbct"><c><![CDATA[+M<S>sbct <size>]]></c></marker></tag> + <item> Singleblock carrier threshold. Blocks larger than this threshold will be placed in singleblock carriers. Blocks smaller than this threshold will be placed in multiblock carriers.</item> - <tag><c><![CDATA[+M<S>smbcs <size>]]></c></tag> - <item> <marker id="M_smbcs"></marker> - + <tag><marker id="M_smbcs"><c><![CDATA[+M<S>smbcs <size>]]></c></marker></tag> + <item> Smallest (<c>mseg_alloc</c>) multiblock carrier size (in kilobytes). See <seealso marker="#mseg_mbc_sizes">the description on how sizes for mseg_alloc multiblock carriers are decided</seealso> in "the <c>alloc_util</c> framework" section.</item> - <tag><c><![CDATA[+M<S>t true|false|<amount>]]></c></tag> - <item> <marker id="M_t"></marker> - + <tag><marker id="M_t"><c><![CDATA[+M<S>t true|false|<amount>]]></c></marker></tag> + <item> Multiple, thread specific instances of the allocator. This option will only have any effect on the runtime system with SMP support. Default behaviour on the runtime system with @@ -451,16 +427,15 @@ <c>alloc_util</c>, i.e. all allocators based on <c>alloc_util</c> will be effected:</p> <taglist> - <tag><c><![CDATA[+Muycs <size>]]></c></tag> - <item> <marker id="Muycs"></marker> -<c>sys_alloc</c> carrier size. Carriers allocated via + <tag><marker id="Muycs"><c><![CDATA[+Muycs <size>]]></c></marker></tag> + <item> + <c>sys_alloc</c> carrier size. Carriers allocated via <c>sys_alloc</c> will be allocated in sizes which are multiples of the <c>sys_alloc</c> carrier size. This is not true for main multiblock carriers and carriers allocated during a memory shortage, though.</item> - <tag><c><![CDATA[+Mummc <amount>]]></c></tag> - <item> <marker id="Mummc"></marker> - + <tag><marker id="Mummc"><c><![CDATA[+Mummc <amount>]]></c></marker></tag> + <item> Max <c>mseg_alloc</c> carriers. Maximum number of carriers placed in separate memory segments. When this limit has been reached, new carriers will be placed in memory retrieved from @@ -468,23 +443,20 @@ </taglist> <p>Instrumentation flags:</p> <taglist> - <tag><c>+Mim true|false</c></tag> - <item> <marker id="Mim"></marker> - + <tag><marker id="Mim"><c>+Mim true|false</c></marker></tag> + <item> A map over current allocations is kept by the emulator. The allocation map can be retrieved via the <c>instrument</c> module. <c>+Mim true</c> implies <c>+Mis true</c>. <c>+Mim true</c> is the same as <seealso marker="erl#instr">-instr</seealso>.</item> - <tag><c>+Mis true|false</c></tag> - <item> <marker id="Mis"></marker> - + <tag><marker id="Mis"><c>+Mis true|false</c></marker></tag> + <item> Status over allocated memory is kept by the emulator. The allocation status can be retrieved via the <c>instrument</c> module.</item> - <tag><c>+Mit X</c></tag> - <item> <marker id="Mit"></marker> - + <tag><marker id="Mit"><c>+Mit X</c></marker></tag> + <item> Reserved for future use. Do <em>not</em> use this flag.</item> </taglist> <note> @@ -493,8 +465,8 @@ </note> <p>Other flags:</p> <taglist> - <tag><c>+Mea min|max|r9c|r10b|r11b|config</c></tag> - <item> <marker id="Mea"></marker> + <tag><marker id="Mea"><c>+Mea min|max|r9c|r10b|r11b|config</c></marker></tag> + <item> <taglist> <tag><c>min</c></tag> <item> diff --git a/lib/asn1/doc/src/asn1ct.xml b/lib/asn1/doc/src/asn1ct.xml index 9c04956e86..8a0ae52c39 100644 --- a/lib/asn1/doc/src/asn1ct.xml +++ b/lib/asn1/doc/src/asn1ct.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>asn1ct</title> @@ -52,9 +52,11 @@ <v>Options = [Option| OldOption]</v> <v>Option = ber_bin | per_bin | uper_bin | der | compact_bit_string | noobj | {n2n,EnumTypeName} |{outdir,Dir} | {i,IncludeDir} | optimize | - driver | asn1config | undec_rest | {inline,OutputName} | inline</v> + driver | asn1config | undec_rest | {inline,OutputName} | inline | + {macro_name_prefix, Prefix} | {record_name_prefix, Prefix}</v> <v>OldOption = ber | per</v> <v>Reason = term()</v> + <v>Prefix = string()</v> </type> <desc> <p>Compiles the ASN.1 module <c>Asn1module</c> and generates an @@ -270,6 +272,18 @@ Binary = binary() It is as <c>{inline,OutputName}</c>, but the output file gets the default name of the source <c>.set.asn</c> file.</p> </item> + <tag><c>{macro_name_prefix, Prefix}</c></tag> + <item> + <p>All macro names generated by the compiler are prefixed with + <c>Prefix</c>. This is useful when multiple protocols that contains + macros with identical names are included in a single module.</p> + </item> + <tag><c>{record_name_prefix, Prefix}</c></tag> + <item> + <p>All record names generated by the compiler are prefixed with + <c>Prefix</c>. This is useful when multiple protocols that contains + records with identical names are included in a single module.</p> + </item> </taglist> <p>Any additional option that is applied will be passed to the final step when the generated .erl file is compiled. diff --git a/lib/asn1/src/asn1ct_gen.erl b/lib/asn1/src/asn1ct_gen.erl index fefb92bb34..b9f6c46b53 100644 --- a/lib/asn1/src/asn1ct_gen.erl +++ b/lib/asn1/src/asn1ct_gen.erl @@ -1,26 +1,26 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% -module(asn1ct_gen). -include("asn1_records.hrl"). -%%-compile(export_all). + -export([pgen_exports/3, pgen_hrl/4, gen_head/3, @@ -1301,8 +1301,8 @@ put_chars(undefined,X) -> put_chars(Y,X) -> io:put_chars(Y,X). -fopen(F, Mode) -> - case file:open(F, Mode) of +fopen(F, ModeList) -> + case file:open(F, ModeList) of {ok, Fd} -> Fd; {error, Reason} -> @@ -1357,7 +1357,8 @@ pgen_hrltypes(Erules,Module,[H|T],NumRecords) -> %% Generates a macro for value Value defined in the ASN.1 module gen_macro(Value) when is_record(Value,valuedef) -> - emit({"-define('",Value#valuedef.name,"', ", + Prefix = get_macro_name_prefix(), + emit({"-define('",Prefix,Value#valuedef.name,"', ", {asis,Value#valuedef.value},").",nl}). %% Generate record functions ************** @@ -2064,3 +2065,11 @@ get_record_name_prefix() -> {value,{_,Prefix}} -> Prefix end. + +get_macro_name_prefix() -> + case lists:keysearch(macro_name_prefix,1,get(encoding_options)) of + false -> + ""; + {value,{_,Prefix}} -> + Prefix + end. diff --git a/lib/asn1/src/asn1rt_ber_bin.erl b/lib/asn1/src/asn1rt_ber_bin.erl index 71d78377d4..ab04d981b0 100644 --- a/lib/asn1/src/asn1rt_ber_bin.erl +++ b/lib/asn1/src/asn1rt_ber_bin.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2000-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -179,7 +179,7 @@ restbytes2(_RemBytes,Bytes,noext) -> exit({error,{asn1, {unexpected,Bytes}}}); restbytes2(RemBytes,Bytes,ext) -> %% {RemBytes,0}. - {RemBytes,size(Bytes)}. + {RemBytes,byte_size(Bytes)}. @@ -256,8 +256,6 @@ skip_ExtensionAdditions(Bytes,Tags,RmB) -> end end. - - %%=============================================================================== %%=============================================================================== %%=============================================================================== @@ -339,7 +337,7 @@ peek_tag(<<PartialTag,Buffer/binary>>, TagAck) -> peek_tag(Buffer,<<TagAck/binary,PartialTag>>); peek_tag(_,TagAck) -> exit({error,{asn1, {invalid_tag,TagAck}}}). -%%peek_tag([Tag|Buffer]) when (Tag band 31) == 31 -> +%%peek_tag([Tag|Buffer]) when (Tag band 31) =:= 31 -> %% [Tag band 2#11011111 | peek_tag(Buffer,[])]; %%%% single tag (tagno < 31) %%peek_tag([Tag|Buffer]) -> @@ -474,8 +472,7 @@ encode_tags2([Tag|Trest], BytesSoFar, LenSoFar) -> encode_tags2([], BytesSoFar, LenSoFar) -> {BytesSoFar,LenSoFar}. -encode_tags1([Tag1, Tag2| Trest], Acc) - when Tag1#tag.type == 'IMPLICIT' -> +encode_tags1([Tag1, Tag2| Trest], Acc) when Tag1#tag.type =:= 'IMPLICIT' -> encode_tags1([Tag1#tag{type=Tag2#tag.type,form=Tag2#tag.form}|Trest],Acc); encode_tags1([Tag1 | Trest], Acc) -> encode_tags1(Trest, [Tag1|Acc]); @@ -483,7 +480,7 @@ encode_tags1([], Acc) -> Acc. % the resulting tags are returned in reverse order encode_one_tag(Bin) when is_binary(Bin) -> - {Bin,size(Bin)}; + {Bin,byte_size(Bin)}; encode_one_tag(#tag{class=Class,number=No,type=Type, form = Form}) -> NewForm = case Type of 'EXPLICIT' -> @@ -506,11 +503,6 @@ encode_one_tag(#tag{class=Class,number=No,type=Type, form = Form}) -> % [encode_tag_val({NewClass, OldForm, NewTagNr}) | Buffer1]. - - - - - %%=============================================================================== %% %% This comment is valid for all the encode/decode functions @@ -533,20 +525,19 @@ encode_one_tag(#tag{class=Class,number=No,type=Type, form = Form}) -> %% This version does not consider Explicit tagging of the open type. It %% is only left because of backward compatibility. encode_open_type(Val) when is_list(Val) -> - {Val,size(list_to_binary(Val))}; + {Val, byte_size(list_to_binary(Val))}; encode_open_type(Val) -> - {Val, size(Val)}. + {Val, byte_size(Val)}. %% encode_open_type(Val, []) when is_list(Val) -> - {Val,size(list_to_binary(Val))}; -encode_open_type(Val,[]) -> - {Val, size(Val)}; + {Val, byte_size(list_to_binary(Val))}; +encode_open_type(Val, []) -> + {Val, byte_size(Val)}; encode_open_type(Val, Tag) when is_list(Val) -> - encode_tags(Tag,Val,size(list_to_binary(Val))); -encode_open_type(Val,Tag) -> - encode_tags(Tag,Val, size(Val)). - + encode_tags(Tag, Val, byte_size(list_to_binary(Val))); +encode_open_type(Val, Tag) -> + encode_tags(Tag, Val, byte_size(Val)). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -652,8 +643,6 @@ decode_boolean2(Buffer, _) -> exit({error,{asn1, {decode_boolean, Buffer}}}). - - %%=========================================================================== %% Integer, ITU_T X.690 Chapter 8.3 @@ -664,7 +653,7 @@ decode_boolean2(Buffer, _) -> %%=========================================================================== encode_integer(C, Val, []) when is_integer(Val) -> - {EncVal,Len}=encode_integer(C, Val), + {EncVal,Len} = encode_integer(C, Val), dotag_universal(?N_INTEGER,EncVal,Len); encode_integer(C, Val, Tag) when is_integer(Val) -> dotag(Tag, ?N_INTEGER, encode_integer(C, Val)); @@ -674,10 +663,9 @@ encode_integer(_, Val, _) -> exit({error,{asn1, {encode_integer, Val}}}). - encode_integer(C, Val, NamedNumberList, Tag) when is_atom(Val) -> - case lists:keysearch(Val, 1, NamedNumberList) of - {value,{_, NewVal}} -> + case lists:keyfind(Val, 1, NamedNumberList) of + {_, NewVal} -> dotag(Tag, ?N_INTEGER, encode_integer(C, NewVal)); _ -> exit({error,{asn1, {encode_integer_namednumber, Val}}}) @@ -688,8 +676,6 @@ encode_integer(C, Val, _NamedNumberList, Tag) -> dotag(Tag, ?N_INTEGER, encode_integer(C, Val)). - - encode_integer(_C, Val) -> Bytes = if @@ -716,7 +702,6 @@ encode_integer_neg(N, Acc) -> %% (Buffer, Range, NamedNumberList, HasTag, TotalLen) -> {Integer, Remain, RemovedBytes} %%=============================================================================== - decode_integer(Buffer, Range, Tags, OptOrMand) -> NewTags = new_tags(Tags,#tag{class=?UNIVERSAL,number=?N_INTEGER}), decode_integer_notag(Buffer, Range, [], NewTags, OptOrMand). @@ -748,8 +733,8 @@ resolve_named_value(Result={Val,Buffer,RemBytes},NamedNumberList) -> case NamedNumberList of [] -> Result; _ -> - NewVal = case lists:keysearch(Val, 2, NamedNumberList) of - {value,{NamedVal, _}} -> + NewVal = case lists:keyfind(Val, 2, NamedNumberList) of + {NamedVal, _} -> NamedVal; _ -> Val @@ -778,10 +763,10 @@ check_integer_constraint(Result={Val, _Buffer,_},Range) -> %% encode enumerated value %%============================================================================ -encode_enumerated(Val, []) when is_integer(Val)-> +encode_enumerated(Val, []) when is_integer(Val) -> {EncVal,Len} = encode_integer(false,Val), dotag_universal(?N_ENUMERATED,EncVal,Len); -encode_enumerated(Val, DoTag) when is_integer(Val)-> +encode_enumerated(Val, DoTag) when is_integer(Val) -> dotag(DoTag, ?N_ENUMERATED, encode_integer(false,Val)); encode_enumerated({Name,Val}, DoTag) when is_atom(Name) -> encode_enumerated(Val, DoTag). @@ -797,11 +782,11 @@ encode_enumerated(C, Val, {NamedNumberList,ExtList}, DoTag) when is_atom(Val) -> end; encode_enumerated(C, Val, NamedNumberList, DoTag) when is_atom(Val) -> - case lists:keysearch(Val, 1, NamedNumberList) of - {value, {_, NewVal}} when DoTag == []-> + case lists:keyfind(Val, 1, NamedNumberList) of + {_, NewVal} when DoTag =:= [] -> {EncVal,Len} = encode_integer(C,NewVal), dotag_universal(?N_ENUMERATED,EncVal,Len); - {value, {_, NewVal}} -> + {_, NewVal} -> dotag(DoTag, ?N_ENUMERATED, encode_integer(C, NewVal)); _ -> exit({error,{asn1, {enumerated_not_in_range, Val}}}) @@ -874,8 +859,8 @@ decode_enumerated_notag(Buffer, Range, NNList, Tags, OptOrMand) -> decode_enumerated1(Val, NamedNumberList) -> %% it must be a named integer - case lists:keysearch(Val, 2, NamedNumberList) of - {value,{NamedVal, _}} -> + case lists:keyfind(Val, 2, NamedNumberList) of + {NamedVal, _} -> NamedVal; _ -> {asn1_enum,Val} @@ -1220,32 +1205,32 @@ encode_bin_bit_string(C,{Unused,BinBits},_NamedBitList,DoTag)-> remove_unused_then_dotag(DoTag,StringType,Unused,BinBits) -> case Unused of - 0 when (size(BinBits) == 0),DoTag==[] -> + 0 when (byte_size(BinBits) =:= 0), DoTag =:= [] -> %% time optimization of next case {[StringType,1,0],3}; - 0 when (size(BinBits) == 0) -> + 0 when (byte_size(BinBits) =:= 0) -> dotag(DoTag,StringType,{<<0>>,1}); - 0 when DoTag==[]-> % time optimization of next case + 0 when DoTag =:= [] -> % time optimization of next case dotag_universal(StringType,[Unused|[BinBits]],size(BinBits)+1); % {LenEnc,Len} = encode_legth(size(BinBits)+1), % {[StringType,LenEnc,[Unused|BinBits]],size(BinBits)+1+Len+1}; 0 -> dotag(DoTag,StringType,<<Unused,BinBits/binary>>); - Num when DoTag == [] -> % time optimization of next case - N = (size(BinBits)-1), + Num when DoTag =:= [] -> % time optimization of next case + N = byte_size(BinBits) - 1, <<BBits:N/binary,LastByte>> = BinBits, dotag_universal(StringType, [Unused,BBits,(LastByte bsr Num) bsl Num], - size(BinBits)+1); + byte_size(BinBits) + 1); % {LenEnc,Len} = encode_legth(size(BinBits)+1), % {[StringType,LenEnc,[Unused,BBits,(LastByte bsr Num) bsl Num], % 1+Len+size(BinBits)+1}; Num -> - N = (size(BinBits)-1), + N = byte_size(BinBits) - 1, <<BBits:N/binary,LastByte>> = BinBits, dotag(DoTag,StringType,{[Unused,binary_to_list(BBits) ++ [(LastByte bsr Num) bsl Num]], - 1+size(BinBits)}) + byte_size(BinBits) + 1}) end. @@ -1291,8 +1276,8 @@ encode_bit_string_named(C, [FirstVal | RestVal], NamedBitList, DoTag) -> get_all_bitposes([{bit,ValPos}|Rest], NamedBitList, Ack) -> get_all_bitposes(Rest, NamedBitList, [ValPos | Ack ]); get_all_bitposes([Val | Rest], NamedBitList, Ack) when is_atom(Val) -> - case lists:keysearch(Val, 1, NamedBitList) of - {value, {_ValName, ValPos}} -> + case lists:keyfind(Val, 1, NamedBitList) of + {_ValName, ValPos} -> get_all_bitposes(Rest, NamedBitList, [ValPos | Ack]); _ -> exit({error,{asn1, {bitstring_namedbit, Val}}}) @@ -1320,10 +1305,6 @@ make_and_set_list(Len, [], XPos) -> [0 | make_and_set_list(Len - 1, [], XPos + 1)]. - - - - %%================================================================= %% Encode bit string for lists of ones and zeroes %%================================================================= @@ -1342,7 +1323,7 @@ encode_bit_string_bits(C, BitListVal, _NamedBitList, DoTag) when is_list(BitList encode_constr_bit_str_bits(Constr,BitListVal,DoTag); Size -> case length(BitListVal) of - BitSize when BitSize == Size -> + BitSize when BitSize =:= Size -> encode_bitstring(BitListVal); BitSize when BitSize < Size -> PaddedList = @@ -1399,7 +1380,7 @@ encode_constr_bit_str_bits({Min,Max},BitListVal,_DoTag) -> %% as the most significant elements followed by padded zero elements pad_bit_list(Size,BitListVal) -> Tail = lists:duplicate(Size,0), - lists:append(BitListVal,Tail). + BitListVal ++ Tail. %%================================================================= %% Do the actual encoding @@ -1513,7 +1494,6 @@ decode_bitstring2(Len, Unused, %% Decode the bitlist to names %%---------------------------------------- - decode_bitstring_NNL(BitList,NamedNumberList) -> decode_bitstring_NNL(BitList,NamedNumberList,0,[]). @@ -1523,15 +1503,15 @@ decode_bitstring_NNL([],_,_No,Result) -> decode_bitstring_NNL([B|BitList],[{Name,No}|NamedNumberList],No,Result) -> if - B == 0 -> + B =:= 0 -> decode_bitstring_NNL(BitList,NamedNumberList,No+1,Result); true -> decode_bitstring_NNL(BitList,NamedNumberList,No+1,[Name|Result]) end; decode_bitstring_NNL([1|BitList],NamedNumberList,No,Result) -> - decode_bitstring_NNL(BitList,NamedNumberList,No+1,[{bit,No}|Result]); + decode_bitstring_NNL(BitList,NamedNumberList,No+1,[{bit,No}|Result]); decode_bitstring_NNL([0|BitList],NamedNumberList,No,Result) -> - decode_bitstring_NNL(BitList,NamedNumberList,No+1,Result). + decode_bitstring_NNL(BitList,NamedNumberList,No+1,Result). %%============================================================================ @@ -1542,18 +1522,18 @@ decode_bitstring_NNL([0|BitList],NamedNumberList,No,Result) -> %% the function does not check this because it takes to much time %%============================================================================ encode_octet_string(_C, OctetList, []) when is_binary(OctetList) -> - dotag_universal(?N_OCTET_STRING,OctetList,size(OctetList)); + dotag_universal(?N_OCTET_STRING,OctetList,byte_size(OctetList)); encode_octet_string(_C, OctetList, DoTag) when is_binary(OctetList) -> - dotag(DoTag, ?N_OCTET_STRING, {OctetList,size(OctetList)}); + dotag(DoTag, ?N_OCTET_STRING, {OctetList,byte_size(OctetList)}); encode_octet_string(_C, OctetList, DoTag) when is_list(OctetList) -> case length(OctetList) of - Len when DoTag == [] -> + Len when DoTag =:= [] -> dotag_universal(?N_OCTET_STRING,OctetList,Len); Len -> dotag(DoTag, ?N_OCTET_STRING, {OctetList,Len}) end; -% encode_octet_string(C, OctetList, DoTag) when is_list(OctetList) -> -% dotag(DoTag, ?N_OCTET_STRING, {OctetList,length(OctetList)}); +%% encode_octet_string(C, OctetList, DoTag) when is_list(OctetList) -> +%% dotag(DoTag, ?N_OCTET_STRING, {OctetList,length(OctetList)}); encode_octet_string(C, {Name,OctetList}, DoTag) when is_atom(Name) -> encode_octet_string(C, OctetList, DoTag). @@ -1565,7 +1545,7 @@ encode_octet_string(C, {Name,OctetList}, DoTag) when is_atom(Name) -> %% Octet string is decoded as a restricted string %%============================================================================ decode_octet_string(Buffer, Range, Tags, TotalLen, OptOrMand) -> -% NewTags = new_tags(HasTag,#tag{class=?UNIVERSAL,number=?N_OCTET_STRING}), +%% NewTags = new_tags(HasTag,#tag{class=?UNIVERSAL,number=?N_OCTET_STRING}), decode_restricted_string(Buffer, Range, ?N_OCTET_STRING, Tags, TotalLen, [], OptOrMand,old). @@ -1753,17 +1733,17 @@ decode_relative_oid_notag(Buffer, Tags, OptOrMand) -> %%============================================================================ encode_restricted_string(_C, OctetList, StringType, []) when is_binary(OctetList) -> - dotag_universal(StringType,OctetList,size(OctetList)); + dotag_universal(StringType, OctetList, byte_size(OctetList)); encode_restricted_string(_C, OctetList, StringType, DoTag) when is_binary(OctetList) -> - dotag(DoTag, StringType, {OctetList, size(OctetList)}); + dotag(DoTag, StringType, {OctetList, byte_size(OctetList)}); encode_restricted_string(_C, OctetList, StringType, []) when is_list(OctetList) -> - dotag_universal(StringType,OctetList,length(OctetList)); + dotag_universal(StringType, OctetList, length(OctetList)); encode_restricted_string(_C, OctetList, StringType, DoTag) when is_list(OctetList) -> dotag(DoTag, StringType, {OctetList, length(OctetList)}); -encode_restricted_string(C,{Name,OctetL},StringType,DoTag) when is_atom(Name)-> +encode_restricted_string(C,{Name,OctetL},StringType,DoTag) when is_atom(Name) -> encode_restricted_string(C, OctetL, StringType, DoTag). %%============================================================================ @@ -1793,23 +1773,21 @@ decode_restricted_string_tag(Buffer, Range, StringType, TagsIn, LenIn, NNList, O LenIn, NNList, OptOrMand, BinOrOld). - - check_and_convert_restricted_string(Val,StringType,Range,NamedNumberList,_BinOrOld) -> {StrLen,NewVal} = case StringType of - ?N_BIT_STRING when NamedNumberList /= [] -> + ?N_BIT_STRING when NamedNumberList =/= [] -> {no_check,Val}; ?N_BIT_STRING when is_list(Val) -> {length(Val),Val}; ?N_BIT_STRING when is_tuple(Val) -> {(size(element(2,Val))*8) - element(1,Val),Val}; _ when is_binary(Val) -> - {size(Val),binary_to_list(Val)}; + {byte_size(Val),binary_to_list(Val)}; _ when is_list(Val) -> {length(Val), Val} end, case Range of - _ when StrLen == no_check -> + _ when StrLen =:= no_check -> NewVal; [] -> % No length constraint NewVal; @@ -1832,7 +1810,6 @@ check_and_convert_restricted_string(Val,StringType,Range,NamedNumberList,_BinOrO NewVal end. - %%============================================================================= %% Common routines for several string types including bit string %% handles indefinite length @@ -1840,7 +1817,7 @@ check_and_convert_restricted_string(Val,StringType,Range,NamedNumberList,_BinOrO decode_restricted_string_notag(Buffer, _Range, StringType, TagsIn, - _, NamedNumberList, OptOrMand,BinOrOld) -> + _, NamedNumberList, OptOrMand, BinOrOld) -> %%----------------------------------------------------------- %% Get inner (the implicit tag or no tag) and %% outer (the explicit tag) lengths. @@ -1891,7 +1868,7 @@ decode_restricted_parts(Buffer, RestBytes, [], StringType, RestTags, Len, NNList {concat_bit_binaries(AccVal, Val), AccRb+Rb}; _ when is_binary(Val),is_binary(AccVal) -> {<<AccVal/binary,Val/binary>>,AccRb+Rb}; - _ when is_binary(Val), AccVal==[] -> + _ when is_binary(Val), AccVal =:= [] -> {Val,AccRb+Rb}; _ -> {AccVal++Val, AccRb+Rb} @@ -1977,16 +1954,14 @@ mk_universal_string([A,B,C,D|T],Acc) -> %% encode UTF8 string %%============================================================================ encode_UTF8_string(_,UTF8String,[]) when is_binary(UTF8String) -> - dotag_universal(?N_UTF8String,UTF8String,size(UTF8String)); + dotag_universal(?N_UTF8String,UTF8String,byte_size(UTF8String)); encode_UTF8_string(_,UTF8String,DoTag) when is_binary(UTF8String) -> - dotag(DoTag,?N_UTF8String,{UTF8String,size(UTF8String)}); + dotag(DoTag,?N_UTF8String,{UTF8String,byte_size(UTF8String)}); encode_UTF8_string(_,UTF8String,[]) -> dotag_universal(?N_UTF8String,UTF8String,length(UTF8String)); encode_UTF8_string(_,UTF8String,DoTag) -> dotag(DoTag,?N_UTF8String,{UTF8String,length(UTF8String)}). - - %%============================================================================ %% decode UTF8 string %%============================================================================ @@ -2016,7 +1991,7 @@ decode_UTF8_string_notag(Buffer, Tags, OptOrMand) -> %% encode BMP string %%============================================================================ -encode_BMP_string(C, {Name,BMPString}, DoTag) when is_atom(Name)-> +encode_BMP_string(C, {Name,BMPString}, DoTag) when is_atom(Name) -> encode_BMP_string(C, BMPString, DoTag); encode_BMP_string(_C, BMPString, []) -> OctetList = mk_BMP_list(BMPString), @@ -2464,16 +2439,16 @@ concat_bit_binaries({U1,B1},{U2,B2}) -> S2 = (size(B2) * 8) - U2, PadBits = 8 - ((S1+S2) rem 8), {PadBits, <<B1:S1/binary-unit:1,B2:S2/binary-unit:1,0:PadBits>>}; -concat_bit_binaries(L1,L2) when is_list(L1),is_list(L2) -> +concat_bit_binaries(L1,L2) when is_list(L1), is_list(L2) -> %% this case occur when decoding with NNL L1 ++ L2. get_constraint(C,Key) -> - case lists:keysearch(Key,1,C) of + case lists:keyfind(Key,1,C) of false -> no; - {value,{_,V}} -> + {_, V} -> V end. @@ -2484,7 +2459,7 @@ get_constraint(C,Key) -> new_tags([],LastTag) -> [LastTag]; -new_tags(Tags=[#tag{type='IMPLICIT'}],_LastTag) -> +new_tags(Tags = [#tag{type='IMPLICIT'}],_LastTag) -> Tags; new_tags([T1 = #tag{type='IMPLICIT'},#tag{type=T2Type}|Rest],LastTag) -> new_tags([T1#tag{type=T2Type}|Rest],LastTag); diff --git a/lib/compiler/src/sys_expand_pmod.erl b/lib/compiler/src/sys_expand_pmod.erl index dbd5c1ec2f..4fee26f2a6 100644 --- a/lib/compiler/src/sys_expand_pmod.erl +++ b/lib/compiler/src/sys_expand_pmod.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(sys_expand_pmod). @@ -283,9 +283,13 @@ expr({cons,Line,H0,T0},St) -> T1 = expr(T0,St), {cons,Line,H1,T1}; expr({lc,Line,E0,Qs0},St) -> - Qs1 = lc_quals(Qs0,St), + Qs1 = lc_bc_quals(Qs0,St), E1 = expr(E0,St), {lc,Line,E1,Qs1}; +expr({bc,Line,E0,Qs0},St) -> + Qs1 = lc_bc_quals(Qs0,St), + E1 = expr(E0,St), + {bc,Line,E1,Qs1}; expr({tuple,Line,Es0},St) -> Es1 = expr_list(Es0,St), {tuple,Line,Es1}; @@ -391,14 +395,18 @@ icr_clauses([C0|Cs],St) -> [C1|icr_clauses(Cs,St)]; icr_clauses([],_St) -> []. -lc_quals([{generate,Line,P0,E0}|Qs],St) -> +lc_bc_quals([{generate,Line,P0,E0}|Qs],St) -> + E1 = expr(E0,St), + P1 = pattern(P0,St), + [{generate,Line,P1,E1}|lc_bc_quals(Qs,St)]; +lc_bc_quals([{b_generate,Line,P0,E0}|Qs],St) -> E1 = expr(E0,St), P1 = pattern(P0,St), - [{generate,Line,P1,E1}|lc_quals(Qs,St)]; -lc_quals([E0|Qs],St) -> + [{b_generate,Line,P1,E1}|lc_bc_quals(Qs,St)]; +lc_bc_quals([E0|Qs],St) -> E1 = expr(E0,St), - [E1|lc_quals(Qs,St)]; -lc_quals([],_St) -> []. + [E1|lc_bc_quals(Qs,St)]; +lc_bc_quals([],_St) -> []. fun_clauses([C0|Cs],St) -> C1 = clause(C0,St), diff --git a/lib/compiler/test/pmod_SUITE.erl b/lib/compiler/test/pmod_SUITE.erl index c8919e5539..293e110c45 100644 --- a/lib/compiler/test/pmod_SUITE.erl +++ b/lib/compiler/test/pmod_SUITE.erl @@ -1,31 +1,31 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(pmod_SUITE). -export([all/1,init_per_testcase/2,fin_per_testcase/2, - basic/1]). + basic/1, otp_8447/1]). -include("test_server.hrl"). all(suite) -> test_lib:recompile(?MODULE), - [basic]. + [basic, otp_8447]. init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> Dog = test_server:timetrap(?t:minutes(1)), @@ -38,8 +38,8 @@ fin_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> basic(Config) when is_list(Config) -> ?line basic_1(Config, []), - ?line basic_1(Config, [inline]), - ?line basic_1(Config, [{inline,500}]), +% ?line basic_1(Config, [inline]), +% ?line basic_1(Config, [{inline,500},inline]), ok. basic_1(Config, Opts) -> @@ -78,6 +78,12 @@ basic_1(Config, Opts) -> ok. +otp_8447(Config) when is_list(Config) -> + ?line P = pmod_basic:new(foo), + ?line [0,0,1,1,1,0,0,1] = P:bc1(), + ?line <<10:4>> = P:bc2(), + ok. + compile_load(Module, Conf, Opts) -> ?line Dir = ?config(data_dir,Conf), ?line Src = filename:join(Dir, atom_to_list(Module)), diff --git a/lib/compiler/test/pmod_SUITE_data/pmod_basic.erl b/lib/compiler/test/pmod_SUITE_data/pmod_basic.erl index e6f4c63421..0d46cffe00 100644 --- a/lib/compiler/test/pmod_SUITE_data/pmod_basic.erl +++ b/lib/compiler/test/pmod_SUITE_data/pmod_basic.erl @@ -1,25 +1,26 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(pmod_basic, [Props]). -export([lookup/1,or_props/1,prepend/1,append/1,stupid_sum/0]). -export([bar/1,bar_bar/1]). +-export([bc1/0, bc2/0]). lookup(Key) -> proplists:lookup(Key, Props). @@ -70,3 +71,9 @@ bar(S) when S#s.a == 0 -> ok. bar_bar(S) when is_record(S, s) -> ok; bar_bar(_) -> error. + +bc1() -> + [A || <<A:1>> <= <<"9">> ]. + +bc2() -> + << <<A:1>> || A <- [1,0,1,0] >>. diff --git a/lib/dialyzer/src/Makefile b/lib/dialyzer/src/Makefile index 2521a866f3..810f86dc21 100644 --- a/lib/dialyzer/src/Makefile +++ b/lib/dialyzer/src/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2006-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2006-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # #============================================================================= diff --git a/lib/dialyzer/src/dialyzer.app.src b/lib/dialyzer/src/dialyzer.app.src index bd8b79bf21..9222a28a77 100644 --- a/lib/dialyzer/src/dialyzer.app.src +++ b/lib/dialyzer/src/dialyzer.app.src @@ -1,20 +1,20 @@ %% This is an -*- erlang -*- file. %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer.erl b/lib/dialyzer/src/dialyzer.erl index 95955db7e9..3b7b68e8c4 100644 --- a/lib/dialyzer/src/dialyzer.erl +++ b/lib/dialyzer/src/dialyzer.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%----------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer.hrl b/lib/dialyzer/src/dialyzer.hrl index d50b8720f8..2da8ed2e5d 100644 --- a/lib/dialyzer/src/dialyzer.hrl +++ b/lib/dialyzer/src/dialyzer.hrl @@ -1,20 +1,20 @@ %%% This is an -*- Erlang -*- file. %%% %%% %CopyrightBegin% -%%% -%%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%%% +%%% +%%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%%% %%% The contents of this file are subject to the Erlang Public License, %%% Version 1.1, (the "License"); you may not use this file except in %%% compliance with the License. You should have received a copy of the %%% Erlang Public License along with this software. If not, it can be %%% retrieved online at http://www.erlang.org/. -%%% +%%% %%% Software distributed under the License is distributed on an "AS IS" %%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %%% the License for the specific language governing rights and limitations %%% under the License. -%%% +%%% %%% %CopyrightEnd% %%% %%%------------------------------------------------------------------- diff --git a/lib/dialyzer/src/dialyzer_analysis_callgraph.erl b/lib/dialyzer/src/dialyzer_analysis_callgraph.erl index db62dcebac..ab1bbe5ade 100644 --- a/lib/dialyzer/src/dialyzer_analysis_callgraph.erl +++ b/lib/dialyzer/src/dialyzer_analysis_callgraph.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%-------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_behaviours.erl b/lib/dialyzer/src/dialyzer_behaviours.erl index 61cdcf27c0..4e8dceaa8e 100644 --- a/lib/dialyzer/src/dialyzer_behaviours.erl +++ b/lib/dialyzer/src/dialyzer_behaviours.erl @@ -2,7 +2,7 @@ %%----------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/dialyzer/src/dialyzer_callgraph.erl b/lib/dialyzer/src/dialyzer_callgraph.erl index 696d504978..f932f43548 100644 --- a/lib/dialyzer/src/dialyzer_callgraph.erl +++ b/lib/dialyzer/src/dialyzer_callgraph.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%----------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_cl.erl b/lib/dialyzer/src/dialyzer_cl.erl index 724383d06a..d533e734db 100644 --- a/lib/dialyzer/src/dialyzer_cl.erl +++ b/lib/dialyzer/src/dialyzer_cl.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_cl_parse.erl b/lib/dialyzer/src/dialyzer_cl_parse.erl index 1f0da012d6..9a522e906a 100644 --- a/lib/dialyzer/src/dialyzer_cl_parse.erl +++ b/lib/dialyzer/src/dialyzer_cl_parse.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%----------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_codeserver.erl b/lib/dialyzer/src/dialyzer_codeserver.erl index 3b4b66cb68..3bc5fadc21 100644 --- a/lib/dialyzer/src/dialyzer_codeserver.erl +++ b/lib/dialyzer/src/dialyzer_codeserver.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%----------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_contracts.erl b/lib/dialyzer/src/dialyzer_contracts.erl index bad0a8d8cd..3486c72748 100644 --- a/lib/dialyzer/src/dialyzer_contracts.erl +++ b/lib/dialyzer/src/dialyzer_contracts.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%----------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_dataflow.erl b/lib/dialyzer/src/dialyzer_dataflow.erl index dada88c8bf..a57d9a96c6 100644 --- a/lib/dialyzer/src/dialyzer_dataflow.erl +++ b/lib/dialyzer/src/dialyzer_dataflow.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%-------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_dep.erl b/lib/dialyzer/src/dialyzer_dep.erl index 7d56376730..febb65b766 100644 --- a/lib/dialyzer/src/dialyzer_dep.erl +++ b/lib/dialyzer/src/dialyzer_dep.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%----------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_gui_wx.erl b/lib/dialyzer/src/dialyzer_gui_wx.erl index 5b807804e2..2e309d7ec1 100644 --- a/lib/dialyzer/src/dialyzer_gui_wx.erl +++ b/lib/dialyzer/src/dialyzer_gui_wx.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%------------------------------------------------------------------------ %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2009-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_options.erl b/lib/dialyzer/src/dialyzer_options.erl index 1f587d6df0..da0e1f9aaf 100644 --- a/lib/dialyzer/src/dialyzer_options.erl +++ b/lib/dialyzer/src/dialyzer_options.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%----------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_plt.erl b/lib/dialyzer/src/dialyzer_plt.erl index fed1e74b33..e387077a46 100644 --- a/lib/dialyzer/src/dialyzer_plt.erl +++ b/lib/dialyzer/src/dialyzer_plt.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%---------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_races.erl b/lib/dialyzer/src/dialyzer_races.erl index 303e64e68e..4972967960 100644 --- a/lib/dialyzer/src/dialyzer_races.erl +++ b/lib/dialyzer/src/dialyzer_races.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%----------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_succ_typings.erl b/lib/dialyzer/src/dialyzer_succ_typings.erl index 1670a6cf89..1ff4783852 100644 --- a/lib/dialyzer/src/dialyzer_succ_typings.erl +++ b/lib/dialyzer/src/dialyzer_succ_typings.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%----------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_typesig.erl b/lib/dialyzer/src/dialyzer_typesig.erl index 57d869b88a..35b283a00a 100644 --- a/lib/dialyzer/src/dialyzer_typesig.erl +++ b/lib/dialyzer/src/dialyzer_typesig.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%----------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/dialyzer/src/dialyzer_utils.erl b/lib/dialyzer/src/dialyzer_utils.erl index d6ddf76956..6ea243c26f 100644 --- a/lib/dialyzer/src/dialyzer_utils.erl +++ b/lib/dialyzer/src/dialyzer_utils.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %%----------------------------------------------------------------------- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% diff --git a/lib/docbuilder/vsn.mk b/lib/docbuilder/vsn.mk index 4c782f7481..2852ebcc8b 100644 --- a/lib/docbuilder/vsn.mk +++ b/lib/docbuilder/vsn.mk @@ -1,6 +1,8 @@ -DOCB_VSN = 0.9.8.6 +DOCB_VSN = 0.9.8.7 -TICKETS = OTP-8201 +TICKETS = OTP-8343 + +TICKETS_0.9.8.6 = OTP-8201 TICKETS_0.9.8.5 = OTP-7851 diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl index ee0ddd6915..38342870e5 100644 --- a/lib/hipe/cerl/erl_bif_types.erl +++ b/lib/hipe/cerl/erl_bif_types.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% ===================================================================== @@ -1771,8 +1771,29 @@ type(erts_debug, disassemble, 1, Xs) -> fun (_) -> t_sup([t_atom('false'), t_atom('undef'), t_tuple([t_integer(), t_binary(), t_mfa()])]) end); +type(erts_debug, dist_ext_to_term, 2, Xs) -> + strict(arg_types(erts_debug, dist_ext_to_term, 2), Xs, + fun (_) -> t_any() end); type(erts_debug, flat_size, 1, Xs) -> strict(arg_types(erts_debug, flat_size, 1), Xs, fun (_) -> t_integer() end); +type(erts_debug, lock_counters, 1, Xs) -> + strict(arg_types(erts_debug, lock_counters, 1), Xs, + fun ([Arg]) -> + case t_is_atom(Arg) of + true -> + case t_atom_vals(Arg) of + ['enabled'] -> t_boolean(); + ['info'] -> t_any(); + ['clear'] -> t_atom(ok); + _ -> t_sup([t_boolean(), t_any(), t_atom('ok')]) + end; + false -> + case t_is_tuple(Arg) of + true -> t_boolean(); + false -> t_sup([t_boolean(), t_any(), t_atom('ok')]) + end + end + end); type(erts_debug, same, 2, Xs) -> strict(arg_types(erts_debug, same, 2), Xs, fun (_) -> t_boolean() end); %%-- ets ---------------------------------------------------------------------- @@ -2672,6 +2693,8 @@ type(os, getenv, 1, Xs) -> type(os, getpid, 0, _) -> t_string(); type(os, putenv, 2, Xs) -> strict(arg_types(os, putenv, 2), Xs, fun (_) -> t_atom('true') end); +type(os, timestamp, 0, _) -> + t_time(); %%-- re ----------------------------------------------------------------------- type(re, compile, 1, Xs) -> strict(arg_types(re, compile, 1), Xs, @@ -3874,8 +3897,16 @@ arg_types(erts_debug, breakpoint, 2) -> [t_tuple([t_atom(), t_atom(), t_sup(t_integer(), t_atom('_'))]), t_boolean()]; arg_types(erts_debug, disassemble, 1) -> [t_sup(t_mfa(), t_integer())]; +arg_types(erts_debug, dist_ext_to_term, 2) -> + [t_tuple(), t_binary()]; arg_types(erts_debug, flat_size, 1) -> [t_any()]; +arg_types(erts_debug, lock_counters, 1) -> + [t_sup([t_atom(enabled), + t_atom(info), + t_atom(clear), + t_tuple([t_atom(copy_save), t_boolean()]), + t_tuple([t_atom(process_locks), t_boolean()])])]; arg_types(erts_debug, same, 2) -> [t_any(), t_any()]; %%------- ets ----------------------------------------------------------------- @@ -4298,6 +4329,8 @@ arg_types(os, getpid, 0) -> []; arg_types(os, putenv, 2) -> [t_string(), t_string()]; +arg_types(os, timestamp, 0) -> + []; %%-- re ----------------------------------------------------------------------- arg_types(re, compile, 1) -> [t_iodata()]; @@ -4916,7 +4949,8 @@ t_inet_setoption_packettype() -> t_integers([0,1,2,4]), t_atom('asn1'), t_atom('cdr'), t_atom('sunrm'), t_atom('fcgi'), t_atom('tpkt'), t_atom('line'), - t_atom('http')]). %% but t_atom('httph') is not needed + t_atom('http'), + t_atom('http_bin')]). %% but t_atom('httph') is not needed t_inet_posix_error() -> t_atom(). %% XXX: Very underspecified diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl index 871856da83..b4d80d359a 100644 --- a/lib/hipe/cerl/erl_types.erl +++ b/lib/hipe/cerl/erl_types.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% ====================================================================== diff --git a/lib/mnesia/doc/src/notes.xml b/lib/mnesia/doc/src/notes.xml index 69f2185cd8..66242398d9 100644 --- a/lib/mnesia/doc/src/notes.xml +++ b/lib/mnesia/doc/src/notes.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>Mnesia Release Notes</title> @@ -38,6 +38,35 @@ thus constitutes one section in this document. The title of each section is the version number of Mnesia.</p> + <section><title>Mnesia 4.4.13</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Transactions could be left hanging if a node went down + when invoking mnesia:sync_transaction/[1,2]. Thanks Igor + Ribeiro Sucupira.</p> + <p> + Own Id: OTP-8402</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Igor Ribeiro Sucupira added the option to compress data + when copying tables between Mnesia nodes.</p> + <p> + Own Id: OTP-8406</p> + </item> + </list> + </section> + + </section> <section><title>Mnesia 4.4.12</title> <section><title>Improvements and New Features</title> diff --git a/lib/mnesia/src/mnesia.appup.src b/lib/mnesia/src/mnesia.appup.src index cad63bf8df..b3b9297db2 100644 --- a/lib/mnesia/src/mnesia.appup.src +++ b/lib/mnesia/src/mnesia.appup.src @@ -1,14 +1,30 @@ %% -*- erlang -*- {"%VSN%", [ + {"4.4.12", + [ + {update, mnesia, soft, soft_purge, soft_purge, []}, + {update, mnesia_loader, soft, soft_purge, soft_purge, []}, + {update, mnesia_monitor, soft, soft_purge, soft_purge, []}, + {update, mnesia_tm, soft, soft_purge, soft_purge, []} + ] + }, {"4.4.11", [ + {update, mnesia, soft, soft_purge, soft_purge, []}, + {update, mnesia_loader, soft, soft_purge, soft_purge, []}, + {update, mnesia_monitor, soft, soft_purge, soft_purge, []}, + {update, mnesia_tm, soft, soft_purge, soft_purge, []}, {update, mnesia_locker, soft, soft_purge, soft_purge, []}, {update, mnesia_controller, soft, soft_purge, soft_purge, []} ] }, {"4.4.10", [ + {update, mnesia, soft, soft_purge, soft_purge, []}, + {update, mnesia_loader, soft, soft_purge, soft_purge, []}, + {update, mnesia_monitor, soft, soft_purge, soft_purge, []}, + {update, mnesia_tm, soft, soft_purge, soft_purge, []}, {update, mnesia_locker, soft, soft_purge, soft_purge, []}, {update, mnesia_controller, soft, soft_purge, soft_purge, []} ] @@ -18,14 +34,30 @@ {"4.4.7", [{restart_application, mnesia}]} ], [ + {"4.4.12", + [ + {update, mnesia, soft, soft_purge, soft_purge, []}, + {update, mnesia_loader, soft, soft_purge, soft_purge, []}, + {update, mnesia_monitor, soft, soft_purge, soft_purge, []}, + {update, mnesia_tm, soft, soft_purge, soft_purge, []} + ] + }, {"4.4.11", [ + {update, mnesia, soft, soft_purge, soft_purge, []}, + {update, mnesia_loader, soft, soft_purge, soft_purge, []}, + {update, mnesia_monitor, soft, soft_purge, soft_purge, []}, + {update, mnesia_tm, soft, soft_purge, soft_purge, []}, {update, mnesia_locker, soft, soft_purge, soft_purge, []}, {update, mnesia_controller, soft, soft_purge, soft_purge, []} ] }, {"4.4.10", [ + {update, mnesia, soft, soft_purge, soft_purge, []}, + {update, mnesia_loader, soft, soft_purge, soft_purge, []}, + {update, mnesia_monitor, soft, soft_purge, soft_purge, []}, + {update, mnesia_tm, soft, soft_purge, soft_purge, []}, {update, mnesia_locker, soft, soft_purge, soft_purge, []}, {update, mnesia_controller, soft, soft_purge, soft_purge, []} ] diff --git a/lib/mnesia/vsn.mk b/lib/mnesia/vsn.mk index 2de3658bf3..f82bd45c72 100644 --- a/lib/mnesia/vsn.mk +++ b/lib/mnesia/vsn.mk @@ -1,7 +1,8 @@ -MNESIA_VSN = 4.4.12 +MNESIA_VSN = 4.4.13 -TICKETS = OTP-8250 +TICKETS = OTP-8402 OTP-8406 OTP-8250 +#TICKETS_4.4.12 = OTP-8250 #TICKETS_4.4.11 = OTP-8074 #TICKETS_4.4.10 = OTP-7928 OTP-7968 OTP-8002 #TICKETS_4.4.9 = OTP-7911 diff --git a/lib/odbc/c_src/odbcserver.c b/lib/odbc/c_src/odbcserver.c index 6a920e6c76..aaaea20a10 100644 --- a/lib/odbc/c_src/odbcserver.c +++ b/lib/odbc/c_src/odbcserver.c @@ -119,6 +119,7 @@ #include <sys/socket.h> #include <sys/uio.h> #include <netdb.h> +#include <netinet/in.h> #endif #include <limits.h> diff --git a/lib/orber/doc/src/ch_install.xml b/lib/orber/doc/src/ch_install.xml index ab5885954b..dde4bf4006 100644 --- a/lib/orber/doc/src/ch_install.xml +++ b/lib/orber/doc/src/ch_install.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>Installing Orber</title> @@ -234,6 +234,16 @@ nodeB@hostB> orber:start(). <cell align="left" valign="middle">0</cell> </row> <row> + <cell align="left" valign="middle">iiop_out_ports_attempts</cell> + <cell align="left" valign="middle">integer() > 0</cell> + <cell align="left" valign="middle">1</cell> + </row> + <row> + <cell align="left" valign="middle">iiop_out_ports_random</cell> + <cell align="left" valign="middle">true | false</cell> + <cell align="left" valign="middle">false</cell> + </row> + <row> <cell align="left" valign="middle">iiop_max_fragments</cell> <cell align="left" valign="middle">integer() > 0 | infinity</cell> <cell align="left" valign="middle">infinity</cell> @@ -506,6 +516,13 @@ nodeB@hostB> orber:start(). If communicating via SSL, make sure you use a version that supports the local <c>{port, Port}</c> option. See also <seealso marker="ch_install#firewall">Firewall Configuration</seealso>.</item> + <tag><em>iiop_out_ports_random</em></tag> + <item>Requires that <c>iiop_out_ports</c> define a port range. If that is the + case Orber will select a port randomly from that sequence.</item> + <tag><em>iiop_out_ports_attempts</em></tag> + <item>Requires that <c>iiop_out_ports</c> define a port range. If so Orber will + accept a number of timeouts, defined by this parameter, when trying to connect + to another ORB.</item> <tag><em>iiop_max_fragments</em></tag> <item>Limits the number of IIOP fragments allowed per request.</item> <tag><em>iiop_max_in_requests</em></tag> diff --git a/lib/orber/doc/src/notes.xml b/lib/orber/doc/src/notes.xml index c7a2dab617..d388cc42a8 100644 --- a/lib/orber/doc/src/notes.xml +++ b/lib/orber/doc/src/notes.xml @@ -40,6 +40,13 @@ <list type="bulleted"> <item> <p> + Added the configuration parameters iiop_out_ports_attempts and + iiop_out_ports_random.</p> + <p> + Own Id: OTP-8448 Aux Id: seq11498</p> + </item> + <item> + <p> Removed obsolete SSL dependency.</p> <p> Own Id: OTP-8374 Aux Id:</p> diff --git a/lib/orber/doc/src/orber.xml b/lib/orber/doc/src/orber.xml index 05036667cc..5e38e4cf9f 100644 --- a/lib/orber/doc/src/orber.xml +++ b/lib/orber/doc/src/orber.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>orber</title> @@ -162,13 +162,33 @@ </func> <func> <name>iiop_out_ports() -> 0 | {Min, Max}</name> - <fsummary>Display the ports Orber may use when connecting to another ORB</fsummary> + <fsummary>Display the ports Orber may use when connecting to another ORB</fsummary> <desc> <p>The return value of this operation is what the configuration parameter <seealso marker="ch_install#config">iiop_out_ports</seealso> - have been set to.</p> + has been set to.</p> + </desc> + </func> + + <func> + <name>iiop_out_ports_random() -> true | false</name> + <fsummary>Determine if Orber should select local ports randomly</fsummary> + <desc> + <p>Return the value of the configuration parameter + <seealso marker="ch_install#config">iiop_out_ports_random</seealso>.</p> </desc> </func> + + <func> + <name>iiop_out_ports_attempts() -> int()</name> + <fsummary>Display if Orber should accept more than one timeout connecting to another ORB</fsummary> + <desc> + <p>Return the value of the configuration parameter + <seealso marker="ch_install#config">iiop_out_ports_attempts</seealso>.</p> + </desc> + </func> + + <func> <name>iiop_ssl_port() -> int()</name> <fsummary>Display the IIOP port number used for secure connections</fsummary> diff --git a/lib/orber/src/orber.erl b/lib/orber/src/orber.erl index e9c6822551..c3d37ad1fb 100644 --- a/lib/orber/src/orber.erl +++ b/lib/orber/src/orber.erl @@ -1,20 +1,20 @@ %%-------------------------------------------------------------------- %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -34,7 +34,8 @@ %% External exports %%----------------------------------------------------------------- -export([start/0, start/1, stop/0, install/1, install/2, orber_nodes/0, iiop_port/0, - domain/0, iiop_ssl_port/0, iiop_out_ports/0, + domain/0, iiop_ssl_port/0, iiop_out_ports/0, iiop_out_ports_random/0, + iiop_out_ports_attempts/0, ssl_server_certfile/0, ssl_client_certfile/0, set_ssl_client_certfile/1, ssl_server_verify/0, ssl_client_verify/0, set_ssl_client_verify/1, ssl_server_depth/0, ssl_client_depth/0, set_ssl_client_depth/1, @@ -305,6 +306,12 @@ nat_iiop_port() -> iiop_out_ports() -> orber_env:iiop_out_ports(). +iiop_out_ports_random() -> + orber_env:iiop_out_ports_random(). + +iiop_out_ports_attempts() -> + orber_env:iiop_out_ports_attempts(). + orber_nodes() -> case catch mnesia:table_info(orber_objkeys,ram_copies) of Nodes when is_list(Nodes) -> diff --git a/lib/orber/src/orber_env.erl b/lib/orber/src/orber_env.erl index 79f852eee0..d80edb4ee0 100644 --- a/lib/orber/src/orber_env.erl +++ b/lib/orber/src/orber_env.erl @@ -1,20 +1,20 @@ %%-------------------------------------------------------------------- %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -43,8 +43,8 @@ -export([iiop_acl/0, iiop_port/0, nat_iiop_port/0, nat_iiop_port/1, iiop_out_ports/0, domain/0, ip_address_variable_defined/0, nat_host/0, nat_host/1, host/0, - ip_address/0, ip_address/1, giop_version/0, iiop_timeout/0, - iiop_connection_timeout/0, iiop_setup_connection_timeout/0, + ip_address/0, ip_address/1, giop_version/0, iiop_timeout/0, iiop_out_ports_random/0, + iiop_connection_timeout/0, iiop_setup_connection_timeout/0, iiop_out_ports_attempts/0, iiop_in_connection_timeout/0, iiop_max_fragments/0, iiop_max_in_requests/0, iiop_max_in_connections/0, iiop_backlog/0, objectkeys_gc_time/0, get_ORBInitRef/0, get_ORBDefaultInitRef/0, get_interceptors/0, @@ -234,6 +234,8 @@ create_main_info() -> "IIOP out connection timeout...: ~p msec~n" "IIOP setup connection timeout.: ~p msec~n" "IIOP out ports................: ~p~n" + "IIOP out ports attempts.......: ~p~n" + "IIOP out ports random.........: ~p~n" "IIOP out connections..........: ~p~n" "IIOP out connections (pending): ~p~n" "IIOP out keepalive............: ~p~n" @@ -256,7 +258,8 @@ create_main_info() -> nat_host(), ip_address_local(), orber:orber_nodes(), Major, Minor, iiop_timeout(), iiop_connection_timeout(), - iiop_setup_connection_timeout(), iiop_out_ports(), + iiop_setup_connection_timeout(), iiop_out_ports(), + iiop_out_ports_attempts(), iiop_out_ports_random(), orber:iiop_connections(out), orber:iiop_connections_pending(), iiop_out_keepalive(), orber:iiop_connections(in), iiop_in_connection_timeout(), iiop_in_keepalive(), @@ -389,6 +392,23 @@ iiop_out_ports() -> 0 end. +iiop_out_ports_random() -> + case application:get_env(orber, iiop_out_ports_random) of + {ok, true} -> + true; + _ -> + false + end. + +iiop_out_ports_attempts() -> + case application:get_env(orber, iiop_out_ports_attempts) of + {ok, No} when is_integer(No) andalso No > 0 -> + No; + _ -> + 1 + end. + + domain() -> case application:get_env(orber, domain) of {ok, Domain} when is_list(Domain) -> @@ -1251,6 +1271,12 @@ configure(nat_ip_address, {local, Value1, Value2}, Status) when is_list(Value1) %% Set the range of ports we may use on this machine when connecting to a server. configure(iiop_out_ports, {Min, Max}, Status) when is_integer(Min) andalso is_integer(Max) -> do_safe_configure(iiop_out_ports, {Min, Max}, Status); +configure(iiop_out_ports_attempts, Max, Status) when is_integer(Max) andalso Max > 0 -> + do_safe_configure(iiop_out_ports_attempts, Max, Status); +configure(iiop_out_ports_random, true, Status) -> + do_safe_configure(iiop_out_ports_random, true, Status); +configure(iiop_out_ports_random, false, Status) -> + do_safe_configure(iiop_out_ports_random, false, Status); %% Set the lightweight option. configure(lightweight, Value, Status) when is_list(Value) -> do_safe_configure(lightweight, Value, Status); diff --git a/lib/orber/src/orber_socket.erl b/lib/orber/src/orber_socket.erl index 2a64bd4e75..af6df01b7d 100644 --- a/lib/orber/src/orber_socket.erl +++ b/lib/orber/src/orber_socket.erl @@ -1,20 +1,20 @@ %%-------------------------------------------------------------------- %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -82,17 +82,17 @@ connect(Type, Host, Port, Options) -> end, case orber:iiop_out_ports() of {Min, Max} when Type == normal -> - multi_connect(Min, Max, Type, Host, Port, - [binary, {reuseaddr, true}, - {packet,cdr}| Options2], Timeout); + multi_connect(get_port_sequence(Min, Max), orber_env:iiop_out_ports_attempts(), + Type, Host, Port, [binary, {reuseaddr, true}, + {packet,cdr}| Options2], Timeout); {Min, Max} when Generation > 2 -> - multi_connect(Min, Max, Type, Host, Port, - [binary, {reuseaddr, true}, - {packet,cdr}| Options2], Timeout); + multi_connect(get_port_sequence(Min, Max), orber_env:iiop_out_ports_attempts(), + Type, Host, Port, [binary, {reuseaddr, true}, + {packet,cdr}| Options2], Timeout); {Min, Max} -> %% reuseaddr not available for older SSL versions - multi_connect(Min, Max, Type, Host, Port, - [binary, {packet,cdr}| Options2], Timeout); + multi_connect(get_port_sequence(Min, Max), orber_env:iiop_out_ports_attempts(), + Type, Host, Port, [binary, {packet,cdr}| Options2], Timeout); _ -> connect(Type, Host, Port, [binary, {packet,cdr}| Options2], Timeout) end. @@ -130,17 +130,17 @@ connect(ssl, Host, Port, Options, Timeout) -> corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) end. -multi_connect(CurrentPort, Max, Type, Host, Port, Options, _) when CurrentPort > Max -> +multi_connect([], _Retries, Type, Host, Port, Options, _) -> orber:dbg("[~p] orber_socket:multi_connect(~p, ~p, ~p, ~p);~n" "Unable to use any of the sockets defined by 'iiop_out_ports'.~n" "Either all ports are in use or to many connections already exists.", [?LINE, Type, Host, Port, Options], ?DEBUG_LEVEL), corba:raise(#'IMP_LIMIT'{minor=(?ORBER_VMCID bor 1), completion_status=?COMPLETED_NO}); -multi_connect(CurrentPort, Max, normal, Host, Port, Options, Timeout) -> +multi_connect([CurrentPort|Rest], Retries, normal, Host, Port, Options, Timeout) -> case catch gen_tcp:connect(Host, Port, [{port, CurrentPort}|Options], Timeout) of {ok, Socket} -> Socket; - {error, timeout} -> + {error, timeout} when Retries =< 1 -> orber:dbg("[~p] orber_socket:multi_connect(normal, ~p, ~p, ~p);~n" "Timeout after ~p msec.", [?LINE, Host, Port, [{port, CurrentPort}|Options], @@ -148,13 +148,13 @@ multi_connect(CurrentPort, Max, normal, Host, Port, Options, Timeout) -> corba:raise(#'COMM_FAILURE'{minor=(?ORBER_VMCID bor 4), completion_status=?COMPLETED_NO}); _ -> - multi_connect(CurrentPort+1, Max, normal, Host, Port, Options, Timeout) + multi_connect(Rest, Retries - 1, normal, Host, Port, Options, Timeout) end; -multi_connect(CurrentPort, Max, ssl, Host, Port, Options, Timeout) -> +multi_connect([CurrentPort|Rest], Retries, ssl, Host, Port, Options, Timeout) -> case catch ssl:connect(Host, Port, [{port, CurrentPort}|Options], Timeout) of {ok, Socket} -> Socket; - {error, timeout} -> + {error, timeout} when Retries =< 1 -> orber:dbg("[~p] orber_socket:multi_connect(ssl, ~p, ~p, ~p);~n" "Timeout after ~p msec.", [?LINE, Host, Port, [{port, CurrentPort}|Options], @@ -162,10 +162,28 @@ multi_connect(CurrentPort, Max, ssl, Host, Port, Options, Timeout) -> corba:raise(#'COMM_FAILURE'{minor=(?ORBER_VMCID bor 4), completion_status=?COMPLETED_NO}); _ -> - multi_connect(CurrentPort+1, Max, ssl, Host, Port, Options, Timeout) + multi_connect(Rest, Retries - 1, ssl, Host, Port, Options, Timeout) end. +get_port_sequence(Min, Max) -> + case orber_env:iiop_out_ports_random() of + true -> + {A1,A2,A3} = now(), + random:seed(A1, A2, A3), + Seq = lists:seq(Min, Max), + random_sequence((Max - Min) + 1, Seq, []); + _ -> + lists:seq(Min, Max) + end. + +random_sequence(0, _, Acc) -> + Acc; +random_sequence(Length, Seq, Acc) -> + Nth = random:uniform(Length), + Value = lists:nth(Nth, Seq), + NewSeq = lists:delete(Value, Seq), + random_sequence(Length-1, NewSeq, [Value|Acc]). %%----------------------------------------------------------------- %% Create a listen socket at Port in CDR mode for diff --git a/lib/orber/vsn.mk b/lib/orber/vsn.mk index b56172d7cf..d074bfb86c 100644 --- a/lib/orber/vsn.mk +++ b/lib/orber/vsn.mk @@ -4,7 +4,8 @@ ORBER_VSN = 3.6.15 TICKETS = OTP-8353 \ OTP-8354 \ OTP-8374 \ - OTP-8409 + OTP-8409 \ + OTP-8448 TICKETS_3.6.14 = OTP-8201 diff --git a/lib/os_mon/src/cpu_sup.erl b/lib/os_mon/src/cpu_sup.erl index 742e20b1fa..e414e2c10b 100644 --- a/lib/os_mon/src/cpu_sup.erl +++ b/lib/os_mon/src/cpu_sup.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(cpu_sup). @@ -65,15 +65,10 @@ %% Contract specifications %%---------------------------------------------------------------------- --type(util_cpus() :: 'all' | integer() | [integer()]). --type(util_state() :: - 'user' | - 'nice_user' | - 'kernel' | - 'wait' | - 'idle'). --type(util_value() :: {util_state(), float()} | float()). --type(util_desc() :: {util_cpus(), util_value(), util_value(), []}). +-type util_cpus() :: 'all' | integer() | [integer()]. +-type util_state() :: 'user' | 'nice_user' | 'kernel' | 'wait' | 'idle'. +-type util_value() :: {util_state(), float()} | float(). +-type util_desc() :: {util_cpus(), util_value(), util_value(), []}. %%---------------------------------------------------------------------- %% Exported functions @@ -88,28 +83,28 @@ start_link() -> stop() -> gen_server:call(cpu_sup, ?quit, infinity). --spec(nprocs/0 :: () -> integer() | {'error', any()}). +-spec nprocs() -> integer() | {'error', any()}. nprocs() -> os_mon:call(cpu_sup, ?nprocs, infinity). --spec(avg1/0 :: () -> integer() | {'error', any()}). +-spec avg1() -> integer() | {'error', any()}. avg1() -> os_mon:call(cpu_sup, ?avg1, infinity). --spec(avg5/0 :: () -> integer() | {'error', any()}). +-spec avg5() -> integer() | {'error', any()}. avg5() -> os_mon:call(cpu_sup, ?avg5, infinity). --spec(avg15/0 :: () -> integer() | {'error', any()}). +-spec avg15() -> integer() | {'error', any()}. avg15() -> os_mon:call(cpu_sup, ?avg15, infinity). --spec(util/1 :: ([ 'detailed' | 'per_cpu']) -> - util_desc() | [util_desc()] | {'error', any()}). +-spec util(['detailed' | 'per_cpu']) -> + util_desc() | [util_desc()] | {'error', any()}. util(Args) when is_list (Args) -> % Get arguments @@ -126,7 +121,7 @@ util(Args) when is_list (Args) -> util(_) -> erlang:error(badarg). --spec(util/0 :: () -> float()). +-spec util() -> float(). util() -> case util([]) of diff --git a/lib/parsetools/include/yeccpre.hrl b/lib/parsetools/include/yeccpre.hrl index 2ffa13d6a7..33a103d95f 100644 --- a/lib/parsetools/include/yeccpre.hrl +++ b/lib/parsetools/include/yeccpre.hrl @@ -1,52 +1,51 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The parser generator will insert appropriate declarations before this line.% --type(yecc_ret() :: {'error', _} | {'ok', _}). +-type yecc_ret() :: {'error', _} | {'ok', _}. -spec parse(Tokens :: list()) -> yecc_ret(). parse(Tokens) -> yeccpars0(Tokens, {no_func, no_line}, 0, [], []). --spec(parse_and_scan/1 :: - ({function() | {atom(), atom()}, [_]} | {atom(), atom(), [_]}) -> - yecc_ret()). +-spec parse_and_scan({function() | {atom(), atom()}, [_]} | {atom(), atom(), [_]}) -> + yecc_ret(). parse_and_scan({F, A}) -> % Fun or {M, F} yeccpars0([], {{F, A}, no_line}, 0, [], []); parse_and_scan({M, F, A}) -> yeccpars0([], {{{M, F}, A}, no_line}, 0, [], []). --spec(format_error/1 :: (any()) -> [char() | list()]). +-spec format_error(any()) -> [char() | list()]. format_error(Message) -> case io_lib:deep_char_list(Message) of - true -> - Message; - _ -> - io_lib:write(Message) + true -> + Message; + _ -> + io_lib:write(Message) end. -% To be used in grammar files to throw an error message to the parser -% toplevel. Doesn't have to be exported! --compile({nowarn_unused_function, return_error/2}). --spec(return_error/2 :: (integer(), any()) -> no_return()). +%% To be used in grammar files to throw an error message to the parser +%% toplevel. Doesn't have to be exported! +-compile({nowarn_unused_function,{return_error,2}}). +-spec return_error(integer(), any()) -> no_return(). return_error(Line, Message) -> throw({error, {Line, ?MODULE, Message}}). @@ -85,7 +84,7 @@ yeccpars1([Token | Tokens], Tzr, State, States, Vstack) -> yeccpars1([], {{F, A},_Line}, State, States, Vstack) -> case apply(F, A) of {ok, Tokens, Endline} -> - yeccpars1(Tokens, {{F, A}, Endline}, State, States, Vstack); + yeccpars1(Tokens, {{F, A}, Endline}, State, States, Vstack); {eof, Endline} -> yeccpars1([], {no_func, Endline}, State, States, Vstack); {error, Descriptor, _Endline} -> @@ -118,7 +117,7 @@ yeccpars1(State1, State, States, Vstack, Token0, [], {no_func, Line}) -> yeccpars2(State, '$end', [State1 | States], [Token0 | Vstack], yecc_end(Line), [], {no_func, Line}). -% For internal use only. +%% For internal use only. yecc_end({Line,_Column}) -> {'$end', Line}; yecc_end(Line) -> diff --git a/lib/parsetools/src/yecc.erl b/lib/parsetools/src/yecc.erl index f4d76f471d..b8b2b2308c 100644 --- a/lib/parsetools/src/yecc.erl +++ b/lib/parsetools/src/yecc.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% Yacc like LALR-1 parser generator for Erlang. @@ -30,8 +30,8 @@ -import(lists, [append/1, append/2, concat/1, delete/2, filter/2, flatmap/2, foldl/3, foldr/3, foreach/2, keydelete/3, - keysearch/3, keysort/2, last/1, map/2, member/2, - reverse/1, sort/1, usort/1]). + keysort/2, last/1, map/2, member/2, reverse/1, + sort/1, usort/1]). -include("erl_compile.hrl"). -include("ms_transform.hrl"). @@ -297,18 +297,18 @@ options(Options0, [Key | Keys], L) when is_list(Options0) -> false -> Options0 end, - V = case keysearch(Key, 1, Options) of - {value, {Key, Filename0}} when Key =:= includefile; - Key =:= parserfile -> + V = case lists:keyfind(Key, 1, Options) of + {Key, Filename0} when Key =:= includefile; + Key =:= parserfile -> case is_filename(Filename0) of no -> badarg; Filename -> {ok, [{Key, Filename}]} end; - {value, {Key, Bool}} when Bool =:= true; Bool =:= false -> - {ok, [{Key, Bool}]}; - {value, {Key, _}} -> + {Key, Bool} = KB when is_boolean(Bool) -> + {ok, [KB]}; + {Key, _} -> badarg; false -> {ok, [{Key, default_option(Key)}]} @@ -348,8 +348,7 @@ atom_option(verbose) -> {verbose, true}; atom_option(Key) -> Key. is_filename(T) -> - try filename:flatten(T) of - Filename -> Filename + try filename:flatten(T) catch error: _ -> no end. @@ -366,8 +365,8 @@ shorten_filename(Name0) -> start(Infilex, Options) -> Infile = assure_extension(Infilex, ".yrl"), - {value, {_, Outfilex0}} = keysearch(parserfile, 1, Options), - {value, {_, Includefilex}} = keysearch(includefile, 1, Options), + {_, Outfilex0} = lists:keyfind(parserfile, 1, Options), + {_, Includefilex} = lists:keyfind(includefile, 1, Options), Outfilex = case Outfilex0 of [] -> filename:rootname(Infilex, ".yrl"); _ -> Outfilex0 @@ -715,14 +714,14 @@ names(Symbols) -> map(fun(Symbol) -> Symbol#symbol.name end, Symbols). symbol_line(Name, St) -> - {value, #symbol{line = Line}} = symbol_search(Name, St#yecc.all_symbols), + #symbol{line = Line} = symbol_find(Name, St#yecc.all_symbols), Line. symbol_member(Symbol, Symbols) -> - symbol_search(Symbol#symbol.name, Symbols) =/= false. + symbol_find(Symbol#symbol.name, Symbols) =/= false. -symbol_search(Name, Symbols) -> - keysearch(Name, #symbol.name, Symbols). +symbol_find(Name, Symbols) -> + lists:keyfind(Name, #symbol.name, Symbols). states_and_goto_table(St0) -> St1 = create_symbol_table(St0), @@ -876,8 +875,8 @@ add_warnings(SymNames, W0, St0) -> check_rhs([#symbol{name = '$empty'}], St) -> St; check_rhs(Rhs, St0) -> - case symbol_search('$empty', Rhs) of - {value, #symbol{line = Line}} -> + case symbol_find('$empty', Rhs) of + #symbol{line = Line} -> add_error(Line, illegal_empty, St0); false -> foldl(fun(Sym, St) -> @@ -1096,10 +1095,10 @@ compute_states2([{Sym,Seed} | Seeds], N, Try, CurrState, StateTab, Tables) -> compute_states2(Seeds, N, Try, CurrState, StateTab, Tables); {merge, M, NewCurrent} -> %% io:fwrite(<<"Merging with state ~w\n">>, [M]), - Try1 = case keysearch(M, 1, Try) of + Try1 = case lists:keyfind(M, 1, Try) of false -> [{M, NewCurrent} | Try]; - {value, {_, OldCurrent}} -> + {_, OldCurrent} -> case ordsets:is_subset(NewCurrent, OldCurrent) of true -> Try; diff --git a/lib/parsetools/src/yeccparser.erl b/lib/parsetools/src/yeccparser.erl index 80a6bbce0e..415547b4ce 100644 --- a/lib/parsetools/src/yeccparser.erl +++ b/lib/parsetools/src/yeccparser.erl @@ -16,53 +16,52 @@ line_of(Token) -> -file("/clearcase/otp/erts/lib/parsetools/include/yeccpre.hrl", 0). %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The parser generator will insert appropriate declarations before this line.% --type(yecc_ret() :: {'error', _} | {'ok', _}). +-type yecc_ret() :: {'error', _} | {'ok', _}. --spec(parse/1 :: (_) -> yecc_ret()). +-spec parse(_) -> yecc_ret(). parse(Tokens) -> yeccpars0(Tokens, false). --spec(parse_and_scan/1 :: - ({function() | {atom(), atom()}, [_]} | {atom(), atom(), [_]}) -> - yecc_ret()). +-spec parse_and_scan({function() | {atom(), atom()}, [_]} | {atom(), atom(), [_]}) -> + yecc_ret(). parse_and_scan({F, A}) -> % Fun or {M, F} yeccpars0([], {F, A}); parse_and_scan({M, F, A}) -> yeccpars0([], {{M, F}, A}). --spec(format_error/1 :: (any()) -> [char() | list()]). +-spec format_error(any()) -> [char() | list()]. format_error(Message) -> case io_lib:deep_char_list(Message) of - true -> - Message; - _ -> - io_lib:write(Message) + true -> + Message; + _ -> + io_lib:write(Message) end. -% To be used in grammar files to throw an error message to the parser -% toplevel. Doesn't have to be exported! +%% To be used in grammar files to throw an error message to the parser +%% toplevel. Doesn't have to be exported! -compile({nowarn_unused_function,{return_error,2}}). --spec(return_error/2 :: (integer(), any()) -> no_return()). +-spec return_error(integer(), any()) -> no_return(). return_error(Line, Message) -> throw({error, {Line, ?MODULE, Message}}). @@ -101,7 +100,7 @@ yeccpars1([Token | Tokens], Tokenizer, State, States, Vstack) -> yeccpars1([], {F, A}, State, States, Vstack) -> case apply(F, A) of {ok, Tokens, _Endline} -> - yeccpars1(Tokens, {F, A}, State, States, Vstack); + yeccpars1(Tokens, {F, A}, State, States, Vstack); {eof, _Endline} -> yeccpars1([], false, State, States, Vstack); {error, Descriptor, _Endline} -> @@ -123,7 +122,7 @@ yeccpars1(State1, State, States, Vstack, Stack1, [Token | Tokens], yeccpars1(State1, State, States, Vstack, Stack1, [], {F, A}) -> case apply(F, A) of {ok, Tokens, _Endline} -> - yeccpars1(State1, State, States, Vstack, Stack1, Tokens, {F, A}); + yeccpars1(State1, State, States, Vstack, Stack1, Tokens, {F, A}); {eof, _Endline} -> yeccpars1(State1, State, States, Vstack, Stack1, [], false); {error, Descriptor, _Endline} -> diff --git a/lib/percept/src/egd.erl b/lib/percept/src/egd.erl index 7972fde597..4fb5b6c46a 100644 --- a/lib/percept/src/egd.erl +++ b/lib/percept/src/egd.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% @@ -46,10 +46,10 @@ %% @type color() %% @type render_option() = {render_engine, opaque} | {render_engine, alpha} --type(egd_image() :: pid()). --type(point() :: {non_neg_integer(), non_neg_integer()}). --type(render_option() :: {'render_engine', 'opaque'} | {'render_engine', 'alpha'}). --type(color() :: {float(), float(), float(), float()}). +-type egd_image() :: pid(). +-type point() :: {non_neg_integer(), non_neg_integer()}. +-type render_option() :: {'render_engine', 'opaque'} | {'render_engine', 'alpha'}. +-type color() :: {float(), float(), float(), float()}. %%========================================================================== %% @@ -60,7 +60,7 @@ %% @spec create(integer(), integer()) -> egd_image() %% @doc Creates an image area and returns its reference. --spec(create/2 :: (Width :: integer(), Height :: integer()) -> egd_image()). +-spec create(Width :: integer(), Height :: integer()) -> egd_image(). create(Width,Height) -> spawn_link(fun() -> init(trunc(Width),trunc(Height)) end). @@ -69,16 +69,17 @@ create(Width,Height) -> %% @spec destroy(egd_image()) -> ok %% @doc Destroys the image. --spec(destroy/1 :: (Image :: egd_image()) -> ok). +-spec destroy(Image :: egd_image()) -> ok. destroy(Image) -> cast(Image, destroy), ok. -%% @spec render(egd_image()) -> binary() +%% @spec render(egd_image()) -> binary() %% @equiv render(Image, png, [{render_engine, opaque}]) +-spec render(Image :: egd_image()) -> binary(). render(Image) -> render(Image, png, [{render_engine, opaque}]). @@ -94,10 +95,10 @@ render(Image, Type) -> %% binary can either be a raw bitmap with rgb tripplets or a binary in png %% format. --spec(render/3 :: ( +-spec render( Image :: egd_image(), Type :: 'png' | 'raw_bitmap' | 'eps', - Options :: [render_option()]) -> binary()). + Options :: [render_option()]) -> binary(). render(Image, Type, Options) -> {render_engine, RenderType} = proplists:lookup(render_engine, Options), @@ -116,11 +117,11 @@ information(Pid) -> %% @spec line(egd_image(), point(), point(), color()) -> ok %% @doc Creates a line object from P1 to P2 in the image. --spec(line/4 :: ( +-spec line( Image :: egd_image(), P1 :: point(), P2 :: point(), - Color :: color()) -> 'ok'). + Color :: color()) -> 'ok'. line(Image, P1, P2, Color) -> cast(Image, {line, P1, P2, Color}), @@ -132,9 +133,8 @@ line(Image, P1, P2, Color) -> %% Name = black | silver | gray | white | maroon | red | purple | fuchia | green | lime | olive | yellow | navy | blue | teal | aqua %% @doc Creates a color reference. --spec(color/1 :: ( - Value :: {byte(), byte(), byte()} | {byte(), byte(), byte(), byte()} | atom()) -> - color()). +-spec color(Value :: {byte(), byte(), byte()} | {byte(), byte(), byte(), byte()} | atom()) -> + color(). color(Color) -> egd_primitives:color(Color). diff --git a/lib/percept/src/egd.hrl b/lib/percept/src/egd.hrl index 274986db65..2e8f5ebc50 100644 --- a/lib/percept/src/egd.hrl +++ b/lib/percept/src/egd.hrl @@ -1,24 +1,24 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% --type(rgba_float() :: {float(), float(), float(), float()}). --type(rgba_byte() :: {byte(), byte(), byte(), byte()}). --type(rgb() :: {byte(), byte(), byte()}). +-type rgba_float() :: {float(), float(), float(), float()}. +-type rgba_byte() :: {byte(), byte(), byte(), byte()}. +-type rgb() :: {byte(), byte(), byte()}. -record(image_object, { type, diff --git a/lib/percept/src/egd_render.erl b/lib/percept/src/egd_render.erl index 4a0247dd33..7fd1072ab1 100644 --- a/lib/percept/src/egd_render.erl +++ b/lib/percept/src/egd_render.erl @@ -29,7 +29,8 @@ -include("egd.hrl"). -define('DummyC',0). -binary(Image) -> binary(Image, opaque). +binary(Image) -> + binary(Image, opaque). binary(Image, Type) -> parallel_binary(precompile(Image),Type). @@ -42,9 +43,8 @@ parallel_binary(Image = #image{ height = Height },Type) -> W = Image#image.width, Bg = Image#image.background, Os = Image#image.objects, - erlang:list_to_binary(lists:map(fun - (Y) -> scanline(Y, Os, {0,0,W - 1, Bg}, Type) - end, lists:seq(1, Height))); + erlang:list_to_binary([scanline(Y, Os, {0,0,W - 1, Bg}, Type) + || Y <- lists:seq(1, Height)]); Np -> Pids = start_workers(Np, Type), Handler = handle_workers(Height, Pids), @@ -54,7 +54,9 @@ parallel_binary(Image = #image{ height = Height },Type) -> Res end. -start_workers(Np, Type) -> start_workers(Np, Type, []). +start_workers(Np, Type) -> + start_workers(Np, Type, []). + start_workers( 0, _, Pids) -> Pids; start_workers(Np, Type, Pids) when Np > 0 -> start_workers(Np - 1, Type, [spawn_link(fun() -> worker(Type) end)|Pids]). @@ -90,7 +92,9 @@ init_workers(Image, Handler, [Pid|Pids]) -> Handler ! {Pid, scan_complete}, init_workers(Image, Handler, Pids). -handle_workers(H, Pids) -> spawn_link(fun() -> handle_workers(H, H, length(Pids)) end). +handle_workers(H, Pids) -> + spawn_link(fun() -> handle_workers(H, H, length(Pids)) end). + handle_workers(_, 0, _) -> ok; handle_workers(H, Hi, Np) when H > 0 -> N = trunc(Hi/(2*Np)), @@ -110,7 +114,9 @@ finish_workers([Pid|Pids]) -> Pid ! {self(), done}, finish_workers(Pids). -receive_binaries(H) -> receive_binaries(H, []). +receive_binaries(H) -> + receive_binaries(H, []). + receive_binaries(0, Bins) -> erlang:list_to_binary(Bins); receive_binaries(H, Bins) when H > 0 -> receive @@ -118,7 +124,6 @@ receive_binaries(H, Bins) when H > 0 -> receive_binaries(H - 1, [Bin|Bins]) end. - scanline(Y, Os, {_,_,Width,_}=LSB, Type) -> OLSs = parse_objects_on_line(Y-1, Width, Os), RLSs = resulting_line_spans([LSB|OLSs],Type), @@ -190,7 +195,6 @@ modify_layers(Layers,[{{_,Z,start},C}|Trans]) -> modify_layers(Layers,[{{_,Z,stop },C}|Trans]) -> modify_layers(remove_layer(Layers, Z, C), Trans). - add_layer([{Z1,_}=H|Layers],Z,C) when Z1 > Z -> [H|add_layer(Layers,Z,C)]; add_layer(Layers,Z,C) -> diff --git a/lib/percept/src/percept.erl b/lib/percept/src/percept.erl index af1a920efd..f5e0f7e469 100644 --- a/lib/percept/src/percept.erl +++ b/lib/percept/src/percept.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% @@ -50,7 +50,7 @@ %% @type percept_option() = procs | ports | exclusive --type(percept_option() :: 'procs' | 'ports' | 'exclusive' | 'scheduler'). +-type percept_option() :: 'procs' | 'ports' | 'exclusive' | 'scheduler'. %%========================================================================== %% @@ -85,8 +85,8 @@ stop(_State) -> %% profiling --spec(profile/1 :: (Filename :: string()) -> - {'ok', port()} | {'already_started', port()}). +-spec profile(Filename :: file:filename()) -> + {'ok', port()} | {'already_started', port()}. profile(Filename) -> percept_profile:start(Filename, [procs]). @@ -94,10 +94,9 @@ profile(Filename) -> %% @spec profile(Filename::string(), [percept_option()]) -> {ok, Port} | {already_started, Port} %% @see percept_profile --spec(profile/2 :: ( - Filename :: string(), - Options :: [percept_option()]) -> - {'ok', port()} | {'already_started', port()}). +-spec profile(Filename :: file:filename(), + Options :: [percept_option()]) -> + {'ok', port()} | {'already_started', port()}. profile(Filename, Options) -> percept_profile:start(Filename, Options). @@ -105,16 +104,15 @@ profile(Filename, Options) -> %% @spec profile(Filename::string(), MFA::mfa(), [percept_option()]) -> ok | {already_started, Port} | {error, not_started} %% @see percept_profile --spec(profile/3 :: ( - Filename :: string(), - Entry :: {atom(), atom(), list()}, - Options :: [percept_option()]) -> - 'ok' | {'already_started', port()} | {'error', 'not_started'}). +-spec profile(Filename :: file:filename(), + Entry :: {atom(), atom(), list()}, + Options :: [percept_option()]) -> + 'ok' | {'already_started', port()} | {'error', 'not_started'}. profile(Filename, MFA, Options) -> percept_profile:start(Filename, MFA, Options). --spec(stop_profile/0 :: () -> 'ok' | {'error', 'not_started'}). +-spec stop_profile() -> 'ok' | {'error', 'not_started'}. %% @spec stop_profile() -> ok | {'error', 'not_started'} %% @see percept_profile @@ -125,8 +123,8 @@ stop_profile() -> %% @spec analyze(string()) -> ok | {error, Reason} %% @doc Analyze file. --spec(analyze/1 :: (Filename :: string()) -> - 'ok' | {'error', any()}). +-spec analyze(Filename :: file:filename()) -> + 'ok' | {'error', any()}. analyze(Filename) -> case percept_db:start() of @@ -142,9 +140,8 @@ analyze(Filename) -> %% Reason = term() %% @doc Starts webserver. --spec(start_webserver/0 :: () -> - {'started', string(), pos_integer()} | - {'error', any()}). +-spec start_webserver() -> + {'started', string(), pos_integer()} | {'error', any()}. start_webserver() -> start_webserver(0). @@ -156,9 +153,8 @@ start_webserver() -> %% @doc Starts webserver. If port number is 0, an available port number will %% be assigned by inets. --spec(start_webserver/1 :: (Port :: non_neg_integer()) -> - {'started', string(), pos_integer()} | - {'error', any()}). +-spec start_webserver(Port :: non_neg_integer()) -> + {'started', string(), pos_integer()} | {'error', any()}. start_webserver(Port) when is_integer(Port) -> application:load(percept), @@ -255,20 +251,20 @@ trace_parser(Trace, {Count, Pid}) -> find_service_pid_from_port([], _) -> undefined; find_service_pid_from_port([{_, Pid, Options} | Services], Port) -> - case lists:keysearch(port, 1, Options) of + case lists:keyfind(port, 1, Options) of false -> find_service_pid_from_port(Services, Port); - {value, {port, Port}} -> + {port, Port} -> Pid end. find_service_port_from_pid([], _) -> undefined; find_service_port_from_pid([{_, Pid, Options} | _], Pid) -> - case lists:keysearch(port, 1, Options) of + case lists:keyfind(port, 1, Options) of false -> undefined; - {value, {port, Port}} -> + {port, Port} -> Port end; find_service_port_from_pid([{_, _, _} | Services], Pid) -> diff --git a/lib/percept/src/percept.hrl b/lib/percept/src/percept.hrl index a9afceb6d1..36b6f63a4d 100644 --- a/lib/percept/src/percept.hrl +++ b/lib/percept/src/percept.hrl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% @@ -23,10 +23,10 @@ %%% Type definitions %%% %%% ------------------- %%% --type(timestamp() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}). --type(true_mfa() :: {atom(), atom(), byte() | list()}). --type(state() :: 'active' | 'inactive'). --type(scheduler_id() :: {'scheduler_id', non_neg_integer()}). +-type timestamp() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}. +-type true_mfa() :: {atom(), atom(), byte() | list()}. +-type state() :: 'active' | 'inactive'. +-type scheduler_id() :: {'scheduler_id', non_neg_integer()}. %%% ------------------- %%% %%% Records %%% @@ -40,8 +40,7 @@ runnable_count = 0 %:: non_neg_integer() }). --record( - information, { +-record(information, { id ,%:: pid() | port(), name = undefined ,%:: atom() | string() | 'undefined', entry = undefined ,%:: true_mfa() | 'undefined', diff --git a/lib/percept/src/percept_db.erl b/lib/percept/src/percept_db.erl index dc85fa3510..edb0d79a29 100644 --- a/lib/percept/src/percept_db.erl +++ b/lib/percept/src/percept_db.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% @@ -72,7 +72,7 @@ %% Pid = pid() %% @doc Starts or restarts the percept database. --spec(start/0 :: () -> {'started', pid()} | {'restarted', pid()}). +-spec start() -> {'started', pid()} | {'restarted', pid()}. start() -> case erlang:whereis(percept_db) of @@ -92,7 +92,7 @@ start() -> %% Pid = pid() %% @doc Stops the percept database. --spec(stop/0 :: () -> 'not_started' | {'stopped', pid()}). +-spec stop() -> 'not_started' | {'stopped', pid()}. stop() -> case erlang:whereis(percept_db) of @@ -392,23 +392,14 @@ consolidate_runnability_loop(Key) -> consolidate_runnability_loop(ets:next(pdb_activity, Key)). list_all_ts() -> - ATs = [ Act#activity.timestamp || - Act <- select_query({activity, []})], - STs = [ Act#activity.timestamp || - Act <- select_query({scheduler, []})], + ATs = [Act#activity.timestamp || Act <- select_query({activity, []})], + STs = [Act#activity.timestamp || Act <- select_query({scheduler, []})], ITs = lists:flatten([ [I#information.start, I#information.stop] || I <- select_query({information, all})]), - % Filter out all undefined (non ts) - TsList = lists:filter( - fun(Element) -> - case Element of - {_,_,_} -> true; - _ -> false - end - end, ATs ++ STs ++ ITs), - TsList. + %% Filter out all undefined (non ts) + [Elem || Elem = {_,_,_} <- ATs ++ STs ++ ITs]. %% get_runnable_count(Type, State) -> RunnableCount %% In: diff --git a/lib/percept/src/percept_html.erl b/lib/percept/src/percept_html.erl index ffce7a98fa..7e0ea45783 100644 --- a/lib/percept/src/percept_html.erl +++ b/lib/percept/src/percept_html.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% -module(percept_html). @@ -172,12 +172,12 @@ div_tag_graph() -> width:40px; height:40px;\"></div></div>". --spec(url_graph/5 :: ( +-spec url_graph( Widht :: non_neg_integer(), Height :: non_neg_integer(), Min :: float(), Max :: float(), - Pids :: [pid()]) -> string()). + Pids :: [pid()]) -> string(). url_graph(W, H, Min, Max, []) -> "/cgi-bin/percept_graph/graph?range_min=" ++ term2html(float(Min)) @@ -508,10 +508,7 @@ cl_deltas([A,B|Ls], Out) -> cl_deltas([B|Ls], [B - A | Out]). join_strings(Strings) -> lists:flatten(Strings). --spec(join_strings_with/2 :: ( - Strings :: [string()], - Separator :: string()) -> - string()). +-spec join_strings_with(Strings :: [string()], Separator :: string()) -> string(). join_strings_with([S1, S2 | R], S) -> join_strings_with([join_strings_with(S1,S2,S) | R], S); @@ -522,7 +519,7 @@ join_strings_with(S1, S2, S) -> %%% Generic erlang2html --spec(html_table/1 :: (Rows :: [[string() | {'td' | 'th', string()}]]) -> string()). +-spec html_table(Rows :: [[string() | {'td' | 'th', string()}]]) -> string(). html_table(Rows) -> "<table>" ++ html_table_row(Rows) ++ "</table>". @@ -539,7 +536,7 @@ html_table_data([Data|Row]) -> "<td>" ++ Data ++ "</td>" ++ html_table_dat --spec(table_line/1 :: (Table :: [any()]) -> string()). +-spec table_line(Table :: [any()]) -> string(). table_line(List) -> table_line(List, ["<tr>"]). table_line([], Out) -> lists:flatten(lists:reverse(["</tr>\n"|Out])); @@ -548,16 +545,12 @@ table_line([Element | Elements], Out) when is_list(Element) -> table_line([Element | Elements], Out) -> table_line(Elements, ["<td>" ++ term2html(Element) ++ "</td>"|Out]). --spec(term2html/1 :: (any()) -> string()). +-spec term2html(any()) -> string(). term2html(Term) when is_float(Term) -> lists:flatten(io_lib:format("~.4f", [Term])); term2html(Term) -> lists:flatten(io_lib:format("~p", [Term])). --spec(mfa2html/1 :: (MFA :: { - atom(), - atom(), - list() | integer()}) -> - string()). +-spec mfa2html(MFA :: {atom(), atom(), list() | integer()}) -> string(). mfa2html({Module, Function, Arguments}) when is_list(Arguments) -> lists:flatten(io_lib:format("~p:~p/~p", [Module, Function, length(Arguments)])); @@ -566,7 +559,7 @@ mfa2html({Module, Function, Arity}) when is_integer(Arity) -> mfa2html(_) -> "undefined". --spec(pid2html/1 :: (Pid :: pid() | port()) -> string()). +-spec pid2html(Pid :: pid() | port()) -> string(). pid2html(Pid) when is_pid(Pid) -> PidString = term2html(Pid), @@ -577,14 +570,14 @@ pid2html(Pid) when is_port(Pid) -> pid2html(_) -> "undefined". --spec(image_string/1 :: (Request :: string()) -> string()). +-spec image_string(Request :: string()) -> string(). image_string(Request) -> "<img border=0 src=\"/cgi-bin/percept_graph/" ++ Request ++ " \">". --spec(image_string/2 :: (atom() | string(), list()) -> string()). +-spec image_string(atom() | string(), list()) -> string(). image_string(Request, Options) when is_atom(Request), is_list(Options) -> image_string(image_string_head(erlang:atom_to_list(Request), Options, [])); @@ -610,13 +603,13 @@ image_string_tail(Request, [{Type, Value} | Opts], Out) -> %%% percept conversions --spec(pid2value/1 :: (Pid :: pid()) -> string()). +-spec pid2value(Pid :: pid()) -> string(). pid2value(Pid) -> String = lists:flatten(io_lib:format("~p", [Pid])), lists:sublist(String, 2, erlang:length(String)-2). --spec(value2pid/1 :: (Value :: string()) -> pid()). +-spec value2pid(Value :: string()) -> pid(). value2pid(Value) -> String = lists:flatten("<" ++ Value ++ ">"), @@ -625,10 +618,8 @@ value2pid(Value) -> %%% get value --spec(get_option_value/2 :: ( - Option :: string(), - Options :: [{string(),any()}]) -> - {'error', any()} | bool() | pid() | [pid()] | number()). +-spec get_option_value(Option :: string(), Options :: [{string(),any()}]) -> + {'error', any()} | boolean() | pid() | [pid()] | number(). get_option_value(Option, Options) -> case catch get_option_value0(Option, Options) of @@ -662,8 +653,7 @@ get_default_option_value(Option) -> _ -> {error, {undefined_default_option, Option}} end. --spec(get_number_value/1 :: (Value :: string()) -> - number() | {'error', 'illegal_number'}). +-spec get_number_value(string()) -> number() | {'error', 'illegal_number'}. get_number_value(Value) -> % Try float @@ -710,7 +700,7 @@ menu() -> <li><a href=/cgi-bin/percept_html/page>overview</a></li> </ul></div>\n". --spec(error_msg/1 :: (Error :: string()) -> string()). +-spec error_msg(Error :: string()) -> string(). error_msg(Error) -> "<table width=300> diff --git a/lib/public_key/doc/src/notes.xml b/lib/public_key/doc/src/notes.xml index 822f8bdb66..a5fbc81093 100644 --- a/lib/public_key/doc/src/notes.xml +++ b/lib/public_key/doc/src/notes.xml @@ -34,6 +34,21 @@ <file>notes.xml</file> </header> +<section><title>Public_Key 0.5</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p>Added <c>public_key:pkix_transform/2</c> to enable + ssl to send CA list during Certificate Request.</p> + <p><c>NOTE</c>: SSL (new_ssl) requires public_key-0.5. + ssl usage.</p> + <p>Own Id: OTP-8372</p> + </item> + </list> + </section> + +</section> <section><title>Public_Key 0.4</title> diff --git a/lib/public_key/src/public_key.appup.src b/lib/public_key/src/public_key.appup.src index 8d33482f11..ee0f9a3cc1 100644 --- a/lib/public_key/src/public_key.appup.src +++ b/lib/public_key/src/public_key.appup.src @@ -1,6 +1,18 @@ %% -*- erlang -*- {"%VSN%", [ + {"0.4", + [ + {update, public_key, soft, soft_purge, soft_purge, []}, + {update, pubkey_cert_records, soft, soft_purge, soft_purge, []} + ] + } ], [ + {"0.4", + [ + {update, public_key, soft, soft_purge, soft_purge, []}, + {update, pubkey_cert_records, soft, soft_purge, soft_purge, []} + ] + } ]}. diff --git a/lib/public_key/vsn.mk b/lib/public_key/vsn.mk index 64f0203915..f4d5281e94 100644 --- a/lib/public_key/vsn.mk +++ b/lib/public_key/vsn.mk @@ -1,6 +1,7 @@ -PUBLIC_KEY_VSN = 0.4 +PUBLIC_KEY_VSN = 0.5 -TICKETS = OTP-8250 +TICKETS = OTP-8372 +#TICKETS_0.4 = OTP-8250 #TICKETS_0.3 = OTP-8100 OTP-8142 #TICKETS_0.2 = OTP-7860 #TICKETS_0.1 = OTP-7637
\ No newline at end of file diff --git a/lib/reltool/doc/src/notes.xml b/lib/reltool/doc/src/notes.xml index 293793e900..524d728901 100644 --- a/lib/reltool/doc/src/notes.xml +++ b/lib/reltool/doc/src/notes.xml @@ -38,6 +38,21 @@ section is the version number of Reltool.</p> + <section><title>Reltool 0.5.3</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Removed spurious documentation files.</p> + <p> + Own Id: OTP-8057</p> + </item> + </list> + </section> + + </section> + <section><title>Reltool 0.5.2</title> <section><title>Improvements and New Features</title> diff --git a/lib/reltool/vsn.mk b/lib/reltool/vsn.mk index d5ca40619c..b0561a6110 100644 --- a/lib/reltool/vsn.mk +++ b/lib/reltool/vsn.mk @@ -1,24 +1,25 @@ # This is an -*-makefile-*- file. # %CopyrightBegin% -# -# Copyright Ericsson AB 2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2009-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% -RELTOOL_VSN = 0.5.2 +RELTOOL_VSN = 0.5.3 -TICKETS = OTP-8254 +TICKETS = OTP-8057 +TICKETS_0_5_2 = OTP-8254 TICKETS_0_5_1 = OTP-8199 TICKETS_0_5 = OTP-7949 TICKETS_0_2_2 = OTP-7999 diff --git a/lib/runtime_tools/src/percept_profile.erl b/lib/runtime_tools/src/percept_profile.erl index b333dee0cf..cdc7a0fca1 100644 --- a/lib/runtime_tools/src/percept_profile.erl +++ b/lib/runtime_tools/src/percept_profile.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% @@ -41,7 +41,7 @@ %% @type percept_option() = procs | ports | exclusive --type(percept_option() :: 'procs' | 'ports' | 'exclusive' | 'scheduler'). +-type percept_option() :: 'procs' | 'ports' | 'exclusive' | 'scheduler'. %%========================================================================== %% @@ -52,8 +52,8 @@ %% @spec start(Filename::string()) -> {ok, Port} | {already_started, Port} %% @equiv start(Filename, [procs]) --spec(start/1 :: (Filename :: string()) -> - {'ok', port()} | {'already_started', port()}). +-spec start(Filename :: file:filename()) -> + {'ok', port()} | {'already_started', port()}. start(Filename) -> profile_to_file(Filename, [procs]). @@ -64,10 +64,9 @@ start(Filename) -> %% All events are stored in the file given by Filename. %% An explicit call to stop/0 is needed to stop profiling. --spec(start/2 :: ( - Filename :: string(), - Options :: [percept_option()]) -> - {'ok', port()} | {'already_started', port()}). +-spec start(Filename :: file:filename(), + Options :: [percept_option()]) -> + {'ok', port()} | {'already_started', port()}. start(Filename, Options) -> profile_to_file(Filename, Options). @@ -79,11 +78,10 @@ start(Filename, Options) -> %% No explicit call to stop/0 is needed, the profiling stops when %% the entry function returns. --spec(start/3 :: ( - Filename :: string(), - Entry :: {atom(), atom(), list()}, - Options :: [percept_option()]) -> - 'ok' | {'already_started', port()} | {'error', 'not_started'}). +-spec start(Filename :: file:filename(), + Entry :: {atom(), atom(), list()}, + Options :: [percept_option()]) -> + 'ok' | {'already_started', port()} | {'error', 'not_started'}. start(Filename, {Module, Function, Args}, Options) -> case whereis(percept_port) of @@ -107,11 +105,11 @@ deliver_all_trace() -> receive {Tracer, ok} -> ok end, erlang:trace(Tracee, false, [procs]), ok. --spec(stop/0 :: () -> 'ok' | {'error', 'not_started'}). %% @spec stop() -> ok | {'error', 'not_started'} %% @doc Stops profiling. +-spec stop() -> 'ok' | {'error', 'not_started'}. stop() -> erlang:system_profile(undefined, [runnable_ports, runnable_procs]), @@ -192,5 +190,4 @@ parse_profile_options([Opt|Opts], {TOpts, POpts}) -> }); _ -> parse_profile_options(Opts, {TOpts, POpts}) - end. diff --git a/lib/sasl/doc/src/rb.xml b/lib/sasl/doc/src/rb.xml index 5b49a7bced..f35ceb5777 100644 --- a/lib/sasl/doc/src/rb.xml +++ b/lib/sasl/doc/src/rb.xml @@ -4,23 +4,21 @@ <erlref> <header> <copyright> - <year>1996</year> - <year>2007</year> - <holder>Ericsson AB, All Rights Reserved</holder> + <year>1996</year><year>2010</year> + <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. - The Initial Developer of the Original Code is Ericsson AB. </legalnotice> <title>rb</title> @@ -43,20 +41,70 @@ </description> <funcs> <func> + <name>filter(Filters)</name> + <name>filter(Filters, Dates)</name> + <fsummary>Filter reports and displays them on the screen</fsummary> + <type> + <v>Filters = [filter()]</v> + <v>filter() = {Key, Value} | {Key, Value, no} | {Key, RegExp, re} | {Key, RegExp, re, no}</v> + <v>Key = term()</v> + <v>Value = term()</v> + <v>RegExp = string() | {string, Options} | mp(), {mp(), Options}</v> + <v>Dates = {DateFrom, DateTo} | {DateFrom, from} | {DateTo, to}</v> + <v>DateFrom = DateTo = {date(), time()}</v> + <v>date() and time() are the same type as in the <c>calendar</c> module</v> + </type> + <desc> + <p>This function displays the reports that match the provided filters.</p> + <p> + When a filter includes the <c>no</c> atom it will exclude the reports that match + that filter. + </p> + <p> + The reports are matched using the <c>proplists</c> module. The report must be a proplist + to be matched against any of the <c>filters()</c>. + </p> + <p> + If the filter is of the form <c>{Key, RegExp, re}</c> the report must contain an element with + <c>key = Key</c> and <c>Value</c> must match the RegExp regular expression. + </p> + <p> + If the Dates parameter is provided, then the reports are filtered according to the date + when they occurred. If Dates is of the form <c>{DateFrom, from}</c> then reports that occurred + after DateFrom are displayed. + </p> + <p> + If Dates is of the form <c>{DateTo, to}</c> then reports that occurred before DateTo + are displayed. + </p> + <p> + If two Dates are provided, then reports that occurred between those dates are returned. + </p> + <p> + If you only want to filter only by dates, then you can provide the empty list as the Filters + parameter. + </p> + <p> + See <c>rb:grep/1</c> for more information on the RegExp parameter. + </p> + </desc> + </func> + <func> <name>grep(RegExp)</name> <fsummary>Search the reports for a regular expression</fsummary> <type> - <v>RegExp = string()</v> + <v>RegExp = string() | {string, Options} | mp(), {mp(), Options}</v> </type> <desc> <p>All reports containing the regular expression <c>RegExp</c> are printed. </p> - <p><c>RegExp</c> is a string containing the regular - expression. Refer to the module <c>regexp</c> in the STDLIB - reference manual - for a definition of valid regular expressions. They are - essentially the same as the UNIX command <c>egrep</c>. + <p><c>RegExp</c> can be a string containing the regular + expression; a tuple with the string and the options for + compilation; a compiled regular expression; a compiled + regular expression and the options for running it. + Refer to the module <c>re</c> and specially the function <c>re:run/3</c> + for a definition of valid regular expressions and options. </p> </desc> </func> diff --git a/lib/sasl/src/rb.erl b/lib/sasl/src/rb.erl index 00d86285e5..332a99c6f9 100644 --- a/lib/sasl/src/rb.erl +++ b/lib/sasl/src/rb.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(rb). @@ -22,7 +22,7 @@ %% External exports -export([start/0, start/1, stop/0, rescan/0, rescan/1]). --export([list/0, list/1, show/0, show/1, grep/1, start_log/1, stop_log/0]). +-export([list/0, list/1, show/0, show/1, grep/1, filter/1, filter/2, start_log/1, stop_log/0]). -export([h/0, help/0]). %% Internal exports @@ -73,6 +73,12 @@ show(Type) when is_atom(Type) -> grep(RegExp) -> gen_server:call(rb_server, {grep, RegExp}, infinity). +filter(Filters) when is_list(Filters) -> + gen_server:call(rb_server, {filter, Filters}, infinity). + +filter(Filters, FDates) when is_list(Filters) andalso is_tuple(FDates) -> + gen_server:call(rb_server, {filter, {Filters, FDates}}, infinity). + start_log(FileName) -> gen_server:call(rb_server, {start_log, FileName}). stop_log() -> gen_server:call(rb_server, stop_log). @@ -90,7 +96,17 @@ help() -> io:format("rb:list(Type) - list all reports of type Type~n"), io:format(" currently supported types are:~n"), print_types(), - io:format("rb:grep(RegExp) - print reports containing RegExp~n"), + io:format("rb:grep(RegExp) - print reports containing RegExp.~n"), + io:format(" RegExp must be a valid argument for ~n"), + io:format(" the function re:run/2 or re:run/3.~n"), + io:format("rb:filter(Filters) - print reports matching Filters.~n"), + io:format(" reports must be proplists.~n"), + io:format(" Filters is a list of tuples of the following form:~n"), + print_filters(), + io:format("rb:filter(Filters, Dates) -~n"), + io:format(" same as rb:filter/1 but accepts date ranges to filter reports.~n"), + io:format(" Dates must be of the following form:~n"), + print_dates(), io:format("rb:rescan() - rescans the report directory with same~n"), io:format(" options.~n"), io:format("rb:rescan(Options) - rescans the report directory with new~n"), @@ -133,7 +149,26 @@ print_types() -> io:format(" - progress~n"), io:format(" - error~n"). - +print_filters() -> + io:format(" - {Key, Value}~n"), + io:format(" includes report containing {Key, Value}~n"), + io:format(" - {Key, Value, no}~n"), + io:format(" excludes report containing {Key, Value}~n"), + io:format(" - {Key, RegExp, re}~n"), + io:format(" RegExp must be a valid argument for ~n"), + io:format(" the function re:run/2 or re:run/3.~n"), + io:format(" - {Key, RegExp, re, no}~n"), + io:format(" excludes report containing {Key, RegExp}~n"). + +print_dates() -> + io:format(" - {StartDate, EndDate}~n"), + io:format(" StartDate = EndDate = {{Y-M-D},{H,M,S}} ~n"), + io:format(" prints the reports with date between StartDate and EndDate~n"), + io:format(" - {StartDate, from}~n"), + io:format(" prints the reports with date greater than StartDate~n"), + io:format(" - {EndDate, to}~n"), + io:format(" prints the reports with date lesser than StartDate~n"). + init(Options) -> process_flag(priority, low), process_flag(trap_exit, true), @@ -190,8 +225,22 @@ handle_call(show, _From, State) -> {reply, ok, State#state{device = NewDevice}}; handle_call({grep, RegExp}, _From, State) -> #state{dir = Dir, data = Data, device = Device, abort = Abort, log = Log} = State, - NewDevice = print_grep_reports(Dir, Data, RegExp, Device, Abort, Log), - {reply, ok, State#state{device = NewDevice}}. + try print_grep_reports(Dir, Data, RegExp, Device, Abort, Log) of + NewDevice -> + {reply, ok, State#state{device = NewDevice}} + catch + error:Error -> + {reply, {error, Error}, State} + end; +handle_call({filter, Filters}, _From, State) -> + #state{dir = Dir, data = Data, device = Device, abort = Abort, log = Log} = State, + try filter_all_reports(Dir, Data, Filters, Device, Abort, Log) of + NewDevice -> + {reply, ok, State#state{device = NewDevice}} + catch + error:Error -> + {reply, {error, Error}, State} + end. terminate(_Reason, #state{device = Device}) -> close_device(Device). @@ -415,7 +464,7 @@ read_report(Fd) -> Ref = make_ref(), case (catch {Ref,binary_to_term(Bin)}) of {'EXIT',_} -> - {error, "Inclomplete erlang term in log"}; + {error, "Incomplete erlang term in log"}; {Ref,Term} -> {ok, Term} end @@ -622,21 +671,178 @@ check_rep(Fd, FilePosition, Device, RegExp, Number, Abort, Log) -> case read_rep_msg(Fd, FilePosition) of {Date, Msg} -> MsgStr = lists:flatten(io_lib:format("~p",[Msg])), - case regexp:match(MsgStr, RegExp) of - {match, _, _} -> + case run_re(MsgStr, RegExp) of + match -> io:format("Found match in report number ~w~n", [Number]), case catch rb_format_supp:print(Date, Msg, Device) of {'EXIT', _} -> handle_bad_form(Date, Msg, Device, Abort, Log); _ -> {proceed,Device} - end; + end; + _ -> + {proceed,Device} + end; + _ -> + io:format("rb: Cannot read from file~n"), + {proceed,Device} + end. + +run_re(Subject, {Regexp, Options}) -> + run_re(Subject, Regexp, Options); +run_re(Subject, Regexp) -> + run_re(Subject, Regexp, []). + +run_re(Subject, Regexp, Options) -> + case re:run(Subject, Regexp, Options) of + nomatch -> + nomatch; + _ -> + match + end. + +filter_all_reports(_Dir, [], _Filters, Device, _Abort, _Log) -> + Device; +filter_all_reports(Dir, Data, Filters, Device, Abort, Log) -> + {Next,Device1} = filter_report(Dir, Data, Filters, element(1, hd(Data)), + Device, Abort, Log), + if Next == abort -> + Device1; + true -> + filter_all_reports(Dir, tl(Data), Filters, Device1, Abort, Log) + end. + +filter_report(Dir, Data, Filters, Number, Device, Abort, Log) -> + case find_report(Data, Number) of + {Fname, FilePosition} -> + FileName = lists:concat([Dir, Fname]), + case file:open(FileName, [read]) of + {ok, Fd} -> + filter_rep(Filters, Fd, FilePosition, Device, Abort, Log); + _ -> + io:format("rb: can't open file ~p~n", [Fname]), + {proceed,Device} + end; + no_report -> + {proceed,Device} + end. + +filter_rep({Filters, FDates}, Fd, FilePosition, Device, Abort, Log) -> + RepMsg = read_rep_msg(Fd, FilePosition), + case RepMsg of + {_DateStr, {Date, _Msg}} -> + case compare_dates(Date, FDates) of + true -> + print_filter_report(RepMsg, Filters, Device, Abort, Log); _ -> {proceed,Device} end; _ -> io:format("rb: Cannot read from file~n"), {proceed,Device} + end; +filter_rep(Filters, Fd, FilePosition, Device, Abort, Log) -> + RepMsg = read_rep_msg(Fd, FilePosition), + case RepMsg of + {Date, Msg} -> + print_filter_report({Date, Msg}, Filters, Device, Abort, Log); + _ -> + io:format("rb: Cannot read from file~n"), + {proceed,Device} + end. + +filter_report([], _Msg) -> + true; +filter_report([{Key, Value}|T], Msg) -> + case proplists:get_value(Key, Msg) of + Value -> + filter_report(T, Msg); + _ -> + false + end; +filter_report([{Key, Value, no}|T], Msg) -> + case proplists:get_value(Key, Msg) of + Value -> + false; + _ -> + filter_report(T, Msg) + end; +filter_report([{Key, RegExp, re}|T], Msg) -> + case proplists:get_value(Key, Msg) of + undefined -> + false; + Value -> + Subject = lists:flatten(io_lib:format("~p",[Value])), + case run_re(Subject, RegExp) of + match -> + filter_report(T, Msg); + _ -> false + end + end; +filter_report([{Key, RegExp, re, no}|T], Msg) -> + case proplists:get_value(Key, Msg) of + undefined -> + false; + Value -> + Subject = lists:flatten(io_lib:format("~p",[Value])), + case run_re(Subject, RegExp) of + match -> false; + _ -> filter_report(T, Msg) + end + end. + +get_compare_dates(Date, CompareDate) -> + case application:get_env(sasl, utc_log) of + {ok, true} -> + {local_time_to_universal_time(Date), + local_time_to_universal_time(CompareDate)}; + _ -> + {Date, CompareDate} + end. +get_compare_dates(Date, From, To) -> + case application:get_env(sasl, utc_log) of + {ok, true} -> + {local_time_to_universal_time(Date), + local_time_to_universal_time(From), + local_time_to_universal_time(To)}; + _ -> + {Date, From, To} + end. + +compare_dates(Date, {CompareDate, from}) -> + {Date2, DateFrom} = get_compare_dates(Date, CompareDate), + calendar:datetime_to_gregorian_seconds(Date2) >= + calendar:datetime_to_gregorian_seconds(DateFrom); +compare_dates(Date, {CompareDate, to}) -> + {Date2, DateTo} = get_compare_dates(Date, CompareDate), + calendar:datetime_to_gregorian_seconds(Date2) =< + calendar:datetime_to_gregorian_seconds(DateTo); +compare_dates(Date, {From, To}) -> + {Date2, DateFrom, DateTo} = get_compare_dates(Date, From, To), + calendar:datetime_to_gregorian_seconds(Date2) >= + calendar:datetime_to_gregorian_seconds(DateFrom) + andalso + calendar:datetime_to_gregorian_seconds(Date2) =< + calendar:datetime_to_gregorian_seconds(DateTo). + +print_filter_report({Date, Msg}, Filters, Device, Abort, Log) -> + {_D, M} = Msg, + {_, _, M2} = M, + case M2 of + {_, _, Report} -> + case filter_report(Filters, Report) of + true -> + case catch rb_format_supp:print(Date, Msg, Device) of + {'EXIT', _} -> + handle_bad_form(Date, Msg, Device, Abort, Log); + _ -> + {proceed,Device} + end; + _ -> + {proceed, Device} + end; + _ -> + {proceed,Device} end. read_rep(Fd, FilePosition, Device, Abort, Log) -> diff --git a/lib/sasl/src/sasl.app.src b/lib/sasl/src/sasl.app.src index cfe4b81ab6..8c814cfaf5 100644 --- a/lib/sasl/src/sasl.app.src +++ b/lib/sasl/src/sasl.app.src @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% {application, sasl, @@ -32,6 +32,8 @@ sasl_report, sasl_report_tty_h, sasl_report_file_h, + si, + si_sasl_supp, systools, systools_make, systools_rc, diff --git a/lib/sasl/src/sasl.erl b/lib/sasl/src/sasl.erl index 979d80159e..d1babaffff 100644 --- a/lib/sasl/src/sasl.erl +++ b/lib/sasl/src/sasl.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(sasl). @@ -126,13 +126,13 @@ type(_) -> all. add_error_logger_mf(undefined) -> ok; add_error_logger_mf({Dir, MaxB, MaxF}) -> error_logger:add_report_handler( - log_mf_h, log_mf_h:init(Dir, MaxB, MaxF, {sasl, pred})). + log_mf_h, log_mf_h:init(Dir, MaxB, MaxF, fun pred/1)). delete_error_logger_mf(undefined) -> ok; delete_error_logger_mf(_) -> error_logger:delete_report_handler(log_mf_h). -pred({_Type, GL, _Msg}) when node(GL) /= node() -> false; +pred({_Type, GL, _Msg}) when node(GL) =/= node() -> false; pred(_) -> true. %%%----------------------------------------------------------------- diff --git a/lib/sasl/src/sasl_report.erl b/lib/sasl/src/sasl_report.erl index bad3a75151..c3e6fede15 100644 --- a/lib/sasl/src/sasl_report.erl +++ b/lib/sasl/src/sasl_report.erl @@ -1,40 +1,46 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(sasl_report). --export([write_report/3]). +-export([write_report/3, format_report/3]). -write_report(Fd, What, {Time, {error_report, _GL, {Pid, Type, Report}}}) -> +format_report(Fd, What, Report) -> + io_report(io_lib, Fd, What, Report). + +write_report(Fd, What, Report) -> + io_report(io, Fd, What, Report). + +io_report(IO, Fd, What, {Time, {error_report, _GL, {Pid, Type, Report}}}) -> case is_my_error_report(What, Type) of true -> Head = write_head(Type, Time, Pid), - write_report2(Fd, Head, Type, Report); + write_report2(IO, Fd, Head, Type, Report); _ -> true end; -write_report(Fd, What, {Time, {info_report, _GL, {Pid, Type, Report}}}) -> +io_report(IO, Fd, What, {Time, {info_report, _GL, {Pid, Type, Report}}}) -> case is_my_info_report(What, Type) of true -> Head = write_head(Type, Time, Pid), - write_report2(Fd, Head, Type, Report); + write_report2(IO, Fd, Head, Type, Report); _ -> true end; -write_report(_Fd, _, _) -> +io_report(_IO, _Fd, _, _) -> false. is_my_error_report(all, Type) -> is_my_error_report(Type); @@ -50,20 +56,26 @@ is_my_info_report(_, _Type) -> false. is_my_info_report(progress) -> true; is_my_info_report(_) -> false. -write_report2(Fd, Head, supervisor_report, Report) -> +write_report2(IO, Fd, Head, supervisor_report, Report) -> Name = sup_get(supervisor, Report), Context = sup_get(errorContext, Report), Reason = sup_get(reason, Report), Offender = sup_get(offender, Report), - io:format(Fd, Head ++ " Supervisor: ~p~n Context: ~p~n Reason: " - "~80.18p~n Offender: ~80.18p~n~n", - [Name,Context,Reason,Offender]); -write_report2(Fd, Head, progress, Report) -> + FmtString = " Supervisor: ~p~n Context: ~p~n Reason: " + "~80.18p~n Offender: ~80.18p~n~n", + write_report_action(IO, Fd, Head ++ FmtString, + [Name,Context,Reason,Offender]); +write_report2(IO, Fd, Head, progress, Report) -> Format = format_key_val(Report), - io:format(Fd, Head ++ "~s", [Format]); -write_report2(Fd, Head, crash_report, Report) -> + write_report_action(IO, Fd, Head ++ "~s", [Format]); +write_report2(IO, Fd, Head, crash_report, Report) -> Format = proc_lib:format(Report), - io:format(Fd, Head ++ "~s", [Format]). + write_report_action(IO, Fd, Head ++ "~s", [Format]). + +write_report_action(io, Fd, Format, Args) -> + io:format(Fd, Format, Args); +write_report_action(io_lib, _Fd, Format, Args) -> + io_lib:format(Format, Args). format_key_val([{Tag,Data}|Rep]) -> io_lib:format(" ~16w: ~p~n",[Tag,Data]) ++ format_key_val(Rep); diff --git a/lib/stdlib/src/escript.erl b/lib/stdlib/src/escript.erl index b2562c6169..05c42c24f0 100644 --- a/lib/stdlib/src/escript.erl +++ b/lib/stdlib/src/escript.erl @@ -63,7 +63,7 @@ script_name() -> %% string()). foldl(Fun, Acc0, File) when is_function(Fun, 4) -> case parse_file(File, false) of - {text, _, Forms, _Mode} when is_list(Forms) -> + {text, _, Forms, _HasRecs, _Mode} when is_list(Forms) -> GetInfo = fun() -> file:read_file_info(File) end, GetBin = fun() -> diff --git a/lib/tools/emacs/erlang-skels-old.el b/lib/tools/emacs/erlang-skels-old.el new file mode 100644 index 0000000000..b88d7bcc4b --- /dev/null +++ b/lib/tools/emacs/erlang-skels-old.el @@ -0,0 +1,1267 @@ +;; +;; %CopyrightBegin% +;; +;; Copyright Ericsson AB 2010. All Rights Reserved. +;; +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. +;; +;; %CopyrightEnd% +;;; +;;; Purpose: Provide Erlang code skeletons. +;;; See 'erlang-skel-file' variable. + +(defvar erlang-tempo-tags nil + "Tempo tags for erlang mode") + +(defvar erlang-skel + '(("If" "if" erlang-skel-if) + ("Case" "case" erlang-skel-case) + ("Receive" "receive" erlang-skel-receive) + ("Receive After" "after" erlang-skel-receive-after) + ("Receive Loop" "loop" erlang-skel-receive-loop) + ("Module" "module" erlang-skel-module) + ("Author" "author" erlang-skel-author) + () + ("Small Header" "small-header" + erlang-skel-small-header erlang-skel-header) + ("Normal Header" "normal-header" + erlang-skel-normal-header erlang-skel-header) + ("Large Header" "large-header" + erlang-skel-large-header erlang-skel-header) + () + ("Small Server" "small-server" + erlang-skel-small-server erlang-skel-header) + () + ("Application" "application" + erlang-skel-application erlang-skel-header) + ("Supervisor" "supervisor" + erlang-skel-supervisor erlang-skel-header) + ("supervisor_bridge" "supervisor-bridge" + erlang-skel-supervisor-bridge erlang-skel-header) + ("gen_server" "generic-server" + erlang-skel-generic-server erlang-skel-header) + ("gen_event" "gen-event" + erlang-skel-gen-event erlang-skel-header) + ("gen_fsm" "gen-fsm" + erlang-skel-gen-fsm erlang-skel-header) + ("Library module" "gen-lib" + erlang-skel-lib erlang-skel-header) + ("Corba callback" "gen-corba-cb" + erlang-skel-corba-callback erlang-skel-header) + ("Small Common Test suite" "ct-test-suite-s" + erlang-skel-ct-test-suite-s erlang-skel-header) + ("Large Common Test suite" "ct-test-suite-l" + erlang-skel-ct-test-suite-l erlang-skel-header) + ("Erlang TS test suite" "ts-test-suite" + erlang-skel-ts-test-suite erlang-skel-header) + ) + "*Description of all skeleton templates. +Both functions and menu entries will be created. + +Each entry in `erlang-skel' should be a list with three or four +elements, or the empty list. + +The first element is the name which shows up in the menu. The second +is the `tempo' identifier (The string \"erlang-\" will be added in +front of it). The third is the skeleton descriptor, a variable +containing `tempo' attributes as described in the function +`tempo-define-template'. The optional fourth elements denotes a +function which should be called when the menu is selected. + +Functions corresponding to every template will be created. The name +of the function will be `tempo-template-erlang-X' where `X' is the +tempo identifier as specified in the second argument of the elements +in this list. + +A list with zero elements means that the a horizontal line should +be placed in the menu.") + +;; In XEmacs `user-mail-address' returns "[email protected] (Foo Bar)" ARGH! +;; What's wrong with that? RFC 822 says it's legal. [sverkerw] +;; This needs to use the customized value. If that's not sane, things like +;; add-log will lose anyhow. Avoid it if there _is_ a paren. +(defvar erlang-skel-mail-address + (if (or (not user-mail-address) (string-match "(" user-mail-address)) + (concat (user-login-name) "@" + (or (and (boundp 'mail-host-address) + mail-host-address) + (system-name))) + user-mail-address) + "Mail address of the user.") + +;; Expression templates: +(defvar erlang-skel-case + '((erlang-skel-skip-blank) o > + "case " p " of" n> p "_ ->" n> p "ok" n> "end" p) + "*The skeleton of a `case' expression. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-if + '((erlang-skel-skip-blank) o > + "if" n> p " ->" n> p "ok" n> "end" p) + "The skeleton of an `if' expression. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-receive + '((erlang-skel-skip-blank) o > + "receive" n> p "_ ->" n> p "ok" n> "end" p) + "*The skeleton of a `receive' expression. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-receive-after + '((erlang-skel-skip-blank) o > + "receive" n> p "_ ->" n> p "ok" n> "after " p "T ->" n> + p "ok" n> "end" p) + "*The skeleton of a `receive' expression with an `after' clause. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-receive-loop + '(& o "loop(" p ") ->" n> "receive" n> p "_ ->" n> + "loop(" p ")" n> "end.") + "*The skeleton of a simple `receive' loop. +Please see the function `tempo-define-template'.") + + +;; Attribute templates + +(defvar erlang-skel-module + '(& "-module(" + (erlang-add-quotes-if-needed (erlang-get-module-from-file-name)) + ")." n) + "*The skeleton of a `module' attribute. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-author + '(& "-author('" erlang-skel-mail-address "')." n) + "*The skeleton of a `author' attribute. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-vc nil + "*The skeleton template to generate a version control attribute. +The default is to insert nothing. Example of usage: + + (setq erlang-skel-vc '(& \"-rcs(\\\"$\Id: $ \\\").\") n) + +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-export + '(& "-export([" n> "])." n) + "*The skeleton of an `export' attribute. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-import + '(& "%%-import(Module, [Function/Arity, ...])." n) + "*The skeleton of an `import' attribute. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-compile nil + ;; '(& "%%-compile(export_all)." n) + "*The skeleton of a `compile' attribute. +Please see the function `tempo-define-template'.") + + +;; Comment templates. + +(defvar erlang-skel-date-function 'erlang-skel-dd-mmm-yyyy + "*Function which returns date string. +Look in the module `time-stamp' for a battery of functions.") + +(defvar erlang-skel-copyright-comment '() + "*The template for a copyright line in the header, normally empty. +This variable should be bound to a `tempo' template, for example: + '(& \"%%% Copyright (C) 2000, Yoyodyne, Inc.\" n) + +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-created-comment + '(& "%%% Created : " (funcall erlang-skel-date-function) " by " + (user-full-name) " <" erlang-skel-mail-address ">" n) + "*The template for the \"Created:\" comment line.") + +(defvar erlang-skel-author-comment + '(& "%%% Author : " (user-full-name) " <" erlang-skel-mail-address ">" n) + "*The template for creating the \"Author:\" line in the header. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-file-comment + '(& "%%% File : " (file-name-nondirectory buffer-file-name) n) +"*The template for creating the \"Module:\" line in the header. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-small-header + '(o (erlang-skel-include erlang-skel-module) + ;; erlang-skel-author) + n + (erlang-skel-include erlang-skel-compile + ;; erlang-skel-export + erlang-skel-vc)) + "*The template of a small header without any comments. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-normal-header + '(o (erlang-skel-include erlang-skel-copyright-comment + erlang-skel-file-comment + erlang-skel-author-comment) + "%%% Description : " p n + (erlang-skel-include erlang-skel-created-comment) n + (erlang-skel-include erlang-skel-small-header) n) + "*The template of a normal header. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-large-header + '(o (erlang-skel-separator) + (erlang-skel-include erlang-skel-copyright-comment + erlang-skel-file-comment + erlang-skel-author-comment) + "%%% Description : " p n + "%%%" n + (erlang-skel-include erlang-skel-created-comment) + (erlang-skel-separator) + (erlang-skel-include erlang-skel-small-header) ) + "*The template of a large header. +Please see the function `tempo-define-template'.") + + +;; Server templates. + +(defvar erlang-skel-small-server + '((erlang-skel-include erlang-skel-large-header) + "-export([start/0,init/1])." n n n + "start() ->" n> "spawn(" (erlang-get-module-from-file-name) + ", init, [self()])." n n + "init(From) ->" n> + "loop(From)." n n + "loop(From) ->" n> + "receive" n> + p "_ ->" n> + "loop(From)" n> + "end." + ) + "*Template of a small server. +Please see the function `tempo-define-template'.") + +;; Behaviour templates. + +(defvar erlang-skel-application + '((erlang-skel-include erlang-skel-large-header) + "-behaviour(application)." n n + "%% Application callbacks" n + "-export([start/2, stop/1])." n n + (erlang-skel-double-separator 2) + "%% Application callbacks" n + (erlang-skel-double-separator 2) + (erlang-skel-separator 2) + "%% Function: start(Type, StartArgs) -> {ok, Pid} |" n + "%% {ok, Pid, State} |" n + "%% {error, Reason}" n + "%% Description: This function is called whenever an application " n + "%% is started using application:start/1,2, and should start the processes" n + "%% of the application. If the application is structured according to the" n + "%% OTP design principles as a supervision tree, this means starting the" n + "%% top supervisor of the tree." n + (erlang-skel-separator 2) + "start(_Type, StartArgs) ->" n> + "case 'TopSupervisor':start_link(StartArgs) of" n> + "{ok, Pid} -> " n> + "{ok, Pid};" n> + "Error ->" n> + "Error" n> + "end." n + n + (erlang-skel-separator 2) + "%% Function: stop(State) -> void()" n + "%% Description: This function is called whenever an application" n + "%% has stopped. It is intended to be the opposite of Module:start/2 and" n + "%% should do any necessary cleaning up. The return value is ignored. "n + (erlang-skel-separator 2) + "stop(_State) ->" n> + "ok." n + n + (erlang-skel-double-separator 2) + "%% Internal functions" n + (erlang-skel-double-separator 2) + ) + "*The template of an application behaviour. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-supervisor + '((erlang-skel-include erlang-skel-large-header) + "-behaviour(supervisor)." n n + + "%% API" n + "-export([start_link/0])." n n + + "%% Supervisor callbacks" n + "-export([init/1])." n n + + "-define(SERVER, ?MODULE)." n n + + (erlang-skel-double-separator 2) + "%% API functions" n + (erlang-skel-double-separator 2) + (erlang-skel-separator 2) + "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n + "%% Description: Starts the supervisor" n + (erlang-skel-separator 2) + "start_link() ->" n> + "supervisor:start_link({local, ?SERVER}, ?MODULE, [])." n + n + (erlang-skel-double-separator 2) + "%% Supervisor callbacks" n + (erlang-skel-double-separator 2) + (erlang-skel-separator 2) + "%% Func: init(Args) -> {ok, {SupFlags, [ChildSpec]}} |" n + "%% ignore |" n + "%% {error, Reason}" n + "%% Description: Whenever a supervisor is started using "n + "%% supervisor:start_link/[2,3], this function is called by the new process "n + "%% to find out about restart strategy, maximum restart frequency and child "n + "%% specifications." n + (erlang-skel-separator 2) + "init([]) ->" n> + "AChild = {'AName',{'AModule',start_link,[]}," n> + "permanent,2000,worker,['AModule']}," n> + "{ok,{{one_for_all,0,1}, [AChild]}}." n + n + (erlang-skel-double-separator 2) + "%% Internal functions" n + (erlang-skel-double-separator 2) + ) + "*The template of an supervisor behaviour. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-supervisor-bridge + '((erlang-skel-include erlang-skel-large-header) + "-behaviour(supervisor_bridge)." n n + + "%% API" n + "-export([start_link/0])." n n + + "%% supervisor_bridge callbacks" n + "-export([init/1, terminate/2])." n n + + "-define(SERVER, ?MODULE)." n n + + "-record(state, {})." n n + + (erlang-skel-double-separator 2) + "%% API" n + (erlang-skel-double-separator 2) + (erlang-skel-separator 2) + "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n + "%% Description: Starts the supervisor bridge" n + (erlang-skel-separator 2) + "start_link() ->" n> + "supervisor_bridge:start_link({local, ?SERVER}, ?MODULE, [])." n + n + (erlang-skel-double-separator 2) + "%% supervisor_bridge callbacks" n + (erlang-skel-double-separator 2) + (erlang-skel-separator 2) + "%% Funcion: init(Args) -> {ok, Pid, State} |" n + "%% ignore |" n + "%% {error, Reason} " n + "%% Description:Creates a supervisor_bridge process, linked to the calling" n + "%% process, which calls Module:init/1 to start the subsystem. To ensure a" n + "%% synchronized start-up procedure, this function does not return until" n + "%% Module:init/1 has returned. " n + (erlang-skel-separator 2) + "init([]) ->" n> + "case 'AModule':start_link() of" n> + "{ok, Pid} ->" n> + "{ok, Pid, #state{}};" n> + "Error ->" n> + "Error" n> + "end." n + n + (erlang-skel-separator 2) + "%% Func: terminate(Reason, State) -> void()" n + "%% Description:This function is called by the supervisor_bridge when it is"n + "%% about to terminate. It should be the opposite of Module:init/1 and stop"n + "%% the subsystem and do any necessary cleaning up.The return value is ignored." + (erlang-skel-separator 2) + "terminate(Reason, State) ->" n> + "'AModule':stop()," n> + "ok." n + n + (erlang-skel-double-separator 2) + "%% Internal functions" n + (erlang-skel-double-separator 2) + ) + "*The template of an supervisor_bridge behaviour. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-generic-server + '((erlang-skel-include erlang-skel-large-header) + "-behaviour(gen_server)." n n + + "%% API" n + "-export([start_link/0])." n n + + "%% gen_server callbacks" n + "-export([init/1, handle_call/3, handle_cast/2, " + "handle_info/2," n> + "terminate/2, code_change/3])." n n + + "-record(state, {})." n n + + (erlang-skel-double-separator 2) + "%% API" n + (erlang-skel-double-separator 2) + (erlang-skel-separator 2) + "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n + "%% Description: Starts the server" n + (erlang-skel-separator 2) + "start_link() ->" n> + "gen_server:start_link({local, ?SERVER}, ?MODULE, [], [])." n + n + (erlang-skel-double-separator 2) + "%% gen_server callbacks" n + (erlang-skel-double-separator 2) + n + (erlang-skel-separator 2) + "%% Function: init(Args) -> {ok, State} |" n + "%% {ok, State, Timeout} |" n + "%% ignore |" n + "%% {stop, Reason}" n + "%% Description: Initializes the server" n + (erlang-skel-separator 2) + "init([]) ->" n> + "{ok, #state{}}." n + n + (erlang-skel-separator 2) + "%% Function: " + "%% handle_call(Request, From, State) -> {reply, Reply, State} |" n + "%% {reply, Reply, State, Timeout} |" n + "%% {noreply, State} |" n + "%% {noreply, State, Timeout} |" n + "%% {stop, Reason, Reply, State} |" n + "%% {stop, Reason, State}" n + "%% Description: Handling call messages" n + (erlang-skel-separator 2) + "handle_call(_Request, _From, State) ->" n> + "Reply = ok," n> + "{reply, Reply, State}." n + n + (erlang-skel-separator 2) + "%% Function: handle_cast(Msg, State) -> {noreply, State} |" n + "%% {noreply, State, Timeout} |" n + "%% {stop, Reason, State}" n + "%% Description: Handling cast messages" n + + (erlang-skel-separator 2) + "handle_cast(_Msg, State) ->" n> + "{noreply, State}." n + n + (erlang-skel-separator 2) + "%% Function: handle_info(Info, State) -> {noreply, State} |" n + "%% {noreply, State, Timeout} |" n + "%% {stop, Reason, State}" n + "%% Description: Handling all non call/cast messages" n + (erlang-skel-separator 2) + "handle_info(_Info, State) ->" n> + "{noreply, State}." n + n + (erlang-skel-separator 2) + "%% Function: terminate(Reason, State) -> void()" n + "%% Description: This function is called by a gen_server when it is about to"n + "%% terminate. It should be the opposite of Module:init/1 and do any necessary"n + "%% cleaning up. When it returns, the gen_server terminates with Reason." n + "%% The return value is ignored." n + + (erlang-skel-separator 2) + "terminate(_Reason, _State) ->" n> + "ok." n + n + (erlang-skel-separator 2) + "%% Func: code_change(OldVsn, State, Extra) -> {ok, NewState}" n + "%% Description: Convert process state when code is changed" n + (erlang-skel-separator 2) + "code_change(_OldVsn, State, _Extra) ->" n> + "{ok, State}." n + n + (erlang-skel-separator 2) + "%%% Internal functions" n + (erlang-skel-separator 2) + ) + "*The template of a generic server. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-gen-event + '((erlang-skel-include erlang-skel-large-header) + "-behaviour(gen_event)." n + + "%% API" n + "-export([start_link/0, add_handler/0])." n n + + "%% gen_event callbacks" n + "-export([init/1, handle_event/2, handle_call/2, " n> + "handle_info/2, terminate/2, code_change/3])." n n + + "-record(state, {})." n n + + (erlang-skel-double-separator 2) + "%% gen_event callbacks" n + (erlang-skel-double-separator 2) + (erlang-skel-separator 2) + "%% Function: start_link() -> {ok,Pid} | {error,Error} " n + "%% Description: Creates an event manager." n + (erlang-skel-separator 2) + "start_link() ->" n> + "gen_event:start_link({local, ?SERVER}). " n + n + (erlang-skel-separator 2) + "%% Function: add_handler() -> ok | {'EXIT',Reason} | term()" n + "%% Description: Adds an event handler" n + (erlang-skel-separator 2) + "add_handler() ->" n> + "gen_event:add_handler(?SERVER, ?MODULE, [])." n + n + (erlang-skel-double-separator 2) + "%% gen_event callbacks" n + (erlang-skel-double-separator 2) + (erlang-skel-separator 2) + "%% Function: init(Args) -> {ok, State}" n + "%% Description: Whenever a new event handler is added to an event manager,"n + "%% this function is called to initialize the event handler." n + (erlang-skel-separator 2) + "init([]) ->" n> + "{ok, #state{}}." n + n + (erlang-skel-separator 2) + "%% Function: "n + "%% handle_event(Event, State) -> {ok, State} |" n + "%% {swap_handler, Args1, State1, Mod2, Args2} |"n + "%% remove_handler" n + "%% Description:Whenever an event manager receives an event sent using"n + "%% gen_event:notify/2 or gen_event:sync_notify/2, this function is called for"n + "%% each installed event handler to handle the event. "n + (erlang-skel-separator 2) + "handle_event(_Event, State) ->" n> + "{ok, State}." n + n + (erlang-skel-separator 2) + "%% Function: " n + "%% handle_call(Request, State) -> {ok, Reply, State} |" n + "%% {swap_handler, Reply, Args1, State1, "n + "%% Mod2, Args2} |" n + "%% {remove_handler, Reply}" n + "%% Description: Whenever an event manager receives a request sent using"n + "%% gen_event:call/3,4, this function is called for the specified event "n + "%% handler to handle the request."n + (erlang-skel-separator 2) + "handle_call(_Request, State) ->" n> + "Reply = ok," n> + "{ok, Reply, State}." n + n + (erlang-skel-separator 2) + "%% Function: " n + "%% handle_info(Info, State) -> {ok, State} |" n + "%% {swap_handler, Args1, State1, Mod2, Args2} |" n + "%% remove_handler" n + "%% Description: This function is called for each installed event handler when"n + "%% an event manager receives any other message than an event or a synchronous"n + "%% request (or a system message)."n + (erlang-skel-separator 2) + "handle_info(_Info, State) ->" n> + "{ok, State}." n + n + (erlang-skel-separator 2) + "%% Function: terminate(Reason, State) -> void()" n + "%% Description:Whenever an event handler is deleted from an event manager,"n + "%% this function is called. It should be the opposite of Module:init/1 and "n + "%% do any necessary cleaning up. " n + (erlang-skel-separator 2) + "terminate(_Reason, _State) ->" n> + "ok." n + n + (erlang-skel-separator 2) + "%% Function: code_change(OldVsn, State, Extra) -> {ok, NewState} " n + "%% Description: Convert process state when code is changed" n + (erlang-skel-separator 2) + "code_change(_OldVsn, State, _Extra) ->" n> + "{ok, State}." n + n + (erlang-skel-separator 2) + "%%% Internal functions" n + (erlang-skel-separator 2) + ) + "*The template of a gen_event. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-gen-fsm + '((erlang-skel-include erlang-skel-large-header) + "-behaviour(gen_fsm)." n n + + "%% API" n + "-export([start_link/0])." n n + + "%% gen_fsm callbacks" n + "-export([init/1, state_name/2, state_name/3, handle_event/3," n> + "handle_sync_event/4, handle_info/3, terminate/3, code_change/4])." n n + + "-record(state, {})." n n + + (erlang-skel-double-separator 2) + "%% API" n + (erlang-skel-double-separator 2) + (erlang-skel-separator 2) + "%% Function: start_link() -> ok,Pid} | ignore | {error,Error}" n + "%% Description:Creates a gen_fsm process which calls Module:init/1 to"n + "%% initialize. To ensure a synchronized start-up procedure, this function" n + "%% does not return until Module:init/1 has returned. " n + (erlang-skel-separator 2) + "start_link() ->" n> + "gen_fsm:start_link({local, ?SERVER}, ?MODULE, [], [])." n + n + (erlang-skel-double-separator 2) + "%% gen_fsm callbacks" n + (erlang-skel-double-separator 2) + (erlang-skel-separator 2) + "%% Function: init(Args) -> {ok, StateName, State} |" n + "%% {ok, StateName, State, Timeout} |" n + "%% ignore |" n + "%% {stop, StopReason} " n + "%% Description:Whenever a gen_fsm is started using gen_fsm:start/[3,4] or"n + "%% gen_fsm:start_link/3,4, this function is called by the new process to "n + "%% initialize. " n + (erlang-skel-separator 2) + "init([]) ->" n> + "{ok, state_name, #state{}}." n + n + (erlang-skel-separator 2) + "%% Function: "n + "%% state_name(Event, State) -> {next_state, NextStateName, NextState}|" n + "%% {next_state, NextStateName, " n + "%% NextState, Timeout} |" n + "%% {stop, Reason, NewState}" n + "%% Description:There should be one instance of this function for each possible"n + "%% state name. Whenever a gen_fsm receives an event sent using" n + "%% gen_fsm:send_event/2, the instance of this function with the same name as"n + "%% the current state name StateName is called to handle the event. It is also "n + "%% called if a timeout occurs. " n + (erlang-skel-separator 2) + "state_name(_Event, State) ->" n> + "{next_state, state_name, State}." n + n + (erlang-skel-separator 2) + "%% Function:" n + "%% state_name(Event, From, State) -> {next_state, NextStateName, NextState} |"n + "%% {next_state, NextStateName, " n + "%% NextState, Timeout} |" n + "%% {reply, Reply, NextStateName, NextState}|"n + "%% {reply, Reply, NextStateName, " n + "%% NextState, Timeout} |" n + "%% {stop, Reason, NewState}|" n + "%% {stop, Reason, Reply, NewState}" n + "%% Description: There should be one instance of this function for each" n + "%% possible state name. Whenever a gen_fsm receives an event sent using" n + "%% gen_fsm:sync_send_event/2,3, the instance of this function with the same"n + "%% name as the current state name StateName is called to handle the event." n + (erlang-skel-separator 2) + "state_name(_Event, _From, State) ->" n> + "Reply = ok," n> + "{reply, Reply, state_name, State}." n + n + (erlang-skel-separator 2) + "%% Function: " n + "%% handle_event(Event, StateName, State) -> {next_state, NextStateName, "n + "%% NextState} |" n + "%% {next_state, NextStateName, "n + "%% NextState, Timeout} |" n + "%% {stop, Reason, NewState}" n + "%% Description: Whenever a gen_fsm receives an event sent using"n + "%% gen_fsm:send_all_state_event/2, this function is called to handle"n + "%% the event." n + (erlang-skel-separator 2) + "handle_event(_Event, StateName, State) ->" n> + "{next_state, StateName, State}." n + n + (erlang-skel-separator 2) + "%% Function: " n + "%% handle_sync_event(Event, From, StateName, "n + "%% State) -> {next_state, NextStateName, NextState} |" n + "%% {next_state, NextStateName, NextState, " n + "%% Timeout} |" n + "%% {reply, Reply, NextStateName, NextState}|" n + "%% {reply, Reply, NextStateName, NextState, " n + "%% Timeout} |" n + "%% {stop, Reason, NewState} |" n + "%% {stop, Reason, Reply, NewState}" n + "%% Description: Whenever a gen_fsm receives an event sent using"n + "%% gen_fsm:sync_send_all_state_event/2,3, this function is called to handle"n + "%% the event."n + (erlang-skel-separator 2) + "handle_sync_event(Event, From, StateName, State) ->" n> + "Reply = ok," n> + "{reply, Reply, StateName, State}." n + n + (erlang-skel-separator 2) + "%% Function: " n + "%% handle_info(Info,StateName,State)-> {next_state, NextStateName, NextState}|" n + "%% {next_state, NextStateName, NextState, "n + "%% Timeout} |" n + "%% {stop, Reason, NewState}" n + "%% Description: This function is called by a gen_fsm when it receives any"n + "%% other message than a synchronous or asynchronous event"n + "%% (or a system message)." n + (erlang-skel-separator 2) + "handle_info(_Info, StateName, State) ->" n> + "{next_state, StateName, State}." n + n + (erlang-skel-separator 2) + "%% Function: terminate(Reason, StateName, State) -> void()" n + "%% Description:This function is called by a gen_fsm when it is about"n + "%% to terminate. It should be the opposite of Module:init/1 and do any"n + "%% necessary cleaning up. When it returns, the gen_fsm terminates with"n + "%% Reason. The return value is ignored." n + (erlang-skel-separator 2) + "terminate(_Reason, _StateName, _State) ->" n> + "ok." n + n + (erlang-skel-separator 2) + "%% Function:" n + "%% code_change(OldVsn, StateName, State, Extra) -> {ok, StateName, NewState}" n + "%% Description: Convert process state when code is changed" n + (erlang-skel-separator 2) + "code_change(_OldVsn, StateName, State, _Extra) ->" n> + "{ok, StateName, State}." n + n + (erlang-skel-separator 2) + "%%% Internal functions" n + (erlang-skel-separator 2) + ) + "*The template of a gen_fsm. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-lib + '((erlang-skel-include erlang-skel-large-header) + + "%% API" n + "-export([])." n n + + (erlang-skel-double-separator 2) + "%% API" n + (erlang-skel-double-separator 2) + (erlang-skel-separator 2) + "%% Function: " n + "%% Description:" n + (erlang-skel-separator 2) + n + (erlang-skel-double-separator 2) + "%% Internal functions" n + (erlang-skel-double-separator 2) + ) + "*The template of a library module. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-corba-callback + '((erlang-skel-include erlang-skel-large-header) + "%% Include files" n n + + "%% API" n + "-export([])." n n + + "%% Corba callbacks" n + "-export([init/1, terminate/2, code_change/3])." n n + + "-record(state, {})." n n + + (erlang-skel-double-separator 2) + "%% Corba callbacks" n + (erlang-skel-double-separator 2) + (erlang-skel-separator 2) + "%% Function: init(Args) -> {ok, State} |" n + "%% {ok, State, Timeout} |" n + "%% ignore |" n + "%% {stop, Reason}" n + "%% Description: Initializes the server" n + (erlang-skel-separator 2) + "init([]) ->" n> + "{ok, #state{}}." n + n + (erlang-skel-separator 2) + "%% Function: terminate(Reason, State) -> void()" n + "%% Description: Shutdown the server" n + (erlang-skel-separator 2) + "terminate(_Reason, _State) ->" n> + "ok." n + n + (erlang-skel-separator 2) + "%% Function: code_change(OldVsn, State, Extra) -> {ok, NewState} " n + "%% Description: Convert process state when code is changed" n + (erlang-skel-separator 2) + "code_change(_OldVsn, State, _Extra) ->" n> + "{ok, State}." n + n + (erlang-skel-double-separator 2) + "%% Internal functions" n + (erlang-skel-double-separator 2) + ) + "*The template of a library module. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-ts-test-suite + '((erlang-skel-include erlang-skel-large-header) + "%% Note: This directive should only be used in test suites." n + "-compile(export_all)." n n + + "-include_lib(\"test_server/include/test_server.hrl\")." n n + + (erlang-skel-separator 2) + "%% TEST SERVER CALLBACK FUNCTIONS" n + (erlang-skel-separator 2) + n + (erlang-skel-separator 2) + "%% Function: init_per_suite(Config0) -> Config1 | {skip,Reason}" n + "%%" n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the suite." n + "%%" n + "%% Description: Initialization before the suite." n + "%%" n + "%% Note: This function is free to add any key/value pairs to the Config" n + "%% variable, but should NOT alter/remove any existing entries." n + (erlang-skel-separator 2) + "init_per_suite(Config) ->" n > + "Config." n n + + (erlang-skel-separator 2) + "%% Function: end_per_suite(Config) -> void()" n + "%%" n + "%% Config = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%%" n + "%% Description: Cleanup after the suite." n + (erlang-skel-separator 2) + "end_per_suite(_Config) ->" n > + "ok." n n + + (erlang-skel-separator 2) + "%% Function: init_per_testcase(TestCase, Config0) -> Config1 |" n + "%% {skip,Reason}" n + "%% TestCase = atom()" n + "%% Name of the test case that is about to run." n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the test case." n + "%%" n + "%% Description: Initialization before each test case." n + "%%" n + "%% Note: This function is free to add any key/value pairs to the Config" n + "%% variable, but should NOT alter/remove any existing entries." n + (erlang-skel-separator 2) + "init_per_testcase(_TestCase, Config) ->" n > + "Config." n n + + (erlang-skel-separator 2) + "%% Function: end_per_testcase(TestCase, Config) -> void()" n + "%%" n + "%% TestCase = atom()" n + "%% Name of the test case that is finished." n + "%% Config = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%%" n + "%% Description: Cleanup after each test case." n + (erlang-skel-separator 2) + "end_per_testcase(_TestCase, _Config) ->" n > + "ok."n n + + (erlang-skel-separator 2) + "%% Function: all(Clause) -> Descr | Spec | {skip,Reason}" n + "%%" n + "%% Clause = doc | suite" n + "%% Indicates expected return value." n + "%% Descr = [string()] | []" n + "%% String that describes the test suite." n + "%% Spec = [TestCase]" n + "%% A test specification." n + "%% TestCase = ConfCase | atom()" n + "%% Configuration case, or the name of a test case function." n + "%% ConfCase = {conf,Init,Spec,End} |" n + "%% {conf,Properties,Init,Spec,End}" n + "%% Init = End = {Mod,Func} | Func" n + "%% Initialization and cleanup function." n + "%% Mod = Func = atom()" n + "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n + "%% Execution properties of the test cases (may be combined)." n + "%% Shuffle = shuffle | {shuffle,Seed}" n + "%% To get cases executed in random order." n + "%% Seed = {integer(),integer(),integer()}" n + "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n + "%% repeat_until_any_ok | repeat_until_any_fail" n + "%% To get execution of cases repeated." n + "%% N = integer() | forever" n + "%% Reason = term()" n + "%% The reason for skipping the test suite." n + "%%" n + "%% Description: Returns a description of the test suite when" n + "%% Clause == doc, and a test specification (list" n + "%% of the conf and test cases in the suite) when" n + "%% Clause == suite." n + (erlang-skel-separator 2) + "all(doc) -> " n > + "[\"Describe the main purpose of this suite\"];" n n + "all(suite) -> " n > + "[a_test_case]." n n + n + (erlang-skel-separator 2) + "%% TEST CASES" n + (erlang-skel-separator 2) + n + (erlang-skel-separator 2) + "%% Function: TestCase(Arg) -> Descr | Spec | ok | exit() | {skip,Reason}" n + "%%" n + "%% Arg = doc | suite | Config" n + "%% Indicates expected behaviour and return value." n + "%% Config = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Descr = [string()] | []" n + "%% String that describes the test case." n + "%% Spec = [tuple()] | []" n + "%% A test specification, see all/1." n + "%% Reason = term()" n + "%% The reason for skipping the test case." n + "%%" n + "%% Description: Test case function. Returns a description of the test" n + "%% case (doc), then returns a test specification (suite)," n + "%% or performs the actual test (Config)." n + (erlang-skel-separator 2) + "a_test_case(doc) -> " n > + "[\"Describe the main purpose of this test case\"];" n n + "a_test_case(suite) -> " n > + "[];" n n + "a_test_case(Config) when is_list(Config) -> " n > + "ok." n + ) + "*The template of a library module. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-ct-test-suite-l + '((erlang-skel-include erlang-skel-large-header) + "%% Note: This directive should only be used in test suites." n + "-compile(export_all)." n n + + "-include_lib(\"common_test/include/ct.hrl\")." n n + + (erlang-skel-separator 2) + "%% COMMON TEST CALLBACK FUNCTIONS" n + (erlang-skel-separator 2) + n + (erlang-skel-separator 2) + "%% Function: suite() -> Info" n + "%%" n + "%% Info = [tuple()]" n + "%% List of key/value pairs." n + "%%" n + "%% Description: Returns list of tuples to set default properties" n + "%% for the suite." n + "%%" n + "%% Note: The suite/0 function is only meant to be used to return" n + "%% default data values, not perform any other operations." n + (erlang-skel-separator 2) + "suite() ->" n > + "[{timetrap,{minutes,10}}]." n n + + (erlang-skel-separator 2) + "%% Function: init_per_suite(Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + "%%" n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the suite." n + "%%" n + "%% Description: Initialization before the suite." n + "%%" n + "%% Note: This function is free to add any key/value pairs to the Config" n + "%% variable, but should NOT alter/remove any existing entries." n + (erlang-skel-separator 2) + "init_per_suite(Config) ->" n > + "Config." n n + + (erlang-skel-separator 2) + "%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}" n + "%%" n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%%" n + "%% Description: Cleanup after the suite." n + (erlang-skel-separator 2) + "end_per_suite(_Config) ->" n > + "ok." n n + + (erlang-skel-separator 2) + "%% Function: init_per_group(GroupName, Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + "%%" n + "%% GroupName = atom()" n + "%% Name of the test case group that is about to run." n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding configuration data for the group." n + "%% Reason = term()" n + "%% The reason for skipping all test cases and subgroups in the group." n + "%%" n + "%% Description: Initialization before each test case group." n + (erlang-skel-separator 2) + "init_per_group(_GroupName, Config) ->" n > + "Config." n n + + (erlang-skel-separator 2) + "%% Function: end_per_group(GroupName, Config0) ->" n + "%% void() | {save_config,Config1}" n + "%%" n + "%% GroupName = atom()" n + "%% Name of the test case group that is finished." n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding configuration data for the group." n + "%%" n + "%% Description: Cleanup after each test case group." n + (erlang-skel-separator 2) + "end_per_group(_GroupName, _Config) ->" n > + "ok." n n + + (erlang-skel-separator 2) + "%% Function: init_per_testcase(TestCase, Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + "%%" n + "%% TestCase = atom()" n + "%% Name of the test case that is about to run." n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the test case." n + "%%" n + "%% Description: Initialization before each test case." n + "%%" n + "%% Note: This function is free to add any key/value pairs to the Config" n + "%% variable, but should NOT alter/remove any existing entries." n + (erlang-skel-separator 2) + "init_per_testcase(_TestCase, Config) ->" n > + "Config." n n + + (erlang-skel-separator 2) + "%% Function: end_per_testcase(TestCase, Config0) ->" n + "%% void() | {save_config,Config1} | {fail,Reason}" n + "%%" n + "%% TestCase = atom()" n + "%% Name of the test case that is finished." n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for failing the test case." n + "%%" n + "%% Description: Cleanup after each test case." n + (erlang-skel-separator 2) + "end_per_testcase(_TestCase, _Config) ->" n > + "ok." n n + + (erlang-skel-separator 2) + "%% Function: groups() -> [Group]" n + "%%" n + "%% Group = {GroupName,Properties,GroupsAndTestCases}" n + "%% GroupName = atom()" n + "%% The name of the group." n + "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n + "%% Group properties that may be combined." n + "%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]" n + "%% TestCase = atom()" n + "%% The name of a test case." n + "%% Shuffle = shuffle | {shuffle,Seed}" n + "%% To get cases executed in random order." n + "%% Seed = {integer(),integer(),integer()}" n + "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n + "%% repeat_until_any_ok | repeat_until_any_fail" n + "%% To get execution of cases repeated." n + "%% N = integer() | forever" n + "%%" n + "%% Description: Returns a list of test case group definitions." n + (erlang-skel-separator 2) + "groups() ->" n > + "[]." n n + + (erlang-skel-separator 2) + "%% Function: all() -> GroupsAndTestCases | {skip,Reason}" n + "%%" n + "%% GroupsAndTestCases = [{group,GroupName} | TestCase]" n + "%% GroupName = atom()" n + "%% Name of a test case group." n + "%% TestCase = atom()" n + "%% Name of a test case." n + "%% Reason = term()" n + "%% The reason for skipping all groups and test cases." n + "%%" n + "%% Description: Returns the list of groups and test cases that" n + "%% are to be executed." n + (erlang-skel-separator 2) + "all() -> " n > + "[my_test_case]." n n + + n + (erlang-skel-separator 2) + "%% TEST CASES" n + (erlang-skel-separator 2) + n + + (erlang-skel-separator 2) + "%% Function: TestCase() -> Info" n + "%%" n + "%% Info = [tuple()]" n + "%% List of key/value pairs." n + "%%" n + "%% Description: Test case info function - returns list of tuples to set" n + "%% properties for the test case." n + "%%" n + "%% Note: This function is only meant to be used to return a list of" n + "%% values, not perform any other operations." n + (erlang-skel-separator 2) + "my_test_case() -> " n > + "[]." n n + + (erlang-skel-separator 2) + "%% Function: TestCase(Config0) ->" n + "%% ok | exit() | {skip,Reason} | {comment,Comment} |" n + "%% {save_config,Config1} | {skip_and_save,Reason,Config1}" n + "%%" n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the test case." n + "%% Comment = term()" n + "%% A comment about the test case that will be printed in the html log." n + "%%" n + "%% Description: Test case function. (The name of it must be specified in" n + "%% the all/0 list or in a test case group for the test case" n + "%% to be executed)." n + (erlang-skel-separator 2) + "my_test_case(_Config) -> " n > + "ok." n + ) + "*The template of a library module. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-ct-test-suite-s + '((erlang-skel-include erlang-skel-large-header) + "-compile(export_all)." n n + + "-include_lib(\"common_test/include/ct.hrl\")." n n + + (erlang-skel-separator 2) + "%% Function: suite() -> Info" n + "%% Info = [tuple()]" n + (erlang-skel-separator 2) + "suite() ->" n > + "[{timetrap,{seconds,30}}]." n n + + (erlang-skel-separator 2) + "%% Function: init_per_suite(Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + (erlang-skel-separator 2) + "init_per_suite(Config) ->" n > + "Config." n n + + (erlang-skel-separator 2) + "%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}" n + "%% Config0 = Config1 = [tuple()]" n + (erlang-skel-separator 2) + "end_per_suite(_Config) ->" n > + "ok." n n + + (erlang-skel-separator 2) + "%% Function: init_per_group(GroupName, Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + "%% GroupName = atom()" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + (erlang-skel-separator 2) + "init_per_group(_GroupName, Config) ->" n > + "Config." n n + + (erlang-skel-separator 2) + "%% Function: end_per_group(GroupName, Config0) ->" n + "%% void() | {save_config,Config1}" n + "%% GroupName = atom()" n + "%% Config0 = Config1 = [tuple()]" n + (erlang-skel-separator 2) + "end_per_group(_GroupName, _Config) ->" n > + "ok." n n + + (erlang-skel-separator 2) + "%% Function: init_per_testcase(TestCase, Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + "%% TestCase = atom()" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + (erlang-skel-separator 2) + "init_per_testcase(_TestCase, Config) ->" n > + "Config." n n + + (erlang-skel-separator 2) + "%% Function: end_per_testcase(TestCase, Config0) ->" n + "%% void() | {save_config,Config1} | {fail,Reason}" n + "%% TestCase = atom()" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + (erlang-skel-separator 2) + "end_per_testcase(_TestCase, _Config) ->" n > + "ok." n n + + (erlang-skel-separator 2) + "%% Function: groups() -> [Group]" n + "%% Group = {GroupName,Properties,GroupsAndTestCases}" n + "%% GroupName = atom()" n + "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n + "%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]" n + "%% TestCase = atom()" n + "%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}}" n + "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n + "%% repeat_until_any_ok | repeat_until_any_fail" n + "%% N = integer() | forever" n + (erlang-skel-separator 2) + "groups() ->" n > + "[]." n n + + (erlang-skel-separator 2) + "%% Function: all() -> GroupsAndTestCases | {skip,Reason}" n + "%% GroupsAndTestCases = [{group,GroupName} | TestCase]" n + "%% GroupName = atom()" n + "%% TestCase = atom()" n + "%% Reason = term()" n + (erlang-skel-separator 2) + "all() -> " n > + "[my_test_case]." n n + + (erlang-skel-separator 2) + "%% Function: TestCase() -> Info" n + "%% Info = [tuple()]" n + (erlang-skel-separator 2) + "my_test_case() -> " n > + "[]." n n + + (erlang-skel-separator 2) + "%% Function: TestCase(Config0) ->" n + "%% ok | exit() | {skip,Reason} | {comment,Comment} |" n + "%% {save_config,Config1} | {skip_and_save,Reason,Config1}" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + "%% Comment = term()" n + (erlang-skel-separator 2) + "my_test_case(_Config) -> " n > + "ok." n + ) + "*The template of a library module. +Please see the function `tempo-define-template'.") diff --git a/lib/tools/emacs/erlang-skels.el b/lib/tools/emacs/erlang-skels.el new file mode 100644 index 0000000000..355b223822 --- /dev/null +++ b/lib/tools/emacs/erlang-skels.el @@ -0,0 +1,1553 @@ +;; +;; %CopyrightBegin% +;; +;; Copyright Ericsson AB 2010. All Rights Reserved. +;; +;; The contents of this file are subject to the Erlang Public License, +;; Version 1.1, (the "License"); you may not use this file except in +;; compliance with the License. You should have received a copy of the +;; Erlang Public License along with this software. If not, it can be +;; retrieved online at http://www.erlang.org/. +;; +;; Software distributed under the License is distributed on an "AS IS" +;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +;; the License for the specific language governing rights and limitations +;; under the License. +;; +;; %CopyrightEnd% +;;; +;;; Purpose: Provide Erlang code skeletons. +;;; See 'erlang-skel-file' variable. + +(defvar erlang-tempo-tags nil + "Tempo tags for erlang mode") + +(defvar erlang-skel + '(("If" "if" erlang-skel-if) + ("Case" "case" erlang-skel-case) + ("Receive" "receive" erlang-skel-receive) + ("Receive After" "after" erlang-skel-receive-after) + ("Receive Loop" "loop" erlang-skel-receive-loop) + ("Module" "module" erlang-skel-module) + ("Author" "author" erlang-skel-author) + ("Function" "function" erlang-skel-function) + () + ("Small Header" "small-header" + erlang-skel-small-header erlang-skel-header) + ("Normal Header" "normal-header" + erlang-skel-normal-header erlang-skel-header) + ("Large Header" "large-header" + erlang-skel-large-header erlang-skel-header) + () + ("Small Server" "small-server" + erlang-skel-small-server erlang-skel-header) + () + ("Application" "application" + erlang-skel-application erlang-skel-header) + ("Supervisor" "supervisor" + erlang-skel-supervisor erlang-skel-header) + ("supervisor_bridge" "supervisor-bridge" + erlang-skel-supervisor-bridge erlang-skel-header) + ("gen_server" "generic-server" + erlang-skel-generic-server erlang-skel-header) + ("gen_event" "gen-event" + erlang-skel-gen-event erlang-skel-header) + ("gen_fsm" "gen-fsm" + erlang-skel-gen-fsm erlang-skel-header) + ("Library module" "gen-lib" + erlang-skel-lib erlang-skel-header) + ("Corba callback" "gen-corba-cb" + erlang-skel-corba-callback erlang-skel-header) + ("Small Common Test suite" "ct-test-suite-s" + erlang-skel-ct-test-suite-s erlang-skel-header) + ("Large Common Test suite" "ct-test-suite-l" + erlang-skel-ct-test-suite-l erlang-skel-header) + ("Erlang TS test suite" "ts-test-suite" + erlang-skel-ts-test-suite erlang-skel-header) + ) + "*Description of all skeleton templates. +Both functions and menu entries will be created. + +Each entry in `erlang-skel' should be a list with three or four +elements, or the empty list. + +The first element is the name which shows up in the menu. The second +is the `tempo' identifier (The string \"erlang-\" will be added in +front of it). The third is the skeleton descriptor, a variable +containing `tempo' attributes as described in the function +`tempo-define-template'. The optional fourth elements denotes a +function which should be called when the menu is selected. + +Functions corresponding to every template will be created. The name +of the function will be `tempo-template-erlang-X' where `X' is the +tempo identifier as specified in the second argument of the elements +in this list. + +A list with zero elements means that the a horizontal line should +be placed in the menu.") + +(defvar erlang-skel-use-separators t + "A boolean than determines whether the skeletons include horizontal +separators. + +Should this variable be nil, the documentation for functions will not +include separators of the form %%--...") + +;; In XEmacs `user-mail-address' returns "[email protected] (Foo Bar)" ARGH! +;; What's wrong with that? RFC 822 says it's legal. [sverkerw] +;; This needs to use the customized value. If that's not sane, things like +;; add-log will lose anyhow. Avoid it if there _is_ a paren. +(defvar erlang-skel-mail-address + (if (or (not user-mail-address) (string-match "(" user-mail-address)) + (concat (user-login-name) "@" + (or (and (boundp 'mail-host-address) + mail-host-address) + (system-name))) + user-mail-address) + "Mail address of the user.") + +;; Expression templates: +(defvar erlang-skel-case + '((erlang-skel-skip-blank) o > + "case " p " of" n> p "_ ->" n> p "ok" n> "end" p) + "*The skeleton of a `case' expression. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-if + '((erlang-skel-skip-blank) o > + "if" n> p " ->" n> p "ok" n> "end" p) + "The skeleton of an `if' expression. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-receive + '((erlang-skel-skip-blank) o > + "receive" n> p "_ ->" n> p "ok" n> "end" p) + "*The skeleton of a `receive' expression. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-receive-after + '((erlang-skel-skip-blank) o > + "receive" n> p "_ ->" n> p "ok" n> "after " p "T ->" n> + p "ok" n> "end" p) + "*The skeleton of a `receive' expression with an `after' clause. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-receive-loop + '(& o "loop(" p ") ->" n> "receive" n> p "_ ->" n> + "loop(" p ")" n> "end.") + "*The skeleton of a simple `receive' loop. +Please see the function `tempo-define-template'.") + + +(defvar erlang-skel-function + '((erlang-skel-separator-start 2) + "%% @doc" n + "%% @spec" n + (erlang-skel-separator-end 2)) + "*The template of a function skeleton. +Please see the function `tempo-define-template'.") + + +;; Attribute templates + +(defvar erlang-skel-module + '(& "-module(" + (erlang-add-quotes-if-needed (erlang-get-module-from-file-name)) + ")." n) + "*The skeleton of a `module' attribute. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-author + '(& "-author('" erlang-skel-mail-address "')." n) + "*The skeleton of a `author' attribute. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-vc nil + "*The skeleton template to generate a version control attribute. +The default is to insert nothing. Example of usage: + + (setq erlang-skel-vc '(& \"-rcs(\\\"$\Id: $ \\\").\") n) + +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-export + '(& "-export([" n> "])." n) + "*The skeleton of an `export' attribute. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-import + '(& "%%-import(Module, [Function/Arity, ...])." n) + "*The skeleton of an `import' attribute. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-compile nil + ;; '(& "%%-compile(export_all)." n) + "*The skeleton of a `compile' attribute. +Please see the function `tempo-define-template'.") + + +;; Comment templates. + +(defvar erlang-skel-date-function 'erlang-skel-dd-mmm-yyyy + "*Function which returns date string. +Look in the module `time-stamp' for a battery of functions.") + +(defvar erlang-skel-copyright-comment + (if (boundp '*copyright-organization*) + '(& "%%% @copyright (C) " (format-time-string "%Y") ", " + *copyright-organization* n) + '(& "%%% @copyright (C) " (format-time-string "%Y") ", " + (user-full-name) n)) + "*The template for a copyright line in the header, normally empty. +This variable should be bound to a `tempo' template, for example: + '(& \"%%% Copyright (C) 2000, Yoyodyne, Inc.\" n) +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-created-comment + '(& "%%% Created : " (funcall erlang-skel-date-function) " by " + (user-full-name) " <" erlang-skel-mail-address ">" n) + "*The template for the \"Created:\" comment line.") + +(defvar erlang-skel-author-comment + '(& "%%% @author " (user-full-name) " <" erlang-skel-mail-address ">" n) + "*The template for creating the \"Author:\" line in the header. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-small-header + '(o (erlang-skel-include erlang-skel-module) + n + (erlang-skel-include erlang-skel-compile erlang-skel-vc)) + "*The template of a small header without any comments. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-normal-header + '(o (erlang-skel-include erlang-skel-author-comment) + (erlang-skel-include erlang-skel-copyright-comment) + "%%% @doc" n + "%%%" p n + "%%% @end" n + (erlang-skel-include erlang-skel-created-comment) n + (erlang-skel-include erlang-skel-small-header) n) + "*The template of a normal header. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-large-header + '(o (erlang-skel-separator) + (erlang-skel-include erlang-skel-author-comment) + (erlang-skel-include erlang-skel-copyright-comment) + "%%% @doc" n + "%%%" p n + "%%% @end" n + (erlang-skel-include erlang-skel-created-comment) + (erlang-skel-separator) + (erlang-skel-include erlang-skel-small-header) ) + "*The template of a large header. +Please see the function `tempo-define-template'.") + + + ;; Server templates. +(defvar erlang-skel-small-server + '((erlang-skel-include erlang-skel-large-header) + "-export([start/0, init/1])." n n n + "start() ->" n> "spawn(" (erlang-get-module-from-file-name) + ", init, [self()])." n n + "init(From) ->" n> + "loop(From)." n n + "loop(From) ->" n> + "receive" n> + p "_ ->" n> + "loop(From)" n> + "end." n + ) + "*Template of a small server. +Please see the function `tempo-define-template'.") + +;; Behaviour templates. +(defvar erlang-skel-application + '((erlang-skel-include erlang-skel-large-header) + "-behaviour(application)." n n + "%% Application callbacks" n + "-export([start/2, stop/1])." n n + (erlang-skel-double-separator-start 3) + "%%% Application callbacks" n + (erlang-skel-double-separator-end 3) n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% This function is called whenever an application is started using" n + "%% application:start/[1,2], and should start the processes of the" n + "%% application. If the application is structured according to the OTP" n + "%% design principles as a supervision tree, this means starting the" n + "%% top supervisor of the tree." n + "%%" n + "%% @spec start(StartType, StartArgs) -> {ok, Pid} |" n + "%% {ok, Pid, State} |" n + "%% {error, Reason}" n + "%% StartType = normal | {takeover, Node} | {failover, Node}" n + "%% StartArgs = term()" n + (erlang-skel-separator-end 2) + "start(_StartType, _StartArgs) ->" n> + "case 'TopSupervisor':start_link() of" n> + "{ok, Pid} ->" n> + "{ok, Pid};" n> + "Error ->" n> + "Error" n> + "end." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% This function is called whenever an application has stopped. It" n + "%% is intended to be the opposite of Module:start/2 and should do" n + "%% any necessary cleaning up. The return value is ignored." n + "%%" n + "%% @spec stop(State) -> void()" n + (erlang-skel-separator-end 2) + "stop(_State) ->" n> + "ok." n + n + (erlang-skel-double-separator-start 3) + "%%% Internal functions" n + (erlang-skel-double-separator-end 3) + ) + "*The template of an application behaviour. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-supervisor + '((erlang-skel-include erlang-skel-large-header) + "-behaviour(supervisor)." n n + + "%% API" n + "-export([start_link/0])." n n + + "%% Supervisor callbacks" n + "-export([init/1])." n n + + "-define(SERVER, ?MODULE)." n n + + (erlang-skel-double-separator-start 3) + "%%% API functions" n + (erlang-skel-double-separator-end 3) n + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Starts the supervisor" n + "%%" n + "%% @spec start_link() -> {ok, Pid} | ignore | {error, Error}" n + (erlang-skel-separator-end 2) + "start_link() ->" n> + "supervisor:start_link({local, ?SERVER}, ?MODULE, [])." n + n + (erlang-skel-double-separator-start 3) + "%%% Supervisor callbacks" n + (erlang-skel-double-separator-end 3) n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Whenever a supervisor is started using supervisor:start_link/[2,3]," n + "%% this function is called by the new process to find out about" n + "%% restart strategy, maximum restart frequency and child" n + "%% specifications." n + "%%" n + "%% @spec init(Args) -> {ok, {SupFlags, [ChildSpec]}} |" n + "%% ignore |" n + "%% {error, Reason}" n + (erlang-skel-separator-end 2) + "init([]) ->" n> + "RestartStrategy = one_for_one," n> + "MaxRestarts = 1000," n> + "MaxSecondsBetweenRestarts = 3600," n + "" n> + "SupFlags = {RestartStrategy, MaxRestarts, MaxSecondsBetweenRestarts}," n + "" n> + "Restart = permanent," n> + "Shutdown = 2000," n> + "Type = worker," n + "" n> + "AChild = {'AName', {'AModule', start_link, []}," n> + "Restart, Shutdown, Type, ['AModule']}," n + "" n> + "{ok, {SupFlags, [AChild]}}." n + n + (erlang-skel-double-separator-start 3) + "%%% Internal functions" n + (erlang-skel-double-separator-end 3) + ) + "*The template of an supervisor behaviour. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-supervisor-bridge + '((erlang-skel-include erlang-skel-large-header) + "-behaviour(supervisor_bridge)." n n + + "%% API" n + "-export([start_link/0])." n n + + "%% supervisor_bridge callbacks" n + "-export([init/1, terminate/2])." n n + + "-define(SERVER, ?MODULE)." n n + + "-record(state, {})." n n + + (erlang-skel-double-separator-start 3) + "%%% API" n + (erlang-skel-double-separator-end 3) n + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Starts the supervisor bridge" n + "%%" n + "%% @spec start_link() -> {ok, Pid} | ignore | {error, Error}" n + (erlang-skel-separator-end 2) + "start_link() ->" n> + "supervisor_bridge:start_link({local, ?SERVER}, ?MODULE, [])." n + n + (erlang-skel-double-separator-start 3) + "%%% supervisor_bridge callbacks" n + (erlang-skel-double-separator-end 3) n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Creates a supervisor_bridge process, linked to the calling process," n + "%% which calls Module:init/1 to start the subsystem. To ensure a" n + "%% synchronized start-up procedure, this function does not return" n + "%% until Module:init/1 has returned." n + "%%" n + "%% @spec init(Args) -> {ok, Pid, State} |" n + "%% ignore |" n + "%% {error, Reason}" n + (erlang-skel-separator-end 2) + "init([]) ->" n> + "case 'AModule':start_link() of" n> + "{ok, Pid} ->" n> + "{ok, Pid, #state{}};" n> + "Error ->" n> + "Error" n> + "end." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% This function is called by the supervisor_bridge when it is about" n + "%% to terminate. It should be the opposite of Module:init/1 and stop" n + "%% the subsystem and do any necessary cleaning up.The return value is" n + "%% ignored." n + "%%" n + "%% @spec terminate(Reason, State) -> void()" n + (erlang-skel-separator-end 2) + "terminate(Reason, State) ->" n> + "'AModule':stop()," n> + "ok." n + n + (erlang-skel-double-separator-start 3) + "%%% Internal functions" n + (erlang-skel-double-separator-end 3) + ) + "*The template of an supervisor_bridge behaviour. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-generic-server + '((erlang-skel-include erlang-skel-large-header) + "-behaviour(gen_server)." n n + + "%% API" n + "-export([start_link/0])." n n + + "%% gen_server callbacks" n + "-export([init/1, handle_call/3, handle_cast/2, " + "handle_info/2," n> + "terminate/2, code_change/3])." n n + + "-define(SERVER, ?MODULE). " n n + + "-record(state, {})." n n + + (erlang-skel-double-separator-start 3) + "%%% API" n + (erlang-skel-double-separator-end 3) n + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Starts the server" n + "%%" n + "%% @spec start_link() -> {ok, Pid} | ignore | {error, Error}" n + (erlang-skel-separator-end 2) + "start_link() ->" n> + "gen_server:start_link({local, ?SERVER}, ?MODULE, [], [])." n + n + (erlang-skel-double-separator-start 3) + "%%% gen_server callbacks" n + (erlang-skel-double-separator-end 3) + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Initializes the server" n + "%%" n + "%% @spec init(Args) -> {ok, State} |" n + "%% {ok, State, Timeout} |" n + "%% ignore |" n + "%% {stop, Reason}" n + (erlang-skel-separator-end 2) + "init([]) ->" n> + "{ok, #state{}}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Handling call messages" n + "%%" n + "%% @spec handle_call(Request, From, State) ->" n + "%% {reply, Reply, State} |" n + "%% {reply, Reply, State, Timeout} |" n + "%% {noreply, State} |" n + "%% {noreply, State, Timeout} |" n + "%% {stop, Reason, Reply, State} |" n + "%% {stop, Reason, State}" n + (erlang-skel-separator-end 2) + "handle_call(_Request, _From, State) ->" n> + "Reply = ok," n> + "{reply, Reply, State}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Handling cast messages" n + "%%" n + "%% @spec handle_cast(Msg, State) -> {noreply, State} |" n + "%% {noreply, State, Timeout} |" n + "%% {stop, Reason, State}" n + (erlang-skel-separator-end 2) + "handle_cast(_Msg, State) ->" n> + "{noreply, State}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Handling all non call/cast messages" n + "%%" n + "%% @spec handle_info(Info, State) -> {noreply, State} |" n + "%% {noreply, State, Timeout} |" n + "%% {stop, Reason, State}" n + (erlang-skel-separator-end 2) + "handle_info(_Info, State) ->" n> + "{noreply, State}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% This function is called by a gen_server when it is about to" n + "%% terminate. It should be the opposite of Module:init/1 and do any" n + "%% necessary cleaning up. When it returns, the gen_server terminates" n + "%% with Reason. The return value is ignored." n + "%%" n + "%% @spec terminate(Reason, State) -> void()" n + (erlang-skel-separator-end 2) + "terminate(_Reason, _State) ->" n> + "ok." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Convert process state when code is changed" n + "%%" n + "%% @spec code_change(OldVsn, State, Extra) -> {ok, NewState}" n + (erlang-skel-separator-end 2) + "code_change(_OldVsn, State, _Extra) ->" n> + "{ok, State}." n + n + (erlang-skel-double-separator-start 3) + "%%% Internal functions" n + (erlang-skel-double-separator-end 3) + ) + "*The template of a generic server. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-gen-event + '((erlang-skel-include erlang-skel-large-header) + "-behaviour(gen_event)." n n + + "%% API" n + "-export([start_link/0, add_handler/0])." n n + + "%% gen_event callbacks" n + "-export([init/1, handle_event/2, handle_call/2, " n> + "handle_info/2, terminate/2, code_change/3])." n n + + "-define(SERVER, ?MODULE). " n n + + "-record(state, {})." n n + + (erlang-skel-double-separator-start 3) + "%%% gen_event callbacks" n + (erlang-skel-double-separator-end 3) n + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Creates an event manager" n + "%%" n + "%% @spec start_link() -> {ok, Pid} | {error, Error}" n + (erlang-skel-separator-end 2) + "start_link() ->" n> + "gen_event:start_link({local, ?SERVER})." n + n + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Adds an event handler" n + "%%" n + "%% @spec add_handler() -> ok | {'EXIT', Reason} | term()" n + (erlang-skel-separator-end 2) + "add_handler() ->" n> + "gen_event:add_handler(?SERVER, ?MODULE, [])." n + n + (erlang-skel-double-separator-start 3) + "%%% gen_event callbacks" n + (erlang-skel-double-separator-end 3) n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Whenever a new event handler is added to an event manager," n + "%% this function is called to initialize the event handler." n + "%%" n + "%% @spec init(Args) -> {ok, State}" n + (erlang-skel-separator-end 2) + "init([]) ->" n> + "{ok, #state{}}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Whenever an event manager receives an event sent using" n + "%% gen_event:notify/2 or gen_event:sync_notify/2, this function is" n + "%% called for each installed event handler to handle the event." n + "%%" n + "%% @spec handle_event(Event, State) ->" n + "%% {ok, State} |" n + "%% {swap_handler, Args1, State1, Mod2, Args2} |"n + "%% remove_handler" n + (erlang-skel-separator-end 2) + "handle_event(_Event, State) ->" n> + "{ok, State}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Whenever an event manager receives a request sent using" n + "%% gen_event:call/3,4, this function is called for the specified" n + "%% event handler to handle the request." n + "%%" n + "%% @spec handle_call(Request, State) ->" n + "%% {ok, Reply, State} |" n + "%% {swap_handler, Reply, Args1, State1, Mod2, Args2} |" n + "%% {remove_handler, Reply}" n + (erlang-skel-separator-end 2) + "handle_call(_Request, State) ->" n> + "Reply = ok," n> + "{ok, Reply, State}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% This function is called for each installed event handler when" n + "%% an event manager receives any other message than an event or a" n + "%% synchronous request (or a system message)." n + "%%" n + "%% @spec handle_info(Info, State) ->" n + "%% {ok, State} |" n + "%% {swap_handler, Args1, State1, Mod2, Args2} |" n + "%% remove_handler" n + (erlang-skel-separator-end 2) + "handle_info(_Info, State) ->" n> + "{ok, State}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Whenever an event handler is deleted from an event manager, this" n + "%% function is called. It should be the opposite of Module:init/1 and" n + "%% do any necessary cleaning up." n + "%%" n + "%% @spec terminate(Reason, State) -> void()" n + (erlang-skel-separator-end 2) + "terminate(_Reason, _State) ->" n> + "ok." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Convert process state when code is changed" n + "%%" n + "%% @spec code_change(OldVsn, State, Extra) -> {ok, NewState}" n + (erlang-skel-separator-end 2) + "code_change(_OldVsn, State, _Extra) ->" n> + "{ok, State}." n + n + (erlang-skel-double-separator-start 3) + "%%% Internal functions" n + (erlang-skel-double-separator-end 3) + ) + "*The template of a gen_event. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-gen-fsm + '((erlang-skel-include erlang-skel-large-header) + "-behaviour(gen_fsm)." n n + + "%% API" n + "-export([start_link/0])." n n + + "%% gen_fsm callbacks" n + "-export([init/1, state_name/2, state_name/3, handle_event/3," n> + "handle_sync_event/4, handle_info/3, terminate/3, code_change/4])." n n + + "-define(SERVER, ?MODULE)." n n + + "-record(state, {})." n n + + (erlang-skel-double-separator-start 3) + "%%% API" n + (erlang-skel-double-separator-end 3) n + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Creates a gen_fsm process which calls Module:init/1 to" n + "%% initialize. To ensure a synchronized start-up procedure, this" n + "%% function does not return until Module:init/1 has returned." n + "%%" n + "%% @spec start_link() -> {ok, Pid} | ignore | {error, Error}" n + (erlang-skel-separator-end 2) + "start_link() ->" n> + "gen_fsm:start_link({local, ?SERVER}, ?MODULE, [], [])." n + n + (erlang-skel-double-separator-start 3) + "%%% gen_fsm callbacks" n + (erlang-skel-double-separator-end 3) n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Whenever a gen_fsm is started using gen_fsm:start/[3,4] or" n + "%% gen_fsm:start_link/[3,4], this function is called by the new" n + "%% process to initialize." n + "%%" n + "%% @spec init(Args) -> {ok, StateName, State} |" n + "%% {ok, StateName, State, Timeout} |" n + "%% ignore |" n + "%% {stop, StopReason}" n + (erlang-skel-separator-end 2) + "init([]) ->" n> + "{ok, state_name, #state{}}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% There should be one instance of this function for each possible" n + "%% state name. Whenever a gen_fsm receives an event sent using" n + "%% gen_fsm:send_event/2, the instance of this function with the same" n + "%% name as the current state name StateName is called to handle" n + "%% the event. It is also called if a timeout occurs." n + "%%" n + "%% @spec state_name(Event, State) ->" n + "%% {next_state, NextStateName, NextState} |" n + "%% {next_state, NextStateName, NextState, Timeout} |" n + "%% {stop, Reason, NewState}" n + (erlang-skel-separator-end 2) + "state_name(_Event, State) ->" n> + "{next_state, state_name, State}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% There should be one instance of this function for each possible" n + "%% state name. Whenever a gen_fsm receives an event sent using" n + "%% gen_fsm:sync_send_event/[2,3], the instance of this function with" n + "%% the same name as the current state name StateName is called to" n + "%% handle the event." n + "%%" n + "%% @spec state_name(Event, From, State) ->" n + "%% {next_state, NextStateName, NextState} |"n + "%% {next_state, NextStateName, NextState, Timeout} |" n + "%% {reply, Reply, NextStateName, NextState} |" n + "%% {reply, Reply, NextStateName, NextState, Timeout} |" n + "%% {stop, Reason, NewState} |" n + "%% {stop, Reason, Reply, NewState}" n + (erlang-skel-separator-end 2) + "state_name(_Event, _From, State) ->" n> + "Reply = ok," n> + "{reply, Reply, state_name, State}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Whenever a gen_fsm receives an event sent using" n + "%% gen_fsm:send_all_state_event/2, this function is called to handle" n + "%% the event." n + "%%" n + "%% @spec handle_event(Event, StateName, State) ->" n + "%% {next_state, NextStateName, NextState} |" n + "%% {next_state, NextStateName, NextState, Timeout} |" n + "%% {stop, Reason, NewState}" n + (erlang-skel-separator-end 2) + "handle_event(_Event, StateName, State) ->" n> + "{next_state, StateName, State}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Whenever a gen_fsm receives an event sent using" n + "%% gen_fsm:sync_send_all_state_event/[2,3], this function is called" n + "%% to handle the event." n + "%%" n + "%% @spec handle_sync_event(Event, From, StateName, State) ->" n + "%% {next_state, NextStateName, NextState} |" n + "%% {next_state, NextStateName, NextState, Timeout} |" n + "%% {reply, Reply, NextStateName, NextState} |" n + "%% {reply, Reply, NextStateName, NextState, Timeout} |" n + "%% {stop, Reason, NewState} |" n + "%% {stop, Reason, Reply, NewState}" n + (erlang-skel-separator-end 2) + "handle_sync_event(_Event, _From, StateName, State) ->" n> + "Reply = ok," n> + "{reply, Reply, StateName, State}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% This function is called by a gen_fsm when it receives any" n + "%% message other than a synchronous or asynchronous event" n + "%% (or a system message)." n + "%%" n + "%% @spec handle_info(Info,StateName,State)->" n + "%% {next_state, NextStateName, NextState} |" n + "%% {next_state, NextStateName, NextState, Timeout} |" n + "%% {stop, Reason, NewState}" n + (erlang-skel-separator-end 2) + "handle_info(_Info, StateName, State) ->" n> + "{next_state, StateName, State}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% This function is called by a gen_fsm when it is about to" n + "%% terminate. It should be the opposite of Module:init/1 and do any" n + "%% necessary cleaning up. When it returns, the gen_fsm terminates with" n + "%% Reason. The return value is ignored." n + "%%" n + "%% @spec terminate(Reason, StateName, State) -> void()" n + (erlang-skel-separator-end 2) + "terminate(_Reason, _StateName, _State) ->" n> + "ok." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Convert process state when code is changed" n + "%%" n + "%% @spec code_change(OldVsn, StateName, State, Extra) ->" n + "%% {ok, StateName, NewState}" n + (erlang-skel-separator-end 2) + "code_change(_OldVsn, StateName, State, _Extra) ->" n> + "{ok, StateName, State}." n + n + (erlang-skel-double-separator-start 3) + "%%% Internal functions" n + (erlang-skel-double-separator-end 3) + ) + "*The template of a gen_fsm. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-lib + '((erlang-skel-include erlang-skel-large-header) + + "%% API" n + "-export([])." n n + + (erlang-skel-double-separator-start 3) + "%%% API" n + (erlang-skel-double-separator-end 3) n + (erlang-skel-separator-start 2) + "%% @doc" n + "%% @spec" n + (erlang-skel-separator-end 2) + n + (erlang-skel-double-separator-start 3) + "%%% Internal functions" n + (erlang-skel-double-separator-end 3) + ) + "*The template of a library module. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-corba-callback + '((erlang-skel-include erlang-skel-large-header) + "%% Include files" n n + + "%% API" n + "-export([])." n n + + "%% Corba callbacks" n + "-export([init/1, terminate/2, code_change/3])." n n + + "-record(state, {})." n n + + (erlang-skel-double-separator-start 3) + "%%% Corba callbacks" n + (erlang-skel-double-separator-end 3) n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Initializes the server" n + "%%" n + "%% @spec init(Args) -> {ok, State} |" n + "%% {ok, State, Timeout} |" n + "%% ignore |" n + "%% {stop, Reason}" n + (erlang-skel-separator-end 2) + "init([]) ->" n> + "{ok, #state{}}." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Shutdown the server" n + "%%" n + "%% @spec terminate(Reason, State) -> void()" n + (erlang-skel-separator-end 2) + "terminate(_Reason, _State) ->" n> + "ok." n + n + (erlang-skel-separator-start 2) + "%% @private" n + "%% @doc" n + "%% Convert process state when code is changed" n + "%%" n + "%% @spec code_change(OldVsn, State, Extra) -> {ok, NewState}" n + (erlang-skel-separator-end 2) + "code_change(_OldVsn, State, _Extra) ->" n> + "{ok, State}." n + n + (erlang-skel-double-separator-start 3) + "%%% Internal functions" n + (erlang-skel-double-separator-end 3) + ) + "*The template of a library module. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-ts-test-suite + '((erlang-skel-include erlang-skel-large-header) + "%% Note: This directive should only be used in test suites." n + "-compile(export_all)." n n + + "-include_lib(\"test_server/include/test_server.hrl\")." n n + + (erlang-skel-separator-start 2) + "%% TEST SERVER CALLBACK FUNCTIONS" n + (erlang-skel-separator 2) + n + (erlang-skel-separator-start 2) + "%%" n + "%% @doc" n + "%% Initialization before the suite." n + "%%" n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the suite." n + "%%" n + "%% Note: This function is free to add any key/value pairs to the Config" n + "%% variable, but should NOT alter/remove any existing entries." n + "%%" n + "%% @spec init_per_suite(Config) -> Config" n + (erlang-skel-separator-end 2) + "init_per_suite(Config) ->" n > + "Config." n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Cleanup after the suite." n + "%% Config - [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%%" n + "%% @spec end_per_suite(Config) -> _" n + (erlang-skel-separator-end 2) + "end_per_suite(_Config) ->" n > + "ok." n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Initialization before each test case" n + "%%" n + "%% TestCase - atom()" n + "%% Name of the test case that is about to be run." n + "%% Config - [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the test case." n + "%%" n + "%% Note: This function is free to add any key/value pairs to the Config" n + "%% variable, but should NOT alter/remove any existing entries." n + "%%" n + "%% @spec init_per_testcase(TestCase, Config) -> Config" n + (erlang-skel-separator-end 2) + "init_per_testcase(_TestCase, Config) ->" n > + "Config." n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Cleanup after each test case" n + "%%" n + "%% TestCase = atom()" n + "%% Name of the test case that is finished." n + "%% Config = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%%" n + "%% @spec end_per_testcase(TestCase, Config) -> _" n + (erlang-skel-separator-end 2) + "end_per_testcase(_TestCase, _Config) ->" n > + "ok."n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Returns a description of the test suite when" n + "%% Clause == doc, and a test specification (list" n + "%% of the conf and test cases in the suite) when" n + "%% Clause == suite." n + "%% Returns a list of all test cases in this test suite" n + "%%" n + "%% Clause = doc | suite" n + "%% Indicates expected return value." n + "%% Descr = [string()] | []" n + "%% String that describes the test suite." n + "%% Spec = [TestCase]" n + "%% A test specification." n + "%% TestCase = ConfCase | atom()" n + "%% Configuration case, or the name of a test case function." n + "%% ConfCase = {conf,Init,Spec,End} |" n + "%% {conf,Properties,Init,Spec,End}" n + "%% Init = End = {Mod,Func} | Func" n + "%% Initialization and cleanup function." n + "%% Mod = Func = atom()" n + "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n + "%% Execution properties of the test cases (may be combined)." n + "%% Shuffle = shuffle | {shuffle,Seed}" n + "%% To get cases executed in random order." n + "%% Seed = {integer(),integer(),integer()}" n + "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n + "%% repeat_until_any_ok | repeat_until_any_fail" n + "%% To get execution of cases repeated." n + "%% N = integer() | forever" n + "%% Reason = term()" n + "%% The reason for skipping the test suite." n + "%%" n + "%% @spec all(Clause) -> TestCases" n + (erlang-skel-separator-end 2) + "all(doc) ->" n > + "[\"Describe the main purpose of this suite\"];" n n + "all(suite) -> " n > + "[a_test_case]." n n + n + (erlang-skel-separator-start 2) + "%% TEST CASES" n + (erlang-skel-separator 2) + n + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Test case function. Returns a description of the test" n + "%% case (doc), then returns a test specification (suite)," n + "%% or performs the actual test (Config)." n + "%%" n + "%% Arg = doc | suite | Config" n + "%% Indicates expected behaviour and return value." n + "%% Config = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Descr = [string()] | []" n + "%% String that describes the test case." n + "%% Spec = [tuple()] | []" n + "%% A test specification, see all/1." n + "%% Reason = term()" n + "%% The reason for skipping the test case." n + "%%" n + "%% @spec TestCase(Arg) -> Descr | Spec | ok | exit() | {skip,Reason}" n + + (erlang-skel-separator-end 2) + "a_test_case(doc) -> " n > + "[\"Describe the main purpose of this test case\"];" n n + "a_test_case(suite) -> " n > + "[];" n n + "a_test_case(Config) when is_list(Config) -> " n > + "ok." n + ) + "*The template of a library module. +Please see the function `tempo-define-template'.") + +(defvar erlang-skel-ct-test-suite-s + '((erlang-skel-include erlang-skel-large-header) + "-compile(export_all)." n n + + "-include_lib(\"common_test/include/ct.hrl\")." n n + + (erlang-skel-separator-start 2) + "%% @spec suite() -> Info" n + "%% Info = [tuple()]" n + (erlang-skel-separator-end 2) + "suite() ->" n > + "[{timetrap,{seconds,30}}]." n n + + (erlang-skel-separator-start 2) + "%% @spec init_per_suite(Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + (erlang-skel-separator-end 2) + "init_per_suite(Config) ->" n > + "Config." n n + + (erlang-skel-separator-start 2) + "%% @spec end_per_suite(Config0) -> void() | {save_config,Config1}" n + "%% Config0 = Config1 = [tuple()]" n + (erlang-skel-separator-end 2) + "end_per_suite(_Config) ->" n > + "ok." n n + + (erlang-skel-separator-start 2) + "%% @spec init_per_group(GroupName, Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + "%% GroupName = atom()" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + (erlang-skel-separator-end 2) + "init_per_group(_GroupName, Config) ->" n > + "Config." n n + + (erlang-skel-separator-start 2) + "%% @spec end_per_group(GroupName, Config0) ->" n + "%% void() | {save_config,Config1}" n + "%% GroupName = atom()" n + "%% Config0 = Config1 = [tuple()]" n + (erlang-skel-separator-end 2) + "end_per_group(_GroupName, _Config) ->" n > + "ok." n n + + (erlang-skel-separator-start 2) + "%% @spec init_per_testcase(TestCase, Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + "%% TestCase = atom()" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + (erlang-skel-separator-end 2) + "init_per_testcase(_TestCase, Config) ->" n > + "Config." n n + + (erlang-skel-separator-start 2) + "%% @spec end_per_testcase(TestCase, Config0) ->" n + "%% void() | {save_config,Config1} | {fail,Reason}" n + "%% TestCase = atom()" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + (erlang-skel-separator-end 2) + "end_per_testcase(_TestCase, _Config) ->" n > + "ok." n n + + (erlang-skel-separator-start 2) + "%% @spec groups() -> [Group]" n + "%% Group = {GroupName,Properties,GroupsAndTestCases}" n + "%% GroupName = atom()" n + "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n + "%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]" n + "%% TestCase = atom()" n + "%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}}" n + "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n + "%% repeat_until_any_ok | repeat_until_any_fail" n + "%% N = integer() | forever" n + (erlang-skel-separator-end 2) + "groups() ->" n > + "[]." n n + + (erlang-skel-separator-start 2) + "%% @spec all() -> GroupsAndTestCases | {skip,Reason}" n + "%% GroupsAndTestCases = [{group,GroupName} | TestCase]" n + "%% GroupName = atom()" n + "%% TestCase = atom()" n + "%% Reason = term()" n + (erlang-skel-separator-end 2) + "all() -> " n > + "[my_test_case]." n n + + (erlang-skel-separator-start 2) + "%% @spec TestCase() -> Info" n + "%% Info = [tuple()]" n + (erlang-skel-separator-end 2) + "my_test_case() -> " n > + "[]." n n + + (erlang-skel-separator-start 2) + "%% @spec TestCase(Config0) ->" n + "%% ok | exit() | {skip,Reason} | {comment,Comment} |" n + "%% {save_config,Config1} | {skip_and_save,Reason,Config1}" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + "%% Comment = term()" n + (erlang-skel-separator-end 2) + "my_test_case(_Config) -> " n > + "ok." n + ) + "*The template of a library module. +Please see the function `tempo-define-template'.") + + +(defvar erlang-skel-ct-test-suite-l + '((erlang-skel-include erlang-skel-large-header) + "%% Note: This directive should only be used in test suites." n + "-compile(export_all)." n n + + "-include_lib(\"common_test/include/ct.hrl\")." n n + + (erlang-skel-separator-start 2) + "%% COMMON TEST CALLBACK FUNCTIONS" n + (erlang-skel-separator 2) + n + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Returns list of tuples to set default properties" n + "%% for the suite." n + "%%" n + "%% Function: suite() -> Info" n + "%%" n + "%% Info = [tuple()]" n + "%% List of key/value pairs." n + "%%" n + "%% Note: The suite/0 function is only meant to be used to return" n + "%% default data values, not perform any other operations." n + "%%" n + "%% @spec suite() -> Info" n + (erlang-skel-separator-end 2) + "suite() ->" n > + "[{timetrap,{minutes,10}}]." n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Initialization before the whole suite" n + "%%" n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the suite." n + "%%" n + "%% Note: This function is free to add any key/value pairs to the Config" n + "%% variable, but should NOT alter/remove any existing entries." n + "%%" n + "%% @spec init_per_suite(Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + (erlang-skel-separator-end 2) + "init_per_suite(Config) ->" n > + "Config." n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Cleanup after the whole suite" n + "%%" n + "%% Config - [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%%" n + "%% @spec end_per_suite(Config) -> _" n + (erlang-skel-separator-end 2) + "end_per_suite(_Config) ->" n > + "ok." n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Initialization before each test case group." n + "%%" n + "%% GroupName = atom()" n + "%% Name of the test case group that is about to run." n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding configuration data for the group." n + "%% Reason = term()" n + "%% The reason for skipping all test cases and subgroups in the group." n + "%%" n + "%% @spec init_per_group(GroupName, Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + (erlang-skel-separator-end 2) + "init_per_group(_GroupName, Config) ->" n > + "Config." n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Cleanup after each test case group." n + "%%" n + "%% GroupName = atom()" n + "%% Name of the test case group that is finished." n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding configuration data for the group." n + "%%" n + "%% @spec end_per_group(GroupName, Config0) ->" n + "%% void() | {save_config,Config1}" n + (erlang-skel-separator-end 2) + "end_per_group(_GroupName, _Config) ->" n > + "ok." n n + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Initialization before each test case" n + "%%" n + "%% TestCase - atom()" n + "%% Name of the test case that is about to be run." n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the test case." n + "%%" n + "%% Note: This function is free to add any key/value pairs to the Config" n + "%% variable, but should NOT alter/remove any existing entries." n + "%%" n + "%% @spec init_per_testcase(TestCase, Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + (erlang-skel-separator-end 2) + "init_per_testcase(_TestCase, Config) ->" n > + "Config." n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Cleanup after each test case" n + "%%" n + "%% TestCase - atom()" n + "%% Name of the test case that is finished." n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%%" n + "%% @spec end_per_testcase(TestCase, Config0) ->" n + "%% void() | {save_config,Config1} | {fail,Reason}" n + (erlang-skel-separator-end 2) + "end_per_testcase(_TestCase, _Config) ->" n > + "ok." n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Returns a list of test case group definitions." n + "%%" n + "%% Group = {GroupName,Properties,GroupsAndTestCases}" n + "%% GroupName = atom()" n + "%% The name of the group." n + "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n + "%% Group properties that may be combined." n + "%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]" n + "%% TestCase = atom()" n + "%% The name of a test case." n + "%% Shuffle = shuffle | {shuffle,Seed}" n + "%% To get cases executed in random order." n + "%% Seed = {integer(),integer(),integer()}" n + "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n + "%% repeat_until_any_ok | repeat_until_any_fail" n + "%% To get execution of cases repeated." n + "%% N = integer() | forever" n + "%%" n + "%% @spec: groups() -> [Group]" n + (erlang-skel-separator-end 2) + "groups() ->" n > + "[]." n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Returns the list of groups and test cases that" n + "%% are to be executed." n + "%%" n + "%% GroupsAndTestCases = [{group,GroupName} | TestCase]" n + "%% GroupName = atom()" n + "%% Name of a test case group." n + "%% TestCase = atom()" n + "%% Name of a test case." n + "%% Reason = term()" n + "%% The reason for skipping all groups and test cases." n + "%%" n + "%% @spec all() -> GroupsAndTestCases | {skip,Reason}" n + (erlang-skel-separator-end 2) + "all() -> " n > + "[my_test_case]." n n + + n + (erlang-skel-separator-start 2) + "%% TEST CASES" n + (erlang-skel-separator 2) + n + + (erlang-skel-separator-start 2) + "%% @doc " n + "%% Test case info function - returns list of tuples to set" n + "%% properties for the test case." n + "%%" n + "%% Info = [tuple()]" n + "%% List of key/value pairs." n + "%%" n + "%% Note: This function is only meant to be used to return a list of" n + "%% values, not perform any other operations." n + "%%" n + "%% @spec TestCase() -> Info " n + (erlang-skel-separator-end 2) + "my_test_case() -> " n > + "[]." n n + + (erlang-skel-separator 2) + "%% @doc Test case function. (The name of it must be specified in" n + "%% the all/0 list or in a test case group for the test case" n + "%% to be executed)." n + "%%" n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the test case." n + "%% Comment = term()" n + "%% A comment about the test case that will be printed in the html log." n + "%%" n + "%% @spec TestCase(Config0) ->" n + "%% ok | exit() | {skip,Reason} | {comment,Comment} |" n + "%% {save_config,Config1} | {skip_and_save,Reason,Config1}" n + (erlang-skel-separator-end 2) + "my_test_case(_Config) -> " n > + "ok." n + + ) + "*The template of a library module. + Please see the function `tempo-define-template'.") + +;; Skeleton code: + +;; This code is based on the package `tempo' which is part of modern +;; Emacsen. (GNU Emacs 19.25 (?) and XEmacs 19.14.) + +(defun erlang-skel-init () + "Generate the skeleton functions and menu items. +The variable `erlang-skel' contains the name and descriptions of +all skeletons. + +The skeleton routines are based on the `tempo' package. Should this +package not be present, this function does nothing." + (interactive) + (condition-case nil + (require 'tempo) + (error t)) + (if (featurep 'tempo) + (let ((skel erlang-skel) + (menu '())) + (while skel + (cond ((null (car skel)) + (setq menu (cons nil menu))) + (t + (funcall (symbol-function 'tempo-define-template) + (concat "erlang-" (nth 1 (car skel))) + ;; The tempo template used contains an `include' + ;; function call only, hence changes to the + ;; variables describing the templates take effect + ;; immdiately. + (list (list 'erlang-skel-include (nth 2 (car skel)))) + (nth 1 (car skel))) + (setq menu (cons (erlang-skel-make-menu-item + (car skel)) menu)))) + (setq skel (cdr skel))) + (setq erlang-menu-skel-items + (list nil (list "Skeletons" (nreverse menu)))) + (setq erlang-menu-items + (erlang-menu-add-above 'erlang-menu-skel-items + 'erlang-menu-version-items + erlang-menu-items)) + (erlang-menu-init)))) + +(defun erlang-skel-make-menu-item (skel) + (let ((func (intern (concat "tempo-template-erlang-" (nth 1 skel))))) + (cond ((null (nth 3 skel)) + (list (car skel) func)) + (t + (list (car skel) + (list 'lambda '() + '(interactive) + (list 'funcall + (list 'quote (nth 3 skel)) + (list 'quote func)))))))) + +;; Functions designed to be added to the skeleton menu. +;; (Not normally used) +(defun erlang-skel-insert (func) + "Insert skeleton generated by FUNC and goto first tempo mark." + (save-excursion (funcall func)) + (funcall (symbol-function 'tempo-forward-mark))) + +(defun erlang-skel-header (func) + "Insert the header generated by FUNC at the beginning of the buffer." + (goto-char (point-min)) + (save-excursion (funcall func)) + (funcall (symbol-function 'tempo-forward-mark))) + + +;; Functions used inside the skeleton descriptions. +(defun erlang-skel-skip-blank () + (skip-chars-backward " \t") + nil) + +(defun erlang-skel-include (&rest args) + "Include a template inside another template. + +Example of use, assuming that `erlang-skel-func' is defined: + + (defvar foo-skeleton '(\"%%% New function:\" + (erlang-skel-include erlang-skel-func))) + +Technically, this function returns the `tempo' attribute`(l ...)' which +can contain other `tempo' attributes. Please see the function +`tempo-define-template' for a description of the `(l ...)' attribute." + (let ((res '()) + entry) + (while args + (setq entry (car args)) + (while entry + (setq res (cons (car entry) res)) + (setq entry (cdr entry))) + (setq args (cdr args))) + (cons 'l (nreverse res)))) + +(defun erlang-skel-separator (&optional percent) + "Return a comment separator." + (let ((percent (or percent 3))) + (concat (make-string percent ?%) + (make-string (- 70 percent) ?-) + "\n"))) + +(defun erlang-skel-separator-start (&optional percent) + "Return a comment separator or an empty string if separators +are configured off." + (if erlang-skel-use-separators + (erlang-skel-separator percent) + "")) + +(defun erlang-skel-separator-end (&optional percent) + "Return a comment separator to end a function comment block or an +empty string if separators are configured off." + (if erlang-skel-use-separators + (concat "%% @end\n" (erlang-skel-separator percent)) + "")) + +(defun erlang-skel-double-separator (&optional percent) + "Return a double line (equals sign) comment separator." + (let ((percent (or percent 3))) + (concat (make-string percent ?%) + (make-string (- 70 percent) ?=) + "\n"))) + +(defun erlang-skel-double-separator-start (&optional percent) + "Return a double separator or a newline if separators are configured off." + (if erlang-skel-use-separators + (erlang-skel-double-separator percent) + "\n")) + +(defun erlang-skel-double-separator-end (&optional percent) + "Return a double separator or an empty string if separators are +configured off." + (if erlang-skel-use-separators + (erlang-skel-double-separator percent) + "")) + +(defun erlang-skel-dd-mmm-yyyy () + "Return the current date as a string in \"DD Mon YYYY\" form. +The first character of DD is space if the value is less than 10." + (let ((date (current-time-string))) + (format "%2d %s %s" + (string-to-int (substring date 8 10)) + (substring date 4 7) + (substring date -4)))) + +;; Local variables: +;; coding: iso-8859-1 +;; End: + +;;; erlang-skels.el ends here diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el index 4fc4826238..da586ee09a 100644 --- a/lib/tools/emacs/erlang.el +++ b/lib/tools/emacs/erlang.el @@ -1,19 +1,19 @@ ;; erlang.el --- Major modes for editing and running Erlang ;; %CopyrightBegin% -;; -;; Copyright Ericsson AB 1996-2009. All Rights Reserved. -;; +;; +;; Copyright Ericsson AB 1996-2010. All Rights Reserved. +;; ;; The contents of this file are subject to the Erlang Public License, ;; Version 1.1, (the "License"); you may not use this file except in ;; compliance with the License. You should have received a copy of the ;; Erlang Public License along with this software. If not, it can be ;; retrieved online at http://www.erlang.org/. -;; +;; ;; Software distributed under the License is distributed on an "AS IS" ;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See ;; the License for the specific language governing rights and limitations ;; under the License. -;; +;; ;; %CopyrightEnd% ;; ;; Copyright (C) 2004 Free Software Foundation, Inc. @@ -72,7 +72,7 @@ ;; Variables: -(defconst erlang-version "2.6.2" +(defconst erlang-version "2.7" "The version number of Erlang mode.") (defvar erlang-root-dir nil @@ -895,1254 +895,16 @@ behaviour.") (defconst inferior-erlang-use-cmm (boundp 'minor-mode-overriding-map-alist) "Non-nil means use `compilation-minor-mode' in Erlang shell.") -;; Tempo skeleton templates: - -(defvar erlang-tempo-tags nil - "Tempo tags for erlang mode") - -(defvar erlang-skel - '(("If" "if" erlang-skel-if) - ("Case" "case" erlang-skel-case) - ("Receive" "receive" erlang-skel-receive) - ("Receive After" "after" erlang-skel-receive-after) - ("Receive Loop" "loop" erlang-skel-receive-loop) - ("Module" "module" erlang-skel-module) - ("Author" "author" erlang-skel-author) - () - ("Small Header" "small-header" - erlang-skel-small-header erlang-skel-header) - ("Normal Header" "normal-header" - erlang-skel-normal-header erlang-skel-header) - ("Large Header" "large-header" - erlang-skel-large-header erlang-skel-header) - () - ("Small Server" "small-server" - erlang-skel-small-server erlang-skel-header) - () - ("Application" "application" - erlang-skel-application erlang-skel-header) - ("Supervisor" "supervisor" - erlang-skel-supervisor erlang-skel-header) - ("supervisor_bridge" "supervisor-bridge" - erlang-skel-supervisor-bridge erlang-skel-header) - ("gen_server" "generic-server" - erlang-skel-generic-server erlang-skel-header) - ("gen_event" "gen-event" - erlang-skel-gen-event erlang-skel-header) - ("gen_fsm" "gen-fsm" - erlang-skel-gen-fsm erlang-skel-header) - ("Library module" "gen-lib" - erlang-skel-lib erlang-skel-header) - ("Corba callback" "gen-corba-cb" - erlang-skel-corba-callback erlang-skel-header) - ("Small Common Test suite" "ct-test-suite-s" - erlang-skel-ct-test-suite-s erlang-skel-header) - ("Large Common Test suite" "ct-test-suite-l" - erlang-skel-ct-test-suite-l erlang-skel-header) - ("Erlang TS test suite" "ts-test-suite" - erlang-skel-ts-test-suite erlang-skel-header) - ) - "*Description of all skeleton templates. -Both functions and menu entries will be created. - -Each entry in `erlang-skel' should be a list with three or four -elements, or the empty list. - -The first element is the name which shows up in the menu. The second -is the `tempo' identifier (The string \"erlang-\" will be added in -front of it). The third is the skeleton descriptor, a variable -containing `tempo' attributes as described in the function -`tempo-define-template'. The optional fourth elements denotes a -function which should be called when the menu is selected. - -Functions corresponding to every template will be created. The name -of the function will be `tempo-template-erlang-X' where `X' is the -tempo identifier as specified in the second argument of the elements -in this list. - -A list with zero elements means that the a horizontal line should -be placed in the menu.") - -;; In XEmacs `user-mail-address' returns "[email protected] (Foo Bar)" ARGH! -;; What's wrong with that? RFC 822 says it's legal. [sverkerw] -;; This needs to use the customized value. If that's not sane, things like -;; add-log will lose anyhow. Avoid it if there _is_ a paren. -(defvar erlang-skel-mail-address - (if (or (not user-mail-address) (string-match "(" user-mail-address)) - (concat (user-login-name) "@" - (or (and (boundp 'mail-host-address) - mail-host-address) - (system-name))) - user-mail-address) - "Mail address of the user.") - -;; Expression templates: -(defvar erlang-skel-case - '((erlang-skel-skip-blank) o > - "case " p " of" n> p "_ ->" n> p "ok" n> "end" p) - "*The skeleton of a `case' expression. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-if - '((erlang-skel-skip-blank) o > - "if" n> p " ->" n> p "ok" n> "end" p) - "The skeleton of an `if' expression. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-receive - '((erlang-skel-skip-blank) o > - "receive" n> p "_ ->" n> p "ok" n> "end" p) - "*The skeleton of a `receive' expression. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-receive-after - '((erlang-skel-skip-blank) o > - "receive" n> p "_ ->" n> p "ok" n> "after " p "T ->" n> - p "ok" n> "end" p) - "*The skeleton of a `receive' expression with an `after' clause. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-receive-loop - '(& o "loop(" p ") ->" n> "receive" n> p "_ ->" n> - "loop(" p ")" n> "end.") - "*The skeleton of a simple `receive' loop. -Please see the function `tempo-define-template'.") - - -;; Attribute templates - -(defvar erlang-skel-module - '(& "-module(" - (erlang-add-quotes-if-needed (erlang-get-module-from-file-name)) - ")." n) - "*The skeleton of a `module' attribute. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-author - '(& "-author('" erlang-skel-mail-address "')." n) - "*The skeleton of a `author' attribute. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-vc nil - "*The skeleton template to generate a version control attribute. -The default is to insert nothing. Example of usage: - - (setq erlang-skel-vc '(& \"-rcs(\\\"$\Id: $ \\\").\") n) - -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-export - '(& "-export([" n> "])." n) - "*The skeleton of an `export' attribute. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-import - '(& "%%-import(Module, [Function/Arity, ...])." n) - "*The skeleton of an `import' attribute. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-compile nil - ;; '(& "%%-compile(export_all)." n) - "*The skeleton of a `compile' attribute. -Please see the function `tempo-define-template'.") - - -;; Comment templates. - -(defvar erlang-skel-date-function 'erlang-skel-dd-mmm-yyyy - "*Function which returns date string. -Look in the module `time-stamp' for a battery of functions.") - -(defvar erlang-skel-copyright-comment '() - "*The template for a copyright line in the header, normally empty. -This variable should be bound to a `tempo' template, for example: - '(& \"%%% Copyright (C) 2000, Yoyodyne, Inc.\" n) - -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-created-comment - '(& "%%% Created : " (funcall erlang-skel-date-function) " by " - (user-full-name) " <" erlang-skel-mail-address ">" n) - "*The template for the \"Created:\" comment line.") - -(defvar erlang-skel-author-comment - '(& "%%% Author : " (user-full-name) " <" erlang-skel-mail-address ">" n) - "*The template for creating the \"Author:\" line in the header. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-file-comment - '(& "%%% File : " (file-name-nondirectory buffer-file-name) n) -"*The template for creating the \"Module:\" line in the header. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-small-header - '(o (erlang-skel-include erlang-skel-module) - ;; erlang-skel-author) - n - (erlang-skel-include erlang-skel-compile - ;; erlang-skel-export - erlang-skel-vc)) - "*The template of a small header without any comments. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-normal-header - '(o (erlang-skel-include erlang-skel-copyright-comment - erlang-skel-file-comment - erlang-skel-author-comment) - "%%% Description : " p n - (erlang-skel-include erlang-skel-created-comment) n - (erlang-skel-include erlang-skel-small-header) n) - "*The template of a normal header. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-large-header - '(o (erlang-skel-separator) - (erlang-skel-include erlang-skel-copyright-comment - erlang-skel-file-comment - erlang-skel-author-comment) - "%%% Description : " p n - "%%%" n - (erlang-skel-include erlang-skel-created-comment) - (erlang-skel-separator) - (erlang-skel-include erlang-skel-small-header) ) - "*The template of a large header. -Please see the function `tempo-define-template'.") - - -;; Server templates. - -(defvar erlang-skel-small-server - '((erlang-skel-include erlang-skel-large-header) - "-export([start/0,init/1])." n n n - "start() ->" n> "spawn(" (erlang-get-module-from-file-name) - ", init, [self()])." n n - "init(From) ->" n> - "loop(From)." n n - "loop(From) ->" n> - "receive" n> - p "_ ->" n> - "loop(From)" n> - "end." - ) - "*Template of a small server. -Please see the function `tempo-define-template'.") - -;; Behaviour templates. - -(defvar erlang-skel-application - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(application)." n n - "%% Application callbacks" n - "-export([start/2, stop/1])." n n - (erlang-skel-double-separator 2) - "%% Application callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: start(Type, StartArgs) -> {ok, Pid} |" n - "%% {ok, Pid, State} |" n - "%% {error, Reason}" n - "%% Description: This function is called whenever an application " n - "%% is started using application:start/1,2, and should start the processes" n - "%% of the application. If the application is structured according to the" n - "%% OTP design principles as a supervision tree, this means starting the" n - "%% top supervisor of the tree." n - (erlang-skel-separator 2) - "start(_Type, StartArgs) ->" n> - "case 'TopSupervisor':start_link(StartArgs) of" n> - "{ok, Pid} -> " n> - "{ok, Pid};" n> - "Error ->" n> - "Error" n> - "end." n - n - (erlang-skel-separator 2) - "%% Function: stop(State) -> void()" n - "%% Description: This function is called whenever an application" n - "%% has stopped. It is intended to be the opposite of Module:start/2 and" n - "%% should do any necessary cleaning up. The return value is ignored. "n - (erlang-skel-separator 2) - "stop(_State) ->" n> - "ok." n - n - (erlang-skel-double-separator 2) - "%% Internal functions" n - (erlang-skel-double-separator 2) - ) - "*The template of an application behaviour. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-supervisor - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(supervisor)." n n - "%% API" n - "-export([start_link/0])." n n +(defvar erlang-skel-file "erlang-skels" + "The type of erlang-skeletons that should be used, default + uses edoc type, for the old type, standard comments, + set \"erlang-skels-old\" in your .emacs and restart. - "%% Supervisor callbacks" n - "-export([init/1])." n n + Or define your own and set the variable to that file.") - "-define(SERVER, ?MODULE)." n n - - (erlang-skel-double-separator 2) - "%% API functions" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n - "%% Description: Starts the supervisor" n - (erlang-skel-separator 2) - "start_link() ->" n> - "supervisor:start_link({local, ?SERVER}, ?MODULE, [])." n - n - (erlang-skel-double-separator 2) - "%% Supervisor callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Func: init(Args) -> {ok, {SupFlags, [ChildSpec]}} |" n - "%% ignore |" n - "%% {error, Reason}" n - "%% Description: Whenever a supervisor is started using "n - "%% supervisor:start_link/[2,3], this function is called by the new process "n - "%% to find out about restart strategy, maximum restart frequency and child "n - "%% specifications." n - (erlang-skel-separator 2) - "init([]) ->" n> - "AChild = {'AName',{'AModule',start_link,[]}," n> - "permanent,2000,worker,['AModule']}," n> - "{ok,{{one_for_all,0,1}, [AChild]}}." n - n - (erlang-skel-double-separator 2) - "%% Internal functions" n - (erlang-skel-double-separator 2) - ) - "*The template of an supervisor behaviour. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-supervisor-bridge - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(supervisor_bridge)." n n - - "%% API" n - "-export([start_link/0])." n n - - "%% supervisor_bridge callbacks" n - "-export([init/1, terminate/2])." n n - - "-define(SERVER, ?MODULE)." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator 2) - "%% API" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n - "%% Description: Starts the supervisor bridge" n - (erlang-skel-separator 2) - "start_link() ->" n> - "supervisor_bridge:start_link({local, ?SERVER}, ?MODULE, [])." n - n - (erlang-skel-double-separator 2) - "%% supervisor_bridge callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Funcion: init(Args) -> {ok, Pid, State} |" n - "%% ignore |" n - "%% {error, Reason} " n - "%% Description:Creates a supervisor_bridge process, linked to the calling" n - "%% process, which calls Module:init/1 to start the subsystem. To ensure a" n - "%% synchronized start-up procedure, this function does not return until" n - "%% Module:init/1 has returned. " n - (erlang-skel-separator 2) - "init([]) ->" n> - "case 'AModule':start_link() of" n> - "{ok, Pid} ->" n> - "{ok, Pid, #state{}};" n> - "Error ->" n> - "Error" n> - "end." n - n - (erlang-skel-separator 2) - "%% Func: terminate(Reason, State) -> void()" n - "%% Description:This function is called by the supervisor_bridge when it is"n - "%% about to terminate. It should be the opposite of Module:init/1 and stop"n - "%% the subsystem and do any necessary cleaning up.The return value is ignored." - (erlang-skel-separator 2) - "terminate(Reason, State) ->" n> - "'AModule':stop()," n> - "ok." n - n - (erlang-skel-double-separator 2) - "%% Internal functions" n - (erlang-skel-double-separator 2) - ) - "*The template of an supervisor_bridge behaviour. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-generic-server - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(gen_server)." n n - - "%% API" n - "-export([start_link/0])." n n - - "%% gen_server callbacks" n - "-export([init/1, handle_call/3, handle_cast/2, " - "handle_info/2," n> - "terminate/2, code_change/3])." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator 2) - "%% API" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n - "%% Description: Starts the server" n - (erlang-skel-separator 2) - "start_link() ->" n> - "gen_server:start_link({local, ?SERVER}, ?MODULE, [], [])." n - n - (erlang-skel-double-separator 2) - "%% gen_server callbacks" n - (erlang-skel-double-separator 2) - n - (erlang-skel-separator 2) - "%% Function: init(Args) -> {ok, State} |" n - "%% {ok, State, Timeout} |" n - "%% ignore |" n - "%% {stop, Reason}" n - "%% Description: Initiates the server" n - (erlang-skel-separator 2) - "init([]) ->" n> - "{ok, #state{}}." n - n - (erlang-skel-separator 2) - "%% Function: " - "%% handle_call(Request, From, State) -> {reply, Reply, State} |" n - "%% {reply, Reply, State, Timeout} |" n - "%% {noreply, State} |" n - "%% {noreply, State, Timeout} |" n - "%% {stop, Reason, Reply, State} |" n - "%% {stop, Reason, State}" n - "%% Description: Handling call messages" n - (erlang-skel-separator 2) - "handle_call(_Request, _From, State) ->" n> - "Reply = ok," n> - "{reply, Reply, State}." n - n - (erlang-skel-separator 2) - "%% Function: handle_cast(Msg, State) -> {noreply, State} |" n - "%% {noreply, State, Timeout} |" n - "%% {stop, Reason, State}" n - "%% Description: Handling cast messages" n - - (erlang-skel-separator 2) - "handle_cast(_Msg, State) ->" n> - "{noreply, State}." n - n - (erlang-skel-separator 2) - "%% Function: handle_info(Info, State) -> {noreply, State} |" n - "%% {noreply, State, Timeout} |" n - "%% {stop, Reason, State}" n - "%% Description: Handling all non call/cast messages" n - (erlang-skel-separator 2) - "handle_info(_Info, State) ->" n> - "{noreply, State}." n - n - (erlang-skel-separator 2) - "%% Function: terminate(Reason, State) -> void()" n - "%% Description: This function is called by a gen_server when it is about to"n - "%% terminate. It should be the opposite of Module:init/1 and do any necessary"n - "%% cleaning up. When it returns, the gen_server terminates with Reason." n - "%% The return value is ignored." n - - (erlang-skel-separator 2) - "terminate(_Reason, _State) ->" n> - "ok." n - n - (erlang-skel-separator 2) - "%% Func: code_change(OldVsn, State, Extra) -> {ok, NewState}" n - "%% Description: Convert process state when code is changed" n - (erlang-skel-separator 2) - "code_change(_OldVsn, State, _Extra) ->" n> - "{ok, State}." n - n - (erlang-skel-separator 2) - "%%% Internal functions" n - (erlang-skel-separator 2) - ) - "*The template of a generic server. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-gen-event - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(gen_event)." n - - "%% API" n - "-export([start_link/0, add_handler/0])." n n - - "%% gen_event callbacks" n - "-export([init/1, handle_event/2, handle_call/2, " n> - "handle_info/2, terminate/2, code_change/3])." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator 2) - "%% gen_event callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: start_link() -> {ok,Pid} | {error,Error} " n - "%% Description: Creates an event manager." n - (erlang-skel-separator 2) - "start_link() ->" n> - "gen_event:start_link({local, ?SERVER}). " n - n - (erlang-skel-separator 2) - "%% Function: add_handler() -> ok | {'EXIT',Reason} | term()" n - "%% Description: Adds an event handler" n - (erlang-skel-separator 2) - "add_handler() ->" n> - "gen_event:add_handler(?SERVER, ?MODULE, [])." n - n - (erlang-skel-double-separator 2) - "%% gen_event callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: init(Args) -> {ok, State}" n - "%% Description: Whenever a new event handler is added to an event manager,"n - "%% this function is called to initialize the event handler." n - (erlang-skel-separator 2) - "init([]) ->" n> - "{ok, #state{}}." n - n - (erlang-skel-separator 2) - "%% Function: "n - "%% handle_event(Event, State) -> {ok, State} |" n - "%% {swap_handler, Args1, State1, Mod2, Args2} |"n - "%% remove_handler" n - "%% Description:Whenever an event manager receives an event sent using"n - "%% gen_event:notify/2 or gen_event:sync_notify/2, this function is called for"n - "%% each installed event handler to handle the event. "n - (erlang-skel-separator 2) - "handle_event(_Event, State) ->" n> - "{ok, State}." n - n - (erlang-skel-separator 2) - "%% Function: " n - "%% handle_call(Request, State) -> {ok, Reply, State} |" n - "%% {swap_handler, Reply, Args1, State1, "n - "%% Mod2, Args2} |" n - "%% {remove_handler, Reply}" n - "%% Description: Whenever an event manager receives a request sent using"n - "%% gen_event:call/3,4, this function is called for the specified event "n - "%% handler to handle the request."n - (erlang-skel-separator 2) - "handle_call(_Request, State) ->" n> - "Reply = ok," n> - "{ok, Reply, State}." n - n - (erlang-skel-separator 2) - "%% Function: " n - "%% handle_info(Info, State) -> {ok, State} |" n - "%% {swap_handler, Args1, State1, Mod2, Args2} |" n - "%% remove_handler" n - "%% Description: This function is called for each installed event handler when"n - "%% an event manager receives any other message than an event or a synchronous"n - "%% request (or a system message)."n - (erlang-skel-separator 2) - "handle_info(_Info, State) ->" n> - "{ok, State}." n - n - (erlang-skel-separator 2) - "%% Function: terminate(Reason, State) -> void()" n - "%% Description:Whenever an event handler is deleted from an event manager,"n - "%% this function is called. It should be the opposite of Module:init/1 and "n - "%% do any necessary cleaning up. " n - (erlang-skel-separator 2) - "terminate(_Reason, _State) ->" n> - "ok." n - n - (erlang-skel-separator 2) - "%% Function: code_change(OldVsn, State, Extra) -> {ok, NewState} " n - "%% Description: Convert process state when code is changed" n - (erlang-skel-separator 2) - "code_change(_OldVsn, State, _Extra) ->" n> - "{ok, State}." n - n - (erlang-skel-separator 2) - "%%% Internal functions" n - (erlang-skel-separator 2) - ) - "*The template of a gen_event. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-gen-fsm - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(gen_fsm)." n n - - "%% API" n - "-export([start_link/0])." n n - - "%% gen_fsm callbacks" n - "-export([init/1, state_name/2, state_name/3, handle_event/3," n> - "handle_sync_event/4, handle_info/3, terminate/3, code_change/4])." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator 2) - "%% API" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: start_link() -> ok,Pid} | ignore | {error,Error}" n - "%% Description:Creates a gen_fsm process which calls Module:init/1 to"n - "%% initialize. To ensure a synchronized start-up procedure, this function" n - "%% does not return until Module:init/1 has returned. " n - (erlang-skel-separator 2) - "start_link() ->" n> - "gen_fsm:start_link({local, ?SERVER}, ?MODULE, [], [])." n - n - (erlang-skel-double-separator 2) - "%% gen_fsm callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: init(Args) -> {ok, StateName, State} |" n - "%% {ok, StateName, State, Timeout} |" n - "%% ignore |" n - "%% {stop, StopReason} " n - "%% Description:Whenever a gen_fsm is started using gen_fsm:start/[3,4] or"n - "%% gen_fsm:start_link/3,4, this function is called by the new process to "n - "%% initialize. " n - (erlang-skel-separator 2) - "init([]) ->" n> - "{ok, state_name, #state{}}." n - n - (erlang-skel-separator 2) - "%% Function: "n - "%% state_name(Event, State) -> {next_state, NextStateName, NextState}|" n - "%% {next_state, NextStateName, " n - "%% NextState, Timeout} |" n - "%% {stop, Reason, NewState}" n - "%% Description:There should be one instance of this function for each possible"n - "%% state name. Whenever a gen_fsm receives an event sent using" n - "%% gen_fsm:send_event/2, the instance of this function with the same name as"n - "%% the current state name StateName is called to handle the event. It is also "n - "%% called if a timeout occurs. " n - (erlang-skel-separator 2) - "state_name(_Event, State) ->" n> - "{next_state, state_name, State}." n - n - (erlang-skel-separator 2) - "%% Function:" n - "%% state_name(Event, From, State) -> {next_state, NextStateName, NextState} |"n - "%% {next_state, NextStateName, " n - "%% NextState, Timeout} |" n - "%% {reply, Reply, NextStateName, NextState}|"n - "%% {reply, Reply, NextStateName, " n - "%% NextState, Timeout} |" n - "%% {stop, Reason, NewState}|" n - "%% {stop, Reason, Reply, NewState}" n - "%% Description: There should be one instance of this function for each" n - "%% possible state name. Whenever a gen_fsm receives an event sent using" n - "%% gen_fsm:sync_send_event/2,3, the instance of this function with the same"n - "%% name as the current state name StateName is called to handle the event." n - (erlang-skel-separator 2) - "state_name(_Event, _From, State) ->" n> - "Reply = ok," n> - "{reply, Reply, state_name, State}." n - n - (erlang-skel-separator 2) - "%% Function: " n - "%% handle_event(Event, StateName, State) -> {next_state, NextStateName, "n - "%% NextState} |" n - "%% {next_state, NextStateName, "n - "%% NextState, Timeout} |" n - "%% {stop, Reason, NewState}" n - "%% Description: Whenever a gen_fsm receives an event sent using"n - "%% gen_fsm:send_all_state_event/2, this function is called to handle"n - "%% the event." n - (erlang-skel-separator 2) - "handle_event(_Event, StateName, State) ->" n> - "{next_state, StateName, State}." n - n - (erlang-skel-separator 2) - "%% Function: " n - "%% handle_sync_event(Event, From, StateName, "n - "%% State) -> {next_state, NextStateName, NextState} |" n - "%% {next_state, NextStateName, NextState, " n - "%% Timeout} |" n - "%% {reply, Reply, NextStateName, NextState}|" n - "%% {reply, Reply, NextStateName, NextState, " n - "%% Timeout} |" n - "%% {stop, Reason, NewState} |" n - "%% {stop, Reason, Reply, NewState}" n - "%% Description: Whenever a gen_fsm receives an event sent using"n - "%% gen_fsm:sync_send_all_state_event/2,3, this function is called to handle"n - "%% the event."n - (erlang-skel-separator 2) - "handle_sync_event(Event, From, StateName, State) ->" n> - "Reply = ok," n> - "{reply, Reply, StateName, State}." n - n - (erlang-skel-separator 2) - "%% Function: " n - "%% handle_info(Info,StateName,State)-> {next_state, NextStateName, NextState}|" n - "%% {next_state, NextStateName, NextState, "n - "%% Timeout} |" n - "%% {stop, Reason, NewState}" n - "%% Description: This function is called by a gen_fsm when it receives any"n - "%% other message than a synchronous or asynchronous event"n - "%% (or a system message)." n - (erlang-skel-separator 2) - "handle_info(_Info, StateName, State) ->" n> - "{next_state, StateName, State}." n - n - (erlang-skel-separator 2) - "%% Function: terminate(Reason, StateName, State) -> void()" n - "%% Description:This function is called by a gen_fsm when it is about"n - "%% to terminate. It should be the opposite of Module:init/1 and do any"n - "%% necessary cleaning up. When it returns, the gen_fsm terminates with"n - "%% Reason. The return value is ignored." n - (erlang-skel-separator 2) - "terminate(_Reason, _StateName, _State) ->" n> - "ok." n - n - (erlang-skel-separator 2) - "%% Function:" n - "%% code_change(OldVsn, StateName, State, Extra) -> {ok, StateName, NewState}" n - "%% Description: Convert process state when code is changed" n - (erlang-skel-separator 2) - "code_change(_OldVsn, StateName, State, _Extra) ->" n> - "{ok, StateName, State}." n - n - (erlang-skel-separator 2) - "%%% Internal functions" n - (erlang-skel-separator 2) - ) - "*The template of a gen_fsm. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-lib - '((erlang-skel-include erlang-skel-large-header) - - "%% API" n - "-export([])." n n - - (erlang-skel-double-separator 2) - "%% API" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: " n - "%% Description:" n - (erlang-skel-separator 2) - n - (erlang-skel-double-separator 2) - "%% Internal functions" n - (erlang-skel-double-separator 2) - ) - "*The template of a library module. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-corba-callback - '((erlang-skel-include erlang-skel-large-header) - "%% Include files" n n - - "%% API" n - "-export([])." n n - - "%% Corba callbacks" n - "-export([init/1, terminate/2, code_change/3])." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator 2) - "%% Corba callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: init(Args) -> {ok, State} |" n - "%% {ok, State, Timeout} |" n - "%% ignore |" n - "%% {stop, Reason}" n - "%% Description: Initiates the server" n - (erlang-skel-separator 2) - "init([]) ->" n> - "{ok, #state{}}." n - n - (erlang-skel-separator 2) - "%% Function: terminate(Reason, State) -> void()" n - "%% Description: Shutdown the server" n - (erlang-skel-separator 2) - "terminate(_Reason, _State) ->" n> - "ok." n - n - (erlang-skel-separator 2) - "%% Function: code_change(OldVsn, State, Extra) -> {ok, NewState} " n - "%% Description: Convert process state when code is changed" n - (erlang-skel-separator 2) - "code_change(_OldVsn, State, _Extra) ->" n> - "{ok, State}." n - n - (erlang-skel-double-separator 2) - "%% Internal functions" n - (erlang-skel-double-separator 2) - ) - "*The template of a library module. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-ts-test-suite - '((erlang-skel-include erlang-skel-large-header) - "%% Note: This directive should only be used in test suites." n - "-compile(export_all)." n n - - "-include(\"test_server.hrl\")." n n - - (erlang-skel-separator 2) - "%% TEST SERVER CALLBACK FUNCTIONS" n - (erlang-skel-separator 2) - n - (erlang-skel-separator 2) - "%% Function: init_per_suite(Config0) -> Config1 | {skip,Reason}" n - "%%" n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for skipping the suite." n - "%%" n - "%% Description: Initialization before the suite." n - "%%" n - "%% Note: This function is free to add any key/value pairs to the Config" n - "%% variable, but should NOT alter/remove any existing entries." n - (erlang-skel-separator 2) - "init_per_suite(Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_suite(Config) -> void()" n - "%%" n - "%% Config = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%%" n - "%% Description: Cleanup after the suite." n - (erlang-skel-separator 2) - "end_per_suite(_Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: init_per_testcase(TestCase, Config0) -> Config1 |" n - "%% {skip,Reason}" n - "%% TestCase = atom()" n - "%% Name of the test case that is about to run." n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for skipping the test case." n - "%%" n - "%% Description: Initialization before each test case." n - "%%" n - "%% Note: This function is free to add any key/value pairs to the Config" n - "%% variable, but should NOT alter/remove any existing entries." n - (erlang-skel-separator 2) - "init_per_testcase(_TestCase, Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_testcase(TestCase, Config) -> void()" n - "%%" n - "%% TestCase = atom()" n - "%% Name of the test case that is finished." n - "%% Config = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%%" n - "%% Description: Cleanup after each test case." n - (erlang-skel-separator 2) - "end_per_testcase(_TestCase, _Config) ->" n > - "ok."n n - - (erlang-skel-separator 2) - "%% Function: all(Clause) -> Descr | Spec | {skip,Reason}" n - "%%" n - "%% Clause = doc | suite" n - "%% Indicates expected return value." n - "%% Descr = [string()] | []" n - "%% String that describes the test suite." n - "%% Spec = [TestCase]" n - "%% A test specification." n - "%% TestCase = ConfCase | atom()" n - "%% Configuration case, or the name of a test case function." n - "%% ConfCase = {conf,Init,Spec,End} |" n - "%% {conf,Properties,Init,Spec,End}" n - "%% Init = End = {Mod,Func} | Func" n - "%% Initialization and cleanup function." n - "%% Mod = Func = atom()" n - "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n - "%% Execution properties of the test cases (may be combined)." n - "%% Shuffle = shuffle | {shuffle,Seed}" n - "%% To get cases executed in random order." n - "%% Seed = {integer(),integer(),integer()}" n - "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n - "%% repeat_until_any_ok | repeat_until_any_fail" n - "%% To get execution of cases repeated." n - "%% N = integer() | forever" n - "%% Reason = term()" n - "%% The reason for skipping the test suite." n - "%%" n - "%% Description: Returns a description of the test suite when" n - "%% Clause == doc, and a test specification (list" n - "%% of the conf and test cases in the suite) when" n - "%% Clause == suite." n - (erlang-skel-separator 2) - "all(doc) -> " n > - "[\"Describe the main purpose of this suite\"];" n n - "all(suite) -> " n > - "[a_test_case]." n n - n - (erlang-skel-separator 2) - "%% TEST CASES" n - (erlang-skel-separator 2) - n - (erlang-skel-separator 2) - "%% Function: TestCase(Arg) -> Descr | Spec | ok | exit() | {skip,Reason}" n - "%%" n - "%% Arg = doc | suite | Config" n - "%% Indicates expected behaviour and return value." n - "%% Config = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Descr = [string()] | []" n - "%% String that describes the test case." n - "%% Spec = [tuple()] | []" n - "%% A test specification, see all/1." n - "%% Reason = term()" n - "%% The reason for skipping the test case." n - "%%" n - "%% Description: Test case function. Returns a description of the test" n - "%% case (doc), then returns a test specification (suite)," n - "%% or performs the actual test (Config)." n - (erlang-skel-separator 2) - "a_test_case(doc) -> " n > - "[\"Describe the main purpose of this test case\"];" n n - "a_test_case(suite) -> " n > - "[];" n n - "a_test_case(Config) when is_list(Config) -> " n > - "ok." n - ) - "*The template of a library module. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-ct-test-suite-l - '((erlang-skel-include erlang-skel-large-header) - "%% Note: This directive should only be used in test suites." n - "-compile(export_all)." n n - - "-include(\"ct.hrl\")." n n - - (erlang-skel-separator 2) - "%% COMMON TEST CALLBACK FUNCTIONS" n - (erlang-skel-separator 2) - n - (erlang-skel-separator 2) - "%% Function: suite() -> Info" n - "%%" n - "%% Info = [tuple()]" n - "%% List of key/value pairs." n - "%%" n - "%% Description: Returns list of tuples to set default properties" n - "%% for the suite." n - "%%" n - "%% Note: The suite/0 function is only meant to be used to return" n - "%% default data values, not perform any other operations." n - (erlang-skel-separator 2) - "suite() ->" n > - "[{timetrap,{minutes,10}}]." n n - - (erlang-skel-separator 2) - "%% Function: init_per_suite(Config0) ->" n - "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n - "%%" n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for skipping the suite." n - "%%" n - "%% Description: Initialization before the suite." n - "%%" n - "%% Note: This function is free to add any key/value pairs to the Config" n - "%% variable, but should NOT alter/remove any existing entries." n - (erlang-skel-separator 2) - "init_per_suite(Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}" n - "%%" n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%%" n - "%% Description: Cleanup after the suite." n - (erlang-skel-separator 2) - "end_per_suite(_Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: init_per_group(GroupName, Config0) ->" n - "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n - "%%" n - "%% GroupName = atom()" n - "%% Name of the test case group that is about to run." n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding configuration data for the group." n - "%% Reason = term()" n - "%% The reason for skipping all test cases and subgroups in the group." n - "%%" n - "%% Description: Initialization before each test case group." n - (erlang-skel-separator 2) - "init_per_group(_GroupName, Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_group(GroupName, Config0) ->" n - "%% void() | {save_config,Config1}" n - "%%" n - "%% GroupName = atom()" n - "%% Name of the test case group that is finished." n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding configuration data for the group." n - "%%" n - "%% Description: Cleanup after each test case group." n - (erlang-skel-separator 2) - "end_per_group(_GroupName, _Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: init_per_testcase(TestCase, Config0) ->" n - "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n - "%%" n - "%% TestCase = atom()" n - "%% Name of the test case that is about to run." n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for skipping the test case." n - "%%" n - "%% Description: Initialization before each test case." n - "%%" n - "%% Note: This function is free to add any key/value pairs to the Config" n - "%% variable, but should NOT alter/remove any existing entries." n - (erlang-skel-separator 2) - "init_per_testcase(_TestCase, Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_testcase(TestCase, Config0) ->" n - "%% void() | {save_config,Config1} | {fail,Reason}" n - "%%" n - "%% TestCase = atom()" n - "%% Name of the test case that is finished." n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for failing the test case." n - "%%" n - "%% Description: Cleanup after each test case." n - (erlang-skel-separator 2) - "end_per_testcase(_TestCase, _Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: groups() -> [Group]" n - "%%" n - "%% Group = {GroupName,Properties,GroupsAndTestCases}" n - "%% GroupName = atom()" n - "%% The name of the group." n - "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n - "%% Group properties that may be combined." n - "%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]" n - "%% TestCase = atom()" n - "%% The name of a test case." n - "%% Shuffle = shuffle | {shuffle,Seed}" n - "%% To get cases executed in random order." n - "%% Seed = {integer(),integer(),integer()}" n - "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n - "%% repeat_until_any_ok | repeat_until_any_fail" n - "%% To get execution of cases repeated." n - "%% N = integer() | forever" n - "%%" n - "%% Description: Returns a list of test case group definitions." n - (erlang-skel-separator 2) - "groups() ->" n > - "[]." n n - - (erlang-skel-separator 2) - "%% Function: all() -> GroupsAndTestCases | {skip,Reason}" n - "%%" n - "%% GroupsAndTestCases = [{group,GroupName} | TestCase]" n - "%% GroupName = atom()" n - "%% Name of a test case group." n - "%% TestCase = atom()" n - "%% Name of a test case." n - "%% Reason = term()" n - "%% The reason for skipping all groups and test cases." n - "%%" n - "%% Description: Returns the list of groups and test cases that" n - "%% are to be executed." n - (erlang-skel-separator 2) - "all() -> " n > - "[my_test_case]." n n - - n - (erlang-skel-separator 2) - "%% TEST CASES" n - (erlang-skel-separator 2) - n - - (erlang-skel-separator 2) - "%% Function: TestCase() -> Info" n - "%%" n - "%% Info = [tuple()]" n - "%% List of key/value pairs." n - "%%" n - "%% Description: Test case info function - returns list of tuples to set" n - "%% properties for the test case." n - "%%" n - "%% Note: This function is only meant to be used to return a list of" n - "%% values, not perform any other operations." n - (erlang-skel-separator 2) - "my_test_case() -> " n > - "[]." n n - - (erlang-skel-separator 2) - "%% Function: TestCase(Config0) ->" n - "%% ok | exit() | {skip,Reason} | {comment,Comment} |" n - "%% {save_config,Config1} | {skip_and_save,Reason,Config1}" n - "%%" n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for skipping the test case." n - "%% Comment = term()" n - "%% A comment about the test case that will be printed in the html log." n - "%%" n - "%% Description: Test case function. (The name of it must be specified in" n - "%% the all/0 list or in a test case group for the test case" n - "%% to be executed)." n - (erlang-skel-separator 2) - "my_test_case(_Config) -> " n > - "ok." n - ) - "*The template of a library module. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-ct-test-suite-s - '((erlang-skel-include erlang-skel-large-header) - "-compile(export_all)." n n - - "-include(\"ct.hrl\")." n n - - (erlang-skel-separator 2) - "%% Function: suite() -> Info" n - "%% Info = [tuple()]" n - (erlang-skel-separator 2) - "suite() ->" n > - "[{timetrap,{seconds,30}}]." n n - - (erlang-skel-separator 2) - "%% Function: init_per_suite(Config0) ->" n - "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n - "%% Config0 = Config1 = [tuple()]" n - "%% Reason = term()" n - (erlang-skel-separator 2) - "init_per_suite(Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}" n - "%% Config0 = Config1 = [tuple()]" n - (erlang-skel-separator 2) - "end_per_suite(_Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: init_per_group(GroupName, Config0) ->" n - "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n - "%% GroupName = atom()" n - "%% Config0 = Config1 = [tuple()]" n - "%% Reason = term()" n - (erlang-skel-separator 2) - "init_per_group(_GroupName, Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_group(GroupName, Config0) ->" n - "%% void() | {save_config,Config1}" n - "%% GroupName = atom()" n - "%% Config0 = Config1 = [tuple()]" n - (erlang-skel-separator 2) - "end_per_group(_GroupName, _Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: init_per_testcase(TestCase, Config0) ->" n - "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n - "%% TestCase = atom()" n - "%% Config0 = Config1 = [tuple()]" n - "%% Reason = term()" n - (erlang-skel-separator 2) - "init_per_testcase(_TestCase, Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_testcase(TestCase, Config0) ->" n - "%% void() | {save_config,Config1} | {fail,Reason}" n - "%% TestCase = atom()" n - "%% Config0 = Config1 = [tuple()]" n - "%% Reason = term()" n - (erlang-skel-separator 2) - "end_per_testcase(_TestCase, _Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: groups() -> [Group]" n - "%% Group = {GroupName,Properties,GroupsAndTestCases}" n - "%% GroupName = atom()" n - "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n - "%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]" n - "%% TestCase = atom()" n - "%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}}" n - "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n - "%% repeat_until_any_ok | repeat_until_any_fail" n - "%% N = integer() | forever" n - (erlang-skel-separator 2) - "groups() ->" n > - "[]." n n - - (erlang-skel-separator 2) - "%% Function: all() -> GroupsAndTestCases | {skip,Reason}" n - "%% GroupsAndTestCases = [{group,GroupName} | TestCase]" n - "%% GroupName = atom()" n - "%% TestCase = atom()" n - "%% Reason = term()" n - (erlang-skel-separator 2) - "all() -> " n > - "[my_test_case]." n n - - (erlang-skel-separator 2) - "%% Function: TestCase() -> Info" n - "%% Info = [tuple()]" n - (erlang-skel-separator 2) - "my_test_case() -> " n > - "[]." n n - - (erlang-skel-separator 2) - "%% Function: TestCase(Config0) ->" n - "%% ok | exit() | {skip,Reason} | {comment,Comment} |" n - "%% {save_config,Config1} | {skip_and_save,Reason,Config1}" n - "%% Config0 = Config1 = [tuple()]" n - "%% Reason = term()" n - "%% Comment = term()" n - (erlang-skel-separator 2) - "my_test_case(_Config) -> " n > - "ok." n - ) - "*The template of a library module. -Please see the function `tempo-define-template'.") +;; Tempo skeleton templates: +(load erlang-skel-file) ;; Font-lock variables diff --git a/lib/typer/src/typer_annotator.erl b/lib/typer/src/typer_annotator.erl index a68360604d..68a8f03a5c 100644 --- a/lib/typer/src/typer_annotator.erl +++ b/lib/typer/src/typer_annotator.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %%============================================================================ diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl index 780bb2e741..2ed4476440 100644 --- a/lib/wx/api_gen/wx_gen.erl +++ b/lib/wx/api_gen/wx_gen.erl @@ -73,8 +73,7 @@ gen_xml() -> -record(hs,{alias,skip,fs,fopt,ev,acc,info}). init_defs(List0) -> - List1 = to_lists(List0), - lists:map(fun mangle_info/1, List1). + [mangle_info(L) || L <- to_lists(List0)]. mangle_info(E={enum,Type0,SkipStr}) -> Type = case is_atom(Type0) of true -> atom_to_list(Type0); false -> Type0 end, @@ -138,9 +137,9 @@ parse_defs([{class,Name,Parent,Info}|Rest], Acc0) -> Defs0 = load_members(FileName, Name, gb_trees:empty(), Tab, Type, Info), put(current_class, Name), - Class0 = #class{name=name(Name,Info),parent=Parent, + Class0 = #class{name=name(Name,Info), parent=Parent, doc=get_value(doc,Info#hs.info,undefined), - file=FileName,options=Info#hs.info, id=next_id(class_id)}, + file=FileName, options=Info#hs.info, id=next_id(class_id)}, ParseClass = fun(Member,{Class,Dfs}) -> parse_class(Member,Tab,Dfs,Class,Info) end, @@ -161,12 +160,11 @@ parse_defs([], Acc) -> reverse(Acc). meta_info(C=#class{name=CName,methods=Ms0}) -> Ms = lists:append(Ms0), - HaveConstructor = - lists:keysearch(constructor, #method.method_type, Ms) =/= false, + HaveConstructor = lists:keymember(constructor, #method.method_type, Ms), case lists:keysearch(destructor, #method.method_type, Ms) of false when HaveConstructor -> - Dest = #method{name="destroy",id=next_id(func_id), - method_type=destructor, params=[this(CName)]}, + Dest = #method{name = "destroy", id = next_id(func_id), + method_type = destructor, params = [this(CName)]}, C#class{methods = [[Dest]|Ms0]}; false -> C#class{abstract = true}; @@ -451,9 +449,9 @@ find_erl_alias_name(MName,Ps,Fopts) -> _ -> Find = fun({all,AliasName},Acc) -> [AliasName|Acc]; ({Var,AliasName},Acc) -> - case lists:keysearch(Var, #param.name, Ps) of - {value, _} -> [AliasName|Acc]; - _ -> Acc + case lists:keymember(Var, #param.name, Ps) of + true -> [AliasName|Acc]; + false -> Acc end end, case lists:foldl(Find, [], Aliases) of @@ -873,11 +871,14 @@ add_method2(M0=#method{name=Name,params=Ps0,type=T0},#class{name=CName,parent=Pa end, M1 = M0#method{defined_in=CName, min_arity = length(Req), - max_arity = length(Req) + if length(Opt) > 0 -> 1; true -> 0 end, + max_arity = length(Req) + case Opt of + [_ | _] -> 1; + _ -> 0 + end, type = Type, method_type = IsStatic, where = Where, - id=next_id(func_id), + id = next_id(func_id), pre_hook = get_opt(pre_hook, Name, length(Ps), Opts), post_hook = get_opt(post_hook, Name, length(Ps), Opts), doc = get_opt(doc, Name, length(Ps), Opts) @@ -1037,10 +1038,10 @@ types_differ([list|R1], [opt_list|R2]) -> types_differ([opt_list|R1], [list|R2]) -> types_differ(R1,R2); types_differ([C1|R1], [C2|R2]) when is_tuple(C1), is_tuple(C2) -> - (size(C1) =/= size(C2)) orelse types_differ(R1,R2); + (tuple_size(C1) =/= tuple_size(C2)) orelse types_differ(R1,R2); types_differ([C1|_R1], [_C2|_R2]) when is_tuple(C1) -> true; -types_differ([_C1|_R1], [C2|_R2]) when is_tuple(C2)-> +types_differ([_C1|_R1], [C2|_R2]) when is_tuple(C2) -> true; types_differ([_C1|R1], [_C2|R2]) -> %% More cases? types_differ(R1,R2); @@ -1198,7 +1199,7 @@ name(Name0, #hs{alias=Alias}) -> Name0; "esaBrekciP" ++ _ -> %% Arrg uses base Name0; - "esaB" ++ Rest when hd(Name0) == $w -> + "esaB" ++ Rest when hd(Name0) =:= $w -> %% Arrg Some decl uses base class directly reverse(Rest); _F -> diff --git a/lib/wx/doc/src/notes.xml b/lib/wx/doc/src/notes.xml index f9f16defd3..92933c348b 100644 --- a/lib/wx/doc/src/notes.xml +++ b/lib/wx/doc/src/notes.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2009</year> + <year>2009</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>wxErlang Release Notes</title> @@ -31,6 +31,58 @@ <p>This document describes the changes made to the wxErlang application.</p> +<section><title>Wx 0.98.5</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Corrected incorrectly generated wxFileDialog:getPaths/1. + Reported by Jason/hornja.</p> + <p> + Own Id: OTP-8330</p> + </item> + <item> + <p> + Fixed a memory reference bug which caused unexplained + {badarg, Int} exits when running multiple wx + applications.</p> + <p> + Own Id: OTP-8461</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Added <c>wxListCtrl:getEditCtrl/1</c> (not available on + Mac).</p> + <p> + Own Id: OTP-8408</p> + </item> + <item> + <p> + Cleanups suggested by tidier and modernization of types + and specs.</p> + <p> + Own Id: OTP-8455</p> + </item> + <item> + <p> Changed representation of wxTreeItem to be an + integer. This saves memory, where the driver do not need + to keep a object reference to each tree item. </p> <p> + Added getFirstChild and getNextChild to wxTreeCtrl.</p> + <p> + Own Id: OTP-8462</p> + </item> + </list> + </section> + +</section> + <section><title>Wx 0.98.4</title> <section><title>Improvements and New Features</title> diff --git a/lib/wx/examples/demo/demo_html_tagger.erl b/lib/wx/examples/demo/demo_html_tagger.erl index 9b6d1fd950..243e5d659f 100644 --- a/lib/wx/examples/demo/demo_html_tagger.erl +++ b/lib/wx/examples/demo/demo_html_tagger.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2009-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% -module(demo_html_tagger). @@ -462,7 +462,7 @@ fix_remote([H|T]) -> fix_remote([]) -> []. --spec is_keyword(atom()) -> bool(). +-spec is_keyword(atom()) -> boolean(). is_keyword('after' ) -> true; is_keyword('and') -> true; diff --git a/lib/wx/vsn.mk b/lib/wx/vsn.mk index 91bbdc8c99..54ab92cad2 100644 --- a/lib/wx/vsn.mk +++ b/lib/wx/vsn.mk @@ -1,6 +1,7 @@ -WX_VSN = 0.98.4 +WX_VSN = 0.98.5 -TICKETS = OTP-8243 OTP-8250 OTP-8292 +TICKETS = OTP-8330 OTP-8461 OTP-8408 OTP-8455 OTP-8462 +TICKETS_0.98.4 = OTP-8243 OTP-8250 OTP-8292 TICKETS_0.98.3 = OTP-8138 OTP-8126 OTP-8083 TICKETS_0.98.2 = OTP-7943 TICKETS_0.98.1 = OTP-7875
\ No newline at end of file diff --git a/lib/xmerl/doc/src/notes.xml b/lib/xmerl/doc/src/notes.xml index 115c81a806..0f30ae9eca 100644 --- a/lib/xmerl/doc/src/notes.xml +++ b/lib/xmerl/doc/src/notes.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2004</year><year>2009</year> + <year>2004</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>Xmerl Release Notes</title> @@ -31,6 +31,20 @@ <p>This document describes the changes made to the Xmerl application.</p> +<section><title>Xmerl 1.2.4</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p>Updated the documentation Makefile to work with the + new documentation build process.</p> + <p> + Own Id: OTP-8343</p> + </item> + </list> + </section> + +</section> <section><title>Xmerl 1.2.3</title> diff --git a/lib/xmerl/vsn.mk b/lib/xmerl/vsn.mk index 0bb57ea252..4162b52a80 100644 --- a/lib/xmerl/vsn.mk +++ b/lib/xmerl/vsn.mk @@ -1,28 +1,30 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2003-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2003-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # -XMERL_VSN = 1.2.3 +XMERL_VSN = 1.2.4 + TICKETS = \ - OTP-8251 \ - OTP-8252 \ - OTP-8253 + OTP-8343 + +TICKETS_1.2.4 = \ + OTP-8343 TICKETS_1.2.3 = \ OTP-8251 \ diff --git a/system/README.unixware b/system/README.unixware deleted file mode 100644 index b9f9433723..0000000000 --- a/system/README.unixware +++ /dev/null @@ -1,201 +0,0 @@ - -OTP R4B b1 UnixWare Release Notes ------------------------------------- - -Kent Boortz - -This is an *unsupported* release of OTP to UnixWare 2.1.2. -In fact, it should not be considered a release or a product at all, -it is a demo what a real release could look like. - -Questions should be directed directly to - - Kent Boortz - -Changes or problems: - - * There is no documentation as part of this release. - Use the R5B documentation that comes with the - Solaris release. - - * To run older graphical tools based on 'pxw' like - 'xerl' and 'interpreter' you have to add - "/usr/X/lib" to your LD_LIBRARY_PATH. - - * The OTP test cases looks reasonable well considering the - short time I had to do the port. The tests of the base - system gives equal results than on Solaris. There are - some problems with the 'ic' application (CORBA) and there - may be some 'mnesia' problems (the tests where not completed - when I wrote this note) - - * OTP normally try to handle IP host name lookups - by itself, parsing /etc/hosts and other configuration - files. This is done because the normal calls like - gethostbyname() is blocking. In this UnixWare port - the normal gethostbyname() is used and if a reply - from the name server takes some time this may block - the OTP system from doing other tasks (it may be the - case that it doesn't block the whole system, it may - just keep other Erlang processes that do DNS lookups - waiting, I'm not sure). - - * The erl_interface library support varios types of threading - This is not supported in the OTP UnixWare release. - - * If you use gcc you compile and link dynamic drivers with - - gcc -fPIC -c foo.c - ld -G -t text -o foo.so foo.o - - With the UnixWare C compiler I belive it will be - - gcc -KPIC -c foo.c - ld -G -t text -o foo.so foo.o - - * The default shell limits was a problem when I was running - some large tests. These limits can be changed by building - a new kernel. To enable unlimited use of virtual memory - and data you do as root - - % /etc/conf/bin/idtune SDATLIM 0x7FFFFFFF - % /etc/conf/bin/idtune HDATLIM 0x7FFFFFFF - % /etc/conf/bin/idtune SVMMLIM 0x7FFFFFFF - % /etc/conf/bin/idtune HVMMLIM 0x7FFFFFFF - % /etc/conf/bin/idbuild - - When you reboot a new kernel will be built. - - * I didn't give the system enough swap space. You can add - swap on an ordinary file. To add about 100 MB more swap - you do as root - - % dd < /dev/zero > /moreswap bs=512 count=200000 - % swap -a /moreswap 0 200000 - - The first line will create a 100 MB file on the root partition - and the second line will add this file as swap space. Note that - the "swap" command is a bit buggy and may hang. Reboot UnixWare - and try again. - -Internel notes on build the release - - * If the network addresses are changed you enter single user - mode by hitting a key after the "Booting UnixWare..." and - the beep. At the prompt - - BOOT# Hit return only to clear line - BOOT# INITSTATE=S - BOOT# go - - This will put you into single user mode. Find out ip address, - default router and DNS server. At the shell prompt - - # /usr/local/bin/tcsh - # setenv TERM vt100 - # cd /etc - # vi resolv.conf - < edit and save with :x! > - # cd /etc/inet - # vi hosts - < edit and save with :x! > - # vi config - < edit and save with :x! > - # cd / - # shutdown now - - Now it should be possible to restart in single user mode. - It may still have long timeouts because the NIS information - is wrong. As root you do - - # ypinit -c - - and type in "arda" as NIS domain and "gandalf.du.uab.ericsson.se" - as NIS server. - - * Prebuilding the release. Create a view with the -ncaexported option. - See "http://otp/product/internal/test/doc/howto/export_view.html". - Build a solaris release (optionally using a boostrap compiler) - - # cd /clearcase/otp/erts/autoconf; cm -V; cd .. - # cm -V opt EMULATOR=jam BUILD_ALL=1 >& LOG.1 - - * Create the directories for mount points and mount the view on - the UnixWare machine. - - # mkdir -p /clearcase/otp; cd /clearcase/otp - # mkdir erts internal_tools libraries system tools - - Use s script like - - #!/bin/sh - HOST=$1 - VIEW=$2 - MOUNT=$HOST:/view/$VIEW/clearcase/otp - - mount -F nfs $MOUNT/erts $DIR/erts - mount -F nfs $MOUNT/libraries $DIR/libraries - mount -F nfs $MOUNT/tools $DIR/tools - mount -F nfs $MOUNT/internal_tools $DIR/internal_tools - mount -F nfs $MOUNT/system $DIR/system - - to mount the ClearCase VOBs. - - * Building the - * Building the - - "/usr/X/lib" to your LD_LIBRARY_PATH. - - Had to patch the file - - /usr/local/lib/g++-include/_G_config.h - - not to define _G_HAVE_SYS_CDEFS 1 - - Problems with pxw yacc - - yacc -dv -b i386-univel-sysv4.2MP/y parse.y - UX:yacc: ERROR: Illegal option -- b - UX:yacc: TO FIX: Usage: yacc [-wvVdlt] [-Q(y/n)] [-p driver_file] file - gmake[6]: *** [i386-univel-sysv4.2MP/y.tab.c] Error 1 - - Create some symbolic links (until got compiled libs for UnixWare) - - # cd crypt/src/ssleay - # ln -s elibcrypto.so.i386-pc-solaris2.5.1 elibcrypto.so.i386-univel-sysv4.2MP - # cd ssl/src/ssleay - # ln -s i386-pc-solaris2.5.1 i386-univel-sysv4.2MP - - Run - - # ntpdate super.du.uab.ericsson.se - - now and then to set the time on the machine. - - - Disabled HAVE_MULTICAST_SUPPORT from "drv/inet_drv.c", should be set in configure - - UnixWare want two arguments to 'ln' - - SkunkWare gcc, ln, tar, ..... required, make sure PATH points out them first - - The emulator has to be linked with "gcc -r -Wl,-Bexport " to be linkable - with dynamic libraries. - - Tcl/Tk was compiled from - - tcl7.6p2plus.tar.gz - tk4.2p2plus.tar.gz - - and the make-files where changed, see - - (not needed it seems, if not using gcc at least) - - - VILL HA "-ly -ll" BARA PA PXW ??????? - - You can view the limits of the Unix processes in - - /etc/conf/mtune.d/proc - diff --git a/system/doc/installation_guide/Makefile b/system/doc/installation_guide/Makefile index ec60105ae0..53a02a1edf 100644 --- a/system/doc/installation_guide/Makefile +++ b/system/doc/installation_guide/Makefile @@ -54,10 +54,12 @@ XML_FILES = \ $(XML_PART_FILES) # ---------------------------------------------------- -# Readme for X-compiling +# Install readme files # ---------------------------------------------------- -XCOMP_README_FILE = $(ERL_TOP)/xcomp/README.md -README_FILE = $(ERL_TOP)/README +INSTALL_READMES = \ + $(ERL_TOP)/INSTALL.html \ + $(ERL_TOP)/INSTALL-CROSS.html \ + $(ERL_TOP)/INSTALL-WIN32.html # ---------------------------------------------------- @@ -98,10 +100,8 @@ include $(ERL_TOP)/make/otp_release_targets.mk release_docs_spec: docs $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) $(README_FILE) $(GIF_FILES) $(HTMLDIR)/*.html \ + $(INSTALL_DATA) $(INSTALL_READMES) $(GIF_FILES) $(HTMLDIR)/*.html \ $(RELSYSDIR) - $(INSTALL_DIR) $(RELSYSDIR)/xcomp - $(INSTALL_DATA) $(XCOMP_README_FILE) $(RELSYSDIR)/xcomp release_spec: diff --git a/system/doc/installation_guide/install.xml b/system/doc/installation_guide/install.xml index 2e37ff35e9..027b3c49a0 100644 --- a/system/doc/installation_guide/install.xml +++ b/system/doc/installation_guide/install.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2000</year><year>2009</year> + <year>2000</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>Installation</title> @@ -33,6 +33,23 @@ </header> <section> + <title>Source</title> + <p>This document describes installation procedures for + binary releases. Documentation of the build and installation + procedures for the source release can be found in the source + tree at the following locations:</p> + <taglist> + <tag>Building and Installing Erlang/OTP</tag> + <item><url href="INSTALL.html"><c>$ERL_TOP/INSTALL.md</c></url></item> + <tag>Cross Compiling Erlang/OTP</tag> + <item><url href="INSTALL-CROSS.html"><c>$ERL_TOP/INSTALL-CROSS.md</c></url></item> + <tag>How to Build Erlang/OTP on Windows</tag> + <item><url href="INSTALL-WIN32.html"><c>$ERL_TOP/INSTALL-WIN32.md</c></url></item> + </taglist> + <p>Where <c>$ERL_TOP</c> is the top directory in the source tree.</p> + </section> + + <section> <title>UNIX</title> <section> diff --git a/system/doc/top/src/erl_html_tools.erl b/system/doc/top/src/erl_html_tools.erl index 8a5c744128..c920245f94 100644 --- a/system/doc/top/src/erl_html_tools.erl +++ b/system/doc/top/src/erl_html_tools.erl @@ -212,6 +212,8 @@ get_app_dirs(Dir) -> lists:map(fun(File) -> {File, filename:join([Dir, File])} end, Files), lists:zf(fun is_app_with_doc/1, AFiles). +is_app_with_doc({"." ++ ADir, _APath}) -> + false; is_app_with_doc({ADir, APath}) -> case file:read_file_info(filename:join([APath, "info"])) of {ok, _FileInfo} -> diff --git a/system/doc/top/src/otp_man_index.erl b/system/doc/top/src/otp_man_index.erl index 78ecd8b954..0fdc531b37 100644 --- a/system/doc/top/src/otp_man_index.erl +++ b/system/doc/top/src/otp_man_index.erl @@ -117,6 +117,8 @@ get_app_dirs(Dir) -> lists:map(fun(File) -> {File, filename:join([Dir, File])} end, Files), lists:zf(fun is_app_with_doc/1, AFiles). +is_app_with_doc({"." ++ ADir, _APath}) -> + false; is_app_with_doc({ADir, APath}) -> case file:read_file_info(filename:join([APath, "info"])) of {ok, _FileInfo} -> diff --git a/xcomp/README.md b/xcomp/README.md index e97b26e605..bc2696c046 100644 --- a/xcomp/README.md +++ b/xcomp/README.md @@ -2,25 +2,38 @@ Cross Compiling Erlang/OTP ========================== This document describes how to cross compile Erlang/OTP. Note that the support -for cross compiling Erlang/OTP is in its early stage of development, and -should be considered as experimental. You are encouraged to read the whole -document before attempting to cross compile Erlang/OTP. +for cross compiling Erlang/OTP should be considered as experimental. As far as +we know, the R13B04 release should cross compile fine, but since we currently +have a very limited set of cross compilation environments to test with we +cannot be sure. The cross compile support will stay in an experimental state +until we get a lot more cross compilation environments to test with. + +You are encouraged to read the whole document before attempting to cross +compile Erlang/OTP. Before reading this document you should read the +[`$ERL_TOP/INSTALL.md`] [1] document which describes building Erlang/OTP in +general. `$ERL_TOP` is the top directory in the source tree. + +`otp_build` Versus `configure`/`make` +------------------------------------ Building Erlang/OTP can be done either by using the `$ERL_TOP/otp_build` -script, or by invoking `$ERL_TOP/configure` and `make` directly (where -`$ERL_TOP` is the top directory in the source tree). Building using `otp_build` -is easier since it involves fewer steps, but the `otp_build` build procedure -is not as flexible as the `configure`/`make` build procedure. The binary -releases that we deliver are built using `otp_build`. Also note that -`otp_build configure` will produce a default configuration that differs from -what `configure` will produce by default. For example, currently +script, or by invoking `$ERL_TOP/configure` and `make` directly. Building using +`otp_build` is easier since it involves fewer steps, but the `otp_build` build +procedure is not as flexible as the `configure`/`make` build procedure. Note +that `otp_build configure` will produce a default configuration that differs +from what `configure` will produce by default. For example, currently `--disable-dynamic-ssl-lib` is added to the `configure` command line arguments -unless `--enable-dynamic-ssl-lib` has been explicitly passed. The defaults -used by `otp_build configure` may change at any time without prior notice. +unless `--enable-dynamic-ssl-lib` has been explicitly passed. The binary +releases that we deliver are built using `otp_build`. The defaults used by +`otp_build configure` may change at any time without prior notice. + +Cross Configuration +------------------- The `$ERL_TOP/xcomp/erl-xcomp.conf.template` file contains all available cross configuration variables and can be used as a template when creating a cross -compilation configuration. For examples of working cross configurations see +compilation configuration. All cross configuration variables are also listed +at the end of this document. For examples of working cross configurations see the `$ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf` file and the `$ERL_TOP/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf` file. If the default behavior of a variable is satisfactory, the variable does not need to be set. @@ -38,10 +51,16 @@ invoking `make`; otherwise, the environment variables might set make variables in some applications, or parts of some applications, and you may end up with an erroneously configured build. +What can be Cross Compiled? +--------------------------- + All Erlang/OTP applications except the `wx` application can be cross compiled. The build of the `wx` driver will currently be automatically disabled when cross compiling. +Compatibility +------------- + The build system, including cross compilation configuration variables used, may be subject to non backward compatible changes without prior notice. Current cross build system has been tested when cross compiling some Linux/GNU @@ -49,6 +68,9 @@ systems, but has only been partly tested for more esoteric platforms. The VxWorks example file is highly dependent on our environment and is here more or less only for internal use. +Patches +------- + Please submit any patches for cross compiling in a way consistent with this system. All input is welcome as we have a very limited set of cross compiling environments to test with. If a new configuration variable is needed, add it @@ -58,7 +80,7 @@ Other files that might need to be updated are: - `$ERL_TOP/xcomp/erl-xcomp-vars.sh` - `$ERL_TOP/erl-build-tool-vars.sh` - `$ERL_TOP/erts/aclocal.m4` -- `$ERL_TOP/xcomp/README` +- `$ERL_TOP/xcomp/README.md` - `$ERL_TOP/xcomp/erl-xcomp-*.conf` Note that this might be an incomplete list of files that need to be updated. @@ -66,24 +88,23 @@ Note that this might be an incomplete list of files that need to be updated. General information on how to submit patches can be found at: <http://wiki.github.com/erlang/otp/submitting-patches> -If you are building in a `git` working directory, the `configure` scripts need -to be generated before you can start building. This is done by invoking -`./otp_build autoconf` in the `$ERL_TOP` directory. The `configure` scripts -also have to be regenerated when a `configure.in` or `aclocal.m4` file is -modified. Note that this is *not* needed when building an unmodified version -of the released source. +Build and Install Procedure +--------------------------- + +If you are building in Git you want to read the "Building in Git" section +of [`$ERL_TOP/INSTALL.md`] [1] before proceeding. -Build and Install ------------------ +We will first go through the `configure`/`make` build procedure which people +probably are most familiar with. - [1] +### Building With `configure`/`make` Directly ### + + (1) Change directory into the top directory of the Erlang/OTP source tree. $ cd $ERL_TOP -### Build ### - In order to compile Erlang code, a small Erlang bootstrap system has to be built, or an Erlang/OTP system of the same release as the one being built has to be provided in the `$PATH`. The Erlang/OTP for the target system will @@ -91,11 +112,11 @@ be built using this Erlang system, together with the cross compilation tools provided. If you want to build using a compatible Erlang/OTP system in the `$PATH`, -jump to [3]. +jump to (3). #### Building a Bootstrap System #### - [2] + (2) $ ./configure --enable-bootstrap-only $ make @@ -109,7 +130,7 @@ be built. #### Cross Building the System #### - [3] + (3) $ ./configure --host=<HOST> --build=<BUILD> [Other Config Args] $ make @@ -139,9 +160,11 @@ silently produce suboptimal code, or silently produce erroneous code. #### Installing #### You can either install using the installation paths determined by `configure` -[4], or install manually using [5]. +(4), or install manually using (5). - [4] +##### Installing Using Paths Determined by `configure` ##### + + (4) $ make install DESTDIR=<TEMPORARY_PREFIX> @@ -149,8 +172,8 @@ You can either install using the installation paths determined by `configure` `configure` arguments specifying where the installation should reside are for example: `--prefix`, `--exec-prefix`, `--libdir`, `--bindir`, etc. By default it will install under `/usr/local`. You typically do not want to install your -cross build under `/usr/local` on your build machine. Using `DESTDIR` will -cause the installation paths to be prefixed by `$DESTDIR`. This makes it +cross build under `/usr/local` on your build machine. Using [`DESTDIR`] [2] +will cause the installation paths to be prefixed by `$DESTDIR`. This makes it possible to install and package the installation on the build machine without having to place the installation in the same directory on the build machine as it should be executed from on the target machine. @@ -160,9 +183,9 @@ the system, move it to the target machine, and unpack it. Note that the installation will only be working on the target machine at the location determined by `configure`. -Installing manually: +##### Installing Manually ##### - [5] + (5) $ make release RELEASE_ROOT=<RELEASE_DIR> @@ -181,50 +204,51 @@ currently be invoked as follows in the directory where it resides where: - * `-minimal` - Creates an installation that starts up a minimal - amount of applications, i.e., only `kernel` and - `stdlib` are started. The minimal system is normally - enough, and is what `make install` uses. - * `-sasl` - Creates an installation that also starts up the - `sasl` application. - * `-cross` - For cross compilation. Informs the install script - that it is run on the build machine. - * `<ERL_ROOT>` - The absolute path to the Erlang installation to use - at run time. This is often the same as the current - working directory, but does not have to be. It can - follow any other path through the file system to the - same directory. +* `-minimal` Creates an installation that starts up a minimal amount + of applications, i.e., only `kernel` and `stdlib` are started. The + minimal system is normally enough, and is what `make install` uses. +* `-sasl` Creates an installation that also starts up the `sasl` + application. +* `-cross` For cross compilation. Informs the install script that it + is run on the build machine. +* `<ERL_ROOT>` - The absolute path to the Erlang installation to use + at run time. This is often the same as the current working directory, + but does not have to be. It can follow any other path through the file + system to the same directory. If neither `-minimal`, nor `-sasl` is passed as argument you will be prompted. -You can now either do [6] or [7]: +You can now either do: + + (6) - [6] +* Decide where the installation should be located on the target machine, + run the `Install` script on the build machine, and package the installed + installation. The installation just need to be unpacked at the right + location on the target machine: -Decide where the installation should be located on the target machine, run -the `Install` script on the build machine, and package the installed -installation. The installation just need to be unpacked at the right location -on the target machine: + $ cd <RELEASE_DIR> + $ ./Install -cross [-minimal|-sasl] <ABSOLUTE_INSTALL_DIR_ON_TARGET> - $ cd <RELEASE_DIR> - $ ./Install -cross [-minimal|-sasl] <ABSOLUTE_INSTALL_DIR_ON_TARGET> +or: - [7] + (7) -Package the installation in <RELEASE_DIR>, place it wherever you want on your -target machine, and run the `Install` script on your target machine: +* Package the installation in `<RELEASE_DIR>`, place it wherever you want + on your target machine, and run the `Install` script on your target + machine: - $ cd <ABSOLUTE_INSTALL_DIR_ON_TARGET> - $ ./Install [-minimal|-sasl] <ABSOLUTE_INSTALL_DIR_ON_TARGET> + $ cd <ABSOLUTE_INSTALL_DIR_ON_TARGET> + $ ./Install [-minimal|-sasl] <ABSOLUTE_INSTALL_DIR_ON_TARGET> -#### Building With the `otp_build` Script #### +### Building With the `otp_build` Script ### - [8] + (8) $ cd $ERL_TOP - [9] + (9) $ ./otp_build configure --xcomp-conf=<FILE> [Other Config Args] @@ -235,7 +259,7 @@ alternatively: If you have your cross compilation configuration in a file, pass it using the `--xcomp-conf=<FILE>` command line argument. If not, pass `--host=<HOST>`, `--build=<BUILD>`, and the configuration variables using a `<VARIABLE>=<VALUE>` -syntax on the command line (same as in [3]). Note that `<HOST>` and `<BUILD>` +syntax on the command line (same as in (3)). Note that `<HOST>` and `<BUILD>` have to be passed one way or the other; either by using `erl_xcomp_host=<HOST>` and `erl_xcomp_build=<BUILD>` in the configuration file, or by using the `--host=<HOST>`, and `--build=<BUILD>` command line arguments. @@ -243,19 +267,19 @@ and `erl_xcomp_build=<BUILD>` in the configuration file, or by using the `otp_build configure` will configure both for the boostrap system on the build machine and the cross host system. - [10] + (10) $ ./otp_build boot -a `otp_build boot -a` will first build a bootstrap system for the build machine and then do the cross build of the system. - [11] + (11) $ ./otp_build release -a <RELEASE_DIR> -`otp_build release -a` will do the same as [5], and you will after this have -to do a manual install either by doing [6], or [7]. +`otp_build release -a` will do the same as (5), and you will after this have +to do a manual install either by doing (6), or (7). Currently Used Configuration Variables -------------------------------------- @@ -274,22 +298,22 @@ cross compilation using `$ERL_TOP/otp_build configure`. *NOTE*! These variables currently have *no* effect if you configure using the `configure` script directly. -* `erl_xcomp_build` - The build system used. This value will be passed as - `--build=$erl_xcomp_build` argument to the `configure` script. It does - not have to be a full `CPU-VENDOR-OS` triplet, but can be. The full - `CPU-VENDOR-OS` triplet will be created by - `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build`. - If set to `guess`, the build system will be guessed using - `$ERL_TOP/erts/autoconf/config.guess`. +* `erl_xcomp_build` - The build system used. This value will be passed as + `--build=$erl_xcomp_build` argument to the `configure` script. It does + not have to be a full `CPU-VENDOR-OS` triplet, but can be. The full + `CPU-VENDOR-OS` triplet will be created by + `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build`. If set to `guess`, + the build system will be guessed using + `$ERL_TOP/erts/autoconf/config.guess`. -* `erl_xcomp_host` - Cross host/target system to build for. This value will - be passed as `--host=$erl_xcomp_host` argument to the `configure` script. - It does not have to be a full `CPU-VENDOR-OS` triplet, but can be. The - full `CPU-VENDOR-OS` triplet will be created by: - `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host` +* `erl_xcomp_host` - Cross host/target system to build for. This value will + be passed as `--host=$erl_xcomp_host` argument to the `configure` script. + It does not have to be a full `CPU-VENDOR-OS` triplet, but can be. The + full `CPU-VENDOR-OS` triplet will be created by + `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host`. -* `erl_xcomp_configure_flags` - Extra configure flags to pass to the - `configure` script. +* `erl_xcomp_configure_flags` - Extra configure flags to pass to the + `configure` script. ### Cross Compiler and Other Tools ### @@ -299,75 +323,75 @@ not need to set these variables (where `<HOST>` is what has been passed as All variables in this section can also be used when native compiling. -* `CC` - C compiler. +* `CC` - C compiler. -* `CFLAGS` - C compiler flags. +* `CFLAGS` - C compiler flags. -* `STATIC_CFLAGS` - Static C compiler flags. +* `STATIC_CFLAGS` - Static C compiler flags. -* `CFLAG_RUNTIME_LIBRARY_PATH` - This flag should set runtime library - search path for the shared libraries. Note that this actually is a - linker flag, but it needs to be passed via the compiler. +* `CFLAG_RUNTIME_LIBRARY_PATH` - This flag should set runtime library + search path for the shared libraries. Note that this actually is a + linker flag, but it needs to be passed via the compiler. -* `CPP` - C pre-processor. +* `CPP` - C pre-processor. -* `CPPFLAGS` - C pre-processor flags. +* `CPPFLAGS` - C pre-processor flags. -* `CXX` - C++ compiler. +* `CXX` - C++ compiler. -* `CXXFLAGS` - C++ compiler flags. +* `CXXFLAGS` - C++ compiler flags. -* `LD` - Linker. +* `LD` - Linker. -* `LDFLAGS` - Linker flags. +* `LDFLAGS` - Linker flags. -* `LIBS` - Libraries. +* `LIBS` - Libraries. #### *D*ynamic *E*rlang *D*river Linking #### *NOTE*! Either set all or none of the `DED_LD*` variables. -* `DED_LD` - Linker for Dynamically loaded Erlang Drivers. +* `DED_LD` - Linker for Dynamically loaded Erlang Drivers. -* `DED_LDFLAGS` - Linker flags to use with `DED_LD`. +* `DED_LDFLAGS` - Linker flags to use with `DED_LD`. -* `DED_LD_FLAG_RUNTIME_LIBRARY_PATH` - This flag should set runtime library - search path for shared libraries when linking with `DED_LD`. +* `DED_LD_FLAG_RUNTIME_LIBRARY_PATH` - This flag should set runtime library + search path for shared libraries when linking with `DED_LD`. #### Large File Support #### *NOTE*! Either set all or none of the `LFS_*` variables. -* `LFS_CFLAGS` - Large file support C compiler flags. +* `LFS_CFLAGS` - Large file support C compiler flags. -* `LFS_LDFLAGS` - Large file support linker flags. +* `LFS_LDFLAGS` - Large file support linker flags. -* `LFS_LIBS` - Large file support libraries. +* `LFS_LIBS` - Large file support libraries. #### Other Tools #### -* `RANLIB` - `ranlib` archive index tool. +* `RANLIB` - `ranlib` archive index tool. -* `AR` - `ar` archiving tool. +* `AR` - `ar` archiving tool. -* `GETCONF` - `getconf` system configuration inspection tool. `getconf` is - currently used for finding out large file support flags to use, and - on Linux systems for finding out if we have an NPTL thread library or - not. +* `GETCONF` - `getconf` system configuration inspection tool. `getconf` is + currently used for finding out large file support flags to use, and + on Linux systems for finding out if we have an NPTL thread library or + not. ### Cross System Root Locations ### -* `erl_xcomp_sysroot` - The absolute path to the system root of the cross - compilation environment. Currently, the `crypto`, `odbc`, `ssh` and - `ssl` applications need the system root. These applications will be - skipped if the system root has not been set. The system root might be - needed for other things too. If this is the case and the system root - has not been set, `configure` will fail and request you to set it. +* `erl_xcomp_sysroot` - The absolute path to the system root of the cross + compilation environment. Currently, the `crypto`, `odbc`, `ssh` and + `ssl` applications need the system root. These applications will be + skipped if the system root has not been set. The system root might be + needed for other things too. If this is the case and the system root + has not been set, `configure` will fail and request you to set it. -* `erl_xcomp_isysroot` - The absolute path to the system root for includes - of the cross compilation environment. If not set, this value defaults - to `$erl_xcomp_sysroot`, i.e., only set this value if the include system - root path is not the same as the system root path. +* `erl_xcomp_isysroot` - The absolute path to the system root for includes + of the cross compilation environment. If not set, this value defaults + to `$erl_xcomp_sysroot`, i.e., only set this value if the include system + root path is not the same as the system root path. ### Optional Feature, and Bug Tests ### @@ -382,72 +406,72 @@ it cannot figure the result out. The `configure` script will issue a warning when a default value is used. When a variable has been set, no warning will be issued. -* `erl_xcomp_after_morecore_hook` - `yes|no`. Defaults to `no`. If `yes`, the - target system must have a working `__after_morecore_hook` that can be - used for tracking used `malloc()` implementations core memory usage. - This is currently only used by unsupported features. - -* `erl_xcomp_bigendian` - `yes|no`. No default. If `yes`, the target system - must be big endian. If `no`, little endian. This can often be - automatically detected, but not always. If not automatically detected, - `configure` will fail unless this variable is set. Since no default - value is used, `configure` will try to figure this out automatically. - -* `erl_xcomp_clock_gettime_cpu_time` - `yes|no`. Defaults to `no`. If `yes`, - the target system must have a working `clock_gettime()` implementation - that can be used for retrieving process CPU time. - -* `erl_xcomp_getaddrinfo` - `yes|no`. Defaults to `no`. If `yes`, the target - system must have a working `getaddrinfo()` implementation that can - handle both IPv4 and IPv6. - -* `erl_xcomp_gethrvtime_procfs_ioctl` - `yes|no`. Defaults to `no`. If `yes`, - the target system must have a working `gethrvtime()` implementation and - is used with procfs `ioctl()`. - -* `erl_xcomp_dlsym_brk_wrappers` - `yes|no`. Defaults to `no`. If `yes`, the - target system must have a working `dlsym(RTLD_NEXT, <S>)` implementation - that can be used on `brk` and `sbrk` symbols used by the `malloc()` - implementation in use, and by this track the `malloc()` implementations - core memory usage. This is currently only used by unsupported features. - -* `erl_xcomp_kqueue` - `yes|no`. Defaults to `no`. If `yes`, the target system - must have a working `kqueue()` implementation that returns a file - descriptor which can be used by `poll()` and/or `select()`. If `no` and - the target system has not got `epoll()` or `/dev/poll`, the kernel-poll - feature will be disabled. - -* `erl_xcomp_linux_clock_gettime_correction` - `yes|no`. Defaults to `yes` on - Linux; otherwise, `no`. If `yes`, `clock_gettime(CLOCK_MONOTONIC, _)` on - the target system must work. This variable is recommended to be set to - `no` on Linux systems with kernel versions less than 2.6. - -* `erl_xcomp_linux_nptl` - `yes|no`. Defaults to `yes` on Linux; otherwise, - `no`. If `yes`, the target system must have NPTL (Native POSIX Thread - Library). Older Linux systems have LinuxThreads instead of NPTL (Linux - kernel versions typically less than 2.6). - -* `erl_xcomp_linux_usable_sigaltstack` - `yes|no`. Defaults to `yes` on Linux; - otherwise, `no`. If `yes`, `sigaltstack()` must be usable on the target - system. `sigaltstack()` on Linux kernel versions less than 2.4 are - broken. - -* `erl_xcomp_linux_usable_sigusrx` - `yes|no`. Defaults to `yes`. If `yes`, - the `SIGUSR1` and `SIGUSR2` signals must be usable by the ERTS. Old - LinuxThreads thread libraries (Linux kernel versions typically less than - 2.2) used these signals and made them unusable by the ERTS. - -* `erl_xcomp_poll` - `yes|no`. Defaults to `no` on Darwin/MacOSX; otherwise, - `yes`. If `yes`, the target system must have a working `poll()` - implementation that also can handle devices. If `no`, `select()` will be - used instead of `poll()`. - -* `erl_xcomp_putenv_copy` - `yes|no`. Defaults to `no`. If `yes`, the target - system must have a `putenv()` implementation that stores a copy of the - key/value pair. - -* `erl_xcomp_reliable_fpe` - `yes|no`. Defaults to `no`. If `yes`, the target - system must have reliable floating point exceptions. +* `erl_xcomp_after_morecore_hook` - `yes|no`. Defaults to `no`. If `yes`, + the target system must have a working `__after_morecore_hook` that can be + used for tracking used `malloc()` implementations core memory usage. + This is currently only used by unsupported features. + +* `erl_xcomp_bigendian` - `yes|no`. No default. If `yes`, the target system + must be big endian. If `no`, little endian. This can often be + automatically detected, but not always. If not automatically detected, + `configure` will fail unless this variable is set. Since no default + value is used, `configure` will try to figure this out automatically. + +* `erl_xcomp_clock_gettime_cpu_time` - `yes|no`. Defaults to `no`. If `yes`, + the target system must have a working `clock_gettime()` implementation + that can be used for retrieving process CPU time. + +* `erl_xcomp_getaddrinfo` - `yes|no`. Defaults to `no`. If `yes`, the target + system must have a working `getaddrinfo()` implementation that can + handle both IPv4 and IPv6. + +* `erl_xcomp_gethrvtime_procfs_ioctl` - `yes|no`. Defaults to `no`. If `yes`, + the target system must have a working `gethrvtime()` implementation and + is used with procfs `ioctl()`. + +* `erl_xcomp_dlsym_brk_wrappers` - `yes|no`. Defaults to `no`. If `yes`, the + target system must have a working `dlsym(RTLD_NEXT, <S>)` implementation + that can be used on `brk` and `sbrk` symbols used by the `malloc()` + implementation in use, and by this track the `malloc()` implementations + core memory usage. This is currently only used by unsupported features. + +* `erl_xcomp_kqueue` - `yes|no`. Defaults to `no`. If `yes`, the target + system must have a working `kqueue()` implementation that returns a file + descriptor which can be used by `poll()` and/or `select()`. If `no` and + the target system has not got `epoll()` or `/dev/poll`, the kernel-poll + feature will be disabled. + +* `erl_xcomp_linux_clock_gettime_correction` - `yes|no`. Defaults to `yes` on + Linux; otherwise, `no`. If `yes`, `clock_gettime(CLOCK_MONOTONIC, _)` on + the target system must work. This variable is recommended to be set to + `no` on Linux systems with kernel versions less than 2.6. + +* `erl_xcomp_linux_nptl` - `yes|no`. Defaults to `yes` on Linux; otherwise, + `no`. If `yes`, the target system must have NPTL (Native POSIX Thread + Library). Older Linux systems have LinuxThreads instead of NPTL (Linux + kernel versions typically less than 2.6). + +* `erl_xcomp_linux_usable_sigaltstack` - `yes|no`. Defaults to `yes` on Linux; + otherwise, `no`. If `yes`, `sigaltstack()` must be usable on the target + system. `sigaltstack()` on Linux kernel versions less than 2.4 are + broken. + +* `erl_xcomp_linux_usable_sigusrx` - `yes|no`. Defaults to `yes`. If `yes`, + the `SIGUSR1` and `SIGUSR2` signals must be usable by the ERTS. Old + LinuxThreads thread libraries (Linux kernel versions typically less than + 2.2) used these signals and made them unusable by the ERTS. + +* `erl_xcomp_poll` - `yes|no`. Defaults to `no` on Darwin/MacOSX; otherwise, + `yes`. If `yes`, the target system must have a working `poll()` + implementation that also can handle devices. If `no`, `select()` will be + used instead of `poll()`. + +* `erl_xcomp_putenv_copy` - `yes|no`. Defaults to `no`. If `yes`, the target + system must have a `putenv()` implementation that stores a copy of the + key/value pair. + +* `erl_xcomp_reliable_fpe` - `yes|no`. Defaults to `no`. If `yes`, the target + system must have reliable floating point exceptions. Copyright and License --------------------- @@ -470,16 +494,6 @@ Copyright and License > %CopyrightEnd% -<!-- - -Modifying This Document ------------------------ - -This document has been written using Markdown notation. This makes it possible -to easily generate a nice looking HTML version of this file. When modifying -this file, make sure that the modifications are made using valid Markdown -notation. For more information on Markdown see: - <http://daringfireball.net/projects/markdown/>. - ---> + [1]: INSTALL.html "$ERL_TOP/INSTALL.md" + [2]: http://www.gnu.org/prep/standards/html_node/DESTDIR.html "DESTDIR" diff --git a/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf b/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf index 9379739744..f9fff0fa8e 100644 --- a/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf +++ b/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf @@ -1,258 +1,258 @@ -#### -*-shell-script-*- -#### -#### %CopyrightBegin% -#### -#### Copyright Ericsson AB 2009-2010. All Rights Reserved. -#### -#### The contents of this file are subject to the Erlang Public License, -#### Version 1.1, (the "License"); you may not use this file except in -#### compliance with the License. You should have received a copy of the -#### Erlang Public License along with this software. If not, it can be -#### retrieved online at http://www.erlang.org/. -#### -#### Software distributed under the License is distributed on an "AS IS" -#### basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -#### the License for the specific language governing rights and limitations -#### under the License. -#### -#### %CopyrightEnd% -#### -#### File: erl-xcomp-TileraMDE2.0-tilepro.conf -#### Author: Rickard Green -#### -#### -------------------------------------------------------------------------- -#### When cross compiling Erlang/OTP using `otp_build`, copy this file and set -#### the variables needed below. Then pass the path to the copy of this file as -#### an argument to `otp_build` in the configure stage: -#### `otp_build configure --xcomp-conf=<FILE>` -#### -------------------------------------------------------------------------- - -### Note that you cannot define arbitrary variables in a cross compilation -### configuration file. Only the ones listed below will be guaranteed to be -### visible throughout the whole execution of all `configure` scripts. Other -### variables needs to be defined as arguments to `configure` or exported in -### the environment. - -### ### Variables for `otp_build` Only ### - -### Variables in this section are only used, when configuring Erlang/OTP for -### cross compilation using `$ERL_TOP/otp_build configure`. - -### *NOTE*! These variables currently have *no* effect if you configure using -### the `configure` script directly. - -## `erl_xcomp_build` - The build system used. This value will be passed as -## `--build=$erl_xcomp_build` argument to the `configure` script. It does -## not have to be a full `CPU-VENDOR-OS` triplet, but can be. The full -## `CPU-VENDOR-OS` triplet will be created by -## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build`. -## If set to `guess`, the build system will be guessed using -## `$ERL_TOP/erts/autoconf/config.guess`. +## -*-shell-script-*- +## +## %CopyrightBegin% +## +## Copyright Ericsson AB 2009-2010. All Rights Reserved. +## +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. +## +## %CopyrightEnd% +## +## File: erl-xcomp-TileraMDE2.0-tilepro.conf +## Author: Rickard Green +## +## ----------------------------------------------------------------------------- +## When cross compiling Erlang/OTP using `otp_build', copy this file and set +## the variables needed below. Then pass the path to the copy of this file as +## an argument to `otp_build' in the configure stage: +## `otp_build configure --xcomp-conf=<FILE>' +## ----------------------------------------------------------------------------- + +## Note that you cannot define arbitrary variables in a cross compilation +## configuration file. Only the ones listed below will be guaranteed to be +## visible throughout the whole execution of all `configure' scripts. Other +## variables needs to be defined as arguments to `configure' or exported in +## the environment. + +## -- Variables for `otp_build' Only ------------------------------------------- + +## Variables in this section are only used, when configuring Erlang/OTP for +## cross compilation using `$ERL_TOP/otp_build configure'. + +## *NOTE*! These variables currently have *no* effect if you configure using +## the `configure' script directly. + +# * `erl_xcomp_build' - The build system used. This value will be passed as +# `--build=$erl_xcomp_build' argument to the `configure' script. It does +# not have to be a full `CPU-VENDOR-OS' triplet, but can be. The full +# `CPU-VENDOR-OS' triplet will be created by +# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build'. If set to `guess', +# the build system will be guessed using +# `$ERL_TOP/erts/autoconf/config.guess'. erl_xcomp_build=guess -## `erl_xcomp_host` - Cross host/target system to build for. This value will -## be passed as `--host=$erl_xcomp_host` argument to the `configure` script. -## It does not have to be a full `CPU-VENDOR-OS` triplet, but can be. The -## full `CPU-VENDOR-OS` triplet will be created by: -## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host` +# * `erl_xcomp_host' - Cross host/target system to build for. This value will +# be passed as `--host=$erl_xcomp_host' argument to the `configure' script. +# It does not have to be a full `CPU-VENDOR-OS' triplet, but can be. The +# full `CPU-VENDOR-OS' triplet will be created by +# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host'. erl_xcomp_host=tile -## `erl_xcomp_configure_flags` - Extra configure flags to pass to the -## `configure` script. +# * `erl_xcomp_configure_flags' - Extra configure flags to pass to the +# `configure' script. erl_xcomp_configure_flags="--without-termcap" -### ### Cross Compiler and Other Tools ### +## -- Cross Compiler and Other Tools ------------------------------------------- -### If the cross compilation tools are prefixed by `<HOST>-` you probably do -### not need to set these variables (where `<HOST>` is what has been passed as -### `--host=<HOST>` argument to `configure`). +## If the cross compilation tools are prefixed by `<HOST>-' you probably do +## not need to set these variables (where `<HOST>' is what has been passed as +## `--host=<HOST>' argument to `configure'). -### All variables in this section can also be used when native compiling. +## All variables in this section can also be used when native compiling. -## `CC` - C compiler. +# * `CC' - C compiler. #CC= -## `CFLAGS` - C compiler flags. +# * `CFLAGS' - C compiler flags. #CFLAGS= -## `STATIC_CFLAGS` - Static C compiler flags. +# * `STATIC_CFLAGS' - Static C compiler flags. #STATIC_CFLAGS= -## `CFLAG_RUNTIME_LIBRARY_PATH` - This flag should set runtime library -## search path for the shared libraries. Note that this actually is a -## linker flag, but it needs to be passed via the compiler. +# * `CFLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library +# search path for the shared libraries. Note that this actually is a +# linker flag, but it needs to be passed via the compiler. #CFLAG_RUNTIME_LIBRARY_PATH= -## `CPP` - C pre-processor. +# * `CPP' - C pre-processor. #CPP= -## `CPPFLAGS` - C pre-processor flags. +# * `CPPFLAGS' - C pre-processor flags. #CPPFLAGS= -## `CXX` - C++ compiler. +# * `CXX' - C++ compiler. #CXX= -## `CXXFLAGS` - C++ compiler flags. +# * `CXXFLAGS' - C++ compiler flags. #CXXFLAGS= -## `LD` - Linker. +# * `LD' - Linker. #LD= -## `LDFLAGS` - Linker flags. +# * `LDFLAGS' - Linker flags. #LDFLAGS= -## `LIBS` - Libraries. +# * `LIBS' - Libraries. #LIBS= -### #### *D*ynamic *E*rlang *D*river Linking #### +## -- *D*ynamic *E*rlang *D*river Linking -- -### *NOTE*! Either set all or none of the `DED_LD*` variables. +## *NOTE*! Either set all or none of the `DED_LD*' variables. -## `DED_LD` - Linker for Dynamically loaded Erlang Drivers. +# * `DED_LD' - Linker for Dynamically loaded Erlang Drivers. #DED_LD= -## `DED_LDFLAGS` - Linker flags to use with `DED_LD`. +# * `DED_LDFLAGS' - Linker flags to use with `DED_LD'. #DED_LDFLAGS= -## `DED_LD_FLAG_RUNTIME_LIBRARY_PATH` - This flag should set runtime library -## search path for shared libraries when linking with `DED_LD`. +# * `DED_LD_FLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library +# search path for shared libraries when linking with `DED_LD'. #DED_LD_FLAG_RUNTIME_LIBRARY_PATH= -### #### Large File Support #### +## -- Large File Support -- -### *NOTE*! Either set all or none of the `LFS_*` variables. +## *NOTE*! Either set all or none of the `LFS_*' variables. -## `LFS_CFLAGS` - Large file support C compiler flags. +# * `LFS_CFLAGS' - Large file support C compiler flags. #LFS_CFLAGS= -## `LFS_LDFLAGS` - Large file support linker flags. +# * `LFS_LDFLAGS' - Large file support linker flags. #LFS_LDFLAGS= -## `LFS_LIBS` - Large file support libraries. +# * `LFS_LIBS' - Large file support libraries. #LFS_LIBS= -### #### Other Tools #### +## -- Other Tools -- -## `RANLIB` - `ranlib` archive index tool. +# * `RANLIB' - `ranlib' archive index tool. #RANLIB= -## `AR` - `ar` archiving tool. +# * `AR' - `ar' archiving tool. #AR= -## `GETCONF` - `getconf` system configuration inspection tool. `getconf` is -## currently used for finding out large file support flags to use, and -## on Linux systems for finding out if we have an NPTL thread library or -## not. +# * `GETCONF' - `getconf' system configuration inspection tool. `getconf' is +# currently used for finding out large file support flags to use, and +# on Linux systems for finding out if we have an NPTL thread library or +# not. #GETCONF= -### ### Cross System Root Locations ### +## -- Cross System Root Locations ---------------------------------------------- -## `erl_xcomp_sysroot` - The absolute path to the system root of the cross -## compilation environment. Currently, the `crypto`, `odbc`, `ssh` and -## `ssl` applications need the system root. These applications will be -## skipped if the system root has not been set. The system root might be -## needed for other things too. If this is the case and the system root -## has not been set, `configure` will fail and request you to set it. +# * `erl_xcomp_sysroot' - The absolute path to the system root of the cross +# compilation environment. Currently, the `crypto', `odbc', `ssh' and +# `ssl' applications need the system root. These applications will be +# skipped if the system root has not been set. The system root might be +# needed for other things too. If this is the case and the system root +# has not been set, `configure' will fail and request you to set it. erl_xcomp_sysroot="$TILERA_ROOT/tile" -## `erl_xcomp_isysroot` - The absolute path to the system root for includes -## of the cross compilation environment. If not set, this value defaults -## to `$erl_xcomp_sysroot`, i.e., only set this value if the include system -## root path is not the same as the system root path. +# * `erl_xcomp_isysroot' - The absolute path to the system root for includes +# of the cross compilation environment. If not set, this value defaults +# to `$erl_xcomp_sysroot', i.e., only set this value if the include system +# root path is not the same as the system root path. #erl_xcomp_isysroot= -### ### Optional Feature, and Bug Tests ### +## -- Optional Feature, and Bug Tests ------------------------------------------ -### These tests cannot (always) be done automatically when cross compiling. You -### usually do not need to set these variables. Only set these if you really -### know what you are doing. +## These tests cannot (always) be done automatically when cross compiling. You +## usually do not need to set these variables. Only set these if you really +## know what you are doing. -### Note that some of these values will override results of tests performed -### by `configure`, and some will not be used until `configure` is sure that -### it cannot figure the result out. +## Note that some of these values will override results of tests performed +## by `configure', and some will not be used until `configure' is sure that +## it cannot figure the result out. -### The `configure` script will issue a warning when a default value is used. -### When a variable has been set, no warning will be issued. +## The `configure' script will issue a warning when a default value is used. +## When a variable has been set, no warning will be issued. -## `erl_xcomp_after_morecore_hook` - `yes|no`. Defaults to `no`. If `yes`, the -## target system must have a working `__after_morecore_hook` that can be -## used for tracking used `malloc()` implementations core memory usage. -## This is currently only used by unsupported features. +# * `erl_xcomp_after_morecore_hook' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `__after_morecore_hook' that can be +# used for tracking used `malloc()' implementations core memory usage. +# This is currently only used by unsupported features. #erl_xcomp_after_morecore_hook= -## `erl_xcomp_bigendian` - `yes|no`. No default. If `yes`, the target system -## must be big endian. If `no`, little endian. This can often be -## automatically detected, but not always. If not automatically detected, -## `configure` will fail unless this variable is set. Since no default -## value is used, `configure` will try to figure this out automatically. +# * `erl_xcomp_bigendian' - `yes|no'. No default. If `yes', the target system +# must be big endian. If `no', little endian. This can often be +# automatically detected, but not always. If not automatically detected, +# `configure' will fail unless this variable is set. Since no default +# value is used, `configure' will try to figure this out automatically. #erl_xcomp_bigendian= -## `erl_xcomp_clock_gettime_cpu_time` - `yes|no`. Defaults to `no`. If `yes`, -## the target system must have a working `clock_gettime()` implementation -## that can be used for retrieving process CPU time. +# * `erl_xcomp_clock_gettime_cpu_time' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `clock_gettime()' implementation +# that can be used for retrieving process CPU time. #erl_xcomp_clock_gettime_cpu_time= -## `erl_xcomp_getaddrinfo` - `yes|no`. Defaults to `no`. If `yes`, the target -## system must have a working `getaddrinfo()` implementation that can -## handle both IPv4 and IPv6. +# * `erl_xcomp_getaddrinfo' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a working `getaddrinfo()' implementation that can +# handle both IPv4 and IPv6. erl_xcomp_getaddrinfo=yes -## `erl_xcomp_gethrvtime_procfs_ioctl` - `yes|no`. Defaults to `no`. If `yes`, -## the target system must have a working `gethrvtime()` implementation and -## is used with procfs `ioctl()`. +# * `erl_xcomp_gethrvtime_procfs_ioctl' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `gethrvtime()' implementation and +# is used with procfs `ioctl()'. #erl_xcomp_gethrvtime_procfs_ioctl= -## `erl_xcomp_dlsym_brk_wrappers` - `yes|no`. Defaults to `no`. If `yes`, the -## target system must have a working `dlsym(RTLD_NEXT, <S>)` implementation -## that can be used on `brk` and `sbrk` symbols used by the `malloc()` -## implementation in use, and by this track the `malloc()` implementations -## core memory usage. This is currently only used by unsupported features. +# * `erl_xcomp_dlsym_brk_wrappers' - `yes|no'. Defaults to `no'. If `yes', the +# target system must have a working `dlsym(RTLD_NEXT, <S>)' implementation +# that can be used on `brk' and `sbrk' symbols used by the `malloc()' +# implementation in use, and by this track the `malloc()' implementations +# core memory usage. This is currently only used by unsupported features. #erl_xcomp_dlsym_brk_wrappers= -## `erl_xcomp_kqueue` - `yes|no`. Defaults to `no`. If `yes`, the target system -## must have a working `kqueue()` implementation that returns a file -## descriptor which can be used by `poll()` and/or `select()`. If `no` and -## the target system has not got `epoll()` or `/dev/poll`, the kernel-poll -## feature will be disabled. +# * `erl_xcomp_kqueue' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a working `kqueue()' implementation that returns a file +# descriptor which can be used by `poll()' and/or `select()'. If `no' and +# the target system has not got `epoll()' or `/dev/poll', the kernel-poll +# feature will be disabled. #erl_xcomp_kqueue= -## `erl_xcomp_linux_clock_gettime_correction` - `yes|no`. Defaults to `yes` on -## Linux; otherwise, `no`. If `yes`, `clock_gettime(CLOCK_MONOTONIC, _)` on -## the target system must work. This variable is recommended to be set to -## `no` on Linux systems with kernel versions less than 2.6. +# * `erl_xcomp_linux_clock_gettime_correction' - `yes|no'. Defaults to `yes' on +# Linux; otherwise, `no'. If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on +# the target system must work. This variable is recommended to be set to +# `no' on Linux systems with kernel versions less than 2.6. #erl_xcomp_linux_clock_gettime_correction= -## `erl_xcomp_linux_nptl` - `yes|no`. Defaults to `yes` on Linux; otherwise, -## `no`. If `yes`, the target system must have NPTL (Native POSIX Thread -## Library). Older Linux systems have LinuxThreads instead of NPTL (Linux -## kernel versions typically less than 2.6). +# * `erl_xcomp_linux_nptl' - `yes|no'. Defaults to `yes' on Linux; otherwise, +# `no'. If `yes', the target system must have NPTL (Native POSIX Thread +# Library). Older Linux systems have LinuxThreads instead of NPTL (Linux +# kernel versions typically less than 2.6). #erl_xcomp_linux_nptl= -## `erl_xcomp_linux_usable_sigaltstack` - `yes|no`. Defaults to `yes` on Linux; -## otherwise, `no`. If `yes`, `sigaltstack()` must be usable on the target -## system. `sigaltstack()` on Linux kernel versions less than 2.4 are -## broken. +# * `erl_xcomp_linux_usable_sigaltstack' - `yes|no'. Defaults to `yes' on Linux; +# otherwise, `no'. If `yes', `sigaltstack()' must be usable on the target +# system. `sigaltstack()' on Linux kernel versions less than 2.4 are +# broken. #erl_xcomp_linux_usable_sigaltstack= -## `erl_xcomp_linux_usable_sigusrx` - `yes|no`. Defaults to `yes`. If `yes`, -## the `SIGUSR1` and `SIGUSR2` signals must be usable by the ERTS. Old -## LinuxThreads thread libraries (Linux kernel versions typically less than -## 2.2) used these signals and made them unusable by the ERTS. +# * `erl_xcomp_linux_usable_sigusrx' - `yes|no'. Defaults to `yes'. If `yes', +# the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. Old +# LinuxThreads thread libraries (Linux kernel versions typically less than +# 2.2) used these signals and made them unusable by the ERTS. #erl_xcomp_linux_usable_sigusrx= -## `erl_xcomp_poll` - `yes|no`. Defaults to `no` on Darwin/MacOSX; otherwise, -## `yes`. If `yes`, the target system must have a working `poll()` -## implementation that also can handle devices. If `no`, `select()` will be -## used instead of `poll()`. +# * `erl_xcomp_poll' - `yes|no'. Defaults to `no' on Darwin/MacOSX; otherwise, +# `yes'. If `yes', the target system must have a working `poll()' +# implementation that also can handle devices. If `no', `select()' will be +# used instead of `poll()'. #erl_xcomp_poll= -## `erl_xcomp_putenv_copy` - `yes|no`. Defaults to `no`. If `yes`, the target -## system must have a `putenv()` implementation that stores a copy of the -## key/value pair. +# * `erl_xcomp_putenv_copy' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a `putenv()' implementation that stores a copy of the +# key/value pair. #erl_xcomp_putenv_copy= -## `erl_xcomp_reliable_fpe` - `yes|no`. Defaults to `no`. If `yes`, the target -## system must have reliable floating point exceptions. +# * `erl_xcomp_reliable_fpe' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have reliable floating point exceptions. #erl_xcomp_reliable_fpe= -#### +## ----------------------------------------------------------------------------- diff --git a/xcomp/erl-xcomp-avr32-atmel-linux-gnu.conf b/xcomp/erl-xcomp-avr32-atmel-linux-gnu.conf index 11ffce2085..f691c6cfd1 100644 --- a/xcomp/erl-xcomp-avr32-atmel-linux-gnu.conf +++ b/xcomp/erl-xcomp-avr32-atmel-linux-gnu.conf @@ -1,262 +1,261 @@ -#### -*-shell-script-*- -#### -#### %CopyrightBegin% -#### -#### Copyright Ericsson AB 2010. All Rights Reserved. -#### -#### The contents of this file are subject to the Erlang Public License, -#### Version 1.1, (the "License"); you may not use this file except in -#### compliance with the License. You should have received a copy of the -#### Erlang Public License along with this software. If not, it can be -#### retrieved online at http://www.erlang.org/. -#### -#### Software distributed under the License is distributed on an "AS IS" -#### basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -#### the License for the specific language governing rights and limitations -#### under the License. -#### -#### %CopyrightEnd% -#### -#### File: erl-xcomp-avr32-atmel-linux-gnu.conf -#### Author: Winston Smith <[email protected]> -#### -#### -------------------------------------------------------------------------- -#### When cross compiling Erlang/OTP using `otp_build', copy this file and set -#### the variables needed below. Then pass the path to the copy of this file as -#### an argument to `otp_build' in the configure stage: -#### `otp_build configure --xcomp-conf=<FILE>' -#### -------------------------------------------------------------------------- - -### Note that you cannot define arbitrary variables in a cross compilation -### configuration file. Only the ones listed below will be guaranteed to be -### visible throughout the whole execution of all `configure' scripts. Other -### variables needs to be defined as arguments to `configure' or exported in -### the environment. - -### ---- `otp_build' only variables ------------------------------------------- - -### Variables in this section are only used, when configuring Erlang/OTP for -### cross compilation using `$ERL_TOP/otp_build configure'. - -### NOTE! These variables currently have *no* effect if you configure using the -### `configure' script directly. - -## erl_xcomp_build - Build system. -## This value will be passed as `--build=$erl_xcomp_build' argument to the -## `configure' script. It does not have to be a full CPU-VENDOR-OS triplet, -## but can be. The full CPU-VENDOR-OS triplet will be created by: -## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build' -## If `erl_xcomp_build=guess', the build system will be guessed using: -## `$ERL_TOP/erts/autoconf/config.guess'. +## -*-shell-script-*- +## +## %CopyrightBegin% +## +## Copyright Ericsson AB 2010. All Rights Reserved. +## +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. +## +## %CopyrightEnd% +## +## File: erl-xcomp-avr32-atmel-linux-gnu.conf +## Author: Winston Smith <[email protected]> +## +## ----------------------------------------------------------------------------- +## When cross compiling Erlang/OTP using `otp_build', copy this file and set +## the variables needed below. Then pass the path to the copy of this file as +## an argument to `otp_build' in the configure stage: +## `otp_build configure --xcomp-conf=<FILE>' +## ----------------------------------------------------------------------------- + +## Note that you cannot define arbitrary variables in a cross compilation +## configuration file. Only the ones listed below will be guaranteed to be +## visible throughout the whole execution of all `configure' scripts. Other +## variables needs to be defined as arguments to `configure' or exported in +## the environment. + +## -- Variables for `otp_build' Only ------------------------------------------- + +## Variables in this section are only used, when configuring Erlang/OTP for +## cross compilation using `$ERL_TOP/otp_build configure'. + +## *NOTE*! These variables currently have *no* effect if you configure using +## the `configure' script directly. + +# * `erl_xcomp_build' - The build system used. This value will be passed as +# `--build=$erl_xcomp_build' argument to the `configure' script. It does +# not have to be a full `CPU-VENDOR-OS' triplet, but can be. The full +# `CPU-VENDOR-OS' triplet will be created by +# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build'. If set to `guess', +# the build system will be guessed using +# `$ERL_TOP/erts/autoconf/config.guess'. erl_xcomp_build=guess -## erl_xcomp_host - Cross host system. -## This value will be passed as `--host=$erl_xcomp_host' argument to the -## `configure' script. It does not have to be a full CPU-VENDOR-OS triplet, -## but can be. The full CPU-VENDOR-OS triplet will be created by: -## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host' +# * `erl_xcomp_host' - Cross host/target system to build for. This value will +# be passed as `--host=$erl_xcomp_host' argument to the `configure' script. +# It does not have to be a full `CPU-VENDOR-OS' triplet, but can be. The +# full `CPU-VENDOR-OS' triplet will be created by +# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host'. erl_xcomp_host=avr32-atmel-linux-gnu -## erl_xcomp_configure_flags - Extra configure flags. -## Extra flags to pass to the `configure' script. +# * `erl_xcomp_configure_flags' - Extra configure flags to pass to the +# `configure' script. #erl_xcomp_configure_flags= -### ---- Cross compiler and other tools to use -------------------------------- +## -- Cross Compiler and Other Tools ------------------------------------------- -### If the cross compilation tools are prefixed by `<HOST>-' you probably do -### not need to set these variables (where `<HOST>' is what has been passed as -### `--host=<HOST>' argument to `configure'). +## If the cross compilation tools are prefixed by `<HOST>-' you probably do +## not need to set these variables (where `<HOST>' is what has been passed as +## `--host=<HOST>' argument to `configure'). -## CC - C compiler. +## All variables in this section can also be used when native compiling. + +# * `CC' - C compiler. CC=avr32-linux-gcc -## CFLAGS - C compiler flags. +# * `CFLAGS' - C compiler flags. #CFLAGS= -## STATIC_CFLAGS - Static C compiler flags. +# * `STATIC_CFLAGS' - Static C compiler flags. #STATIC_CFLAGS= -## CFLAG_RUNTIME_LIBRARY_PATH - C compiler runtime library path flag. -## This flag should set a specific runtime library path for the shared -## library at link time. Note that this is actually a linker flag, but it -## needs to be passed via the compiler. +# * `CFLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library +# search path for the shared libraries. Note that this actually is a +# linker flag, but it needs to be passed via the compiler. #CFLAG_RUNTIME_LIBRARY_PATH= -## CPP - C pre-processor. +# * `CPP' - C pre-processor. #CPP= -## CPPFLAGS - C pre-processor flags. +# * `CPPFLAGS' - C pre-processor flags. #CPPFLAGS= -## CXX - C++ compiler. +# * `CXX' - C++ compiler. CXX=avr32-linux-g++ -## CXXFLAGS - C++ compiler flags. +# * `CXXFLAGS' - C++ compiler flags. #CXXFLAGS= -## LD - Linker. +# * `LD' - Linker. LD=avr32-linux-ld -## LDFLAGS - Linker flags. +# * `LDFLAGS' - Linker flags. #LDFLAGS= -## LIBS - Libraries. +# * `LIBS' - Libraries. #LIBS= -### -- Dynamic Erlang Driver linker flags -- +## -- *D*ynamic *E*rlang *D*river Linking -- -### NOTE! Either set all or non of the DED_LD* variables. +## *NOTE*! Either set all or none of the `DED_LD*' variables. -## DED_LD - Linker. +# * `DED_LD' - Linker for Dynamically loaded Erlang Drivers. #DED_LD= -## DED_LDFLAGS - Linker flags. +# * `DED_LDFLAGS' - Linker flags to use with `DED_LD'. #DED_LDFLAGS= -## DED_LD_FLAG_RUNTIME_LIBRARY_PATH - Linker runtime library path flag. -## This flag should set a specific runtime library path for the shared -## library at link time. +# * `DED_LD_FLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library +# search path for shared libraries when linking with `DED_LD'. #DED_LD_FLAG_RUNTIME_LIBRARY_PATH= -### -- Large file support -- +## -- Large File Support -- -### NOTE! Either set all or non of the LFS_* variables. +## *NOTE*! Either set all or none of the `LFS_*' variables. -## LFS_CFLAGS - Large file support C compiler flags. +# * `LFS_CFLAGS' - Large file support C compiler flags. #LFS_CFLAGS= -## LFS_LDFLAGS - Large file support linker flags. +# * `LFS_LDFLAGS' - Large file support linker flags. #LFS_LDFLAGS= -## LFS_LIBS - Large file support libraries. +# * `LFS_LIBS' - Large file support libraries. #LFS_LIBS= -### -- Other tools -- +## -- Other Tools -- -## RANLIB - `ranlib' archive index tool. +# * `RANLIB' - `ranlib' archive index tool. RANLIB=avr32-linux-ranlib -## AR - `ar' archiving tool. +# * `AR' - `ar' archiving tool. AR=avr32-linux-ar -## GETCONF - `getconf' system configuration inspection tool. +# * `GETCONF' - `getconf' system configuration inspection tool. `getconf' is +# currently used for finding out large file support flags to use, and +# on Linux systems for finding out if we have an NPTL thread library or +# not. #GETCONF= -### ---- Cross System Root Locations ------------------------------------------ - -## erl_xcomp_sysroot - Absolute cross system root path. -## The absolute path to the system root of the cross compilation -## environment. Currently, the `crypto', `odbc', `ssh' and `ssl' -## applications need the system root. These applications will be skipped -## if the system root has not been set. The system root might be needed -## for other things too. If this is the case and the system root has not -## been set, `configure' will fail and request you to set it. -## -## NOTE: For AVR32, this should be set to the build_avr32/staging_dir -## subdirectory within the buildroot tree. +## -- Cross System Root Locations ---------------------------------------------- + +# * `erl_xcomp_sysroot' - The absolute path to the system root of the cross +# compilation environment. Currently, the `crypto', `odbc', `ssh' and +# `ssl' applications need the system root. These applications will be +# skipped if the system root has not been set. The system root might be +# needed for other things too. If this is the case and the system root +# has not been set, `configure' will fail and request you to set it. +# +# NOTE: For AVR32, this should be set to the build_avr32/staging_dir +# subdirectory within the buildroot tree. erl_xcomp_sysroot="$ATMEL_SYSROOT_AVR32" -## erl_xcomp_isysroot - Absolute cross include system root path. -## The absolute path to the system root for includes of the cross -## compilation environment. If not set, this value defaults to -## `$erl_xcomp_sysroot', i.e., only set this value if the include system -## root path is not the same as the system root path. +# * `erl_xcomp_isysroot' - The absolute path to the system root for includes +# of the cross compilation environment. If not set, this value defaults +# to `$erl_xcomp_sysroot', i.e., only set this value if the include system +# root path is not the same as the system root path. #erl_xcomp_isysroot= -### ---- Optional feature, or bug tests --------------------------------------- +## -- Optional Feature, and Bug Tests ------------------------------------------ -### These tests cannot (always) be done automatically when cross compiling. You -### usually does not need to set these variables. Only set these if you really -### know what you are doing. +## These tests cannot (always) be done automatically when cross compiling. You +## usually do not need to set these variables. Only set these if you really +## know what you are doing. -### Note that some of these values will override results of tests performed -### by `configure', and some will not be used until `configure' is sure that -### it cannot figure the result out. +## Note that some of these values will override results of tests performed +## by `configure', and some will not be used until `configure' is sure that +## it cannot figure the result out. -### The `configure' script will issue a warning when a default value is used. -### When a variable has been set, no warning will be issued. +## The `configure' script will issue a warning when a default value is used. +## When a variable has been set, no warning will be issued. -## erl_xcomp_bigendian - yes|no -## If `yes', the target system must be big endian. If `no', little endian. -## This can often be automatically detected, but not always. If not -## automatically detected, `configure' will fail unless this variable is -## set. No default value is used, i.e., `configure' will try to figure -## this out automatically. -#erl_xcomp_bigendian= +# * `erl_xcomp_after_morecore_hook' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `__after_morecore_hook' that can be +# used for tracking used `malloc()' implementations core memory usage. +# This is currently only used by unsupported features. +#erl_xcomp_after_morecore_hook= -## erl_xcomp_linux_clock_gettime_correction - yes|no (defaults to `yes' on -## Linux; otherwise, `no') -## If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on the target system must -## work. This variable is recommended to be set to `no' on Linux systems -## with kernel versions less than 2.6. -#erl_xcomp_linux_clock_gettime_correction= +# * `erl_xcomp_bigendian' - `yes|no'. No default. If `yes', the target system +# must be big endian. If `no', little endian. This can often be +# automatically detected, but not always. If not automatically detected, +# `configure' will fail unless this variable is set. Since no default +# value is used, `configure' will try to figure this out automatically. +#erl_xcomp_bigendian= -## erl_xcomp_linux_nptl - yes|no (defaults to `yes' on Linux; otherwise, `no') -## If `yes', the target system must have NPTL (Native POSIX Thread Library). -## Older Linux systems have LinuxThreads instead of NPTL (Linux kernel -## versions typically less than 2.6). -#erl_xcomp_linux_nptl= +# * `erl_xcomp_clock_gettime_cpu_time' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `clock_gettime()' implementation +# that can be used for retrieving process CPU time. +erl_xcomp_clock_gettime_cpu_time=yes -## erl_xcomp_linux_usable_sigusrx - yes|no (defaults to `yes') -## If `yes', the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. -## Old LinuxThreads thread libraries (Linux kernel versions less than 2.2) -## used these signals and made them unusable by the ERTS. -#erl_xcomp_linux_usable_sigusrx= +# * `erl_xcomp_getaddrinfo' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a working `getaddrinfo()' implementation that can +# handle both IPv4 and IPv6. +erl_xcomp_getaddrinfo=yes -## erl_xcomp_linux_usable_sigaltstack - yes|no (defaults to `yes' on Linux; -## otherwise, `no') -## If `yes', `sigaltstack()' must be usable on the target system. -## `sigaltstack()' on Linux kernel versions less than 2.4 are broken. -#erl_xcomp_linux_usable_sigaltstack= +# * `erl_xcomp_gethrvtime_procfs_ioctl' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `gethrvtime()' implementation and +# is used with procfs `ioctl()'. +#erl_xcomp_gethrvtime_procfs_ioctl= -## erl_xcomp_poll - yes|no (defaults to `no' on Darwin/MacOSX; otherwise, `yes') -## If `yes', the target system must have a working `poll()' implementation -## that also can handle devices. If `no', `select()' will be used instead of -## `poll()'. -#erl_xcomp_poll= +# * `erl_xcomp_dlsym_brk_wrappers' - `yes|no'. Defaults to `no'. If `yes', the +# target system must have a working `dlsym(RTLD_NEXT, <S>)' implementation +# that can be used on `brk' and `sbrk' symbols used by the `malloc()' +# implementation in use, and by this track the `malloc()' implementations +# core memory usage. This is currently only used by unsupported features. +erl_xcomp_dlsym_brk_wrappers=yes -## erl_xcomp_kqueue - yes|no (defaults to `no') -## If `yes', the target system must have a working `kqueue()' implementation -## that returns a file descriptor which can be used by `poll()' and/or -## `select()'. If `no' and the target system has not got `epoll()' or -## `/dev/poll', the kernel-poll feature will be disabled. +# * `erl_xcomp_kqueue' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a working `kqueue()' implementation that returns a file +# descriptor which can be used by `poll()' and/or `select()'. If `no' and +# the target system has not got `epoll()' or `/dev/poll', the kernel-poll +# feature will be disabled. #erl_xcomp_kqueue= -## erl_xcomp_putenv_copy - yes|no (defaults to `no') -## If `yes', the target system must have a `putenv()' implementation that -## stores a copy of the key/value pair. -#erl_xcomp_putenv_copy= +# * `erl_xcomp_linux_clock_gettime_correction' - `yes|no'. Defaults to `yes' on +# Linux; otherwise, `no'. If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on +# the target system must work. This variable is recommended to be set to +# `no' on Linux systems with kernel versions less than 2.6. +#erl_xcomp_linux_clock_gettime_correction= -## erl_xcomp_reliable_fpe - yes|no (defaults to `no') -## If `yes', the target system must have reliable floating point exceptions. -#erl_xcomp_reliable_fpe= +# * `erl_xcomp_linux_nptl' - `yes|no'. Defaults to `yes' on Linux; otherwise, +# `no'. If `yes', the target system must have NPTL (Native POSIX Thread +# Library). Older Linux systems have LinuxThreads instead of NPTL (Linux +# kernel versions typically less than 2.6). +#erl_xcomp_linux_nptl= -## erl_xcomp_getaddrinfo - yes|no (defaults to `no') -## If `yes', the target system must have a working `getaddrinfo()' -## implementation that can handle both IPv4 and IPv6. -erl_xcomp_getaddrinfo=yes +# * `erl_xcomp_linux_usable_sigaltstack' - `yes|no'. Defaults to `yes' on Linux; +# otherwise, `no'. If `yes', `sigaltstack()' must be usable on the target +# system. `sigaltstack()' on Linux kernel versions less than 2.4 are +# broken. +#erl_xcomp_linux_usable_sigaltstack= -## erl_xcomp_gethrvtime_procfs_ioctl - yes|no (defaults to `no') -## If `yes', the target system must have a working `gethrvtime()' -## implementation and is used with procfs `ioctl()'. -#erl_xcomp_gethrvtime_procfs_ioctl= +# * `erl_xcomp_linux_usable_sigusrx' - `yes|no'. Defaults to `yes'. If `yes', +# the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. Old +# LinuxThreads thread libraries (Linux kernel versions typically less than +# 2.2) used these signals and made them unusable by the ERTS. +#erl_xcomp_linux_usable_sigusrx= -## erl_xcomp_clock_gettime_cpu_time - yes|no (defaults to `no') -## If `yes', the target system must have a working `clock_gettime()' -## implementation that can be used for retrieving process CPU time. -erl_xcomp_clock_gettime_cpu_time=yes +# * `erl_xcomp_poll' - `yes|no'. Defaults to `no' on Darwin/MacOSX; otherwise, +# `yes'. If `yes', the target system must have a working `poll()' +# implementation that also can handle devices. If `no', `select()' will be +# used instead of `poll()'. +#erl_xcomp_poll= -## erl_xcomp_after_morecore_hook - yes|no (defaults to `no') -## If `yes', the target system must have a working `__after_morecore_hook' -## that can be used for tracking used `malloc()' implementations core memory -## usage. -#erl_xcomp_after_morecore_hook= +# * `erl_xcomp_putenv_copy' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a `putenv()' implementation that stores a copy of the +# key/value pair. +#erl_xcomp_putenv_copy= -## erl_xcomp_dlsym_brk_wrappers - yes|no (defaults to `no') -## If `yes', the target system must have a working `dlsym(RTLD_NEXT, <S>)' -## implementation that can be used on `brk' and `sbrk' symbols used by the -## `malloc()' implementation in use, and by this track the `malloc()' -## implementations core memory usage. -erl_xcomp_dlsym_brk_wrappers=yes +# * `erl_xcomp_reliable_fpe' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have reliable floating point exceptions. +#erl_xcomp_reliable_fpe= -#### -------------------------------------------------------------------------- +## ----------------------------------------------------------------------------- diff --git a/xcomp/erl-xcomp-vxworks_ppc32.conf b/xcomp/erl-xcomp-vxworks_ppc32.conf index b75c7444bb..ed8305ea93 100644 --- a/xcomp/erl-xcomp-vxworks_ppc32.conf +++ b/xcomp/erl-xcomp-vxworks_ppc32.conf @@ -1,258 +1,258 @@ -#### -*-shell-script-*- -#### -#### %CopyrightBegin% -#### -#### Copyright Ericsson AB 2009-2010. All Rights Reserved. -#### -#### The contents of this file are subject to the Erlang Public License, -#### Version 1.1, (the "License"); you may not use this file except in -#### compliance with the License. You should have received a copy of the -#### Erlang Public License along with this software. If not, it can be -#### retrieved online at http://www.erlang.org/. -#### -#### Software distributed under the License is distributed on an "AS IS" -#### basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -#### the License for the specific language governing rights and limitations -#### under the License. -#### -#### %CopyrightEnd% -#### -#### File: erl-xcomp-vxworks_ppc32.conf -#### Author: Rickard Green/Patrik Nyblom -#### -#### -------------------------------------------------------------------------- -#### When cross compiling Erlang/OTP using `otp_build`, copy this file and set -#### the variables needed below. Then pass the path to the copy of this file as -#### an argument to `otp_build` in the configure stage: -#### `otp_build configure --xcomp-conf=<FILE>` -#### -------------------------------------------------------------------------- - -### Note that you cannot define arbitrary variables in a cross compilation -### configuration file. Only the ones listed below will be guaranteed to be -### visible throughout the whole execution of all `configure` scripts. Other -### variables needs to be defined as arguments to `configure` or exported in -### the environment. - -### ### Variables for `otp_build` Only ### - -### Variables in this section are only used, when configuring Erlang/OTP for -### cross compilation using `$ERL_TOP/otp_build configure`. - -### *NOTE*! These variables currently have *no* effect if you configure using -### the `configure` script directly. - -## `erl_xcomp_build` - The build system used. This value will be passed as -## `--build=$erl_xcomp_build` argument to the `configure` script. It does -## not have to be a full `CPU-VENDOR-OS` triplet, but can be. The full -## `CPU-VENDOR-OS` triplet will be created by -## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build`. -## If set to `guess`, the build system will be guessed using -## `$ERL_TOP/erts/autoconf/config.guess`. +## -*-shell-script-*- +## +## %CopyrightBegin% +## +## Copyright Ericsson AB 2009-2010. All Rights Reserved. +## +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. +## +## %CopyrightEnd% +## +## File: erl-xcomp-vxworks_ppc32.conf +## Author: Rickard Green/Patrik Nyblom +## +## ----------------------------------------------------------------------------- +## When cross compiling Erlang/OTP using `otp_build', copy this file and set +## the variables needed below. Then pass the path to the copy of this file as +## an argument to `otp_build' in the configure stage: +## `otp_build configure --xcomp-conf=<FILE>' +## ----------------------------------------------------------------------------- + +## Note that you cannot define arbitrary variables in a cross compilation +## configuration file. Only the ones listed below will be guaranteed to be +## visible throughout the whole execution of all `configure' scripts. Other +## variables needs to be defined as arguments to `configure' or exported in +## the environment. + +## -- Variables for `otp_build' Only ------------------------------------------- + +## Variables in this section are only used, when configuring Erlang/OTP for +## cross compilation using `$ERL_TOP/otp_build configure'. + +## *NOTE*! These variables currently have *no* effect if you configure using +## the `configure' script directly. + +# * `erl_xcomp_build' - The build system used. This value will be passed as +# `--build=$erl_xcomp_build' argument to the `configure' script. It does +# not have to be a full `CPU-VENDOR-OS' triplet, but can be. The full +# `CPU-VENDOR-OS' triplet will be created by +# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build'. If set to `guess', +# the build system will be guessed using +# `$ERL_TOP/erts/autoconf/config.guess'. erl_xcomp_build=guess -## `erl_xcomp_host` - Cross host/target system to build for. This value will -## be passed as `--host=$erl_xcomp_host` argument to the `configure` script. -## It does not have to be a full `CPU-VENDOR-OS` triplet, but can be. The -## full `CPU-VENDOR-OS` triplet will be created by: -## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host` +# * `erl_xcomp_host' - Cross host/target system to build for. This value will +# be passed as `--host=$erl_xcomp_host' argument to the `configure' script. +# It does not have to be a full `CPU-VENDOR-OS' triplet, but can be. The +# full `CPU-VENDOR-OS' triplet will be created by +# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host'. erl_xcomp_host=powerpc-wrs-vxworks -## `erl_xcomp_configure_flags` - Extra configure flags to pass to the -## `configure` script. +# * `erl_xcomp_configure_flags' - Extra configure flags to pass to the +# `configure' script. erl_xcomp_configure_flags="--disable-threads --without-termcap" -### ### Cross Compiler and Other Tools ### +## -- Cross Compiler and Other Tools ------------------------------------------- -### If the cross compilation tools are prefixed by `<HOST>-` you probably do -### not need to set these variables (where `<HOST>` is what has been passed as -### `--host=<HOST>` argument to `configure`). +## If the cross compilation tools are prefixed by `<HOST>-' you probably do +## not need to set these variables (where `<HOST>' is what has been passed as +## `--host=<HOST>' argument to `configure'). -### All variables in this section can also be used when native compiling. +## All variables in this section can also be used when native compiling. -## `CC` - C compiler. +# * `CC' - C compiler. CC="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/ccppc" -## `CFLAGS` - C compiler flags. +# * `CFLAGS' - C compiler flags. CFLAGS="-DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -DWANT_NONBLOCKING -DHAVE_SENS -DHAVE_MEMMOVE -DVXWORKS -I$WIND_BASE/vxworks-6.3/target/h -I$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/lib/gcc/powerpc-wrs-vxworks/3.4.4/include -I$WIND_BASE/vxworks-6.3/target/h/wrn/coreip -I$WIND_BASE/vxworks-6.3/target/h -mstrict-align -fvolatile -fno-builtin -mlongcall" -## `STATIC_CFLAGS` - Static C compiler flags. +# * `STATIC_CFLAGS' - Static C compiler flags. #STATIC_CFLAGS= -## `CFLAG_RUNTIME_LIBRARY_PATH` - This flag should set runtime library -## search path for the shared libraries. Note that this actually is a -## linker flag, but it needs to be passed via the compiler. +# * `CFLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library +# search path for the shared libraries. Note that this actually is a +# linker flag, but it needs to be passed via the compiler. #CFLAG_RUNTIME_LIBRARY_PATH= -## `CPP` - C pre-processor. +# * `CPP' - C pre-processor. CPP="$CC $CFLAGS -E" -## `CPPFLAGS` - C pre-processor flags. +# * `CPPFLAGS' - C pre-processor flags. #CPPFLAGS= -## `CXX` - C++ compiler. +# * `CXX' - C++ compiler. #CXX= -## `CXXFLAGS` - C++ compiler flags. +# * `CXXFLAGS' - C++ compiler flags. #CXXFLAGS= -## `LD` - Linker. +# * `LD' - Linker. LD="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/ldppc" -## `LDFLAGS` - Linker flags. +# * `LDFLAGS' - Linker flags. LDFLAGS="-mlongcall" -## `LIBS` - Libraries. +# * `LIBS' - Libraries. #LIBS= -### #### *D*ynamic *E*rlang *D*river Linking #### +## -- *D*ynamic *E*rlang *D*river Linking -- -### *NOTE*! Either set all or none of the `DED_LD*` variables. +## *NOTE*! Either set all or none of the `DED_LD*' variables. -## `DED_LD` - Linker for Dynamically loaded Erlang Drivers. +# * `DED_LD' - Linker for Dynamically loaded Erlang Drivers. #DED_LD= -## `DED_LDFLAGS` - Linker flags to use with `DED_LD`. +# * `DED_LDFLAGS' - Linker flags to use with `DED_LD'. #DED_LDFLAGS= -## `DED_LD_FLAG_RUNTIME_LIBRARY_PATH` - This flag should set runtime library -## search path for shared libraries when linking with `DED_LD`. +# * `DED_LD_FLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library +# search path for shared libraries when linking with `DED_LD'. #DED_LD_FLAG_RUNTIME_LIBRARY_PATH= -### #### Large File Support #### +## -- Large File Support -- -### *NOTE*! Either set all or none of the `LFS_*` variables. +## *NOTE*! Either set all or none of the `LFS_*' variables. -## `LFS_CFLAGS` - Large file support C compiler flags. +# * `LFS_CFLAGS' - Large file support C compiler flags. #LFS_CFLAGS= -## `LFS_LDFLAGS` - Large file support linker flags. +# * `LFS_LDFLAGS' - Large file support linker flags. #LFS_LDFLAGS= -## `LFS_LIBS` - Large file support libraries. +# * `LFS_LIBS' - Large file support libraries. #LFS_LIBS= -### #### Other Tools #### +## -- Other Tools -- -## `RANLIB` - `ranlib` archive index tool. +# * `RANLIB' - `ranlib' archive index tool. RANLIB="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/ranlibppc" -## `AR` - `ar` archiving tool. +# * `AR' - `ar' archiving tool. AR="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/arppc" -## `GETCONF` - `getconf` system configuration inspection tool. `getconf` is -## currently used for finding out large file support flags to use, and -## on Linux systems for finding out if we have an NPTL thread library or -## not. +# * `GETCONF' - `getconf' system configuration inspection tool. `getconf' is +# currently used for finding out large file support flags to use, and +# on Linux systems for finding out if we have an NPTL thread library or +# not. #GETCONF= -### ### Cross System Root Locations ### +## -- Cross System Root Locations ---------------------------------------------- -## `erl_xcomp_sysroot` - The absolute path to the system root of the cross -## compilation environment. Currently, the `crypto`, `odbc`, `ssh` and -## `ssl` applications need the system root. These applications will be -## skipped if the system root has not been set. The system root might be -## needed for other things too. If this is the case and the system root -## has not been set, `configure` will fail and request you to set it. +# * `erl_xcomp_sysroot' - The absolute path to the system root of the cross +# compilation environment. Currently, the `crypto', `odbc', `ssh' and +# `ssl' applications need the system root. These applications will be +# skipped if the system root has not been set. The system root might be +# needed for other things too. If this is the case and the system root +# has not been set, `configure' will fail and request you to set it. #erl_xcomp_sysroot= -## `erl_xcomp_isysroot` - The absolute path to the system root for includes -## of the cross compilation environment. If not set, this value defaults -## to `$erl_xcomp_sysroot`, i.e., only set this value if the include system -## root path is not the same as the system root path. +# * `erl_xcomp_isysroot' - The absolute path to the system root for includes +# of the cross compilation environment. If not set, this value defaults +# to `$erl_xcomp_sysroot', i.e., only set this value if the include system +# root path is not the same as the system root path. #erl_xcomp_isysroot= -### ### Optional Feature, and Bug Tests ### +## -- Optional Feature, and Bug Tests ------------------------------------------ -### These tests cannot (always) be done automatically when cross compiling. You -### usually do not need to set these variables. Only set these if you really -### know what you are doing. +## These tests cannot (always) be done automatically when cross compiling. You +## usually do not need to set these variables. Only set these if you really +## know what you are doing. -### Note that some of these values will override results of tests performed -### by `configure`, and some will not be used until `configure` is sure that -### it cannot figure the result out. +## Note that some of these values will override results of tests performed +## by `configure', and some will not be used until `configure' is sure that +## it cannot figure the result out. -### The `configure` script will issue a warning when a default value is used. -### When a variable has been set, no warning will be issued. +## The `configure' script will issue a warning when a default value is used. +## When a variable has been set, no warning will be issued. -## `erl_xcomp_after_morecore_hook` - `yes|no`. Defaults to `no`. If `yes`, the -## target system must have a working `__after_morecore_hook` that can be -## used for tracking used `malloc()` implementations core memory usage. -## This is currently only used by unsupported features. +# * `erl_xcomp_after_morecore_hook' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `__after_morecore_hook' that can be +# used for tracking used `malloc()' implementations core memory usage. +# This is currently only used by unsupported features. #erl_xcomp_after_morecore_hook= -## `erl_xcomp_bigendian` - `yes|no`. No default. If `yes`, the target system -## must be big endian. If `no`, little endian. This can often be -## automatically detected, but not always. If not automatically detected, -## `configure` will fail unless this variable is set. Since no default -## value is used, `configure` will try to figure this out automatically. +# * `erl_xcomp_bigendian' - `yes|no'. No default. If `yes', the target system +# must be big endian. If `no', little endian. This can often be +# automatically detected, but not always. If not automatically detected, +# `configure' will fail unless this variable is set. Since no default +# value is used, `configure' will try to figure this out automatically. erl_xcomp_bigendian=yes -## `erl_xcomp_clock_gettime_cpu_time` - `yes|no`. Defaults to `no`. If `yes`, -## the target system must have a working `clock_gettime()` implementation -## that can be used for retrieving process CPU time. +# * `erl_xcomp_clock_gettime_cpu_time' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `clock_gettime()' implementation +# that can be used for retrieving process CPU time. #erl_xcomp_clock_gettime_cpu_time= -## `erl_xcomp_getaddrinfo` - `yes|no`. Defaults to `no`. If `yes`, the target -## system must have a working `getaddrinfo()` implementation that can -## handle both IPv4 and IPv6. +# * `erl_xcomp_getaddrinfo' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a working `getaddrinfo()' implementation that can +# handle both IPv4 and IPv6. #erl_xcomp_getaddrinfo= -## `erl_xcomp_gethrvtime_procfs_ioctl` - `yes|no`. Defaults to `no`. If `yes`, -## the target system must have a working `gethrvtime()` implementation and -## is used with procfs `ioctl()`. +# * `erl_xcomp_gethrvtime_procfs_ioctl' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `gethrvtime()' implementation and +# is used with procfs `ioctl()'. #erl_xcomp_gethrvtime_procfs_ioctl= -## `erl_xcomp_dlsym_brk_wrappers` - `yes|no`. Defaults to `no`. If `yes`, the -## target system must have a working `dlsym(RTLD_NEXT, <S>)` implementation -## that can be used on `brk` and `sbrk` symbols used by the `malloc()` -## implementation in use, and by this track the `malloc()` implementations -## core memory usage. This is currently only used by unsupported features. +# * `erl_xcomp_dlsym_brk_wrappers' - `yes|no'. Defaults to `no'. If `yes', the +# target system must have a working `dlsym(RTLD_NEXT, <S>)' implementation +# that can be used on `brk' and `sbrk' symbols used by the `malloc()' +# implementation in use, and by this track the `malloc()' implementations +# core memory usage. This is currently only used by unsupported features. #erl_xcomp_dlsym_brk_wrappers= -## `erl_xcomp_kqueue` - `yes|no`. Defaults to `no`. If `yes`, the target system -## must have a working `kqueue()` implementation that returns a file -## descriptor which can be used by `poll()` and/or `select()`. If `no` and -## the target system has not got `epoll()` or `/dev/poll`, the kernel-poll -## feature will be disabled. +# * `erl_xcomp_kqueue' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a working `kqueue()' implementation that returns a file +# descriptor which can be used by `poll()' and/or `select()'. If `no' and +# the target system has not got `epoll()' or `/dev/poll', the kernel-poll +# feature will be disabled. #erl_xcomp_kqueue= -## `erl_xcomp_linux_clock_gettime_correction` - `yes|no`. Defaults to `yes` on -## Linux; otherwise, `no`. If `yes`, `clock_gettime(CLOCK_MONOTONIC, _)` on -## the target system must work. This variable is recommended to be set to -## `no` on Linux systems with kernel versions less than 2.6. +# * `erl_xcomp_linux_clock_gettime_correction' - `yes|no'. Defaults to `yes' on +# Linux; otherwise, `no'. If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on +# the target system must work. This variable is recommended to be set to +# `no' on Linux systems with kernel versions less than 2.6. #erl_xcomp_linux_clock_gettime_correction= -## `erl_xcomp_linux_nptl` - `yes|no`. Defaults to `yes` on Linux; otherwise, -## `no`. If `yes`, the target system must have NPTL (Native POSIX Thread -## Library). Older Linux systems have LinuxThreads instead of NPTL (Linux -## kernel versions typically less than 2.6). +# * `erl_xcomp_linux_nptl' - `yes|no'. Defaults to `yes' on Linux; otherwise, +# `no'. If `yes', the target system must have NPTL (Native POSIX Thread +# Library). Older Linux systems have LinuxThreads instead of NPTL (Linux +# kernel versions typically less than 2.6). #erl_xcomp_linux_nptl= -## `erl_xcomp_linux_usable_sigaltstack` - `yes|no`. Defaults to `yes` on Linux; -## otherwise, `no`. If `yes`, `sigaltstack()` must be usable on the target -## system. `sigaltstack()` on Linux kernel versions less than 2.4 are -## broken. +# * `erl_xcomp_linux_usable_sigaltstack' - `yes|no'. Defaults to `yes' on Linux; +# otherwise, `no'. If `yes', `sigaltstack()' must be usable on the target +# system. `sigaltstack()' on Linux kernel versions less than 2.4 are +# broken. #erl_xcomp_linux_usable_sigaltstack= -## `erl_xcomp_linux_usable_sigusrx` - `yes|no`. Defaults to `yes`. If `yes`, -## the `SIGUSR1` and `SIGUSR2` signals must be usable by the ERTS. Old -## LinuxThreads thread libraries (Linux kernel versions typically less than -## 2.2) used these signals and made them unusable by the ERTS. +# * `erl_xcomp_linux_usable_sigusrx' - `yes|no'. Defaults to `yes'. If `yes', +# the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. Old +# LinuxThreads thread libraries (Linux kernel versions typically less than +# 2.2) used these signals and made them unusable by the ERTS. #erl_xcomp_linux_usable_sigusrx= -## `erl_xcomp_poll` - `yes|no`. Defaults to `no` on Darwin/MacOSX; otherwise, -## `yes`. If `yes`, the target system must have a working `poll()` -## implementation that also can handle devices. If `no`, `select()` will be -## used instead of `poll()`. +# * `erl_xcomp_poll' - `yes|no'. Defaults to `no' on Darwin/MacOSX; otherwise, +# `yes'. If `yes', the target system must have a working `poll()' +# implementation that also can handle devices. If `no', `select()' will be +# used instead of `poll()'. #erl_xcomp_poll= -## `erl_xcomp_putenv_copy` - `yes|no`. Defaults to `no`. If `yes`, the target -## system must have a `putenv()` implementation that stores a copy of the -## key/value pair. +# * `erl_xcomp_putenv_copy' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a `putenv()' implementation that stores a copy of the +# key/value pair. #erl_xcomp_putenv_copy= -## `erl_xcomp_reliable_fpe` - `yes|no`. Defaults to `no`. If `yes`, the target -## system must have reliable floating point exceptions. +# * `erl_xcomp_reliable_fpe' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have reliable floating point exceptions. #erl_xcomp_reliable_fpe= -#### +## ----------------------------------------------------------------------------- diff --git a/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf b/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf index a0dd7c9115..f645ddbd96 100644 --- a/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf +++ b/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf @@ -1,258 +1,258 @@ -#### -*-shell-script-*- -#### -#### %CopyrightBegin% -#### -#### Copyright Ericsson AB 2010. All Rights Reserved. -#### -#### The contents of this file are subject to the Erlang Public License, -#### Version 1.1, (the "License"); you may not use this file except in -#### compliance with the License. You should have received a copy of the -#### Erlang Public License along with this software. If not, it can be -#### retrieved online at http://www.erlang.org/. -#### -#### Software distributed under the License is distributed on an "AS IS" -#### basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -#### the License for the specific language governing rights and limitations -#### under the License. -#### -#### %CopyrightEnd% -#### -#### File: erl-xcomp-x86_64-saf-linux-gnu.conf -#### Author: Rickard Green -#### -#### -------------------------------------------------------------------------- -#### When cross compiling Erlang/OTP using `otp_build`, copy this file and set -#### the variables needed below. Then pass the path to the copy of this file as -#### an argument to `otp_build` in the configure stage: -#### `otp_build configure --xcomp-conf=<FILE>` -#### -------------------------------------------------------------------------- - -### Note that you cannot define arbitrary variables in a cross compilation -### configuration file. Only the ones listed below will be guaranteed to be -### visible throughout the whole execution of all `configure` scripts. Other -### variables needs to be defined as arguments to `configure` or exported in -### the environment. - -### ### Variables for `otp_build` Only ### - -### Variables in this section are only used, when configuring Erlang/OTP for -### cross compilation using `$ERL_TOP/otp_build configure`. - -### *NOTE*! These variables currently have *no* effect if you configure using -### the `configure` script directly. - -## `erl_xcomp_build` - The build system used. This value will be passed as -## `--build=$erl_xcomp_build` argument to the `configure` script. It does -## not have to be a full `CPU-VENDOR-OS` triplet, but can be. The full -## `CPU-VENDOR-OS` triplet will be created by -## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build`. -## If set to `guess`, the build system will be guessed using -## `$ERL_TOP/erts/autoconf/config.guess`. +## -*-shell-script-*- +## +## %CopyrightBegin% +## +## Copyright Ericsson AB 2010. All Rights Reserved. +## +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. +## +## %CopyrightEnd% +## +## File: erl-xcomp-x86_64-saf-linux-gnu.conf +## Author: Rickard Green +## +## ----------------------------------------------------------------------------- +## When cross compiling Erlang/OTP using `otp_build', copy this file and set +## the variables needed below. Then pass the path to the copy of this file as +## an argument to `otp_build' in the configure stage: +## `otp_build configure --xcomp-conf=<FILE>' +## ----------------------------------------------------------------------------- + +## Note that you cannot define arbitrary variables in a cross compilation +## configuration file. Only the ones listed below will be guaranteed to be +## visible throughout the whole execution of all `configure' scripts. Other +## variables needs to be defined as arguments to `configure' or exported in +## the environment. + +## -- Variables for `otp_build' Only ------------------------------------------- + +## Variables in this section are only used, when configuring Erlang/OTP for +## cross compilation using `$ERL_TOP/otp_build configure'. + +## *NOTE*! These variables currently have *no* effect if you configure using +## the `configure' script directly. + +# * `erl_xcomp_build' - The build system used. This value will be passed as +# `--build=$erl_xcomp_build' argument to the `configure' script. It does +# not have to be a full `CPU-VENDOR-OS' triplet, but can be. The full +# `CPU-VENDOR-OS' triplet will be created by +# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build'. If set to `guess', +# the build system will be guessed using +# `$ERL_TOP/erts/autoconf/config.guess'. erl_xcomp_build=guess -## `erl_xcomp_host` - Cross host/target system to build for. This value will -## be passed as `--host=$erl_xcomp_host` argument to the `configure` script. -## It does not have to be a full `CPU-VENDOR-OS` triplet, but can be. The -## full `CPU-VENDOR-OS` triplet will be created by: -## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host` +# * `erl_xcomp_host' - Cross host/target system to build for. This value will +# be passed as `--host=$erl_xcomp_host' argument to the `configure' script. +# It does not have to be a full `CPU-VENDOR-OS' triplet, but can be. The +# full `CPU-VENDOR-OS' triplet will be created by +# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host'. erl_xcomp_host=x86_64-saf-linux-gnu -## `erl_xcomp_configure_flags` - Extra configure flags to pass to the -## `configure` script. +# * `erl_xcomp_configure_flags' - Extra configure flags to pass to the +# `configure' script. #erl_xcomp_configure_flags= -### ### Cross Compiler and Other Tools ### +## -- Cross Compiler and Other Tools ------------------------------------------- -### If the cross compilation tools are prefixed by `<HOST>-` you probably do -### not need to set these variables (where `<HOST>` is what has been passed as -### `--host=<HOST>` argument to `configure`). +## If the cross compilation tools are prefixed by `<HOST>-' you probably do +## not need to set these variables (where `<HOST>' is what has been passed as +## `--host=<HOST>' argument to `configure'). -### All variables in this section can also be used when native compiling. +## All variables in this section can also be used when native compiling. -## `CC` - C compiler. +# * `CC' - C compiler. CC=x86_64-saf-gcc -## `CFLAGS` - C compiler flags. +# * `CFLAGS' - C compiler flags. #CFLAGS= -## `STATIC_CFLAGS` - Static C compiler flags. +# * `STATIC_CFLAGS' - Static C compiler flags. #STATIC_CFLAGS= -## `CFLAG_RUNTIME_LIBRARY_PATH` - This flag should set runtime library -## search path for the shared libraries. Note that this actually is a -## linker flag, but it needs to be passed via the compiler. +# * `CFLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library +# search path for the shared libraries. Note that this actually is a +# linker flag, but it needs to be passed via the compiler. #CFLAG_RUNTIME_LIBRARY_PATH= -## `CPP` - C pre-processor. +# * `CPP' - C pre-processor. #CPP= -## `CPPFLAGS` - C pre-processor flags. +# * `CPPFLAGS' - C pre-processor flags. #CPPFLAGS= -## `CXX` - C++ compiler. +# * `CXX' - C++ compiler. CXX=x86_64-saf-g++ -## `CXXFLAGS` - C++ compiler flags. +# * `CXXFLAGS' - C++ compiler flags. #CXXFLAGS= -## `LD` - Linker. +# * `LD' - Linker. LD=x86_64-saf-ld -## `LDFLAGS` - Linker flags. +# * `LDFLAGS' - Linker flags. #LDFLAGS= -## `LIBS` - Libraries. +# * `LIBS' - Libraries. #LIBS= -### #### *D*ynamic *E*rlang *D*river Linking #### +## -- *D*ynamic *E*rlang *D*river Linking -- -### *NOTE*! Either set all or none of the `DED_LD*` variables. +## *NOTE*! Either set all or none of the `DED_LD*' variables. -## `DED_LD` - Linker for Dynamically loaded Erlang Drivers. +# * `DED_LD' - Linker for Dynamically loaded Erlang Drivers. #DED_LD= -## `DED_LDFLAGS` - Linker flags to use with `DED_LD`. +# * `DED_LDFLAGS' - Linker flags to use with `DED_LD'. #DED_LDFLAGS= -## `DED_LD_FLAG_RUNTIME_LIBRARY_PATH` - This flag should set runtime library -## search path for shared libraries when linking with `DED_LD`. +# * `DED_LD_FLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library +# search path for shared libraries when linking with `DED_LD'. #DED_LD_FLAG_RUNTIME_LIBRARY_PATH= -### #### Large File Support #### +## -- Large File Support -- -### *NOTE*! Either set all or none of the `LFS_*` variables. +## *NOTE*! Either set all or none of the `LFS_*' variables. -## `LFS_CFLAGS` - Large file support C compiler flags. +# * `LFS_CFLAGS' - Large file support C compiler flags. #LFS_CFLAGS= -## `LFS_LDFLAGS` - Large file support linker flags. +# * `LFS_LDFLAGS' - Large file support linker flags. #LFS_LDFLAGS= -## `LFS_LIBS` - Large file support libraries. +# * `LFS_LIBS' - Large file support libraries. #LFS_LIBS= -### #### Other Tools #### +## -- Other Tools -- -## `RANLIB` - `ranlib` archive index tool. +# * `RANLIB' - `ranlib' archive index tool. RANLIB=x86_64-saf-ranlib -## `AR` - `ar` archiving tool. +# * `AR' - `ar' archiving tool. AR=x86_64-saf-ar -## `GETCONF` - `getconf` system configuration inspection tool. `getconf` is -## currently used for finding out large file support flags to use, and -## on Linux systems for finding out if we have an NPTL thread library or -## not. +# * `GETCONF' - `getconf' system configuration inspection tool. `getconf' is +# currently used for finding out large file support flags to use, and +# on Linux systems for finding out if we have an NPTL thread library or +# not. #GETCONF= -### ### Cross System Root Locations ### +## -- Cross System Root Locations ---------------------------------------------- -## `erl_xcomp_sysroot` - The absolute path to the system root of the cross -## compilation environment. Currently, the `crypto`, `odbc`, `ssh` and -## `ssl` applications need the system root. These applications will be -## skipped if the system root has not been set. The system root might be -## needed for other things too. If this is the case and the system root -## has not been set, `configure` will fail and request you to set it. +# * `erl_xcomp_sysroot' - The absolute path to the system root of the cross +# compilation environment. Currently, the `crypto', `odbc', `ssh' and +# `ssl' applications need the system root. These applications will be +# skipped if the system root has not been set. The system root might be +# needed for other things too. If this is the case and the system root +# has not been set, `configure' will fail and request you to set it. erl_xcomp_sysroot="$SAF_SYSROOT_X86_64" -## `erl_xcomp_isysroot` - The absolute path to the system root for includes -## of the cross compilation environment. If not set, this value defaults -## to `$erl_xcomp_sysroot`, i.e., only set this value if the include system -## root path is not the same as the system root path. +# * `erl_xcomp_isysroot' - The absolute path to the system root for includes +# of the cross compilation environment. If not set, this value defaults +# to `$erl_xcomp_sysroot', i.e., only set this value if the include system +# root path is not the same as the system root path. #erl_xcomp_isysroot= -### ### Optional Feature, and Bug Tests ### +## -- Optional Feature, and Bug Tests ------------------------------------------ -### These tests cannot (always) be done automatically when cross compiling. You -### usually do not need to set these variables. Only set these if you really -### know what you are doing. +## These tests cannot (always) be done automatically when cross compiling. You +## usually do not need to set these variables. Only set these if you really +## know what you are doing. -### Note that some of these values will override results of tests performed -### by `configure`, and some will not be used until `configure` is sure that -### it cannot figure the result out. +## Note that some of these values will override results of tests performed +## by `configure', and some will not be used until `configure' is sure that +## it cannot figure the result out. -### The `configure` script will issue a warning when a default value is used. -### When a variable has been set, no warning will be issued. +## The `configure' script will issue a warning when a default value is used. +## When a variable has been set, no warning will be issued. -## `erl_xcomp_after_morecore_hook` - `yes|no`. Defaults to `no`. If `yes`, the -## target system must have a working `__after_morecore_hook` that can be -## used for tracking used `malloc()` implementations core memory usage. -## This is currently only used by unsupported features. +# * `erl_xcomp_after_morecore_hook' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `__after_morecore_hook' that can be +# used for tracking used `malloc()' implementations core memory usage. +# This is currently only used by unsupported features. erl_xcomp_after_morecore_hook=yes -## `erl_xcomp_bigendian` - `yes|no`. No default. If `yes`, the target system -## must be big endian. If `no`, little endian. This can often be -## automatically detected, but not always. If not automatically detected, -## `configure` will fail unless this variable is set. Since no default -## value is used, `configure` will try to figure this out automatically. +# * `erl_xcomp_bigendian' - `yes|no'. No default. If `yes', the target system +# must be big endian. If `no', little endian. This can often be +# automatically detected, but not always. If not automatically detected, +# `configure' will fail unless this variable is set. Since no default +# value is used, `configure' will try to figure this out automatically. #erl_xcomp_bigendian= -## `erl_xcomp_clock_gettime_cpu_time` - `yes|no`. Defaults to `no`. If `yes`, -## the target system must have a working `clock_gettime()` implementation -## that can be used for retrieving process CPU time. +# * `erl_xcomp_clock_gettime_cpu_time' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `clock_gettime()' implementation +# that can be used for retrieving process CPU time. #erl_xcomp_clock_gettime_cpu_time= -## `erl_xcomp_getaddrinfo` - `yes|no`. Defaults to `no`. If `yes`, the target -## system must have a working `getaddrinfo()` implementation that can -## handle both IPv4 and IPv6. +# * `erl_xcomp_getaddrinfo' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a working `getaddrinfo()' implementation that can +# handle both IPv4 and IPv6. erl_xcomp_getaddrinfo=yes -## `erl_xcomp_gethrvtime_procfs_ioctl` - `yes|no`. Defaults to `no`. If `yes`, -## the target system must have a working `gethrvtime()` implementation and -## is used with procfs `ioctl()`. +# * `erl_xcomp_gethrvtime_procfs_ioctl' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `gethrvtime()' implementation and +# is used with procfs `ioctl()'. #erl_xcomp_gethrvtime_procfs_ioctl= -## `erl_xcomp_dlsym_brk_wrappers` - `yes|no`. Defaults to `no`. If `yes`, the -## target system must have a working `dlsym(RTLD_NEXT, <S>)` implementation -## that can be used on `brk` and `sbrk` symbols used by the `malloc()` -## implementation in use, and by this track the `malloc()` implementations -## core memory usage. This is currently only used by unsupported features. +# * `erl_xcomp_dlsym_brk_wrappers' - `yes|no'. Defaults to `no'. If `yes', the +# target system must have a working `dlsym(RTLD_NEXT, <S>)' implementation +# that can be used on `brk' and `sbrk' symbols used by the `malloc()' +# implementation in use, and by this track the `malloc()' implementations +# core memory usage. This is currently only used by unsupported features. #erl_xcomp_dlsym_brk_wrappers= -## `erl_xcomp_kqueue` - `yes|no`. Defaults to `no`. If `yes`, the target system -## must have a working `kqueue()` implementation that returns a file -## descriptor which can be used by `poll()` and/or `select()`. If `no` and -## the target system has not got `epoll()` or `/dev/poll`, the kernel-poll -## feature will be disabled. +# * `erl_xcomp_kqueue' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a working `kqueue()' implementation that returns a file +# descriptor which can be used by `poll()' and/or `select()'. If `no' and +# the target system has not got `epoll()' or `/dev/poll', the kernel-poll +# feature will be disabled. #erl_xcomp_kqueue= -## `erl_xcomp_linux_clock_gettime_correction` - `yes|no`. Defaults to `yes` on -## Linux; otherwise, `no`. If `yes`, `clock_gettime(CLOCK_MONOTONIC, _)` on -## the target system must work. This variable is recommended to be set to -## `no` on Linux systems with kernel versions less than 2.6. +# * `erl_xcomp_linux_clock_gettime_correction' - `yes|no'. Defaults to `yes' on +# Linux; otherwise, `no'. If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on +# the target system must work. This variable is recommended to be set to +# `no' on Linux systems with kernel versions less than 2.6. #erl_xcomp_linux_clock_gettime_correction= -## `erl_xcomp_linux_nptl` - `yes|no`. Defaults to `yes` on Linux; otherwise, -## `no`. If `yes`, the target system must have NPTL (Native POSIX Thread -## Library). Older Linux systems have LinuxThreads instead of NPTL (Linux -## kernel versions typically less than 2.6). +# * `erl_xcomp_linux_nptl' - `yes|no'. Defaults to `yes' on Linux; otherwise, +# `no'. If `yes', the target system must have NPTL (Native POSIX Thread +# Library). Older Linux systems have LinuxThreads instead of NPTL (Linux +# kernel versions typically less than 2.6). #erl_xcomp_linux_nptl= -## `erl_xcomp_linux_usable_sigaltstack` - `yes|no`. Defaults to `yes` on Linux; -## otherwise, `no`. If `yes`, `sigaltstack()` must be usable on the target -## system. `sigaltstack()` on Linux kernel versions less than 2.4 are -## broken. +# * `erl_xcomp_linux_usable_sigaltstack' - `yes|no'. Defaults to `yes' on Linux; +# otherwise, `no'. If `yes', `sigaltstack()' must be usable on the target +# system. `sigaltstack()' on Linux kernel versions less than 2.4 are +# broken. #erl_xcomp_linux_usable_sigaltstack= -## `erl_xcomp_linux_usable_sigusrx` - `yes|no`. Defaults to `yes`. If `yes`, -## the `SIGUSR1` and `SIGUSR2` signals must be usable by the ERTS. Old -## LinuxThreads thread libraries (Linux kernel versions typically less than -## 2.2) used these signals and made them unusable by the ERTS. +# * `erl_xcomp_linux_usable_sigusrx' - `yes|no'. Defaults to `yes'. If `yes', +# the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. Old +# LinuxThreads thread libraries (Linux kernel versions typically less than +# 2.2) used these signals and made them unusable by the ERTS. #erl_xcomp_linux_usable_sigusrx= -## `erl_xcomp_poll` - `yes|no`. Defaults to `no` on Darwin/MacOSX; otherwise, -## `yes`. If `yes`, the target system must have a working `poll()` -## implementation that also can handle devices. If `no`, `select()` will be -## used instead of `poll()`. +# * `erl_xcomp_poll' - `yes|no'. Defaults to `no' on Darwin/MacOSX; otherwise, +# `yes'. If `yes', the target system must have a working `poll()' +# implementation that also can handle devices. If `no', `select()' will be +# used instead of `poll()'. #erl_xcomp_poll= -## `erl_xcomp_putenv_copy` - `yes|no`. Defaults to `no`. If `yes`, the target -## system must have a `putenv()` implementation that stores a copy of the -## key/value pair. +# * `erl_xcomp_putenv_copy' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a `putenv()' implementation that stores a copy of the +# key/value pair. #erl_xcomp_putenv_copy= -## `erl_xcomp_reliable_fpe` - `yes|no`. Defaults to `no`. If `yes`, the target -## system must have reliable floating point exceptions. +# * `erl_xcomp_reliable_fpe' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have reliable floating point exceptions. #erl_xcomp_reliable_fpe= -#### +## ----------------------------------------------------------------------------- diff --git a/xcomp/erl-xcomp.conf.template b/xcomp/erl-xcomp.conf.template index 090f92c15f..eb331ffe92 100644 --- a/xcomp/erl-xcomp.conf.template +++ b/xcomp/erl-xcomp.conf.template @@ -1,258 +1,258 @@ -#### -*-shell-script-*- -#### -#### %CopyrightBegin% -#### -#### Copyright Ericsson AB 2009-2010. All Rights Reserved. -#### -#### The contents of this file are subject to the Erlang Public License, -#### Version 1.1, (the "License"); you may not use this file except in -#### compliance with the License. You should have received a copy of the -#### Erlang Public License along with this software. If not, it can be -#### retrieved online at http://www.erlang.org/. -#### -#### Software distributed under the License is distributed on an "AS IS" -#### basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -#### the License for the specific language governing rights and limitations -#### under the License. -#### -#### %CopyrightEnd% -#### -#### File: erl-xcomp.conf.template -#### Author: Rickard Green -#### -#### -------------------------------------------------------------------------- -#### When cross compiling Erlang/OTP using `otp_build`, copy this file and set -#### the variables needed below. Then pass the path to the copy of this file as -#### an argument to `otp_build` in the configure stage: -#### `otp_build configure --xcomp-conf=<FILE>` -#### -------------------------------------------------------------------------- - -### Note that you cannot define arbitrary variables in a cross compilation -### configuration file. Only the ones listed below will be guaranteed to be -### visible throughout the whole execution of all `configure` scripts. Other -### variables needs to be defined as arguments to `configure` or exported in -### the environment. - -### ### Variables for `otp_build` Only ### - -### Variables in this section are only used, when configuring Erlang/OTP for -### cross compilation using `$ERL_TOP/otp_build configure`. - -### *NOTE*! These variables currently have *no* effect if you configure using -### the `configure` script directly. - -## `erl_xcomp_build` - The build system used. This value will be passed as -## `--build=$erl_xcomp_build` argument to the `configure` script. It does -## not have to be a full `CPU-VENDOR-OS` triplet, but can be. The full -## `CPU-VENDOR-OS` triplet will be created by -## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build`. -## If set to `guess`, the build system will be guessed using -## `$ERL_TOP/erts/autoconf/config.guess`. +## -*-shell-script-*- +## +## %CopyrightBegin% +## +## Copyright Ericsson AB 2009-2010. All Rights Reserved. +## +## The contents of this file are subject to the Erlang Public License, +## Version 1.1, (the "License"); you may not use this file except in +## compliance with the License. You should have received a copy of the +## Erlang Public License along with this software. If not, it can be +## retrieved online at http://www.erlang.org/. +## +## Software distributed under the License is distributed on an "AS IS" +## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +## the License for the specific language governing rights and limitations +## under the License. +## +## %CopyrightEnd% +## +## File: erl-xcomp.conf.template +## Author: Rickard Green +## +## ----------------------------------------------------------------------------- +## When cross compiling Erlang/OTP using `otp_build', copy this file and set +## the variables needed below. Then pass the path to the copy of this file as +## an argument to `otp_build' in the configure stage: +## `otp_build configure --xcomp-conf=<FILE>' +## ----------------------------------------------------------------------------- + +## Note that you cannot define arbitrary variables in a cross compilation +## configuration file. Only the ones listed below will be guaranteed to be +## visible throughout the whole execution of all `configure' scripts. Other +## variables needs to be defined as arguments to `configure' or exported in +## the environment. + +## -- Variables for `otp_build' Only ------------------------------------------- + +## Variables in this section are only used, when configuring Erlang/OTP for +## cross compilation using `$ERL_TOP/otp_build configure'. + +## *NOTE*! These variables currently have *no* effect if you configure using +## the `configure' script directly. + +# * `erl_xcomp_build' - The build system used. This value will be passed as +# `--build=$erl_xcomp_build' argument to the `configure' script. It does +# not have to be a full `CPU-VENDOR-OS' triplet, but can be. The full +# `CPU-VENDOR-OS' triplet will be created by +# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build'. If set to `guess', +# the build system will be guessed using +# `$ERL_TOP/erts/autoconf/config.guess'. #erl_xcomp_build= -## `erl_xcomp_host` - Cross host/target system to build for. This value will -## be passed as `--host=$erl_xcomp_host` argument to the `configure` script. -## It does not have to be a full `CPU-VENDOR-OS` triplet, but can be. The -## full `CPU-VENDOR-OS` triplet will be created by: -## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host` +# * `erl_xcomp_host' - Cross host/target system to build for. This value will +# be passed as `--host=$erl_xcomp_host' argument to the `configure' script. +# It does not have to be a full `CPU-VENDOR-OS' triplet, but can be. The +# full `CPU-VENDOR-OS' triplet will be created by +# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host'. #erl_xcomp_host= -## `erl_xcomp_configure_flags` - Extra configure flags to pass to the -## `configure` script. +# * `erl_xcomp_configure_flags' - Extra configure flags to pass to the +# `configure' script. #erl_xcomp_configure_flags= -### ### Cross Compiler and Other Tools ### +## -- Cross Compiler and Other Tools ------------------------------------------- -### If the cross compilation tools are prefixed by `<HOST>-` you probably do -### not need to set these variables (where `<HOST>` is what has been passed as -### `--host=<HOST>` argument to `configure`). +## If the cross compilation tools are prefixed by `<HOST>-' you probably do +## not need to set these variables (where `<HOST>' is what has been passed as +## `--host=<HOST>' argument to `configure'). -### All variables in this section can also be used when native compiling. +## All variables in this section can also be used when native compiling. -## `CC` - C compiler. +# * `CC' - C compiler. #CC= -## `CFLAGS` - C compiler flags. +# * `CFLAGS' - C compiler flags. #CFLAGS= -## `STATIC_CFLAGS` - Static C compiler flags. +# * `STATIC_CFLAGS' - Static C compiler flags. #STATIC_CFLAGS= -## `CFLAG_RUNTIME_LIBRARY_PATH` - This flag should set runtime library -## search path for the shared libraries. Note that this actually is a -## linker flag, but it needs to be passed via the compiler. +# * `CFLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library +# search path for the shared libraries. Note that this actually is a +# linker flag, but it needs to be passed via the compiler. #CFLAG_RUNTIME_LIBRARY_PATH= -## `CPP` - C pre-processor. +# * `CPP' - C pre-processor. #CPP= -## `CPPFLAGS` - C pre-processor flags. +# * `CPPFLAGS' - C pre-processor flags. #CPPFLAGS= -## `CXX` - C++ compiler. +# * `CXX' - C++ compiler. #CXX= -## `CXXFLAGS` - C++ compiler flags. +# * `CXXFLAGS' - C++ compiler flags. #CXXFLAGS= -## `LD` - Linker. +# * `LD' - Linker. #LD= -## `LDFLAGS` - Linker flags. +# * `LDFLAGS' - Linker flags. #LDFLAGS= -## `LIBS` - Libraries. +# * `LIBS' - Libraries. #LIBS= -### #### *D*ynamic *E*rlang *D*river Linking #### +## -- *D*ynamic *E*rlang *D*river Linking -- -### *NOTE*! Either set all or none of the `DED_LD*` variables. +## *NOTE*! Either set all or none of the `DED_LD*' variables. -## `DED_LD` - Linker for Dynamically loaded Erlang Drivers. +# * `DED_LD' - Linker for Dynamically loaded Erlang Drivers. #DED_LD= -## `DED_LDFLAGS` - Linker flags to use with `DED_LD`. +# * `DED_LDFLAGS' - Linker flags to use with `DED_LD'. #DED_LDFLAGS= -## `DED_LD_FLAG_RUNTIME_LIBRARY_PATH` - This flag should set runtime library -## search path for shared libraries when linking with `DED_LD`. +# * `DED_LD_FLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library +# search path for shared libraries when linking with `DED_LD'. #DED_LD_FLAG_RUNTIME_LIBRARY_PATH= -### #### Large File Support #### +## -- Large File Support -- -### *NOTE*! Either set all or none of the `LFS_*` variables. +## *NOTE*! Either set all or none of the `LFS_*' variables. -## `LFS_CFLAGS` - Large file support C compiler flags. +# * `LFS_CFLAGS' - Large file support C compiler flags. #LFS_CFLAGS= -## `LFS_LDFLAGS` - Large file support linker flags. +# * `LFS_LDFLAGS' - Large file support linker flags. #LFS_LDFLAGS= -## `LFS_LIBS` - Large file support libraries. +# * `LFS_LIBS' - Large file support libraries. #LFS_LIBS= -### #### Other Tools #### +## -- Other Tools -- -## `RANLIB` - `ranlib` archive index tool. +# * `RANLIB' - `ranlib' archive index tool. #RANLIB= -## `AR` - `ar` archiving tool. +# * `AR' - `ar' archiving tool. #AR= -## `GETCONF` - `getconf` system configuration inspection tool. `getconf` is -## currently used for finding out large file support flags to use, and -## on Linux systems for finding out if we have an NPTL thread library or -## not. +# * `GETCONF' - `getconf' system configuration inspection tool. `getconf' is +# currently used for finding out large file support flags to use, and +# on Linux systems for finding out if we have an NPTL thread library or +# not. #GETCONF= -### ### Cross System Root Locations ### +## -- Cross System Root Locations ---------------------------------------------- -## `erl_xcomp_sysroot` - The absolute path to the system root of the cross -## compilation environment. Currently, the `crypto`, `odbc`, `ssh` and -## `ssl` applications need the system root. These applications will be -## skipped if the system root has not been set. The system root might be -## needed for other things too. If this is the case and the system root -## has not been set, `configure` will fail and request you to set it. +# * `erl_xcomp_sysroot' - The absolute path to the system root of the cross +# compilation environment. Currently, the `crypto', `odbc', `ssh' and +# `ssl' applications need the system root. These applications will be +# skipped if the system root has not been set. The system root might be +# needed for other things too. If this is the case and the system root +# has not been set, `configure' will fail and request you to set it. #erl_xcomp_sysroot= -## `erl_xcomp_isysroot` - The absolute path to the system root for includes -## of the cross compilation environment. If not set, this value defaults -## to `$erl_xcomp_sysroot`, i.e., only set this value if the include system -## root path is not the same as the system root path. +# * `erl_xcomp_isysroot' - The absolute path to the system root for includes +# of the cross compilation environment. If not set, this value defaults +# to `$erl_xcomp_sysroot', i.e., only set this value if the include system +# root path is not the same as the system root path. #erl_xcomp_isysroot= -### ### Optional Feature, and Bug Tests ### +## -- Optional Feature, and Bug Tests ------------------------------------------ -### These tests cannot (always) be done automatically when cross compiling. You -### usually do not need to set these variables. Only set these if you really -### know what you are doing. +## These tests cannot (always) be done automatically when cross compiling. You +## usually do not need to set these variables. Only set these if you really +## know what you are doing. -### Note that some of these values will override results of tests performed -### by `configure`, and some will not be used until `configure` is sure that -### it cannot figure the result out. +## Note that some of these values will override results of tests performed +## by `configure', and some will not be used until `configure' is sure that +## it cannot figure the result out. -### The `configure` script will issue a warning when a default value is used. -### When a variable has been set, no warning will be issued. +## The `configure' script will issue a warning when a default value is used. +## When a variable has been set, no warning will be issued. -## `erl_xcomp_after_morecore_hook` - `yes|no`. Defaults to `no`. If `yes`, the -## target system must have a working `__after_morecore_hook` that can be -## used for tracking used `malloc()` implementations core memory usage. -## This is currently only used by unsupported features. +# * `erl_xcomp_after_morecore_hook' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `__after_morecore_hook' that can be +# used for tracking used `malloc()' implementations core memory usage. +# This is currently only used by unsupported features. #erl_xcomp_after_morecore_hook= -## `erl_xcomp_bigendian` - `yes|no`. No default. If `yes`, the target system -## must be big endian. If `no`, little endian. This can often be -## automatically detected, but not always. If not automatically detected, -## `configure` will fail unless this variable is set. Since no default -## value is used, `configure` will try to figure this out automatically. +# * `erl_xcomp_bigendian' - `yes|no'. No default. If `yes', the target system +# must be big endian. If `no', little endian. This can often be +# automatically detected, but not always. If not automatically detected, +# `configure' will fail unless this variable is set. Since no default +# value is used, `configure' will try to figure this out automatically. #erl_xcomp_bigendian= -## `erl_xcomp_clock_gettime_cpu_time` - `yes|no`. Defaults to `no`. If `yes`, -## the target system must have a working `clock_gettime()` implementation -## that can be used for retrieving process CPU time. +# * `erl_xcomp_clock_gettime_cpu_time' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `clock_gettime()' implementation +# that can be used for retrieving process CPU time. #erl_xcomp_clock_gettime_cpu_time= -## `erl_xcomp_getaddrinfo` - `yes|no`. Defaults to `no`. If `yes`, the target -## system must have a working `getaddrinfo()` implementation that can -## handle both IPv4 and IPv6. +# * `erl_xcomp_getaddrinfo' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a working `getaddrinfo()' implementation that can +# handle both IPv4 and IPv6. #erl_xcomp_getaddrinfo= -## `erl_xcomp_gethrvtime_procfs_ioctl` - `yes|no`. Defaults to `no`. If `yes`, -## the target system must have a working `gethrvtime()` implementation and -## is used with procfs `ioctl()`. +# * `erl_xcomp_gethrvtime_procfs_ioctl' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `gethrvtime()' implementation and +# is used with procfs `ioctl()'. #erl_xcomp_gethrvtime_procfs_ioctl= -## `erl_xcomp_dlsym_brk_wrappers` - `yes|no`. Defaults to `no`. If `yes`, the -## target system must have a working `dlsym(RTLD_NEXT, <S>)` implementation -## that can be used on `brk` and `sbrk` symbols used by the `malloc()` -## implementation in use, and by this track the `malloc()` implementations -## core memory usage. This is currently only used by unsupported features. +# * `erl_xcomp_dlsym_brk_wrappers' - `yes|no'. Defaults to `no'. If `yes', the +# target system must have a working `dlsym(RTLD_NEXT, <S>)' implementation +# that can be used on `brk' and `sbrk' symbols used by the `malloc()' +# implementation in use, and by this track the `malloc()' implementations +# core memory usage. This is currently only used by unsupported features. #erl_xcomp_dlsym_brk_wrappers= -## `erl_xcomp_kqueue` - `yes|no`. Defaults to `no`. If `yes`, the target system -## must have a working `kqueue()` implementation that returns a file -## descriptor which can be used by `poll()` and/or `select()`. If `no` and -## the target system has not got `epoll()` or `/dev/poll`, the kernel-poll -## feature will be disabled. +# * `erl_xcomp_kqueue' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a working `kqueue()' implementation that returns a file +# descriptor which can be used by `poll()' and/or `select()'. If `no' and +# the target system has not got `epoll()' or `/dev/poll', the kernel-poll +# feature will be disabled. #erl_xcomp_kqueue= -## `erl_xcomp_linux_clock_gettime_correction` - `yes|no`. Defaults to `yes` on -## Linux; otherwise, `no`. If `yes`, `clock_gettime(CLOCK_MONOTONIC, _)` on -## the target system must work. This variable is recommended to be set to -## `no` on Linux systems with kernel versions less than 2.6. +# * `erl_xcomp_linux_clock_gettime_correction' - `yes|no'. Defaults to `yes' on +# Linux; otherwise, `no'. If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on +# the target system must work. This variable is recommended to be set to +# `no' on Linux systems with kernel versions less than 2.6. #erl_xcomp_linux_clock_gettime_correction= -## `erl_xcomp_linux_nptl` - `yes|no`. Defaults to `yes` on Linux; otherwise, -## `no`. If `yes`, the target system must have NPTL (Native POSIX Thread -## Library). Older Linux systems have LinuxThreads instead of NPTL (Linux -## kernel versions typically less than 2.6). +# * `erl_xcomp_linux_nptl' - `yes|no'. Defaults to `yes' on Linux; otherwise, +# `no'. If `yes', the target system must have NPTL (Native POSIX Thread +# Library). Older Linux systems have LinuxThreads instead of NPTL (Linux +# kernel versions typically less than 2.6). #erl_xcomp_linux_nptl= -## `erl_xcomp_linux_usable_sigaltstack` - `yes|no`. Defaults to `yes` on Linux; -## otherwise, `no`. If `yes`, `sigaltstack()` must be usable on the target -## system. `sigaltstack()` on Linux kernel versions less than 2.4 are -## broken. +# * `erl_xcomp_linux_usable_sigaltstack' - `yes|no'. Defaults to `yes' on Linux; +# otherwise, `no'. If `yes', `sigaltstack()' must be usable on the target +# system. `sigaltstack()' on Linux kernel versions less than 2.4 are +# broken. #erl_xcomp_linux_usable_sigaltstack= -## `erl_xcomp_linux_usable_sigusrx` - `yes|no`. Defaults to `yes`. If `yes`, -## the `SIGUSR1` and `SIGUSR2` signals must be usable by the ERTS. Old -## LinuxThreads thread libraries (Linux kernel versions typically less than -## 2.2) used these signals and made them unusable by the ERTS. +# * `erl_xcomp_linux_usable_sigusrx' - `yes|no'. Defaults to `yes'. If `yes', +# the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. Old +# LinuxThreads thread libraries (Linux kernel versions typically less than +# 2.2) used these signals and made them unusable by the ERTS. #erl_xcomp_linux_usable_sigusrx= -## `erl_xcomp_poll` - `yes|no`. Defaults to `no` on Darwin/MacOSX; otherwise, -## `yes`. If `yes`, the target system must have a working `poll()` -## implementation that also can handle devices. If `no`, `select()` will be -## used instead of `poll()`. +# * `erl_xcomp_poll' - `yes|no'. Defaults to `no' on Darwin/MacOSX; otherwise, +# `yes'. If `yes', the target system must have a working `poll()' +# implementation that also can handle devices. If `no', `select()' will be +# used instead of `poll()'. #erl_xcomp_poll= -## `erl_xcomp_putenv_copy` - `yes|no`. Defaults to `no`. If `yes`, the target -## system must have a `putenv()` implementation that stores a copy of the -## key/value pair. +# * `erl_xcomp_putenv_copy' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a `putenv()' implementation that stores a copy of the +# key/value pair. #erl_xcomp_putenv_copy= -## `erl_xcomp_reliable_fpe` - `yes|no`. Defaults to `no`. If `yes`, the target -## system must have reliable floating point exceptions. +# * `erl_xcomp_reliable_fpe' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have reliable floating point exceptions. #erl_xcomp_reliable_fpe= -#### +## ----------------------------------------------------------------------------- |