OCaml branches information [closed] - branch

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
There's a lot of interesting branches of OCaml in http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/. I can't seem to find any good information about what these do, though. Are they not ment to be public? For example, the README-files are identical in all branches. How to find more information about them (just googling won't help)?

Here is some information about some of the more major branches (those which are available to be installed through OPAM -- http://opam.ocamlpro.com):
4.00.1+short-types C 4.00.1+short-types Better heuristic to display long type names
-- -- 3.11.2 Official 3.11.2 release
-- -- 3.12.1 Official 3.12.1 release
-- -- 4.00.0 Official 4.00.0 release
-- -- 4.00.1 Official 4.00.1 release
-- -- 3.12.1+mirage-unix-direct Mirage compiler for unix
-- -- 3.12.1+mirage-xen Mirage compiler for xen
-- -- 3.12.1+natdynlink-osx Support for native dynlink on OSX
-- -- 4.00.0+debug-runtime Debug runtime
-- -- 4.00.0+fp Runtime with frame-pointers (improved GDB & perf usage)
-- -- 4.00.0+raspberrypi Native backend for Raspberry-PI
-- -- 4.00.1+BER BER MetaOCaml (http://okmij.org/ftp/ML/MetaOCaml.html)
-- -- 4.00.1+alloc-profiling support allocation profiling on x86_64
-- -- 4.00.1+annot Enable -binannot by default
-- -- 4.00.1+french French translation of error messages
-- -- 4.00.1+mirage-unix Mirage compiler for unix
-- -- 4.00.1+mirage-xen Mirage compiler for xen
-- -- 4.00.1+open-types add open extensible types to OCaml
-- -- 4.00.1+raspberrypi Native backend for Raspberry-PI
-- -- 4.01.0dev+endian Improved low-level integer primitive access
-- -- 4.01.0dev+mirage-unix UNIX tuntap backend for Mirage
-- -- 4.01.0dev+mirage-xen Xen unikernel builds for Mirage
-- -- 4.01.0dev+short-paths latest trunk snapshot with short type names
-- -- 4.01.0dev+trunk latest trunk snapshot

You can try emailing OCaml maintainers at: caml#inria.fr, or post your question regarding the branches in OCaml forums. The revision logs for each of the branches may also give some clues as to what each branch is for.

Related

ARM Cortex-M3 Startup Code

I'm trying to understand how the initialization code works that ships with Keil (realview v4) for the STM32 microcontrollers. Specifically, I'm trying to understand how the stack is initialized.
In the documentation on ARM's website it mentions that one of the routines in startup_xxx.s, __user_initial_stack_heap, should not use more than 88 bytes of stack. Do you know where that limitation is coming from?
It seems that when the reset handler calls System_Init it is executing a couple functions in a C environment which I believe means it is using some form of a temporary stack (it allocates a few automatic variables). However, all of those stack'd items should be out of scope once it returns back and then calls __main which is where __user_initial_stack_heap is called from.
So why is there this requirement for __user_initial_stack_heap to not use more than 88 bytes? Does the rest of __main use a ton of stack or something?
Any explanation of the cortex-m3 stack architecture as it relates to the startup sequence would be fantastic.
You will see from the __user_initial_stackheap() documentation, that the function is for legacy support and that it is superseded by __user_setup_stackheap(); the documentation for the latter provides a clue ragarding your question:
Unlike __user_initial_stackheap(), __user_setup_stackheap() works with systems where the application starts with a value of sp (r13) that is already correct, for example, Cortex-M3
[..]
Using __user_setup_stackheap() rather than __user_initial_stackheap() improves code size because there is no requirement for a temporary stack.
On Cortex-M the sp is initialised on reset by the hardware from a value stored in the vector table, on older ARM7 and ARM9 devices this is not the case and it is necessary to set the stack-pointer in software. The start-up code needs a small stack for use before the user defined stack is applied - this may be the case for example if the user stack were in external memory and could not be used until the memory controller were initialised. The 88 byte restriction is imposed simply because this temporary stack is sized to be as small as possible since it is probably unused after start-up.
In your case in STM32 (a Cortex-M device), it is likely that there is in fact no such restriction, but you should perhaps update your start-up code to use the newer function to be certain. That said, given the required behaviour of this function and the fact that its results are returned in registers, I would suggest that 88 bytes would be rather extravagant if you were to need that much! Moreover, you only need to reimplement it if you are using scatter loading file as described.

CUDA fmaf function [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am trying to optimize a CUDA code. I replaced expression
result = x*y+z
with
result = fmaf(x,y,z)
But, it gives an error - CUDA error: kernel launch failure (7): too many resources requested for launch
As #JackOLantern indicated, it's likely the device code compiler will make this kind of optimization for you. You can compare the two cases to see what kind of code has been emitted by using:
nvcc -ptx -arch... mycode.cu
to see what kind of PTX code got emitted in each case, or:
cuobjdump -sass myapp
to see what kind of SASS (device machine code) got emitted in each case.
You haven't supplied any actual code, but the "too many resources requested for launch" in the context of this question is most likely due to requesting too many registers per threadblock ((registers per thread) * (threads per block) should be less than the maximum registers allowable per block, i.e. per multiprocessor).
You can determine the maximum registers allowable per block for your device using the deviceQuery sample code or from the programming guide. (registers per multiprocessor)
You can find out how many registers per thread the compiler is using by specifying:
-Xptxas -v
as additional command-line switches when compiling your code.
You can use the launch bounds qualifier to instruct the compiler to use fewer registers per thread.

LGPL grammar file licensing [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
Given a LGPL'ed grammar file, is the source generated by a compiler-compiler for the grammar a derivative works? What about if the grammar file was modified before it was given as input to the compiler-compiler? There isn't any linking, at least not in the conventional sense.
If the output is a derivitive work, must I then simply provide the (modified) grammer sources making any best efforts to ensure the grammar will function without dependencies imposed by the program/library using it? Or are there more restrictions which must be resolved?
1) Since the grammar contains the essence of the resulting code, it definitely belongs to "all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities" and is not a part of "the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work". In brief, LGPLv3 applies.
So, you need to convey the "Minimal Corresponding Source" (the one used to build the version in the Combined Work) according to sec.4 d) 0) or GPLv3 sec.6, mark it as modified if it is and possibly include custom tools if required by GPL's definition of "Corresponding Source". (In general, as sec.0 says, LGPLv3 is effectively GPLv3 with a few additional provisions.)
2) It might be a derivative work of the generator used as well if the latter inserts parts of itself into the code (see FSF FAQ#Can I use GPL-covered tools... to compile...?) - check the generator's workings and licensing terms if necessary. If it is, you'll have to satisfy both LGPLv3 and the generator's terms that apply to the results of its work.
The best answer, and which everyone should be giving you is as follows:
Contact a lawyer
Disclaimer: IANAL and if you want something "official" you should talk to one. That said...
A common-sense approach says that yes, the result of compilation of something that is compilable is a derivative work. For instance, the compiled version of an LGPL library is still LGPL - you can't say that you obtained a compiled version of the library and never compiled it yourself and somehow dodge providing the source code that way.
Thus, the LGPL would require you to distribute the (potentially modified) source of the original LGPL work, such that if an individual wanted to further modify the work, they could.

What implementation of Forth should I use for learning Forth? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I want to start learning Forth (like in the related Stack Overflow question Is it practical to learn and use Forth?). I see that there are many implementations. I would like to use a
ANS 1994 compatible version (if reasonable, but sticking to the standard might be good)
small and compact implementation, I don't want a full OS.
Windows
easy to use, I am new to Forth ;-)
What particular implementation can be recommended?
Win32Forth is really fantastic, as mentioned above. It has a nice integrated development environment and is a pretty modern implementation that seems to match up very well with the standards as well as including some more experimental but widely-accepted features.
I use Gforth, but I also use Vim to edit source files. :) Gforth is good and "classic" as far as the features it supports. It gives you a very "old school" Forth experience without being overly quirky to use. (Some free Forths do odd things with their command lines and such - I use Brodie's "Starting Forth" as the model of how a Forth interpreter should behave.)
I looked at SwiftForth, which is a very nice "high tech" Forth system that goes well beyond what the classic Forths offer in terms of language features and really brings Forth into the modern programming world. If you want to actually do Forth programs professionally, SwiftForth looks like it can handle just about anything you want to do with it.
Some time ago I evaluated 4tH, an implementation of Forth.
I think it meets all of
your requirements. For instance the compiler is only 61 KB. There is also full support for floating point numbers, important if you want to
try to use it for technical/scientific purposes.
4tH runs on most operating systems, including MS-DOS, MS-Windows (both 16 bit and 32 bit), Linux, Coherent, AIX, SunOS, BOS, BSD, Mac OS X, BeOS, RISC OS, etc. Download (Windows installer, 1.5 MB, includes the manual). Manual (PDF, 1.1 MB).
There is an active community centered around the Google Group 4tH-compiler.
For instance today I received two messages.
Please note that in 4tH you can't define your own defining words (words executing at compile time). This is not a serious
limitation, unless you want to cover advanced Forth features.
To get you started (as this is not very clear from the manual or the interactive compile), after installation copy the compiler, 4th.exe, to an empty folder, make two files in this directory, HelloWorld.bat and HelloWorld.4th, and run HelloWorld.bat:
HelloWorld.bat:
4th.exe cx HelloWorld.4th
pause
HelloWorld.4th:
: hello ." Hello from XYZ!" cr cr ;
hello
SwiftForth. It isn't self-consciously small and compact; it just happens to be. It's easy to use (LOCATE WH EDIT , a nicer than usual WORDS), comes with two books, and has an excellent mailing list with over a decade of archives. The evaluation version won't let you compile turnkey apps or DLLs; it still provides an excellent console for a student, and can support scripts in the usual ways. Quick Windows examples:
: sleep-monitor ( -- )
HWND_BROADCAST WM_SYSCOMMAND SC_MONITORPOWER 2 SendMessage drop ;
library dnsapi.dll
( ... DLL imports, constants ... )
variable results
: DnsQuery ( z -- res )
DNS_TYPE_A 0 NULL results NULL DnsQuery_UTF8 ;
: resolves? ( z -- f )
DnsQuery if false exit then
results # DnsRecordListFree true ;
\ an example use of the dialog compiler
\ this compiled DSL is an example of something that 4th
\ precludes with its "not ... serious limitation"
DIALOG (HELLO-ABOUT)
[MODELESS " About Hello" 10 10 120 70
(FONT 8, MS Sans Serif) ]
\ [class text id x y sx xy ]
[CTEXT " HELLO" -1 10 10 100 10 ]
[CTEXT " (C) 1997 Forth, Inc." -1 10 25 100 10 ]
[CTEXT " http://www.forth.com" -1 10 35 100 10 ]
[DEFPUSHBUTTON " OK" IDOK 35 50 50 14 ]
END-DIALOG
Download Gforth for PC and Android.
Tinker with it using it as a calculator, solving simple problems, Fibonacci, solving the quadratic a b c, etc.
I realise they might not meet all your requirements but the following Forth-like languages might also interest you from a learning perspective.
Factor
RetroForth
Additionally, I have found the Re-Factor blog to be a good introduction to Factor.
If you can find a copy of FORTH Inc's old polyFORTH, and an old x86 that can run it, this is the language used in Leo Brodie's original "Starting FORTH". It is a clean and very robust FORTH.
I recommend ciforth, as you're a Windows user the version built for Windows is known as wina: an MS-WIndows NAtive Forth.
ciforth is a small system written in NASM assembler, and comes with a similar interface for a wide variety of systems. It's small, fast, classic (blocks ftw), easy to use as it's old school, comes with a ton of documentation and a wordlist that isn't overwhelming like Gforth's (the wordlist for Lina is here, the only difference between lina and wina are in words that access the underlying OS: linux/MS-Windows).
Gforth has a lot of bloated definitions and some of Starting Forth won't work in it, for example.
The only thing the official release of ciforth lacks is a floating point stack, but Forth can deal with fixed point incredibly well (if one reads Starting Forth, one learns about how to use it).
wina versions can call dll functions just fine, in 32 and 64 bit, but can also make turnkey applications that call dll functions.
Beta releases have floating point as a loadable extension.
Win32Forth worked well for me.
durexForth is an ANS compliant C64 Forth and very small.

Where can I find TTY and curses documentation for Unix?

I'm working on automation tools for an ERP program running on SCO Unix.
See my questions on Expect:
(Tcl/Expect) clear screen after exit
Expect - get variable from screen region based on row and column
Where can I find (either locally or on the web) resources for understanding what control characters are used in a session, and more specifically, determining a field location on the screen during an interaction with the ERP program?
The specific control characters for a given terminal type are stored in the terminfo database. curses reads the value of $TERM when initializing and uses it to find and extract the relevant sequences for the various terminal operations.
I'm not really clear what you are asking, but one source of documentation on curses is the GNU implementation at http://www.gnu.org/software/ncurses. As far as 'control characters' go, well that depends on what terminal you use - yours probably understands ANSI codes - see http://en.wikipedia.org/wiki/ANSI_escape_code.
I just found out that the X/Open Group released a new version of their standard in November 2009 (previous version was released in 1996), and it is available free on the web from their bookstore as Technical Standard - X/Open Curses, Issue 7. You have to register, but access is free (and registration does not lead to an inundation of email, etc).
The previous version, Issue 4, Version 2 (from July 1996), is no longer available from X/Open. Given the newness of Issue 7, the new features are unlikely to be widely implemented yet, but look for changes in the next few years.