first commit
1100
1_intro.html
Normal file
880
1_intro.rst
Normal file
|
|
@ -0,0 +1,880 @@
|
|||
============================================================
|
||||
The ultimate introduction
|
||||
============================================================
|
||||
|
||||
|
||||
What is Nim?
|
||||
============
|
||||
|
||||
- new **systems** programming language
|
||||
- compiles to C
|
||||
- garbage collection + manual memory management
|
||||
- thread local garbage collection
|
||||
- design goals: efficient, expressive, elegant
|
||||
|
||||
..
|
||||
* Nim compiles to C; C++ and Objective-C are also supported
|
||||
* there is an experimental JavaScript backend
|
||||
* it provides a soft realtime GC: you can tell it how long it is allowed to run
|
||||
* the Nim compiler and **all** of the standard library (including the GC)
|
||||
are written in Nim
|
||||
* whole program dead code elimination: stdlib carefully crafted to make use
|
||||
of it; for instance parsers do not use (runtime) regular expressions ->
|
||||
re engine not part of the executable
|
||||
* our infrastructure (IDE, build tools, package manager) is
|
||||
also completely written in Nim
|
||||
* infix/indentation based syntax
|
||||
|
||||
|
||||
Philosophy
|
||||
==========
|
||||
|
||||
* power
|
||||
* efficiency
|
||||
* fun
|
||||
|
||||
..
|
||||
Talk about what the plans for Nim were
|
||||
|
||||
|
||||
|
||||
Why Nim?
|
||||
========
|
||||
|
||||
- Major influences: Modula 3, Delphi, Ada, C++, Python, Lisp, Oberon.
|
||||
|
||||
- Development started in 2006
|
||||
- First successful bootstrapping in 2008
|
||||
- compiler written in Delphi
|
||||
- converted to Nim via "pas2nim"
|
||||
|
||||
|
||||
Uses of Nim
|
||||
===========
|
||||
|
||||
- games
|
||||
- compilers
|
||||
- operating system development
|
||||
- scientific computing
|
||||
- scripting
|
||||
|
||||
|
||||
URLs
|
||||
====
|
||||
|
||||
============ ================================================
|
||||
Website http://nim-lang.org
|
||||
Mailing list http://www.freelists.org/list/nim-dev
|
||||
Forum http://forum.nim-lang.org
|
||||
Github https://github.com/Araq/Nim
|
||||
IRC irc.freenode.net/nim
|
||||
============ ================================================
|
||||
|
||||
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
::
|
||||
git clone -b devel git://github.com/nim-lang/Nim.git
|
||||
cd Nim
|
||||
git clone -b devel --depth 1 git://github.com/nim-lang/csources
|
||||
cd csources && sh build.sh
|
||||
cd ..
|
||||
bin/nim c koch
|
||||
./koch boot -d:release
|
||||
|
||||
|
||||
|
||||
Hello World
|
||||
===========
|
||||
|
||||
.. code-block:: nim
|
||||
echo "hello world!"
|
||||
|
||||
|
||||
Hello World
|
||||
===========
|
||||
|
||||
.. code-block:: nim
|
||||
echo "hello world!"
|
||||
|
||||
::
|
||||
nim c -r hello.nim
|
||||
|
||||
|
||||
|
||||
More Code!
|
||||
==========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
proc decimalToRoman*(number: range[1..3_999]): string =
|
||||
## Converts a number to a Roman numeral.
|
||||
const romanComposites = {
|
||||
"M": 1000, "CM": 900,
|
||||
"D": 500, "CD": 400, "C": 100,
|
||||
"XC": 90, "L": 50, "XL": 40, "X": 10, "IX": 9,
|
||||
"V": 5, "IV": 4, "I": 1}
|
||||
result = ""
|
||||
var decVal = number.int
|
||||
for key, val in items(romanComposites):
|
||||
while decVal >= val:
|
||||
decVal -= val
|
||||
result.add(key)
|
||||
|
||||
echo decimalToRoman(1009) # MIX
|
||||
|
||||
|
||||
- ``{"M": 1000, "CM": 900}`` sugar for ``[("M": 1000), ("CM": 900)]``
|
||||
- ``result`` implicitly available
|
||||
|
||||
|
||||
Nimble
|
||||
======
|
||||
|
||||
- Live demo.
|
||||
|
||||
|
||||
Function application
|
||||
====================
|
||||
|
||||
Function application is ``f()``, ``f(a)``, ``f(a, b)``.
|
||||
|
||||
|
||||
Function application
|
||||
====================
|
||||
|
||||
Function application is ``f()``, ``f(a)``, ``f(a, b)``.
|
||||
|
||||
And here is the sugar:
|
||||
|
||||
=========== ================== ===============================
|
||||
Sugar Meaning Example
|
||||
=========== ================== ===============================
|
||||
``f a`` ``f(a)`` ``spawn log("some message")``
|
||||
``a.f()`` ``f(a)`` ``db.fetchRow()``
|
||||
``a.f`` ``f(a)`` ``mystring.len``
|
||||
``f a, b`` ``f(a, b)`` ``echo "hello ", "world"``
|
||||
``a.f(b)`` ``f(a, b)`` ``myarray.map(f)``
|
||||
``a.f b`` ``f(a, b)`` ``db.fetchRow 1``
|
||||
``f"\n"`` ``f(r"\n")`` ``re"\b[a-z*]\b"``
|
||||
=========== ================== ===============================
|
||||
|
||||
|
||||
Function application
|
||||
====================
|
||||
|
||||
Function application is ``f()``, ``f(a)``, ``f(a, b)``.
|
||||
|
||||
And here is the sugar:
|
||||
|
||||
=========== ================== ===============================
|
||||
Sugar Meaning Example
|
||||
=========== ================== ===============================
|
||||
``f a`` ``f(a)`` ``spawn log("some message")``
|
||||
``a.f()`` ``f(a)`` ``db.fetchRow()``
|
||||
``a.f`` ``f(a)`` ``mystring.len``
|
||||
``f a, b`` ``f(a, b)`` ``echo "hello ", "world"``
|
||||
``a.f(b)`` ``f(a, b)`` ``myarray.map(f)``
|
||||
``a.f b`` ``f(a, b)`` ``db.fetchRow 1``
|
||||
``f"\n"`` ``f(r"\n")`` ``re"\b[a-z*]\b"``
|
||||
=========== ================== ===============================
|
||||
|
||||
|
||||
**BUT**: ``f`` does not mean ``f()``; ``myarray.map(f)`` passes ``f`` to ``map``
|
||||
|
||||
|
||||
Operators
|
||||
=========
|
||||
|
||||
* operators are simply sugar for functions
|
||||
* operator in backticks is treated like an identifier
|
||||
|
||||
::
|
||||
`@`(x, y)
|
||||
x.`@`(y)
|
||||
`@`(x)
|
||||
x.`@`()
|
||||
x.`@`
|
||||
|
||||
|
||||
Operators
|
||||
=========
|
||||
|
||||
* Of course, most of the time binary operators are simply invoked as ``x @ y``
|
||||
and unary operators as ``@x``.
|
||||
* No explicit distinction between binary and unary operators:
|
||||
|
||||
.. code-block:: Nim
|
||||
proc `++`(x: var int; y: int = 1; z: int = 0) =
|
||||
x = x + y + z
|
||||
|
||||
var g = 70
|
||||
++g
|
||||
g ++ 7
|
||||
g.`++`(10, 20)
|
||||
echo g # writes 108
|
||||
|
||||
* parameters are readonly unless declared as ``var``
|
||||
* ``var`` means "pass by reference" (implemented with a hidden pointer)
|
||||
|
||||
|
||||
Control flow
|
||||
============
|
||||
|
||||
|
||||
- The usual control flow statements are available:
|
||||
* if
|
||||
* case
|
||||
* when
|
||||
* while
|
||||
* for
|
||||
* try
|
||||
* defer
|
||||
* return
|
||||
* yield
|
||||
|
||||
|
||||
If vs when
|
||||
==========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
when defined(posix):
|
||||
proc getCreationTime(file: string): Time =
|
||||
var res: Stat
|
||||
if stat(file, res) < 0'i32:
|
||||
let error = osLastError()
|
||||
raiseOSError(error)
|
||||
return res.st_ctime
|
||||
|
||||
|
||||
|
||||
Statements vs expressions
|
||||
=========================
|
||||
|
||||
Statements require indentation:
|
||||
|
||||
.. code-block:: nim
|
||||
# no indentation needed for single assignment statement:
|
||||
if x: x = false
|
||||
|
||||
# indentation needed for nested if statement:
|
||||
if x:
|
||||
if y:
|
||||
y = false
|
||||
else:
|
||||
y = true
|
||||
|
||||
# indentation needed, because two statements follow the condition:
|
||||
if x:
|
||||
x = false
|
||||
y = false
|
||||
|
||||
|
||||
Statements vs expressions
|
||||
=========================
|
||||
|
||||
Expressions do not:
|
||||
|
||||
.. code-block:: nim
|
||||
|
||||
if thisIsaLongCondition() and
|
||||
thisIsAnotherLongCondition(1,
|
||||
2, 3, 4):
|
||||
x = true
|
||||
|
||||
- Rule of thumb: optional indentation after operators, ``(`` and ``,``
|
||||
- ``if``, ``case`` etc also available as expressions
|
||||
|
||||
|
||||
|
||||
Builtin types
|
||||
=============
|
||||
|
||||
- ``int`` -- platform dependent (16) 32 or 64 bit signed number
|
||||
* overflows produce an exception in debug mode; wrap around in release mode
|
||||
|
||||
- ``float`` -- 64 bit floating point number
|
||||
* float64 an alias for float
|
||||
* float32 32 bit floating point number
|
||||
|
||||
- ``int8`` / ``int16`` / ``int32`` / ``int64``
|
||||
* integer types with a platform independent size
|
||||
|
||||
|
||||
Builtin types
|
||||
=============
|
||||
|
||||
- ``uint`` / ``uint8`` / ``uint16`` / ``uint32`` / ``uint64``
|
||||
* like in C, always wrap around; modulo arithmetic
|
||||
* heavily discouraged: ``for in 0 .. x.len - 3``
|
||||
should iterate 0 times when ``x.len == 0``, not 4294967293 times!
|
||||
* instead: use ``Natural``
|
||||
|
||||
- ``range[T]``
|
||||
* subrange type; quite heavily used in Nim
|
||||
(``type Natural = range[0..high(int)]``)
|
||||
|
||||
- ``bool``
|
||||
|
||||
|
||||
Builtin types
|
||||
=============
|
||||
|
||||
- ``array[FixedSize, T]``
|
||||
* fixed size in Nim
|
||||
* value based datatypes
|
||||
* layout is compatible to C
|
||||
* create via ``[1, 2, 3]`` construction
|
||||
|
||||
- ``seq[T]``
|
||||
* dynamically resizable at runtime
|
||||
* grow with ``add``, resize with ``setLen``
|
||||
* create via ``@`` or ``newSeq``: ``@[1, 2, 3]``
|
||||
* allocated on the heap and GC'ed
|
||||
|
||||
- ``openArray[T]``
|
||||
* allows to pass ``seq`` or ``array`` to a routine
|
||||
* internally a (pointer, length) pair
|
||||
|
||||
|
||||
Builtin types
|
||||
=============
|
||||
|
||||
- ``proc (a, b: string) {.closure.}``
|
||||
* functions are first class in Nim
|
||||
* "calling convention" affects type compatibility
|
||||
* ``closure`` is a special calling convention (closures are GC'ed)
|
||||
|
||||
- ``char`` / ``string`` / ``cstring``
|
||||
* ``char`` is simply an octet, ``string`` is almost a ``seq[char]``.
|
||||
* ``string`` is (usually) allocated on the heap and GC'ed
|
||||
|
||||
|
||||
Builtin types
|
||||
=============
|
||||
|
||||
``tuple``
|
||||
|
||||
* value based datatypes
|
||||
* structural typing
|
||||
* optional field names
|
||||
* construct with ``()``
|
||||
|
||||
.. code-block:: Nim
|
||||
:number-lines:
|
||||
|
||||
proc `+-`(x, y: int): (int, int) = (x - y, x + y)
|
||||
# alternatively
|
||||
proc `+-`(x, y: int): tuple[lowerBound, upperBound: int] = (x - y, x + y)
|
||||
|
||||
let tup = 100 +- 10
|
||||
echo tup[0], " ", tup.upperBound
|
||||
|
||||
# tuple unpacking
|
||||
let (lower, _) = 100 +- 10
|
||||
|
||||
|
||||
Builtin types
|
||||
=============
|
||||
|
||||
``object``
|
||||
|
||||
* nominal typing
|
||||
* value based datatypes
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
type
|
||||
Rect = object
|
||||
x, y, w, h: int
|
||||
|
||||
# construction:
|
||||
let r = Rect(x: 12, y: 22, w: 40, h: 80)
|
||||
|
||||
# field access:
|
||||
echo r.x, " ", r.y
|
||||
|
||||
|
||||
Builtin types
|
||||
=============
|
||||
|
||||
enums & sets
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
type
|
||||
SandboxFlag* = enum ## what the interpreter should allow
|
||||
allowCast, ## allow unsafe language feature: 'cast'
|
||||
allowFFI, ## allow the FFI
|
||||
allowInfiniteLoops ## allow endless loops
|
||||
SandboxFlags* = set[SandboxFlag]
|
||||
|
||||
proc runNimCode(code: string; flags: SandboxFlags = {allowCast, allowFFI}) =
|
||||
...
|
||||
|
||||
|
||||
Builtin types
|
||||
=============
|
||||
|
||||
.. code-block:: C
|
||||
:number-lines:
|
||||
|
||||
#define allowCast (1 << 0)
|
||||
#define allowFFI (1 << 1)
|
||||
#define allowInfiniteLoops (1 << 1)
|
||||
|
||||
void runNimCode(char* code, unsigned int flags = allowCast|allowFFI);
|
||||
|
||||
runNimCode("4+5", 700);
|
||||
|
||||
|
||||
Builtin types
|
||||
=============
|
||||
|
||||
``ref`` and ``ptr``
|
||||
|
||||
* pointers; ``ref`` is a "traced" pointer, ``ptr`` is an "untraced" pointer
|
||||
* ``string``, ``seq``, ``ref`` and ``closure`` are GC'ed, nothing else
|
||||
* ``ref object`` an idiom to get reference semantics out of objects
|
||||
|
||||
|
||||
Regular expressions
|
||||
===================
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
# Model a regular expression
|
||||
type
|
||||
RegexKind = enum ## the regex AST's kind
|
||||
reChar, ## character node "c"
|
||||
reCClass, ## character class node "[a-z]"
|
||||
reStar, ## star node "r*"
|
||||
rePlus, ## plus node "r+"
|
||||
reOpt, ## option node "r?"
|
||||
reCat, ## concatenation node "ab"
|
||||
reAlt, ## alternatives node "a|b"
|
||||
reWordBoundary ## "\b"
|
||||
|
||||
RegExpr = ref object
|
||||
case kind: RegexKind
|
||||
of reWordBoundary: discard
|
||||
of reChar:
|
||||
c: char
|
||||
of reCClass:
|
||||
cc: set[char]
|
||||
of reStar, rePlus, reOpt:
|
||||
child0: RegExpr
|
||||
of reCat, reAlt:
|
||||
child1, child2: RegExpr
|
||||
|
||||
|
||||
Equality
|
||||
========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
proc `==`(a, b: RegExpr): bool =
|
||||
if a.kind == b.kind:
|
||||
case a.kind
|
||||
of reWordBoundary: result = true
|
||||
of reChar: result = a.c == b.c
|
||||
of reCClass: result = a.cc == b.cc
|
||||
of reStar, rePlus, reOpt: result = `==`(a.child0, b.child0)
|
||||
of reCat, reAlt: result = `==`(a.child1, b.child1) and
|
||||
`==`(a.child2, b.child2)
|
||||
|
||||
|
||||
Accessors
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
type
|
||||
HashTable[K, V] = object
|
||||
data: seq[(K, V)]
|
||||
|
||||
proc hash[K](k: K): int = 0
|
||||
|
||||
proc `[]`*[K, V](x: HashTable[K, V]; k: K): V =
|
||||
result = x.data[hash(k)][1]
|
||||
|
||||
proc `[]=`*[K, V](x: var HashTable[K, V]; k: K, v: V) =
|
||||
x.data[hash(k)][1] = v
|
||||
|
||||
|
||||
proc initHashTable[K, V](): HashTable[K, V] =
|
||||
result.data = @[]
|
||||
|
||||
var tab = initHashTable[string, string]()
|
||||
tab["key"] = "abc" # calls '[]=' accessor
|
||||
|
||||
echo tab["key"] # calls '[]' accessor
|
||||
|
||||
|
||||
Accessors
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
type
|
||||
HashTable[K, V] = object
|
||||
data: seq[(K, V)]
|
||||
|
||||
proc hash[K](k: K): int = 0
|
||||
|
||||
proc `[]`*[K, V](x: HashTable[K, V]; k: K): V =
|
||||
result = x.data[hash(k)][1]
|
||||
|
||||
proc `[]=`*[K, V](x: var HashTable[K, V]; k: K, v: V) =
|
||||
x.data[hash(k)][1] = v
|
||||
|
||||
|
||||
proc initHashTable[K, V](): HashTable[K, V] =
|
||||
result.data = @[]
|
||||
|
||||
var tab = initHashTable[string, string]()
|
||||
tab["key"] = "abc" # calls '[]=' accessor
|
||||
|
||||
echo tab["key"] # calls '[]' accessor
|
||||
|
||||
# ouch:
|
||||
tab["key"].add "xyz"
|
||||
|
||||
|
||||
Accessors
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
|
||||
proc `[]`*[Key, Value](x: var HashTable[Key, Value]; k: Key): var Value =
|
||||
result = x.data[hash(key)]
|
||||
|
||||
|
||||
var
|
||||
tab = initHashTable[string, string]()
|
||||
|
||||
# compiles :-)
|
||||
tab["key"].add "xyz"
|
||||
|
||||
|
||||
* ``var`` "pass by reference" for parameters
|
||||
* can also by used for return values
|
||||
|
||||
|
||||
Distinct
|
||||
========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
# Taken from system.nim
|
||||
const taintMode = compileOption("taintmode")
|
||||
|
||||
when taintMode:
|
||||
type TaintedString* = distinct string
|
||||
proc len*(s: TaintedString): int {.borrow.}
|
||||
else:
|
||||
type TaintedString* = string
|
||||
|
||||
proc readLine*(f: File): TaintedString {.tags: [ReadIOEffect], benign.}
|
||||
|
||||
|
||||
Distinct
|
||||
========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
# taintmode_ex
|
||||
|
||||
echo readLine(stdin)
|
||||
|
||||
::
|
||||
nim c -r --taintMode:on taintmode_ex
|
||||
|
||||
|
||||
|
||||
Distinct
|
||||
========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
# taintmode_ex
|
||||
|
||||
echo readLine(stdin).string
|
||||
|
||||
::
|
||||
nim c -r --taintMode:on taintmode_ex
|
||||
|
||||
|
||||
|
||||
Distinct
|
||||
========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
# taintmode_ex
|
||||
|
||||
proc `$`(x: TaintedString): string {.borrow.} # but: defeats the purpose
|
||||
|
||||
echo readLine(stdin)
|
||||
|
||||
::
|
||||
nim c -r --taintMode:on taintmode_ex
|
||||
|
||||
|
||||
Module system
|
||||
=============
|
||||
|
||||
.. code-block::nim
|
||||
:number-lines:
|
||||
|
||||
# Module A
|
||||
var
|
||||
global*: string = "A.global"
|
||||
|
||||
proc p*(x: string) = echo "exported ", x
|
||||
|
||||
|
||||
.. code-block::nim
|
||||
:number-lines:
|
||||
|
||||
# Module B
|
||||
import A
|
||||
|
||||
echo p(global)
|
||||
|
||||
|
||||
Module system
|
||||
=============
|
||||
|
||||
.. code-block::nim
|
||||
:number-lines:
|
||||
|
||||
# Module A
|
||||
var
|
||||
global*: string = "A.global"
|
||||
|
||||
proc p*(x: string) = echo "exported ", x
|
||||
|
||||
|
||||
.. code-block::nim
|
||||
:number-lines:
|
||||
|
||||
# Module B
|
||||
from A import p
|
||||
|
||||
echo p(A.global)
|
||||
|
||||
|
||||
Module system
|
||||
=============
|
||||
|
||||
.. code-block::nim
|
||||
:number-lines:
|
||||
|
||||
# Module A
|
||||
var
|
||||
global*: string = "A.global"
|
||||
|
||||
proc p*(x: string) = echo "exported ", x
|
||||
|
||||
|
||||
.. code-block::nim
|
||||
:number-lines:
|
||||
|
||||
# Module B
|
||||
import A except global
|
||||
|
||||
echo p(A.global)
|
||||
|
||||
|
||||
|
||||
Routines
|
||||
========
|
||||
|
||||
- ``proc``
|
||||
- ``iterator``
|
||||
- ``template``
|
||||
- ``macro``
|
||||
- ``method``
|
||||
- ``converter``
|
||||
- (``func``)
|
||||
|
||||
|
||||
Iterators
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
iterator `..<`(a, b: int): int =
|
||||
var i = a
|
||||
while i < b:
|
||||
yield i
|
||||
i += 1
|
||||
|
||||
for i in 0..<10:
|
||||
echo i+1, "-th iteration"
|
||||
|
||||
|
||||
Iterators
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
for x in [1, 2, 3]:
|
||||
echo x
|
||||
|
||||
|
||||
|
||||
Iterators
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
for x in [1, 2, 3]:
|
||||
echo x
|
||||
|
||||
|
||||
Rewritten to:
|
||||
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
for x in items([1, 2, 3]):
|
||||
echo x
|
||||
|
||||
..
|
||||
for i, x in foobar is rewritten to use the pairs iterator
|
||||
|
||||
|
||||
Iterators
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
iterator items*[IX, T](a: array[IX, T]): T {.inline.} =
|
||||
var i = low(IX)
|
||||
while i <= high(IX):
|
||||
yield a[i]
|
||||
i += 1
|
||||
|
||||
|
||||
Iterators
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
for x in [1, 2, 3]:
|
||||
x = 0 # doesn't compile
|
||||
|
||||
|
||||
|
||||
Iterators
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
var a = [1, 2, 3]
|
||||
for x in a:
|
||||
x = 0 # doesn't compile
|
||||
|
||||
|
||||
Iterators
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
iterator mitems*[IX, T](a: var array[IX, T]): var T {.inline.} =
|
||||
var i = low(IX)
|
||||
if i <= high(IX):
|
||||
while true:
|
||||
yield a[i]
|
||||
if i >= high(IX): break
|
||||
i += 1
|
||||
|
||||
var a = [1, 2, 3]
|
||||
for x in mitems(a):
|
||||
x = 0 # compiles
|
||||
|
||||
|
||||
Parallelism
|
||||
===========
|
||||
|
||||
.. code-block::nim
|
||||
:number-lines:
|
||||
|
||||
import tables, strutils
|
||||
|
||||
proc countWords(filename: string): CountTableRef[string] =
|
||||
## Counts all the words in the file.
|
||||
result = newCountTable[string]()
|
||||
for word in readFile(filename).split:
|
||||
result.inc word
|
||||
|
||||
|
||||
Parallelism
|
||||
===========
|
||||
|
||||
.. code-block::nim
|
||||
:number-lines:
|
||||
|
||||
#
|
||||
#
|
||||
const
|
||||
files = ["data1.txt", "data2.txt", "data3.txt", "data4.txt"]
|
||||
|
||||
proc main() =
|
||||
var tab = newCountTable[string]()
|
||||
for f in files:
|
||||
let tab2 = countWords(f)
|
||||
tab.merge(tab2)
|
||||
tab.sort()
|
||||
echo tab.largest
|
||||
|
||||
main()
|
||||
|
||||
|
||||
Parallelism
|
||||
===========
|
||||
|
||||
.. code-block::nim
|
||||
:number-lines:
|
||||
|
||||
import threadpool
|
||||
|
||||
const
|
||||
files = ["data1.txt", "data2.txt", "data3.txt", "data4.txt"]
|
||||
|
||||
proc main() =
|
||||
var tab = newCountTable[string]()
|
||||
var results: array[files.len, ***FlowVar[CountTableRef[string]]***]
|
||||
for i, f in files:
|
||||
results[i] = ***spawn*** countWords(f)
|
||||
for i in 0..high(results):
|
||||
tab.merge(*** ^results[i] ***)
|
||||
tab.sort()
|
||||
echo tab.largest
|
||||
|
||||
main()
|
||||
716
2_meta.html
Normal file
|
|
@ -0,0 +1,716 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Meta programming</title>
|
||||
<meta name="copyright"
|
||||
content="Copyright © 2015 Andreas Rumpf" />
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="Slidy2/styles/slidy.css" />
|
||||
<script src="Slidy2/scripts/slidy.js"
|
||||
charset="utf-8" type="text/javascript"></script>
|
||||
<style type="text/css">
|
||||
|
||||
span.DecNumber {color: blue}
|
||||
span.BinNumber {color: blue}
|
||||
span.HexNumber {color: blue}
|
||||
span.OctNumber {color: blue}
|
||||
span.FloatNumber {color: blue}
|
||||
span.Identifier {color: black}
|
||||
span.Keyword {font-weight: bold}
|
||||
span.StringLit {color: blue}
|
||||
span.LongStringLit {color: blue}
|
||||
span.CharLit {color: blue}
|
||||
span.EscapeSequence {color: black}
|
||||
span.Operator {color: black}
|
||||
span.Punctation {color: black}
|
||||
span.Comment, span.LongComment {font-style:italic; color: green}
|
||||
span.RegularExpression {color: DarkViolet}
|
||||
span.TagStart {color: DarkViolet}
|
||||
span.TagEnd {color: DarkViolet}
|
||||
span.Key {color: blue}
|
||||
span.Value {color: black}
|
||||
span.RawData {color: blue}
|
||||
span.Assembler {color: blue}
|
||||
span.Preprocessor {color: DarkViolet}
|
||||
span.Directive {color: DarkViolet}
|
||||
span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference,
|
||||
span.Other {color: black}
|
||||
|
||||
div.navigation {
|
||||
-moz-border-radius: 5px 5px 5px 5px;
|
||||
float: left;
|
||||
width: 30%;
|
||||
margin: 0; padding: 0;
|
||||
border: 3px outset #7F7F7F;
|
||||
background-color: #7F7F7F;
|
||||
}
|
||||
|
||||
div.navigation ul {
|
||||
list-style-type: none;
|
||||
padding-left: 1em;
|
||||
}
|
||||
div.navigation ul li a, div.navigation ul li a:visited {
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
text-decoration: none;
|
||||
}
|
||||
div.navigation ul li a:hover {
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
color: gold;
|
||||
}
|
||||
|
||||
div.content {
|
||||
margin-left: 30%;
|
||||
padding: 0 1em;
|
||||
border-left: 4em;
|
||||
}
|
||||
|
||||
dl.item dd, dl.item dd p {
|
||||
margin-top:3px;
|
||||
}
|
||||
dl.item dd pre {
|
||||
margin-left: 15pt;
|
||||
border: 0px;
|
||||
}
|
||||
dl.item dt, dl.item dt pre {
|
||||
margin: 20pt 0 0 5pt;
|
||||
}
|
||||
|
||||
pre, span.tok {
|
||||
background-color: #F9F9F9;
|
||||
border-color: #C4C4C4;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 1px 2px;
|
||||
color: black;
|
||||
line-spacing: 110%;
|
||||
font-weight: normal;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
span.red {
|
||||
color: #A80000;
|
||||
}
|
||||
|
||||
hr {background-color:#9D9D9D; border:0 none; color:#9D9D9D; height:1px; width:100%;}
|
||||
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger@python.org
|
||||
:Date: Date: 2006-05-21 22:44:42 +0200 (Sun, 21 May 2006)
|
||||
:Revision: Revision: 4564
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th { border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first { margin-top: 0 ! important }
|
||||
.last, .with-subtitle { margin-bottom: 0 ! important }
|
||||
.hidden { display: none }
|
||||
a.toc-backref { text-decoration: none ; color: black }
|
||||
blockquote.epigraph { margin: 2em 5em ; }
|
||||
dl.docutils dd { margin-bottom: 0.5em }
|
||||
div.abstract { margin: 2em 5em }
|
||||
div.abstract p.topic-title { font-weight: bold ; text-align: center }
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ; border: medium outset ; padding: 1em }
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title { font-weight: bold ; font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title { color: red ; font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication { margin: 2em 5em ; text-align: center ; font-style: italic }
|
||||
div.dedication p.topic-title { font-weight: bold ; font-style: normal }
|
||||
div.figure { margin-left: 2em ; margin-right: 2em }
|
||||
div.footer, div.header { clear: both; font-size: smaller }
|
||||
div.line-block { display: block ; margin-top: 1em ; margin-bottom: 1em }
|
||||
div.line-block div.line-block { margin-top: 0 ; margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
div.sidebar { margin-left: 1em ; border: medium outset ;
|
||||
padding: 1em ; background-color: #ffffee ; /*width: 40% ;*/ float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric { font-family: sans-serif ; font-size: medium }
|
||||
div.system-messages { margin: 5em }
|
||||
div.system-messages h1 { color: red }
|
||||
div.system-message { border: medium outset ; padding: 1em }
|
||||
div.system-message p.system-message-title { color: red ; font-weight: bold }
|
||||
div.topic { margin: 2em;}
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
h1.title { text-align: center }
|
||||
h2.subtitle { text-align: center }
|
||||
/* hr.docutils { width: 75% } */
|
||||
img.align-left { clear: left }
|
||||
img.align-right { clear: right }
|
||||
ol.simple, ul.simple { margin-bottom: 1em }
|
||||
ol.arabic { list-style: decimal }
|
||||
ol.loweralpha { list-style: lower-alpha }
|
||||
ol.upperalpha { list-style: upper-alpha }
|
||||
ol.lowerroman { list-style: lower-roman }
|
||||
ol.upperroman { list-style: upper-roman }
|
||||
p.attribution { text-align: right ; margin-left: 50% }
|
||||
p.caption { font-style: italic }
|
||||
p.credits { font-style: italic ; font-size: smaller }
|
||||
p.label { white-space: nowrap }
|
||||
p.rubric { font-weight:bold;font-size:larger;color:maroon;text-align:center}
|
||||
p.sidebar-title {font-family: sans-serif ;font-weight: bold ;font-size: larger }
|
||||
p.sidebar-subtitle {font-family: sans-serif ; font-weight: bold }
|
||||
p.topic-title {
|
||||
font-weight: bold;
|
||||
background-color: #6D6D6D;
|
||||
border-bottom: 1px solid #000000;
|
||||
border-top: 1px solid black;
|
||||
color: white;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
pre.address { margin-bottom: 0;margin-top:0;font-family:serif;font-size:100% }
|
||||
pre.literal-block, pre.doctest-block {margin-left: 2em ;margin-right: 2em }
|
||||
span.classifier {font-family: sans-serif;font-style: oblique }
|
||||
span.classifier-delimiter {font-family: sans-serif;font-weight: bold }
|
||||
span.interpreted {font-family: sans-serif }
|
||||
span.option {white-space: nowrap }
|
||||
span.pre {white-space: pre }
|
||||
span.problematic {color: red }
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation { border-left: solid 1px gray; margin-left: 1px }
|
||||
table.docinfo {margin: 2em 4em }
|
||||
table.docutils {margin-top: 0.5em;margin-bottom: 0.5em; border: 0 solid #9d9d9d; border-collapse: collapse; }
|
||||
table.footnote {border-left: solid 1px black;margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {padding-left: 0.5em;padding-right: 0.5em;
|
||||
vertical-align: top;}
|
||||
|
||||
table.docutils td, table.docutils th { border-bottom:1px solid #9D9D9D; }
|
||||
/* color: #4d4d4d} */
|
||||
|
||||
/* table.docutils td:hover, table.docinfo td:hover {color: #000000} */
|
||||
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold;text-align: left;white-space: nowrap;padding-left: 0 }
|
||||
|
||||
table.docutils th
|
||||
{
|
||||
color: black;
|
||||
font-weight:normal;
|
||||
background-color: #E3E3E3;
|
||||
border-top: 1px solid #1d1d1d;
|
||||
border-bottom: 1px solid #1d1d1d;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {font-size: 100% }
|
||||
ul.auto-toc { list-style-type: none }
|
||||
/*a.reference { color: #E00000; font-weight:bold;}
|
||||
a.reference:hover {color: #E00000;background-color: #ffff00;display: margin;
|
||||
font-weight:bold;}*/
|
||||
|
||||
p.pic {
|
||||
width: 1040px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="Slidy2/styles/w3c-blue.css" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="background">
|
||||
<img id="head-icon" alt="Nimrod logo"
|
||||
src="logo2.png" />
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1 class="title">Meta programming</h1>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="templates">Templates</h1><ul class="simple"><li>templates are declarative, macros imperative</li>
|
||||
</ul>
|
||||
<pre id="listing_1" class="listing"><span class="Comment"># from System.nim</span>
|
||||
<span class="Keyword">template</span> <span class="Punctuation">`</span><span class="Operator">!=</span><span class="Punctuation">`</span> <span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">:</span> <span class="Identifier">untyped</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">untyped</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">not</span> <span class="Punctuation">(</span><span class="Identifier">a</span> <span class="Operator">==</span> <span class="Identifier">b</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Identifier">assert</span><span class="Punctuation">(</span><span class="DecNumber">5</span> <span class="Operator">!=</span> <span class="DecNumber">6</span><span class="Punctuation">)</span> <span class="Comment"># rewritten to: assert(not (5 == 6))</span></pre><ul class="simple"><li>more transformations<ul class="simple"><li><tt class="docutils literal"><span class="pre">a > b</span></tt> is rewritten to <tt class="docutils literal"><span class="pre">b < a</span></tt>.</li>
|
||||
<li><tt class="docutils literal"><span class="pre">a in b</span></tt> is rewritten to <tt class="docutils literal"><span class="pre">contains(b, a)</span></tt>.</li>
|
||||
<li><tt class="docutils literal"><span class="pre">a notin b</span></tt> is rewritten to <tt class="docutils literal"><span class="pre">not (a in b)</span></tt>.</li>
|
||||
<li><tt class="docutils literal"><span class="pre">a isnot b</span></tt> is rewritten to <tt class="docutils literal"><span class="pre">not (a is b)</span></tt>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="templates">Templates</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
</pre></td><td><pre id="listing_2" class="listing"><span class="Keyword">template</span> <span class="Identifier">html</span><span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">,</span> <span class="Identifier">body</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">proc</span> <span class="Identifier">name</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">string</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="StringLit">"<html>"</span>
|
||||
<span class="Identifier">body</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"</html>"</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Identifier">html</span> <span class="Identifier">mainPage</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"colon syntax to pass statements to template"</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_2')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="templates">Templates</h1><p>Templates already suffice to implement simple DSLs:</p>
|
||||
<table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
</pre></td><td><pre id="listing_3" class="listing"><span class="Identifier">html</span> <span class="Identifier">mainPage</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">head</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">title</span> <span class="StringLit">"The Nim programming language"</span>
|
||||
<span class="Identifier">body</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">ul</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">li</span> <span class="StringLit">"efficient"</span>
|
||||
<span class="Identifier">li</span> <span class="StringLit">"expressive"</span>
|
||||
<span class="Identifier">li</span> <span class="StringLit">"elegant"</span>
|
||||
|
||||
<span class="Identifier">echo</span> <span class="Identifier">mainPage</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_3')">Select</button><p>Produces:<pre>
|
||||
<html>
|
||||
<head><title>The Nim programming language</title></head>
|
||||
<body>
|
||||
<ul>
|
||||
<li>efficient</li>
|
||||
<li>expressive</li>
|
||||
<li>elegant</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html></pre>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="templates">Templates</h1><pre id="listing_4" class="listing"><span class="Keyword">template</span> <span class="Identifier">html</span><span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">,</span> <span class="Identifier">body</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">proc</span> <span class="Identifier">name</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">string</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="StringLit">"<html>"</span>
|
||||
<span class="Identifier">body</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"</html>"</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Keyword">template</span> <span class="Identifier">head</span><span class="Punctuation">(</span><span class="Identifier">body</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"<head>"</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">body</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"</head>"</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Operator">...</span>
|
||||
|
||||
<span class="Keyword">template</span> <span class="Identifier">title</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"<title>$1</title>"</span> <span class="Operator">%</span> <span class="Identifier">x</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Keyword">template</span> <span class="Identifier">li</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"<li>$1</li>"</span> <span class="Operator">%</span> <span class="Identifier">x</span><span class="Punctuation">)</span></pre>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="templates">Templates</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
</pre></td><td><pre id="listing_5" class="listing"><span class="Keyword">proc</span> <span class="Identifier">mainPage</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">string</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="StringLit">"<html>"</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"<head>"</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"<title>$1</title>"</span> <span class="Operator">%</span> <span class="StringLit">"The Nim programming language"</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"</head>"</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"<body>"</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"<ul>"</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"<li>$1</li>"</span> <span class="Operator">%</span> <span class="StringLit">"efficient"</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"<li>$1</li>"</span> <span class="Operator">%</span> <span class="StringLit">"expressive"</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"<li>$1</li>"</span> <span class="Operator">%</span> <span class="StringLit">"elegant"</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"</ul>"</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"</body>"</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="StringLit">"</html>"</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_5')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="macros">Macros</h1><ul class="simple"><li>imperative AST to AST transformations</li>
|
||||
<li>Turing complete</li>
|
||||
<li><tt class="docutils literal"><span class="pre">macros</span></tt> module provides an API for dealing with Nim ASTs</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="code-coverage">Code coverage</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
</pre></td><td><pre id="listing_6" class="listing"><span class="Keyword">proc</span> <span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">try</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">case</span> <span class="Identifier">x</span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">8</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">if</span> <span class="Identifier">y</span> <span class="Operator">></span> <span class="DecNumber">9</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"8.1"</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"8.2"</span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">9</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"9"</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"else"</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"no exception"</span>
|
||||
<span class="Keyword">except</span> <span class="Identifier">IoError</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"IoError"</span>
|
||||
|
||||
<span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="DecNumber">8</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="DecNumber">10</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_6')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="code-coverage">Code coverage</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
</pre></td><td><pre id="listing_7" class="listing"><span class="Keyword">proc</span> <span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">try</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">case</span> <span class="Identifier">x</span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">8</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">if</span> <span class="Identifier">y</span> <span class="Operator">></span> <span class="DecNumber">9</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"8.1"</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span> <span style="background-color:#FF7700"><span class="Identifier">echo</span> <span class="StringLit">"8.2"</span></span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">9</span><span class="Punctuation">:</span> <span style="background-color:#FF7700"><span class="Identifier">echo</span> <span class="StringLit">"9"</span></span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"else"</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"no exception"</span>
|
||||
<span class="Keyword">except</span> <span class="Identifier">IoError</span><span class="Punctuation">:</span>
|
||||
<span style="background-color:#FF7700"><span class="Identifier">echo</span> <span class="StringLit">"IoError"</span></span>
|
||||
|
||||
<span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="DecNumber">8</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="DecNumber">10</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_7')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="code-coverage">Code coverage</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
</pre></td><td><pre id="listing_8" class="listing"><span class="Comment"># This is the code our macro will produce!</span>
|
||||
|
||||
<span class="Keyword">var</span>
|
||||
<span class="Identifier">track</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="Punctuation">(</span><span class="StringLit">"line 9"</span><span class="Punctuation">,</span> <span class="Identifier">false</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="StringLit">"line 13"</span><span class="Punctuation">,</span> <span class="Identifier">false</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Operator">...</span><span class="Punctuation">]</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">try</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">case</span> <span class="Identifier">x</span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">8</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">if</span> <span class="Identifier">y</span> <span class="Operator">></span> <span class="DecNumber">9</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">track</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">]</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Identifier">true</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"8.1"</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">track</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Identifier">true</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"8.2"</span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">9</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">track</span><span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">]</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Identifier">true</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"9"</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">track</span><span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Identifier">true</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"foo"</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"no exception"</span>
|
||||
<span class="Keyword">except</span> <span class="Identifier">IoError</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">track</span><span class="Punctuation">[</span><span class="DecNumber">4</span><span class="Punctuation">]</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Identifier">true</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"IoError"</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_8')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="code-coverage">Code coverage</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
</pre></td><td><pre id="listing_9" class="listing"><span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="DecNumber">8</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">listCoverage</span><span class="Punctuation">(</span><span class="Identifier">s</span><span class="Punctuation">:</span> <span class="Identifier">openArray</span><span class="Punctuation">[</span><span class="Punctuation">(</span><span class="Identifier">string</span><span class="Punctuation">,</span> <span class="Identifier">bool</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">for</span> <span class="Identifier">x</span> <span class="Keyword">in</span> <span class="Identifier">s</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">if</span> <span class="Keyword">not</span> <span class="Identifier">x</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"NOT COVERED "</span><span class="Punctuation">,</span> <span class="Identifier">x</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">]</span>
|
||||
|
||||
<span class="Identifier">listCoverage</span><span class="Punctuation">(</span><span class="Identifier">track</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_9')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="code-coverage">Code coverage</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
</pre></td><td><pre id="listing_10" class="listing"><span class="Keyword">import</span> <span class="Identifier">macros</span>
|
||||
|
||||
<span class="Keyword">macro</span> <span class="Identifier">cov</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">:</span> <span class="Identifier">untyped</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">untyped</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">n</span>
|
||||
<span class="Identifier">echo</span> <span class="Identifier">treeRepr</span> <span class="Identifier">n</span>
|
||||
|
||||
<span class="Identifier">cov</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">proc</span> <span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">try</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">case</span> <span class="Identifier">x</span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">8</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">if</span> <span class="Identifier">y</span> <span class="Operator">></span> <span class="DecNumber">9</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"8.1"</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"8.2"</span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">9</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"9"</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"foo"</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"no exception"</span>
|
||||
<span class="Keyword">except</span> <span class="Identifier">IoError</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"IoError"</span>
|
||||
|
||||
<span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="DecNumber">8</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="DecNumber">10</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_10')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="code-coverage">Code coverage</h1><pre>...
|
||||
TryStmt
|
||||
StmtList
|
||||
CaseStmt
|
||||
Ident !"x"
|
||||
OfBranch
|
||||
IntLit 8
|
||||
StmtList
|
||||
IfStmt
|
||||
ElifBranch
|
||||
Infix
|
||||
Ident !">"
|
||||
Ident !"y"
|
||||
IntLit 9
|
||||
StmtList [...]
|
||||
Else
|
||||
StmtList [...]
|
||||
OfBranch
|
||||
IntLit 9
|
||||
StmtList
|
||||
Command
|
||||
Ident !"echo"
|
||||
StrLit 9
|
||||
Else
|
||||
StmtList
|
||||
Command
|
||||
Ident !"echo"
|
||||
StrLit foo
|
||||
Command [...]
|
||||
ExceptBranch
|
||||
[...]</pre>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="code-coverage">Code coverage</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
</pre></td><td><pre id="listing_11" class="listing"><span class="Comment">## Code coverage macro</span>
|
||||
|
||||
<span class="Keyword">import</span> <span class="Identifier">macros</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">transform</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">,</span> <span class="Identifier">track</span><span class="Punctuation">,</span> <span class="Identifier">list</span><span class="Punctuation">:</span> <span class="Identifier">NimNode</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">NimNode</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">compileTime</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
|
||||
<span class="Operator">...</span>
|
||||
|
||||
<span class="Keyword">macro</span> <span class="Identifier">cov</span><span class="Punctuation">(</span><span class="Identifier">body</span><span class="Punctuation">:</span> <span class="Identifier">untyped</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">untyped</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">var</span> <span class="Identifier">list</span> <span class="Operator">=</span> <span class="Identifier">newNimNode</span><span class="Punctuation">(</span><span class="Identifier">nnkBracket</span><span class="Punctuation">)</span>
|
||||
<span class="Keyword">let</span> <span class="Identifier">track</span> <span class="Operator">=</span> <span class="Identifier">genSym</span><span class="Punctuation">(</span><span class="Identifier">nskVar</span><span class="Punctuation">,</span> <span class="StringLit">"track"</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">transform</span><span class="Punctuation">(</span><span class="Identifier">body</span><span class="Punctuation">,</span> <span class="Identifier">track</span><span class="Punctuation">,</span> <span class="Identifier">list</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">newStmtList</span><span class="Punctuation">(</span><span class="Identifier">newVarStmt</span><span class="Punctuation">(</span><span class="Identifier">track</span><span class="Punctuation">,</span> <span class="Identifier">list</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Identifier">result</span><span class="Punctuation">,</span>
|
||||
<span class="Identifier">newCall</span><span class="Punctuation">(</span><span class="RawData">bindSym"listCoverage"</span><span class="Punctuation">,</span> <span class="Identifier">track</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">echo</span> <span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">toStrLit</span>
|
||||
|
||||
|
||||
<span class="Identifier">cov</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">proc</span> <span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Operator">...</span>
|
||||
|
||||
<span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="DecNumber">8</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="DecNumber">10</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_11')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="macros">Macros</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
</pre></td><td><pre id="listing_12" class="listing"><span class="Keyword">proc</span> <span class="Identifier">transform</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">,</span> <span class="Identifier">track</span><span class="Punctuation">,</span> <span class="Identifier">list</span><span class="Punctuation">:</span> <span class="Identifier">NimNode</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">NimNode</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">compileTime</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
|
||||
<span class="Comment"># recurse:</span>
|
||||
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">copyNimNode</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">)</span>
|
||||
<span class="Keyword">for</span> <span class="Identifier">c</span> <span class="Keyword">in</span> <span class="Identifier">n</span><span class="Operator">.</span><span class="Identifier">children</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">transform</span><span class="Punctuation">(</span><span class="Identifier">track</span><span class="Punctuation">,</span> <span class="Identifier">list</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Keyword">if</span> <span class="Identifier">n</span><span class="Operator">.</span><span class="Identifier">kind</span> <span class="Keyword">in</span> <span class="Punctuation">{</span><span class="Identifier">nnkElifBranch</span><span class="Punctuation">,</span> <span class="Identifier">nnkOfBranch</span><span class="Punctuation">,</span> <span class="Identifier">nnkExceptBranch</span><span class="Punctuation">,</span> <span class="Identifier">nnkElse</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">let</span> <span class="Identifier">lineinfo</span> <span class="Operator">=</span> <span class="Identifier">result</span><span class="Punctuation">[</span><span class="Operator">^</span><span class="DecNumber">1</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">lineinfo</span>
|
||||
|
||||
<span class="Keyword">template</span> <span class="Identifier">trackStmt</span><span class="Punctuation">(</span><span class="Identifier">track</span><span class="Punctuation">,</span> <span class="Identifier">i</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">track</span><span class="Punctuation">[</span><span class="Identifier">i</span><span class="Punctuation">]</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Identifier">true</span>
|
||||
<span class="Identifier">result</span><span class="Punctuation">[</span><span class="Operator">^</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Identifier">newStmtList</span><span class="Punctuation">(</span><span class="Identifier">getAst</span> <span class="Identifier">trackStmt</span><span class="Punctuation">(</span><span class="Identifier">track</span><span class="Punctuation">,</span> <span class="Identifier">list</span><span class="Operator">.</span><span class="Identifier">len</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Identifier">result</span><span class="Punctuation">[</span><span class="Operator">^</span><span class="DecNumber">1</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Keyword">template</span> <span class="Identifier">tup</span><span class="Punctuation">(</span><span class="Identifier">lineinfo</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Punctuation">(</span><span class="Identifier">lineinfo</span><span class="Punctuation">,</span> <span class="Identifier">false</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">list</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="Identifier">getAst</span> <span class="Identifier">tup</span><span class="Punctuation">(</span><span class="Identifier">lineinfo</span><span class="Punctuation">)</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_12')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="macros">Macros</h1><p>Result:<pre>8.1
|
||||
no exception
|
||||
else
|
||||
no exception
|
||||
NOT COVERED coverage.nim(42,14)
|
||||
NOT COVERED coverage.nim(43,12)
|
||||
NOT COVERED coverage.nim(47,6)</pre>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="macros">Macros</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
</pre></td><td><pre id="listing_13" class="listing"><span class="Keyword">proc</span> <span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">try</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">case</span> <span class="Identifier">x</span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">8</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">if</span> <span class="Identifier">y</span> <span class="Operator">></span> <span class="DecNumber">9</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"8.1"</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span> <span style="background-color:#FF7700"><span class="Identifier">echo</span> <span class="StringLit">"8.2"</span></span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">9</span><span class="Punctuation">:</span> <span style="background-color:#FF7700"><span class="Identifier">echo</span> <span class="StringLit">"9"</span></span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">echo</span> <span class="StringLit">"else"</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"no exception"</span>
|
||||
<span class="Keyword">except</span> <span class="Identifier">IoError</span><span class="Punctuation">:</span>
|
||||
<span style="background-color:#FF7700"><span class="Identifier">echo</span> <span class="StringLit">"IoError"</span></span>
|
||||
|
||||
<span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="DecNumber">8</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="DecNumber">10</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_13')">Select</button>
|
||||
|
||||
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
378
2_meta.rst
Normal file
|
|
@ -0,0 +1,378 @@
|
|||
=================================================================
|
||||
Meta programming
|
||||
=================================================================
|
||||
|
||||
|
||||
Templates
|
||||
=========
|
||||
|
||||
* templates are declarative, macros imperative
|
||||
|
||||
.. code-block:: nim
|
||||
# from System.nim
|
||||
template `!=` (a, b: untyped): untyped =
|
||||
not (a == b)
|
||||
|
||||
assert(5 != 6) # rewritten to: assert(not (5 == 6))
|
||||
|
||||
* more transformations
|
||||
- ``a > b`` is rewritten to ``b < a``.
|
||||
- ``a in b`` is rewritten to ``contains(b, a)``.
|
||||
- ``a notin b`` is rewritten to ``not (a in b)``.
|
||||
- ``a isnot b`` is rewritten to ``not (a is b)``.
|
||||
|
||||
|
||||
Templates
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
template html(name, body) =
|
||||
proc name(): string =
|
||||
result = "<html>"
|
||||
body
|
||||
result.add("</html>")
|
||||
|
||||
html mainPage:
|
||||
echo "colon syntax to pass statements to template"
|
||||
|
||||
|
||||
|
||||
Templates
|
||||
=========
|
||||
|
||||
Templates already suffice to implement simple DSLs:
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
html mainPage:
|
||||
head:
|
||||
title "The Nim programming language"
|
||||
body:
|
||||
ul:
|
||||
li "efficient"
|
||||
li "expressive"
|
||||
li "elegant"
|
||||
|
||||
echo mainPage()
|
||||
|
||||
|
||||
Produces::
|
||||
|
||||
<html>
|
||||
<head><title>The Nim programming language</title></head>
|
||||
<body>
|
||||
<ul>
|
||||
<li>efficient</li>
|
||||
<li>expressive</li>
|
||||
<li>elegant</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Templates
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
template html(name, body) =
|
||||
proc name(): string =
|
||||
result = "<html>"
|
||||
body
|
||||
result.add("</html>")
|
||||
|
||||
template head(body) =
|
||||
result.add("<head>")
|
||||
body
|
||||
result.add("</head>")
|
||||
|
||||
...
|
||||
|
||||
template title(x) =
|
||||
result.add("<title>$1</title>" % x)
|
||||
|
||||
template li(x) =
|
||||
result.add("<li>$1</li>" % x)
|
||||
|
||||
|
||||
Templates
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
proc mainPage(): string =
|
||||
result = "<html>"
|
||||
result.add("<head>")
|
||||
result.add("<title>$1</title>" % "The Nim programming language")
|
||||
result.add("</head>")
|
||||
result.add("<body>")
|
||||
result.add("<ul>")
|
||||
result.add("<li>$1</li>" % "efficient")
|
||||
result.add("<li>$1</li>" % "expressive")
|
||||
result.add("<li>$1</li>" % "elegant")
|
||||
result.add("</ul>")
|
||||
result.add("</body>")
|
||||
result.add("</html>")
|
||||
|
||||
|
||||
Macros
|
||||
======
|
||||
|
||||
* imperative AST to AST transformations
|
||||
* Turing complete
|
||||
* ``macros`` module provides an API for dealing with Nim ASTs
|
||||
|
||||
|
||||
|
||||
Code coverage
|
||||
=============
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
proc toTest(x, y: int) =
|
||||
try:
|
||||
case x
|
||||
of 8:
|
||||
if y > 9: echo "8.1"
|
||||
else: echo "8.2"
|
||||
of 9: echo "9"
|
||||
else: echo "else"
|
||||
echo "no exception"
|
||||
except IoError:
|
||||
echo "IoError"
|
||||
|
||||
toTest(8, 10)
|
||||
toTest(10, 10)
|
||||
|
||||
|
||||
Code coverage
|
||||
=============
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
proc toTest(x, y: int) =
|
||||
try:
|
||||
case x
|
||||
of 8:
|
||||
if y > 9: echo "8.1"
|
||||
else: ***echo "8.2"***
|
||||
of 9: ***echo "9"***
|
||||
else: echo "else"
|
||||
echo "no exception"
|
||||
except IoError:
|
||||
***echo "IoError"***
|
||||
|
||||
toTest(8, 10)
|
||||
toTest(10, 10)
|
||||
|
||||
|
||||
|
||||
Code coverage
|
||||
=============
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
# This is the code our macro will produce!
|
||||
|
||||
var
|
||||
track = [("line 9", false), ("line 13", false), ...]
|
||||
|
||||
proc toTest(x, y: int) =
|
||||
try:
|
||||
case x
|
||||
of 8:
|
||||
if y > 9:
|
||||
track[0][1] = true
|
||||
echo "8.1"
|
||||
else:
|
||||
track[1][1] = true
|
||||
echo "8.2"
|
||||
of 9:
|
||||
track[2][1] = true
|
||||
echo "9"
|
||||
else:
|
||||
track[3][1] = true
|
||||
echo "foo"
|
||||
echo "no exception"
|
||||
except IoError:
|
||||
track[4][1] = true
|
||||
echo "IoError"
|
||||
|
||||
|
||||
Code coverage
|
||||
=============
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
toTest(8, 10)
|
||||
toTest(1, 2)
|
||||
|
||||
proc listCoverage(s: openArray[(string, bool)]) =
|
||||
for x in s:
|
||||
if not x[1]: echo "NOT COVERED ", x[0]
|
||||
|
||||
listCoverage(track)
|
||||
|
||||
|
||||
Code coverage
|
||||
=============
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
import macros
|
||||
|
||||
macro cov(n: untyped): untyped =
|
||||
result = n
|
||||
echo treeRepr n
|
||||
|
||||
cov:
|
||||
proc toTest(x, y: int) =
|
||||
try:
|
||||
case x
|
||||
of 8:
|
||||
if y > 9: echo "8.1"
|
||||
else: echo "8.2"
|
||||
of 9: echo "9"
|
||||
else: echo "foo"
|
||||
echo "no exception"
|
||||
except IoError:
|
||||
echo "IoError"
|
||||
|
||||
toTest(8, 10)
|
||||
toTest(10, 10)
|
||||
|
||||
|
||||
Code coverage
|
||||
=============
|
||||
|
||||
::
|
||||
...
|
||||
TryStmt
|
||||
StmtList
|
||||
CaseStmt
|
||||
Ident !"x"
|
||||
OfBranch
|
||||
IntLit 8
|
||||
StmtList
|
||||
IfStmt
|
||||
ElifBranch
|
||||
Infix
|
||||
Ident !">"
|
||||
Ident !"y"
|
||||
IntLit 9
|
||||
StmtList [...]
|
||||
Else
|
||||
StmtList [...]
|
||||
OfBranch
|
||||
IntLit 9
|
||||
StmtList
|
||||
Command
|
||||
Ident !"echo"
|
||||
StrLit 9
|
||||
Else
|
||||
StmtList
|
||||
Command
|
||||
Ident !"echo"
|
||||
StrLit foo
|
||||
Command [...]
|
||||
ExceptBranch
|
||||
[...]
|
||||
|
||||
|
||||
|
||||
Code coverage
|
||||
=============
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
## Code coverage macro
|
||||
|
||||
import macros
|
||||
|
||||
proc transform(n, track, list: NimNode): NimNode {.compileTime.} =
|
||||
...
|
||||
|
||||
macro cov(body: untyped): untyped =
|
||||
var list = newNimNode(nnkBracket)
|
||||
let track = genSym(nskVar, "track")
|
||||
result = transform(body, track, list)
|
||||
result = newStmtList(newVarStmt(track, list), result,
|
||||
newCall(bindSym"listCoverage", track))
|
||||
echo result.toStrLit
|
||||
|
||||
|
||||
cov:
|
||||
proc toTest(x, y: int) =
|
||||
...
|
||||
|
||||
toTest(8, 10)
|
||||
toTest(10, 10)
|
||||
|
||||
|
||||
Macros
|
||||
======
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
proc transform(n, track, list: NimNode): NimNode {.compileTime.} =
|
||||
# recurse:
|
||||
result = copyNimNode(n)
|
||||
for c in n.children:
|
||||
result.add c.transform(track, list)
|
||||
|
||||
if n.kind in {nnkElifBranch, nnkOfBranch, nnkExceptBranch, nnkElse}:
|
||||
let lineinfo = result[^1].lineinfo
|
||||
|
||||
template trackStmt(track, i) =
|
||||
track[i][1] = true
|
||||
result[^1] = newStmtList(getAst trackStmt(track, list.len), result[^1])
|
||||
|
||||
template tup(lineinfo) =
|
||||
(lineinfo, false)
|
||||
list.add(getAst tup(lineinfo))
|
||||
|
||||
|
||||
Macros
|
||||
======
|
||||
|
||||
Result::
|
||||
8.1
|
||||
no exception
|
||||
else
|
||||
no exception
|
||||
NOT COVERED coverage.nim(42,14)
|
||||
NOT COVERED coverage.nim(43,12)
|
||||
NOT COVERED coverage.nim(47,6)
|
||||
|
||||
|
||||
Macros
|
||||
======
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
proc toTest(x, y: int) =
|
||||
try:
|
||||
case x
|
||||
of 8:
|
||||
if y > 9: echo "8.1"
|
||||
else: ***echo "8.2"***
|
||||
of 9: ***echo "9"***
|
||||
else: echo "else"
|
||||
echo "no exception"
|
||||
except IoError:
|
||||
***echo "IoError"***
|
||||
|
||||
toTest(8, 10)
|
||||
toTest(10, 10)
|
||||
|
||||
|
||||
747
3_effects.html
Normal file
|
|
@ -0,0 +1,747 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Effect system</title>
|
||||
<meta name="copyright"
|
||||
content="Copyright © 2015 Andreas Rumpf" />
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="Slidy2/styles/slidy.css" />
|
||||
<script src="Slidy2/scripts/slidy.js"
|
||||
charset="utf-8" type="text/javascript"></script>
|
||||
<style type="text/css">
|
||||
|
||||
span.DecNumber {color: blue}
|
||||
span.BinNumber {color: blue}
|
||||
span.HexNumber {color: blue}
|
||||
span.OctNumber {color: blue}
|
||||
span.FloatNumber {color: blue}
|
||||
span.Identifier {color: black}
|
||||
span.Keyword {font-weight: bold}
|
||||
span.StringLit {color: blue}
|
||||
span.LongStringLit {color: blue}
|
||||
span.CharLit {color: blue}
|
||||
span.EscapeSequence {color: black}
|
||||
span.Operator {color: black}
|
||||
span.Punctation {color: black}
|
||||
span.Comment, span.LongComment {font-style:italic; color: green}
|
||||
span.RegularExpression {color: DarkViolet}
|
||||
span.TagStart {color: DarkViolet}
|
||||
span.TagEnd {color: DarkViolet}
|
||||
span.Key {color: blue}
|
||||
span.Value {color: black}
|
||||
span.RawData {color: blue}
|
||||
span.Assembler {color: blue}
|
||||
span.Preprocessor {color: DarkViolet}
|
||||
span.Directive {color: DarkViolet}
|
||||
span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference,
|
||||
span.Other {color: black}
|
||||
|
||||
div.navigation {
|
||||
-moz-border-radius: 5px 5px 5px 5px;
|
||||
float: left;
|
||||
width: 30%;
|
||||
margin: 0; padding: 0;
|
||||
border: 3px outset #7F7F7F;
|
||||
background-color: #7F7F7F;
|
||||
}
|
||||
|
||||
div.navigation ul {
|
||||
list-style-type: none;
|
||||
padding-left: 1em;
|
||||
}
|
||||
div.navigation ul li a, div.navigation ul li a:visited {
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
text-decoration: none;
|
||||
}
|
||||
div.navigation ul li a:hover {
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
color: gold;
|
||||
}
|
||||
|
||||
div.content {
|
||||
margin-left: 30%;
|
||||
padding: 0 1em;
|
||||
border-left: 4em;
|
||||
}
|
||||
|
||||
dl.item dd, dl.item dd p {
|
||||
margin-top:3px;
|
||||
}
|
||||
dl.item dd pre {
|
||||
margin-left: 15pt;
|
||||
border: 0px;
|
||||
}
|
||||
dl.item dt, dl.item dt pre {
|
||||
margin: 20pt 0 0 5pt;
|
||||
}
|
||||
|
||||
pre, span.tok {
|
||||
background-color: #F9F9F9;
|
||||
border-color: #C4C4C4;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 1px 2px;
|
||||
color: black;
|
||||
line-spacing: 110%;
|
||||
font-weight: normal;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
span.red {
|
||||
color: #A80000;
|
||||
}
|
||||
|
||||
hr {background-color:#9D9D9D; border:0 none; color:#9D9D9D; height:1px; width:100%;}
|
||||
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger@python.org
|
||||
:Date: Date: 2006-05-21 22:44:42 +0200 (Sun, 21 May 2006)
|
||||
:Revision: Revision: 4564
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th { border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first { margin-top: 0 ! important }
|
||||
.last, .with-subtitle { margin-bottom: 0 ! important }
|
||||
.hidden { display: none }
|
||||
a.toc-backref { text-decoration: none ; color: black }
|
||||
blockquote.epigraph { margin: 2em 5em ; }
|
||||
dl.docutils dd { margin-bottom: 0.5em }
|
||||
div.abstract { margin: 2em 5em }
|
||||
div.abstract p.topic-title { font-weight: bold ; text-align: center }
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ; border: medium outset ; padding: 1em }
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title { font-weight: bold ; font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title { color: red ; font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication { margin: 2em 5em ; text-align: center ; font-style: italic }
|
||||
div.dedication p.topic-title { font-weight: bold ; font-style: normal }
|
||||
div.figure { margin-left: 2em ; margin-right: 2em }
|
||||
div.footer, div.header { clear: both; font-size: smaller }
|
||||
div.line-block { display: block ; margin-top: 1em ; margin-bottom: 1em }
|
||||
div.line-block div.line-block { margin-top: 0 ; margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
div.sidebar { margin-left: 1em ; border: medium outset ;
|
||||
padding: 1em ; background-color: #ffffee ; /*width: 40% ;*/ float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric { font-family: sans-serif ; font-size: medium }
|
||||
div.system-messages { margin: 5em }
|
||||
div.system-messages h1 { color: red }
|
||||
div.system-message { border: medium outset ; padding: 1em }
|
||||
div.system-message p.system-message-title { color: red ; font-weight: bold }
|
||||
div.topic { margin: 2em;}
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
h1.title { text-align: center }
|
||||
h2.subtitle { text-align: center }
|
||||
/* hr.docutils { width: 75% } */
|
||||
img.align-left { clear: left }
|
||||
img.align-right { clear: right }
|
||||
ol.simple, ul.simple { margin-bottom: 1em }
|
||||
ol.arabic { list-style: decimal }
|
||||
ol.loweralpha { list-style: lower-alpha }
|
||||
ol.upperalpha { list-style: upper-alpha }
|
||||
ol.lowerroman { list-style: lower-roman }
|
||||
ol.upperroman { list-style: upper-roman }
|
||||
p.attribution { text-align: right ; margin-left: 50% }
|
||||
p.caption { font-style: italic }
|
||||
p.credits { font-style: italic ; font-size: smaller }
|
||||
p.label { white-space: nowrap }
|
||||
p.rubric { font-weight:bold;font-size:larger;color:maroon;text-align:center}
|
||||
p.sidebar-title {font-family: sans-serif ;font-weight: bold ;font-size: larger }
|
||||
p.sidebar-subtitle {font-family: sans-serif ; font-weight: bold }
|
||||
p.topic-title {
|
||||
font-weight: bold;
|
||||
background-color: #6D6D6D;
|
||||
border-bottom: 1px solid #000000;
|
||||
border-top: 1px solid black;
|
||||
color: white;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
pre.address { margin-bottom: 0;margin-top:0;font-family:serif;font-size:100% }
|
||||
pre.literal-block, pre.doctest-block {margin-left: 2em ;margin-right: 2em }
|
||||
span.classifier {font-family: sans-serif;font-style: oblique }
|
||||
span.classifier-delimiter {font-family: sans-serif;font-weight: bold }
|
||||
span.interpreted {font-family: sans-serif }
|
||||
span.option {white-space: nowrap }
|
||||
span.pre {white-space: pre }
|
||||
span.problematic {color: red }
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation { border-left: solid 1px gray; margin-left: 1px }
|
||||
table.docinfo {margin: 2em 4em }
|
||||
table.docutils {margin-top: 0.5em;margin-bottom: 0.5em; border: 0 solid #9d9d9d; border-collapse: collapse; }
|
||||
table.footnote {border-left: solid 1px black;margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {padding-left: 0.5em;padding-right: 0.5em;
|
||||
vertical-align: top;}
|
||||
|
||||
table.docutils td, table.docutils th { border-bottom:1px solid #9D9D9D; }
|
||||
/* color: #4d4d4d} */
|
||||
|
||||
/* table.docutils td:hover, table.docinfo td:hover {color: #000000} */
|
||||
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold;text-align: left;white-space: nowrap;padding-left: 0 }
|
||||
|
||||
table.docutils th
|
||||
{
|
||||
color: black;
|
||||
font-weight:normal;
|
||||
background-color: #E3E3E3;
|
||||
border-top: 1px solid #1d1d1d;
|
||||
border-bottom: 1px solid #1d1d1d;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {font-size: 100% }
|
||||
ul.auto-toc { list-style-type: none }
|
||||
/*a.reference { color: #E00000; font-weight:bold;}
|
||||
a.reference:hover {color: #E00000;background-color: #ffff00;display: margin;
|
||||
font-weight:bold;}*/
|
||||
|
||||
p.pic {
|
||||
width: 1040px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="Slidy2/styles/w3c-blue.css" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="background">
|
||||
<img id="head-icon" alt="Nimrod logo"
|
||||
src="logo2.png" />
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1 class="title">Effect system</h1>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="nosideeffect">NoSideEffect</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
</pre></td><td><pre id="listing_1" class="listing"><span class="Identifier">cov</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">proc</span> <span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">int</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">noSideEffect</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">case</span> <span class="Identifier">x</span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">8</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">if</span> <span class="Identifier">y</span> <span class="Operator">></span> <span class="DecNumber">9</span><span class="Punctuation">:</span> <span class="DecNumber">8</span><span class="Operator">+</span><span class="DecNumber">1</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="DecNumber">8</span><span class="Operator">+</span><span class="DecNumber">2</span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">9</span><span class="Punctuation">:</span> <span class="DecNumber">9</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="DecNumber">100</span>
|
||||
|
||||
<span class="Comment"># Error: 'toTest' can have side-effects</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_1')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="nosideeffect">NoSideEffect</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
</pre></td><td><pre id="listing_2" class="listing"><span class="Keyword">var</span>
|
||||
<span class="Identifier">track</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="Punctuation">(</span><span class="StringLit">"line 9"</span><span class="Punctuation">,</span> <span class="Identifier">false</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="StringLit">"line 13"</span><span class="Punctuation">,</span> <span class="Identifier">false</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Operator">...</span><span class="Punctuation">]</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">int</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">noSideEffect</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">case</span> <span class="Identifier">x</span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">8</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">if</span> <span class="Identifier">y</span> <span class="Operator">></span> <span class="DecNumber">9</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">track</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">]</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Identifier">true</span>
|
||||
<span class="Operator">...</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_2')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="nosideeffect">NoSideEffect</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
</pre></td><td><pre id="listing_3" class="listing"><span class="Keyword">var</span>
|
||||
<span class="Identifier">track</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="Punctuation">(</span><span class="StringLit">"line 9"</span><span class="Punctuation">,</span> <span class="Identifier">false</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="StringLit">"line 13"</span><span class="Punctuation">,</span> <span class="Identifier">false</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Operator">...</span><span class="Punctuation">]</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">setter</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">track</span><span class="Punctuation">[</span><span class="Identifier">x</span><span class="Punctuation">]</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="Identifier">true</span>
|
||||
|
||||
<span class="Keyword">type</span> <span class="Identifier">HideEffects</span> <span class="Operator">=</span> <span class="Keyword">proc</span> <span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">noSideEffect</span><span class="Punctuation">,</span> <span class="Identifier">raises</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Identifier">tags</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">toTest</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">int</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">case</span> <span class="Identifier">x</span>
|
||||
<span class="Keyword">of</span> <span class="DecNumber">8</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">if</span> <span class="Identifier">y</span> <span class="Operator">></span> <span class="DecNumber">9</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">cast</span><span class="Punctuation">[</span><span class="Identifier">HideEffects</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Identifier">setter</span><span class="Punctuation">)</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
|
||||
<span class="Operator">...</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_3')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="effect-system">Effect System</h1><ul class="simple"><li>tracks side effects</li>
|
||||
<li>tracks exceptions</li>
|
||||
<li>tracks "tags": ReadIOEffect, WriteIoEffect, TimeEffect, ReadDirEffect, <strong>ExecIOEffect</strong></li>
|
||||
<li>tracks locking levels; deadlock prevention at compile-time</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="exceptions">Exceptions</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
</pre></td><td><pre id="listing_4" class="listing"><span class="Keyword">import</span> <span class="Identifier">strutils</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">readFromFile</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">raises</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
|
||||
<span class="Comment"># read the first two lines of a text file that should contain numbers</span>
|
||||
<span class="Comment"># and tries to add them</span>
|
||||
<span class="Keyword">var</span>
|
||||
<span class="Identifier">f</span><span class="Punctuation">:</span> <span class="Identifier">File</span>
|
||||
<span class="Keyword">if</span> <span class="Identifier">open</span><span class="Punctuation">(</span><span class="Identifier">f</span><span class="Punctuation">,</span> <span class="StringLit">"numbers.txt"</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">try</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">readLine</span><span class="Punctuation">(</span><span class="Identifier">f</span><span class="Punctuation">)</span>
|
||||
<span class="Keyword">var</span> <span class="Identifier">b</span> <span class="Operator">=</span> <span class="Identifier">readLine</span><span class="Punctuation">(</span><span class="Identifier">f</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">echo</span><span class="Punctuation">(</span><span class="StringLit">"sum: "</span> <span class="Operator">&</span> <span class="Operator">$</span><span class="Punctuation">(</span><span class="Identifier">parseInt</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator">+</span> <span class="Identifier">parseInt</span><span class="Punctuation">(</span><span class="Identifier">b</span><span class="Punctuation">)</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
|
||||
<span class="Keyword">except</span> <span class="Identifier">OverflowError</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">echo</span><span class="Punctuation">(</span><span class="StringLit">"overflow!"</span><span class="Punctuation">)</span>
|
||||
<span class="Keyword">except</span> <span class="Identifier">ValueError</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">echo</span><span class="Punctuation">(</span><span class="StringLit">"could not convert string to integer"</span><span class="Punctuation">)</span>
|
||||
<span class="Keyword">except</span> <span class="Identifier">IOError</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">echo</span><span class="Punctuation">(</span><span class="StringLit">"IO error!"</span><span class="Punctuation">)</span>
|
||||
<span class="Keyword">except</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">echo</span><span class="Punctuation">(</span><span class="StringLit">"Unknown exception!"</span><span class="Punctuation">)</span>
|
||||
<span class="Keyword">finally</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">close</span><span class="Punctuation">(</span><span class="Identifier">f</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_4')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="tags">Tags</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
</pre></td><td><pre id="listing_5" class="listing"><span class="Keyword">type</span>
|
||||
<span class="Identifier">TagA</span> <span class="Operator">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootEffect</span>
|
||||
<span class="Identifier">TagB</span> <span class="Operator">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootEffect</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">a</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">tags</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">TagA</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span> <span class="Keyword">discard</span>
|
||||
<span class="Keyword">proc</span> <span class="Identifier">b</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">tags</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">TagB</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span> <span class="Keyword">discard</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">x</span><span class="Punctuation">(</span><span class="Identifier">input</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">tags</span><span class="Punctuation">:</span> <span class="Punctuation">[</span> <span class="Operator">?</span> <span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">if</span> <span class="Identifier">input</span> <span class="Operator"><</span> <span class="DecNumber">0</span><span class="Punctuation">:</span> <span class="Identifier">a</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">b</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_5')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="tags">Tags</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
</pre></td><td><pre id="listing_6" class="listing"><span class="Keyword">type</span>
|
||||
<span class="Identifier">TagA</span> <span class="Operator">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootEffect</span>
|
||||
<span class="Identifier">TagB</span> <span class="Operator">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootEffect</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">a</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">tags</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">TagA</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span> <span class="Keyword">discard</span>
|
||||
<span class="Keyword">proc</span> <span class="Identifier">b</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">tags</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">TagB</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span> <span class="Keyword">discard</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">x</span><span class="Punctuation">(</span><span class="Identifier">input</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">tags</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">TagA</span><span class="Punctuation">,</span> <span class="Identifier">TagB</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">if</span> <span class="Identifier">input</span> <span class="Operator"><</span> <span class="DecNumber">0</span><span class="Punctuation">:</span> <span class="Identifier">a</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">b</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_6')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="tags">Tags</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
</pre></td><td><pre id="listing_7" class="listing"><span class="Keyword">proc</span> <span class="Identifier">execProcesses</span><span class="Punctuation">(</span><span class="Identifier">commands</span><span class="Punctuation">:</span> <span class="Identifier">openArray</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span><span class="Punctuation">,</span>
|
||||
<span class="Identifier">beforeRunEvent</span><span class="Punctuation">:</span> <span class="Keyword">proc</span> <span class="Punctuation">(</span><span class="Identifier">command</span><span class="Punctuation">:</span> <span class="Identifier">string</span><span class="Punctuation">)</span> <span class="Operator">=</span> <span class="Keyword">nil</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">int</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">tags</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">ExecIOEffect</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
<span class="Comment">## executes the commands in parallel. The highest return value of</span>
|
||||
<span class="Comment">## all processes is returned. Runs `beforeRunEvent` before running each</span>
|
||||
<span class="Comment">## command.</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">echoCommand</span><span class="Punctuation">(</span><span class="Identifier">command</span><span class="Punctuation">:</span> <span class="Identifier">string</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">tags</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">WriteIOEffect</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">echo</span> <span class="Identifier">command</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">compose</span><span class="Operator">*</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">execProcesses</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="StringLit">"gcc -o foo foo.c"</span><span class="Punctuation">,</span>
|
||||
<span class="StringLit">"gcc -o bar bar.c"</span><span class="Punctuation">,</span>
|
||||
<span class="StringLit">"gcc -o baz baz.c"</span><span class="Punctuation">]</span><span class="Punctuation">,</span>
|
||||
<span class="Identifier">echoCommand</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_7')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="gc-safety">GC safety</h1><ul class="simple"><li>a <tt class="docutils literal"><span class="pre">spawn</span></tt>'ed proc must be <tt class="docutils literal"><span class="pre">gcsafe</span></tt></li>
|
||||
<li><tt class="docutils literal"><span class="pre">gcsafe</span></tt>: Does not access global variables containing GC'ed memory</li>
|
||||
<li><tt class="docutils literal"><span class="pre">noSideEffect</span></tt>: Does not access global variables</li>
|
||||
<li><tt class="docutils literal"><span class="pre">noSideEffect</span></tt> implies <tt class="docutils literal"><span class="pre">gcsafe</span></tt></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="gc-safety">GC safety</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
</pre></td><td><pre id="listing_8" class="listing"><span class="Keyword">import</span> <span class="Identifier">tables</span><span class="Punctuation">,</span> <span class="Identifier">strutils</span><span class="Punctuation">,</span> <span class="Identifier">threadpool</span>
|
||||
|
||||
<span class="Keyword">const</span>
|
||||
<span class="Identifier">files</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="StringLit">"data1.txt"</span><span class="Punctuation">,</span> <span class="StringLit">"data2.txt"</span><span class="Punctuation">,</span> <span class="StringLit">"data3.txt"</span><span class="Punctuation">,</span> <span class="StringLit">"data4.txt"</span><span class="Punctuation">]</span>
|
||||
|
||||
<span class="Keyword">var</span> <span class="Identifier">tab</span> <span class="Operator">=</span> <span class="Identifier">newCountTable</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">countWords</span><span class="Punctuation">(</span><span class="Identifier">filename</span><span class="Punctuation">:</span> <span class="Identifier">string</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Comment">## Counts all the words in the file.</span>
|
||||
<span class="Keyword">for</span> <span class="Identifier">word</span> <span class="Keyword">in</span> <span class="Identifier">readFile</span><span class="Punctuation">(</span><span class="Identifier">filename</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">split</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">tab</span><span class="Operator">.</span><span class="Identifier">inc</span> <span class="Identifier">word</span>
|
||||
|
||||
<span class="Keyword">for</span> <span class="Identifier">f</span> <span class="Keyword">in</span> <span class="Identifier">files</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">spawn</span> <span class="Identifier">countWords</span><span class="Punctuation">(</span><span class="Identifier">f</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">sync</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">tab</span><span class="Operator">.</span><span class="Identifier">sort</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">echo</span> <span class="Identifier">tab</span><span class="Operator">.</span><span class="Identifier">largest</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_8')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="gc-safety">GC safety</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
</pre></td><td><pre id="listing_9" class="listing"><span class="Keyword">import</span> <span class="Identifier">threadpool</span><span class="Punctuation">,</span> <span class="Identifier">tables</span><span class="Punctuation">,</span> <span class="Identifier">strutils</span>
|
||||
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">pragma</span> <span class="Identifier">isolated</span><span class="Punctuation">,</span> <span class="Identifier">threadvar</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
|
||||
<span class="Keyword">var</span> <span class="Identifier">tab</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">isolated</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span> <span class="Identifier">CountTable</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">rawPut</span><span class="Punctuation">(</span><span class="Identifier">key</span><span class="Punctuation">:</span> <span class="Identifier">string</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">inc</span><span class="Punctuation">(</span><span class="Identifier">tab</span><span class="Punctuation">,</span> <span class="Identifier">key</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">put</span><span class="Punctuation">(</span><span class="Identifier">key</span><span class="Punctuation">:</span> <span class="Identifier">string</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">pinnedSpawn</span> <span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="Identifier">rawPut</span><span class="Punctuation">(</span><span class="Identifier">key</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">rawGet</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">string</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">tab</span><span class="Operator">.</span><span class="Identifier">sort</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">tab</span><span class="Operator">.</span><span class="Identifier">largest</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">]</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">getMax</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">string</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">let</span> <span class="Identifier">flow</span> <span class="Operator">=</span> <span class="Identifier">pinnedSpawn</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="Identifier">rawGet</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Operator">^</span><span class="Identifier">flow</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">main</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">pinnedSpawn</span> <span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="Keyword">proc</span> <span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">=</span> <span class="Identifier">tab</span> <span class="Operator">=</span> <span class="Identifier">initCountTable</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
|
||||
<span class="Keyword">for</span> <span class="Identifier">x</span> <span class="Keyword">in</span> <span class="Identifier">split</span><span class="Punctuation">(</span><span class="Identifier">readFile</span><span class="Punctuation">(</span><span class="StringLit">"readme.txt"</span><span class="Punctuation">)</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">put</span> <span class="Identifier">x</span>
|
||||
<span class="Identifier">echo</span> <span class="Identifier">getMax</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_9')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="guards-and-locks">Guards and locks</h1><ul class="simple"><li>common low level concurrency mechanisms like locks, atomic instructions or condition variables are available</li>
|
||||
<li>guards fight data races</li>
|
||||
<li>locking levels fight deadlocks</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="data-race">Data race</h1><p>A data race occurs when:</p>
|
||||
<ul class="simple"><li>two or more threads access the same memory location concurrently</li>
|
||||
<li>at least one of the accesses is for writing</li>
|
||||
<li>the threads are not using any exclusive locks to control their accesses</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="guards-fight-data-races">Guards fight data races</h1><ul class="simple"><li>Object fields and global variables can be annotated via a <tt class="docutils literal"><span class="pre">guard</span></tt> pragma</li>
|
||||
<li>Access then has to be within a <tt class="docutils literal"><span class="pre">locks</span></tt> section:</li>
|
||||
</ul>
|
||||
<table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
</pre></td><td><pre id="listing_10" class="listing"><span class="Keyword">var</span> <span class="Identifier">glock</span><span class="Punctuation">:</span> <span class="Identifier">Lock</span>
|
||||
<span class="Keyword">var</span> <span class="Identifier">gdata</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">guard</span><span class="Punctuation">:</span> <span class="Identifier">glock</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span> <span class="Identifier">int</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">invalid</span> <span class="Operator">=</span>
|
||||
<span class="Comment"># invalid: unguarded access:</span>
|
||||
<span class="Identifier">echo</span> <span class="Identifier">gdata</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">valid</span> <span class="Operator">=</span>
|
||||
<span class="Comment"># valid access:</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">glock</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">echo</span> <span class="Identifier">gdata</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_10')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="guards-fight-data-races">Guards fight data races</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
</pre></td><td><pre id="listing_11" class="listing"><span class="Keyword">template</span> <span class="Identifier">lock</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">Lock</span><span class="Punctuation">;</span> <span class="Identifier">body</span><span class="Punctuation">:</span> <span class="Identifier">untyped</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">pthread_mutex_lock</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">a</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">try</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">body</span>
|
||||
<span class="Keyword">finally</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">pthread_mutex_unlock</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_11')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="guards-fight-data-races">Guards fight data races</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
</pre></td><td><pre id="listing_12" class="listing"><span class="Keyword">var</span> <span class="Identifier">dummyLock</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">compileTime</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span> <span class="Identifier">int</span>
|
||||
<span class="Keyword">var</span> <span class="Identifier">atomicCounter</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">guard</span><span class="Punctuation">:</span> <span class="Identifier">dummyLock</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span> <span class="Identifier">int</span>
|
||||
|
||||
<span class="Keyword">template</span> <span class="Identifier">atomicRead</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">expr</span> <span class="Operator">=</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">dummyLock</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">memoryReadBarrier</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">x</span>
|
||||
|
||||
<span class="Identifier">echo</span> <span class="Identifier">atomicRead</span><span class="Punctuation">(</span><span class="Identifier">atomicCounter</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_12')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="deadlocks">Deadlocks</h1><p>A deadlock occurs when:</p>
|
||||
<ul class="simple"><li>thread A acquires lock L1</li>
|
||||
<li>thread B acquires lock L2</li>
|
||||
<li>thread A tries to acquire lock L2</li>
|
||||
<li>thread B tries to acquire lock L1</li>
|
||||
</ul>
|
||||
<p>Solution?</p>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="deadlocks">Deadlocks</h1><p>A deadlock occurs when:</p>
|
||||
<ul class="simple"><li>thread A acquires lock L1</li>
|
||||
<li>thread B acquires lock L2</li>
|
||||
<li>thread A tries to acquire lock L2</li>
|
||||
<li>thread B tries to acquire lock L1</li>
|
||||
</ul>
|
||||
<p>Solution?</p>
|
||||
<ul class="simple"><li>enforce L1 is always acquired before L2</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="locking-levels-fight-deadlocks">Locking levels fight deadlocks</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
</pre></td><td><pre id="listing_13" class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">:</span> <span class="Identifier">Lock</span><span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">]</span>
|
||||
<span class="Keyword">var</span> <span class="Identifier">x</span><span class="Punctuation">:</span> <span class="Identifier">Lock</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span>
|
||||
<span class="Comment"># invalid locking order: Lock[1] cannot be acquired before Lock[2]:</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">x</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">a</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Operator">...</span>
|
||||
<span class="Comment"># valid locking order: Lock[2] acquired before Lock[1]:</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">a</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">x</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Operator">...</span>
|
||||
|
||||
<span class="Comment"># invalid locking order: Lock[2] acquired before Lock[2]:</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">a</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">b</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Operator">...</span>
|
||||
|
||||
<span class="Comment"># valid locking order, locks of the same level acquired at the same time:</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Operator">...</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_13')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="locking-levels-fight-deadlocks">Locking levels fight deadlocks</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
</pre></td><td><pre id="listing_14" class="listing"><span class="Keyword">template</span> <span class="Identifier">multilock</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">:</span> <span class="Keyword">ptr</span> <span class="Identifier">Lock</span><span class="Punctuation">;</span> <span class="Identifier">body</span><span class="Punctuation">:</span> <span class="Identifier">stmt</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">if</span> <span class="Keyword">cast</span><span class="Punctuation">[</span><span class="Identifier">ByteAddress</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator"><</span> <span class="Keyword">cast</span><span class="Punctuation">[</span><span class="Identifier">ByteAddress</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Identifier">b</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">pthread_mutex_lock</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">pthread_mutex_lock</span><span class="Punctuation">(</span><span class="Identifier">b</span><span class="Punctuation">)</span>
|
||||
<span class="Keyword">else</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">pthread_mutex_lock</span><span class="Punctuation">(</span><span class="Identifier">b</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">pthread_mutex_lock</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">try</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">body</span>
|
||||
<span class="Keyword">finally</span><span class="Punctuation">:</span>
|
||||
<span class="Identifier">pthread_mutex_unlock</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">pthread_mutex_unlock</span><span class="Punctuation">(</span><span class="Identifier">b</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_14')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="locking-levels-fight-deadlocks">Locking levels fight deadlocks</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
</pre></td><td><pre id="listing_15" class="listing"><span class="Keyword">proc</span> <span class="Identifier">p</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="FloatNumber">3.</span><span class="Punctuation">}</span> <span class="Operator">=</span> <span class="Keyword">discard</span>
|
||||
|
||||
<span class="Keyword">var</span> <span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">Lock</span><span class="Punctuation">[</span><span class="DecNumber">4</span><span class="Punctuation">]</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">locks</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">a</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span>
|
||||
<span class="Comment"># p's locklevel (3) is strictly less than a's (4) so the call is allowed:</span>
|
||||
<span class="Identifier">p</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_15')">Select</button>
|
||||
|
||||
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
415
3_effects.rst
Normal file
|
|
@ -0,0 +1,415 @@
|
|||
=============
|
||||
Effect system
|
||||
=============
|
||||
|
||||
|
||||
NoSideEffect
|
||||
============
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
cov:
|
||||
proc toTest(x, y: int): int {.noSideEffect.} =
|
||||
case x
|
||||
of 8:
|
||||
if y > 9: 8+1
|
||||
else: 8+2
|
||||
of 9: 9
|
||||
else: 100
|
||||
|
||||
# Error: 'toTest' can have side-effects
|
||||
|
||||
|
||||
|
||||
NoSideEffect
|
||||
============
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
var
|
||||
track = [("line 9", false), ("line 13", false), ...]
|
||||
|
||||
proc toTest(x, y: int): int {.noSideEffect.} =
|
||||
case x
|
||||
of 8:
|
||||
if y > 9:
|
||||
track[0][1] = true
|
||||
...
|
||||
|
||||
|
||||
|
||||
NoSideEffect
|
||||
============
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
var
|
||||
track = [("line 9", false), ("line 13", false), ...]
|
||||
|
||||
proc setter(x: int) =
|
||||
track[x][1] = true
|
||||
|
||||
type HideEffects = proc (x: int) {.noSideEffect, raises: [], tags: [].}
|
||||
|
||||
proc toTest(x, y: int): int =
|
||||
case x
|
||||
of 8:
|
||||
if y > 9:
|
||||
cast[HideEffects](setter)(0)
|
||||
...
|
||||
|
||||
|
||||
Effect System
|
||||
=============
|
||||
|
||||
- tracks side effects
|
||||
- tracks exceptions
|
||||
- tracks "tags": ReadIOEffect, WriteIoEffect, TimeEffect,
|
||||
ReadDirEffect, **ExecIOEffect**
|
||||
- tracks locking levels; deadlock prevention at compile-time
|
||||
|
||||
..
|
||||
Think of ``(T, E)`` as opposed to ``E[T]``.
|
||||
|
||||
|
||||
Exceptions
|
||||
==========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
import strutils
|
||||
|
||||
proc readFromFile() {.raises: [].} =
|
||||
# read the first two lines of a text file that should contain numbers
|
||||
# and tries to add them
|
||||
var
|
||||
f: File
|
||||
if open(f, "numbers.txt"):
|
||||
try:
|
||||
var a = readLine(f)
|
||||
var b = readLine(f)
|
||||
echo("sum: " & $(parseInt(a) + parseInt(b)))
|
||||
except OverflowError:
|
||||
echo("overflow!")
|
||||
except ValueError:
|
||||
echo("could not convert string to integer")
|
||||
except IOError:
|
||||
echo("IO error!")
|
||||
except:
|
||||
echo("Unknown exception!")
|
||||
finally:
|
||||
close(f)
|
||||
|
||||
..
|
||||
- describe inference algorithm
|
||||
|
||||
proc noRaise(x: proc()) {.raises: [].} =
|
||||
# unknown call that might raise anything, but valid:
|
||||
x()
|
||||
|
||||
proc doRaise() {.raises: [IOError].} =
|
||||
raise newException(IOError, "IO")
|
||||
|
||||
proc use() {.raises: [].} =
|
||||
# doesn't compile! Can raise IOError!
|
||||
noRaise(doRaise)
|
||||
|
||||
|
||||
Tags
|
||||
====
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
type
|
||||
TagA = object of RootEffect
|
||||
TagB = object of RootEffect
|
||||
|
||||
proc a() {.tags: [TagA].} = discard
|
||||
proc b() {.tags: [TagB].} = discard
|
||||
|
||||
proc x(input: int) {.tags: [ ? ].} =
|
||||
if input < 0: a()
|
||||
else: b()
|
||||
|
||||
..
|
||||
Just demonstrate 'doc2' here
|
||||
|
||||
|
||||
Tags
|
||||
====
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
type
|
||||
TagA = object of RootEffect
|
||||
TagB = object of RootEffect
|
||||
|
||||
proc a() {.tags: [TagA].} = discard
|
||||
proc b() {.tags: [TagB].} = discard
|
||||
|
||||
proc x(input: int) {.tags: [TagA, TagB].} =
|
||||
if input < 0: a()
|
||||
else: b()
|
||||
|
||||
|
||||
Tags
|
||||
====
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
proc execProcesses(commands: openArray[string],
|
||||
beforeRunEvent: proc (command: string) = nil): int
|
||||
{.tags: [ExecIOEffect].}
|
||||
## executes the commands in parallel. The highest return value of
|
||||
## all processes is returned. Runs `beforeRunEvent` before running each
|
||||
## command.
|
||||
|
||||
proc echoCommand(command: string) {.tags: [WriteIOEffect].} =
|
||||
echo command
|
||||
|
||||
proc compose*() =
|
||||
execProcesses(["gcc -o foo foo.c",
|
||||
"gcc -o bar bar.c",
|
||||
"gcc -o baz baz.c"],
|
||||
echoCommand)
|
||||
|
||||
|
||||
|
||||
GC safety
|
||||
=========
|
||||
|
||||
- a ``spawn``'ed proc must be ``gcsafe``
|
||||
- ``gcsafe``: Does not access global variables containing GC'ed memory
|
||||
- ``noSideEffect``: Does not access global variables
|
||||
- ``noSideEffect`` implies ``gcsafe``
|
||||
|
||||
|
||||
GC safety
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
import tables, strutils, threadpool
|
||||
|
||||
const
|
||||
files = ["data1.txt", "data2.txt", "data3.txt", "data4.txt"]
|
||||
|
||||
var tab = newCountTable[string]()
|
||||
|
||||
proc countWords(filename: string) =
|
||||
## Counts all the words in the file.
|
||||
for word in readFile(filename).split:
|
||||
tab.inc word
|
||||
|
||||
for f in files:
|
||||
spawn countWords(f)
|
||||
sync()
|
||||
tab.sort()
|
||||
echo tab.largest
|
||||
|
||||
|
||||
GC safety
|
||||
=========
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
import threadpool, tables, strutils
|
||||
|
||||
{.pragma isolated, threadvar.}
|
||||
|
||||
var tab {.isolated.}: CountTable[string]
|
||||
|
||||
proc rawPut(key: string) =
|
||||
inc(tab, key)
|
||||
|
||||
proc put(key: string) =
|
||||
pinnedSpawn 0, rawPut(key)
|
||||
|
||||
proc rawGet(): string =
|
||||
tab.sort()
|
||||
result = tab.largest()[0]
|
||||
|
||||
proc getMax(): string =
|
||||
let flow = pinnedSpawn(0, rawGet())
|
||||
result = ^flow
|
||||
|
||||
proc main =
|
||||
pinnedSpawn 0, (proc () = tab = initCountTable[string]())
|
||||
for x in split(readFile("readme.txt")):
|
||||
put x
|
||||
echo getMax()
|
||||
|
||||
main()
|
||||
|
||||
|
||||
|
||||
Guards and locks
|
||||
================
|
||||
|
||||
- common low level concurrency mechanisms like locks, atomic instructions or
|
||||
condition variables are available
|
||||
- guards fight data races
|
||||
- locking levels fight deadlocks
|
||||
|
||||
|
||||
Data race
|
||||
=========
|
||||
|
||||
A data race occurs when:
|
||||
|
||||
- two or more threads access the same memory location concurrently
|
||||
- at least one of the accesses is for writing
|
||||
- the threads are not using any exclusive locks to control their accesses
|
||||
|
||||
|
||||
Guards fight data races
|
||||
=======================
|
||||
|
||||
- Object fields and global variables can be annotated via a ``guard`` pragma
|
||||
- Access then has to be within a ``locks`` section:
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
var glock: Lock
|
||||
var gdata {.guard: glock.}: int
|
||||
|
||||
proc invalid =
|
||||
# invalid: unguarded access:
|
||||
echo gdata
|
||||
|
||||
proc valid =
|
||||
# valid access:
|
||||
{.locks: [glock].}:
|
||||
echo gdata
|
||||
|
||||
|
||||
Guards fight data races
|
||||
=======================
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
template lock(a: Lock; body: untyped) =
|
||||
pthread_mutex_lock(a)
|
||||
{.locks: [a].}:
|
||||
try:
|
||||
body
|
||||
finally:
|
||||
pthread_mutex_unlock(a)
|
||||
|
||||
|
||||
Guards fight data races
|
||||
=======================
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
var dummyLock {.compileTime.}: int
|
||||
var atomicCounter {.guard: dummyLock.}: int
|
||||
|
||||
template atomicRead(x): expr =
|
||||
{.locks: [dummyLock].}:
|
||||
memoryReadBarrier()
|
||||
x
|
||||
|
||||
echo atomicRead(atomicCounter)
|
||||
|
||||
|
||||
Deadlocks
|
||||
=========
|
||||
|
||||
A deadlock occurs when:
|
||||
|
||||
- thread A acquires lock L1
|
||||
- thread B acquires lock L2
|
||||
- thread A tries to acquire lock L2
|
||||
- thread B tries to acquire lock L1
|
||||
|
||||
Solution?
|
||||
|
||||
|
||||
Deadlocks
|
||||
=========
|
||||
|
||||
A deadlock occurs when:
|
||||
|
||||
- thread A acquires lock L1
|
||||
- thread B acquires lock L2
|
||||
- thread A tries to acquire lock L2
|
||||
- thread B tries to acquire lock L1
|
||||
|
||||
Solution?
|
||||
|
||||
- enforce L1 is always acquired before L2
|
||||
|
||||
|
||||
|
||||
Locking levels fight deadlocks
|
||||
==============================
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
var a, b: Lock[2]
|
||||
var x: Lock[1]
|
||||
# invalid locking order: Lock[1] cannot be acquired before Lock[2]:
|
||||
{.locks: [x].}:
|
||||
{.locks: [a].}:
|
||||
...
|
||||
# valid locking order: Lock[2] acquired before Lock[1]:
|
||||
{.locks: [a].}:
|
||||
{.locks: [x].}:
|
||||
...
|
||||
|
||||
# invalid locking order: Lock[2] acquired before Lock[2]:
|
||||
{.locks: [a].}:
|
||||
{.locks: [b].}:
|
||||
...
|
||||
|
||||
# valid locking order, locks of the same level acquired at the same time:
|
||||
{.locks: [a, b].}:
|
||||
...
|
||||
|
||||
|
||||
|
||||
Locking levels fight deadlocks
|
||||
==============================
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
template multilock(a, b: ptr Lock; body: stmt) =
|
||||
if cast[ByteAddress](a) < cast[ByteAddress](b):
|
||||
pthread_mutex_lock(a)
|
||||
pthread_mutex_lock(b)
|
||||
else:
|
||||
pthread_mutex_lock(b)
|
||||
pthread_mutex_lock(a)
|
||||
{.locks: [a, b].}:
|
||||
try:
|
||||
body
|
||||
finally:
|
||||
pthread_mutex_unlock(a)
|
||||
pthread_mutex_unlock(b)
|
||||
|
||||
|
||||
Locking levels fight deadlocks
|
||||
==============================
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
proc p() {.locks: 3.} = discard
|
||||
|
||||
var a: Lock[4]
|
||||
{.locks: [a].}:
|
||||
# p's locklevel (3) is strictly less than a's (4) so the call is allowed:
|
||||
p()
|
||||
576
4_cppinterop.html
Normal file
|
|
@ -0,0 +1,576 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Interfacing with C/C++</title>
|
||||
<meta name="copyright"
|
||||
content="Copyright © 2015 Andreas Rumpf" />
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="Slidy2/styles/slidy.css" />
|
||||
<script src="Slidy2/scripts/slidy.js"
|
||||
charset="utf-8" type="text/javascript"></script>
|
||||
<style type="text/css">
|
||||
|
||||
span.DecNumber {color: blue}
|
||||
span.BinNumber {color: blue}
|
||||
span.HexNumber {color: blue}
|
||||
span.OctNumber {color: blue}
|
||||
span.FloatNumber {color: blue}
|
||||
span.Identifier {color: black}
|
||||
span.Keyword {font-weight: bold}
|
||||
span.StringLit {color: blue}
|
||||
span.LongStringLit {color: blue}
|
||||
span.CharLit {color: blue}
|
||||
span.EscapeSequence {color: black}
|
||||
span.Operator {color: black}
|
||||
span.Punctation {color: black}
|
||||
span.Comment, span.LongComment {font-style:italic; color: green}
|
||||
span.RegularExpression {color: DarkViolet}
|
||||
span.TagStart {color: DarkViolet}
|
||||
span.TagEnd {color: DarkViolet}
|
||||
span.Key {color: blue}
|
||||
span.Value {color: black}
|
||||
span.RawData {color: blue}
|
||||
span.Assembler {color: blue}
|
||||
span.Preprocessor {color: DarkViolet}
|
||||
span.Directive {color: DarkViolet}
|
||||
span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference,
|
||||
span.Other {color: black}
|
||||
|
||||
div.navigation {
|
||||
-moz-border-radius: 5px 5px 5px 5px;
|
||||
float: left;
|
||||
width: 30%;
|
||||
margin: 0; padding: 0;
|
||||
border: 3px outset #7F7F7F;
|
||||
background-color: #7F7F7F;
|
||||
}
|
||||
|
||||
div.navigation ul {
|
||||
list-style-type: none;
|
||||
padding-left: 1em;
|
||||
}
|
||||
div.navigation ul li a, div.navigation ul li a:visited {
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
text-decoration: none;
|
||||
}
|
||||
div.navigation ul li a:hover {
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
color: gold;
|
||||
}
|
||||
|
||||
div.content {
|
||||
margin-left: 30%;
|
||||
padding: 0 1em;
|
||||
border-left: 4em;
|
||||
}
|
||||
|
||||
dl.item dd, dl.item dd p {
|
||||
margin-top:3px;
|
||||
}
|
||||
dl.item dd pre {
|
||||
margin-left: 15pt;
|
||||
border: 0px;
|
||||
}
|
||||
dl.item dt, dl.item dt pre {
|
||||
margin: 20pt 0 0 5pt;
|
||||
}
|
||||
|
||||
pre, span.tok {
|
||||
background-color: #F9F9F9;
|
||||
border-color: #C4C4C4;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 1px 2px;
|
||||
color: black;
|
||||
line-spacing: 110%;
|
||||
font-weight: normal;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
span.red {
|
||||
color: #A80000;
|
||||
}
|
||||
|
||||
hr {background-color:#9D9D9D; border:0 none; color:#9D9D9D; height:1px; width:100%;}
|
||||
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger@python.org
|
||||
:Date: Date: 2006-05-21 22:44:42 +0200 (Sun, 21 May 2006)
|
||||
:Revision: Revision: 4564
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th { border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first { margin-top: 0 ! important }
|
||||
.last, .with-subtitle { margin-bottom: 0 ! important }
|
||||
.hidden { display: none }
|
||||
a.toc-backref { text-decoration: none ; color: black }
|
||||
blockquote.epigraph { margin: 2em 5em ; }
|
||||
dl.docutils dd { margin-bottom: 0.5em }
|
||||
div.abstract { margin: 2em 5em }
|
||||
div.abstract p.topic-title { font-weight: bold ; text-align: center }
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ; border: medium outset ; padding: 1em }
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title { font-weight: bold ; font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title { color: red ; font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication { margin: 2em 5em ; text-align: center ; font-style: italic }
|
||||
div.dedication p.topic-title { font-weight: bold ; font-style: normal }
|
||||
div.figure { margin-left: 2em ; margin-right: 2em }
|
||||
div.footer, div.header { clear: both; font-size: smaller }
|
||||
div.line-block { display: block ; margin-top: 1em ; margin-bottom: 1em }
|
||||
div.line-block div.line-block { margin-top: 0 ; margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
div.sidebar { margin-left: 1em ; border: medium outset ;
|
||||
padding: 1em ; background-color: #ffffee ; /*width: 40% ;*/ float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric { font-family: sans-serif ; font-size: medium }
|
||||
div.system-messages { margin: 5em }
|
||||
div.system-messages h1 { color: red }
|
||||
div.system-message { border: medium outset ; padding: 1em }
|
||||
div.system-message p.system-message-title { color: red ; font-weight: bold }
|
||||
div.topic { margin: 2em;}
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
h1.title { text-align: center }
|
||||
h2.subtitle { text-align: center }
|
||||
/* hr.docutils { width: 75% } */
|
||||
img.align-left { clear: left }
|
||||
img.align-right { clear: right }
|
||||
ol.simple, ul.simple { margin-bottom: 1em }
|
||||
ol.arabic { list-style: decimal }
|
||||
ol.loweralpha { list-style: lower-alpha }
|
||||
ol.upperalpha { list-style: upper-alpha }
|
||||
ol.lowerroman { list-style: lower-roman }
|
||||
ol.upperroman { list-style: upper-roman }
|
||||
p.attribution { text-align: right ; margin-left: 50% }
|
||||
p.caption { font-style: italic }
|
||||
p.credits { font-style: italic ; font-size: smaller }
|
||||
p.label { white-space: nowrap }
|
||||
p.rubric { font-weight:bold;font-size:larger;color:maroon;text-align:center}
|
||||
p.sidebar-title {font-family: sans-serif ;font-weight: bold ;font-size: larger }
|
||||
p.sidebar-subtitle {font-family: sans-serif ; font-weight: bold }
|
||||
p.topic-title {
|
||||
font-weight: bold;
|
||||
background-color: #6D6D6D;
|
||||
border-bottom: 1px solid #000000;
|
||||
border-top: 1px solid black;
|
||||
color: white;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
pre.address { margin-bottom: 0;margin-top:0;font-family:serif;font-size:100% }
|
||||
pre.literal-block, pre.doctest-block {margin-left: 2em ;margin-right: 2em }
|
||||
span.classifier {font-family: sans-serif;font-style: oblique }
|
||||
span.classifier-delimiter {font-family: sans-serif;font-weight: bold }
|
||||
span.interpreted {font-family: sans-serif }
|
||||
span.option {white-space: nowrap }
|
||||
span.pre {white-space: pre }
|
||||
span.problematic {color: red }
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation { border-left: solid 1px gray; margin-left: 1px }
|
||||
table.docinfo {margin: 2em 4em }
|
||||
table.docutils {margin-top: 0.5em;margin-bottom: 0.5em; border: 0 solid #9d9d9d; border-collapse: collapse; }
|
||||
table.footnote {border-left: solid 1px black;margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {padding-left: 0.5em;padding-right: 0.5em;
|
||||
vertical-align: top;}
|
||||
|
||||
table.docutils td, table.docutils th { border-bottom:1px solid #9D9D9D; }
|
||||
/* color: #4d4d4d} */
|
||||
|
||||
/* table.docutils td:hover, table.docinfo td:hover {color: #000000} */
|
||||
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold;text-align: left;white-space: nowrap;padding-left: 0 }
|
||||
|
||||
table.docutils th
|
||||
{
|
||||
color: black;
|
||||
font-weight:normal;
|
||||
background-color: #E3E3E3;
|
||||
border-top: 1px solid #1d1d1d;
|
||||
border-bottom: 1px solid #1d1d1d;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {font-size: 100% }
|
||||
ul.auto-toc { list-style-type: none }
|
||||
/*a.reference { color: #E00000; font-weight:bold;}
|
||||
a.reference:hover {color: #E00000;background-color: #ffff00;display: margin;
|
||||
font-weight:bold;}*/
|
||||
|
||||
p.pic {
|
||||
width: 1040px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="Slidy2/styles/w3c-blue.css" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="background">
|
||||
<img id="head-icon" alt="Nimrod logo"
|
||||
src="logo2.png" />
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1 class="title">Interfacing with C/C++</h1>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="interfacing-with-c">Interfacing with C</h1><p>2 options</p>
|
||||
<ul class="simple"><li>via <tt class="docutils literal"><span class="pre">dynlib</span></tt></li>
|
||||
<li>via <tt class="docutils literal"><span class="pre">header</span></tt></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="dynlib-import">Dynlib import</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
</pre></td><td><pre id="listing_1" class="listing"><span class="Keyword">type</span>
|
||||
<span class="Identifier">GtkWidget</span> <span class="Operator">=</span> <span class="Keyword">object</span>
|
||||
<span class="Identifier">data</span><span class="Punctuation">:</span> <span class="Identifier">cint</span>
|
||||
<span class="Identifier">binary</span><span class="Punctuation">:</span> <span class="Identifier">cfloat</span>
|
||||
<span class="Identifier">compatible</span><span class="Punctuation">:</span> <span class="Identifier">char</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">gtk_image_new</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Keyword">ptr</span> <span class="Identifier">GtkWidget</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">cdecl</span><span class="Punctuation">,</span> <span class="Identifier">dynlib</span><span class="Punctuation">:</span> <span class="StringLit">"libgtk-x11-2.0.so"</span><span class="Punctuation">,</span> <span class="Identifier">importc</span><span class="Operator">.</span><span class="Punctuation">}</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_1')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="header-import">Header import</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
</pre></td><td><pre id="listing_2" class="listing"><span class="Keyword">type</span>
|
||||
<span class="Identifier">GtkWidget</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importc</span><span class="Punctuation">:</span> <span class="StringLit">"GtkWidget_t"</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"<gtk.h>"</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span> <span class="Keyword">object</span>
|
||||
<span class="Identifier">data</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importc</span><span class="Punctuation">:</span> <span class="StringLit">"Data"</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span> <span class="Identifier">cint</span>
|
||||
<span class="Identifier">binary</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importc</span><span class="Punctuation">:</span> <span class="StringLit">"Binary"</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span> <span class="Identifier">cfloat</span>
|
||||
<span class="Identifier">compatible</span><span class="Punctuation">:</span> <span class="Identifier">char</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">gtk_image_new</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Keyword">ptr</span> <span class="Identifier">GtkWidget</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">cdecl</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"<gtk.h>"</span><span class="Punctuation">,</span> <span class="Identifier">importc</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">passC</span><span class="Punctuation">:</span> <span class="Identifier">staticExec</span><span class="Punctuation">(</span><span class="StringLit">"pkg-config --cflags gtk"</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">passL</span><span class="Punctuation">:</span> <span class="Identifier">staticExec</span><span class="Punctuation">(</span><span class="StringLit">"pkg-config --libs gtk"</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Punctuation">}</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_2')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="header-import">Header import</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
</pre></td><td><pre id="listing_3" class="listing"><span class="Keyword">proc</span> <span class="Identifier">printf</span><span class="Punctuation">(</span><span class="Identifier">formatstr</span><span class="Punctuation">:</span> <span class="Identifier">cstring</span><span class="Punctuation">)</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"<stdio.h>"</span><span class="Punctuation">,</span> <span class="Identifier">importc</span><span class="Punctuation">:</span> <span class="StringLit">"printf"</span><span class="Punctuation">,</span> <span class="Identifier">varargs</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
|
||||
<span class="Identifier">printf</span><span class="Punctuation">(</span><span class="StringLit">"%s%s"</span><span class="Punctuation">,</span> <span class="StringLit">"Nim strings "</span><span class="Punctuation">,</span> <span class="StringLit">"converted to cstring for you"</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_3')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="data-exchange-with-c">Data exchange with C</h1><table border="1" class="docutils"><tr><th>C type</th><th>Nim type</th></tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">int</span></tt></td><td><tt class="docutils literal"><span class="pre">cint</span></tt></td></tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">unsigned long</span></tt></td><td><tt class="docutils literal"><span class="pre">culong</span></tt></td></tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">float</span></tt></td><td><tt class="docutils literal"><span class="pre">cfloat</span></tt></td></tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">int x[4]</span></tt></td><td><tt class="docutils literal"><span class="pre">array[4, cint]</span></tt></td></tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">int*</span></tt></td><td><tt class="docutils literal"><span class="pre">ptr int</span></tt></td></tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">char*</span></tt></td><td><tt class="docutils literal"><span class="pre">cstring</span></tt></td></tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">char**</span></tt></td><td><tt class="docutils literal"><span class="pre">cstringArray = ptr array [0..ArrayDummySize, cstring]</span></tt></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="data-exchange-with-c">Data exchange with C</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
</pre></td><td><pre id="listing_4" class="listing"><span class="Keyword">int</span> <span class="Identifier">sum</span><span class="Punctuation">(</span><span class="Keyword">int</span><span class="Operator">*</span> <span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">size_t</span> <span class="Identifier">len</span><span class="Punctuation">)</span> <span class="Punctuation">{</span>
|
||||
<span class="Keyword">int</span> <span class="Identifier">result</span> <span class="Operator">=</span> <span class="DecNumber">0</span><span class="Punctuation">;</span>
|
||||
<span class="Keyword">for</span> <span class="Punctuation">(</span><span class="Identifier">size_t</span> <span class="Identifier">i</span> <span class="Operator">=</span> <span class="DecNumber">0</span><span class="Punctuation">;</span> <span class="Identifier">i</span> <span class="Operator"><</span> <span class="Identifier">len</span><span class="Punctuation">;</span> <span class="Identifier">i</span><span class="Operator">++</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span> <span class="Operator">+=</span> <span class="Identifier">x</span><span class="Punctuation">[</span><span class="Identifier">i</span><span class="Punctuation">]</span><span class="Punctuation">;</span>
|
||||
<span class="Keyword">return</span> <span class="Identifier">result</span><span class="Punctuation">;</span>
|
||||
<span class="Punctuation">}</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_4')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="data-exchange-with-c">Data exchange with C</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
</pre></td><td><pre id="listing_5" class="listing"><span class="Keyword">int</span> <span class="Identifier">sum</span><span class="Punctuation">(</span><span class="Keyword">int</span><span class="Operator">*</span> <span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">size_t</span> <span class="Identifier">len</span><span class="Punctuation">)</span> <span class="Punctuation">{</span>
|
||||
<span class="Keyword">int</span> <span class="Identifier">result</span> <span class="Operator">=</span> <span class="DecNumber">0</span><span class="Punctuation">;</span>
|
||||
<span class="Keyword">for</span> <span class="Punctuation">(</span><span class="Identifier">size_t</span> <span class="Identifier">i</span> <span class="Operator">=</span> <span class="DecNumber">0</span><span class="Punctuation">;</span> <span class="Identifier">i</span> <span class="Operator"><</span> <span class="Identifier">len</span><span class="Punctuation">;</span> <span class="Identifier">i</span><span class="Operator">++</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">result</span> <span class="Operator">+=</span> <span class="Identifier">x</span><span class="Punctuation">[</span><span class="Identifier">i</span><span class="Punctuation">]</span><span class="Punctuation">;</span>
|
||||
<span class="Keyword">return</span> <span class="Identifier">result</span><span class="Punctuation">;</span>
|
||||
<span class="Punctuation">}</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_5')">Select</button><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
</pre></td><td><pre id="listing_6" class="listing"><span class="Keyword">proc</span> <span class="Identifier">sum</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">:</span> <span class="Keyword">ptr</span> <span class="Identifier">cint</span><span class="Punctuation">;</span> <span class="Identifier">len</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">cint</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importc</span><span class="Punctuation">:</span> <span class="StringLit">"sum"</span><span class="Punctuation">,</span> <span class="Identifier">cdecl</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"foo.h"</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">callSum</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">var</span> <span class="Identifier">x</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="FloatNumber">1.</span><span class="Identifier">cint</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span>
|
||||
<span class="Identifier">echo</span> <span class="Identifier">sum</span><span class="Punctuation">(</span><span class="Keyword">addr</span> <span class="Identifier">x</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">len</span><span class="Punctuation">)</span>
|
||||
|
||||
<span class="Keyword">var</span> <span class="Identifier">y</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="FloatNumber">1.</span><span class="Identifier">cint</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span>
|
||||
<span class="Identifier">echo</span> <span class="Identifier">sum</span><span class="Punctuation">(</span><span class="Keyword">addr</span> <span class="Identifier">y</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Operator">.</span><span class="Identifier">len</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_6')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="codegendecl-pragma">CodegenDecl pragma</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
</pre></td><td><pre id="listing_7" class="listing"><span class="Keyword">var</span>
|
||||
<span class="Identifier">a</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">codegenDecl</span><span class="Punctuation">:</span> <span class="StringLit">"$# progmem $#"</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span> <span class="Identifier">int</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">myinterrupt</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">codegenDecl</span><span class="Punctuation">:</span> <span class="StringLit">"__interrupt $# $#$#"</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
|
||||
<span class="Identifier">echo</span> <span class="StringLit">"realistic interrupt handler"</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_7')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="wrapping-c">Wrapping C++</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
</pre></td><td><pre id="listing_8" class="listing"><span class="Keyword">class</span> <span class="Identifier">Foo</span> <span class="Punctuation">{</span>
|
||||
<span class="Keyword">public</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">int</span> <span class="Identifier">value</span><span class="Punctuation">;</span>
|
||||
<span class="Keyword">int</span> <span class="Identifier">GetValue</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span> <span class="Keyword">return</span> <span class="Identifier">value</span><span class="Punctuation">;</span> <span class="Punctuation">}</span>
|
||||
<span class="Keyword">int</span><span class="Operator">&</span> <span class="Identifier">SetValue</span><span class="Punctuation">(</span><span class="Keyword">int</span> <span class="Identifier">x</span><span class="Punctuation">)</span> <span class="Punctuation">{</span> <span class="Identifier">field</span> <span class="Operator">=</span> <span class="Identifier">x</span><span class="Punctuation">;</span> <span class="Keyword">return</span> <span class="Operator">&</span><span class="Identifier">field</span><span class="Punctuation">;</span> <span class="Punctuation">}</span>
|
||||
<span class="Punctuation">}</span><span class="Punctuation">;</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_8')">Select</button><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
</pre></td><td><pre id="listing_9" class="listing"><span class="Keyword">type</span>
|
||||
<span class="Identifier">Foo</span><span class="Operator">*</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"Foo"</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"file.h"</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span> <span class="Keyword">object</span>
|
||||
<span class="Identifier">value</span><span class="Operator">*:</span> <span class="Identifier">cint</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">getValue</span><span class="Operator">*</span><span class="Punctuation">(</span><span class="Identifier">this</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">Foo</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">cint</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"GetValue"</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"file.h"</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
<span class="Keyword">proc</span> <span class="Identifier">setValue</span><span class="Operator">*</span><span class="Punctuation">(</span><span class="Identifier">this</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">Foo</span><span class="Punctuation">;</span> <span class="Identifier">x</span><span class="Punctuation">:</span> <span class="Identifier">cint</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">cint</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"SetValue"</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"file.h"</span><span class="Operator">.</span><span class="Punctuation">}</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_9')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="wrapping-c">Wrapping C++</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
</pre></td><td><pre id="listing_10" class="listing"><span class="Keyword">class</span> <span class="Identifier">Foo</span> <span class="Punctuation">{</span>
|
||||
<span class="Keyword">public</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">int</span> <span class="Identifier">value</span><span class="Punctuation">;</span>
|
||||
<span class="Keyword">int</span> <span class="Identifier">GetValue</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span> <span class="Keyword">return</span> <span class="Identifier">value</span><span class="Punctuation">;</span> <span class="Punctuation">}</span>
|
||||
<span class="Keyword">int</span><span class="Operator">&</span> <span class="Identifier">SetValue</span><span class="Punctuation">(</span><span class="Keyword">int</span> <span class="Identifier">x</span><span class="Punctuation">)</span> <span class="Punctuation">{</span> <span class="Identifier">field</span> <span class="Operator">=</span> <span class="Identifier">x</span><span class="Punctuation">;</span> <span class="Keyword">return</span> <span class="Operator">&</span><span class="Identifier">field</span><span class="Punctuation">;</span> <span class="Punctuation">}</span>
|
||||
<span class="Punctuation">}</span><span class="Punctuation">;</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_10')">Select</button><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
</pre></td><td><pre id="listing_11" class="listing"><span class="Keyword">type</span>
|
||||
<span class="Identifier">Foo</span><span class="Operator">*</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"Foo"</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"file.h"</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span> <span class="Keyword">object</span>
|
||||
<span class="Identifier">value</span><span class="Operator">*:</span> <span class="Identifier">cint</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">getValue</span><span class="Operator">*</span><span class="Punctuation">(</span><span class="Identifier">this</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">Foo</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">cint</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"#.GetValue(@)"</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"file.h"</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
<span class="Keyword">proc</span> <span class="Identifier">setValue</span><span class="Operator">*</span><span class="Punctuation">(</span><span class="Identifier">this</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">Foo</span><span class="Punctuation">;</span> <span class="Identifier">x</span><span class="Punctuation">:</span> <span class="Identifier">cint</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">cint</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"#.SetValue(@)"</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"file.h"</span><span class="Operator">.</span><span class="Punctuation">}</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_11')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="constructors">Constructors</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
</pre></td><td><pre id="listing_12" class="listing"><span class="Keyword">class</span> <span class="Identifier">Foo</span> <span class="Punctuation">{</span>
|
||||
<span class="Keyword">public</span><span class="Punctuation">:</span>
|
||||
<span class="Keyword">int</span> <span class="Identifier">value</span><span class="Punctuation">;</span>
|
||||
<span class="Keyword">int</span> <span class="Identifier">GetValue</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span> <span class="Keyword">return</span> <span class="Identifier">value</span><span class="Punctuation">;</span> <span class="Punctuation">}</span>
|
||||
<span class="Keyword">int</span><span class="Operator">&</span> <span class="Identifier">SetValue</span><span class="Punctuation">(</span><span class="Keyword">int</span> <span class="Identifier">x</span><span class="Punctuation">)</span> <span class="Punctuation">{</span> <span class="Identifier">field</span> <span class="Operator">=</span> <span class="Identifier">x</span><span class="Punctuation">;</span> <span class="Keyword">return</span> <span class="Operator">&</span><span class="Identifier">field</span><span class="Punctuation">;</span> <span class="Punctuation">}</span>
|
||||
|
||||
<span class="Identifier">Foo</span><span class="Punctuation">(</span><span class="Keyword">int</span> <span class="Identifier">x</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">field</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Punctuation">}</span>
|
||||
<span class="Punctuation">}</span><span class="Punctuation">;</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_12')">Select</button><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
</pre></td><td><pre id="listing_13" class="listing"><span class="Keyword">type</span>
|
||||
<span class="Identifier">Foo</span><span class="Operator">*</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"Foo"</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"file.h"</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span> <span class="Keyword">object</span>
|
||||
<span class="Identifier">value</span><span class="Operator">*:</span> <span class="Identifier">cint</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">getValue</span><span class="Operator">*</span><span class="Punctuation">(</span><span class="Identifier">this</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">Foo</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">cint</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"#.GetValue(@)"</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"file.h"</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
<span class="Keyword">proc</span> <span class="Identifier">setValue</span><span class="Operator">*</span><span class="Punctuation">(</span><span class="Identifier">this</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">Foo</span><span class="Punctuation">;</span> <span class="Identifier">x</span><span class="Punctuation">:</span> <span class="Identifier">cint</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">cint</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"#.SetValue(@)"</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"file.h"</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">constructFoo</span><span class="Operator">*</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">:</span> <span class="Identifier">cint</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">Foo</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"Foo(@)"</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"file.h"</span><span class="Operator">.</span><span class="Punctuation">}</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_13')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="constructors">Constructors</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
</pre></td><td><pre id="listing_14" class="listing"><span class="Identifier">Foo</span> <span class="Identifier">foo</span> <span class="Operator">=</span> <span class="Identifier">Foo</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Punctuation">;</span>
|
||||
|
||||
<span class="Keyword">auto</span> <span class="Identifier">foo</span> <span class="Operator">=</span> <span class="Identifier">Foo</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Punctuation">;</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_14')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="constructors">Constructors</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
</pre></td><td><pre id="listing_15" class="listing"><span class="Identifier">Foo</span> <span class="Identifier">foo</span> <span class="Operator">=</span> <span class="Identifier">Foo</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Punctuation">;</span>
|
||||
<span class="Comment">// Calls copy constructor!</span>
|
||||
<span class="Keyword">auto</span> <span class="Identifier">foo</span> <span class="Operator">=</span> <span class="Identifier">Foo</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Punctuation">;</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_15')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="constructors">Constructors</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
</pre></td><td><pre id="listing_16" class="listing"><span class="Identifier">Foo</span> <span class="Identifier">foo</span> <span class="Operator">=</span> <span class="Identifier">Foo</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Punctuation">;</span>
|
||||
<span class="Comment">// Calls copy constructor!</span>
|
||||
<span class="Keyword">auto</span> <span class="Identifier">foo</span> <span class="Operator">=</span> <span class="Identifier">Foo</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Punctuation">;</span>
|
||||
|
||||
<span class="Identifier">Foo</span> <span class="Identifier">foo</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Punctuation">;</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_16')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="constructors">Constructors</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
</pre></td><td><pre id="listing_17" class="listing"><span class="Keyword">proc</span> <span class="Identifier">constructFoo</span><span class="Operator">*</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">:</span> <span class="Identifier">cint</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">Foo</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"Foo(@)"</span><span class="Punctuation">,</span> <span class="Identifier">header</span><span class="Punctuation">:</span> <span class="StringLit">"file.h"</span><span class="Punctuation">,</span> <span class="Identifier">constructor</span><span class="Operator">.</span><span class="Punctuation">}</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_17')">Select</button><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
</pre></td><td><pre id="listing_18" class="listing"><span class="Keyword">proc</span> <span class="Identifier">newFoo</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">:</span> <span class="Identifier">cint</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Keyword">ptr</span> <span class="Identifier">Foo</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"new Foo(@)"</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
|
||||
<span class="Keyword">let</span> <span class="Identifier">x</span> <span class="Operator">=</span> <span class="Identifier">newFoo</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">)</span>
|
||||
|
||||
|
||||
<span class="Keyword">proc</span> <span class="Identifier">cnew</span><span class="Operator">*</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">:</span> <span class="Identifier">T</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Keyword">ptr</span> <span class="Identifier">T</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"(new '*0#@)"</span><span class="Punctuation">,</span> <span class="Identifier">nodecl</span><span class="Operator">.</span><span class="Punctuation">}</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_18')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="generics">Generics</h1><p>For example:</p>
|
||||
<table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
</pre></td><td><pre id="listing_19" class="listing"><span class="Keyword">type</span> <span class="Identifier">Input</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"System::Input"</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span> <span class="Keyword">object</span>
|
||||
<span class="Keyword">proc</span> <span class="Identifier">getSubsystem</span><span class="Operator">*</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Keyword">ptr</span> <span class="Identifier">T</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importcpp</span><span class="Punctuation">:</span> <span class="StringLit">"SystemManager::getSubsystem<'*0>()"</span><span class="Punctuation">,</span> <span class="Identifier">nodecl</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
|
||||
<span class="Keyword">let</span> <span class="Identifier">x</span><span class="Punctuation">:</span> <span class="Keyword">ptr</span> <span class="Identifier">Input</span> <span class="Operator">=</span> <span class="Identifier">getSubsystem</span><span class="Punctuation">[</span><span class="Identifier">Input</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_19')">Select</button><p>Produces:</p>
|
||||
<table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
</pre></td><td><pre id="listing_20" class="listing"><span class="Identifier">x</span> <span class="Operator">=</span> <span class="Identifier">SystemManager</span><span class="Punctuation">:</span><span class="Punctuation">:</span><span class="Identifier">getSubsystem</span><span class="Operator"><</span><span class="Identifier">System</span><span class="Punctuation">:</span><span class="Punctuation">:</span><span class="Identifier">Input</span><span class="Operator">></span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_20')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="emit-pragma">Emit pragma</h1><table class="line-nums-table"><tbody><tr><td class="blob-line-nums"><pre class="line-nums">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
</pre></td><td><pre id="listing_21" class="listing"><span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">emit</span><span class="Punctuation">:</span> <span class="LongStringLit">"""
|
||||
static int cvariable = 420;
|
||||
"""</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">push</span> <span class="Identifier">stackTrace</span><span class="Punctuation">:</span><span class="Identifier">off</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
<span class="Keyword">proc</span> <span class="Identifier">embedsC</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">=</span>
|
||||
<span class="Keyword">var</span> <span class="Identifier">nimVar</span> <span class="Operator">=</span> <span class="DecNumber">89</span>
|
||||
<span class="Comment"># use backticks to access Nim symbols within an emit section:</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">emit</span><span class="Punctuation">:</span> <span class="LongStringLit">"""fprintf(stdout, "%d\n", cvariable + (int)`nimVar`);"""</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
<span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">pop</span><span class="Operator">.</span><span class="Punctuation">}</span>
|
||||
|
||||
<span class="Identifier">embedsC</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre></td></tr></tbody></table><button onclick="copyToClipboard('listing_21')">Select</button>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="questions">Questions?</h1>
|
||||
|
||||
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
340
4_cppinterop.rst
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
======================
|
||||
Interfacing with C/C++
|
||||
======================
|
||||
|
||||
|
||||
Interfacing with C
|
||||
==================
|
||||
|
||||
2 options
|
||||
|
||||
- via ``dynlib``
|
||||
- via ``header``
|
||||
|
||||
|
||||
Dynlib import
|
||||
=============
|
||||
|
||||
.. code-block:: Nim
|
||||
:number-lines:
|
||||
type
|
||||
GtkWidget = object
|
||||
data: cint
|
||||
binary: cfloat
|
||||
compatible: char
|
||||
|
||||
proc gtk_image_new(): ptr GtkWidget
|
||||
{.cdecl, dynlib: "libgtk-x11-2.0.so", importc.}
|
||||
|
||||
|
||||
|
||||
Header import
|
||||
=============
|
||||
|
||||
.. code-block::
|
||||
:number-lines:
|
||||
|
||||
type
|
||||
GtkWidget {.importc: "GtkWidget_t", header: "<gtk.h>".} = object
|
||||
data {.importc: "Data".}: cint
|
||||
binary {.importc: "Binary".}: cfloat
|
||||
compatible: char
|
||||
|
||||
proc gtk_image_new(): ptr GtkWidget
|
||||
{.cdecl, header: "<gtk.h>", importc.}
|
||||
|
||||
{.passC: staticExec("pkg-config --cflags gtk").}
|
||||
{.passL: staticExec("pkg-config --libs gtk").}
|
||||
|
||||
|
||||
|
||||
Header import
|
||||
=============
|
||||
|
||||
.. code-block::
|
||||
:number-lines:
|
||||
|
||||
proc printf(formatstr: cstring)
|
||||
{.header: "<stdio.h>", importc: "printf", varargs.}
|
||||
|
||||
printf("%s%s", "Nim strings ", "converted to cstring for you")
|
||||
|
||||
|
||||
Data exchange with C
|
||||
====================
|
||||
|
||||
================= ==========================================================
|
||||
C type Nim type
|
||||
================= ==========================================================
|
||||
``int`` ``cint``
|
||||
``unsigned long`` ``culong``
|
||||
``float`` ``cfloat``
|
||||
``int x[4]`` ``array[4, cint]``
|
||||
``int*`` ``ptr int``
|
||||
``char*`` ``cstring``
|
||||
``char**`` ``cstringArray = ptr array [0..ArrayDummySize, cstring]``
|
||||
================= ==========================================================
|
||||
|
||||
|
||||
Data exchange with C
|
||||
====================
|
||||
|
||||
.. code-block:: C
|
||||
:number-lines:
|
||||
|
||||
int sum(int* x, size_t len) {
|
||||
int result = 0;
|
||||
for (size_t i = 0; i < len; i++)
|
||||
result += x[i];
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Data exchange with C
|
||||
====================
|
||||
|
||||
.. code-block:: C
|
||||
:number-lines:
|
||||
|
||||
int sum(int* x, size_t len) {
|
||||
int result = 0;
|
||||
for (size_t i = 0; i < len; i++)
|
||||
result += x[i];
|
||||
return result;
|
||||
}
|
||||
|
||||
.. code-block:: Nim
|
||||
:number-lines:
|
||||
|
||||
proc sum(x: ptr cint; len: int): cint
|
||||
{.importc: "sum", cdecl, header: "foo.h".}
|
||||
|
||||
proc callSum =
|
||||
var x = @[1.cint, 2, 3, 4]
|
||||
echo sum(addr x[0], x.len)
|
||||
|
||||
var y = [1.cint, 2, 3, 4]
|
||||
echo sum(addr y[0], y.len)
|
||||
|
||||
|
||||
|
||||
CodegenDecl pragma
|
||||
==================
|
||||
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
var
|
||||
a {.codegenDecl: "$# progmem $#".}: int
|
||||
|
||||
proc myinterrupt() {.codegenDecl: "__interrupt $# $#$#".} =
|
||||
echo "realistic interrupt handler"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Wrapping C++
|
||||
============
|
||||
|
||||
.. code-block:: C++
|
||||
:number-lines:
|
||||
|
||||
class Foo {
|
||||
public:
|
||||
int value;
|
||||
int GetValue() { return value; }
|
||||
int& SetValue(int x) { field = x; return &field; }
|
||||
};
|
||||
|
||||
.. code-block:: Nim
|
||||
:number-lines:
|
||||
|
||||
type
|
||||
Foo* {.importcpp: "Foo", header: "file.h".} = object
|
||||
value*: cint
|
||||
|
||||
proc getValue*(this: var Foo): cint
|
||||
{.importcpp: "GetValue", header: "file.h".}
|
||||
proc setValue*(this: var Foo; x: cint): var cint
|
||||
{.importcpp: "SetValue", header: "file.h".}
|
||||
|
||||
|
||||
Wrapping C++
|
||||
============
|
||||
|
||||
.. code-block:: C++
|
||||
:number-lines:
|
||||
|
||||
class Foo {
|
||||
public:
|
||||
int value;
|
||||
int GetValue() { return value; }
|
||||
int& SetValue(int x) { field = x; return &field; }
|
||||
};
|
||||
|
||||
.. code-block:: Nim
|
||||
:number-lines:
|
||||
|
||||
type
|
||||
Foo* {.importcpp: "Foo", header: "file.h".} = object
|
||||
value*: cint
|
||||
|
||||
proc getValue*(this: var Foo): cint
|
||||
{.importcpp: "#.GetValue(@)", header: "file.h".}
|
||||
proc setValue*(this: var Foo; x: cint): var cint
|
||||
{.importcpp: "#.SetValue(@)", header: "file.h".}
|
||||
|
||||
|
||||
|
||||
Constructors
|
||||
============
|
||||
|
||||
.. code-block:: C++
|
||||
:number-lines:
|
||||
|
||||
class Foo {
|
||||
public:
|
||||
int value;
|
||||
int GetValue() { return value; }
|
||||
int& SetValue(int x) { field = x; return &field; }
|
||||
|
||||
Foo(int x): field(x) {}
|
||||
};
|
||||
|
||||
.. code-block:: Nim
|
||||
:number-lines:
|
||||
|
||||
type
|
||||
Foo* {.importcpp: "Foo", header: "file.h".} = object
|
||||
value*: cint
|
||||
|
||||
proc getValue*(this: var Foo): cint
|
||||
{.importcpp: "#.GetValue(@)", header: "file.h".}
|
||||
proc setValue*(this: var Foo; x: cint): var cint
|
||||
{.importcpp: "#.SetValue(@)", header: "file.h".}
|
||||
|
||||
proc constructFoo*(x: cint): Foo
|
||||
{.importcpp: "Foo(@)", header: "file.h".}
|
||||
|
||||
|
||||
Constructors
|
||||
============
|
||||
|
||||
.. code-block:: C++
|
||||
:number-lines:
|
||||
|
||||
Foo foo = Foo(1, 2, 3);
|
||||
|
||||
auto foo = Foo(1, 2, 3);
|
||||
|
||||
|
||||
Constructors
|
||||
============
|
||||
|
||||
.. code-block:: C++
|
||||
:number-lines:
|
||||
|
||||
Foo foo = Foo(1, 2, 3);
|
||||
// Calls copy constructor!
|
||||
auto foo = Foo(1, 2, 3);
|
||||
|
||||
|
||||
Constructors
|
||||
============
|
||||
|
||||
.. code-block:: C++
|
||||
:number-lines:
|
||||
|
||||
Foo foo = Foo(1, 2, 3);
|
||||
// Calls copy constructor!
|
||||
auto foo = Foo(1, 2, 3);
|
||||
|
||||
Foo foo(1, 2, 3);
|
||||
|
||||
|
||||
Constructors
|
||||
============
|
||||
|
||||
.. code-block:: Nim
|
||||
:number-lines:
|
||||
|
||||
proc constructFoo*(x: cint): Foo
|
||||
{.importcpp: "Foo(@)", header: "file.h", constructor.}
|
||||
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
proc newFoo(a, b: cint): ptr Foo {.importcpp: "new Foo(@)".}
|
||||
|
||||
let x = newFoo(3, 4)
|
||||
|
||||
|
||||
proc cnew*[T](x: T): ptr T {.importcpp: "(new '*0#@)", nodecl.}
|
||||
|
||||
|
||||
|
||||
Generics
|
||||
========
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: nim
|
||||
:number-lines:
|
||||
|
||||
type Input {.importcpp: "System::Input".} = object
|
||||
proc getSubsystem*[T](): ptr T
|
||||
{.importcpp: "SystemManager::getSubsystem<'*0>()", nodecl.}
|
||||
|
||||
let x: ptr Input = getSubsystem[Input]()
|
||||
|
||||
Produces:
|
||||
|
||||
.. code-block:: C
|
||||
:number-lines:
|
||||
|
||||
x = SystemManager::getSubsystem<System::Input>()
|
||||
|
||||
|
||||
|
||||
Emit pragma
|
||||
===========
|
||||
|
||||
.. code-block:: Nim
|
||||
:number-lines:
|
||||
|
||||
{.emit: """
|
||||
static int cvariable = 420;
|
||||
""".}
|
||||
|
||||
{.push stackTrace:off.}
|
||||
proc embedsC() =
|
||||
var nimVar = 89
|
||||
# use backticks to access Nim symbols within an emit section:
|
||||
{.emit: """fprintf(stdout, "%d\n", cvariable + (int)`nimVar`);""".}
|
||||
{.pop.}
|
||||
|
||||
embedsC()
|
||||
|
||||
|
||||
..
|
||||
A tour through the standard library
|
||||
-----------------------------------
|
||||
|
||||
- system module: basic arithmetic and IO
|
||||
- strutils module; Unicode module
|
||||
- OS and osproc modules
|
||||
- sequtils and algorithm
|
||||
- tables and sets
|
||||
- linked lists, queues
|
||||
|
||||
- watchpoints
|
||||
- tracing
|
||||
- lexer generation
|
||||
- ORM
|
||||
|
||||
|
||||
Questions?
|
||||
==========
|
||||
43
build.nim
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
import strutils, os, re
|
||||
|
||||
proc main(file: string) =
|
||||
discard execShellCmd("nim rst2html $1.rst" % file)
|
||||
|
||||
const
|
||||
patternA = "<span class\\=\"Operator\">***</span>" &
|
||||
"(.*)" &
|
||||
"<span class\\=\"Operator\">***</span>"
|
||||
|
||||
proc writeln(buf: var string; x: string) = buf.add x & "\n"
|
||||
|
||||
proc tline(line: string): string =
|
||||
result = line.replacef(re(patternA.replace("***", r"\*\*\*"), {}),
|
||||
"<span style=\"background-color:#FF7700\">$1</span>")
|
||||
result = result.replacef(re(patternA.replace("***", r"\+\+\+"), {}),
|
||||
"<span style=\"background-color:#FFFF00\">$1</span>")
|
||||
result = result.replacef(re(patternA.replace("***", r"\=\=\="), {}),
|
||||
"<span style=\"background-color:#7777FF\">$1</span>")
|
||||
|
||||
var f = ""
|
||||
var count = 0
|
||||
for line in lines("$1.html" % file):
|
||||
if line.contains("<h1"):
|
||||
inc count
|
||||
if count != 1:
|
||||
f.writeln("</div>")
|
||||
f.writeln("<div class=\"slide\">")
|
||||
f.writeln(line.tline)
|
||||
elif line.contains("<h2 "):
|
||||
f.writeln("</div><div class=\"slide\" class=\"incremental\">")
|
||||
let a = line.replace("<h2 ", "<h1 ").replace("</h2>", "</h1>")
|
||||
f.writeln(a.tline)
|
||||
elif line.contains("</html>"):
|
||||
f.writeln("</div>")
|
||||
f.writeln(line.tline)
|
||||
else:
|
||||
f.writeln(line.tline)
|
||||
writeFile("$1.html" % file, f)
|
||||
|
||||
for x in os.walkFiles("*.rst"):
|
||||
main(x.splitFile.name)
|
||||
7
livedemo/codegendecl.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
var
|
||||
a {.codegenDecl: "$# progmem $#".}: int
|
||||
|
||||
proc myinterrupt() {.codegenDecl: "$# __interrupt $#$# __attribute__(weirdo)",
|
||||
exportc: "nim_interrupt".} =
|
||||
echo "realistic interrupt handler"
|
||||
76
livedemo/coverage.nim
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
|
||||
## Code coverage macro
|
||||
|
||||
import macros
|
||||
|
||||
proc transform(n, guard, list: NimNode): NimNode {.compileTime.} =
|
||||
# recurse:
|
||||
result = copyNimNode(n)
|
||||
for c in n.children:
|
||||
result.add c.transform(guard, list)
|
||||
|
||||
if n.kind in {nnkElifBranch, nnkOfBranch, nnkExceptBranch, nnkElifExpr,
|
||||
nnkElseExpr, nnkElse, nnkForStmt, nnkWhileStmt}:
|
||||
let lineinfo = result[^1].lineinfo
|
||||
|
||||
template track(guard, i) =
|
||||
guard[i][1] = true
|
||||
result[^1] = newStmtList(getAst track(guard, list.len), result[^1])
|
||||
|
||||
template tup(lineinfo) =
|
||||
(lineinfo, false)
|
||||
list.add(getAst tup(lineinfo))
|
||||
|
||||
proc listCoverage(s: openArray[(string, bool)]) =
|
||||
for x in s:
|
||||
if not x[1]: echo "NOT EXECUTED ", x[0]
|
||||
|
||||
macro cov(p: untyped): untyped =
|
||||
var list = newNimNode(nnkBracket)
|
||||
let guard = genSym(nskVar, "guard")
|
||||
result = transform(p, guard, list)
|
||||
result = newStmtList(newVarStmt(guard, list), result,
|
||||
newCall(bindSym"listCoverage", guard))
|
||||
|
||||
|
||||
cov:
|
||||
proc toTest(x, y: int) =
|
||||
try:
|
||||
case x
|
||||
of 8:
|
||||
if y > 9: echo "8.1"
|
||||
else: echo "8.2"
|
||||
of 9: echo "9"
|
||||
else: echo "else"
|
||||
echo "no IoError"
|
||||
except IoError:
|
||||
echo "IoError"
|
||||
toTest(8, 10)
|
||||
toTest(10, 10)
|
||||
|
||||
|
||||
when false:
|
||||
cov:
|
||||
proc toTest(x: int): int =
|
||||
if x > 0: result = 88
|
||||
else: result = 99
|
||||
|
||||
proc toTestE(x: int): int =
|
||||
(if x > 0: 88 else: 99)
|
||||
|
||||
proc toTestTry(x: int) =
|
||||
try:
|
||||
case x
|
||||
of 8: echo "8"
|
||||
of 9: echo "9"
|
||||
else: echo "foo"
|
||||
echo "Try it"
|
||||
except IoError:
|
||||
echo "IoError"
|
||||
|
||||
echo toTest 89
|
||||
echo toTest(-89)
|
||||
|
||||
echo toTestE 89
|
||||
toTestTry(8)
|
||||
# echo toTestE(-89)
|
||||
64
livedemo/coverage2.nim
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
|
||||
import macros
|
||||
|
||||
type HideEffects = proc (x: int) {.raises: [], noSideEffect, tags: [].}
|
||||
|
||||
proc wrap(n: NimNode; setter, i: NimNode): NimNode {.compileTime.} =
|
||||
# XXX better insert as last statement, but move before 'break', 'return' etc.
|
||||
template callSetterProc(setter, i) =
|
||||
cast[HideEffects](setter)(i)
|
||||
result = newTree(nnkStmtList, getAst callSetterProc(setter, i), n)
|
||||
|
||||
proc transform(n, setter, data: NimNode): NimNode {.compileTime.} =
|
||||
# recurse:
|
||||
result = copyNimNode(n)
|
||||
for c in n.children:
|
||||
result.add c.transform(setter, data)
|
||||
if n.kind in {nnkElifBranch, nnkOfBranch, nnkExceptBranch, nnkElifExpr,
|
||||
nnkElseExpr, nnkElse, nnkForStmt, nnkWhileStmt}:
|
||||
let index = newLit(data.len)
|
||||
data.add(newTree(nnkPar, newLit(result[^1].lineinfo), bindSym"false"))
|
||||
result[^1] = result[^1].wrap(setter, index)
|
||||
|
||||
proc listCoverage(s: openArray[(string, bool)]) =
|
||||
for x in s:
|
||||
if not x[1]: echo "NOT EXECUTED ", x[0]
|
||||
|
||||
macro cov(p: untyped): untyped =
|
||||
var data = newNimNode(nnkBracket)
|
||||
let guard = genSym(nskVar, "guard")
|
||||
let setter = genSym(nskProc, "guardSetter")
|
||||
template setterProc(name, guard) =
|
||||
proc name(x: int) =
|
||||
guard[x][1] = true
|
||||
|
||||
result = transform(p, setter, data)
|
||||
result = newTree(nnkStmtList, newVarStmt(guard, data),
|
||||
getAst setterProc(setter, guard),
|
||||
result,
|
||||
newCall(bindSym"listCoverage", guard))
|
||||
|
||||
cov:
|
||||
proc toTest(x: int): int {.noSideEffect.} =
|
||||
if x > 0: result = 88
|
||||
else: result = 99
|
||||
|
||||
proc toTestE(x: int): int =
|
||||
(if x > 0: 88 else: 99)
|
||||
|
||||
proc toTestTry(x: int) =
|
||||
try:
|
||||
case x
|
||||
of 8: echo "8"
|
||||
of 9: echo "9"
|
||||
else: echo "foo"
|
||||
echo "Try it"
|
||||
except IoError:
|
||||
echo "IoError"
|
||||
|
||||
echo toTest 89
|
||||
echo toTest(-89)
|
||||
|
||||
echo toTestE 89
|
||||
toTestTry(8)
|
||||
# echo toTestE(-89)
|
||||
291
livedemo/demo.html
Normal file
|
|
@ -0,0 +1,291 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Module demo</title>
|
||||
<meta name="copyright"
|
||||
content="Copyright © 2015 Andreas Rumpf" />
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="Slidy2/styles/slidy.css" />
|
||||
<script src="Slidy2/scripts/slidy.js"
|
||||
charset="utf-8" type="text/javascript"></script>
|
||||
<style type="text/css">
|
||||
|
||||
span.DecNumber {color: blue}
|
||||
span.BinNumber {color: blue}
|
||||
span.HexNumber {color: blue}
|
||||
span.OctNumber {color: blue}
|
||||
span.FloatNumber {color: blue}
|
||||
span.Identifier {color: black}
|
||||
span.Keyword {font-weight: bold}
|
||||
span.StringLit {color: blue}
|
||||
span.LongStringLit {color: blue}
|
||||
span.CharLit {color: blue}
|
||||
span.EscapeSequence {color: black}
|
||||
span.Operator {color: black}
|
||||
span.Punctation {color: black}
|
||||
span.Comment, span.LongComment {font-style:italic; color: green}
|
||||
span.RegularExpression {color: DarkViolet}
|
||||
span.TagStart {color: DarkViolet}
|
||||
span.TagEnd {color: DarkViolet}
|
||||
span.Key {color: blue}
|
||||
span.Value {color: black}
|
||||
span.RawData {color: blue}
|
||||
span.Assembler {color: blue}
|
||||
span.Preprocessor {color: DarkViolet}
|
||||
span.Directive {color: DarkViolet}
|
||||
span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference,
|
||||
span.Other {color: black}
|
||||
|
||||
div.navigation {
|
||||
-moz-border-radius: 5px 5px 5px 5px;
|
||||
float: left;
|
||||
width: 30%;
|
||||
margin: 0; padding: 0;
|
||||
border: 3px outset #7F7F7F;
|
||||
background-color: #7F7F7F;
|
||||
}
|
||||
|
||||
div.navigation ul {
|
||||
list-style-type: none;
|
||||
padding-left: 1em;
|
||||
}
|
||||
div.navigation ul li a, div.navigation ul li a:visited {
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
text-decoration: none;
|
||||
}
|
||||
div.navigation ul li a:hover {
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
color: gold;
|
||||
}
|
||||
|
||||
div.content {
|
||||
margin-left: 30%;
|
||||
padding: 0 1em;
|
||||
border-left: 4em;
|
||||
}
|
||||
|
||||
dl.item dd, dl.item dd p {
|
||||
margin-top:3px;
|
||||
}
|
||||
dl.item dd pre {
|
||||
margin-left: 15pt;
|
||||
border: 0px;
|
||||
}
|
||||
dl.item dt, dl.item dt pre {
|
||||
margin: 20pt 0 0 5pt;
|
||||
}
|
||||
|
||||
pre, span.tok {
|
||||
background-color: #F9F9F9;
|
||||
border-color: #C4C4C4;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 1px 2px;
|
||||
color: black;
|
||||
line-spacing: 110%;
|
||||
font-weight: normal;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
span.red {
|
||||
color: #A80000;
|
||||
}
|
||||
|
||||
hr {background-color:#9D9D9D; border:0 none; color:#9D9D9D; height:1px; width:100%;}
|
||||
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger@python.org
|
||||
:Date: Date: 2006-05-21 22:44:42 +0200 (Sun, 21 May 2006)
|
||||
:Revision: Revision: 4564
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th { border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first { margin-top: 0 ! important }
|
||||
.last, .with-subtitle { margin-bottom: 0 ! important }
|
||||
.hidden { display: none }
|
||||
a.toc-backref { text-decoration: none ; color: black }
|
||||
blockquote.epigraph { margin: 2em 5em ; }
|
||||
dl.docutils dd { margin-bottom: 0.5em }
|
||||
div.abstract { margin: 2em 5em }
|
||||
div.abstract p.topic-title { font-weight: bold ; text-align: center }
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ; border: medium outset ; padding: 1em }
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title { font-weight: bold ; font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title { color: red ; font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication { margin: 2em 5em ; text-align: center ; font-style: italic }
|
||||
div.dedication p.topic-title { font-weight: bold ; font-style: normal }
|
||||
div.figure { margin-left: 2em ; margin-right: 2em }
|
||||
div.footer, div.header { clear: both; font-size: smaller }
|
||||
div.line-block { display: block ; margin-top: 1em ; margin-bottom: 1em }
|
||||
div.line-block div.line-block { margin-top: 0 ; margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
div.sidebar { margin-left: 1em ; border: medium outset ;
|
||||
padding: 1em ; background-color: #ffffee ; /*width: 40% ;*/ float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric { font-family: sans-serif ; font-size: medium }
|
||||
div.system-messages { margin: 5em }
|
||||
div.system-messages h1 { color: red }
|
||||
div.system-message { border: medium outset ; padding: 1em }
|
||||
div.system-message p.system-message-title { color: red ; font-weight: bold }
|
||||
div.topic { margin: 2em;}
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
h1.title { text-align: center }
|
||||
h2.subtitle { text-align: center }
|
||||
/* hr.docutils { width: 75% } */
|
||||
img.align-left { clear: left }
|
||||
img.align-right { clear: right }
|
||||
ol.simple, ul.simple { margin-bottom: 1em }
|
||||
ol.arabic { list-style: decimal }
|
||||
ol.loweralpha { list-style: lower-alpha }
|
||||
ol.upperalpha { list-style: upper-alpha }
|
||||
ol.lowerroman { list-style: lower-roman }
|
||||
ol.upperroman { list-style: upper-roman }
|
||||
p.attribution { text-align: right ; margin-left: 50% }
|
||||
p.caption { font-style: italic }
|
||||
p.credits { font-style: italic ; font-size: smaller }
|
||||
p.label { white-space: nowrap }
|
||||
p.rubric { font-weight:bold;font-size:larger;color:maroon;text-align:center}
|
||||
p.sidebar-title {font-family: sans-serif ;font-weight: bold ;font-size: larger }
|
||||
p.sidebar-subtitle {font-family: sans-serif ; font-weight: bold }
|
||||
p.topic-title {
|
||||
font-weight: bold;
|
||||
background-color: #6D6D6D;
|
||||
border-bottom: 1px solid #000000;
|
||||
border-top: 1px solid black;
|
||||
color: white;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
pre.address { margin-bottom: 0;margin-top:0;font-family:serif;font-size:100% }
|
||||
pre.literal-block, pre.doctest-block {margin-left: 2em ;margin-right: 2em }
|
||||
span.classifier {font-family: sans-serif;font-style: oblique }
|
||||
span.classifier-delimiter {font-family: sans-serif;font-weight: bold }
|
||||
span.interpreted {font-family: sans-serif }
|
||||
span.option {white-space: nowrap }
|
||||
span.pre {white-space: pre }
|
||||
span.problematic {color: red }
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation { border-left: solid 1px gray; margin-left: 1px }
|
||||
table.docinfo {margin: 2em 4em }
|
||||
table.docutils {margin-top: 0.5em;margin-bottom: 0.5em; border: 0 solid #9d9d9d; border-collapse: collapse; }
|
||||
table.footnote {border-left: solid 1px black;margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {padding-left: 0.5em;padding-right: 0.5em;
|
||||
vertical-align: top;}
|
||||
|
||||
table.docutils td, table.docutils th { border-bottom:1px solid #9D9D9D; }
|
||||
/* color: #4d4d4d} */
|
||||
|
||||
/* table.docutils td:hover, table.docinfo td:hover {color: #000000} */
|
||||
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold;text-align: left;white-space: nowrap;padding-left: 0 }
|
||||
|
||||
table.docutils th
|
||||
{
|
||||
color: black;
|
||||
font-weight:normal;
|
||||
background-color: #E3E3E3;
|
||||
border-top: 1px solid #1d1d1d;
|
||||
border-bottom: 1px solid #1d1d1d;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {font-size: 100% }
|
||||
ul.auto-toc { list-style-type: none }
|
||||
/*a.reference { color: #E00000; font-weight:bold;}
|
||||
a.reference:hover {color: #E00000;background-color: #ffff00;display: margin;
|
||||
font-weight:bold;}*/
|
||||
|
||||
p.pic {
|
||||
width: 1040px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="Slidy2/styles/w3c-blue.css" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="background">
|
||||
<img id="head-icon" alt="Nimrod logo"
|
||||
src="logo2.png" />
|
||||
</div>
|
||||
|
||||
<h1 class="title">Module demo</h1>
|
||||
<div class='toc'>
|
||||
<div class="navigation" id="navigation">
|
||||
<ul class="simple">
|
||||
<li>
|
||||
<a class="reference" href="#12" id="62">Procs</a>
|
||||
<ul class="simple">
|
||||
<li><a class="reference" href="#101"><wbr />compose</a></li>
|
||||
<li><a class="reference" href="#102"><wbr />compose2</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content" id="content">
|
||||
|
||||
<div class="section" id="12">
|
||||
<h1><a class="toc-backref" href="#62">Procs</a></h1>
|
||||
<dl class="item">
|
||||
<dt id="101"><pre><span class="Keyword">proc</span> <span class="Identifier">compose</span><span class="Other">(</span><span class="Other">)</span> <span class="Other">{.</span><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ExecIOEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">.}</span></pre></dt>
|
||||
<dd>
|
||||
|
||||
</dd>
|
||||
<dt id="102"><pre><span class="Keyword">proc</span> <span class="Identifier">compose2</span><span class="Other">(</span><span class="Other">)</span> <span class="Other">{.</span><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ExecIOEffect</span><span class="Other">]</span><span class="Other">.}</span></pre></dt>
|
||||
<dd>
|
||||
|
||||
</dd>
|
||||
|
||||
</dl></div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
22
livedemo/demo.nim
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
import macros
|
||||
|
||||
macro cov(n: untyped): untyped =
|
||||
result = n
|
||||
echo treeRepr n
|
||||
|
||||
cov:
|
||||
proc toTest(x, y: int) =
|
||||
try:
|
||||
case x
|
||||
of 8:
|
||||
if y > 9: echo "8.1"
|
||||
else: echo "8.2"
|
||||
of 9: echo "9"
|
||||
else: echo "foo"
|
||||
echo "no exception"
|
||||
except IoError:
|
||||
echo "IoError"
|
||||
|
||||
toTest(8, 10)
|
||||
toTest(10, 10)
|
||||
5
livedemo/file.c2nim
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
#cpp
|
||||
#header
|
||||
|
||||
#nep1
|
||||
27
livedemo/file.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
#def WXDLLIMPEXP_CORE
|
||||
|
||||
#define constantA 1
|
||||
#define constantB 2
|
||||
|
||||
|
||||
namespace Name {
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
class WXDLLIMPEXP_CORE Foo {
|
||||
public:
|
||||
T value = {. NimConstant + 78 shr 9 .};
|
||||
T GetValue() { return value; }
|
||||
T& SetValue(int x) { field = x; return &field; }
|
||||
|
||||
Foo(T x): field(x) {}
|
||||
~Foo() {}
|
||||
|
||||
bool operator==(Foo<T>& const other) const;
|
||||
bool operator!=(Foo other);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
17
livedemo/file.nim
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
const
|
||||
constantA* = 1
|
||||
constantB* = 2
|
||||
|
||||
type
|
||||
Foo* {.importcpp: "Name::Foo", header: "file.h".}[T] = object
|
||||
value* {.importc: "value".}: T = NimConstant + 78 shr 9
|
||||
|
||||
|
||||
proc getValue*[T](this: var Foo[T]): T {.importcpp: "GetValue", header: "file.h".}
|
||||
proc setValue*[T](this: var Foo[T]; x: cint): var T {.importcpp: "SetValue",
|
||||
header: "file.h".}
|
||||
proc constructFoo*[T](x: T): Foo[T] {.constructor, importcpp: "Name::Foo(@)",
|
||||
header: "file.h".}
|
||||
proc destroyFoo*[T](this: var Foo[T]) {.importcpp: "#.~Foo()", header: "file.h".}
|
||||
proc `==`*[T](this: Foo[T]; other: Foo[T]): bool {.noSideEffect, importcpp: "(# == #)",
|
||||
header: "file.h".}
|
||||
8
livedemo/options.c2nim
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
#cpp
|
||||
#header
|
||||
#nep1
|
||||
|
||||
#discardableprefix Set
|
||||
|
||||
|
||||
BIN
logo2.png
Normal file
|
After Width: | Height: | Size: 240 KiB |
323
nimdoc.cfg
Normal file
|
|
@ -0,0 +1,323 @@
|
|||
# This is the config file for the documentation generator.
|
||||
# (c) 2015 Andreas Rumpf
|
||||
# Feel free to edit the templates as you need.
|
||||
|
||||
split.item.toc = "20"
|
||||
# too long entries in the table of contents wrap around
|
||||
# after this number of characters
|
||||
|
||||
|
||||
doc.listing_start = """<pre id="listing_$1" class="listing">"""
|
||||
doc.listing_end = """</pre>"""
|
||||
doc.listing_button = """<button onclick="copyToClipboard('listing_$1')">Select</button>"""
|
||||
|
||||
doc.section = """
|
||||
<div class="section" id="$sectionID">
|
||||
<h1><a class="toc-backref" href="#$sectionTitleID">$sectionTitle</a></h1>
|
||||
<dl class="item">
|
||||
$content
|
||||
</dl></div>
|
||||
"""
|
||||
|
||||
doc.section.toc = """
|
||||
<li>
|
||||
<a class="reference" href="#$sectionID" id="$sectionTitleID">$sectionTitle</a>
|
||||
<ul class="simple">
|
||||
$content
|
||||
</ul>
|
||||
</li>
|
||||
"""
|
||||
|
||||
doc.item = """
|
||||
<dt id="$itemID"><pre>$header</pre></dt>
|
||||
<dd>
|
||||
$desc
|
||||
</dd>
|
||||
"""
|
||||
|
||||
doc.item.toc = """
|
||||
<li><a class="reference" href="#$itemID">$name</a></li>
|
||||
"""
|
||||
|
||||
doc.toc = """
|
||||
<div class="navigation" id="navigation">
|
||||
<ul class="simple">
|
||||
$content
|
||||
</ul>
|
||||
</div>"""
|
||||
|
||||
doc.body_toc = """
|
||||
<div class='toc'>
|
||||
$tableofcontents
|
||||
</div>
|
||||
<div class="content" id="content">
|
||||
$moduledesc
|
||||
$content
|
||||
</div>
|
||||
"""
|
||||
|
||||
doc.body_no_toc = """
|
||||
$moduledesc
|
||||
$content
|
||||
"""
|
||||
|
||||
doc.file = """<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>$title</title>
|
||||
<meta name="copyright"
|
||||
content="Copyright © 2015 Andreas Rumpf" />
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="Slidy2/styles/slidy.css" />
|
||||
<script src="Slidy2/scripts/slidy.js"
|
||||
charset="utf-8" type="text/javascript"></script>
|
||||
<style type="text/css">
|
||||
|
||||
span.DecNumber {color: blue}
|
||||
span.BinNumber {color: blue}
|
||||
span.HexNumber {color: blue}
|
||||
span.OctNumber {color: blue}
|
||||
span.FloatNumber {color: blue}
|
||||
span.Identifier {color: black}
|
||||
span.Keyword {font-weight: bold}
|
||||
span.StringLit {color: blue}
|
||||
span.LongStringLit {color: blue}
|
||||
span.CharLit {color: blue}
|
||||
span.EscapeSequence {color: black}
|
||||
span.Operator {color: black}
|
||||
span.Punctation {color: black}
|
||||
span.Comment, span.LongComment {font-style:italic; color: green}
|
||||
span.RegularExpression {color: DarkViolet}
|
||||
span.TagStart {color: DarkViolet}
|
||||
span.TagEnd {color: DarkViolet}
|
||||
span.Key {color: blue}
|
||||
span.Value {color: black}
|
||||
span.RawData {color: blue}
|
||||
span.Assembler {color: blue}
|
||||
span.Preprocessor {color: DarkViolet}
|
||||
span.Directive {color: DarkViolet}
|
||||
span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference,
|
||||
span.Other {color: black}
|
||||
|
||||
div.navigation {
|
||||
-moz-border-radius: 5px 5px 5px 5px;
|
||||
float: left;
|
||||
width: 30%;
|
||||
margin: 0; padding: 0;
|
||||
border: 3px outset #7F7F7F;
|
||||
background-color: #7F7F7F;
|
||||
}
|
||||
|
||||
div.navigation ul {
|
||||
list-style-type: none;
|
||||
padding-left: 1em;
|
||||
}
|
||||
div.navigation ul li a, div.navigation ul li a:visited {
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
text-decoration: none;
|
||||
}
|
||||
div.navigation ul li a:hover {
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
color: gold;
|
||||
}
|
||||
|
||||
div.content {
|
||||
margin-left: 30%;
|
||||
padding: 0 1em;
|
||||
border-left: 4em;
|
||||
}
|
||||
|
||||
dl.item dd, dl.item dd p {
|
||||
margin-top:3px;
|
||||
}
|
||||
dl.item dd pre {
|
||||
margin-left: 15pt;
|
||||
border: 0px;
|
||||
}
|
||||
dl.item dt, dl.item dt pre {
|
||||
margin: 20pt 0 0 5pt;
|
||||
}
|
||||
|
||||
pre, span.tok {
|
||||
background-color: #F9F9F9;
|
||||
border-color: #C4C4C4;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 1px 2px;
|
||||
color: black;
|
||||
line-spacing: 110%;
|
||||
font-weight: normal;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
span.red {
|
||||
color: #A80000;
|
||||
}
|
||||
|
||||
hr {background-color:#9D9D9D; border:0 none; color:#9D9D9D; height:1px; width:100%;}
|
||||
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger@python.org
|
||||
:Date: Date: 2006-05-21 22:44:42 +0200 (Sun, 21 May 2006)
|
||||
:Revision: Revision: 4564
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th { border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first { margin-top: 0 ! important }
|
||||
.last, .with-subtitle { margin-bottom: 0 ! important }
|
||||
.hidden { display: none }
|
||||
a.toc-backref { text-decoration: none ; color: black }
|
||||
blockquote.epigraph { margin: 2em 5em ; }
|
||||
dl.docutils dd { margin-bottom: 0.5em }
|
||||
div.abstract { margin: 2em 5em }
|
||||
div.abstract p.topic-title { font-weight: bold ; text-align: center }
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ; border: medium outset ; padding: 1em }
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title { font-weight: bold ; font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title { color: red ; font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication { margin: 2em 5em ; text-align: center ; font-style: italic }
|
||||
div.dedication p.topic-title { font-weight: bold ; font-style: normal }
|
||||
div.figure { margin-left: 2em ; margin-right: 2em }
|
||||
div.footer, div.header { clear: both; font-size: smaller }
|
||||
div.line-block { display: block ; margin-top: 1em ; margin-bottom: 1em }
|
||||
div.line-block div.line-block { margin-top: 0 ; margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
div.sidebar { margin-left: 1em ; border: medium outset ;
|
||||
padding: 1em ; background-color: #ffffee ; /*width: 40% ;*/ float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric { font-family: sans-serif ; font-size: medium }
|
||||
div.system-messages { margin: 5em }
|
||||
div.system-messages h1 { color: red }
|
||||
div.system-message { border: medium outset ; padding: 1em }
|
||||
div.system-message p.system-message-title { color: red ; font-weight: bold }
|
||||
div.topic { margin: 2em;}
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
h1.title { text-align: center }
|
||||
h2.subtitle { text-align: center }
|
||||
/* hr.docutils { width: 75% } */
|
||||
img.align-left { clear: left }
|
||||
img.align-right { clear: right }
|
||||
ol.simple, ul.simple { margin-bottom: 1em }
|
||||
ol.arabic { list-style: decimal }
|
||||
ol.loweralpha { list-style: lower-alpha }
|
||||
ol.upperalpha { list-style: upper-alpha }
|
||||
ol.lowerroman { list-style: lower-roman }
|
||||
ol.upperroman { list-style: upper-roman }
|
||||
p.attribution { text-align: right ; margin-left: 50% }
|
||||
p.caption { font-style: italic }
|
||||
p.credits { font-style: italic ; font-size: smaller }
|
||||
p.label { white-space: nowrap }
|
||||
p.rubric { font-weight:bold;font-size:larger;color:maroon;text-align:center}
|
||||
p.sidebar-title {font-family: sans-serif ;font-weight: bold ;font-size: larger }
|
||||
p.sidebar-subtitle {font-family: sans-serif ; font-weight: bold }
|
||||
p.topic-title {
|
||||
font-weight: bold;
|
||||
background-color: #6D6D6D;
|
||||
border-bottom: 1px solid #000000;
|
||||
border-top: 1px solid black;
|
||||
color: white;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
pre.address { margin-bottom: 0;margin-top:0;font-family:serif;font-size:100% }
|
||||
pre.literal-block, pre.doctest-block {margin-left: 2em ;margin-right: 2em }
|
||||
span.classifier {font-family: sans-serif;font-style: oblique }
|
||||
span.classifier-delimiter {font-family: sans-serif;font-weight: bold }
|
||||
span.interpreted {font-family: sans-serif }
|
||||
span.option {white-space: nowrap }
|
||||
span.pre {white-space: pre }
|
||||
span.problematic {color: red }
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation { border-left: solid 1px gray; margin-left: 1px }
|
||||
table.docinfo {margin: 2em 4em }
|
||||
table.docutils {margin-top: 0.5em;margin-bottom: 0.5em; border: 0 solid #9d9d9d; border-collapse: collapse; }
|
||||
table.footnote {border-left: solid 1px black;margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {padding-left: 0.5em;padding-right: 0.5em;
|
||||
vertical-align: top;}
|
||||
|
||||
table.docutils td, table.docutils th { border-bottom:1px solid #9D9D9D; }
|
||||
/* color: #4d4d4d} */
|
||||
|
||||
/* table.docutils td:hover, table.docinfo td:hover {color: #000000} */
|
||||
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold;text-align: left;white-space: nowrap;padding-left: 0 }
|
||||
|
||||
table.docutils th
|
||||
{
|
||||
color: black;
|
||||
font-weight:normal;
|
||||
background-color: #E3E3E3;
|
||||
border-top: 1px solid #1d1d1d;
|
||||
border-bottom: 1px solid #1d1d1d;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {font-size: 100% }
|
||||
ul.auto-toc { list-style-type: none }
|
||||
/*a.reference { color: #E00000; font-weight:bold;}
|
||||
a.reference:hover {color: #E00000;background-color: #ffff00;display: margin;
|
||||
font-weight:bold;}*/
|
||||
|
||||
p.pic {
|
||||
width: 1040px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="Slidy2/styles/w3c-blue.css" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="background">
|
||||
<img id="head-icon" alt="Nimrod logo"
|
||||
src="logo2.png" />
|
||||
</div>
|
||||
|
||||
<h1 class="title">$title</h1>
|
||||
$content
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
912
slidy2/Overview.html
Normal file
|
|
@ -0,0 +1,912 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="generator" content=
|
||||
"HTML Tidy for Linux/x86 (vers 1st November 2003), see www.w3.org" />
|
||||
<title>HTML Slidy</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="copyright" content=
|
||||
"Copyright © 2005-2010 W3C (MIT, ERCIM, Keio)" />
|
||||
<meta name="duration" content="5" />
|
||||
<meta name="font-size-adjustment" content="-2" />
|
||||
<link rel="stylesheet" href="styles/slidy.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/w3c-blue.css" type="text/css" />
|
||||
<script src="scripts/slidy.js" charset="utf-8" type="text/javascript">
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="background"><img alt="" id="head-icon"
|
||||
src="graphics/icon-blue.png" /><object id="head-logo"
|
||||
data="graphics/w3c-logo-white.svg" type="image/svg+xml"
|
||||
title="W3C logo"><a href="http://www.w3.org/"><img
|
||||
alt="W3C logo" id="head-logo-fallback"
|
||||
src="graphics/w3c-logo-white.gif" /></a></object></div>
|
||||
|
||||
<div class="background slanty">
|
||||
<img src="graphics/w3c-logo-slanted.jpg" alt="slanted W3C logo" />
|
||||
</div>
|
||||
<div class="slide cover title">
|
||||
<!-- hidden style graphics to ensure they are saved with other content -->
|
||||
<img class="hidden" src="graphics/bullet.png" alt="" />
|
||||
<img class="hidden" src="graphics/fold.gif" alt="" />
|
||||
<img class="hidden" src="graphics/unfold.gif" alt="" />
|
||||
<img class="hidden" src="graphics/fold-dim.gif" alt="" />
|
||||
<img class="hidden" src="graphics/nofold-dim.gif" alt="" />
|
||||
<img class="hidden" src="graphics/unfold-dim.gif" alt="" />
|
||||
<img class="hidden" src="graphics/bullet-fold.gif" alt="" />
|
||||
<img class="hidden" src="graphics/bullet-unfold.gif" alt="" />
|
||||
<img class="hidden" src="graphics/bullet-fold-dim.gif" alt="" />
|
||||
<img class="hidden" src="graphics/bullet-nofold-dim.gif" alt="" />
|
||||
<img class="hidden" src="graphics/bullet-unfold-dim.gif" alt="" />
|
||||
|
||||
<img src="graphics/keys2.jpg" alt="Cover page images (keys)"
|
||||
class="cover" /><br clear="all" />
|
||||
<h1>HTML Slidy: Slide Shows in HTML and XHTML</h1>
|
||||
|
||||
<p><a href="http://www.w3.org/People/Raggett/">Dave Raggett</a>,
|
||||
<<a href="mailto:dsr@w3.org">dsr@w3.org</a>><br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br /><em>Hit the space bar or swipe left for next slide</em></p>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Slide Shows in HTML and XHTML</h1>
|
||||
|
||||
<ul>
|
||||
<li>You can now create accessible slide shows with ease</li>
|
||||
|
||||
<li>Works across browsers and is operated like PowerPoint
|
||||
|
||||
<ul>
|
||||
<li>Advance to next slide with mouse click, space bar or swipe left</li>
|
||||
|
||||
<li>Move forward/backward between slides with Cursor Left,
|
||||
Cursor Right, <strong>Pg Up</strong> and <strong>Pg Dn</strong>
|
||||
keys, or swipe left or right</li>
|
||||
|
||||
<li><strong>Home</strong> key for first slide, <strong>End</strong>
|
||||
key for last slide</li>
|
||||
|
||||
<li>The "<strong>C</strong>" key for an automatically generated
|
||||
table of contents, or click on "contents" on the toolbar or
|
||||
swipe up or down</li>
|
||||
|
||||
<li>Function <strong>F11</strong> to go full screen and back</li>
|
||||
|
||||
<li>The "<strong>F</strong>" key toggles the display of the footer</li>
|
||||
|
||||
<li>The "<strong>A</strong>" key toggles display of current vs all
|
||||
slides
|
||||
|
||||
<ul>
|
||||
<li>Try it now to see how to include notes for handouts (this is
|
||||
explained in the notes following this slide)</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>Font sizes automatically adapt to browser window size
|
||||
|
||||
<ul>
|
||||
<li>use <strong>S</strong> and <strong>B</strong> keys for
|
||||
manual control (or < and >, or the <strong>-</strong> and
|
||||
<strong>+</strong> keys on the number pad</li>
|
||||
<li>Use CSS to set a relative font size on a given slide to make
|
||||
the content bigger or smaller than on other slides</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>Switching off JavaScript reveals all slides</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><em>Now move to next slide to see how it works</em></li>
|
||||
</ul>
|
||||
|
||||
<p class="copyright"><a rel="Copyright" href=
|
||||
"http://www.w3.org/Consortium/Legal/ipr-notice#Copyright" shape=
|
||||
"rect">Copyright</a> © 2005-2010 <a href="/"><acronym title=
|
||||
"World Wide Web Consortium">W3C</acronym></a> <sup>®</sup>
|
||||
(<a href="http://www.csail.mit.edu/"><acronym title=
|
||||
"Massachusetts Institute of Technology">MIT</acronym></a>, <a href=
|
||||
"http://www.ercim.org/"><acronym title=
|
||||
"European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights
|
||||
Reserved.</p>
|
||||
</div>
|
||||
|
||||
<div class="handout">
|
||||
<p>For handouts, its often useful to include extra notes using a
|
||||
div element with class="handout" following each slide, as in:</p>
|
||||
|
||||
<pre>
|
||||
<div class="slide">
|
||||
<em>... your slide content ...</em>
|
||||
</div>
|
||||
|
||||
<div class="handout">
|
||||
<em>... stuff that only appears in the handouts ...</em>
|
||||
</div>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>What you need to do</h1>
|
||||
|
||||
<ul>
|
||||
<li>Each presentation is a single XHTML file</li>
|
||||
|
||||
<li>Each slide is enclosed in <em><div class="slide"> ...
|
||||
</div></em>
|
||||
|
||||
<ul>
|
||||
<li>The div element will be created automatically for h1
|
||||
elements that are direct children of the body element.</li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li>Use regular markup within each slide</li>
|
||||
|
||||
<li>The document head includes two links:
|
||||
<ul>
|
||||
<li>The slide show style sheet:
|
||||
<a href=
|
||||
"http://www.w3.org/Talks/Tools/Slidy2/styles/slidy.css">http://www.w3.org/Talks/Tools/Slidy2/styles/slidy.css</a></li>
|
||||
|
||||
<li>The slide show script: <a href=
|
||||
"http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js">http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js</a></li>
|
||||
|
||||
<li>Or you can link to the compressed version of the script which is about
|
||||
one seventh the size, see <a href=
|
||||
"http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js.gz">http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js.gz</a></li>
|
||||
<li>If you are using XHTML, remember to use </script> and
|
||||
</style> as per <a
|
||||
href="http://www.w3.org/TR/xhtml1/#C_3">Appendix C.3</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<pre>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<title>Slide Shows in XHTML</title>
|
||||
<meta name="copyright"
|
||||
content="Copyright &#169; 2005 your copyright notice" />
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="http://www.w3.org/Talks/Tools/Slidy2/styles/slidy.css" />
|
||||
<script src="http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js"
|
||||
charset="utf-8" type="text/javascript"></script>
|
||||
<style type="text/css">
|
||||
<!-- your custom style rules -->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
... your slides marked up in XHTML ...
|
||||
</body>
|
||||
</html>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>To get the W3C Blue Style</h1>
|
||||
|
||||
<p>The head element should include the following link to the style
|
||||
sheet:</p>
|
||||
|
||||
<pre>
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="http://www.w3.org/Talks/Tools/Slidy2/styles/w3c-blue.css" />
|
||||
</pre>
|
||||
|
||||
<p>The body element's content should start with the following
|
||||
markup:</p>
|
||||
|
||||
<pre>
|
||||
<div class="background">
|
||||
<img id="head-icon" alt="graphic with four colored squares"
|
||||
src="http://www.w3.org/Talks/Tools/Slidy2/graphics/icon-blue.png" />
|
||||
<object id="head-logo" title="W3C logo" type="image/svg+xml"
|
||||
data="http://www.w3.org/Talks/Tools/Slidy2/graphics/w3c-logo-white.svg"><img
|
||||
src="http://www.w3.org/Talks/Tools/Slidy2/graphics/w3c-logo-white.gif"
|
||||
alt="W3C logo" id="head-logo-fallback" /></object>
|
||||
</div>
|
||||
</pre>
|
||||
|
||||
<p>This adds the logos on the top left and right corners of the
|
||||
slide.</p>
|
||||
|
||||
<p>You are of course welcome to create your own slide designs.
|
||||
You can provide different styles and backgrounds for
|
||||
different slides (more details later).</p>
|
||||
|
||||
<p>Use the <em>meta element</em> with <em>name="copyright"</em>
|
||||
for use in the slide show footer:</p>
|
||||
|
||||
<pre>
|
||||
<meta name="copyright"
|
||||
content="Copyright &#169; 2005-2009 W3C (MIT, ERCIM, Keio)" />
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Upgrading from previous versions of Slidy</h1>
|
||||
|
||||
<ul>
|
||||
<li>This uses a new version of the HTML Slidy script</li>
|
||||
<li>It is designed to work better with other scripts,
|
||||
e.g. for UI controls within your slides
|
||||
<ul>
|
||||
<li>Only adds one global name "w3c_slidy"</li>
|
||||
<li>Doesn't interfere with other scripts that set event handers
|
||||
such as onload on body element</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Works for slides delivered as text/html and application/xhtml+xml</li>
|
||||
<li>New presentation timer feature</li>
|
||||
<li>Initial prompt on first slide to help newcomers to Slidy</li>
|
||||
<li>Better support for styling slides and printing them</li>
|
||||
<li>Requires additional style rules, so new script won't work
|
||||
with old presentations without changes to their style sheets
|
||||
<ul>
|
||||
<li>See <a href="styles/slidy.css">slidy.css</a>, and
|
||||
<a href="styles/w3c-blue.css">w3c-blue.css</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>But old presentations will work unchanged as they refer to
|
||||
the old script!</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>To use it off-line</h1>
|
||||
|
||||
<ul>
|
||||
<li>You can download <a href="slidy.zip">slidy.zip</a> and unzip
|
||||
it to create a Slidy directory on your machine</li>
|
||||
|
||||
<li>If you have cvs access to the W3C site you can check out the Slidy
|
||||
directory</li>
|
||||
|
||||
<li>Remember to periodically check for updates</li>
|
||||
|
||||
<li>You then have two choices:
|
||||
|
||||
<ol>
|
||||
<li>Use relative URIs depending on your local setup to access the
|
||||
appropriate files. Use the same directory structure as on the W3C
|
||||
server, ie, ".../2005/Talks/...".</li>
|
||||
|
||||
<li>Run a Web server on your machine so that the directory above
|
||||
can be accessed via <code>http://localhost/Talks/Tools/Slidy2</code>
|
||||
and use the URIs of the form "/Talks/Tools/Slidy2/styles/slidy.css",
|
||||
"/Talks/Tools/Slidy2/scripts/slidy.js".</li>
|
||||
</ol></li>
|
||||
|
||||
<li>In both cases you can then publish your files on the W3C server
|
||||
unchanged.</li>
|
||||
|
||||
<li><strong>NOTE</strong> Internet Explorer on Windows XP now disables
|
||||
scripting for web pages loaded directly from the local file system,
|
||||
a work around is to use another browser, e.g. Firefox or Opera</li>
|
||||
|
||||
<li>Please feel free to create your own designs, and help us to build
|
||||
a gallery of Slidy styles.</li>
|
||||
|
||||
<li>My <a href="/2006/02/woa/">Google TechTalk</a> (1st Feb 2006)
|
||||
uses a notebook themed style</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Timing Your Presentation</h1>
|
||||
|
||||
<ul>
|
||||
<li>Sometimes it is handy to know just how much time you have to
|
||||
left to finish your presentation</li>
|
||||
<li>To get this feature, add the following markup to the
|
||||
content of the head element, replacing 5 by the duration
|
||||
of your presentation in minutes
|
||||
<pre><meta name="duration" content="5" /></pre>
|
||||
</li>
|
||||
<li>The time left in minutes and seconds is shown in the footer
|
||||
next to the slide number</li>
|
||||
<li>The clock starts to run when you move away from the first slide</li>
|
||||
<li>Moving back to the first slide pauses the clock</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="slide slanty">
|
||||
<h1>Generate a Title Page</h1>
|
||||
|
||||
<p>If you want a separate title page with the W3C blue style, the
|
||||
first slide should be as follows:</p>
|
||||
|
||||
<pre>
|
||||
<div class="slide cover">
|
||||
<img src="http://www.w3.org/Talks/Tools/Slidy2/graphics/keys.jpg"
|
||||
alt="Cover page images (keys)" class="cover" />
|
||||
<br clear="all" />
|
||||
<h1>HTML Slidy: Slide Shows in XHTML</h1>
|
||||
<p><a href="http://www.w3.org/People/Raggett/">Dave Raggett,</a>
|
||||
<a href="mailto:dsr@w3.org">dsr@w3.org</a></p>
|
||||
</div>
|
||||
</pre>
|
||||
|
||||
<p>The <a
|
||||
href="http://www.w3.org/Talks/Tools/Slidy2/graphics/w3c-blue.css">w3c-blue.css</a>
|
||||
style sheet looks for the classes "slide" and "cover" on div
|
||||
and img elements using the CSS selector <em>div.slide.cover</em></p>
|
||||
|
||||
<p>This technique can be used to assign your slides to different
|
||||
classes with a different appearence for each such class.</p>
|
||||
|
||||
<p>Slidy also allows you to use different background markup for
|
||||
different slides, based upon shared class names, as in "foo" below.
|
||||
Backgrounds without additional class names are always shown except
|
||||
when the slide isn't transparent. You may need to tweak your
|
||||
custom style sheet.</p>
|
||||
|
||||
<pre>
|
||||
<div class="background foo">
|
||||
... background content ...
|
||||
<div>
|
||||
|
||||
...
|
||||
|
||||
<div class="slide foo">
|
||||
... slide content ...
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Incremental display of slide contents</h1>
|
||||
|
||||
<p>For incremental display, use class="incremental", for
|
||||
instance:</p>
|
||||
|
||||
<ul class="incremental">
|
||||
<li>First bullet point</li>
|
||||
|
||||
<li>Second bullet point</li>
|
||||
|
||||
<li>Third bullet point</li>
|
||||
</ul>
|
||||
|
||||
<p class="incremental">which is marked up as follows:</p>
|
||||
|
||||
<pre class="incremental">
|
||||
<ul class="incremental">
|
||||
<li>First bullet point</li>
|
||||
<li>Second bullet point</li>
|
||||
<li>Third bullet point</li>
|
||||
</ul>
|
||||
|
||||
<p class="incremental">which is marked up as follows:</p>
|
||||
|
||||
<pre class="incremental">
|
||||
...
|
||||
</pre>
|
||||
</pre>
|
||||
|
||||
<div class="footnote">
|
||||
<p>An element is incrementally revealed if its parent element has
|
||||
class="incremental" or if itself has that attribute. Text nodes are
|
||||
not elements and are revealed when their parent element is revealed.
|
||||
You can use class="incremental" on any element except for <br />.
|
||||
Use class="non-incremental" to override the effect of setting the
|
||||
parent element's class to incremental.</p>
|
||||
|
||||
<p>Note: you will see a red asterisk on the left of the toolbar
|
||||
when there is still something more to reveal.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Create outline lists with hidden content</h1>
|
||||
|
||||
<p>You can make your bullet points or numbered list items
|
||||
into outlines that you can expand or collapse</p>
|
||||
|
||||
<ul class="outline">
|
||||
<li>Just add <em>class="outline"</em> to the ul or ol
|
||||
element. Click on this list item for more details.
|
||||
|
||||
<ul>
|
||||
<li>The Slidy script will then treat the list
|
||||
as an outline list.</li>
|
||||
<li>Clicking on outline list items will expand/collapse
|
||||
block-level elements within that list item.</li>
|
||||
<li>Click on the above to make this list item
|
||||
collapse again.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Users will then see expand/collapse icons as appropriate
|
||||
and may click anywhere on the list item to change its state.
|
||||
This particular list item can't be expanded or collapsed.</li>
|
||||
<li class="expand">Add class="expand" to any li elements that
|
||||
you want to start in an expanded state.
|
||||
|
||||
<ul>
|
||||
<li>By default Slidy hides all the block level elements within the
|
||||
outline list items unless you have specified class="expand".</li>
|
||||
<li>Such pre-expanded items can be collapsed by clicking on them.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Note expand/collapse icon highlighting requires browser
|
||||
support for :hover which isn't supported by IE6.
|
||||
|
||||
<ul>
|
||||
<li>Microsoft says it will be supported by IE7 along with
|
||||
many fixes for other CSS woes in IE6.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<pre>
|
||||
<ol class='outline'>
|
||||
<!-- topic 1 starts collapsed -->
|
||||
<li>Topic 1
|
||||
<ol>
|
||||
<li>subtopic a</li>
|
||||
<li>subtopic b</li>
|
||||
</ol>
|
||||
</li>
|
||||
<!-- topic 2 starts expanded -->
|
||||
<li class="expand">Topic 2
|
||||
<ol>
|
||||
<li>subtopic c</li>
|
||||
<li>subtopic d</li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<!-- useful info at http://www.howtocreate.co.uk/wrongWithIE/ -->
|
||||
<div class="slide">
|
||||
<h1>Make your images scale with the browser window size</h1>
|
||||
|
||||
<p>For adaptive layout, use percentage widths on images, together
|
||||
with CSS positioning:</p>
|
||||
|
||||
<ul>
|
||||
<li>CSS positioning is simpler and more reliable than using
|
||||
tables</li>
|
||||
</ul>
|
||||
|
||||
<pre>
|
||||
<div class="slide">
|
||||
<h1>Analysts - "Open standards programming will become
|
||||
mainstream, focused around VoiceXML"</h1>
|
||||
<!-- use CSS positioning and scaling for adaptive layout -->
|
||||
<img src="trends.png" width="50%" style="float:left"
|
||||
alt="projected growth of VoiceXML" />
|
||||
|
||||
<blockquote style="float:right;width: 35%">
|
||||
VoiceXML will dominate the voice environment, due to its
|
||||
flexibility and eventual multimodal capabilities
|
||||
</blockquote><br clear="all" />
|
||||
|
||||
<p style="text-align:center">Source Data Monitor, March
|
||||
2004</p>
|
||||
</div>
|
||||
</pre>
|
||||
|
||||
<p>To work around a CSS rendering bug in IE relating
|
||||
to margins, you can set display:inline on floated elements.</p>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Incremental display of layered images</h1>
|
||||
|
||||
<p>These can be marked up using CSS relative positioning, e.g.</p>
|
||||
|
||||
<pre>
|
||||
<div class="incremental"
|
||||
style="margin-left: 4em; position: relative">
|
||||
<img src="graphics/face1.gif" alt="face"
|
||||
style="position: static; vertical-align: bottom"/>
|
||||
<img src="graphics/face2.gif" alt="eyes"
|
||||
style="position: absolute; left: 0; top: 0" />
|
||||
<img src="graphics/face3.gif" alt="nose"
|
||||
style="position: absolute; left: 0; top: 0" />
|
||||
<img src="graphics/face4.gif" alt="mouth"
|
||||
style="position: absolute; left: 0; top: 0" />
|
||||
</div>
|
||||
</pre>
|
||||
|
||||
<p style="font-size: smaller;">You should also use transparent GIF
|
||||
images to avoid the IE/Win bug for alpha channel in PNG. A fix is
|
||||
expected in IE 7. A <a href=
|
||||
"http://www.skyzyx.com/scripts/sleight.php">work around</a> is
|
||||
available on skyzyx.com. My thanks to <a href=
|
||||
"http://www.webstandards.org/act/acid2/">ACID2</a> for the
|
||||
graphics.</p>
|
||||
|
||||
<div class="incremental" style=
|
||||
"margin-left: 4em; position: relative;"><img src="graphics/face1.gif" alt=
|
||||
"face" style="position: static; vertical-align: bottom;" />
|
||||
<img src="graphics/face2.gif" alt="eyes" style=
|
||||
"position: absolute; left: 0pt; top: 0pt;" /> <img src="graphics/face3.gif"
|
||||
alt="nose" style="position: absolute; left: 0pt; top: 0pt;" />
|
||||
<img src="graphics/face4.gif" alt="mouth" style=
|
||||
"position: absolute; left: 0pt; top: 0pt;" /></div>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>How to center content vertically and horizontally</h1>
|
||||
<div class="vbox"></div>
|
||||
<div class="hbox">
|
||||
<p>Within the div element for your slide:</p>
|
||||
<pre>
|
||||
<div class="vbox"></div>
|
||||
<div class="hbox">
|
||||
Place the content here
|
||||
</div>
|
||||
</pre>
|
||||
<p>and style it with the following:</p>
|
||||
<pre>
|
||||
div.vbox {
|
||||
float: left;
|
||||
height: 40%; width: 50%;
|
||||
margin-top: -220px;
|
||||
}
|
||||
div.hbox {
|
||||
width:60%; margin-top: 0;
|
||||
margin-left:auto; margin-right:auto;
|
||||
height: 60%;
|
||||
border:1px solid silver;
|
||||
background:#F0F0F0;
|
||||
overflow:auto;
|
||||
text-align:left;
|
||||
clear:both;
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>The above styling is included in <a href="styles/w3c-blue.css">w3c-blue.css</a>,
|
||||
which is designed to be used with <a href="styles/slidy.css">slidy.css</a>, but you
|
||||
are encouraged to develop your own style sheet with your own look and feel.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Include SVG Content</h1>
|
||||
|
||||
<p>Inclusion of SVG content can be done using the object element,
|
||||
for example:</p>
|
||||
|
||||
<div style="text-align: center;"><object data="graphics/example.svg" type=
|
||||
"image/svg+xml" title="Indian Office logo" height="10%" width=
|
||||
"50%"><img src="graphics/example.png" alt="Indian Office logo" width=
|
||||
"50%" /></object></div>
|
||||
|
||||
<p>has been achieved by:</p>
|
||||
|
||||
<pre>
|
||||
<object data="graphics/example.svg" type="image/svg+xml"
|
||||
width="50%" height="10%" title="Indian Office logo">
|
||||
<img src="graphics/example.png" width="50%"
|
||||
alt="Indian Office logo" />
|
||||
</object>
|
||||
</pre>
|
||||
|
||||
<p>This ensures that the enclosed png is displayed when the browser
|
||||
has no plugin installed or can't display SVG directly. Providing
|
||||
such a fall back is very important! Don't forget the alt text for
|
||||
people who can't see the image.</p>
|
||||
|
||||
<p>However, there are caveats, see the next slide!</p>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Caveats with SVG+object</h1>
|
||||
|
||||
<p>Adobe has recently withdrawn support for its SVG Viewer, so you are
|
||||
recommended to consider <a
|
||||
href="http://wiki.svg.org/Viewer_Implementations">alternatives</a>.
|
||||
If you still using the Adobe SVG viewer you should be aware of bugs
|
||||
when using the it with IE, Namely:</p>
|
||||
|
||||
<ul>
|
||||
<li>Most modern browsers generally support SVG SVG Tiny 1.1 or better
|
||||
natively without the need for a plugin</li>
|
||||
|
||||
<li>If you need to use Internet Explorer you are advised to upgrade
|
||||
to IE9 which includes native support for SVG.</li>
|
||||
|
||||
<li>Patches to Internet Explorer mean that the Adobe SVG Viewer
|
||||
version 3.03 no longer works with IE6. You are therefore recommended
|
||||
to uninstall version 3.03 and instead install <a
|
||||
href="http://www.adobe.com/svg/viewer/install/beta.html">Adobe SVG Viewer
|
||||
6.0 preview</a> if this is available to to you.</li>
|
||||
|
||||
<li>IE6 makes a <em>copy</em> of the SVG file on the local disc
|
||||
when displaying it; but doesn't pass the original URI to the plugin</li>
|
||||
|
||||
<li>As a result relative references from within the SVG to external
|
||||
resources (scripts, CSS, images, other SVG) will break.</li>
|
||||
|
||||
<li>The work around is to use absolute references within your SVG.</li>
|
||||
|
||||
<li>On Windows, the Adobe SVG plugin doesn't respect the CSS z-index
|
||||
property, and if used on backgrounds will always show through other
|
||||
content</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Additional Remarks</h1>
|
||||
|
||||
<ul>
|
||||
<li>Slides are auto-numbered on the slide show footer</li>
|
||||
|
||||
<li>You can link into the <a href="#(2)">middle</a> of a slide
|
||||
show:
|
||||
|
||||
<ul>
|
||||
<li>It works out which slide you want and hides the rest</li>
|
||||
|
||||
<li>You can even link between slides in the same slide show</li>
|
||||
|
||||
<li>Individual sides can be addressed with the syntax #(<em>slide
|
||||
number</em>),<br />
|
||||
e.g. slide 3 of this presentation is: <a href=
|
||||
"#(3)">http://www.w3.org/Talks/Tools/Slidy#(3)</a>
|
||||
<ul>
|
||||
<li>Previous versions of Slidy used square brackets, which will
|
||||
also work.</li>
|
||||
</ul></li>
|
||||
<li>Note that the browser's back/forward buttons may not work as
|
||||
you might expect due to browser problems.</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>Adding "title" to the list of classes for div elements that serve
|
||||
as title pages will render the corresponding entry in the table of
|
||||
contents in bold italic text (press "C" now for an example)</li>
|
||||
|
||||
<li>If your slides have more content than normal, use a <em>meta
|
||||
element</em> to request a smaller font
|
||||
|
||||
<ul>
|
||||
<li>the following requests fonts to be one step smaller than
|
||||
the Slidy default for the current window width, and positive
|
||||
integers will make the fonts correspondingly larger</li>
|
||||
</ul>
|
||||
|
||||
<pre>
|
||||
<meta name="font-size-adjustment" content="-1" />
|
||||
</pre>
|
||||
|
||||
<ul>
|
||||
<li>Slidy uses JavaScript to dynamically set the font size on the
|
||||
body element, but it is okay to specify relative font changes on
|
||||
other elements within your own style sheet, e.g.</li>
|
||||
</ul>
|
||||
<pre>div.slide.large { font-size: 200% }</pre>
|
||||
</li>
|
||||
|
||||
<li>You are encouraged to ensure your markup is valid. <a href=
|
||||
"http://www.w3.org/People/Raggett/tidy/">HTML Tidy</a> can be used
|
||||
to find and correct common markup problems</li>
|
||||
|
||||
<li>The slide show script and style sheet can be used freely under
|
||||
W3C's <a href=
|
||||
"http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> and <a href=
|
||||
"http://www.w3.org/Consortium/Legal/copyright-documents">document
|
||||
use</a> policies</li>
|
||||
<li>At <a href="http://xtech06.usefulinc.com/">XTech2006</a>
|
||||
I gave this <a href="http://www.w3.org/2006/05/Slidy-XTech/">presentation</a>
|
||||
on Slidy
|
||||
(<a href="http://www.w3.org/2006/05/Slidy-XTech/slidy-xtech06-dsr.pdf">Paper</a>).</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Localization and automatic translation</h1>
|
||||
|
||||
<p>Slidy now includes support for localization</p>
|
||||
|
||||
"es":this.strings_es,
|
||||
"ca":this.strings_ca,
|
||||
"cs":this.strings_cs,
|
||||
"nl":this.strings_nl,
|
||||
"de":this.strings_de,
|
||||
"pl":this.strings_pl,
|
||||
"fr":this.strings_fr,
|
||||
"hu":this.strings_hu,
|
||||
"it":this.strings_it,
|
||||
"el":this.strings_el,
|
||||
"jp":this.strings_ja,
|
||||
"zh":this.strings_zh,
|
||||
"ru":this.strings_ru,
|
||||
"sv":this.strings_sv
|
||||
|
||||
<ul>
|
||||
<li>The tool bar is localized according to the language of the presentation</li>
|
||||
<li>This is taken from the xml:lang or lang attributes on the html element</li>
|
||||
<li>The <a href="http://www.w3.org/Talks/Tools/Slidy2/help/help.html">help file</a> is
|
||||
selected based upon your browser's language preferences</li>
|
||||
<li>As of 29th July 2010, the languages supported are: English,
|
||||
Spanish, Catalonian, Czech, Dutch, German, Polish, French,
|
||||
Hungarian, Italian, Greek, Japanese, Chinese, Russian and
|
||||
Swedish</li>
|
||||
<li>If you would like to contribute localizations for other languages,
|
||||
please get in touch with Dave Raggett <dsr@w3.org></li>
|
||||
<li>The following illustrates what was used for Spanish</li>
|
||||
</ul>
|
||||
<pre>
|
||||
// for each language there is an associative array
|
||||
strings_es: {
|
||||
"slide":"pág.",
|
||||
"help?":"Ayuda",
|
||||
"contents?":"Índice",
|
||||
"table of contents":"tabla de contenidos",
|
||||
"Table of Contents":"Tabla de Contenidos",
|
||||
"restart presentation":"Reiniciar presentación",
|
||||
"restart?":"Inicio"
|
||||
},
|
||||
help_es:
|
||||
"Utilice el ratón, barra espaciadora, teclas Izda/Dcha, " +
|
||||
"o Re pág y Av pág. Use S y B para cambiar el tamaño de fuente.",
|
||||
</pre>
|
||||
|
||||
<p><strong>Note:</strong> Slidy now works with <a
|
||||
href="http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fwww.w3.org%2FTalks%2FTools%2FSlidy2%2F&sl=en&tl=fr&history_state0=">current slides translated into French</a>. Use
|
||||
right mouse button to open frame without Google header. To disable
|
||||
automatic translation of the content of particular elements add
|
||||
<code>class="notranslate"</code>, see <a href="http://googlewebmastercentral.blogspot.com/2008/10/helping-you-break-language-barrier.html">breaking the language barrier</a>.</p>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Future Plans</h1>
|
||||
|
||||
<p>Recent additions have included a table of contents, and a way to
|
||||
hide and reveal content in the spirit of outline lists. The
|
||||
script has been rewritten to make it easier to combine with other
|
||||
scripts, e.g. for UI controls, and support swipes for navigation on
|
||||
touch screen devices. Further work is anticipated on the
|
||||
following:</p>
|
||||
|
||||
<ul>
|
||||
<li>Collecting a gallery of good looking slide themes
|
||||
<ul>
|
||||
<li>Opportunities for graphics designers!</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Bob Ferris has worked on <a
|
||||
href="https://github.com/zazi/slidy_tud/blob/master/README.md">a
|
||||
number of UI extensions</a> which could be incorporated into the
|
||||
W3C slidy script.</li>
|
||||
<li>Getting SVG Tiny to work on IE without need for SVG plugin
|
||||
<ul>
|
||||
<li>Using scripts to dynamically convert SVG Tiny to VML</li>
|
||||
<li>Note that IE9 introduces native SVG support, so it may
|
||||
no longer be worth working on SVG to VML for rendering of SVG</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Pre-alpha version of wysiwyg slide editor (see <a
|
||||
href="editor/editor-screenshot1.png">screenshot</a>)
|
||||
<ul>
|
||||
<li>Using contentEditable when available, otherwise
|
||||
falling back to textarea and plain text conventions</li>
|
||||
<li>Using XMLHttpRequest to dynamically reflect changes to server</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Mechanism for remotely driving Slidy as part of distributed meetings
|
||||
<ul>
|
||||
<li>Using XMLHttpRequest to listen for navigation commands</li>
|
||||
<li>Using VoIP for accompanying audio and teleconferencing</li>
|
||||
<li>Synchronizing recorded spoken presentation with currently viewed slide</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Filters from PowerPoint and Open Office
|
||||
<ul>
|
||||
<li>and export to PDF via <a href="http://www.princexml.com/">PrinceXML</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>If you have comments, suggestions for improvements, or would
|
||||
like to volunteer your help with further work on Slidy,
|
||||
please contact <a href=
|
||||
"http://www.w3.org/People/Raggett/">Dave Raggett</a> <<a href=
|
||||
"mailto:dsr@w3.org">dsr@w3.org</a>></p>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Acknowledgements</h1>
|
||||
|
||||
<ul>
|
||||
<li>My thanks to everyone who sent in bug reports and feature
|
||||
requests</li>
|
||||
<li>Opera Software for implementing CSS @media projection and
|
||||
promoting the idea of using the Web for presentations with
|
||||
<a href="http://www.opera.com/support/tutorials/operashow/">Opera
|
||||
Show</a></li>
|
||||
<li><a href="http://tantek.com/">Tantek Çelik</a> for his
|
||||
pioneering work on applying JavaScript for slide presentations on
|
||||
other browsers</li>
|
||||
<li>Eric Meyer for taking this further with the excellent <a
|
||||
href="http://www.meyerweb.com/eric/tools/s5/s5-intro.html">S5</a></li>
|
||||
<li>W3C's <a href="http://dev.w3.org/cvsweb/slidemaker/">slidemaker
|
||||
tool</a>, which uses a perl script to split an html file up into
|
||||
one file per slide with navigation buttons</li>
|
||||
<li>Early versions of <a href="http://www.w3.org/People/Raggett/tidy/">HTML
|
||||
Tidy</a> which supported a means to create presentations via splitting
|
||||
html files on h2 elements</li>
|
||||
<li>Many sites with advice on JavaScript work arounds for browser
|
||||
variations</li>
|
||||
<li>Microsoft for pioneering contentEditable and XMLHTTP which
|
||||
both provide tremendous opportunities for Web applications</li>
|
||||
<li>Microsoft Office which provided the impetus for creating
|
||||
Slidy as a Web-based alternative to the ubiquitous use of PowerPoint</li>
|
||||
</ul>
|
||||
|
||||
<p class="smaller"><strong>Note</strong> that while Slidy and
|
||||
S5 were developed independently, both support the use of the
|
||||
class values "slide" and "handout" for div elements. Slidy doesn't
|
||||
support the "layout" class featured in S5 and Opera Show, but
|
||||
instead provides a more flexible alternative with the "background"
|
||||
class, which enables different backgrounds on different slides.</p>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Acknowledgements</h1>
|
||||
|
||||
<p>The following people have contributed localizations:</p>
|
||||
|
||||
<ul>
|
||||
<li>Emmanuelle Gutiérrez y Restrepo, Spanish</li>
|
||||
<li>Joan V. Baz, Catalan</li>
|
||||
<li>Jakub Vrána, Czech</li>
|
||||
<li>Ruud Steltenpool, Dutch</li>
|
||||
<li>Beat Vontobel, German</li>
|
||||
<li>Krzysztof Kotowicz, Polish</li>
|
||||
<li>Tamas Horvath, Hungarian</li>
|
||||
<li>Creso Moraes, Brazilian Portuguese</li>
|
||||
<li>Giuseppe Scollo, Italian</li>
|
||||
<li>Konstantinos Koukopoulos, Greek</li>
|
||||
<li>Yoshikazu Sawa (澤 義和), Japanese</li>
|
||||
<li>Shelley Shyan, Chinese</li>
|
||||
<li>Andrew Pantyukhin, Russian</li>
|
||||
<li>Saasha Metsärantala, Swedish</li>
|
||||
</ul>
|
||||
|
||||
<p>The following people have contributed bug reports:</p>
|
||||
|
||||
<ul>
|
||||
<li>Steve Robertson</li>
|
||||
<li>Ivan Herman</li>
|
||||
<li>Steve Bratt</li>
|
||||
<li>Peter Patel-Schneider</li>
|
||||
<li>Matthew Coller</li>
|
||||
<li>Rune Heggtveit</li>
|
||||
<li>Gopal Venkatesan</li>
|
||||
<li>Cay Horstmann</li>
|
||||
<li>Schuyler Duveen</li>
|
||||
<li>Matteo Nannini</li>
|
||||
<li>Ralph Swick</li>
|
||||
<li>Jakub Vrána</li>
|
||||
<li>Philip Bolt</li>
|
||||
<li>Jon Frost</li>
|
||||
<li>Jonathan Chetwynd</li>
|
||||
<li>Nicolas Frisby</li>
|
||||
</ul>
|
||||
|
||||
<p>Douglas Crockford for <a
|
||||
href="http://www.crockford.com/javascript/jsmin.html">jsmin</a>
|
||||
which was used to minify the script before compressing it with gzip.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
912
slidy2/Overview.xhtml
Normal file
|
|
@ -0,0 +1,912 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="generator" content=
|
||||
"HTML Tidy for Linux/x86 (vers 1st November 2003), see www.w3.org" />
|
||||
<title>HTML Slidy</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="copyright" content=
|
||||
"Copyright © 2005-2010 W3C (MIT, ERCIM, Keio)" />
|
||||
<meta name="duration" content="5" />
|
||||
<meta name="font-size-adjustment" content="-2" />
|
||||
<link rel="stylesheet" href="styles/slidy.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/w3c-blue.css" type="text/css" />
|
||||
<script src="scripts/slidy.js" charset="utf-8" type="text/javascript">
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="background"><img alt="" id="head-icon"
|
||||
src="graphics/icon-blue.png" /><object id="head-logo"
|
||||
data="graphics/w3c-logo-white.svg" type="image/svg+xml"
|
||||
title="W3C logo"><a href="http://www.w3.org/"><img
|
||||
alt="W3C logo" id="head-logo-fallback"
|
||||
src="graphics/w3c-logo-white.gif" /></a></object></div>
|
||||
|
||||
<div class="background slanty">
|
||||
<img src="graphics/w3c-logo-slanted.jpg" alt="slanted W3C logo" />
|
||||
</div>
|
||||
<div class="slide cover title">
|
||||
<!-- hidden style graphics to ensure they are saved with other content -->
|
||||
<img class="hidden" src="graphics/bullet.png" alt="" />
|
||||
<img class="hidden" src="graphics/fold.gif" alt="" />
|
||||
<img class="hidden" src="graphics/unfold.gif" alt="" />
|
||||
<img class="hidden" src="graphics/fold-dim.gif" alt="" />
|
||||
<img class="hidden" src="graphics/nofold-dim.gif" alt="" />
|
||||
<img class="hidden" src="graphics/unfold-dim.gif" alt="" />
|
||||
<img class="hidden" src="graphics/bullet-fold.gif" alt="" />
|
||||
<img class="hidden" src="graphics/bullet-unfold.gif" alt="" />
|
||||
<img class="hidden" src="graphics/bullet-fold-dim.gif" alt="" />
|
||||
<img class="hidden" src="graphics/bullet-nofold-dim.gif" alt="" />
|
||||
<img class="hidden" src="graphics/bullet-unfold-dim.gif" alt="" />
|
||||
|
||||
<img src="graphics/keys2.jpg" alt="Cover page images (keys)"
|
||||
class="cover" /><br clear="all" />
|
||||
<h1>HTML Slidy: Slide Shows in HTML and XHTML</h1>
|
||||
|
||||
<p><a href="http://www.w3.org/People/Raggett/">Dave Raggett</a>,
|
||||
<<a href="mailto:dsr@w3.org">dsr@w3.org</a>><br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br /><em>Hit the space bar or swipe left for next slide</em></p>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Slide Shows in HTML and XHTML</h1>
|
||||
|
||||
<ul>
|
||||
<li>You can now create accessible slide shows with ease</li>
|
||||
|
||||
<li>Works across browsers and is operated like PowerPoint
|
||||
|
||||
<ul>
|
||||
<li>Advance to next slide with mouse click, space bar or swipe left</li>
|
||||
|
||||
<li>Move forward/backward between slides with Cursor Left,
|
||||
Cursor Right, <strong>Pg Up</strong> and <strong>Pg Dn</strong>
|
||||
keys, or swipe left or right</li>
|
||||
|
||||
<li><strong>Home</strong> key for first slide, <strong>End</strong>
|
||||
key for last slide</li>
|
||||
|
||||
<li>The "<strong>C</strong>" key for an automatically generated
|
||||
table of contents, or click on "contents" on the toolbar or
|
||||
swipe up or down</li>
|
||||
|
||||
<li>Function <strong>F11</strong> to go full screen and back</li>
|
||||
|
||||
<li>The "<strong>F</strong>" key toggles the display of the footer</li>
|
||||
|
||||
<li>The "<strong>A</strong>" key toggles display of current vs all
|
||||
slides
|
||||
|
||||
<ul>
|
||||
<li>Try it now to see how to include notes for handouts (this is
|
||||
explained in the notes following this slide)</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>Font sizes automatically adapt to browser window size
|
||||
|
||||
<ul>
|
||||
<li>use <strong>S</strong> and <strong>B</strong> keys for
|
||||
manual control (or < and >, or the <strong>-</strong> and
|
||||
<strong>+</strong> keys on the number pad</li>
|
||||
<li>Use CSS to set a relative font size on a given slide to make
|
||||
the content bigger or smaller than on other slides</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>Switching off JavaScript reveals all slides</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><em>Now move to next slide to see how it works</em></li>
|
||||
</ul>
|
||||
|
||||
<p class="copyright"><a rel="Copyright" href=
|
||||
"http://www.w3.org/Consortium/Legal/ipr-notice#Copyright" shape=
|
||||
"rect">Copyright</a> © 2005-2010 <a href="/"><acronym title=
|
||||
"World Wide Web Consortium">W3C</acronym></a> <sup>®</sup>
|
||||
(<a href="http://www.csail.mit.edu/"><acronym title=
|
||||
"Massachusetts Institute of Technology">MIT</acronym></a>, <a href=
|
||||
"http://www.ercim.org/"><acronym title=
|
||||
"European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights
|
||||
Reserved.</p>
|
||||
</div>
|
||||
|
||||
<div class="handout">
|
||||
<p>For handouts, its often useful to include extra notes using a
|
||||
div element with class="handout" following each slide, as in:</p>
|
||||
|
||||
<pre>
|
||||
<div class="slide">
|
||||
<em>... your slide content ...</em>
|
||||
</div>
|
||||
|
||||
<div class="handout">
|
||||
<em>... stuff that only appears in the handouts ...</em>
|
||||
</div>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>What you need to do</h1>
|
||||
|
||||
<ul>
|
||||
<li>Each presentation is a single XHTML file</li>
|
||||
|
||||
<li>Each slide is enclosed in <em><div class="slide"> ...
|
||||
</div></em>
|
||||
|
||||
<ul>
|
||||
<li>The div element will be created automatically for h1
|
||||
elements that are direct children of the body element.</li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li>Use regular markup within each slide</li>
|
||||
|
||||
<li>The document head includes two links:
|
||||
<ul>
|
||||
<li>The slide show style sheet:
|
||||
<a href=
|
||||
"http://www.w3.org/Talks/Tools/Slidy2/styles/slidy.css">http://www.w3.org/Talks/Tools/Slidy2/styles/slidy.css</a></li>
|
||||
|
||||
<li>The slide show script: <a href=
|
||||
"http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js">http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js</a></li>
|
||||
|
||||
<li>Or you can link to the compressed version of the script which is about
|
||||
one seventh the size, see <a href=
|
||||
"http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js.gz">http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js.gz</a></li>
|
||||
<li>If you are using XHTML, remember to use </script> and
|
||||
</style> as per <a
|
||||
href="http://www.w3.org/TR/xhtml1/#C_3">Appendix C.3</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<pre>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<title>Slide Shows in XHTML</title>
|
||||
<meta name="copyright"
|
||||
content="Copyright &#169; 2005 your copyright notice" />
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="http://www.w3.org/Talks/Tools/Slidy2/styles/slidy.css" />
|
||||
<script src="http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js"
|
||||
charset="utf-8" type="text/javascript"></script>
|
||||
<style type="text/css">
|
||||
<!-- your custom style rules -->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
... your slides marked up in XHTML ...
|
||||
</body>
|
||||
</html>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>To get the W3C Blue Style</h1>
|
||||
|
||||
<p>The head element should include the following link to the style
|
||||
sheet:</p>
|
||||
|
||||
<pre>
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection, print"
|
||||
href="http://www.w3.org/Talks/Tools/Slidy2/styles/w3c-blue.css" />
|
||||
</pre>
|
||||
|
||||
<p>The body element's content should start with the following
|
||||
markup:</p>
|
||||
|
||||
<pre>
|
||||
<div class="background">
|
||||
<img id="head-icon" alt="graphic with four colored squares"
|
||||
src="http://www.w3.org/Talks/Tools/Slidy2/graphics/icon-blue.png" />
|
||||
<object id="head-logo" title="W3C logo" type="image/svg+xml"
|
||||
data="http://www.w3.org/Talks/Tools/Slidy2/graphics/w3c-logo-white.svg"><img
|
||||
src="http://www.w3.org/Talks/Tools/Slidy2/graphics/w3c-logo-white.gif"
|
||||
alt="W3C logo" id="head-logo-fallback" /></object>
|
||||
</div>
|
||||
</pre>
|
||||
|
||||
<p>This adds the logos on the top left and right corners of the
|
||||
slide.</p>
|
||||
|
||||
<p>You are of course welcome to create your own slide designs.
|
||||
You can provide different styles and backgrounds for
|
||||
different slides (more details later).</p>
|
||||
|
||||
<p>Use the <em>meta element</em> with <em>name="copyright"</em>
|
||||
for use in the slide show footer:</p>
|
||||
|
||||
<pre>
|
||||
<meta name="copyright"
|
||||
content="Copyright &#169; 2005-2009 W3C (MIT, ERCIM, Keio)" />
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Upgrading from previous versions of Slidy</h1>
|
||||
|
||||
<ul>
|
||||
<li>This uses a new version of the HTML Slidy script</li>
|
||||
<li>It is designed to work better with other scripts,
|
||||
e.g. for UI controls within your slides
|
||||
<ul>
|
||||
<li>Only adds one global name "w3c_slidy"</li>
|
||||
<li>Doesn't interfere with other scripts that set event handers
|
||||
such as onload on body element</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Works for slides delivered as text/html and application/xhtml+xml</li>
|
||||
<li>New presentation timer feature</li>
|
||||
<li>Initial prompt on first slide to help newcomers to Slidy</li>
|
||||
<li>Better support for styling slides and printing them</li>
|
||||
<li>Requires additional style rules, so new script won't work
|
||||
with old presentations without changes to their style sheets
|
||||
<ul>
|
||||
<li>See <a href="styles/slidy.css">slidy.css</a>, and
|
||||
<a href="styles/w3c-blue.css">w3c-blue.css</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>But old presentations will work unchanged as they refer to
|
||||
the old script!</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>To use it off-line</h1>
|
||||
|
||||
<ul>
|
||||
<li>You can download <a href="slidy.zip">slidy.zip</a> and unzip
|
||||
it to create a Slidy directory on your machine</li>
|
||||
|
||||
<li>If you have cvs access to the W3C site you can check out the Slidy
|
||||
directory</li>
|
||||
|
||||
<li>Remember to periodically check for updates</li>
|
||||
|
||||
<li>You then have two choices:
|
||||
|
||||
<ol>
|
||||
<li>Use relative URIs depending on your local setup to access the
|
||||
appropriate files. Use the same directory structure as on the W3C
|
||||
server, ie, ".../2005/Talks/...".</li>
|
||||
|
||||
<li>Run a Web server on your machine so that the directory above
|
||||
can be accessed via <code>http://localhost/Talks/Tools/Slidy2</code>
|
||||
and use the URIs of the form "/Talks/Tools/Slidy2/styles/slidy.css",
|
||||
"/Talks/Tools/Slidy2/scripts/slidy.js".</li>
|
||||
</ol></li>
|
||||
|
||||
<li>In both cases you can then publish your files on the W3C server
|
||||
unchanged.</li>
|
||||
|
||||
<li><strong>NOTE</strong> Internet Explorer on Windows XP now disables
|
||||
scripting for web pages loaded directly from the local file system,
|
||||
a work around is to use another browser, e.g. Firefox or Opera</li>
|
||||
|
||||
<li>Please feel free to create your own designs, and help us to build
|
||||
a gallery of Slidy styles.</li>
|
||||
|
||||
<li>My <a href="/2006/02/woa/">Google TechTalk</a> (1st Feb 2006)
|
||||
uses a notebook themed style</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Timing Your Presentation</h1>
|
||||
|
||||
<ul>
|
||||
<li>Sometimes it is handy to know just how much time you have to
|
||||
left to finish your presentation</li>
|
||||
<li>To get this feature, add the following markup to the
|
||||
content of the head element, replacing 5 by the duration
|
||||
of your presentation in minutes
|
||||
<pre><meta name="duration" content="5" /></pre>
|
||||
</li>
|
||||
<li>The time left in minutes and seconds is shown in the footer
|
||||
next to the slide number</li>
|
||||
<li>The clock starts to run when you move away from the first slide</li>
|
||||
<li>Moving back to the first slide pauses the clock</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="slide slanty">
|
||||
<h1>Generate a Title Page</h1>
|
||||
|
||||
<p>If you want a separate title page with the W3C blue style, the
|
||||
first slide should be as follows:</p>
|
||||
|
||||
<pre>
|
||||
<div class="slide cover">
|
||||
<img src="http://www.w3.org/Talks/Tools/Slidy2/graphics/keys.jpg"
|
||||
alt="Cover page images (keys)" class="cover" />
|
||||
<br clear="all" />
|
||||
<h1>HTML Slidy: Slide Shows in XHTML</h1>
|
||||
<p><a href="http://www.w3.org/People/Raggett/">Dave Raggett,</a>
|
||||
<a href="mailto:dsr@w3.org">dsr@w3.org</a></p>
|
||||
</div>
|
||||
</pre>
|
||||
|
||||
<p>The <a
|
||||
href="http://www.w3.org/Talks/Tools/Slidy2/graphics/w3c-blue.css">w3c-blue.css</a>
|
||||
style sheet looks for the classes "slide" and "cover" on div
|
||||
and img elements using the CSS selector <em>div.slide.cover</em></p>
|
||||
|
||||
<p>This technique can be used to assign your slides to different
|
||||
classes with a different appearence for each such class.</p>
|
||||
|
||||
<p>Slidy also allows you to use different background markup for
|
||||
different slides, based upon shared class names, as in "foo" below.
|
||||
Backgrounds without additional class names are always shown except
|
||||
when the slide isn't transparent. You may need to tweak your
|
||||
custom style sheet.</p>
|
||||
|
||||
<pre>
|
||||
<div class="background foo">
|
||||
... background content ...
|
||||
<div>
|
||||
|
||||
...
|
||||
|
||||
<div class="slide foo">
|
||||
... slide content ...
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Incremental display of slide contents</h1>
|
||||
|
||||
<p>For incremental display, use class="incremental", for
|
||||
instance:</p>
|
||||
|
||||
<ul class="incremental">
|
||||
<li>First bullet point</li>
|
||||
|
||||
<li>Second bullet point</li>
|
||||
|
||||
<li>Third bullet point</li>
|
||||
</ul>
|
||||
|
||||
<p class="incremental">which is marked up as follows:</p>
|
||||
|
||||
<pre class="incremental">
|
||||
<ul class="incremental">
|
||||
<li>First bullet point</li>
|
||||
<li>Second bullet point</li>
|
||||
<li>Third bullet point</li>
|
||||
</ul>
|
||||
|
||||
<p class="incremental">which is marked up as follows:</p>
|
||||
|
||||
<pre class="incremental">
|
||||
...
|
||||
</pre>
|
||||
</pre>
|
||||
|
||||
<div class="footnote">
|
||||
<p>An element is incrementally revealed if its parent element has
|
||||
class="incremental" or if itself has that attribute. Text nodes are
|
||||
not elements and are revealed when their parent element is revealed.
|
||||
You can use class="incremental" on any element except for <br />.
|
||||
Use class="non-incremental" to override the effect of setting the
|
||||
parent element's class to incremental.</p>
|
||||
|
||||
<p>Note: you will see a red asterisk on the left of the toolbar
|
||||
when there is still something more to reveal.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Create outline lists with hidden content</h1>
|
||||
|
||||
<p>You can make your bullet points or numbered list items
|
||||
into outlines that you can expand or collapse</p>
|
||||
|
||||
<ul class="outline">
|
||||
<li>Just add <em>class="outline"</em> to the ul or ol
|
||||
element. Click on this list item for more details.
|
||||
|
||||
<ul>
|
||||
<li>The Slidy script will then treat the list
|
||||
as an outline list.</li>
|
||||
<li>Clicking on outline list items will expand/collapse
|
||||
block-level elements within that list item.</li>
|
||||
<li>Click on the above to make this list item
|
||||
collapse again.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Users will then see expand/collapse icons as appropriate
|
||||
and may click anywhere on the list item to change its state.
|
||||
This particular list item can't be expanded or collapsed.</li>
|
||||
<li class="expand">Add class="expand" to any li elements that
|
||||
you want to start in an expanded state.
|
||||
|
||||
<ul>
|
||||
<li>By default Slidy hides all the block level elements within the
|
||||
outline list items unless you have specified class="expand".</li>
|
||||
<li>Such pre-expanded items can be collapsed by clicking on them.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Note expand/collapse icon highlighting requires browser
|
||||
support for :hover which isn't supported by IE6.
|
||||
|
||||
<ul>
|
||||
<li>Microsoft says it will be supported by IE7 along with
|
||||
many fixes for other CSS woes in IE6.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<pre>
|
||||
<ol class='outline'>
|
||||
<!-- topic 1 starts collapsed -->
|
||||
<li>Topic 1
|
||||
<ol>
|
||||
<li>subtopic a</li>
|
||||
<li>subtopic b</li>
|
||||
</ol>
|
||||
</li>
|
||||
<!-- topic 2 starts expanded -->
|
||||
<li class="expand">Topic 2
|
||||
<ol>
|
||||
<li>subtopic c</li>
|
||||
<li>subtopic d</li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<!-- useful info at http://www.howtocreate.co.uk/wrongWithIE/ -->
|
||||
<div class="slide">
|
||||
<h1>Make your images scale with the browser window size</h1>
|
||||
|
||||
<p>For adaptive layout, use percentage widths on images, together
|
||||
with CSS positioning:</p>
|
||||
|
||||
<ul>
|
||||
<li>CSS positioning is simpler and more reliable than using
|
||||
tables</li>
|
||||
</ul>
|
||||
|
||||
<pre>
|
||||
<div class="slide">
|
||||
<h1>Analysts - "Open standards programming will become
|
||||
mainstream, focused around VoiceXML"</h1>
|
||||
<!-- use CSS positioning and scaling for adaptive layout -->
|
||||
<img src="trends.png" width="50%" style="float:left"
|
||||
alt="projected growth of VoiceXML" />
|
||||
|
||||
<blockquote style="float:right;width: 35%">
|
||||
VoiceXML will dominate the voice environment, due to its
|
||||
flexibility and eventual multimodal capabilities
|
||||
</blockquote><br clear="all" />
|
||||
|
||||
<p style="text-align:center">Source Data Monitor, March
|
||||
2004</p>
|
||||
</div>
|
||||
</pre>
|
||||
|
||||
<p>To work around a CSS rendering bug in IE relating
|
||||
to margins, you can set display:inline on floated elements.</p>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Incremental display of layered images</h1>
|
||||
|
||||
<p>These can be marked up using CSS relative positioning, e.g.</p>
|
||||
|
||||
<pre>
|
||||
<div class="incremental"
|
||||
style="margin-left: 4em; position: relative">
|
||||
<img src="graphics/face1.gif" alt="face"
|
||||
style="position: static; vertical-align: bottom"/>
|
||||
<img src="graphics/face2.gif" alt="eyes"
|
||||
style="position: absolute; left: 0; top: 0" />
|
||||
<img src="graphics/face3.gif" alt="nose"
|
||||
style="position: absolute; left: 0; top: 0" />
|
||||
<img src="graphics/face4.gif" alt="mouth"
|
||||
style="position: absolute; left: 0; top: 0" />
|
||||
</div>
|
||||
</pre>
|
||||
|
||||
<p style="font-size: smaller;">You should also use transparent GIF
|
||||
images to avoid the IE/Win bug for alpha channel in PNG. A fix is
|
||||
expected in IE 7. A <a href=
|
||||
"http://www.skyzyx.com/scripts/sleight.php">work around</a> is
|
||||
available on skyzyx.com. My thanks to <a href=
|
||||
"http://www.webstandards.org/act/acid2/">ACID2</a> for the
|
||||
graphics.</p>
|
||||
|
||||
<div class="incremental" style=
|
||||
"margin-left: 4em; position: relative;"><img src="graphics/face1.gif" alt=
|
||||
"face" style="position: static; vertical-align: bottom;" />
|
||||
<img src="graphics/face2.gif" alt="eyes" style=
|
||||
"position: absolute; left: 0pt; top: 0pt;" /> <img src="graphics/face3.gif"
|
||||
alt="nose" style="position: absolute; left: 0pt; top: 0pt;" />
|
||||
<img src="graphics/face4.gif" alt="mouth" style=
|
||||
"position: absolute; left: 0pt; top: 0pt;" /></div>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>How to center content vertically and horizontally</h1>
|
||||
<div class="vbox"></div>
|
||||
<div class="hbox">
|
||||
<p>Within the div element for your slide:</p>
|
||||
<pre>
|
||||
<div class="vbox"></div>
|
||||
<div class="hbox">
|
||||
Place the content here
|
||||
</div>
|
||||
</pre>
|
||||
<p>and style it with the following:</p>
|
||||
<pre>
|
||||
div.vbox {
|
||||
float: left;
|
||||
height: 40%; width: 50%;
|
||||
margin-top: -220px;
|
||||
}
|
||||
div.hbox {
|
||||
width:60%; margin-top: 0;
|
||||
margin-left:auto; margin-right:auto;
|
||||
height: 60%;
|
||||
border:1px solid silver;
|
||||
background:#F0F0F0;
|
||||
overflow:auto;
|
||||
text-align:left;
|
||||
clear:both;
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>The above styling is included in <a href="styles/w3c-blue.css">w3c-blue.css</a>,
|
||||
which is designed to be used with <a href="styles/slidy.css">slidy.css</a>, but you
|
||||
are encouraged to develop your own style sheet with your own look and feel.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Include SVG Content</h1>
|
||||
|
||||
<p>Inclusion of SVG content can be done using the object element,
|
||||
for example:</p>
|
||||
|
||||
<div style="text-align: center;"><object data="graphics/example.svg" type=
|
||||
"image/svg+xml" title="Indian Office logo" height="10%" width=
|
||||
"50%"><img src="graphics/example.png" alt="Indian Office logo" width=
|
||||
"50%" /></object></div>
|
||||
|
||||
<p>has been achieved by:</p>
|
||||
|
||||
<pre>
|
||||
<object data="graphics/example.svg" type="image/svg+xml"
|
||||
width="50%" height="10%" title="Indian Office logo">
|
||||
<img src="graphics/example.png" width="50%"
|
||||
alt="Indian Office logo" />
|
||||
</object>
|
||||
</pre>
|
||||
|
||||
<p>This ensures that the enclosed png is displayed when the browser
|
||||
has no plugin installed or can't display SVG directly. Providing
|
||||
such a fall back is very important! Don't forget the alt text for
|
||||
people who can't see the image.</p>
|
||||
|
||||
<p>However, there are caveats, see the next slide!</p>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Caveats with SVG+object</h1>
|
||||
|
||||
<p>Adobe has recently withdrawn support for its SVG Viewer, so you are
|
||||
recommended to consider <a
|
||||
href="http://wiki.svg.org/Viewer_Implementations">alternatives</a>.
|
||||
If you still using the Adobe SVG viewer you should be aware of bugs
|
||||
when using the it with IE, Namely:</p>
|
||||
|
||||
<ul>
|
||||
<li>Most modern browsers generally support SVG SVG Tiny 1.1 or better
|
||||
natively without the need for a plugin</li>
|
||||
|
||||
<li>If you need to use Internet Explorer you are advised to upgrade
|
||||
to IE9 which includes native support for SVG.</li>
|
||||
|
||||
<li>Patches to Internet Explorer mean that the Adobe SVG Viewer
|
||||
version 3.03 no longer works with IE6. You are therefore recommended
|
||||
to uninstall version 3.03 and instead install <a
|
||||
href="http://www.adobe.com/svg/viewer/install/beta.html">Adobe SVG Viewer
|
||||
6.0 preview</a> if this is available to to you.</li>
|
||||
|
||||
<li>IE6 makes a <em>copy</em> of the SVG file on the local disc
|
||||
when displaying it; but doesn't pass the original URI to the plugin</li>
|
||||
|
||||
<li>As a result relative references from within the SVG to external
|
||||
resources (scripts, CSS, images, other SVG) will break.</li>
|
||||
|
||||
<li>The work around is to use absolute references within your SVG.</li>
|
||||
|
||||
<li>On Windows, the Adobe SVG plugin doesn't respect the CSS z-index
|
||||
property, and if used on backgrounds will always show through other
|
||||
content</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Additional Remarks</h1>
|
||||
|
||||
<ul>
|
||||
<li>Slides are auto-numbered on the slide show footer</li>
|
||||
|
||||
<li>You can link into the <a href="#(2)">middle</a> of a slide
|
||||
show:
|
||||
|
||||
<ul>
|
||||
<li>It works out which slide you want and hides the rest</li>
|
||||
|
||||
<li>You can even link between slides in the same slide show</li>
|
||||
|
||||
<li>Individual sides can be addressed with the syntax #(<em>slide
|
||||
number</em>),<br />
|
||||
e.g. slide 3 of this presentation is: <a href=
|
||||
"#(3)">http://www.w3.org/Talks/Tools/Slidy#(3)</a>
|
||||
<ul>
|
||||
<li>Previous versions of Slidy used square brackets, which will
|
||||
also work.</li>
|
||||
</ul></li>
|
||||
<li>Note that the browser's back/forward buttons may not work as
|
||||
you might expect due to browser problems.</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>Adding "title" to the list of classes for div elements that serve
|
||||
as title pages will render the corresponding entry in the table of
|
||||
contents in bold italic text (press "C" now for an example)</li>
|
||||
|
||||
<li>If your slides have more content than normal, use a <em>meta
|
||||
element</em> to request a smaller font
|
||||
|
||||
<ul>
|
||||
<li>the following requests fonts to be one step smaller than
|
||||
the Slidy default for the current window width, and positive
|
||||
integers will make the fonts correspondingly larger</li>
|
||||
</ul>
|
||||
|
||||
<pre>
|
||||
<meta name="font-size-adjustment" content="-1" />
|
||||
</pre>
|
||||
|
||||
<ul>
|
||||
<li>Slidy uses JavaScript to dynamically set the font size on the
|
||||
body element, but it is okay to specify relative font changes on
|
||||
other elements within your own style sheet, e.g.</li>
|
||||
</ul>
|
||||
<pre>div.slide.large { font-size: 200% }</pre>
|
||||
</li>
|
||||
|
||||
<li>You are encouraged to ensure your markup is valid. <a href=
|
||||
"http://www.w3.org/People/Raggett/tidy/">HTML Tidy</a> can be used
|
||||
to find and correct common markup problems</li>
|
||||
|
||||
<li>The slide show script and style sheet can be used freely under
|
||||
W3C's <a href=
|
||||
"http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> and <a href=
|
||||
"http://www.w3.org/Consortium/Legal/copyright-documents">document
|
||||
use</a> policies</li>
|
||||
<li>At <a href="http://xtech06.usefulinc.com/">XTech2006</a>
|
||||
I gave this <a href="http://www.w3.org/2006/05/Slidy-XTech/">presentation</a>
|
||||
on Slidy
|
||||
(<a href="http://www.w3.org/2006/05/Slidy-XTech/slidy-xtech06-dsr.pdf">Paper</a>).</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Localization and automatic translation</h1>
|
||||
|
||||
<p>Slidy now includes support for localization</p>
|
||||
|
||||
"es":this.strings_es,
|
||||
"ca":this.strings_ca,
|
||||
"cs":this.strings_cs,
|
||||
"nl":this.strings_nl,
|
||||
"de":this.strings_de,
|
||||
"pl":this.strings_pl,
|
||||
"fr":this.strings_fr,
|
||||
"hu":this.strings_hu,
|
||||
"it":this.strings_it,
|
||||
"el":this.strings_el,
|
||||
"jp":this.strings_ja,
|
||||
"zh":this.strings_zh,
|
||||
"ru":this.strings_ru,
|
||||
"sv":this.strings_sv
|
||||
|
||||
<ul>
|
||||
<li>The tool bar is localized according to the language of the presentation</li>
|
||||
<li>This is taken from the xml:lang or lang attributes on the html element</li>
|
||||
<li>The <a href="http://www.w3.org/Talks/Tools/Slidy2/help/help.html">help file</a> is
|
||||
selected based upon your browser's language preferences</li>
|
||||
<li>As of 29th July 2010, the languages supported are: English,
|
||||
Spanish, Catalonian, Czech, Dutch, German, Polish, French,
|
||||
Hungarian, Italian, Greek, Japanese, Chinese, Russian and
|
||||
Swedish</li>
|
||||
<li>If you would like to contribute localizations for other languages,
|
||||
please get in touch with Dave Raggett <dsr@w3.org></li>
|
||||
<li>The following illustrates what was used for Spanish</li>
|
||||
</ul>
|
||||
<pre>
|
||||
// for each language there is an associative array
|
||||
strings_es: {
|
||||
"slide":"pág.",
|
||||
"help?":"Ayuda",
|
||||
"contents?":"Índice",
|
||||
"table of contents":"tabla de contenidos",
|
||||
"Table of Contents":"Tabla de Contenidos",
|
||||
"restart presentation":"Reiniciar presentación",
|
||||
"restart?":"Inicio"
|
||||
},
|
||||
help_es:
|
||||
"Utilice el ratón, barra espaciadora, teclas Izda/Dcha, " +
|
||||
"o Re pág y Av pág. Use S y B para cambiar el tamaño de fuente.",
|
||||
</pre>
|
||||
|
||||
<p><strong>Note:</strong> Slidy now works with <a
|
||||
href="http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fwww.w3.org%2FTalks%2FTools%2FSlidy2%2F&sl=en&tl=fr&history_state0=">current slides translated into French</a>. Use
|
||||
right mouse button to open frame without Google header. To disable
|
||||
automatic translation of the content of particular elements add
|
||||
<code>class="notranslate"</code>, see <a href="http://googlewebmastercentral.blogspot.com/2008/10/helping-you-break-language-barrier.html">breaking the language barrier</a>.</p>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Future Plans</h1>
|
||||
|
||||
<p>Recent additions have included a table of contents, and a way to
|
||||
hide and reveal content in the spirit of outline lists. The
|
||||
script has been rewritten to make it easier to combine with other
|
||||
scripts, e.g. for UI controls, and support swipes for navigation on
|
||||
touch screen devices. Further work is anticipated on the
|
||||
following:</p>
|
||||
|
||||
<ul>
|
||||
<li>Collecting a gallery of good looking slide themes
|
||||
<ul>
|
||||
<li>Opportunities for graphics designers!</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Bob Ferris has worked on <a
|
||||
href="https://github.com/zazi/slidy_tud/blob/master/README.md">a
|
||||
number of UI extensions</a> which could be incorporated into the
|
||||
W3C slidy script.</li>
|
||||
<li>Getting SVG Tiny to work on IE without need for SVG plugin
|
||||
<ul>
|
||||
<li>Using scripts to dynamically convert SVG Tiny to VML</li>
|
||||
<li>Note that IE9 introduces native SVG support, so it may
|
||||
no longer be worth working on SVG to VML for rendering of SVG</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Pre-alpha version of wysiwyg slide editor (see <a
|
||||
href="editor/editor-screenshot1.png">screenshot</a>)
|
||||
<ul>
|
||||
<li>Using contentEditable when available, otherwise
|
||||
falling back to textarea and plain text conventions</li>
|
||||
<li>Using XMLHttpRequest to dynamically reflect changes to server</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Mechanism for remotely driving Slidy as part of distributed meetings
|
||||
<ul>
|
||||
<li>Using XMLHttpRequest to listen for navigation commands</li>
|
||||
<li>Using VoIP for accompanying audio and teleconferencing</li>
|
||||
<li>Synchronizing recorded spoken presentation with currently viewed slide</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Filters from PowerPoint and Open Office
|
||||
<ul>
|
||||
<li>and export to PDF via <a href="http://www.princexml.com/">PrinceXML</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>If you have comments, suggestions for improvements, or would
|
||||
like to volunteer your help with further work on Slidy,
|
||||
please contact <a href=
|
||||
"http://www.w3.org/People/Raggett/">Dave Raggett</a> <<a href=
|
||||
"mailto:dsr@w3.org">dsr@w3.org</a>></p>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Acknowledgements</h1>
|
||||
|
||||
<ul>
|
||||
<li>My thanks to everyone who sent in bug reports and feature
|
||||
requests</li>
|
||||
<li>Opera Software for implementing CSS @media projection and
|
||||
promoting the idea of using the Web for presentations with
|
||||
<a href="http://www.opera.com/support/tutorials/operashow/">Opera
|
||||
Show</a></li>
|
||||
<li><a href="http://tantek.com/">Tantek Çelik</a> for his
|
||||
pioneering work on applying JavaScript for slide presentations on
|
||||
other browsers</li>
|
||||
<li>Eric Meyer for taking this further with the excellent <a
|
||||
href="http://www.meyerweb.com/eric/tools/s5/s5-intro.html">S5</a></li>
|
||||
<li>W3C's <a href="http://dev.w3.org/cvsweb/slidemaker/">slidemaker
|
||||
tool</a>, which uses a perl script to split an html file up into
|
||||
one file per slide with navigation buttons</li>
|
||||
<li>Early versions of <a href="http://www.w3.org/People/Raggett/tidy/">HTML
|
||||
Tidy</a> which supported a means to create presentations via splitting
|
||||
html files on h2 elements</li>
|
||||
<li>Many sites with advice on JavaScript work arounds for browser
|
||||
variations</li>
|
||||
<li>Microsoft for pioneering contentEditable and XMLHTTP which
|
||||
both provide tremendous opportunities for Web applications</li>
|
||||
<li>Microsoft Office which provided the impetus for creating
|
||||
Slidy as a Web-based alternative to the ubiquitous use of PowerPoint</li>
|
||||
</ul>
|
||||
|
||||
<p class="smaller"><strong>Note</strong> that while Slidy and
|
||||
S5 were developed independently, both support the use of the
|
||||
class values "slide" and "handout" for div elements. Slidy doesn't
|
||||
support the "layout" class featured in S5 and Opera Show, but
|
||||
instead provides a more flexible alternative with the "background"
|
||||
class, which enables different backgrounds on different slides.</p>
|
||||
</div>
|
||||
|
||||
<div class="slide">
|
||||
<h1>Acknowledgements</h1>
|
||||
|
||||
<p>The following people have contributed localizations:</p>
|
||||
|
||||
<ul>
|
||||
<li>Emmanuelle Gutiérrez y Restrepo, Spanish</li>
|
||||
<li>Joan V. Baz, Catalan</li>
|
||||
<li>Jakub Vrána, Czech</li>
|
||||
<li>Ruud Steltenpool, Dutch</li>
|
||||
<li>Beat Vontobel, German</li>
|
||||
<li>Krzysztof Kotowicz, Polish</li>
|
||||
<li>Tamas Horvath, Hungarian</li>
|
||||
<li>Creso Moraes, Brazilian Portuguese</li>
|
||||
<li>Giuseppe Scollo, Italian</li>
|
||||
<li>Konstantinos Koukopoulos, Greek</li>
|
||||
<li>Yoshikazu Sawa (澤 義和), Japanese</li>
|
||||
<li>Shelley Shyan, Chinese</li>
|
||||
<li>Andrew Pantyukhin, Russian</li>
|
||||
<li>Saasha Metsärantala, Swedish</li>
|
||||
</ul>
|
||||
|
||||
<p>The following people have contributed bug reports:</p>
|
||||
|
||||
<ul>
|
||||
<li>Steve Robertson</li>
|
||||
<li>Ivan Herman</li>
|
||||
<li>Steve Bratt</li>
|
||||
<li>Peter Patel-Schneider</li>
|
||||
<li>Matthew Coller</li>
|
||||
<li>Rune Heggtveit</li>
|
||||
<li>Gopal Venkatesan</li>
|
||||
<li>Cay Horstmann</li>
|
||||
<li>Schuyler Duveen</li>
|
||||
<li>Matteo Nannini</li>
|
||||
<li>Ralph Swick</li>
|
||||
<li>Jakub Vrána</li>
|
||||
<li>Philip Bolt</li>
|
||||
<li>Jon Frost</li>
|
||||
<li>Jonathan Chetwynd</li>
|
||||
<li>Nicolas Frisby</li>
|
||||
</ul>
|
||||
|
||||
<p>Douglas Crockford for <a
|
||||
href="http://www.crockford.com/javascript/jsmin.html">jsmin</a>
|
||||
which was used to minify the script before compressing it with gzip.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
30
slidy2/blank.html
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US">
|
||||
<head>
|
||||
<meta name="generator" content=
|
||||
"HTML Tidy for Linux/x86 (vers 1st November 2003), see www.w3.org" />
|
||||
<title>HTML Slidy - template for basic presentations</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="copyright" content=
|
||||
"Copyright © 2005-2010 W3C (MIT, ERCIM, Keio)" />
|
||||
<meta name="duration" content="20" />
|
||||
<link rel="stylesheet" href="http://www.w3.org/Talks/Tools/Slidy2/styles/slidy.css" type="text/css" />
|
||||
<script src="http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js" charset="utf-8" type="text/javascript">
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="slide">
|
||||
<h1>Sample heading</h1>
|
||||
|
||||
<p>This is a template file you can copy and edit on your own server.</p>
|
||||
|
||||
<ul>
|
||||
<li>point 1</li>
|
||||
<li>point 2</li>
|
||||
<li>. . .</li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
slidy2/graphics/bullet-fold-dim.gif
Normal file
|
After Width: | Height: | Size: 161 B |
BIN
slidy2/graphics/bullet-fold-dim.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
slidy2/graphics/bullet-fold.gif
Normal file
|
After Width: | Height: | Size: 163 B |
BIN
slidy2/graphics/bullet-fold.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
slidy2/graphics/bullet-nofold-dim.gif
Normal file
|
After Width: | Height: | Size: 142 B |
BIN
slidy2/graphics/bullet-nofold-dim.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
slidy2/graphics/bullet-nofold.gif
Normal file
|
After Width: | Height: | Size: 157 B |
BIN
slidy2/graphics/bullet-nofold.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
slidy2/graphics/bullet-unfold-dim.gif
Normal file
|
After Width: | Height: | Size: 166 B |
BIN
slidy2/graphics/bullet-unfold-dim.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
slidy2/graphics/bullet-unfold.gif
Normal file
|
After Width: | Height: | Size: 163 B |
BIN
slidy2/graphics/bullet-unfold.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
slidy2/graphics/bullet.gif
Normal file
|
After Width: | Height: | Size: 86 B |
BIN
slidy2/graphics/bullet.png
Normal file
|
After Width: | Height: | Size: 167 B |
BIN
slidy2/graphics/example.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
223
slidy2/graphics/example.svg
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
viewBox="-0.724 -0.46 279 52" xml:space="preserve">
|
||||
<desc>W3C Indian Office logo</desc>
|
||||
<defs>
|
||||
</defs>
|
||||
<g>
|
||||
<rect x="107.669" y="15.986" style="fill:#0C479D" width="163.338" height="13.73"/>
|
||||
<path style="fill:#FFFFFF" d="M117.042,25.062c-0.6,0.853-1.279,1.812-2.692,1.812c-0.879,0-1.985-0.574-1.985-2.052
|
||||
c0-2.039,1.919-4.277,3.758-4.277c1.053,0,1.532,0.586,1.532,1.172c0,0.6-0.333,0.96-0.839,0.96c-0.36,0-0.759-0.239-0.759-0.693
|
||||
c0-0.372,0.28-0.586,0.28-0.772c0-0.174-0.187-0.227-0.307-0.227c-1.16,0-1.959,2.799-1.959,3.745
|
||||
c0,1.065,0.587,1.293,0.973,1.293c0.6,0,1.093-0.428,1.626-1.201L117.042,25.062z"/>
|
||||
<path style="fill:#FFFFFF" d="M134.227,22.596c0,1.985-1.652,4.278-3.784,4.278c-1.093,0-2.132-0.705-2.132-1.986
|
||||
c0-2.053,1.719-4.344,3.825-4.344C132.641,20.544,134.227,20.81,134.227,22.596z M129.896,25.554c0,0.268,0,0.934,0.693,0.934
|
||||
c1.279,0,2.052-3.705,2.052-4.705c0-0.666-0.293-0.852-0.64-0.852C130.562,20.931,129.896,24.702,129.896,25.554z"/>
|
||||
<path style="fill:#FFFFFF" d="M151.587,25.076c-0.426,0.718-1.053,1.746-2.092,1.746c-0.213,0-0.934,0-0.934-0.867
|
||||
c0-0.946,1.174-3.864,1.174-4.157c0-0.161-0.16-0.294-0.334-0.294c-0.333,0-1.679,0.666-2.852,5.197h-1.612
|
||||
c0.679-2.544,1.359-4.744,1.359-5.077c0-0.347-0.36-0.347-0.72-0.347v-0.36c0.293,0,1.612-0.119,2.665-0.359l-0.8,2.479
|
||||
l0.04,0.027c0.96-1.412,1.679-2.519,2.839-2.519c0.32,0,1.013,0.025,1.013,1.052c0,0.866-1.159,3.692-1.159,4.079
|
||||
c0,0.119,0.053,0.24,0.199,0.24c0.268,0,0.574-0.48,0.92-1.013L151.587,25.076z"/>
|
||||
<path style="fill:#FFFFFF" d="M166.562,22.596l-0.36-0.026c-0.106-0.666-0.387-1.586-1.173-1.586c-0.706,0-0.706,0.652-0.706,0.72
|
||||
c0,0.839,1.825,2.013,1.825,3.385c0,1.292-1.146,1.786-1.998,1.786c-0.587,0-0.92-0.266-1.227-0.266
|
||||
c-0.053,0-0.32,0.039-0.387,0.266h-0.359l0.293-2.211l0.36,0.039c0.199,1.772,1.159,1.772,1.278,1.772
|
||||
c0.507,0,0.76-0.398,0.76-0.732c0-0.346-0.319-0.879-0.746-1.373c-0.693-0.799-1.066-1.346-1.066-2.158
|
||||
c0-1.187,0.92-1.666,1.786-1.666c0.666,0,0.826,0.293,1.267,0.293c0.199,0,0.239-0.054,0.373-0.28h0.386L166.562,22.596z"/>
|
||||
<path style="fill:#FFFFFF" d="M183.493,22.596c0,1.985-1.653,4.278-3.785,4.278c-1.093,0-2.132-0.705-2.132-1.986
|
||||
c0-2.053,1.719-4.344,3.824-4.344C181.907,20.544,183.493,20.81,183.493,22.596z M179.161,25.554c0,0.268,0,0.934,0.694,0.934
|
||||
c1.278,0,2.052-3.705,2.052-4.705c0-0.666-0.293-0.852-0.64-0.852C179.828,20.931,179.161,24.702,179.161,25.554z"/>
|
||||
<path style="fill:#FFFFFF" d="M194.643,20.917c1.359-0.119,1.772-0.146,2.665-0.372l-0.746,2.372l0.066,0.026
|
||||
c0.4-0.8,1.188-2.398,2.066-2.398c0.053,0,0.772,0,0.772,0.879c0,0.613-0.373,0.973-0.786,0.973c-0.466,0-0.613-0.506-0.8-0.506
|
||||
c-0.373,0-1.065,1.333-1.359,2.039c-0.347,0.893-0.479,1.532-0.906,2.771h-1.612c0.707-2.398,1.359-4.636,1.359-5.064
|
||||
c0-0.333-0.24-0.346-0.72-0.359V20.917z"/>
|
||||
<path style="fill:#FFFFFF" d="M213.214,21.277h-1.105c-0.44,1.626-1.16,3.958-1.16,4.412c0,0.16,0.187,0.199,0.2,0.199
|
||||
c0.333,0,0.853-0.786,1.026-1.066l0.293,0.187c-0.494,0.774-1.146,1.813-2.187,1.813c-0.959,0-0.959-0.799-0.959-0.893
|
||||
c0-0.547,0.64-2.546,1.227-4.652h-0.681V20.81c0.521-0.199,1.533-0.612,2.439-2.024h0.467l-0.52,1.932h0.959V21.277z"/>
|
||||
<path style="fill:#FFFFFF" d="M226.346,25.008c-0.68,1.04-1.239,1.813-2.226,1.813c-0.773,0-0.92-0.574-0.92-0.893
|
||||
c0-0.586,1.04-3.918,1.04-4.225c0-0.427-0.4-0.439-0.787-0.427v-0.36c0.534-0.039,1.786-0.159,2.692-0.372
|
||||
c-0.52,1.905-1.333,4.717-1.333,5.144c0,0.133,0.121,0.199,0.201,0.199c0.319,0,0.771-0.666,1.039-1.066L226.346,25.008z
|
||||
M225.759,17.585c0.507,0,0.92,0.413,0.92,0.906c0,0.479-0.399,0.88-0.92,0.88c-0.626,0-0.879-0.56-0.879-0.906
|
||||
C224.88,18.145,225.159,17.585,225.759,17.585z"/>
|
||||
<path style="fill:#FFFFFF" d="M243.436,25.102c-0.254,0.452-0.999,1.719-2.119,1.719c-0.2,0-0.893,0-0.893-0.746
|
||||
c0-0.574,0.16-1.027,0.293-1.427l-0.026-0.013c-1.014,1.413-1.572,2.186-2.586,2.186c-1.025,0-1.025-0.732-1.025-1.039
|
||||
c0-0.92,0.999-3.345,0.999-4.119c0-0.347-0.293-0.36-0.746-0.387v-0.36c1.186-0.053,2.599-0.359,2.785-0.372l-1.253,4.104
|
||||
c-0.16,0.507-0.199,0.654-0.199,0.894c0,0.252,0.133,0.318,0.307,0.318c0.532,0,1.345-1.265,1.519-1.584
|
||||
c0.6-1.08,0.906-2.133,1.319-3.559h1.573c-0.268,0.934-1.374,4.518-1.374,4.944c0,0.227,0.134,0.254,0.2,0.254
|
||||
c0.32,0,0.826-0.8,0.946-0.987L243.436,25.102z"/>
|
||||
<path style="fill:#FFFFFF" d="M254.745,20.917c1.412-0.119,1.745-0.146,2.665-0.359l-0.8,2.479l0.04,0.027
|
||||
c0.772-1.187,1.64-2.519,2.825-2.519c0.066,0,0.879,0,0.879,0.893c0,0.52-0.187,0.973-0.307,1.279l0.014,0.027
|
||||
c0.68-1.08,1.466-2.199,2.559-2.199c0.733,0,1.054,0.466,1.054,1.052c0,0.88-1.187,3.599-1.187,4.118
|
||||
c0,0.16,0.146,0.201,0.227,0.201c0.254,0,0.68-0.667,0.906-1.013l0.293,0.174c-0.413,0.707-1.026,1.746-2.092,1.746
|
||||
c-0.227,0-0.934,0-0.934-0.867c0-0.972,1.173-3.811,1.173-4.13c0-0.16-0.106-0.307-0.319-0.307c-0.561,0-1.266,1.159-1.479,1.546
|
||||
c-0.493,0.853-0.68,1.453-1.346,3.637h-1.6c1.026-3.318,1.466-4.49,1.466-4.864c0-0.253-0.159-0.319-0.253-0.319
|
||||
c-0.093,0-1.572,0.333-2.812,5.183h-1.612c0.759-2.785,1.359-4.636,1.359-5.077c0-0.386-0.521-0.359-0.72-0.347V20.917z"/>
|
||||
<path d="M123.286,1.771h2.012l-4.572,15.43h-0.206l-2.858-9.555l-2.857,9.555h-0.183l-4.572-15.43h2.012l2.743,9.396l1.874-6.332
|
||||
l-0.914-3.063h2.012l2.743,9.396L123.286,1.771z"/>
|
||||
<path d="M189.955,1.453h2.012l-4.572,15.43h-0.206l-2.856-9.555l-2.857,9.555h-0.184l-4.572-15.43h2.013l2.743,9.396l1.874-6.333
|
||||
l-0.914-3.063h2.012l2.742,9.396L189.955,1.453z"/>
|
||||
<path d="M244.878,1.453h2.012l-4.572,15.43h-0.205l-2.858-9.555l-2.857,9.555h-0.183l-4.572-15.43h2.012l2.743,9.396l1.874-6.333
|
||||
l-0.914-3.063h2.012l2.744,9.396L244.878,1.453z"/>
|
||||
<path d="M248.27,3.238h6.096v2.024h-4.048v2.438h4.048v2.048h-4.048v3.658h4.048v2.024h-6.096V3.238z"/>
|
||||
<path d="M257.815,3.238h4.268c1.805,0,3.268,1.463,3.268,3.243c0,0.829-0.268,1.463-0.707,2.024
|
||||
c0.927,0.707,1.512,1.731,1.512,3.072c0,2.122-1.73,3.853-3.853,3.853c-0.22,0-4.487,0-4.487,0V3.238z M259.863,7.701h2.22
|
||||
c0.683,0,1.219-0.537,1.219-1.22c0-0.658-0.536-1.219-1.219-1.219c-0.171,0-2.22,0-2.22,0V7.701z M259.863,13.407h2.439
|
||||
c0.999,0,1.829-0.829,1.829-1.829c0-1.024-0.83-1.829-1.829-1.829c-0.391,0-2.439,0-2.439,0V13.407z"/>
|
||||
<path d="M130.116,3.042c2.756,0,4.268,2.829,4.268,6.292s-1.512,6.291-4.268,6.291c-2.731,0-4.268-2.828-4.268-6.291
|
||||
S127.385,3.042,130.116,3.042z M130.116,13.602c1.17,0,2.122-1.926,2.122-4.267c0-2.341-0.951-4.268-2.122-4.268
|
||||
c-1.146,0-2.122,1.926-2.122,4.268C127.994,11.675,128.97,13.602,130.116,13.602z"/>
|
||||
<path d="M146.575,15.431h-2.487l-2.927-4.072c-0.487,0-1.487,0-1.487,0v4.072h-2.049V3.238h3.878c2.219,0,4.048,1.829,4.048,4.072
|
||||
c0,1.561-0.878,2.926-2.194,3.609L146.575,15.431z M143.526,7.31c0-1.122-0.902-2.048-2.023-2.048c-0.22,0-1.829,0-1.829,0v4.072
|
||||
h1.829C142.624,9.334,143.526,8.407,143.526,7.31z"/>
|
||||
<path d="M151.256,13.407h4.048v2.024h-6.096V3.238h2.048V13.407z"/>
|
||||
<path d="M156.724,3.238h2.853c3.024,0,5.487,2.731,5.487,6.097c0,3.365-2.463,6.096-5.487,6.096c-0.269,0-2.853,0-2.853,0V3.238z
|
||||
M158.771,13.407h0.805c1.78,0,3.243-1.829,3.243-4.072c0-2.244-1.463-4.072-3.243-4.072c-0.316,0-0.805,0-0.805,0V13.407z"/>
|
||||
<path d="M200.331,3.238h2.854c3.023,0,5.487,2.731,5.487,6.097c0,3.365-2.464,6.096-5.487,6.096c-0.269,0-2.854,0-2.854,0V3.238z
|
||||
M202.38,13.407h0.805c1.78,0,3.243-1.829,3.243-4.072c0-2.244-1.463-4.072-3.243-4.072c-0.316,0-0.805,0-0.805,0V13.407z"/>
|
||||
<path d="M211.913,3.238h6.097v2.024h-4.048v2.438h4.048v2.048h-4.048v3.658h4.048v2.024h-6.097V3.238z"/>
|
||||
<rect x="194.518" y="3.188" width="1.786" height="12.203"/>
|
||||
<path style="fill-rule:evenodd;clip-rule:evenodd" d="M274.845,25.169c-0.659,0-1.251,0.238-1.699,0.693c-0.477,0.482-0.741,1.109-0.741,1.754
|
||||
c0,0.646,0.252,1.244,0.714,1.713c0.469,0.477,1.074,0.734,1.727,0.734c0.639,0,1.258-0.258,1.74-0.729
|
||||
c0.463-0.447,0.714-1.045,0.714-1.719c0-0.652-0.259-1.264-0.707-1.719C276.122,25.42,275.511,25.169,274.845,25.169z
|
||||
M276.973,27.638c0,0.564-0.218,1.086-0.619,1.475c-0.421,0.408-0.944,0.625-1.522,0.625c-0.544,0-1.081-0.225-1.481-0.633
|
||||
c-0.401-0.408-0.626-0.932-0.626-1.488s0.231-1.102,0.646-1.521c0.389-0.395,0.911-0.606,1.482-0.606
|
||||
c0.585,0,1.107,0.217,1.517,0.633C276.762,26.515,276.973,27.046,276.973,27.638z M274.913,26.183h-1.047v2.773h0.522v-1.184
|
||||
h0.518l0.563,1.184h0.585l-0.618-1.264c0.4-0.082,0.632-0.355,0.632-0.75C276.068,26.44,275.688,26.183,274.913,26.183z
|
||||
M274.817,26.522c0.49,0,0.713,0.135,0.713,0.475c0,0.326-0.223,0.443-0.699,0.443h-0.442v-0.918H274.817z"/>
|
||||
<path d="M93.451,0l1.056,6.42l-3.738,7.152c0,0-1.436-3.034-3.82-4.714c-2.009-1.416-3.318-1.723-5.364-1.301
|
||||
c-2.628,0.542-5.608,3.685-6.908,7.559c-1.556,4.636-1.571,6.879-1.625,8.94c-0.087,3.304,0.434,5.256,0.434,5.256
|
||||
s-2.27-4.199-2.249-10.349c0.015-4.389,0.704-8.371,2.736-12.299c1.787-3.454,4.443-5.526,6.8-5.77
|
||||
c2.437-0.252,4.363,0.923,5.852,2.194c1.562,1.334,3.143,4.253,3.143,4.253L93.451,0z"/>
|
||||
<path d="M93.911,36.329c0,0-1.653,2.953-2.682,4.091c-1.03,1.138-2.872,3.143-5.147,4.146c-2.275,1.001-3.468,1.191-5.716,0.975
|
||||
c-2.246-0.216-4.334-1.517-5.066-2.06c-0.731-0.541-2.601-2.14-3.657-3.629c-1.057-1.49-2.709-4.471-2.709-4.471
|
||||
s0.921,2.986,1.497,4.254c0.332,0.729,1.351,2.96,2.797,4.902c1.349,1.813,3.969,4.932,7.951,5.635
|
||||
c3.982,0.705,6.719-1.083,7.396-1.517c0.677-0.433,2.104-1.628,3.007-2.594c0.943-1.009,1.835-2.296,2.33-3.067
|
||||
c0.361-0.564,0.948-1.707,0.948-1.707L93.911,36.329z"/>
|
||||
<path style="fill:#0C479D" d="M25.146,0.284l9.003,30.611l9.003-30.611h6.519L34.771,50.576h-0.621l-9.313-31.168l-9.314,31.168h-0.621
|
||||
L0,0.284h6.519l9.003,30.611l6.085-20.614l-2.98-9.997H25.146z"/>
|
||||
<path style="fill:#0C479D" d="M68.184,34.434c0,4.554-1.211,8.383-3.632,11.487c-2.422,3.104-5.558,4.655-9.407,4.655
|
||||
c-2.898,0-5.423-0.921-7.576-2.763c-2.152-1.842-3.746-4.335-4.781-7.481l5.091-2.11c0.746,1.904,1.729,3.405,2.95,4.501
|
||||
c1.221,1.097,2.659,1.645,4.315,1.645c1.738,0,3.208-0.972,4.409-2.917s1.801-4.284,1.801-7.017c0-3.022-0.642-5.36-1.925-7.017
|
||||
c-1.491-1.945-3.83-2.918-7.017-2.918h-2.483v-2.98l8.693-15.026H48.128l-2.918,4.967h-1.862V0.284h24.215v3.042l-9.19,15.833
|
||||
c3.229,1.036,5.671,2.919,7.326,5.652C67.354,27.542,68.184,30.749,68.184,34.434z"/>
|
||||
<g>
|
||||
<g>
|
||||
<g>
|
||||
<path d="M135.359,42.137h-4.523v1.736c0.018,0.145,0.018,0.249,0,0.313c-0.075,0.21-0.261,0.314-0.558,0.314
|
||||
c-0.299,0-0.909-0.407-1.831-1.219c-0.922-0.814-1.382-1.357-1.382-1.631c0-0.146,0.093-0.272,0.278-0.385
|
||||
c0.186-0.113,0.324-0.17,0.418-0.17h1.671v-3.802c0-0.337-0.105-0.602-0.318-0.794c-0.212-0.192-0.567-0.29-1.064-0.29
|
||||
c-0.388,0-0.692,0.104-0.914,0.313s-0.332,0.503-0.332,0.886c0,0.271,0.067,0.552,0.202,0.838
|
||||
c0.039,0.095,0.115,0.217,0.231,0.361h-1.27c-0.094-0.163-0.16-0.293-0.197-0.389c-0.151-0.323-0.226-0.59-0.226-0.799
|
||||
c0-0.728,0.246-1.267,0.738-1.621c0.491-0.355,1.118-0.534,1.879-0.534c0.743,0,1.375,0.194,1.894,0.582
|
||||
c0.52,0.387,0.78,0.887,0.78,1.499v3.75h4.523V42.137z M133.104,36.527h-1.116v-0.945h1.116V36.527z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M139.753,36.527h-3.214v11.124h-1.404V36.527h-2.376v-0.945h6.995V36.527z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M145.448,36.527h-3.215v11.124h-1.403V36.527h-2.376v-0.945h6.995V36.527z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M156.204,36.527h-3.776v3.074c0,0.388-0.101,0.75-0.303,1.09c-0.205,0.34-0.556,0.614-1.056,0.822
|
||||
c-0.259,0.114-0.514,0.198-0.763,0.253c-0.25,0.058-0.522,0.088-0.819,0.088c-0.352,0-0.646-0.042-0.888-0.128
|
||||
c0.166,0.211,0.296,0.381,0.388,0.509c0.59,0.774,1.097,1.413,1.521,1.913c0.369,0.403,0.94,0.977,1.714,1.719
|
||||
c0.24,0.227,0.572,0.541,0.996,0.945l-1.01,0.849c-0.628-0.6-1.307-1.285-2.036-2.061c-0.729-0.776-1.399-1.535-2.008-2.28
|
||||
c-0.776-0.984-1.451-1.904-2.023-2.763c-0.203-0.289-0.434-0.653-0.692-1.092l1.082-0.701l1.082,1.649
|
||||
c0.092,0.145,0.287,0.273,0.583,0.388c0.295,0.112,0.619,0.17,0.971,0.17c0.61,0,1.072-0.138,1.388-0.412
|
||||
c0.313-0.273,0.471-0.634,0.471-1.087v-2.945h-6.875v-0.945h12.055V36.527z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M163.116,36.527h-7.771v-0.945h7.771V36.527z M165.354,40.09h-5.216c-0.663,0-1.141,0.116-1.436,0.348
|
||||
c-0.295,0.234-0.441,0.552-0.441,0.954c0,1.125,0.615,2.34,1.848,3.643c0.401,0.434,1.028,0.98,1.873,1.64l-0.886,0.796
|
||||
c-0.939-0.708-1.642-1.304-2.101-1.789c-1.401-1.464-2.102-2.857-2.102-4.179c0-0.742,0.233-1.309,0.705-1.705
|
||||
c0.47-0.393,1.092-0.592,1.866-0.592h5.889V40.09z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M169.777,36.527h-3.214v11.124h-1.404V36.527h-2.377v-0.945h6.995V36.527z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M175.486,36.527h-3.192v11.124h-1.404V36.527h-2.411v-0.945h2.391c-0.35-0.916-0.671-1.6-0.964-2.049
|
||||
c-0.921-1.365-2.052-2.05-3.395-2.05c-0.625,0-1.09,0.17-1.393,0.507c-0.304,0.337-0.456,0.785-0.456,1.347
|
||||
c0,0.546,0.145,1.099,0.432,1.66c0.091,0.177,0.235,0.4,0.433,0.674h-1.267c-0.221-0.291-0.378-0.533-0.47-0.727
|
||||
c-0.33-0.612-0.495-1.154-0.495-1.622c0-0.921,0.284-1.613,0.856-2.08c0.571-0.468,1.345-0.704,2.321-0.704
|
||||
c1.825,0,3.32,0.841,4.479,2.522c0.369,0.549,0.765,1.389,1.19,2.521h3.344V36.527z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M184.403,44.03c-0.333,0.241-0.628,0.419-0.885,0.533c-0.776,0.357-1.635,0.537-2.574,0.537
|
||||
c-1.551,0-2.755-0.447-3.613-1.342c-0.857-0.895-1.287-1.896-1.287-3.008c0.075,0.029,0.133,0.045,0.171,0.045
|
||||
c0.316,0.074,0.57,0.112,0.758,0.112c0.729,0,1.29-0.145,1.684-0.438c0.466-0.337,0.701-0.861,0.701-1.571
|
||||
c0-0.485-0.223-1.025-0.669-1.621c-0.148-0.194-0.371-0.444-0.669-0.751h-3.846v-0.945h8.172v0.945h-2.672
|
||||
c0.242,0.322,0.419,0.589,0.531,0.798c0.371,0.646,0.555,1.196,0.555,1.646c0,1.066-0.514,1.856-1.545,2.372
|
||||
c-0.334,0.161-0.858,0.322-1.577,0.484c0.185,0.531,0.378,0.926,0.579,1.182c0.627,0.806,1.539,1.208,2.737,1.208
|
||||
c0.755,0,1.444-0.18,2.07-0.534c0.753-0.436,1.212-0.864,1.379-1.284V44.03z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M188.993,36.527h-3.216v11.124h-1.404V36.527h-2.375v-0.945h6.995V36.527z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M215.396,36.527h-8.921v3.529c0.221-0.279,0.424-0.483,0.607-0.614c0.57-0.41,1.252-0.614,2.041-0.614
|
||||
c1.087,0,1.96,0.281,2.622,0.847c0.662,0.566,0.994,1.285,0.994,2.155c0,0.791-0.451,1.729-1.352,2.81
|
||||
c-0.293,0.356-0.753,0.824-1.379,1.405l-1.158-0.73c0.549-0.468,0.95-0.858,1.206-1.166c0.804-0.924,1.207-1.742,1.207-2.456
|
||||
c0-0.582-0.171-1.049-0.509-1.397c-0.341-0.349-0.831-0.521-1.473-0.521c-0.753,0-1.408,0.324-1.967,0.972
|
||||
c-0.562,0.649-0.841,1.249-0.841,1.801v5.105h-1.403v-3.497c-0.238,0.191-0.442,0.333-0.605,0.429
|
||||
c-0.57,0.303-1.179,0.453-1.818,0.453c-1.049,0-1.944-0.318-2.688-0.956c-0.744-0.634-1.115-1.405-1.115-2.308
|
||||
s0.361-1.654,1.083-2.259c0.724-0.604,1.597-0.905,2.622-0.905c0.273,0,0.566,0.034,0.878,0.109
|
||||
c0.092,0.015,0.22,0.051,0.385,0.11v1.07c-0.129-0.07-0.231-0.123-0.305-0.159c-0.294-0.124-0.57-0.187-0.829-0.187
|
||||
c-0.664,0-1.232,0.21-1.713,0.632c-0.479,0.421-0.718,0.93-0.718,1.527c0,0.648,0.213,1.206,0.637,1.674
|
||||
c0.426,0.472,0.98,0.704,1.665,0.704c0.628,0,1.164-0.168,1.606-0.507c0.61-0.469,0.916-0.886,0.916-1.259v-5.797h-8.172
|
||||
v-0.945h18.496V36.527z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M220.87,36.527h-3.216v11.124h-1.404V36.527h-2.375v-0.945h6.995V36.527z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M229.798,44.03c-0.33,0.241-0.626,0.419-0.885,0.533c-0.773,0.357-1.633,0.537-2.572,0.537
|
||||
c-1.551,0-2.755-0.447-3.611-1.342c-0.858-0.895-1.287-1.896-1.287-3.008c0.075,0.029,0.13,0.045,0.167,0.045
|
||||
c0.32,0.074,0.572,0.112,0.76,0.112c0.729,0,1.29-0.145,1.684-0.438c0.468-0.337,0.701-0.861,0.701-1.571
|
||||
c0-0.485-0.223-1.025-0.669-1.621c-0.15-0.194-0.371-0.444-0.668-0.751h-3.847v-0.945h8.172v0.945h-2.67
|
||||
c0.242,0.322,0.417,0.589,0.527,0.798c0.371,0.646,0.559,1.196,0.559,1.646c0,1.066-0.518,1.856-1.549,2.372
|
||||
c-0.33,0.161-0.856,0.322-1.577,0.484c0.186,0.531,0.378,0.926,0.583,1.182c0.626,0.806,1.539,1.208,2.735,1.208
|
||||
c0.755,0,1.444-0.18,2.068-0.534c0.756-0.436,1.216-0.864,1.379-1.284V44.03z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M234.388,36.527h-3.214v11.124h-1.404V36.527h-2.375v-0.945h6.993V36.527z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M240.085,36.527h-3.216v11.124h-1.405V36.527h-2.375v-0.945h6.996V36.527z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M238.137,31.033c-0.146-0.065-0.275-0.104-0.386-0.122c-0.331-0.081-0.68-0.119-1.048-0.119
|
||||
c-0.514,0-0.931,0.135-1.253,0.402c-0.321,0.268-0.483,0.671-0.483,1.208c0,0.668,0.307,1.418,0.916,2.246
|
||||
c0.203,0.263,0.508,0.604,0.913,1.028h-1.078c-0.148-0.05-0.497-0.455-1.051-1.215c-0.664-0.925-0.994-1.742-0.994-2.454
|
||||
c0-0.794,0.304-1.368,0.909-1.727c0.496-0.291,1.158-0.436,1.983-0.436c0.403,0,0.79,0.046,1.156,0.141
|
||||
c0.112,0.034,0.248,0.08,0.415,0.145V31.033z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M251.558,36.527H239.78v-0.945h11.777V36.527z M252.608,40.539c-0.313,0.048-0.572,0.097-0.773,0.146
|
||||
c-0.593,0.176-1.104,0.457-1.537,0.844c-0.435,0.384-0.807,0.842-1.122,1.37c-0.238,0.403-0.367,0.684-0.385,0.844
|
||||
l-1.164-0.533l0.395-0.896l0.508-0.752c-0.13-0.274-0.518-0.572-1.161-0.897c-0.518-0.258-1.053-0.388-1.605-0.388
|
||||
c-0.756,0-1.378,0.206-1.866,0.619c-0.488,0.411-0.733,0.965-0.733,1.659c0,1.099,0.756,2.115,2.263,3.052
|
||||
c0.495,0.307,1.249,0.662,2.261,1.067l-0.664,1.04c-0.867,0-2.065-0.692-3.594-2.08c-1.09-0.984-1.633-2.033-1.633-3.146
|
||||
c0-1.017,0.349-1.808,1.05-2.371c0.702-0.565,1.658-0.847,2.878-0.847c0.699,0,1.389,0.157,2.073,0.474
|
||||
c0.681,0.319,1.171,0.665,1.466,1.037c0.184-0.145,0.332-0.25,0.44-0.313c0.37-0.243,0.664-0.411,0.886-0.51
|
||||
c0.388-0.161,0.839-0.289,1.355-0.388c0.167-0.031,0.388-0.063,0.664-0.096V40.539z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M257.114,36.527h-3.216v11.124h-1.402V36.527h-2.377v-0.945h6.995V36.527z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M266.044,44.03c-0.332,0.241-0.627,0.419-0.886,0.533c-0.774,0.357-1.634,0.537-2.573,0.537
|
||||
c-1.55,0-2.755-0.447-3.611-1.342c-0.858-0.895-1.287-1.896-1.287-3.008c0.075,0.029,0.131,0.045,0.169,0.045
|
||||
c0.318,0.074,0.571,0.112,0.759,0.112c0.729,0,1.291-0.145,1.683-0.438c0.468-0.337,0.701-0.861,0.701-1.571
|
||||
c0-0.485-0.222-1.025-0.668-1.621c-0.149-0.194-0.371-0.444-0.669-0.751h-3.846v-0.945h8.172v0.945h-2.669
|
||||
c0.239,0.322,0.417,0.589,0.527,0.798c0.371,0.646,0.559,1.196,0.559,1.646c0,1.066-0.518,1.856-1.55,2.372
|
||||
c-0.332,0.161-0.857,0.322-1.576,0.484c0.184,0.531,0.378,0.926,0.58,1.182c0.629,0.806,1.539,1.208,2.736,1.208
|
||||
c0.756,0,1.443-0.18,2.07-0.534c0.754-0.436,1.214-0.864,1.379-1.284V44.03z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M270.634,36.527h-3.214v11.124h-1.405V36.527h-2.376v-0.945h6.995V36.527z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 19 KiB |
BIN
slidy2/graphics/face1.gif
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
slidy2/graphics/face2.gif
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
slidy2/graphics/face3.gif
Normal file
|
After Width: | Height: | Size: 800 B |
BIN
slidy2/graphics/face4.gif
Normal file
|
After Width: | Height: | Size: 846 B |
BIN
slidy2/graphics/fold-bright.gif
Normal file
|
After Width: | Height: | Size: 145 B |
BIN
slidy2/graphics/fold-dim.bmp
Normal file
|
After Width: | Height: | Size: 306 B |
BIN
slidy2/graphics/fold-dim.gif
Normal file
|
After Width: | Height: | Size: 56 B |
BIN
slidy2/graphics/fold.bmp
Normal file
|
After Width: | Height: | Size: 306 B |
BIN
slidy2/graphics/fold.gif
Normal file
|
After Width: | Height: | Size: 56 B |
BIN
slidy2/graphics/icon-blue.png
Normal file
|
After Width: | Height: | Size: 204 B |
BIN
slidy2/graphics/keys2.jpg
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
slidy2/graphics/nofold-dim.bmp
Normal file
|
After Width: | Height: | Size: 306 B |
BIN
slidy2/graphics/nofold-dim.gif
Normal file
|
After Width: | Height: | Size: 48 B |
BIN
slidy2/graphics/nofold.bmp
Normal file
|
After Width: | Height: | Size: 306 B |
BIN
slidy2/graphics/unfold-bright.gif
Normal file
|
After Width: | Height: | Size: 170 B |
BIN
slidy2/graphics/unfold-dim.bmp
Normal file
|
After Width: | Height: | Size: 306 B |
BIN
slidy2/graphics/unfold-dim.gif
Normal file
|
After Width: | Height: | Size: 59 B |
BIN
slidy2/graphics/unfold.bmp
Normal file
|
After Width: | Height: | Size: 306 B |
BIN
slidy2/graphics/unfold.gif
Normal file
|
After Width: | Height: | Size: 59 B |
BIN
slidy2/graphics/w3c-logo-blue.gif
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
14
slidy2/graphics/w3c-logo-blue.svg
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 93 45" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<a xlink:href="http://www.w3.org">
|
||||
<desc>W3C logo</desc>
|
||||
<rect width="103" height="65" fill="#90A7D0" x="-10" y="-10"/>
|
||||
<g transform="translate(2,2)">
|
||||
<path d="M74.5,.2l0.8,5.1l-3,5.6c0,0-1.13-2.39-3-3.7 c-1.6-1.1-2.6-1.4-4.2-1 c-2.1,0.4-4.4,2.9-5.4,5.9 c-1.2,3.6-1.2,5.4-1.3,7c-0.07,2.6,0.3,4.14,0.3,4.1 s-1.8-3.3-1.8-8.1c0.01-3.5,0.6-6.6,2.2-9.7 c1.41-2.7,3.5-4.4,5.4-4.5 c1.9-0.2,3.4,0.7,4.6,1.7 c1.2,1,2.5,3.3,2.5,3.4z"/>
|
||||
<path d="M74.9,28.8c0,0-1.3,2.3-2.1,3.2c-.8.9-2.3,2.5-4.1,3.3 c-1.8.8-2.7.9-4.5,0.8 c-1.8-.2-3.4-1.2-4-1.6s-2-1.7-2.9-2.9 c-.8-1.2-2.1-3.5-2.1-3.5 s.7,2.4,1.2,3.3c.3.6,1.1,2.3,2.2,3.9c1.1,1.4,3.1,3.9,6.3,4.4 c3.1,.6,5.3-.9,5.8-1.2c.5-.3,1.7-1.3,2.4-2.1 c.7-.8,1.4-1.8,1.8-2.4c.3-.4,0.7-1.3.7-1.3z"/>
|
||||
<path fill="#0C479D" d="M20.7,0.43l7.1,24.1l7.1-24.1 h5.1l-11.7,39.6h-.5l-7.35-24.5l-7.35,24.5h-.5l-11.7-39.6h5.1l7.1,24.1l4.8-16.2l-2.3-7.9z"/>
|
||||
<path fill="#0C479D" d="M54.6,27.3c0,3.6-1,6.6-2.9,9 c-1.9,2.4-4.4,3.7-7.4,3.7 c-2.3,0-4.3-0.7-5.9-2.2 c-1.7-1.4-2.9-3.4-3.8-5.9l4-1.7c.6,1.5,1.4,2.7,2.3,3.5 c1,.9,2.1,1.3,3.4,1.3c1.4,0,2.5-.8,3.5-2.3 c.9-1.5,1.4-3.4,1.4-5.5 c0-2.4-.5-4.2-1.5-5.5 c-1.2-1.5-3-2.3-5.5-2.3h-2v-2.3l6.8-11.8h-8.2l-2.3,3.9 h-1.5v-8.7h19.1v2.4l-7.2,12.5c2.5.8,4.5,2.3,5.8,4.4 c1.3,2.1,2,4.7,1.9,7.5z"/>
|
||||
<text x="78" y="10" font-size="13" font-family="sans-serif">®</text>
|
||||
</g>
|
||||
</a>
|
||||
</svg>
|
||||
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
BIN
slidy2/graphics/w3c-logo-slanted.jpg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
slidy2/graphics/w3c-logo-white.gif
Normal file
|
After Width: | Height: | Size: 793 B |
14
slidy2/graphics/w3c-logo-white.svg
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 93 45" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<a xlink:href="http://www.w3.org">
|
||||
<desc>W3C logo</desc>
|
||||
<rect width="103" height="65" fill="#728ec2" x="-10" y="-10"/>
|
||||
<g transform="translate(2,2)">
|
||||
<path fill="#FFFFFF" d="M74.5,.2l0.8,5.1l-3,5.6c0,0-1.13-2.39-3-3.7 c-1.6-1.1-2.6-1.4-4.2-1 c-2.1,0.4-4.4,2.9-5.4,5.9 c-1.2,3.6-1.2,5.4-1.3,7c-0.07,2.6,0.3,4.14,0.3,4.1 s-1.8-3.3-1.8-8.1c0.01-3.5,0.6-6.6,2.2-9.7 c1.41-2.7,3.5-4.4,5.4-4.5 c1.9-0.2,3.4,0.7,4.6,1.7 c1.2,1,2.5,3.3,2.5,3.4z"/>
|
||||
<path fill="#FFFFFF" d="M74.9,28.8c0,0-1.3,2.3-2.1,3.2c-.8.9-2.3,2.5-4.1,3.3 c-1.8.8-2.7.9-4.5,0.8 c-1.8-.2-3.4-1.2-4-1.6s-2-1.7-2.9-2.9 c-.8-1.2-2.1-3.5-2.1-3.5 s.7,2.4,1.2,3.3c.3.6,1.1,2.3,2.2,3.9c1.1,1.4,3.1,3.9,6.3,4.4 c3.1,.6,5.3-.9,5.8-1.2c.5-.3,1.7-1.3,2.4-2.1 c.7-.8,1.4-1.8,1.8-2.4c.3-.4,0.7-1.3.7-1.3z"/>
|
||||
<path fill="#FFFFFF" d="M20.7,0.43l7.1,24.1l7.1-24.1 h5.1l-11.7,39.6h-.5l-7.35-24.5l-7.35,24.5h-.5l-11.7-39.6h5.1l7.1,24.1l4.8-16.2l-2.3-7.9z"/>
|
||||
<path fill="#FFFFFF" d="M54.6,27.3c0,3.6-1,6.6-2.9,9 c-1.9,2.4-4.4,3.7-7.4,3.7 c-2.3,0-4.3-0.7-5.9-2.2 c-1.7-1.4-2.9-3.4-3.8-5.9l4-1.7c.6,1.5,1.4,2.7,2.3,3.5 c1,.9,2.1,1.3,3.4,1.3c1.4,0,2.5-.8,3.5-2.3 c.9-1.5,1.4-3.4,1.4-5.5 c0-2.4-.5-4.2-1.5-5.5 c-1.2-1.5-3-2.3-5.5-2.3h-2v-2.3l6.8-11.8h-8.2l-2.3,3.9 h-1.5v-8.7h19.1v2.4l-7.2,12.5c2.5.8,4.5,2.3,5.8,4.4 c1.3,2.1,2,4.7,1.9,7.5z"/>
|
||||
<text x="78" y="10" font-size="13" font-family="sans-serif">®</text>
|
||||
</g>
|
||||
</a>
|
||||
</svg>
|
||||
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
28
slidy2/help/.htaccess
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
Options +MultiViews
|
||||
LanguagePriority en
|
||||
AddLanguage pt-br .pt-br
|
||||
|
||||
<Files ~ "*.html">
|
||||
|
||||
ForceType 'text/html; charset=utf-8'
|
||||
|
||||
</Files>
|
||||
|
||||
<Files ~ "*.xhtml">
|
||||
|
||||
ForceType 'application/xhtml+xml; charset=utf-8'
|
||||
|
||||
</Files>
|
||||
|
||||
<Files ~ *.css">
|
||||
|
||||
ForceType 'text/css; charset=utf-8'
|
||||
|
||||
</Files>
|
||||
|
||||
<Files ~ "*.js">
|
||||
|
||||
ForceType 'text/javascript; charset=utf-8'
|
||||
|
||||
</Files>
|
||||
mkdir
|
||||
80
slidy2/help/help.html
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
|
||||
|
||||
<title>Slide Show Help</title><style type="text/css">
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 10%;
|
||||
}
|
||||
.copyright { font-size: smaller }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Slide Show Help</h1>
|
||||
|
||||
<p>This slide show can be driven in the same way as Power Point.
|
||||
To advance to the next slide click pretty much anywhere on the
|
||||
page with the mouse, or press the space bar. You can move forwards
|
||||
or backwards through the slides with the Cursor left, Cursor
|
||||
right, Pg Up and Pg Dn keys. The font size is automatically
|
||||
adjusted to match the browser's window width, but you can also
|
||||
adjust it manually using the "S" key for smaller and the "B" key
|
||||
for bigger. You can also use the "<" and ">" keys. Use the
|
||||
"F" key to switch off/on the bottom status line. The "K" key
|
||||
toggles the use of mouse click to advance to the next slide. You
|
||||
can use "C" to show the table of contents and any other key to
|
||||
hide it. Use the "F11" key to toggle the browser's full screen
|
||||
mode. Note that not all keys are supported in all browsers, as
|
||||
browsers may reserve some keys for browser control and this varies
|
||||
from one browser to the next.</p>
|
||||
|
||||
<p>Firefox users may want the <a
|
||||
href="http://www.krickelkrackel.de/autohide/">autohide</a>
|
||||
extension to hide the toolbars when entering full screen with F11.
|
||||
Newer versions of Firefox have built-in support for SVG, but on older
|
||||
versions for Microsoft Windows, you should consider installing the <a
|
||||
href="http://plugindoc.mozdev.org/windows.html">Adobe SVG Viewer
|
||||
6.0</a>.</p>
|
||||
|
||||
<p>If you would like to see how Slidy works, use View Source to view
|
||||
the XHTML markup, or see this <a
|
||||
href="http://www.w3.org/Talks/Tools/Slidy/">longer explanation</a>,
|
||||
which also explains additional features. Each slide is marked up as
|
||||
a div element with class="slide". CSS positioning and percentage
|
||||
widths on images can be used to ensure your image rich slides scale
|
||||
to match the window size. Content to be revealed incrementally can
|
||||
be marked up with class="incremental". The linked style sheet and
|
||||
scripts were developed as a Web-based alternative to proprietary
|
||||
presentation tools and have been tested on a variety of recent
|
||||
browsers. Integrated editing support is under development. Please
|
||||
send your comments to <a href="http://www.w3.org/People/Raggett/">Dave
|
||||
Raggett</a> <<a href="mailto:dsr@w3.org">dsr@w3.org</a>>.
|
||||
If you find Slidy useful, you may want to consider becoming a
|
||||
<a href="http://www.w3.org/Consortium/sup">W3C Supporter</a>.</p>
|
||||
|
||||
<p><em>You are welcome to make use of the slide show style sheets,
|
||||
scripts and help file under W3C's <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
|
||||
and <a href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> rules.</em></p>
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Return to slide show</button>
|
||||
|
||||
<hr>
|
||||
|
||||
<p class="copyright"><a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2005
|
||||
<a href="/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> rules apply.</p>
|
||||
</body></html>
|
||||
52
slidy2/help/help.html.ca
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ca" lang="ca">
|
||||
<head>
|
||||
<title>Ajuda del presentador de diapositives</title><style type="text/css">
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 10%;
|
||||
}
|
||||
.copyright { font-size: smaller }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Ajuda del presentador de diapositives</h1>
|
||||
|
||||
<p>Per avançar a la pròxima diapositiva només cal fer clic amb el ratolí en qualsevol lloc de la pàgina o bé prémer la barra d’espaidora.
|
||||
Es pot anar endavant i endarrere per les diapositives amb les tecles "cursor esquerra" i "cursor dreta", "RePàg" i "AvPàg". El tamany de font de les lletres s’ajusta automàticament a l’amplada de la pantalla, però també es pot ajustar manualment fent servir la “S” per fer-la mes petita (Smaller) i la “B” per fer-la mes gran (“Bigger”),també es poden fer servir les tecles "<" i ">".
|
||||
La tecla “F” fa aparèixer/desaparèixer el menú de la línia de estat a la part de sota.
|
||||
Amb la tecla “K” s’habilita/deshabilita l’ús del ratolí per avançar a la pròxima diapositiva. La tecla “C” mostra la taula de continguts, amb qualsevol altra tecla la podem amagar.
|
||||
La tecla “F11” serveix per entrar/sortir en el mode pantalla completa del navegador, la tecla “H” dona accés a aquesta pàgina.
|
||||
Cal notar que no totes les tecles estan suportades en tots els navegadors donat que els navegadors poden reservar algunes tecles per el control de navegació i aquestes varien d’un navegador a un altre.</p>
|
||||
<p>Es recomana als usuaris de Firefox que instal•lin la extensió d’<a href="http://www.krickelkrackel.de/autohide/">autoamagar</a> per amagar les barres d’eines en entrar al mode pantalla completa. </p>
|
||||
<p>Si vol saber com funciona Slidy, feu servir “Veure el codi font” per veure el codi XHTML o vegi aquesta <a
|
||||
href="http://www.w3.org/Talks/Tools/Slidy/">explicació més llarga.</a>, que també explica característiques addicionals. Cada diapositiva està marcada com element div amb classe “slide”. Es fa servir posicionament CSS i amplades per percentatge a les imatges per assegurar-se de que les vostres diapositives riques en imatges s’ajustin perfectament a la grandària de la finestra. El contingut que s’ha de revelar incrementalment es pot marcar amb la classe “incremental”. La fulla d’estils adjunta i els scripts es van desenvolupar com una alternativa basada en Web a les eines de presentació propietàries i s’han provat en una gran varietat de navegadors actuals. S’està desenvolupant un sistema d’edició integrada. Si us plau envieu els vostres comentaris a : <a href="http://www.w3.org/People/Raggett/">Dave
|
||||
Raggett</a> <<a href="mailto:dsr@w3.org">dsr@w3.org</a>>.
|
||||
Si trobeu Slidy útil podeu considerar <a href="http://www.w3.org/Consortium/sup">ajudar al W3C</a>.</p>
|
||||
<p><em>Sou benvingut a fer servir el presentador de diapositives, les fulles d’estil , scripts i el fitxer d’ajuda sota les condicions d’ <a href="http://www.w3.org/Consortium/Legal/copyright-documents">ùs de document</a> del W3C I les normes
|
||||
<a href="http://www.w3.org/Consortium/Legal/copyright-software">llicència de software</a>.</em></p>
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Tornar a la presentació de diapositives </button>
|
||||
|
||||
<hr />
|
||||
|
||||
<p class="copyright"><a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2005
|
||||
<a href="/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> rules apply.</p>
|
||||
</body>
|
||||
</html>
|
||||
96
slidy2/help/help.html.de
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
|
||||
<head>
|
||||
<!-- translated by Beat Vontobel -->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Slide Show Help</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 10%;
|
||||
}
|
||||
.copyright { font-size: smaller }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hilfe für die HTML-Slidy-Präsentation</h1>
|
||||
|
||||
<p>Diese Präsentation wird wie Power Point kontrolliert: Klicken
|
||||
Sie mit der Maus irgendwo ins Bild, um zur nächsten Seite zu
|
||||
schalten, oder drücken Sie die Leertaste. Sie können ebenfalls
|
||||
mit den Cursor-Tasten (links/rechts) oder den Tasten für Seite
|
||||
auf und ab vorwärts und rückwärts durch die Präsentation
|
||||
navigieren. Die Schriftgrösse wird automatisch so angepasst, dass
|
||||
Sie zur Fensterbreite des Browsers passt, sie kann aber auch
|
||||
manuell mit den Tasten "s" (kleiner) und "b" (grösser)
|
||||
kontrolliert werden (oder mit der Taste "<" bzw. ">"). Die
|
||||
Statuszeile am unteren Rand des Fensters wird mit "f" ein- und
|
||||
ausgeschaltet. Die Taste "k" schaltet die Funktion des Mausklicks
|
||||
zum Kontrollieren der Präsentation ein und aus. Sie können mit
|
||||
"c" ein Inhaltsverzeichnis ein- und mit einer beliebigen anderen
|
||||
Taste wieder ausblenden. Mit "F11" können Sie (je nach Browser)
|
||||
den Vollbildmodus aktivieren. Die Taste "h" zeigt diesen Hilfetext
|
||||
an. Es ist zu bemerken, dass nicht alle diese Tasten in jedem
|
||||
Browser funktionieren, da sie zum Teil mit anderen Funktionen
|
||||
belegt sind.</p>
|
||||
|
||||
<p>Firefox-Benutzer können die <a
|
||||
href="http://www.krickelkrackel.de/autohide/">autohide</a>-Erweiterung
|
||||
installieren, um die Werkzeugleiste im Vollbildmodus auszublenden.</p>
|
||||
|
||||
<p>Wenn Sie wissen möchten, wie Slidy funktioniert, schauen Sie sich
|
||||
den XHTML-Quellcode der Seite an oder lesen diese etwas <a
|
||||
href="http://www.w3.org/Talks/Tools/Slidy/">längere Erklärung</a>
|
||||
(in Englisch), die auch weitere Funktionen erläutert. Jede einzelne
|
||||
Folie ist als ein <code>div</code>-Element mit <code>class="slide"</code>
|
||||
markiert. CSS-Positionierung und prozentuale Breitenangaben für Bilder
|
||||
können benutzt werden, um sicherzustellen, dass die Folien bei
|
||||
verschiedenen Fenstergrössen optimal dargestellt werden. Der Inhalt
|
||||
auf Folien kann schrittweise angezeigt werden, indem den Elementen
|
||||
<code>class="incremental"</code> zugewiesen wird. Das eingebundene
|
||||
Style Sheet und die Skripten wurden als web-basierte Alternative zu
|
||||
proprietären Programmen entwickelt. Sie wurden auf verschiedensten
|
||||
aktuellen Browsern getestet. Ein eingebauter Editor für die Folien
|
||||
ist in Entwicklung. Bitte senden Sie Kommentare an <a
|
||||
href="http://www.w3.org/People/Raggett/">Dave Raggett</a> <<a
|
||||
href="mailto:dsr@w3.org">dsr@w3.org</a>>. Wenn Sie Slidy
|
||||
nützlich finden, möchten Sie vielleicht ein <a
|
||||
href="http://www.w3.org/Consortium/sup">W3C Supporter</a> werden.</p>
|
||||
|
||||
<p><em>Die Style Sheets, die Skripten der Präsentation und die
|
||||
zugehörigen Texte sind frei zur Benutzung unter den Bedingungen
|
||||
der W3C-Lizenzen <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
|
||||
use</a> und <a href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a>.</em></p>
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Zur Präsentation
|
||||
zurückkehren</button>
|
||||
|
||||
<hr/>
|
||||
|
||||
|
||||
<p class="copyright"><a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2006
|
||||
|
||||
<a href="/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
|
||||
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
||||
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
|
||||
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software licensing</a> rules apply.</p>
|
||||
</body>
|
||||
</html>
|
||||
81
slidy2/help/help.html.en
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>Slide Show Help</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 10%;
|
||||
}
|
||||
.copyright { font-size: smaller }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Slide Show Help</h1>
|
||||
|
||||
<p>This slide show can be driven in the same way as Power Point.
|
||||
To advance to the next slide click pretty much anywhere on the
|
||||
page with the mouse, or press the space bar. You can move forwards
|
||||
or backwards through the slides with the Cursor left, Cursor
|
||||
right, Pg Up and Pg Dn keys. The font size is automatically
|
||||
adjusted to match the browser's window width, but you can also
|
||||
adjust it manually using the "S" key for smaller and the "B" key
|
||||
for bigger. You can also use the "<" and ">" keys. Use the
|
||||
"F" key to switch off/on the bottom status line. The "K" key
|
||||
toggles the use of mouse click to advance to the next slide. You
|
||||
can use "C" to show the table of contents and any other key to
|
||||
hide it. Press the "H" key to view this page. Use the "F11" key to
|
||||
toggle the browser's full screen mode. Note that not all keys are
|
||||
supported in all browsers, as browsers may reserve some keys for
|
||||
browser control and this varies from one browser to the next.</p>
|
||||
|
||||
<p>Firefox users may want the <a
|
||||
href="http://www.krickelkrackel.de/autohide/">autohide</a>
|
||||
extension to hide the toolbars when entering full screen with F11.</p>
|
||||
|
||||
<p>If you would like to see how Slidy works, use View Source to view
|
||||
the XHTML markup, or see this <a
|
||||
href="http://www.w3.org/Talks/Tools/Slidy/">longer explanation</a>,
|
||||
which also explains additional features. Each slide is marked up as
|
||||
a div element with class="slide". CSS positioning and percentage
|
||||
widths on images can be used to ensure your image rich slides scale
|
||||
to match the window size. Content to be revealed incrementally can
|
||||
be marked up with class="incremental". The linked style sheet and
|
||||
scripts were developed as a Web-based alternative to proprietary
|
||||
presentation tools and have been tested on a variety of recent
|
||||
browsers. Integrated editing support is under development. Please
|
||||
send your comments to <a href="http://www.w3.org/People/Raggett/">Dave
|
||||
Raggett</a> <<a href="mailto:dsr@w3.org">dsr@w3.org</a>>.
|
||||
If you find Slidy useful, you may want to consider becoming a
|
||||
<a href="http://www.w3.org/Consortium/sup">W3C Supporter</a>.</p>
|
||||
|
||||
<p><em>You are welcome to make use of the slide show style sheets,
|
||||
scripts and help file under W3C's <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
|
||||
and <a href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> rules.</em></p>
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Return to slide show</button>
|
||||
|
||||
<hr />
|
||||
|
||||
<p class="copyright"><a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2005
|
||||
<a href="/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> rules apply.</p>
|
||||
</body>
|
||||
</html>
|
||||
52
slidy2/help/help.html.es
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
|
||||
<head>
|
||||
<!-- Traducida por Emmanuelle Gutiérrez y Restrepo - Fundación Sidar -->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Ayuda de Slidy</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 10%;
|
||||
}
|
||||
.copyright { font-size: smaller }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Ayuda de "<span lang="en">Slidy</span>"</h1>
|
||||
|
||||
<p>Esta presentación puede manejarse igual que una presentación hecha con Power Point.
|
||||
Para avanzar a la siguiente página o diapositiva haga clic con el ratón en cualquier parte de la página, o pulse la barra espaciadora. Puede moverse adelante y atrás entre las diapositivas con las teclas de flecha izquierda, derecha, retroceso de página (Re Pag) o avance de página (Av Pag). El tamaño de fuente se ajusta automáticamente para encajar en el ancho de la ventana del navegador, pero puede ajustarlo manualmente utilizando la tecla "S" para reducirlo y la tecla "B" para aumentarlo. También puede usar las teclas "<" y ">". Use la tecla "F" para presentar u ocultar la línea de estado en la parte inferior. La tecla "K" habilita o deshabilita el uso del ratón para avanzar a la siguiente diapositiva. Puede usar la tecla "C" para mostrar la tabla de contenidos o índice, y cualquier otra tecla para esconderla. Use la tecla de función "F11" para conmutar la vista a toda pantalla del navegador. Tenga en cuenta que no todas las teclas están igualmente soportadas en todos los navegadores, ya que los navegadores pueden tener reservado el uso de algunas teclas para controles del navegador, y esto puede variar de un navegador a otro.</p>
|
||||
|
||||
<p>Los usuarios de Firefox pueden desear instalar la extensión <a href="http://www.krickelkrackel.de/autohide/" lang="en">"autohide"</a>
|
||||
para ocultar las barras de herramientas cuando utilizan la función F11 para el modo a toda pantalla.</p>
|
||||
|
||||
<p>Si desea saber cómo funciona Slidy, utilice la Vista de Código para ver el marcado XHML, o vea esta <a href="http://www.w3.org/Talks/Tools/Slidy/">explicación extensa</a>,
|
||||
que expone otras características adicionales. Cada diapositiva está marcada con un elemento div con la clase class="slide". Puede usarse posicionamiento y anchos en porcentajes para las imágenes, mediante CSS, para garantizar que la imagen alcance el tamaño de la diapositiva de acuerdo con el tamaño de la ventana. El contenido que se desee presentar paulatinamente puede marcarse con la clase class="incremental". La hoja de estilos y el script enlazado fueron desarrollados como una alternativa, basada en la Web, a las herramientas propietarias de presentación, y han sido probados en una variedad de navegadores recientes. Se está desarrollando un editor integrado. Envie sus comentarios, por favor, a <a href="http://www.w3.org/People/Raggett/" lang="en">Dave Raggett</a> <<a href="mailto:dsr@w3.org">dsr@w3.org</a>>.</p>
|
||||
|
||||
<p><em>Usted puede utilizar las hojas de estilo, scripts, y el fichero de ayuda; siempre que siga las normas de <a href="http://www.w3.org/Consortium/Legal/copyright-documents">uso de documentos</a> y <a href="http://www.w3.org/Consortium/Legal/copyright-software">licencia de software</a> del W3C.</em></p>
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Volver a la presentación</button>
|
||||
|
||||
<hr />
|
||||
|
||||
<p class="copyright" lang="en"><a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2005
|
||||
<a href="/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> rules apply.</p>
|
||||
</body>
|
||||
</html>
|
||||
118
slidy2/help/help.html.fr
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr-FR">
|
||||
<head>
|
||||
|
||||
<title>Aide de Slide Show</title><style type="text/css">
|
||||
|
||||
body {
|
||||
|
||||
font-family: sans-serif;
|
||||
|
||||
margin: 10%;
|
||||
|
||||
}
|
||||
|
||||
.copyright { font-size: smaller }
|
||||
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Aide de Slide Show</h1>
|
||||
|
||||
|
||||
|
||||
<p>Cet exposé Slide Show peut être utilisé de la même manière que Powerpoint.
|
||||
|
||||
Pour avancer au prochain transparent, cliquez n'importe où sur la page avec la
|
||||
souris ou appuyez sur la barre d'espace. Vous pouvez naviguer entre
|
||||
les transparents avec les flèches gauche/droite ainsi que les touches Pg Up et
|
||||
Pg Dn.
|
||||
|
||||
La taille de la police s'adapte automatiquement à la largeur de la fenêtre
|
||||
du navigateur, mais vous pouvez aussi l'ajuster manuellement en utilisant les
|
||||
touches "S" (small) pour la diminuer et "B" (big) pour l'augmenter. Vous
|
||||
pouvez aussi utiliser les touches "<" et ">".
|
||||
|
||||
Utilisez la touche "F" pour afficher ou non le statut en pied-de-page.
|
||||
|
||||
La touche "K" active l'utilisation du clic de souris pour avancer au prochain transparent.
|
||||
Vous pouvez utiliser "T" pour afficher la table des matières et n'importe quelle autre touche
|
||||
pour la cacher.
|
||||
|
||||
Les utilisateurs de Windows peuvent utiliser la touche "F11" pour activer le mode plein écran
|
||||
du navigateur. Appuyez sur la touche "H" pour obtenir cette page. À noter que certaines touches
|
||||
peuvent ne pas fonctionner avec certains navigateurs car elles sont réservées pour son contrôle.
|
||||
De plus, cela peut varier d'un navigateur à l'autre.</p>
|
||||
|
||||
<p>Les utilisateurs de Firefox peuvent installer l'extension <a
|
||||
href="http://www.krickelkrackel.de/autohide/">autohide</a>
|
||||
pour cacher les barres d'outils lorsque le mode plein écran est activé
|
||||
avec la touche F11.</p>
|
||||
|
||||
<p>Si vous voulez voir comment Slidy fonctionne, affichez le code source de la page
|
||||
pour voir le balisage XHTML, ou lisez cette <a
|
||||
href="http://www.w3.org/Talks/Tools/Slidy/">explication plus complète</a> (en anglais),
|
||||
qui explique aussi des fonctionnalités additionnelles.
|
||||
|
||||
Chaque transparent est balisé par un élément div avec l'attribut class="slide".
|
||||
Il est aussi possible d'utiliser le positionnement CSS ainsi que la largeur en pourcentage
|
||||
pour s'assurer que vos images soient à l'échelle du transparent et correspondent ainsi à la taille
|
||||
de la fenêtre. Le contenu devant s'afficher progressivement doit être marqué par l'attribut
|
||||
class="incremental".
|
||||
|
||||
La feuille de style reliée ainsi que les scripts ont été développés comme alternative Web
|
||||
aux outils de présentation propriétaires et ont été testés sur un large panel de navigateurs récents.
|
||||
Le support intégré pour l'édition est en cours de développement. Envoyez vos commentaires
|
||||
(en anglais) à <a href="http://www.w3.org/People/Raggett/">Dave
|
||||
Raggett</a> <<a href="mailto:dsr@w3.org">dsr@w3.org</a>>.
|
||||
Si vous trouvez Slidy utile, vous pouvez également devenir
|
||||
<a href="http://www.w3.org/Consortium/sup">Supporter du W3C</a>.</p>
|
||||
|
||||
|
||||
|
||||
<p><em>Veuillez utilisez les feuilles de style, scripts et fichiers d'aide
|
||||
|
||||
en suivant le <a href="http://www.w3.org/Consortium/Legal/copyright-documents">copyright</a>
|
||||
|
||||
et la <a href="http://www.w3.org/Consortium/Legal/copyright-software">licence</a> du W3C.</em></p>
|
||||
|
||||
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Retour à l'exposé</button>
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
<p class="copyright"><a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2005
|
||||
|
||||
<a href="/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
|
||||
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
||||
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
|
||||
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
|
||||
licensing</a> rules apply.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
98
slidy2/help/help.html.hu
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="hu" lang="hu">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
<title>Segítség a bemutatóhoz</title>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 10%;
|
||||
}
|
||||
.copyright { font-size: smaller }
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Segítség a bemutatóhoz</h1>
|
||||
|
||||
<p>Ezt a bemutatót a Power Point-hoz hasonlóan lehet vezérelni.
|
||||
A következő oldalra való lépéshez kattintson bárhova az aktuális
|
||||
oldalon belül, vagy nyomja le a szóköz billentyűt. Az oldalak között
|
||||
a bal és jobb nyíl, illetve a Page Up és Page Down billentyűkkel mozoghat.
|
||||
A szöveg mérete automatikusan kerül beállításra úgy, hogy igazodjon
|
||||
a böngésző ablakának szélességéhez, viszont az "S" billentyűvel
|
||||
csökkentheti, a "B"-vel növelheti azt. Ugyanerre használhatja a "<"
|
||||
és a ">" billentyűket is.
|
||||
Az "F" billentyűvel be- és
|
||||
kikapcsolhatja az alsó állapotsor megjelenítését. A "K" billentyűvel
|
||||
letilthatja, illetve engedélyezheti, hogy egérkattintással a következő
|
||||
oldalra lehessen lépni. A "C" billentyűvel megjelenítheti, bármely másikkal
|
||||
pedig eltűntetheti a tartalomjegyzéket. Az "F11" billenytűvel válthat át
|
||||
a böngésző teljes képernyős üzemmódjára, vagy jöhet onnan vissza.
|
||||
Megjegyezzük, hogy nem minden billentyű támogatott minden böngészőben,
|
||||
mivel a böngészők lefoglalhatnak néhány (böngészőnként eltérő) billentyűt
|
||||
a saját vezérlésükre.
|
||||
</p>
|
||||
|
||||
<p>A Firefox felhasználóknak hasznos lehet az
|
||||
<a href="http://www.krickelkrackel.de/autohide/">autohide</a>
|
||||
bővítmény, amivel elrejthetők az eszköztárak teljes képernyős üzemmódban.
|
||||
</p>
|
||||
|
||||
<p>Ha szeretné látni, hogyan működik a Slidy, nézze meg az oldal
|
||||
forrásában az XHTML jelölésmódot, vagy nézze meg ezt a
|
||||
<a href="http://www.w3.org/Talks/Tools/Slidy/">hosszabb magyarázatot</a>,
|
||||
ami további funkciókat is bemutat. Minden oldalt egy olyan div elem jelöl,
|
||||
amiben be van állítva, hogy class="slide". A képek CSS-sel történő
|
||||
pozicionálása és szélességüknek százalékban való megadása biztosítja,
|
||||
hogy a sok képet tartalmazó oldalak az ablak méretének megfelelően
|
||||
skálázódjanak. Az oldalon belül egymás után megjelenítendő tartalom a
|
||||
class="incremental" megadásával jelölhető. A becsatolt stíluslapok és
|
||||
scriptek a védjegyzett/szabadalmaztatott/más módon védett
|
||||
bemutató-megjelenítő eszközök web-alapú alternatívájaként lettek
|
||||
fejlesztve, és sok, manapság használatos böngészővel tesztelve.
|
||||
Az integrált szerkesztési lehetőség jelenleg fejlesztés alatt áll.
|
||||
Észrevételeit a következő helyre küldje:
|
||||
<a href="http://www.w3.org/People/Raggett/">Dave Raggett</a>
|
||||
<<a href="mailto:dsr@w3.org">dsr@w3.org</a>>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<em>Ön jogosult az e bemutatóhoz tartozó stíluslapok, scriptek és
|
||||
segítség fájl használatára, amennyiben betartja a W3C
|
||||
<a href="http://www.w3.org/Consortium/Legal/copyright-documents">
|
||||
dokumentum használati</a> és
|
||||
<a href="http://www.w3.org/Consortium/Legal/copyright-software">
|
||||
szoftver licencelési</a> szabályait.
|
||||
</em>
|
||||
</p>
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Visszatérés a bemutatóhoz</button>
|
||||
|
||||
<hr>
|
||||
|
||||
<p class="copyright">
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2005
|
||||
<a href="http://www.w3.org/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a>
|
||||
<sup>®</sup>
|
||||
(<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), minden jog fenntartva. A következő W3C szabályok alkalmazandók:
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">felelősségi</a>,
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">védjegy</a>,
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">dokumentum használati</a> és
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">szoftver licencelési</a>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
82
slidy2/help/help.html.nl
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
|
||||
<head>
|
||||
<!-- translated by Ruud Steltenpool -->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Slidy Help</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 10%;
|
||||
}
|
||||
.copyright { font-size: smaller }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1><span lang="en">Slidy</span> Help</h1>
|
||||
|
||||
<!-- Sheetpresentatie help -->
|
||||
|
||||
<p>Deze sheetpresentatie kan op dezelfde manier worden aangestuurd als
|
||||
Powerpoint. Klik op een willekeurige plaats op de pagina met de muis, of
|
||||
druk op de spatiebalk om naar de volgende sheet te gaan. Je kan voor- of
|
||||
achterwaarts door de sheets bewegen mbv de links/rechts cursor- en de Page
|
||||
Up en Page Down toetsen. De lettergrootte wordt automatisch aangepast aan
|
||||
de breedte van het venster, maar je kunt 'm ook handmatig aanpassen met
|
||||
"S" en "<" voor kleiner en "B" en ">" voor groter. Gebruik de
|
||||
"F" om de status aan de onderkant aan/uit te schakelen. De "K" zorgt
|
||||
ervoor dat een muisklik je niet meer, of wel weer naar de volgende sheet
|
||||
brengt. Je kan de "C" gebruiken om het inhoudsoverzicht op te roepen, en
|
||||
een willekeurige andere toets om 'm weer te verbergen. Gebruik "F11" om de
|
||||
"volledig scherm" modus aan /uit te schakelen. Merk op dat niet alle
|
||||
toetsen in iedere browser worden ondersteund, omdat sommige browsers
|
||||
toetsen gebruiken voor besturing van de browser zelf. Dit varieert zelfs
|
||||
tussen versies van dezelfde browser.</p>
|
||||
|
||||
<p>Firefox gebruikers willen wellicht de <a href="http://www.krickelkrackel.de/autohide/" lang="en">"autohide"</a> extension gebruiken om
|
||||
werkbalken te verbergen wanneer "volledig scherm" wordt aangeroepen met
|
||||
"F11".</p>
|
||||
|
||||
<p>Als u wilt zien hoe Slidy werkt, gebruik Bron Bekijken om de XHTML opmaak
|
||||
te bekijken, of bekijk deze <a href="http://www.w3.org/Talks/Tools/Slidy/">langere uitleg</a>, die ook extra functionaliteit
|
||||
uitlegt. Elke sheet is in de opmaak genoteerd als een div element met
|
||||
class="slide". CSS positionering and procentuele breedtes op afbeeldingen
|
||||
kunnen worden gebruikt om te verzekeren dat uw afbeeldingrijke sheets
|
||||
schalen naar de vensterbreedte. Inhoud kan stapsgewijs zichtbaar worden
|
||||
gemaakt met behulp van class="incremental". Het gelinkte stijlblad en de
|
||||
gelinkte scripts zijn ontwikkeld als een Web-gebaseerd alternatief voor
|
||||
gesloten presentatie programma's en zijn getest op een variëteit van
|
||||
recente browsers. Geintegreerde ondersteuning voor (inhoud)aanpassing
|
||||
wordt ontwikkeld. Zend uw opmerkingen aub naar <a href="http://www.w3.org/People/Raggett/" lang="en">Dave Raggett</a> <<a href="mailto:dsr@w3.org">dsr@w3.org</a>>
|
||||
Als u Slidy bruikbaar vindt, wilt u wellicht overwegen W3C donateur te
|
||||
worden.</p>
|
||||
|
||||
<p>U bent welkom om gebruik te maken van de stijlbladen, scripts en dit
|
||||
helpbestand onder de regels van W3C's <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> (document gebruik) en
|
||||
<a href="http://www.w3.org/Consortium/Legal/copyright-software">software licensing</a> (software licenties)</p>
|
||||
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Rerugkeer naar sheetpresentatie</button>
|
||||
|
||||
<hr />
|
||||
|
||||
<p class="copyright" lang="en"><a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2006
|
||||
<a href="/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> rules apply.</p>
|
||||
</body>
|
||||
</html>
|
||||
76
slidy2/help/help.html.pl
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"" xml:lang="pl" lang="pl">
|
||||
<head>
|
||||
<!-- translated by Krzysztof Kotowicz - koto@webworkers.pl -->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Slidy - pomoc</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 10%;
|
||||
}
|
||||
.copyright { font-size: smaller }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1><span lang="en">Slidy</span> - pomoc</h1>
|
||||
|
||||
<p>Prezentacją steruje się tak samo, jak w Powerpoincie.
|
||||
Aby przejść do następnego slajdu, kliknij w dowolnym miejscu prezentacji myszą
|
||||
lub naciśnij spację. Możesz też poruszać się w przód / tył używając klawiszy
|
||||
kursora (lewo / prawo) lub klawiszy Pg Up / Pg Dn. Rozmiar czcionki jest
|
||||
dobierany automatycznie tak, żeby mieścił się w obszarze przeglądarki,
|
||||
ale możesz także dostosować go ręcznie naciskając klawisze "S", aby pomniejszyć
|
||||
tekst i "B", aby go powiększyć. Możesz do tego celu także użyć klawiszy "<"
|
||||
i ">". Użyj klawisza "F" aby
|
||||
ukryć / pokazać dolny pasek statusu. Klawisz "K" włącza / wyłącza tryb przechodzenia
|
||||
do następnego slajdu po kliknięciu myszką. Możesz użyć klawisza "C", żeby pokazać
|
||||
spis treści i dowolnego innego, żeby go ukryć. Klawisz
|
||||
"F11" włącza tryb pełnoekranowy przeglądarki. Pamiętaj, że nie wszystkie klawisze
|
||||
są obsługiwane we wszystkich przeglądarkach, gdyż niektóre z nich rezerwują
|
||||
konkretne klawisze do własnych celów, wszystko to zależy od używanej przeglądarki.</p>
|
||||
|
||||
<p>Jeśli używasz Firefoxa, zwróć uwagę na rozszerzenie <a
|
||||
href="http://www.krickelkrackel.de/autohide/">autohide</a>, dzięki któremu
|
||||
możesz ukryć paski narzędziowe w trybie pełnoekranowym (F11).</p>
|
||||
|
||||
<p>Jeśli chcesz dowiedzieć się, w jaki sposób działa Slidy, obejrzyj źródło strony prezentacji, żeby
|
||||
zobaczyć użyty XHTML lub zapoznaj się z <a
|
||||
href="http://www.w3.org/Talks/Tools/Slidy/">prezentacją działania</a>, która omawia
|
||||
wszystkie dodatkowe funkcje. Każdy slajd jest reprezentowany przez element div o klasie "slide".
|
||||
Pozycjonowanie CSS i użycie procentowych szerokości obrazków zapewni, że
|
||||
Twoje slajdy będą poprawnie wyświetlane w każdej skali.
|
||||
Zawartości slajdu, które mają być stopniowo odsłaniane oznacz klasą "incremental".
|
||||
Powiązany arkusz stylów CSS i skrypt zostały stworzone jako sieciowa
|
||||
alternatywa dla komercyjnych narzędzi prezentacyjnych. Całość została
|
||||
przetestowana na różnorodnych współczesnych przeglądarkach.
|
||||
Na etapie tworzenia jest aplikacja do zintegrowanego tworzenia i edycji prezentacji.
|
||||
Wszystkie komentarze prosimy kierować do <a href="http://www.w3.org/People/Raggett/">Dave'a
|
||||
Raggetta</a> <<a href="mailto:dsr@w3.org">dsr@w3.org</a>>.</p>
|
||||
|
||||
<p><em>Zachęcamy do używania arkuszy stylów, skryptów i pliku pomocy na warunkach licencyjnych dotyczących <a href="http://www.w3.org/Consortium/Legal/copyright-documents">dokumentów</a>
|
||||
i <a href="http://www.w3.org/Consortium/Legal/copyright-software">oprogramowania</a> W3C</em></p>
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Powróć do pokazu slajdów</button>
|
||||
|
||||
<hr>
|
||||
|
||||
<p class="copyright"><a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2005
|
||||
<a href="/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> rules apply.</p>
|
||||
</body></html>
|
||||
95
slidy2/help/help.html.pt-br
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US">
|
||||
<head>
|
||||
<title>Slide Show Help</title><style type="text/css">
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 10%;
|
||||
}
|
||||
.copyright { font-size: smaller }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Ajuda do Slide Show</h1>
|
||||
|
||||
<p>Este slide show pode ser tocado do jeito do Power Point.
|
||||
Para avançar ao próximo eslaide, clique em qualquer ponto
|
||||
da página com o botão direito do mouse. Ou então use a
|
||||
barra de espaços. Também se pode movimentar para frente ou
|
||||
para trás com as teclas do cursor -- setinhas para a
|
||||
direita, para a esquerda, para cima e para baixo. E ainda
|
||||
com as teclas Page Up e Page Down. O tamanho da fonte é
|
||||
automaticamente ajustado à largura da janela do navegador,
|
||||
mas esse ajuste pode ser manual, usando as teclas "S"
|
||||
(de "smaller") para diminuir o tamanho, e "B" (de "bigger")
|
||||
para aumentar. Igualmente se pode usar as teclas "<" e
|
||||
">". Use
|
||||
a tecla "F" para alternar entre desativada e ativada a
|
||||
linha de status no rodapé. A tecla "K" alterna o uso do
|
||||
clique do mouse para avançar ao próximo eslaide. A tecla
|
||||
"C" mostra a tabela de conteúdos, que será novamente
|
||||
ocultada apertando-se qualquer tecla. Use a tecla "F11"
|
||||
para alternar o modo de tela cheia do navegador. Aperte
|
||||
"H" (de "Help") para abrir esta página de Ajuda. Note que
|
||||
alguns navegadores reservam algumas dessas teclas para
|
||||
outras funções. Assim, experimente no seu navegador para
|
||||
ver se esse é o seu caso.</p>
|
||||
|
||||
<p>Usuários do Firefox podem querer a extensão <a
|
||||
href="http://www.krickelkrackel.de/autohide/">autoocultar</a>
|
||||
para esconder as barras de ferramentas quando entrarem em tela cheia
|
||||
com a tecla F11.</p>
|
||||
|
||||
<p>Se quiser ver como funciona o Slidy, use o View Source para
|
||||
visualizar a marcação XHTML, ou leia esta <a
|
||||
href="http://www.w3.org/Talks/Tools/Slidy/">explanação mais longa</a>,
|
||||
que também contém funcionalidades adicionais. Cada eslaide é
|
||||
marcado como um div element com
|
||||
classe="slide". Posicionamentos e larguras em porcentual de CSS
|
||||
podem ser usados para assegurar que os eslaides com rica
|
||||
ilustração tenham escalabilidade de acordo com o tamanho da janela.
|
||||
Já o conteúdo a ser revelado incrementalmente pode receber a
|
||||
marcação com a classe="incremental".
|
||||
A folha de estilos vinculados e os scripts foram desenvolvidos
|
||||
como uma alternativa baseada em web às ferramentas proprietárias
|
||||
de apresentação, e testados em diversos navegadores recentes.
|
||||
Suporte à edição integrada ainda está em desenvolvimento. Mande
|
||||
seus comentários para <a href="http://www.w3.org/People/Raggett/">Dave
|
||||
Raggett</a> <<a href="mailto:dsr@w3.org">dsr@w3.org</a>>.
|
||||
Achando que o Slidy é útil, V. talvez possa considerar a
|
||||
possibilidade de se tornar um
|
||||
<a href="http://www.w3.org/Consortium/sup">Apoiador do W3C</a>.</p>
|
||||
|
||||
<p><em>Fique à vontade para usar as folhas de estilo, os scripts
|
||||
e o arquivo de ajuda do show de eslaides que se encontram sob as
|
||||
regras de
|
||||
<a href="http://www.w3.org/Consortium/Legal/copyright-documents">
|
||||
uso de documentação</a>
|
||||
e <a href="http://www.w3.org/Consortium/Legal/copyright-software">
|
||||
licenciamento de software</a>do W3C -- Consórcio da World Wide
|
||||
Web.</em></p>
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Voltar a exibir eslaides</button>
|
||||
|
||||
<hr />
|
||||
|
||||
<p class="copyright"><a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2005
|
||||
<a href="/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> rules apply.</p>
|
||||
</body>
|
||||
</html>
|
||||
95
slidy2/help/help.html.pt_br
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US">
|
||||
<head>
|
||||
<title>Slide Show Help</title><style type="text/css">
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 10%;
|
||||
}
|
||||
.copyright { font-size: smaller }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Ajuda do Slide Show</h1>
|
||||
|
||||
<p>Este slide show pode ser tocado do jeito do Power Point.
|
||||
Para avançar ao próximo eslaide, clique em qualquer ponto
|
||||
da página com o botão direito do mouse. Ou então use a
|
||||
barra de espaços. Também se pode movimentar para frente ou
|
||||
para trás com as teclas do cursor -- setinhas para a
|
||||
direita, para a esquerda, para cima e para baixo. E ainda
|
||||
com as teclas Page Up e Page Down. O tamanho da fonte é
|
||||
automaticamente ajustado à largura da janela do navegador,
|
||||
mas esse ajuste pode ser manual, usando as teclas "S"
|
||||
(de "smaller") para diminuir o tamanho, e "B" (de "bigger")
|
||||
para aumentar. Igualmente se pode usar as teclas "<" e
|
||||
">". Use
|
||||
a tecla "F" para alternar entre desativada e ativada a
|
||||
linha de status no rodapé. A tecla "K" alterna o uso do
|
||||
clique do mouse para avançar ao próximo eslaide. A tecla
|
||||
"C" mostra a tabela de conteúdos, que será novamente
|
||||
ocultada apertando-se qualquer tecla. Use a tecla "F11"
|
||||
para alternar o modo de tela cheia do navegador. Aperte
|
||||
"H" (de "Help") para abrir esta página de Ajuda. Note que
|
||||
alguns navegadores reservam algumas dessas teclas para
|
||||
outras funções. Assim, experimente no seu navegador para
|
||||
ver se esse é o seu caso.</p>
|
||||
|
||||
<p>Usuários do Firefox podem querer a extensão <a
|
||||
href="http://www.krickelkrackel.de/autohide/">autoocultar</a>
|
||||
para esconder as barras de ferramentas quando entrarem em tela cheia
|
||||
com a tecla F11.</p>
|
||||
|
||||
<p>Se quiser ver como funciona o Slidy, use o View Source para
|
||||
visualizar a marcação XHTML, ou leia esta <a
|
||||
href="http://www.w3.org/Talks/Tools/Slidy/">explanação mais longa</a>,
|
||||
que também contém funcionalidades adicionais. Cada eslaide é
|
||||
marcado como um div element com
|
||||
classe="slide". Posicionamentos e larguras em porcentual de CSS
|
||||
podem ser usados para assegurar que os eslaides com rica
|
||||
ilustração tenham escalabilidade de acordo com o tamanho da janela.
|
||||
Já o conteúdo a ser revelado incrementalmente pode receber a
|
||||
marcação com a classe="incremental".
|
||||
A folha de estilos vinculados e os scripts foram desenvolvidos
|
||||
como uma alternativa baseada em web às ferramentas proprietárias
|
||||
de apresentação, e testados em diversos navegadores recentes.
|
||||
Suporte à edição integrada ainda está em desenvolvimento. Mande
|
||||
seus comentários para <a href="http://www.w3.org/People/Raggett/">Dave
|
||||
Raggett</a> <<a href="mailto:dsr@w3.org">dsr@w3.org</a>>.
|
||||
Achando que o Slidy é útil, V. talvez possa considerar a
|
||||
possibilidade de se tornar um
|
||||
<a href="http://www.w3.org/Consortium/sup">Apoiador do W3C</a>.</p>
|
||||
|
||||
<p><em>Fique à vontade para usar as folhas de estilo, os scripts
|
||||
e o arquivo de ajuda do show de eslaides que se encontram sob as
|
||||
regras de
|
||||
<a href="http://www.w3.org/Consortium/Legal/copyright-documents">
|
||||
uso de documentação</a>
|
||||
e <a href="http://www.w3.org/Consortium/Legal/copyright-software">
|
||||
licenciamento de software</a>do W3C -- Consórcio da World Wide
|
||||
Web.</em></p>
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Voltar a exibir eslaides</button>
|
||||
|
||||
<hr />
|
||||
|
||||
<p class="copyright"><a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2005
|
||||
<a href="/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> rules apply.</p>
|
||||
</body>
|
||||
</html>
|
||||
75
slidy2/help/help.html.sv
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="sv" lang="sv"><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
|
||||
|
||||
|
||||
<title>Hjälpsida för presentationer</title><style type="text/css"><!--
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 10%;
|
||||
}
|
||||
.copyright { font-size: smaller } -->
|
||||
</style>
|
||||
<script type="text/javascript"><!--
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
// --> </script>
|
||||
</head><body>
|
||||
<h1>Hjälpsida för presentationer</h1>
|
||||
|
||||
<p align="justify">Denna presentation kan användas på liknande sätt som Power Point.
|
||||
För att bläddra till nästa sida går det att trycka på mellanslagstangenten eller klicka med musens
|
||||
västra knapp så gott som var som helst på sidan. Bläddra framåt och
|
||||
bakåt med höger- respektive vänsterpiltangenterna eller tangenterna »Pg Dn» respektive
|
||||
»Pg Up». Textens storlek anpassas automatiskt efter webbläsarens
|
||||
fönsterbredd, men den går även att justera manuellt med
|
||||
tangenterna »S» och »B» för att förminska respektive förstora texten. Alternativt kan
|
||||
tangenterna »<» respektive »>» användas. Tangenten
|
||||
»F» används för att visa / dölja statusraden längst ner i fönstret. Tangenten »K»
|
||||
kopplar på / av möjligheten att klicka med musen för att bläddra till nästa sida. Tangenten
|
||||
»C» används för att visa innehållsförteckningen och en tryckning på vilken annan tangent som
|
||||
helst döljer den. En tryckning på tangenten »H» visar denna hjälpsida. Tangenten »F11»
|
||||
växlar mellan fullskärmsvisning och visning i webbläsarens fönster. Observera att vissa webbläsare kan
|
||||
ha reserverat några av dessa tangenttryckningar för andra funktioner; detta varierar mellan olika webbläsare.</p>
|
||||
|
||||
<p align="justify"><span lang="en">Firefox</span>användare kan vid behov installera <a href="http://www.krickelkrackel.de/autohide" lang="en" hreflang="en">autohide</a>
|
||||
för att verktygsfälten skall döljas vid övergång till fullskärmsvisning med F11.</p>
|
||||
|
||||
<p align="justify">För att se hur <em lang="en">Slidy</em> fungerar, titta på XHTML-koden genom att välja »Visa
|
||||
källa» (eller liknande) i webbläsarens meny eller läs följande <a href="http://www.w3.org/Talks/Tools/Slidy/">längre
|
||||
beskrivning</a>, där även ytterligare finesser beskrivs. Varje sida är markerad som
|
||||
<span lang="en">div</span>-element med attributet <code lang="en">class="slide"</code>. CSS-positionering och procentuell bredd
|
||||
kan användas för att placera bilderna i rätt skala i förhållande till
|
||||
webbläsarens fönsterstorlek. Det som skall visas inkrementiellt
|
||||
markeras med <code lang="en">class="incremental"</code>. Länkar hänvisar till några skript och stilmallar
|
||||
som har testats med en mängd nutida webbläsare och bildar ett webbaserat alternativ till proprietära
|
||||
presentationsprogram. Stöd för integrerad editering håller på att utvecklas. Skicka gärna
|
||||
kommentarer till <a href="http://www.w3.org/People/Raggett/" lang="en" hreflang="en">Dave
|
||||
Raggett</a> <<a href="mailto:dsr@w3.org">dsr@w3.org</a>>.
|
||||
Om du finner <em lang="en">Slidy</em> användbar kan du överväga att bli
|
||||
<a href="http://www.w3.org/Consortium/sup" lang="en" hreflang="en">W3C Supporter</a>.</p>
|
||||
|
||||
<p><em>Välkommen att använda presentationens stilmallar, skript och hjälpfiler enligt reglerna
|
||||
för W3C:s <a href="http://www.w3.org/Consortium/Legal/copyright-documents" lang="en" hreflang="en">document use</a>
|
||||
och <a href="http://www.w3.org/Consortium/Legal/copyright-software" lang="en" hreflang="en">software
|
||||
licensing</a>!</em></p>
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Tillbaka till presentationen</button>
|
||||
|
||||
<hr />
|
||||
|
||||
<p class="copyright" lang="en"><a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2005
|
||||
<a href="http://www.w3.org/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>©</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> rules apply.</p>
|
||||
</body></html>
|
||||
95
slidy2/help/help.pt-br.html
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US">
|
||||
<head>
|
||||
<title>Slide Show Help</title><style type="text/css">
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 10%;
|
||||
}
|
||||
.copyright { font-size: smaller }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = load;
|
||||
function load()
|
||||
{
|
||||
var back = document.getElementById("back");
|
||||
back.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Ajuda do Slide Show</h1>
|
||||
|
||||
<p>Este slide show pode ser tocado do jeito do Power Point.
|
||||
Para avançar ao próximo eslaide, clique em qualquer ponto
|
||||
da página com o botão direito do mouse. Ou então use a
|
||||
barra de espaços. Também se pode movimentar para frente ou
|
||||
para trás com as teclas do cursor -- setinhas para a
|
||||
direita, para a esquerda, para cima e para baixo. E ainda
|
||||
com as teclas Page Up e Page Down. O tamanho da fonte é
|
||||
automaticamente ajustado à largura da janela do navegador,
|
||||
mas esse ajuste pode ser manual, usando as teclas "S"
|
||||
(de "smaller") para diminuir o tamanho, e "B" (de "bigger")
|
||||
para aumentar. Igualmente se pode usar as teclas "<" e
|
||||
">". Use
|
||||
a tecla "F" para alternar entre desativada e ativada a
|
||||
linha de status no rodapé. A tecla "K" alterna o uso do
|
||||
clique do mouse para avançar ao próximo eslaide. A tecla
|
||||
"C" mostra a tabela de conteúdos, que será novamente
|
||||
ocultada apertando-se qualquer tecla. Use a tecla "F11"
|
||||
para alternar o modo de tela cheia do navegador. Aperte
|
||||
"H" (de "Help") para abrir esta página de Ajuda. Note que
|
||||
alguns navegadores reservam algumas dessas teclas para
|
||||
outras funções. Assim, experimente no seu navegador para
|
||||
ver se esse é o seu caso.</p>
|
||||
|
||||
<p>Usuários do Firefox podem querer a extensão <a
|
||||
href="http://extensionroom.mozdev.org/more-info/autohide">autoocultar</a>
|
||||
para esconder as barras de ferramentas quando entrarem em tela cheia
|
||||
com a tecla F11.</p>
|
||||
|
||||
<p>Se quiser ver como funciona o Slidy, use o View Source para
|
||||
visualizar a marcação XHTML, ou leia esta <a
|
||||
href="http://www.w3.org/Talks/Tools/Slidy/">explanação mais longa</a>,
|
||||
que também contém funcionalidades adicionais. Cada eslaide é
|
||||
marcado como um div element com
|
||||
classe="slide". Posicionamentos e larguras em porcentual de CSS
|
||||
podem ser usados para assegurar que os eslaides com rica
|
||||
ilustração tenham escalabilidade de acordo com o tamanho da janela.
|
||||
Já o conteúdo a ser revelado incrementalmente pode receber a
|
||||
marcação com a classe="incremental".
|
||||
A folha de estilos vinculados e os scripts foram desenvolvidos
|
||||
como uma alternativa baseada em web às ferramentas proprietárias
|
||||
de apresentação, e testados em diversos navegadores recentes.
|
||||
Suporte à edição integrada ainda está em desenvolvimento. Mande
|
||||
seus comentários para <a href="http://www.w3.org/People/Raggett/">Dave
|
||||
Raggett</a> <<a href="mailto:dsr@w3.org">dsr@w3.org</a>>.
|
||||
Achando que o Slidy é útil, V. talvez possa considerar a
|
||||
possibilidade de se tornar um
|
||||
<a href="http://www.w3.org/Consortium/sup">Apoiador do W3C</a>.</p>
|
||||
|
||||
<p><em>Fique à vontade para usar as folhas de estilo, os scripts
|
||||
e o arquivo de ajuda do show de eslaides que se encontram sob as
|
||||
regras de
|
||||
<a href="http://www.w3.org/Consortium/Legal/copyright-documents">
|
||||
uso de documentação</a>
|
||||
e <a href="http://www.w3.org/Consortium/Legal/copyright-software">
|
||||
licenciamento de software</a>do W3C -- Consórcio da World Wide
|
||||
Web.</em></p>
|
||||
|
||||
<button id="back" onclick="history.go(-1)">Voltar a exibir eslaides</button>
|
||||
|
||||
<hr />
|
||||
|
||||
<p class="copyright"><a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2005
|
||||
<a href="/" shape="rect"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
||||
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
||||
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
||||
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
|
||||
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software
|
||||
licensing</a> rules apply.</p>
|
||||
</body>
|
||||
</html>
|
||||
28
slidy2/scripts/.htaccess
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
Options +MultiViews
|
||||
LanguagePriority en
|
||||
AddLanguage pt-br .pt-br
|
||||
|
||||
<Files ~ "*.html">
|
||||
|
||||
ForceType 'text/html; charset=utf-8'
|
||||
|
||||
</Files>
|
||||
|
||||
<Files ~ "*.xhtml">
|
||||
|
||||
ForceType 'application/xhtml+xml; charset=utf-8'
|
||||
|
||||
</Files>
|
||||
|
||||
<Files ~ *.css">
|
||||
|
||||
ForceType 'text/css; charset=utf-8'
|
||||
|
||||
</Files>
|
||||
|
||||
<Files ~ "*.js">
|
||||
|
||||
ForceType 'text/javascript; charset=utf-8'
|
||||
|
||||
</Files>
|
||||
mkdir
|
||||
153
slidy2/scripts/img.srcset.js
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
/* imgsrcset - Img srcset polyfill for resolution responsive images. Authors & copyright (c) 2012: WebLinc, David Knight. */
|
||||
|
||||
// Imgsrcset
|
||||
(function(win) {
|
||||
'use strict';
|
||||
|
||||
var _viewport = win.document.documentElement,
|
||||
_srcsetID = 0,
|
||||
_srcsets = [],
|
||||
_eventPrefix = '',
|
||||
_addEvent = win.addEventListener || (_eventPrefix = 'on') && win.attachEvent,
|
||||
_removeEvent = win.removeEventListener || win.detachEvent,
|
||||
_srcExpr = /[^\s]+/g,
|
||||
_digitExpr = /[0-9\.]+/g,
|
||||
_timer = 0,
|
||||
|
||||
/*
|
||||
_matches
|
||||
*/
|
||||
_matches = function(srcset) {
|
||||
var srcList = (srcset.indexOf(',') !== -1 && srcset.split(',')) || [srcset],
|
||||
srcIndex = srcList.length - 1,
|
||||
srcLength = srcIndex,
|
||||
|
||||
list = null,
|
||||
listIndex = 0,
|
||||
|
||||
src = '',
|
||||
media = '';
|
||||
|
||||
if (srcIndex < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
var list = srcList[srcLength - srcIndex].match(_srcExpr) || [],
|
||||
listIndex = list.length;
|
||||
|
||||
while (listIndex--) {
|
||||
var item = list[listIndex],
|
||||
feature = 0,
|
||||
digits = 0;
|
||||
|
||||
if (listIndex > 0) {
|
||||
feature = (item.indexOf('w') !== -1 && (win.innerWidth || _viewport.clientWidth)) ||
|
||||
(item.indexOf('h') !== -1 && (win.innerHeight || _viewport.clientHeight)) ||
|
||||
(item.indexOf('x') !== -1 && (win.devicePixelRatio || 1));
|
||||
|
||||
digits = Number(item.match(_digitExpr));
|
||||
|
||||
if (feature && digits && digits > feature) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
src = item;
|
||||
media = srcList[srcIndex];
|
||||
}
|
||||
}
|
||||
} while (srcIndex--);
|
||||
|
||||
return (src && media && {src: src, media: media}) || false;
|
||||
},
|
||||
|
||||
/*
|
||||
watch
|
||||
*/
|
||||
_watch = function(evt) {
|
||||
clearTimeout(_timer);
|
||||
|
||||
_timer = setTimeout(function() {
|
||||
var srcset = null,
|
||||
srcsetIndex = _srcsetID - 1,
|
||||
srcsetLength = srcsetIndex,
|
||||
match = false;
|
||||
|
||||
do {
|
||||
srcset = _srcsets[srcsetLength - srcsetIndex];
|
||||
|
||||
// If img element does not have a parent, remove array index to prevent caching
|
||||
if (!srcset.element.parentNode) {
|
||||
_srcsetID--;
|
||||
srcset.splice(srcsetIndex, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
match = _matches(srcset.media);
|
||||
|
||||
if (match && (srcset.matches !== match.media)) {
|
||||
srcset.matches = match.media;
|
||||
|
||||
srcset.element.src = match.src;
|
||||
} else if (!match) {
|
||||
srcset.matches = false;
|
||||
srcset.src && (srcset.element.src = srcset.src);
|
||||
}
|
||||
} while(srcsetIndex--);
|
||||
}, 10);
|
||||
},
|
||||
|
||||
/*
|
||||
init
|
||||
*/
|
||||
_init = function() {
|
||||
_removeEvent(_eventPrefix + 'load', _init);
|
||||
|
||||
win.Imgsrcset.parse();
|
||||
_watch();
|
||||
|
||||
// Processes '_srcsets' array and determines which source to use
|
||||
// '_watch' will clear out any images from the array that do not have parents, which should eliminate element caching
|
||||
_addEvent(_eventPrefix + 'resize', _watch);
|
||||
_addEvent(_eventPrefix + 'orientationchange', _watch);
|
||||
};
|
||||
|
||||
/*
|
||||
imgsrcset
|
||||
*/
|
||||
win.Imgsrcset = {
|
||||
/*
|
||||
parse
|
||||
|
||||
Called on '_init' and can also be called if new images are added/removed
|
||||
*/
|
||||
parse: function() {
|
||||
_srcsets = [];
|
||||
|
||||
var imgs = win.document.getElementsByTagName('img') || [],
|
||||
imgIndex = imgs.length - 1,
|
||||
imgLength = imgIndex,
|
||||
img = null,
|
||||
srcset = '';
|
||||
|
||||
do {
|
||||
img = imgs[imgLength - imgIndex];
|
||||
srcset = img.getAttribute('srcset') || '';
|
||||
|
||||
if (!srcset) {
|
||||
continue;
|
||||
}
|
||||
|
||||
_srcsetID = _srcsets.push({
|
||||
element : img,
|
||||
media : srcset,
|
||||
matches : false,
|
||||
src : img.getAttribute('src') || ''
|
||||
});
|
||||
} while(imgIndex--);
|
||||
}
|
||||
};
|
||||
|
||||
// Set up listeners
|
||||
_addEvent(_eventPrefix + 'load', _init);
|
||||
})(window);
|
||||
2944
slidy2/scripts/slidy.js
Normal file
28
slidy2/styles/.htaccess
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
Options +MultiViews
|
||||
LanguagePriority en
|
||||
AddLanguage pt-br .pt-br
|
||||
|
||||
<Files ~ "*.html">
|
||||
|
||||
ForceType 'text/html; charset=utf-8'
|
||||
|
||||
</Files>
|
||||
|
||||
<Files ~ "*.xhtml">
|
||||
|
||||
ForceType 'application/xhtml+xml; charset=utf-8'
|
||||
|
||||
</Files>
|
||||
|
||||
<Files ~ *.css">
|
||||
|
||||
ForceType 'text/css; charset=utf-8'
|
||||
|
||||
</Files>
|
||||
|
||||
<Files ~ "*.js">
|
||||
|
||||
ForceType 'text/javascript; charset=utf-8'
|
||||
|
||||
</Files>
|
||||
mkdir
|
||||
58
slidy2/styles/print.css
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/* print.css
|
||||
|
||||
Copyright (c) 2005 W3C (MIT, ERCIM, Keio), All Rights Reserved.
|
||||
W3C liability, trademark, document use and software licensing
|
||||
rules apply, see:
|
||||
|
||||
http://www.w3.org/Consortium/Legal/copyright-documents
|
||||
http://www.w3.org/Consortium/Legal/copyright-software
|
||||
*/
|
||||
body {
|
||||
color: black;
|
||||
font-family: sans-serif;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
div.slide { page-break-before: always; page-break-inside: avoid; }
|
||||
div.background { display: none;
|
||||
visibility: hidden; page-break-after: avoid; }
|
||||
div.handout { display: block; visibility: visible; }
|
||||
|
||||
div dt
|
||||
{
|
||||
margin-left: 0;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 0.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
div dd
|
||||
{
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
blockquote { font-style: italic }
|
||||
|
||||
pre { color: rgb(0,128,0); font-size: 80%;
|
||||
font-weight: bold; line-height: 120%; }
|
||||
|
||||
p.copyright { font-size: smaller }
|
||||
|
||||
a:visited { color: navy }
|
||||
a:link { color: blue }
|
||||
a:hover { color: red }
|
||||
a:active { color: red }
|
||||
|
||||
a {text-decoration : none}
|
||||
.navbar a:link {color: white}
|
||||
.navbar a:visited {color: yellow}
|
||||
.navbar a:active {color: red}
|
||||
.navbar a:hover {color: red}
|
||||
|
||||
ul { list-style-type: square; }
|
||||
ul ul { list-style-type: disc; }
|
||||
ul ul ul { list-style-type: circle; }
|
||||
ul ul ul ul { list-style-type: disc; }
|
||||
li { margin-left: 0.5em; }
|
||||
li li { font-size: 80%; font-style: italic }
|
||||
li li li { font-size: 80%; font-style: normal }
|
||||
|
||||
411
slidy2/styles/slidy.css
Normal file
|
|
@ -0,0 +1,411 @@
|
|||
/* slidy.css
|
||||
|
||||
Copyright (c) 2005-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
|
||||
W3C liability, trademark, document use and software licensing
|
||||
rules apply, see:
|
||||
|
||||
http://www.w3.org/Consortium/Legal/copyright-documents
|
||||
http://www.w3.org/Consortium/Legal/copyright-software
|
||||
*/
|
||||
body
|
||||
{
|
||||
margin: 0 0 0 0;
|
||||
padding: 0 0 0 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: black;
|
||||
background-color: white;
|
||||
font-family: "Gill Sans MT", "Gill Sans", GillSans, sans-serif;
|
||||
font-size: 14pt;
|
||||
}
|
||||
|
||||
div.toolbar {
|
||||
position: fixed; z-index: 200;
|
||||
top: auto; bottom: 0; left: 0; right: 0;
|
||||
height: 1.2em; text-align: right;
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
font-size: 60%;
|
||||
color: red;
|
||||
background-color: rgb(240,240,240);
|
||||
border-top: solid 1px rgb(180,180,180);
|
||||
}
|
||||
|
||||
div.toolbar span.copyright {
|
||||
color: black;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
||||
div.initial_prompt {
|
||||
position: absolute;
|
||||
z-index: 1000;
|
||||
bottom: 1.2em;
|
||||
width: 100%;
|
||||
background-color: rgb(200,200,200);
|
||||
opacity: 0.35;
|
||||
background-color: rgb(200,200,200, 0.35);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.initial_prompt p.help {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.initial_prompt p.close {
|
||||
text-align: right;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
div.slidy_toc {
|
||||
position: absolute;
|
||||
z-index: 300;
|
||||
width: 60%;
|
||||
max-width: 30em;
|
||||
height: 30em;
|
||||
overflow: auto;
|
||||
top: auto;
|
||||
right: auto;
|
||||
left: 4em;
|
||||
bottom: 4em;
|
||||
padding: 1em;
|
||||
background: rgb(240,240,240);
|
||||
border-style: solid;
|
||||
border-width: 2px;
|
||||
font-size: 60%;
|
||||
}
|
||||
|
||||
div.slidy_toc .toc_heading {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
margin-bottom: 1em;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-color: rgb(180,180,180);
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
|
||||
div.slide {
|
||||
z-index: 20;
|
||||
margin: 0 0 0 0;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
border-width: 0;
|
||||
clear: both;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
line-height: 120%;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
div.background {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.handout {
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
div.slide.titlepage {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.slide.titlepage h1 {
|
||||
padding-top: 10%;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
div.slide h1 {
|
||||
padding-left: 0;
|
||||
padding-right: 20pt;
|
||||
padding-top: 4pt;
|
||||
padding-bottom: 4pt;
|
||||
margin-top: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 60pt;
|
||||
margin-bottom: 0.5em;
|
||||
display: block;
|
||||
font-size: 160%;
|
||||
line-height: 1.2em;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
@media screen and (max-device-width: 1024px)
|
||||
{
|
||||
div.slide { font-size: 100%; }
|
||||
}
|
||||
|
||||
@media screen and (max-device-width: 800px)
|
||||
{
|
||||
div.slide { font-size: 200%; }
|
||||
div.slidy_toc {
|
||||
top: 1em;
|
||||
left: 1em;
|
||||
right: auto;
|
||||
width: 80%;
|
||||
font-size: 180%;
|
||||
}
|
||||
}
|
||||
|
||||
div.toc-heading {
|
||||
width: 100%;
|
||||
border-bottom: solid 1px rgb(180,180,180);
|
||||
margin-bottom: 1em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
img {
|
||||
image-rendering: optimize-quality;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-size: 80%;
|
||||
font-weight: bold;
|
||||
line-height: 120%;
|
||||
padding-top: 0.2em;
|
||||
padding-bottom: 0.2em;
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
border-style: solid;
|
||||
border-left-width: 1em;
|
||||
border-top-width: thin;
|
||||
border-right-width: thin;
|
||||
border-bottom-width: thin;
|
||||
border-color: #95ABD0;
|
||||
color: #00428C;
|
||||
background-color: #E4E5E7;
|
||||
}
|
||||
|
||||
li pre { margin-left: 0; }
|
||||
|
||||
blockquote { font-style: italic }
|
||||
|
||||
img { background-color: transparent }
|
||||
|
||||
p.copyright { font-size: smaller }
|
||||
|
||||
.center { text-align: center }
|
||||
.footnote { font-size: smaller; margin-left: 2em; }
|
||||
|
||||
a img { border-width: 0; border-style: none }
|
||||
|
||||
a:visited { color: navy }
|
||||
a:link { color: navy }
|
||||
a:hover { color: red; text-decoration: underline }
|
||||
a:active { color: red; text-decoration: underline }
|
||||
|
||||
a {text-decoration: none}
|
||||
.toolbar a:link {color: blue}
|
||||
.toolbar a:visited {color: blue}
|
||||
.toolbar a:active {color: red}
|
||||
.toolbar a:hover {color: red}
|
||||
|
||||
ul { list-style-type: square; }
|
||||
ul ul { list-style-type: disc; }
|
||||
ul ul ul { list-style-type: circle; }
|
||||
ul ul ul ul { list-style-type: disc; }
|
||||
li { margin-left: 0.5em; margin-top: 0.5em; }
|
||||
li li { font-size: 85%; font-style: italic }
|
||||
li li li { font-size: 85%; font-style: normal }
|
||||
|
||||
div dt
|
||||
{
|
||||
margin-left: 0;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 0.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
div dd
|
||||
{
|
||||
margin-left: 2em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
|
||||
p,pre,ul,ol,blockquote,h2,h3,h4,h5,h6,dl,table {
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
p.subhead { font-weight: bold; margin-top: 2em; }
|
||||
|
||||
.smaller { font-size: smaller }
|
||||
.bigger { font-size: 130% }
|
||||
|
||||
td,th { padding: 0.2em }
|
||||
|
||||
ul {
|
||||
margin: 0.5em 1.5em 0.5em 1.5em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ol {
|
||||
margin: 0.5em 1.5em 0.5em 1.5em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul { list-style-type: square; }
|
||||
ul ul { list-style-type: disc; }
|
||||
ul ul ul { list-style-type: circle; }
|
||||
ul ul ul ul { list-style-type: disc; }
|
||||
|
||||
ul li {
|
||||
list-style: square;
|
||||
margin: 0.1em 0em 0.6em 0;
|
||||
padding: 0 0 0 0;
|
||||
line-height: 140%;
|
||||
}
|
||||
|
||||
ol li {
|
||||
margin: 0.1em 0em 0.6em 1.5em;
|
||||
padding: 0 0 0 0px;
|
||||
line-height: 140%;
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
li ul li {
|
||||
font-size: 85%;
|
||||
font-style: italic;
|
||||
list-style-type: disc;
|
||||
background: transparent;
|
||||
padding: 0 0 0 0;
|
||||
}
|
||||
li li ul li {
|
||||
font-size: 85%;
|
||||
font-style: normal;
|
||||
list-style-type: circle;
|
||||
background: transparent;
|
||||
padding: 0 0 0 0;
|
||||
}
|
||||
li li li ul li {
|
||||
list-style-type: disc;
|
||||
background: transparent;
|
||||
padding: 0 0 0 0;
|
||||
}
|
||||
|
||||
li ol li {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
|
||||
li li ol li {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
/*
|
||||
setting class="outline on ol or ul makes it behave as an
|
||||
ouline list where blocklevel content in li elements is
|
||||
hidden by default and can be expanded or collapsed with
|
||||
mouse click. Set class="expand" on li to override default
|
||||
*/
|
||||
|
||||
ol.outline li:hover { cursor: pointer }
|
||||
ol.outline li.nofold:hover { cursor: default }
|
||||
|
||||
ul.outline li:hover { cursor: pointer }
|
||||
ul.outline li.nofold:hover { cursor: default }
|
||||
|
||||
ol.outline { list-style:decimal; }
|
||||
ol.outline ol { list-style-type:lower-alpha }
|
||||
|
||||
ol.outline li.nofold {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/nofold-dim.gif) no-repeat 0px 0.5em;
|
||||
}
|
||||
ol.outline li.unfolded {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/fold-dim.gif) no-repeat 0px 0.5em;
|
||||
}
|
||||
ol.outline li.folded {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/unfold-dim.gif) no-repeat 0px 0.5em;
|
||||
}
|
||||
ol.outline li.unfolded:hover {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/fold.gif) no-repeat 0px 0.5em;
|
||||
}
|
||||
ol.outline li.folded:hover {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/unfold.gif) no-repeat 0px 0.5em;
|
||||
}
|
||||
|
||||
ul.outline li.nofold {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/nofold-dim.gif) no-repeat 0px 0.5em;
|
||||
}
|
||||
ul.outline li.unfolded {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/fold-dim.gif) no-repeat 0px 0.5em;
|
||||
}
|
||||
ul.outline li.folded {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/unfold-dim.gif) no-repeat 0px 0.5em;
|
||||
}
|
||||
ul.outline li.unfolded:hover {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/fold.gif) no-repeat 0px 0.5em;
|
||||
}
|
||||
ul.outline li.folded:hover {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/unfold.gif) no-repeat 0px 0.5em;
|
||||
}
|
||||
|
||||
/* for slides with class "title" in table of contents */
|
||||
a.titleslide { font-weight: bold; font-style: italic }
|
||||
|
||||
/*
|
||||
hide images for work around for save as bug
|
||||
where browsers fail to save images used by CSS
|
||||
*/
|
||||
img.hidden { display: none; visibility: hidden }
|
||||
div.initial_prompt { display: none; visibility: hidden }
|
||||
|
||||
div.slide {
|
||||
visibility: visible;
|
||||
position: inherit;
|
||||
}
|
||||
div.handout {
|
||||
border-top-style: solid;
|
||||
border-top-width: thin;
|
||||
border-top-color: black;
|
||||
}
|
||||
|
||||
@media screen {
|
||||
.hidden { display: none; visibility: visible }
|
||||
|
||||
div.slide.hidden { display: block; visibility: visible }
|
||||
div.handout.hidden { display: block; visibility: visible }
|
||||
div.background { display: none; visibility: hidden }
|
||||
body.single_slide div.initial_prompt { display: block; visibility: visible }
|
||||
body.single_slide div.background { display: block; visibility: visible }
|
||||
body.single_slide div.background.hidden { display: none; visibility: hidden }
|
||||
body.single_slide .invisible { visibility: hidden }
|
||||
body.single_slide .hidden { display: none; visibility: hidden }
|
||||
body.single_slide div.slide { position: absolute }
|
||||
body.single_slide div.handout { display: none; visibility: hidden }
|
||||
}
|
||||
|
||||
@media print {
|
||||
.hidden { display: block; visibility: visible }
|
||||
|
||||
div.slide { page-break-after: always; }
|
||||
|
||||
div.slide pre { font-size: 60%; padding-left: 0.5em; }
|
||||
div.toolbar { display: none; visibility: hidden; }
|
||||
div.slidy_toc { display: none; visibility: hidden; }
|
||||
div.background { display: none; visibility: hidden; }
|
||||
|
||||
div.slide { page-break-before: always }
|
||||
|
||||
/* :first-child isn't reliable for print media */
|
||||
div.slide.first-slide { page-break-before: avoid }
|
||||
|
||||
div#pagewidth {
|
||||
display: inline ;
|
||||
}
|
||||
}
|
||||
|
||||
497
slidy2/styles/w3c-blue.css
Normal file
|
|
@ -0,0 +1,497 @@
|
|||
/* w3c-blue.css
|
||||
|
||||
Copyright (c) 2005-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
|
||||
W3C liability, trademark, document use and software licensing
|
||||
rules apply, see:
|
||||
|
||||
http://www.w3.org/Consortium/Legal/copyright-documents
|
||||
http://www.w3.org/Consortium/Legal/copyright-software
|
||||
*/
|
||||
body
|
||||
{
|
||||
margin: 0 0 0 0;
|
||||
padding: 0 0 0 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: black;
|
||||
background-color: white;
|
||||
font-family: "Gill Sans MT", "Gill Sans", GillSans, sans-serif;
|
||||
font-size: 14pt;
|
||||
}
|
||||
|
||||
div.slide.titlepage {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.slide.titlepage h1 {
|
||||
padding-top: 40%;
|
||||
}
|
||||
|
||||
div.slide {
|
||||
z-index: 20;
|
||||
margin: 0 0 0 0;
|
||||
padding: 0;
|
||||
border-width: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
line-height: 100%;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
div.background {
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
vertical-align: bottom;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: auto;
|
||||
height: 3.8em; /*4.1em; */
|
||||
padding: 0 0 0 0.2em;
|
||||
margin: 0 0 0 0;
|
||||
border-width: 0;
|
||||
background-color: #121220; /* #728ec2; */
|
||||
}
|
||||
|
||||
div.background img {
|
||||
height: 4em;
|
||||
}
|
||||
|
||||
/* this rule is hidden from IE which doesn't support + selector */
|
||||
div.slide + div[class].slide { page-break-before: always;}
|
||||
|
||||
div.slide h1 {
|
||||
padding-left: 6em;
|
||||
padding-right: 3em;
|
||||
padding-top: 0.1em;
|
||||
margin-bottom: 0.8em;
|
||||
margin-top: 0.9em; /* -0.05em; */
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
min-height: 2.3em;
|
||||
color: white;
|
||||
height: 2.2em;
|
||||
font-size: 140%;
|
||||
line-height: 1.1em;
|
||||
}
|
||||
|
||||
div.slide h1 a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div.slide h1 a:link {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div.slide h1 a:visited {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div.slide h1 a:hover {
|
||||
color: white;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
div.slide h1 a:active {
|
||||
color: red;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#head-icon {
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0;
|
||||
margin-left: 0;/*
|
||||
margin-right: 1em;
|
||||
background: #121220;
|
||||
border-width: 0;
|
||||
height: 3em;
|
||||
max-width: 3em;*/
|
||||
z-index: 2;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#head-logo {
|
||||
margin: 0;
|
||||
margin-top: 0.25em;
|
||||
padding-top: 0.25em;
|
||||
padding-bottom: 0.2em;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
height: 3.2em;
|
||||
width: 4.8em;
|
||||
float: right;
|
||||
z-index: 2;
|
||||
background: #121220;
|
||||
}
|
||||
|
||||
#head-logo-fallback {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
margin-top: -0.8em;
|
||||
width: 4.8em;
|
||||
float: right;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* the next two classes support vertical and horizontal centering */
|
||||
div.vbox {
|
||||
float: left;
|
||||
height: 40%;
|
||||
width: 50%;
|
||||
margin-top: -240px;
|
||||
}
|
||||
div.hbox {
|
||||
width:60%;
|
||||
margin-top: 0;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
height: 60%;
|
||||
border:1px solid silver;
|
||||
background:#F0F0F0;
|
||||
overflow:auto;
|
||||
text-align:left;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
/* styling for named background */
|
||||
div.background.slanty {
|
||||
z-index: 2;
|
||||
bottom: 0;
|
||||
height: 100%;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
div.background.slanty img { margin-top: 4em; width: 100%; height: 80% }
|
||||
|
||||
/* the following makes the pre background translucent */
|
||||
/* opacity is a CSS3 property but supported by Mozilla family */
|
||||
/* filter is an IE specific feature that also requires width */
|
||||
div.slide.slanty pre {
|
||||
width: 93%; /* needed for IE filter to work */
|
||||
opacity: .8;
|
||||
filter: alpha(opacity=80);
|
||||
}
|
||||
|
||||
img.withBorder {
|
||||
border: 2px solid #c60;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
li pre { margin-left: 0; }
|
||||
|
||||
@media print { pre { font-size: 60% } }
|
||||
|
||||
blockquote { font-style: italic }
|
||||
|
||||
img { background-color: transparent }
|
||||
|
||||
p.copyright { font-size: smaller }
|
||||
|
||||
.center { text-align: center }
|
||||
.footnote { font-size: smaller; margin-left: 2em; }
|
||||
|
||||
a img { border-width: 0; border-style: none }
|
||||
|
||||
a:visited { color: navy }
|
||||
a:link { color: navy }
|
||||
a:hover { color: red; text-decoration: underline }
|
||||
a:active { color: red; text-decoration: underline }
|
||||
|
||||
a {text-decoration: none}
|
||||
.navbar a:link {color: white}
|
||||
.navbar a:visited {color: yellow}
|
||||
.navbar a:active {color: red}
|
||||
.navbar a:hover {color: red}
|
||||
|
||||
ul { list-style-type: square; }
|
||||
ul ul { list-style-type: disc; }
|
||||
ul ul ul { list-style-type: circle; }
|
||||
ul ul ul ul { list-style-type: disc; }
|
||||
li { margin-left: 0.5em; margin-top: 0.5em; }
|
||||
li li { font-size: 85%; font-style: italic }
|
||||
li li li { font-size: 85%; font-style: normal }
|
||||
|
||||
div dt
|
||||
{
|
||||
margin-left: 0;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 0.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
div dd
|
||||
{
|
||||
margin-left: 2em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
|
||||
p,pre,ul,ol,blockquote,h2,h3,h4,h5,h6,dl,table {
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
p.subhead { font-weight: bold; margin-top: 2em; }
|
||||
|
||||
div.cover p.explanation {
|
||||
font-style: italic;
|
||||
margin-top: 3em;
|
||||
}
|
||||
|
||||
|
||||
.smaller { font-size: smaller }
|
||||
|
||||
td,th { padding: 0.2em }
|
||||
|
||||
ul {
|
||||
margin: 0.5em 1.5em 0.5em 1.5em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ol {
|
||||
margin: 0.5em 1.5em 0.5em 1.5em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul { list-style-type: square; }
|
||||
ul ul { list-style-type: disc; }
|
||||
ul ul ul { list-style-type: circle; }
|
||||
ul ul ul ul { list-style-type: disc; }
|
||||
li { margin-left: 0.5em; margin-top: 0.5em; }
|
||||
li li { font-size: 85%; font-style: italic }
|
||||
li li li { font-size: 85%; font-style: normal }
|
||||
|
||||
|
||||
ul li {
|
||||
list-style: none;
|
||||
margin: 0.1em 0em 0.6em 0;
|
||||
padding: 0 0 0 40px;
|
||||
background: transparent url(../graphics/bullet.png) no-repeat 5px 0.3em;
|
||||
line-height: 140%;
|
||||
}
|
||||
|
||||
/* workaround IE's failure to support background on li for print media */
|
||||
@media print { ul li { list-style: disc; padding-left: 0; background: none; } }
|
||||
|
||||
ol li {
|
||||
margin: 0.1em 0em 0.6em 1.5em;
|
||||
padding: 0 0 0 0px;
|
||||
line-height: 140%;
|
||||
}
|
||||
|
||||
li li {
|
||||
font-size: 85%;
|
||||
font-style: italic;
|
||||
list-style-type: disc;
|
||||
background: transparent;
|
||||
padding: 0 0 0 0;
|
||||
}
|
||||
li li li {
|
||||
font-size: 85%;
|
||||
font-style: normal;
|
||||
list-style-type: circle;
|
||||
background: transparent;
|
||||
padding: 0 0 0 0;
|
||||
}
|
||||
li li li li {
|
||||
list-style-type: disc;
|
||||
background: transparent;
|
||||
padding: 0 0 0 0;
|
||||
}
|
||||
|
||||
/* rectangular blue bullet + unfold/nofold/fold widget */
|
||||
|
||||
/*
|
||||
setting class="outline on ol or ul makes it behave as an
|
||||
ouline list where blocklevel content in li elements is
|
||||
hidden by default and can be expanded or collapsed with
|
||||
mouse click. Set class="expand" on li to override default
|
||||
*/
|
||||
|
||||
ol.outline li:hover { cursor: pointer }
|
||||
ol.outline li.nofold:hover { cursor: default }
|
||||
|
||||
ul.outline li:hover { cursor: pointer }
|
||||
ul.outline li.nofold:hover { cursor: default }
|
||||
|
||||
ol.outline { list-style:decimal; }
|
||||
ol.outline ol { list-style-type:lower-alpha }
|
||||
|
||||
ol.outline li.nofold {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/nofold-dim.gif) no-repeat 0px 0.3em;
|
||||
}
|
||||
ol.outline li.unfolded {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/fold-dim.gif) no-repeat 0px 0.3em;
|
||||
}
|
||||
ol.outline li.folded {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/unfold-dim.gif) no-repeat 0px 0.3em;
|
||||
}
|
||||
ol.outline li.unfolded:hover {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/fold.gif) no-repeat 0px 0.3em;
|
||||
}
|
||||
ol.outline li.folded:hover {
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url(../graphics/unfold.gif) no-repeat 0px 0.3em;
|
||||
}
|
||||
|
||||
ul.outline li.nofold {
|
||||
padding: 0 0 0 52px;
|
||||
background: transparent url(../graphics/bullet-nofold-dim.gif) no-repeat 5px 0.3em;
|
||||
}
|
||||
ul.outline li.unfolded {
|
||||
padding: 0 0 0 52px;
|
||||
background: transparent url(../graphics/bullet-fold-dim.gif) no-repeat 5px 0.3em;
|
||||
}
|
||||
ul.outline li.folded {
|
||||
padding: 0 0 0 52px;
|
||||
background: transparent url(../graphics/bullet-unfold-dim.gif) no-repeat 5px 0.3em;
|
||||
}
|
||||
ul.outline li.unfolded:hover {
|
||||
padding: 0 0 0 52px;
|
||||
background: transparent url(../graphics/bullet-fold.gif) no-repeat 5px 0.3em;
|
||||
}
|
||||
ul.outline li.folded:hover {
|
||||
padding: 0 0 0 52px;
|
||||
background: transparent url(../graphics/bullet-unfold.gif) no-repeat 5px 0.3em;
|
||||
}
|
||||
|
||||
li ul.outline li.nofold {
|
||||
padding: 0 0 0 21px;
|
||||
background: transparent url(../graphics/nofold-dim.gif) no-repeat 5px 0.3em;
|
||||
}
|
||||
li ul.outline li.unfolded {
|
||||
padding: 0 0 0 21px;
|
||||
background: transparent url(../graphics/fold-dim.gif) no-repeat 5px 0.3em;
|
||||
}
|
||||
li ul.outline li.folded {
|
||||
padding: 0 0 0 21px;
|
||||
background: transparent url(../graphics/unfold-dim.gif) no-repeat 5px 0.3em;
|
||||
}
|
||||
li ul.outline li.unfolded:hover {
|
||||
padding: 0 0 0 21px;
|
||||
background: transparent url(../graphics/fold.gif) no-repeat 5px 0.3em;
|
||||
}
|
||||
li ul.outline li.folded:hover {
|
||||
padding: 0 0 0 21px;
|
||||
background: transparent url(../graphics/unfold.gif) no-repeat 5px 0.3em;
|
||||
}
|
||||
|
||||
img {
|
||||
image-rendering: optimize-quality;
|
||||
}
|
||||
|
||||
img.withBorder {
|
||||
border: 2px solid #c60;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
div.header {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: auto;
|
||||
height: 2.95em;
|
||||
width: 100%;
|
||||
padding: 0 0 0 0;
|
||||
margin: 0 0 0 0;
|
||||
border-width: 0;
|
||||
border-style: solid;
|
||||
background-color: #005A9C;
|
||||
border-bottom-width: thick;
|
||||
border-bottom-color: #95ABD0;
|
||||
}
|
||||
|
||||
div.footer {
|
||||
position: absolute;
|
||||
z-index: 80;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: auto;
|
||||
bottom: 0;
|
||||
height: 3.5em;
|
||||
margin: 0;
|
||||
font-size: 80%;
|
||||
font-weight: bold;
|
||||
padding-left: 1em;
|
||||
padding-right: 0;
|
||||
padding-top: 0.3em;
|
||||
padding-bottom: 0;
|
||||
color: #003366;
|
||||
background-color: #95ABD0;
|
||||
}
|
||||
|
||||
/* this is a hack to hide property from IE6 and below */
|
||||
div[class="footer"] {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
#hidden-bullet {
|
||||
visibility: hidden;
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.slide.cover {
|
||||
color: white;
|
||||
background-color: #121220;
|
||||
padding-top: 0;
|
||||
padding-right: 0;
|
||||
padding-left: 3em;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
div.slide.cover h1 {
|
||||
margin: 0;
|
||||
padding: 0.5em;
|
||||
color: white;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
div.slide.cover h2 {
|
||||
color: white;
|
||||
}
|
||||
|
||||
div.slide.cover a {
|
||||
color: white;
|
||||
}
|
||||
|
||||
div.slide.cover a:visited { color: white }
|
||||
div.slide.cover a:link { color: white }
|
||||
div.slide.cover a:hover { color: yellow; text-decoration: underline }
|
||||
div.slide.cover a:active { color: yellow; text-decoration: underline }
|
||||
|
||||
div.slide.cover a:hover, div.slide.cover a:active {
|
||||
color: yellow; text-decoration: underline;
|
||||
}
|
||||
|
||||
div.slide.cover img.cover {
|
||||
margin: 0 0 0 0;
|
||||
float: right;
|
||||
padding-bottom: 4em;
|
||||
width: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.slide.cover a:hover, div.slide.cover a:active {
|
||||
color: yellow; text-decoration: underline;
|
||||
}
|
||||
|
||||
/* for Bert as an ardent user of the old W3C slidemaker tool */
|
||||
|
||||
div.comment { display: none; visibility: hidden }
|
||||
|
||||
@media print {
|
||||
div.slide h1 { background: transparent; color: black }
|
||||
div.slide.cover { background: transparent; color: black }
|
||||
div.slide.cover h1 { background: transparent; color: black }
|
||||
div.comment { display: block; visibility: visible }
|
||||
}
|
||||