EnglishFrenchSpanish

Ad


OnWorks favicon

camlmix - Online in the Cloud

Run camlmix in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command camlmix that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


camlmix - preprocessor which converts text with embedded OCaml

SYNOPSIS


camlmix [Options...] files...

DESCRIPTION


camlmix processes text templates with embedded OCaml code to generate text again. From one
or several input files it generates an OCaml text generation program and executes this to
obtain the result. Using option -fun one can also convert the text template into an OCaml
text generation function.

OPTIONS


-o output
write the generated text into file output

-c Only generate the text generation program, don't execute it. By default, the
program is called lastfile.ml when lastfile is the last file argument.

-co file
specify the name of the text generation program

-fun generate OCaml code for text generation function from the input (see ADVANCED USAGE
below)

-e ocamlc
set the name of the OCaml executable

-clean remove the text generation program after execution

-insert ocaml_code
insert ocaml_code at the beginning of the text generation program

-remix try a conversion to the camlremix syntax

-version
print version and exit

-help | --help
print help and exit (this man page was written from the output of -help)

BASIC USAGE


Text enclosed with ## markers is considered as a block of OCaml code. It can be any kind
of toplevel expressions such as definitions or application of printing functions:

This is ocaml version ## print Sys.ocaml_version ##

If the OCaml code starts with = then it is interpreted as an expression of type string
that will printed like the rest of the text:

This is ocaml version ##= Sys.ocaml_version ##

The text block are printed together with the evaluated OCaml pieces using the print
function. Include ### to print ##.

White space can be controlled with ##. and .##:

##. don't print white space occurring on the left

.## don't print white space up to and including the first newline, following to the
right.

ADVANCED USAGE


Directives
Blocks of code that start with the @ character (possibly preceded by spaces) are
directives for Camlmix. There are two directives. include inserts a camlmix file, and
skip skips the next block. For instance

Hello ## @include "world.mlx"; skip .## ## let x = 123 ##!

Conversion into a text generation function for dynamic rendering
The -fun option, used in combination with -c and often -co produces an OCaml source file
which provides a function render with the following signature:

val render : ?print:(string -> unit) -> 'a -> unit

The polymorphic argument is called param in the generated code and can be used to pass
runtime arguments into the render function. The print function is used to set the initial
value of Camlmix.printer (see below). It's default value is:

fun s -> print_string s; flush stdout

Runtime hooks
The text generation program, which camlmix generates, contains a module Camlmix at the
beginning, which can be used in code blocks. This module has the following signature.

module Camlmix : sig

val source : string ref

val line : int ref

val char : int ref
Location of the first character of the current block in its source file.
Line and character numbers count from 1. These references are updated by
camlmix at the beginning of each block.

val printer : (string -> unit) ref
function for printing text blocks

val print_with : (string -> unit) -> unit
print_with f causes the next text block to be printed with f instead of the
current printer. Its behavior is undefined if it is called several times in
the same code block.

val print_if : bool -> unit
print_if cond prints the next text block only if condition cond is true. It
uses print_with internally.

end

Use camlmix online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Phaser
    Phaser
    Phaser is a fast, free, and fun open
    source HTML5 game framework that offers
    WebGL and Canvas rendering across
    desktop and mobile web browsers. Games
    can be co...
    Download Phaser
  • 2
    VASSAL Engine
    VASSAL Engine
    VASSAL is a game engine for creating
    electronic versions of traditional board
    and card games. It provides support for
    game piece rendering and interaction,
    and...
    Download VASSAL Engine
  • 3
    OpenPDF - Fork of iText
    OpenPDF - Fork of iText
    OpenPDF is a Java library for creating
    and editing PDF files with a LGPL and
    MPL open source license. OpenPDF is the
    LGPL/MPL open source successor of iText,
    a...
    Download OpenPDF - Fork of iText
  • 4
    SAGA GIS
    SAGA GIS
    SAGA - System for Automated
    Geoscientific Analyses - is a Geographic
    Information System (GIS) software with
    immense capabilities for geodata
    processing and ana...
    Download SAGA GIS
  • 5
    Toolbox for Java/JTOpen
    Toolbox for Java/JTOpen
    The IBM Toolbox for Java / JTOpen is a
    library of Java classes supporting the
    client/server and internet programming
    models to a system running OS/400,
    i5/OS, o...
    Download Toolbox for Java/JTOpen
  • 6
    D3.js
    D3.js
    D3.js (or D3 for Data-Driven Documents)
    is a JavaScript library that allows you
    to produce dynamic, interactive data
    visualizations in web browsers. With D3
    you...
    Download D3.js
  • More »

Linux commands

  • 1
    abidiff
    abidiff
    abidiff - compare ABIs of ELF files
    abidiff compares the Application Binary
    Interfaces (ABI) of two shared libraries
    in ELF format. It emits a meaningful
    repor...
    Run abidiff
  • 2
    abidw
    abidw
    abidw - serialize the ABI of an ELF
    file abidw reads a shared library in ELF
    format and emits an XML representation
    of its ABI to standard output. The
    emitted ...
    Run abidw
  • 3
    copac2xml
    copac2xml
    bibutils - bibliography conversion
    utilities ...
    Run copac2xml
  • 4
    copt
    copt
    copt - peephole optimizer SYSNOPIS:
    copt file.. DESCRIPTION: copt is a
    general-purpose peephole optimizer. It
    reads code from its standard input and
    writes an ...
    Run copt
  • 5
    gather_stx_titles
    gather_stx_titles
    gather_stx_titles - gather title
    declarations from Stx documents ...
    Run gather_stx_titles
  • 6
    gatling-bench
    gatling-bench
    bench - http benchmark ...
    Run gatling-bench
  • More »

Ad