├── 1_intro.html ├── 1_intro.rst ├── 2_meta.html ├── 2_meta.rst ├── 3_effects.html ├── 3_effects.rst ├── 4_cppinterop.html ├── 4_cppinterop.rst ├── build.nim ├── busyteam2.png ├── livedemo ├── codegendecl.nim ├── coverage.nim ├── coverage2.nim ├── demo.html ├── demo.nim ├── file.c2nim ├── file.h ├── file.nim └── options.c2nim ├── logo2.png ├── nimdoc.cfg ├── overview.rst └── slidy2 ├── Overview.html ├── Overview.xhtml ├── blank.html ├── graphics ├── bullet-fold-dim.gif ├── bullet-fold-dim.png ├── bullet-fold.gif ├── bullet-fold.png ├── bullet-nofold-dim.gif ├── bullet-nofold-dim.png ├── bullet-nofold.gif ├── bullet-nofold.png ├── bullet-unfold-dim.gif ├── bullet-unfold-dim.png ├── bullet-unfold.gif ├── bullet-unfold.png ├── bullet.gif ├── bullet.png ├── example.png ├── example.svg ├── face1.gif ├── face2.gif ├── face3.gif ├── face4.gif ├── fold-bright.gif ├── fold-dim.bmp ├── fold-dim.gif ├── fold.bmp ├── fold.gif ├── icon-blue.png ├── keys2.jpg ├── nofold-dim.bmp ├── nofold-dim.gif ├── nofold.bmp ├── unfold-bright.gif ├── unfold-dim.bmp ├── unfold-dim.gif ├── unfold.bmp ├── unfold.gif ├── w3c-logo-blue.gif ├── w3c-logo-blue.svg ├── w3c-logo-slanted.jpg ├── w3c-logo-white.gif └── w3c-logo-white.svg ├── help ├── .htaccess ├── help.html ├── help.html.ca ├── help.html.de ├── help.html.en ├── help.html.es ├── help.html.fr ├── help.html.hu ├── help.html.nl ├── help.html.pl ├── help.html.pt-br ├── help.html.pt_br ├── help.html.sv └── help.pt-br.html ├── scripts ├── .htaccess ├── img.srcset.js └── slidy.js └── styles ├── .htaccess ├── print.css ├── slidy.css └── w3c-blue.css /1_intro.rst: -------------------------------------------------------------------------------- 1 | ============================================================ 2 | The ultimate introduction 3 | ============================================================ 4 | 5 | 6 | .. raw:: html 7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
Slides
16 |
17 |
git clone https://github.com/Araq/oscon2015
18 |
19 |
20 |
21 |
Download
22 |
23 |
http://nim-lang.org/download.html
24 | 25 | 26 | 27 | Installation 28 | ============ 29 | 30 | :: 31 | git clone -b devel git://github.com/nim-lang/Nim.git 32 | cd Nim 33 | git clone -b devel --depth 1 git://github.com/nim-lang/csources 34 | cd csources && sh build.sh 35 | cd .. 36 | bin/nim c koch 37 | ./koch boot -d:release 38 | 39 | 40 | What is Nim? 41 | ============ 42 | 43 | - new **systems** programming language 44 | - compiles to C 45 | - garbage collection + manual memory management 46 | - thread local garbage collection 47 | - design goals: efficient, expressive, elegant 48 | 49 | .. 50 | * Nim compiles to C; C++ and Objective-C are also supported 51 | * there is an experimental JavaScript backend 52 | * it provides a soft realtime GC: you can tell it how long it is allowed to run 53 | * the Nim compiler and **all** of the standard library (including the GC) 54 | are written in Nim 55 | * whole program dead code elimination: stdlib carefully crafted to make use 56 | of it; for instance parsers do not use (runtime) regular expressions -> 57 | re engine not part of the executable 58 | * our infrastructure (IDE, build tools, package manager) is 59 | also completely written in Nim 60 | * infix/indentation based syntax 61 | 62 | 63 | Philosophy 64 | ========== 65 | 66 | * power 67 | * efficiency 68 | * fun 69 | 70 | .. 71 | Talk about what the plans for Nim were 72 | 73 | 74 | 75 | Why Nim? 76 | ======== 77 | 78 | - Major influences: Modula 3, Delphi, Ada, C++, Python, Lisp, Oberon. 79 | 80 | - Development started in 2006 81 | - First successful bootstrapping in 2008 82 | - compiler written in Delphi 83 | - converted to Nim via "pas2nim" 84 | 85 | 86 | Uses of Nim 87 | =========== 88 | 89 | - games 90 | - compilers 91 | - operating system development 92 | - scientific computing 93 | - scripting 94 | 95 | 96 | Nim at 3dicc 97 | ============ 98 | 99 | .. raw:: html 100 | 101 | 102 | 103 | 104 | URLs 105 | ==== 106 | 107 | ============ ================================================ 108 | Website http://nim-lang.org 109 | Mailing list http://www.freelists.org/list/nim-dev 110 | Forum http://forum.nim-lang.org 111 | Github https://github.com/Araq/Nim 112 | IRC irc.freenode.net/nim 113 | ============ ================================================ 114 | 115 | 116 | 117 | Hello World 118 | =========== 119 | 120 | .. code-block:: nim 121 | echo "hello world!" 122 | 123 | 124 | Hello World 125 | =========== 126 | 127 | .. code-block:: nim 128 | echo "hello world!" 129 | 130 | :: 131 | nim c -r hello.nim 132 | 133 | 134 | 135 | More Code! 136 | ========== 137 | 138 | .. code-block:: nim 139 | :number-lines: 140 | 141 | proc decimalToRoman*(number: range[1..3_999]): string = 142 | ## Converts a number to a Roman numeral. 143 | const romanComposites = { 144 | "M": 1000, "CM": 900, 145 | "D": 500, "CD": 400, "C": 100, 146 | "XC": 90, "L": 50, "XL": 40, "X": 10, "IX": 9, 147 | "V": 5, "IV": 4, "I": 1} 148 | result = "" 149 | var decVal = number.int 150 | for key, val in items(romanComposites): 151 | while decVal >= val: 152 | decVal -= val 153 | result.add(key) 154 | 155 | echo decimalToRoman(1009) # MIX 156 | 157 | 158 | - ``{"M": 1000, "CM": 900}`` sugar for ``[("M", 1000), ("CM", 900)]`` 159 | - ``result`` implicitly available 160 | 161 | 162 | Nimble 163 | ====== 164 | 165 | - Live demo. 166 | 167 | 168 | Function application 169 | ==================== 170 | 171 | Function application is ``f()``, ``f(a)``, ``f(a, b)``. 172 | 173 | 174 | Function application 175 | ==================== 176 | 177 | Function application is ``f()``, ``f(a)``, ``f(a, b)``. 178 | 179 | And here is the sugar: 180 | 181 | =========== ================== =============================== 182 | Sugar Meaning Example 183 | =========== ================== =============================== 184 | ``f a`` ``f(a)`` ``spawn log("some message")`` 185 | ``a.f()`` ``f(a)`` ``db.fetchRow()`` 186 | ``a.f`` ``f(a)`` ``mystring.len`` 187 | ``f a, b`` ``f(a, b)`` ``echo "hello ", "world"`` 188 | ``a.f(b)`` ``f(a, b)`` ``myarray.map(f)`` 189 | ``a.f b`` ``f(a, b)`` ``db.fetchRow 1`` 190 | ``f"\n"`` ``f(r"\n")`` ``re"\b[a-z*]\b"`` 191 | =========== ================== =============================== 192 | 193 | 194 | Function application 195 | ==================== 196 | 197 | Function application is ``f()``, ``f(a)``, ``f(a, b)``. 198 | 199 | And here is the sugar: 200 | 201 | =========== ================== =============================== 202 | Sugar Meaning Example 203 | =========== ================== =============================== 204 | ``f a`` ``f(a)`` ``spawn log("some message")`` 205 | ``a.f()`` ``f(a)`` ``db.fetchRow()`` 206 | ``a.f`` ``f(a)`` ``mystring.len`` 207 | ``f a, b`` ``f(a, b)`` ``echo "hello ", "world"`` 208 | ``a.f(b)`` ``f(a, b)`` ``myarray.map(f)`` 209 | ``a.f b`` ``f(a, b)`` ``db.fetchRow 1`` 210 | ``f"\n"`` ``f(r"\n")`` ``re"\b[a-z*]\b"`` 211 | =========== ================== =============================== 212 | 213 | 214 | **BUT**: ``f`` does not mean ``f()``; ``myarray.map(f)`` passes ``f`` to ``map`` 215 | 216 | 217 | Operators 218 | ========= 219 | 220 | * operators are simply sugar for functions 221 | * operator in backticks is treated like an identifier 222 | 223 | :: 224 | `@`(x, y) 225 | x.`@`(y) 226 | `@`(x) 227 | x.`@`() 228 | x.`@` 229 | 230 | 231 | Operators 232 | ========= 233 | 234 | * Of course, most of the time binary operators are simply invoked as ``x @ y`` 235 | and unary operators as ``@x``. 236 | * No explicit distinction between binary and unary operators: 237 | 238 | .. code-block:: Nim 239 | :number-lines: 240 | 241 | proc `++`(x: var int; y: int = 1; z: int = 0) = 242 | x = x + y + z 243 | 244 | var g = 70 245 | ++g 246 | g ++ 7 247 | g.`++`(10, 20) 248 | echo g # writes 108 249 | 250 | * parameters are readonly unless declared as ``var`` 251 | * ``var`` means "pass by reference" (implemented with a hidden pointer) 252 | 253 | 254 | Control flow 255 | ============ 256 | 257 | 258 | - The usual control flow statements are available: 259 | * if 260 | * case 261 | * when 262 | * while 263 | * for 264 | * try 265 | * defer 266 | * return 267 | * yield 268 | 269 | 270 | If vs when 271 | ========== 272 | 273 | .. code-block:: nim 274 | :number-lines: 275 | 276 | when defined(posix): 277 | proc getCreationTime(file: string): Time = 278 | var res: Stat 279 | if stat(file, res) < 0'i32: 280 | let error = osLastError() 281 | raiseOSError(error) 282 | return res.st_ctime 283 | 284 | 285 | 286 | Statements vs expressions 287 | ========================= 288 | 289 | Statements require indentation: 290 | 291 | .. code-block:: nim 292 | # no indentation needed for single assignment statement: 293 | if x: x = false 294 | 295 | # indentation needed for nested if statement: 296 | if x: 297 | if y: 298 | y = false 299 | else: 300 | y = true 301 | 302 | # indentation needed, because two statements follow the condition: 303 | if x: 304 | x = false 305 | y = false 306 | 307 | 308 | Statements vs expressions 309 | ========================= 310 | 311 | Expressions do not: 312 | 313 | .. code-block:: nim 314 | 315 | if thisIsaLongCondition() and 316 | thisIsAnotherLongCondition(1, 317 | 2, 3, 4): 318 | x = true 319 | 320 | - Rule of thumb: optional indentation after operators, ``(`` and ``,`` 321 | - ``if``, ``case`` etc also available as expressions 322 | 323 | 324 | 325 | Builtin types 326 | ============= 327 | 328 | - ``int`` -- platform dependent (16) 32 or 64 bit signed number 329 | * overflows produce an exception in debug mode; wrap around in release mode 330 | 331 | - ``float`` -- 64 bit floating point number 332 | * float64 an alias for float 333 | * float32 32 bit floating point number 334 | 335 | - ``int8`` / ``int16`` / ``int32`` / ``int64`` 336 | * integer types with a platform independent size 337 | 338 | 339 | Builtin types 340 | ============= 341 | 342 | - ``uint`` / ``uint8`` / ``uint16`` / ``uint32`` / ``uint64`` 343 | * like in C, always wrap around; modulo arithmetic 344 | * heavily discouraged: ``for in 0 .. x.len - 3`` 345 | should iterate 0 times when ``x.len == 0``, not 4294967293 times! 346 | * instead: use ``Natural`` 347 | 348 | - ``range[T]`` 349 | * subrange type; quite heavily used in Nim 350 | (``type Natural = range[0..high(int)]``) 351 | 352 | - ``bool`` 353 | 354 | 355 | Builtin types 356 | ============= 357 | 358 | - ``array[FixedSize, T]`` 359 | * fixed size in Nim 360 | * value based datatypes 361 | * layout is compatible to C 362 | * create via ``[1, 2, 3]`` construction 363 | 364 | - ``seq[T]`` 365 | * dynamically resizable at runtime 366 | * grow with ``add``, resize with ``setLen`` 367 | * create via ``@`` or ``newSeq``: ``@[1, 2, 3]`` 368 | * allocated on the heap and GC'ed 369 | 370 | - ``openArray[T]`` 371 | * allows to pass ``seq`` or ``array`` to a routine 372 | * internally a (pointer, length) pair 373 | 374 | 375 | Builtin types 376 | ============= 377 | 378 | - ``proc (a, b: string) {.closure.}`` 379 | * functions are first class in Nim 380 | * "calling convention" affects type compatibility 381 | * ``closure`` is a special calling convention (closures are GC'ed) 382 | 383 | - ``char`` / ``string`` / ``cstring`` 384 | * ``char`` is simply an octet, ``string`` is almost a ``seq[char]``. 385 | * ``string`` is (usually) allocated on the heap and GC'ed 386 | 387 | 388 | Builtin types 389 | ============= 390 | 391 | ``tuple`` 392 | 393 | * value based datatypes 394 | * structural typing 395 | * optional field names 396 | * construct with ``()`` 397 | 398 | .. code-block:: Nim 399 | :number-lines: 400 | 401 | proc `+-`(x, y: int): (int, int) = (x - y, x + y) 402 | # alternatively 403 | proc `+-`(x, y: int): tuple[lowerBound, upperBound: int] = (x - y, x + y) 404 | 405 | let tup = 100 +- 10 406 | echo tup[0], " ", tup.upperBound 407 | 408 | # tuple unpacking 409 | let (lower, _) = 100 +- 10 410 | 411 | 412 | Builtin types 413 | ============= 414 | 415 | ``object`` 416 | 417 | * value based datatypes 418 | 419 | .. code-block:: nim 420 | :number-lines: 421 | 422 | type 423 | Rect = object 424 | x, y, w, h: int 425 | 426 | # construction: 427 | let r = Rect(x: 12, y: 22, w: 40, h: 80) 428 | 429 | # field access: 430 | echo r.x, " ", r.y 431 | 432 | 433 | Builtin types 434 | ============= 435 | 436 | enums & sets 437 | 438 | .. code-block:: nim 439 | :number-lines: 440 | 441 | type 442 | SandboxFlag* = enum ## what the interpreter should allow 443 | allowCast, ## allow unsafe language feature: 'cast' 444 | allowFFI, ## allow the FFI 445 | allowInfiniteLoops ## allow endless loops 446 | SandboxFlags* = set[SandboxFlag] 447 | 448 | proc runNimCode(code: string; flags: SandboxFlags = {allowCast, allowFFI}) = 449 | ... 450 | 451 | 452 | Builtin types 453 | ============= 454 | 455 | .. code-block:: C 456 | :number-lines: 457 | 458 | #define allowCast (1 << 0) 459 | #define allowFFI (1 << 1) 460 | #define allowInfiniteLoops (1 << 1) 461 | 462 | void runNimCode(char* code, unsigned int flags = allowCast|allowFFI); 463 | 464 | runNimCode("4+5", 700); 465 | 466 | 467 | Builtin types 468 | ============= 469 | 470 | ``ref`` and ``ptr`` 471 | 472 | * pointers; ``ref`` is a "traced" pointer, ``ptr`` is an "untraced" pointer 473 | * ``string``, ``seq``, ``ref`` and ``closure`` are GC'ed, nothing else 474 | * ``ref object`` an idiom to get reference semantics out of objects 475 | 476 | 477 | Regular expressions 478 | =================== 479 | 480 | .. code-block:: nim 481 | :number-lines: 482 | 483 | # Model a regular expression 484 | type 485 | RegexKind = enum ## the regex AST's kind 486 | reChar, ## character node "c" 487 | reCClass, ## character class node "[a-z]" 488 | reStar, ## star node "r*" 489 | rePlus, ## plus node "r+" 490 | reOpt, ## option node "r?" 491 | reCat, ## concatenation node "ab" 492 | reAlt, ## alternatives node "a|b" 493 | reWordBoundary ## "\b" 494 | 495 | RegExpr = ref object 496 | case kind: RegexKind 497 | of reWordBoundary: discard 498 | of reChar: 499 | c: char 500 | of reCClass: 501 | cc: set[char] 502 | of reStar, rePlus, reOpt: 503 | child0: RegExpr 504 | of reCat, reAlt: 505 | child1, child2: RegExpr 506 | 507 | 508 | Equality 509 | ======== 510 | 511 | .. code-block:: nim 512 | :number-lines: 513 | 514 | proc `==`(a, b: RegExpr): bool = 515 | if a.kind == b.kind: 516 | case a.kind 517 | of reWordBoundary: result = true 518 | of reChar: result = a.c == b.c 519 | of reCClass: result = a.cc == b.cc 520 | of reStar, rePlus, reOpt: result = `==`(a.child0, b.child0) 521 | of reCat, reAlt: result = `==`(a.child1, b.child1) and 522 | `==`(a.child2, b.child2) 523 | 524 | 525 | Accessors 526 | ========= 527 | 528 | .. code-block:: nim 529 | :number-lines: 530 | 531 | type 532 | HashTable[K, V] = object 533 | data: seq[(K, V)] 534 | 535 | proc hash[K](k: K): int = 0 536 | 537 | proc `[]`*[K, V](x: HashTable[K, V]; k: K): V = 538 | result = x.data[hash(k)][1] 539 | 540 | proc `[]=`*[K, V](x: var HashTable[K, V]; k: K, v: V) = 541 | x.data[hash(k)][1] = v 542 | 543 | 544 | proc initHashTable[K, V](): HashTable[K, V] = 545 | result.data = @[] 546 | 547 | var tab = initHashTable[string, string]() 548 | tab["key"] = "abc" # calls '[]=' accessor 549 | 550 | echo tab["key"] # calls '[]' accessor 551 | 552 | 553 | Accessors 554 | ========= 555 | 556 | .. code-block:: nim 557 | :number-lines: 558 | 559 | type 560 | HashTable[K, V] = object 561 | data: seq[(K, V)] 562 | 563 | proc hash[K](k: K): int = 0 564 | 565 | proc `[]`*[K, V](x: HashTable[K, V]; k: K): V = 566 | result = x.data[hash(k)][1] 567 | 568 | proc `[]=`*[K, V](x: var HashTable[K, V]; k: K, v: V) = 569 | x.data[hash(k)][1] = v 570 | 571 | 572 | proc initHashTable[K, V](): HashTable[K, V] = 573 | result.data = @[] 574 | 575 | var tab = initHashTable[string, string]() 576 | tab["key"] = "abc" # calls '[]=' accessor 577 | 578 | echo tab["key"] # calls '[]' accessor 579 | 580 | # ouch: 581 | tab["key"].add "xyz" 582 | 583 | 584 | Accessors 585 | ========= 586 | 587 | .. code-block:: nim 588 | :number-lines: 589 | 590 | 591 | proc `[]`*[Key, Value](x: var HashTable[Key, Value]; k: Key): var Value = 592 | result = x.data[hash(key)] 593 | 594 | 595 | var 596 | tab = initHashTable[string, string]() 597 | 598 | # compiles :-) 599 | tab["key"].add "xyz" 600 | 601 | 602 | * ``var`` "pass by reference" for parameters 603 | * can also by used for return values 604 | 605 | 606 | Distinct 607 | ======== 608 | 609 | .. code-block:: nim 610 | :number-lines: 611 | 612 | # Taken from system.nim 613 | const taintMode = compileOption("taintmode") 614 | 615 | when taintMode: 616 | type TaintedString* = distinct string 617 | proc len*(s: TaintedString): int {.borrow.} 618 | else: 619 | type TaintedString* = string 620 | 621 | proc readLine*(f: File): TaintedString {.tags: [ReadIOEffect], benign.} 622 | 623 | 624 | Distinct 625 | ======== 626 | 627 | .. code-block:: nim 628 | :number-lines: 629 | # taintmode_ex 630 | 631 | echo readLine(stdin) 632 | 633 | :: 634 | nim c -r --taintMode:on taintmode_ex 635 | 636 | 637 | 638 | Distinct 639 | ======== 640 | 641 | .. code-block:: nim 642 | :number-lines: 643 | # taintmode_ex 644 | 645 | echo readLine(stdin).string 646 | 647 | :: 648 | nim c -r --taintMode:on taintmode_ex 649 | 650 | 651 | 652 | Distinct 653 | ======== 654 | 655 | .. code-block:: nim 656 | :number-lines: 657 | # taintmode_ex 658 | 659 | proc `$`(x: TaintedString): string {.borrow.} # but: defeats the purpose 660 | 661 | echo readLine(stdin) 662 | 663 | :: 664 | nim c -r --taintMode:on taintmode_ex 665 | 666 | 667 | Module system 668 | ============= 669 | 670 | .. code-block::nim 671 | :number-lines: 672 | 673 | # Module A 674 | var 675 | global*: string = "A.global" 676 | 677 | proc p*(x: string) = echo "exported ", x 678 | 679 | 680 | .. code-block::nim 681 | :number-lines: 682 | 683 | # Module B 684 | import A 685 | 686 | echo p(global) 687 | 688 | 689 | Module system 690 | ============= 691 | 692 | .. code-block::nim 693 | :number-lines: 694 | 695 | # Module A 696 | var 697 | global*: string = "A.global" 698 | 699 | proc p*(x: string) = echo "exported ", x 700 | 701 | 702 | .. code-block::nim 703 | :number-lines: 704 | 705 | # Module B 706 | from A import p 707 | 708 | echo p(A.global) 709 | 710 | 711 | Module system 712 | ============= 713 | 714 | .. code-block::nim 715 | :number-lines: 716 | 717 | # Module A 718 | var 719 | global*: string = "A.global" 720 | 721 | proc p*(x: string) = echo "exported ", x 722 | 723 | 724 | .. code-block::nim 725 | :number-lines: 726 | 727 | # Module B 728 | import A except global 729 | 730 | echo p(A.global) 731 | 732 | 733 | 734 | Routines 735 | ======== 736 | 737 | - ``proc`` 738 | - ``iterator`` 739 | - ``template`` 740 | - ``macro`` 741 | - ``method`` 742 | - ``converter`` 743 | - (``func``) 744 | 745 | 746 | Iterators 747 | ========= 748 | 749 | .. code-block:: nim 750 | :number-lines: 751 | 752 | iterator `..<`(a, b: int): int = 753 | var i = a 754 | while i < b: 755 | yield i 756 | i += 1 757 | 758 | for i in 0..<10: 759 | echo i+1, "-th iteration" 760 | 761 | 762 | Iterators 763 | ========= 764 | 765 | .. code-block:: nim 766 | :number-lines: 767 | 768 | for x in [1, 2, 3]: 769 | echo x 770 | 771 | 772 | 773 | Iterators 774 | ========= 775 | 776 | .. code-block:: nim 777 | :number-lines: 778 | 779 | for x in [1, 2, 3]: 780 | echo x 781 | 782 | 783 | Rewritten to: 784 | 785 | 786 | .. code-block:: nim 787 | :number-lines: 788 | 789 | for x in items([1, 2, 3]): 790 | echo x 791 | 792 | .. 793 | for i, x in foobar is rewritten to use the pairs iterator 794 | 795 | 796 | Iterators 797 | ========= 798 | 799 | .. code-block:: nim 800 | :number-lines: 801 | 802 | iterator items*[IX, T](a: array[IX, T]): T {.inline.} = 803 | var i = low(IX) 804 | while i <= high(IX): 805 | yield a[i] 806 | i += 1 807 | 808 | 809 | Iterators 810 | ========= 811 | 812 | .. code-block:: nim 813 | :number-lines: 814 | 815 | for x in [1, 2, 3]: 816 | x = 0 # doesn't compile 817 | 818 | 819 | 820 | Iterators 821 | ========= 822 | 823 | .. code-block:: nim 824 | :number-lines: 825 | 826 | var a = [1, 2, 3] 827 | for x in a: 828 | x = 0 # doesn't compile 829 | 830 | 831 | Iterators 832 | ========= 833 | 834 | .. code-block:: nim 835 | :number-lines: 836 | 837 | iterator mitems*[IX, T](a: var array[IX, T]): var T {.inline.} = 838 | var i = low(IX) 839 | if i <= high(IX): 840 | while true: 841 | yield a[i] 842 | if i >= high(IX): break 843 | i += 1 844 | 845 | var a = [1, 2, 3] 846 | for x in mitems(a): 847 | x = 0 # compiles 848 | 849 | 850 | Parallelism 851 | =========== 852 | 853 | .. code-block::nim 854 | :number-lines: 855 | 856 | import tables, strutils 857 | 858 | proc countWords(filename: string): CountTableRef[string] = 859 | ## Counts all the words in the file. 860 | result = newCountTable[string]() 861 | for word in readFile(filename).split: 862 | result.inc word 863 | 864 | 865 | Parallelism 866 | =========== 867 | 868 | .. code-block::nim 869 | :number-lines: 870 | 871 | # 872 | # 873 | const 874 | files = ["data1.txt", "data2.txt", "data3.txt", "data4.txt"] 875 | 876 | proc main() = 877 | var tab = newCountTable[string]() 878 | for f in files: 879 | let tab2 = countWords(f) 880 | tab.merge(tab2) 881 | tab.sort() 882 | echo tab.largest 883 | 884 | main() 885 | 886 | 887 | Parallelism 888 | =========== 889 | 890 | .. code-block::nim 891 | :number-lines: 892 | 893 | import threadpool 894 | 895 | const 896 | files = ["data1.txt", "data2.txt", "data3.txt", "data4.txt"] 897 | 898 | proc main() = 899 | var tab = newCountTable[string]() 900 | var results: array[files.len, ***FlowVar[CountTableRef[string]]***] 901 | for i, f in files: 902 | results[i] = ***spawn*** countWords(f) 903 | for i in 0..high(results): 904 | tab.merge(*** ^results[i] ***) 905 | tab.sort() 906 | echo tab.largest 907 | 908 | main() 909 | -------------------------------------------------------------------------------- /2_meta.rst: -------------------------------------------------------------------------------- 1 | ================================================================= 2 | Meta programming 3 | ================================================================= 4 | 5 | 6 | Templates 7 | ========= 8 | 9 | * templates are declarative, macros imperative 10 | 11 | .. code-block:: nim 12 | # from System.nim 13 | template `!=` (a, b: untyped): untyped = 14 | not (a == b) 15 | 16 | assert(5 != 6) # rewritten to: assert(not (5 == 6)) 17 | 18 | * more transformations 19 | - ``a > b`` is rewritten to ``b < a``. 20 | - ``a in b`` is rewritten to ``contains(b, a)``. 21 | - ``a notin b`` is rewritten to ``not (a in b)``. 22 | - ``a isnot b`` is rewritten to ``not (a is b)``. 23 | 24 | 25 | Templates 26 | ========= 27 | 28 | .. code-block:: nim 29 | :number-lines: 30 | 31 | template html(name, body) = 32 | proc name(): string = 33 | result = "" 34 | body 35 | result.add("") 36 | 37 | html mainPage: 38 | echo "colon syntax to pass statements to template" 39 | 40 | 41 | 42 | Templates 43 | ========= 44 | 45 | Templates already suffice to implement simple DSLs: 46 | 47 | .. code-block:: nim 48 | :number-lines: 49 | 50 | html mainPage: 51 | head: 52 | title "The Nim programming language" 53 | body: 54 | ul: 55 | li "efficient" 56 | li "expressive" 57 | li "elegant" 58 | 59 | echo mainPage() 60 | 61 | 62 | Produces:: 63 | 64 | 65 | The Nim programming language 66 | 67 | 72 | 73 | 74 | 75 | 76 | Templates 77 | ========= 78 | 79 | .. code-block:: nim 80 | template html(name, body) = 81 | proc name(): string = 82 | result = "" 83 | body 84 | result.add("") 85 | 86 | template head(body) = 87 | result.add("") 88 | body 89 | result.add("") 90 | 91 | ... 92 | 93 | template title(x) = 94 | result.add("$1" % x) 95 | 96 | template li(x) = 97 | result.add("
  • $1
  • " % x) 98 | 99 | 100 | Templates 101 | ========= 102 | 103 | .. code-block:: nim 104 | :number-lines: 105 | 106 | proc mainPage(): string = 107 | result = "" 108 | result.add("") 109 | result.add("$1" % "The Nim programming language") 110 | result.add("") 111 | result.add("") 112 | result.add("") 117 | result.add("") 118 | result.add("") 119 | 120 | 121 | Macros 122 | ====== 123 | 124 | * imperative AST to AST transformations 125 | * Turing complete 126 | * ``macros`` module provides an API for dealing with Nim ASTs 127 | 128 | 129 | 130 | Code coverage 131 | ============= 132 | 133 | .. code-block:: nim 134 | :number-lines: 135 | 136 | proc toTest(x, y: int) = 137 | try: 138 | case x 139 | of 8: 140 | if y > 9: echo "8.1" 141 | else: echo "8.2" 142 | of 9: echo "9" 143 | else: echo "else" 144 | echo "no exception" 145 | except IoError: 146 | echo "IoError" 147 | 148 | toTest(8, 10) 149 | toTest(10, 10) 150 | 151 | 152 | Code coverage 153 | ============= 154 | 155 | .. code-block:: nim 156 | :number-lines: 157 | 158 | proc toTest(x, y: int) = 159 | try: 160 | case x 161 | of 8: 162 | if y > 9: echo "8.1" 163 | else: ***echo "8.2"*** 164 | of 9: ***echo "9"*** 165 | else: echo "else" 166 | echo "no exception" 167 | except IoError: 168 | ***echo "IoError"*** 169 | 170 | toTest(8, 10) 171 | toTest(10, 10) 172 | 173 | 174 | 175 | Code coverage 176 | ============= 177 | 178 | .. code-block:: nim 179 | :number-lines: 180 | # This is the code our macro will produce! 181 | 182 | var 183 | track = [("line 11", false), ("line 15", false), ...] 184 | 185 | proc toTest(x, y: int) = 186 | try: 187 | case x 188 | of 8: 189 | if y > 9: 190 | track[0][1] = true 191 | echo "8.1" 192 | else: 193 | track[1][1] = true 194 | echo "8.2" 195 | of 9: 196 | track[2][1] = true 197 | echo "9" 198 | else: 199 | track[3][1] = true 200 | echo "foo" 201 | echo "no exception" 202 | except IoError: 203 | track[4][1] = true 204 | echo "IoError" 205 | 206 | 207 | Code coverage 208 | ============= 209 | 210 | .. code-block:: nim 211 | :number-lines: 212 | 213 | toTest(8, 10) 214 | toTest(1, 2) 215 | 216 | proc listCoverage(s: openArray[(string, bool)]) = 217 | for x in s: 218 | if not x[1]: echo "NOT COVERED ", x[0] 219 | 220 | listCoverage(track) 221 | 222 | 223 | Code coverage 224 | ============= 225 | 226 | .. code-block:: nim 227 | :number-lines: 228 | 229 | import macros 230 | 231 | macro cov(n: untyped): untyped = 232 | result = n 233 | echo treeRepr n 234 | 235 | cov: 236 | proc toTest(x, y: int) = 237 | try: 238 | case x 239 | of 8: 240 | if y > 9: echo "8.1" 241 | else: echo "8.2" 242 | of 9: echo "9" 243 | else: echo "foo" 244 | echo "no exception" 245 | except IoError: 246 | echo "IoError" 247 | 248 | toTest(8, 10) 249 | toTest(10, 10) 250 | 251 | 252 | Code coverage 253 | ============= 254 | 255 | :: 256 | ... 257 | TryStmt 258 | StmtList 259 | CaseStmt 260 | Ident !"x" 261 | OfBranch 262 | IntLit 8 263 | StmtList 264 | IfStmt 265 | ElifBranch 266 | Infix 267 | Ident !">" 268 | Ident !"y" 269 | IntLit 9 270 | StmtList [...] 271 | Else 272 | StmtList [...] 273 | OfBranch 274 | IntLit 9 275 | StmtList 276 | Command 277 | Ident !"echo" 278 | StrLit 9 279 | Else 280 | StmtList 281 | Command 282 | Ident !"echo" 283 | StrLit foo 284 | Command [...] 285 | ExceptBranch 286 | [...] 287 | 288 | 289 | 290 | Code coverage 291 | ============= 292 | 293 | .. code-block:: nim 294 | :number-lines: 295 | 296 | ## Code coverage macro 297 | 298 | import macros 299 | 300 | proc transform(n, track, list: NimNode): NimNode {.compileTime.} = 301 | ... 302 | 303 | macro cov(body: untyped): untyped = 304 | var list = newNimNode(nnkBracket) 305 | let track = genSym(nskVar, "track") 306 | result = transform(body, track, list) 307 | result = newStmtList(newVarStmt(track, list), result, 308 | newCall(bindSym"listCoverage", track)) 309 | echo result.toStrLit 310 | 311 | 312 | cov: 313 | proc toTest(x, y: int) = 314 | ... 315 | 316 | toTest(8, 10) 317 | toTest(10, 10) 318 | 319 | 320 | Macros 321 | ====== 322 | 323 | .. code-block:: nim 324 | :number-lines: 325 | 326 | proc transform(n, track, list: NimNode): NimNode {.compileTime.} = 327 | # recurse: 328 | result = copyNimNode(n) 329 | for c in n.children: 330 | result.add c.transform(track, list) 331 | 332 | if n.kind in {nnkElifBranch, nnkOfBranch, nnkExceptBranch, nnkElse}: 333 | let lineinfo = result[^1].lineinfo 334 | 335 | template trackStmt(track, i) = 336 | track[i][1] = true 337 | result[^1] = newStmtList(getAst trackStmt(track, list.len), result[^1]) 338 | 339 | template tup(lineinfo) = 340 | (lineinfo, false) 341 | list.add(getAst tup(lineinfo)) 342 | 343 | 344 | Macros 345 | ====== 346 | 347 | Result:: 348 | 8.1 349 | no exception 350 | else 351 | no exception 352 | NOT COVERED coverage.nim(42,14) 353 | NOT COVERED coverage.nim(43,12) 354 | NOT COVERED coverage.nim(47,6) 355 | 356 | 357 | Macros 358 | ====== 359 | 360 | .. code-block:: nim 361 | :number-lines: 362 | 363 | proc toTest(x, y: int) = 364 | try: 365 | case x 366 | of 8: 367 | if y > 9: echo "8.1" 368 | else: ***echo "8.2"*** 369 | of 9: ***echo "9"*** 370 | else: echo "else" 371 | echo "no exception" 372 | except IoError: 373 | ***echo "IoError"*** 374 | 375 | toTest(8, 10) 376 | toTest(10, 10) 377 | 378 | 379 | -------------------------------------------------------------------------------- /3_effects.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | Effect system 3 | ============= 4 | 5 | 6 | NoSideEffect 7 | ============ 8 | 9 | .. code-block:: nim 10 | :number-lines: 11 | 12 | cov: 13 | proc toTest(x, y: int): int {.noSideEffect.} = 14 | case x 15 | of 8: 16 | if y > 9: 8+1 17 | else: 8+2 18 | of 9: 9 19 | else: 100 20 | 21 | # Error: 'toTest' can have side-effects 22 | 23 | 24 | 25 | NoSideEffect 26 | ============ 27 | 28 | .. code-block:: nim 29 | :number-lines: 30 | 31 | var 32 | track = [("line 9", false), ("line 13", false), ...] 33 | 34 | proc toTest(x, y: int): int {.noSideEffect.} = 35 | case x 36 | of 8: 37 | if y > 9: 38 | track[0][1] = true 39 | ... 40 | 41 | 42 | 43 | NoSideEffect 44 | ============ 45 | 46 | .. code-block:: nim 47 | :number-lines: 48 | 49 | var 50 | track = [("line 9", false), ("line 13", false), ...] 51 | 52 | proc setter(x: int) = 53 | track[x][1] = true 54 | 55 | type HideEffects = proc (x: int) {.noSideEffect, raises: [], tags: [].} 56 | 57 | proc toTest(x, y: int): int = 58 | case x 59 | of 8: 60 | if y > 9: 61 | cast[HideEffects](setter)(0) 62 | ... 63 | 64 | 65 | Effect System 66 | ============= 67 | 68 | - tracks side effects 69 | - tracks exceptions 70 | - tracks "tags": ReadIOEffect, WriteIoEffect, TimeEffect, 71 | ReadDirEffect, **ExecIOEffect** 72 | - tracks locking levels; deadlock prevention at compile-time 73 | 74 | .. 75 | Think of ``(T, E)`` as opposed to ``E[T]``. 76 | 77 | 78 | Exceptions 79 | ========== 80 | 81 | .. code-block:: nim 82 | :number-lines: 83 | 84 | import strutils 85 | 86 | proc readFromFile() {.raises: [].} = 87 | # read the first two lines of a text file that should contain numbers 88 | # and tries to add them 89 | var 90 | f: File 91 | if open(f, "numbers.txt"): 92 | try: 93 | var a = readLine(f) 94 | var b = readLine(f) 95 | echo("sum: " & $(parseInt(a) + parseInt(b))) 96 | except OverflowError: 97 | echo("overflow!") 98 | except ValueError: 99 | echo("could not convert string to integer") 100 | except IOError: 101 | echo("IO error!") 102 | except: 103 | echo("Unknown exception!") 104 | finally: 105 | close(f) 106 | 107 | .. 108 | - describe inference algorithm 109 | 110 | proc noRaise(x: proc()) {.raises: [].} = 111 | # unknown call that might raise anything, but valid: 112 | x() 113 | 114 | proc doRaise() {.raises: [IOError].} = 115 | raise newException(IOError, "IO") 116 | 117 | proc use() {.raises: [].} = 118 | # doesn't compile! Can raise IOError! 119 | noRaise(doRaise) 120 | 121 | 122 | Tags 123 | ==== 124 | 125 | .. code-block:: nim 126 | :number-lines: 127 | type 128 | TagA = object of RootEffect 129 | TagB = object of RootEffect 130 | 131 | proc a() {.tags: [TagA].} = discard 132 | proc b() {.tags: [TagB].} = discard 133 | 134 | proc x(input: int) {.tags: [ ? ].} = 135 | if input < 0: a() 136 | else: b() 137 | 138 | .. 139 | Just demonstrate 'doc2' here 140 | 141 | 142 | Tags 143 | ==== 144 | 145 | .. code-block:: nim 146 | :number-lines: 147 | type 148 | TagA = object of RootEffect 149 | TagB = object of RootEffect 150 | 151 | proc a() {.tags: [TagA].} = discard 152 | proc b() {.tags: [TagB].} = discard 153 | 154 | proc x(input: int) {.tags: [TagA, TagB].} = 155 | if input < 0: a() 156 | else: b() 157 | 158 | 159 | Tags 160 | ==== 161 | 162 | .. code-block:: nim 163 | :number-lines: 164 | 165 | proc execProcesses(commands: openArray[string], 166 | beforeRunEvent: proc (command: string) = nil): int 167 | {.tags: [ExecIOEffect].} 168 | ## executes the commands in parallel. The highest return value of 169 | ## all processes is returned. Runs `beforeRunEvent` before running each 170 | ## command. 171 | 172 | proc echoCommand(command: string) {.tags: [WriteIOEffect].} = 173 | echo command 174 | 175 | proc compose*() = 176 | execProcesses(["gcc -o foo foo.c", 177 | "gcc -o bar bar.c", 178 | "gcc -o baz baz.c"], 179 | echoCommand) 180 | 181 | 182 | 183 | GC safety 184 | ========= 185 | 186 | - a ``spawn``'ed proc must be ``gcsafe`` 187 | - ``gcsafe``: Does not access global variables containing GC'ed memory 188 | - ``noSideEffect``: Does not access global variables 189 | - ``noSideEffect`` implies ``gcsafe`` 190 | 191 | 192 | GC safety 193 | ========= 194 | 195 | .. code-block:: nim 196 | :number-lines: 197 | 198 | import tables, strutils, threadpool 199 | 200 | const 201 | files = ["data1.txt", "data2.txt", "data3.txt", "data4.txt"] 202 | 203 | var tab = newCountTable[string]() 204 | 205 | proc countWords(filename: string) = 206 | ## Counts all the words in the file. 207 | for word in readFile(filename).split: 208 | tab.inc word 209 | 210 | for f in files: 211 | spawn countWords(f) 212 | sync() 213 | tab.sort() 214 | echo tab.largest 215 | 216 | 217 | GC safety 218 | ========= 219 | 220 | .. code-block:: nim 221 | :number-lines: 222 | 223 | import threadpool, tables, strutils 224 | 225 | {.pragma: isolated, threadvar.} 226 | 227 | var tab {.isolated.}: CountTable[string] 228 | 229 | proc rawPut(key: string) = 230 | inc(tab, key) 231 | 232 | proc put(key: string) = 233 | pinnedSpawn 0, rawPut(key) 234 | 235 | proc rawGet(): string = 236 | tab.sort() 237 | result = tab.largest()[0] 238 | 239 | proc getMax(): string = 240 | let flow = pinnedSpawn(0, rawGet()) 241 | result = ^flow 242 | 243 | proc main = 244 | pinnedSpawn 0, (proc () = tab = initCountTable[string]()) 245 | for x in split(readFile("readme.txt")): 246 | put x 247 | echo getMax() 248 | 249 | main() 250 | 251 | 252 | 253 | Guards and locks 254 | ================ 255 | 256 | - common low level concurrency mechanisms like locks, atomic instructions or 257 | condition variables are available 258 | - guards fight data races 259 | - locking levels fight deadlocks 260 | 261 | 262 | Data race 263 | ========= 264 | 265 | A data race occurs when: 266 | 267 | - two or more threads access the same memory location concurrently 268 | - at least one of the accesses is for writing 269 | - the threads are not using any exclusive locks to control their accesses 270 | 271 | 272 | Guards fight data races 273 | ======================= 274 | 275 | - Object fields and global variables can be annotated via a ``guard`` pragma 276 | - Access then has to be within a ``locks`` section: 277 | 278 | .. code-block:: nim 279 | :number-lines: 280 | 281 | var glock: Lock 282 | var gdata {.guard: glock.}: int 283 | 284 | proc invalid = 285 | # invalid: unguarded access: 286 | echo gdata 287 | 288 | proc valid = 289 | # valid access: 290 | {.locks: [glock].}: 291 | echo gdata 292 | 293 | 294 | Guards fight data races 295 | ======================= 296 | 297 | .. code-block:: nim 298 | :number-lines: 299 | 300 | template lock(a: Lock; body: untyped) = 301 | pthread_mutex_lock(a) 302 | {.locks: [a].}: 303 | try: 304 | body 305 | finally: 306 | pthread_mutex_unlock(a) 307 | 308 | 309 | Guards fight data races 310 | ======================= 311 | 312 | .. code-block:: nim 313 | :number-lines: 314 | 315 | var dummyLock {.compileTime.}: int 316 | var atomicCounter {.guard: dummyLock.}: int 317 | 318 | template atomicRead(x): expr = 319 | {.locks: [dummyLock].}: 320 | memoryReadBarrier() 321 | x 322 | 323 | echo atomicRead(atomicCounter) 324 | 325 | 326 | Deadlocks 327 | ========= 328 | 329 | A deadlock occurs when: 330 | 331 | - thread A acquires lock L1 332 | - thread B acquires lock L2 333 | - thread A tries to acquire lock L2 334 | - thread B tries to acquire lock L1 335 | 336 | Solution? 337 | 338 | 339 | Deadlocks 340 | ========= 341 | 342 | A deadlock occurs when: 343 | 344 | - thread A acquires lock L1 345 | - thread B acquires lock L2 346 | - thread A tries to acquire lock L2 347 | - thread B tries to acquire lock L1 348 | 349 | Solution? 350 | 351 | - enforce L1 is always acquired before L2 352 | 353 | 354 | 355 | Locking levels fight deadlocks 356 | ============================== 357 | 358 | .. code-block:: nim 359 | :number-lines: 360 | 361 | var a, b: Lock[2] 362 | var x: Lock[1] 363 | # invalid locking order: Lock[1] cannot be acquired before Lock[2]: 364 | {.locks: [x].}: 365 | {.locks: [a].}: 366 | ... 367 | # valid locking order: Lock[2] acquired before Lock[1]: 368 | {.locks: [a].}: 369 | {.locks: [x].}: 370 | ... 371 | 372 | # invalid locking order: Lock[2] acquired before Lock[2]: 373 | {.locks: [a].}: 374 | {.locks: [b].}: 375 | ... 376 | 377 | # valid locking order, locks of the same level acquired at the same time: 378 | {.locks: [a, b].}: 379 | ... 380 | 381 | 382 | 383 | Locking levels fight deadlocks 384 | ============================== 385 | 386 | .. code-block:: nim 387 | :number-lines: 388 | 389 | template multilock(a, b: ptr Lock; body: stmt) = 390 | if cast[ByteAddress](a) < cast[ByteAddress](b): 391 | pthread_mutex_lock(a) 392 | pthread_mutex_lock(b) 393 | else: 394 | pthread_mutex_lock(b) 395 | pthread_mutex_lock(a) 396 | {.locks: [a, b].}: 397 | try: 398 | body 399 | finally: 400 | pthread_mutex_unlock(a) 401 | pthread_mutex_unlock(b) 402 | 403 | 404 | Locking levels fight deadlocks 405 | ============================== 406 | 407 | .. code-block:: nim 408 | :number-lines: 409 | 410 | proc p() {.locks: 3.} = discard 411 | 412 | var a: Lock[4] 413 | {.locks: [a].}: 414 | # p's locklevel (3) is strictly less than a's (4) so the call is allowed: 415 | p() 416 | -------------------------------------------------------------------------------- /4_cppinterop.rst: -------------------------------------------------------------------------------- 1 | ====================== 2 | Interfacing with C/C++ 3 | ====================== 4 | 5 | 6 | Interfacing with C 7 | ================== 8 | 9 | 2 options 10 | 11 | - via ``dynlib`` 12 | - via ``header`` 13 | 14 | 15 | Dynlib import 16 | ============= 17 | 18 | .. code-block:: Nim 19 | :number-lines: 20 | type 21 | GtkWidget = object 22 | data: cint 23 | binary: cfloat 24 | compatible: char 25 | 26 | proc gtk_image_new(): ptr GtkWidget 27 | {.cdecl, dynlib: "libgtk-x11-2.0.so", importc.} 28 | 29 | 30 | 31 | Header import 32 | ============= 33 | 34 | .. code-block:: 35 | :number-lines: 36 | 37 | type 38 | GtkWidget {.importc: "GtkWidget_t", header: "".} = object 39 | data {.importc: "Data".}: cint 40 | binary {.importc: "Binary".}: cfloat 41 | compatible: char 42 | 43 | proc gtk_image_new(): ptr GtkWidget 44 | {.cdecl, header: "", importc.} 45 | 46 | {.passC: staticExec("pkg-config --cflags gtk").} 47 | {.passL: staticExec("pkg-config --libs gtk").} 48 | 49 | 50 | 51 | Header import 52 | ============= 53 | 54 | .. code-block:: 55 | :number-lines: 56 | 57 | proc printf(formatstr: cstring) 58 | {.header: "", importc: "printf", varargs.} 59 | 60 | printf("%s%s", "Nim strings ", "converted to cstring for you") 61 | 62 | 63 | Data exchange with C 64 | ==================== 65 | 66 | ================= ========================================================== 67 | C type Nim type 68 | ================= ========================================================== 69 | ``int`` ``cint`` 70 | ``unsigned long`` ``culong`` 71 | ``float`` ``cfloat`` 72 | ``int x[4]`` ``array[4, cint]`` 73 | ``int*`` ``ptr int`` 74 | ``char*`` ``cstring`` 75 | ``char**`` ``cstringArray = ptr array [0..ArrayDummySize, cstring]`` 76 | ================= ========================================================== 77 | 78 | 79 | Data exchange with C 80 | ==================== 81 | 82 | .. code-block:: C 83 | :number-lines: 84 | 85 | int sum(int* x, size_t len) { 86 | int result = 0; 87 | for (size_t i = 0; i < len; i++) 88 | result += x[i]; 89 | return result; 90 | } 91 | 92 | 93 | Data exchange with C 94 | ==================== 95 | 96 | .. code-block:: C 97 | :number-lines: 98 | 99 | int sum(int* x, size_t len) { 100 | int result = 0; 101 | for (size_t i = 0; i < len; i++) 102 | result += x[i]; 103 | return result; 104 | } 105 | 106 | .. code-block:: Nim 107 | :number-lines: 108 | 109 | proc sum(x: ptr cint; len: int): cint 110 | {.importc: "sum", cdecl, header: "foo.h".} 111 | 112 | proc callSum = 113 | var x = @[1.cint, 2, 3, 4] 114 | echo sum(addr x[0], x.len) 115 | 116 | var y = [1.cint, 2, 3, 4] 117 | echo sum(addr y[0], y.len) 118 | 119 | 120 | 121 | CodegenDecl pragma 122 | ================== 123 | 124 | 125 | .. code-block:: nim 126 | :number-lines: 127 | 128 | var 129 | a {.codegenDecl: "$# progmem $#".}: int 130 | 131 | proc myinterrupt() {.codegenDecl: "__interrupt $# $#$#".} = 132 | echo "realistic interrupt handler" 133 | 134 | 135 | 136 | 137 | 138 | Wrapping C++ 139 | ============ 140 | 141 | .. code-block:: C++ 142 | :number-lines: 143 | 144 | class Foo { 145 | public: 146 | int value; 147 | int GetValue() { return value; } 148 | int& SetValue(int x) { field = x; return &field; } 149 | }; 150 | 151 | .. code-block:: Nim 152 | :number-lines: 153 | 154 | type 155 | Foo* {.importcpp: "Foo", header: "file.h".} = object 156 | value*: cint 157 | 158 | proc getValue*(this: var Foo): cint 159 | {.importcpp: "GetValue", header: "file.h".} 160 | proc setValue*(this: var Foo; x: cint): var cint 161 | {.importcpp: "SetValue", header: "file.h".} 162 | 163 | 164 | Wrapping C++ 165 | ============ 166 | 167 | .. code-block:: C++ 168 | :number-lines: 169 | 170 | class Foo { 171 | public: 172 | int value; 173 | int GetValue() { return value; } 174 | int& SetValue(int x) { field = x; return &field; } 175 | }; 176 | 177 | .. code-block:: Nim 178 | :number-lines: 179 | 180 | type 181 | Foo* {.importcpp: "Foo", header: "file.h".} = object 182 | value*: cint 183 | 184 | proc getValue*(this: var Foo): cint 185 | {.importcpp: "#.GetValue(@)", header: "file.h".} 186 | proc setValue*(this: var Foo; x: cint): var cint 187 | {.importcpp: "#.SetValue(@)", header: "file.h".} 188 | 189 | 190 | 191 | Constructors 192 | ============ 193 | 194 | .. code-block:: C++ 195 | :number-lines: 196 | 197 | class Foo { 198 | public: 199 | int value; 200 | int GetValue() { return value; } 201 | int& SetValue(int x) { field = x; return &field; } 202 | 203 | Foo(int x): field(x) {} 204 | }; 205 | 206 | .. code-block:: Nim 207 | :number-lines: 208 | 209 | type 210 | Foo* {.importcpp: "Foo", header: "file.h".} = object 211 | value*: cint 212 | 213 | proc getValue*(this: var Foo): cint 214 | {.importcpp: "#.GetValue(@)", header: "file.h".} 215 | proc setValue*(this: var Foo; x: cint): var cint 216 | {.importcpp: "#.SetValue(@)", header: "file.h".} 217 | 218 | proc constructFoo*(x: cint): Foo 219 | {.importcpp: "Foo(@)", header: "file.h".} 220 | 221 | 222 | Constructors 223 | ============ 224 | 225 | .. code-block:: C++ 226 | :number-lines: 227 | 228 | Foo foo = Foo(1, 2, 3); 229 | 230 | auto foo = Foo(1, 2, 3); 231 | 232 | 233 | Constructors 234 | ============ 235 | 236 | .. code-block:: C++ 237 | :number-lines: 238 | 239 | Foo foo = Foo(1, 2, 3); 240 | // Calls copy constructor! 241 | auto foo = Foo(1, 2, 3); 242 | 243 | 244 | Constructors 245 | ============ 246 | 247 | .. code-block:: C++ 248 | :number-lines: 249 | 250 | Foo foo = Foo(1, 2, 3); 251 | // Calls copy constructor! 252 | auto foo = Foo(1, 2, 3); 253 | 254 | Foo foo(1, 2, 3); 255 | 256 | 257 | Constructors 258 | ============ 259 | 260 | .. code-block:: Nim 261 | :number-lines: 262 | 263 | proc constructFoo*(x: cint): Foo 264 | {.importcpp: "Foo(@)", header: "file.h", constructor.} 265 | 266 | 267 | .. code-block:: nim 268 | :number-lines: 269 | 270 | proc newFoo(a, b: cint): ptr Foo {.importcpp: "new Foo(@)".} 271 | 272 | let x = newFoo(3, 4) 273 | 274 | 275 | proc cnew*[T](x: T): ptr T {.importcpp: "(new '*0#@)", nodecl.} 276 | 277 | 278 | 279 | Generics 280 | ======== 281 | 282 | For example: 283 | 284 | .. code-block:: nim 285 | :number-lines: 286 | 287 | type Input {.importcpp: "System::Input".} = object 288 | proc getSubsystem*[T](): ptr T 289 | {.importcpp: "SystemManager::getSubsystem<'*0>()", nodecl.} 290 | 291 | let x: ptr Input = getSubsystem[Input]() 292 | 293 | Produces: 294 | 295 | .. code-block:: C 296 | :number-lines: 297 | 298 | x = SystemManager::getSubsystem() 299 | 300 | 301 | 302 | Emit pragma 303 | =========== 304 | 305 | .. code-block:: Nim 306 | :number-lines: 307 | 308 | {.emit: """ 309 | static int cvariable = 420; 310 | """.} 311 | 312 | {.push stackTrace:off.} 313 | proc embedsC() = 314 | var nimVar = 89 315 | # use backticks to access Nim symbols within an emit section: 316 | {.emit: """fprintf(stdout, "%d\n", cvariable + (int)`nimVar`);""".} 317 | {.pop.} 318 | 319 | embedsC() 320 | 321 | 322 | .. 323 | A tour through the standard library 324 | ----------------------------------- 325 | 326 | - system module: basic arithmetic and IO 327 | - strutils module; Unicode module 328 | - OS and osproc modules 329 | - sequtils and algorithm 330 | - tables and sets 331 | - linked lists, queues 332 | 333 | - watchpoints 334 | - tracing 335 | - lexer generation 336 | - ORM 337 | 338 | 339 | Questions? 340 | ========== 341 | -------------------------------------------------------------------------------- /build.nim: -------------------------------------------------------------------------------- 1 | 2 | import strutils, os, re 3 | 4 | proc main(file: string) = 5 | discard execShellCmd("nim rst2html $1.rst" % file) 6 | 7 | const 8 | patternA = "***" & 9 | "(.*)" & 10 | "***" 11 | 12 | proc writeln(buf: var string; x: string) = buf.add x & "\n" 13 | 14 | proc tline(line: string): string = 15 | result = line.replacef(re(patternA.replace("***", r"\*\*\*"), {}), 16 | "$1") 17 | result = result.replacef(re(patternA.replace("***", r"\+\+\+"), {}), 18 | "$1") 19 | result = result.replacef(re(patternA.replace("***", r"\=\=\="), {}), 20 | "$1") 21 | 22 | var f = "" 23 | var count = 0 24 | for line in lines("$1.html" % file): 25 | if line.contains("") 29 | f.writeln("
    ") 30 | f.writeln(line.tline) 31 | elif line.contains("

    ") 33 | let a = line.replace("

    ", "

    ") 34 | f.writeln(a.tline) 35 | elif line.contains(""): 36 | f.writeln("
    ") 37 | f.writeln(line.tline) 38 | else: 39 | f.writeln(line.tline) 40 | writeFile("$1.html" % file, f) 41 | 42 | for x in os.walkFiles("*.rst"): 43 | main(x.splitFile.name) 44 | -------------------------------------------------------------------------------- /busyteam2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/busyteam2.png -------------------------------------------------------------------------------- /livedemo/codegendecl.nim: -------------------------------------------------------------------------------- 1 | 2 | var 3 | a {.codegenDecl: "$# progmem $#".}: int 4 | 5 | proc myinterrupt() {.codegenDecl: "$# __interrupt $#$# __attribute__(weirdo)", 6 | exportc: "nim_interrupt".} = 7 | echo "realistic interrupt handler" 8 | -------------------------------------------------------------------------------- /livedemo/coverage.nim: -------------------------------------------------------------------------------- 1 | 2 | ## Code coverage macro 3 | 4 | import macros 5 | 6 | proc transform(n, guard, list: NimNode): NimNode {.compileTime.} = 7 | # recurse: 8 | result = copyNimNode(n) 9 | for c in n.children: 10 | result.add c.transform(guard, list) 11 | 12 | if n.kind in {nnkElifBranch, nnkOfBranch, nnkExceptBranch, nnkElifExpr, 13 | nnkElseExpr, nnkElse, nnkForStmt, nnkWhileStmt}: 14 | let lineinfo = result[^1].lineinfo 15 | 16 | template track(guard, i) = 17 | guard[i][1] = true 18 | result[^1] = newStmtList(getAst track(guard, list.len), result[^1]) 19 | 20 | template tup(lineinfo) = 21 | (lineinfo, false) 22 | list.add(getAst tup(lineinfo)) 23 | 24 | proc listCoverage(s: openArray[(string, bool)]) = 25 | for x in s: 26 | if not x[1]: echo "NOT EXECUTED ", x[0] 27 | 28 | macro cov(p: untyped): untyped = 29 | var list = newNimNode(nnkBracket) 30 | let guard = genSym(nskVar, "guard") 31 | result = transform(p, guard, list) 32 | result = newStmtList(newVarStmt(guard, list), result, 33 | newCall(bindSym"listCoverage", guard)) 34 | 35 | 36 | cov: 37 | proc toTest(x, y: int) = 38 | try: 39 | case x 40 | of 8: 41 | if y > 9: echo "8.1" 42 | else: echo "8.2" 43 | of 9: echo "9" 44 | else: echo "else" 45 | echo "no IoError" 46 | except IoError: 47 | echo "IoError" 48 | toTest(8, 10) 49 | toTest(10, 10) 50 | 51 | 52 | when false: 53 | cov: 54 | proc toTest(x: int): int = 55 | if x > 0: result = 88 56 | else: result = 99 57 | 58 | proc toTestE(x: int): int = 59 | (if x > 0: 88 else: 99) 60 | 61 | proc toTestTry(x: int) = 62 | try: 63 | case x 64 | of 8: echo "8" 65 | of 9: echo "9" 66 | else: echo "foo" 67 | echo "Try it" 68 | except IoError: 69 | echo "IoError" 70 | 71 | echo toTest 89 72 | echo toTest(-89) 73 | 74 | echo toTestE 89 75 | toTestTry(8) 76 | # echo toTestE(-89) 77 | -------------------------------------------------------------------------------- /livedemo/coverage2.nim: -------------------------------------------------------------------------------- 1 | 2 | import macros 3 | 4 | type HideEffects = proc (x: int) {.raises: [], noSideEffect, tags: [].} 5 | 6 | proc wrap(n: NimNode; setter, i: NimNode): NimNode {.compileTime.} = 7 | # XXX better insert as last statement, but move before 'break', 'return' etc. 8 | template callSetterProc(setter, i) = 9 | cast[HideEffects](setter)(i) 10 | result = newTree(nnkStmtList, getAst callSetterProc(setter, i), n) 11 | 12 | proc transform(n, setter, data: NimNode): NimNode {.compileTime.} = 13 | # recurse: 14 | result = copyNimNode(n) 15 | for c in n.children: 16 | result.add c.transform(setter, data) 17 | if n.kind in {nnkElifBranch, nnkOfBranch, nnkExceptBranch, nnkElifExpr, 18 | nnkElseExpr, nnkElse, nnkForStmt, nnkWhileStmt}: 19 | let index = newLit(data.len) 20 | data.add(newTree(nnkPar, newLit(result[^1].lineinfo), bindSym"false")) 21 | result[^1] = result[^1].wrap(setter, index) 22 | 23 | proc listCoverage(s: openArray[(string, bool)]) = 24 | for x in s: 25 | if not x[1]: echo "NOT EXECUTED ", x[0] 26 | 27 | macro cov(p: untyped): untyped = 28 | var data = newNimNode(nnkBracket) 29 | let guard = genSym(nskVar, "guard") 30 | let setter = genSym(nskProc, "guardSetter") 31 | template setterProc(name, guard) = 32 | proc name(x: int) = 33 | guard[x][1] = true 34 | 35 | result = transform(p, setter, data) 36 | result = newTree(nnkStmtList, newVarStmt(guard, data), 37 | getAst setterProc(setter, guard), 38 | result, 39 | newCall(bindSym"listCoverage", guard)) 40 | 41 | cov: 42 | proc toTest(x: int): int {.noSideEffect.} = 43 | if x > 0: result = 88 44 | else: result = 99 45 | 46 | proc toTestE(x: int): int = 47 | (if x > 0: 88 else: 99) 48 | 49 | proc toTestTry(x: int) = 50 | try: 51 | case x 52 | of 8: echo "8" 53 | of 9: echo "9" 54 | else: echo "foo" 55 | echo "Try it" 56 | except IoError: 57 | echo "IoError" 58 | 59 | echo toTest 89 60 | echo toTest(-89) 61 | 62 | echo toTestE 89 63 | toTestTry(8) 64 | # echo toTestE(-89) 65 | -------------------------------------------------------------------------------- /livedemo/demo.nim: -------------------------------------------------------------------------------- 1 | 2 | var 3 | a {.codegenDecl: "$# progmem $#".}: int 4 | 5 | proc unused() = 6 | discard 7 | 8 | 9 | proc myinterrupt() {.codegenDecl: "$3 __interrupt $1 $2", exportc.} = 10 | echo "realistic interrupt handler" 11 | -------------------------------------------------------------------------------- /livedemo/file.c2nim: -------------------------------------------------------------------------------- 1 | 2 | #cpp 3 | #header 4 | 5 | #nep1 6 | -------------------------------------------------------------------------------- /livedemo/file.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #nep1 4 | 5 | #define foo 1 6 | #define bar 12 7 | 8 | 9 | #def WXDLLIMPEXP_CORE 10 | 11 | 12 | #discardablePrefix Set 13 | 14 | template 15 | 16 | class WXDLLIMPEXP_CORE Foo { 17 | public: 18 | T value; 19 | T GetValue() { return value; } 20 | T& SetValue(int x) { field = x; return &field; } 21 | Foo(T x) {} 22 | 23 | ~Foo() {} 24 | 25 | bool operator ==(Foo& const other) const; 26 | bool operator !=(Foo& other); 27 | }; 28 | 29 | -------------------------------------------------------------------------------- /livedemo/file.nim: -------------------------------------------------------------------------------- 1 | const 2 | foo* = 1 3 | bar* = 12 4 | 5 | type 6 | Foo* {.importcpp: "Foo", header: "file.h".}[T] = object 7 | value* {.importc: "value".}: T 8 | 9 | 10 | proc getValue*[T](this: var Foo[T]): T {.importcpp: "GetValue", header: "file.h".} 11 | proc setValue*[T](this: var Foo[T]; x: cint): var T {.importcpp: "SetValue", 12 | header: "file.h", discardable.} 13 | proc constructFoo*[T](x: T): Foo[T] {.constructor, importcpp: "Foo(@)", 14 | header: "file.h".} 15 | proc destroyFoo*[T](this: var Foo[T]) {.importcpp: "#.~Foo()", header: "file.h".} 16 | proc `==`*[T](this: Foo[T]; other: Foo[T]): bool {.noSideEffect, importcpp: "(# == #)", 17 | header: "file.h".} 18 | -------------------------------------------------------------------------------- /livedemo/options.c2nim: -------------------------------------------------------------------------------- 1 | 2 | #cpp 3 | #header 4 | #nep1 5 | 6 | #discardableprefix Set 7 | 8 | 9 | -------------------------------------------------------------------------------- /logo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/logo2.png -------------------------------------------------------------------------------- /nimdoc.cfg: -------------------------------------------------------------------------------- 1 | # This is the config file for the documentation generator. 2 | # (c) 2015 Andreas Rumpf 3 | # Feel free to edit the templates as you need. 4 | 5 | split.item.toc = "20" 6 | # too long entries in the table of contents wrap around 7 | # after this number of characters 8 | 9 | 10 | doc.listing_start = """
    """
     11 | doc.listing_end = """
    """ 12 | doc.listing_button = """""" 13 | 14 | doc.section = """ 15 |
    16 |

    $sectionTitle

    17 |
    18 | $content 19 |
    20 | """ 21 | 22 | doc.section.toc = """ 23 |
  • 24 | $sectionTitle 25 |
      26 | $content 27 |
    28 |
  • 29 | """ 30 | 31 | doc.item = """ 32 |
    $header
    33 |
    34 | $desc 35 |
    36 | """ 37 | 38 | doc.item.toc = """ 39 |
  • $name
  • 40 | """ 41 | 42 | doc.toc = """ 43 | """ 48 | 49 | doc.body_toc = """ 50 |
    51 | $tableofcontents 52 |
    53 |
    54 | $moduledesc 55 | $content 56 |
    57 | """ 58 | 59 | doc.body_no_toc = """ 60 | $moduledesc 61 | $content 62 | """ 63 | 64 | doc.file = """ 65 | 66 | 67 | $title 68 | 70 | 72 | 74 | 308 | 309 | 311 | 312 | 313 | 314 |
    315 | Nimrod logo 317 |
    318 | 319 |

    $title

    320 | $content 321 | 322 | 323 | """ 324 | -------------------------------------------------------------------------------- /overview.rst: -------------------------------------------------------------------------------- 1 | ============================================================ 2 | An Overview 3 | ============================================================ 4 | 5 | 6 | .. raw:: html 7 |
    8 |
    9 |
    10 |
    11 |
    12 |
    13 |
    14 |
    15 |
    Slides
    16 |
    17 |
    git clone https://github.com/Araq/oscon2015
    18 |
    19 |
    20 |
    21 |
    Download
    22 |
    23 |
    http://nim-lang.org/download.html
    24 | 25 | 26 | What is Nim? 27 | ============ 28 | 29 | - new **systems** programming language 30 | - compiles to C 31 | - garbage collection + manual memory management 32 | - thread local garbage collection 33 | - design goals: efficient, expressive, elegant 34 | 35 | .. 36 | * Nim compiles to C; C++ and Objective-C are also supported 37 | * there is an experimental JavaScript backend 38 | * it provides a soft realtime GC: you can tell it how long it is allowed to run 39 | * the Nim compiler and **all** of the standard library (including the GC) 40 | are written in Nim 41 | * whole program dead code elimination: stdlib carefully crafted to make use 42 | of it; for instance parsers do not use (runtime) regular expressions -> 43 | re engine not part of the executable 44 | * our infrastructure (IDE, build tools, package manager) is 45 | also completely written in Nim 46 | * infix/indentation based syntax 47 | 48 | 49 | Goals 50 | ===== 51 | 52 | .. 53 | I wanted a programming language that is 54 | 55 | * as fast as C 56 | * as expressive as Python 57 | * as extensible as Lisp 58 | 59 | .. 60 | and of course learning from the mistakes of the past: So take the type system 61 | from Ada, not from C++. At this moment in time, Nim achieves all of my 62 | original goals. 63 | 64 | However, it turns out that after writing a compiler from scratch you learn 65 | one thing or the other, 66 | achieving these goals and 67 | lreaning more about PL design, I have come across features of other 68 | programming languages which have inspired to continue innovating and as such 69 | 70 | .. 71 | Talk about what the plans for Nim were 72 | 73 | 74 | 75 | 76 | Uses of Nim 77 | =========== 78 | 79 | - web development 80 | - games 81 | - compilers 82 | - operating system development 83 | - scientific computing 84 | - scripting 85 | - command line applications 86 | - UI applications 87 | - And lots more! 88 | 89 | 90 | 91 | Hello World 92 | =========== 93 | 94 | .. code-block:: nim 95 | echo "hello world!" 96 | 97 | 98 | Hello World 99 | =========== 100 | 101 | .. code-block:: nim 102 | echo "hello world!" 103 | 104 | :: 105 | nim c -r hello.nim 106 | 107 | 108 | 109 | More Code! 110 | ========== 111 | 112 | .. code-block:: nim 113 | :number-lines: 114 | 115 | proc decimalToRoman*(number: range[1..3_999]): string = 116 | ## Converts a number to a Roman numeral. 117 | const romanComposites = { 118 | "M": 1000, "CM": 900, 119 | "D": 500, "CD": 400, "C": 100, 120 | "XC": 90, "L": 50, "XL": 40, "X": 10, "IX": 9, 121 | "V": 5, "IV": 4, "I": 1} 122 | result = "" 123 | var decVal = number.int 124 | for key, val in items(romanComposites): 125 | while decVal >= val: 126 | decVal -= val 127 | result.add(key) 128 | 129 | echo decimalToRoman(1009) # MIX 130 | 131 | 132 | - ``{"M": 1000, "CM": 900}`` sugar for ``[("M", 1000), ("CM", 900)]`` 133 | - ``result`` implicitly available 134 | 135 | 136 | Function application 137 | ==================== 138 | 139 | Function application is ``f()``, ``f(a)``, ``f(a, b)``. 140 | 141 | 142 | Function application 143 | ==================== 144 | 145 | Function application is ``f()``, ``f(a)``, ``f(a, b)``. 146 | 147 | And here is the sugar: 148 | 149 | =========== ================== =============================== 150 | Sugar Meaning Example 151 | =========== ================== =============================== 152 | ``f a`` ``f(a)`` ``spawn log("some message")`` 153 | ``a.f()`` ``f(a)`` ``db.fetchRow()`` 154 | ``a.f`` ``f(a)`` ``mystring.len`` 155 | ``f a, b`` ``f(a, b)`` ``echo "hello ", "world"`` 156 | ``a.f(b)`` ``f(a, b)`` ``myarray.map(f)`` 157 | ``a.f b`` ``f(a, b)`` ``db.fetchRow 1`` 158 | ``f"\n"`` ``f(r"\n")`` ``re"\b[a-z*]\b"`` 159 | =========== ================== =============================== 160 | 161 | 162 | Function application 163 | ==================== 164 | 165 | Function application is ``f()``, ``f(a)``, ``f(a, b)``. 166 | 167 | And here is the sugar: 168 | 169 | =========== ================== =============================== 170 | Sugar Meaning Example 171 | =========== ================== =============================== 172 | ``f a`` ``f(a)`` ``spawn log("some message")`` 173 | ``a.f()`` ``f(a)`` ``db.fetchRow()`` 174 | ``a.f`` ``f(a)`` ``mystring.len`` 175 | ``f a, b`` ``f(a, b)`` ``echo "hello ", "world"`` 176 | ``a.f(b)`` ``f(a, b)`` ``myarray.map(f)`` 177 | ``a.f b`` ``f(a, b)`` ``db.fetchRow 1`` 178 | ``f"\n"`` ``f(r"\n")`` ``re"\b[a-z*]\b"`` 179 | =========== ================== =============================== 180 | 181 | 182 | **BUT**: ``f`` does not mean ``f()``; ``myarray.map(f)`` passes ``f`` to ``map`` 183 | 184 | 185 | Operators 186 | ========= 187 | 188 | * operators are simply sugar for functions 189 | * operator in backticks is treated like an identifier 190 | 191 | :: 192 | `@`(x, y) 193 | x.`@`(y) 194 | `@`(x) 195 | x.`@`() 196 | x.`@` 197 | 198 | 199 | Operators 200 | ========= 201 | 202 | * Of course, most of the time binary operators are simply invoked as ``x @ y`` 203 | and unary operators as ``@x``. 204 | * No explicit distinction between binary and unary operators: 205 | 206 | .. code-block:: Nim 207 | :number-lines: 208 | 209 | proc `++`(x: var int; y: int = 1; z: int = 0) = 210 | x = x + y + z 211 | 212 | var g = 70 213 | ++g 214 | g ++ 7 215 | g.`++`(10, 20) 216 | echo g # writes 108 217 | 218 | * parameters are readonly unless declared as ``var`` 219 | * ``var`` means "pass by reference" (implemented with a hidden pointer) 220 | 221 | 222 | Control flow 223 | ============ 224 | 225 | 226 | - The usual control flow statements are available: 227 | * if 228 | * case 229 | * when 230 | * while 231 | * for 232 | * try 233 | * defer 234 | * return 235 | * yield 236 | 237 | 238 | Statements vs expressions 239 | ========================= 240 | 241 | Statements require indentation: 242 | 243 | .. code-block:: nim 244 | # no indentation needed for single assignment statement: 245 | if x: x = false 246 | 247 | # indentation needed for nested if statement: 248 | if x: 249 | if y: 250 | y = false 251 | else: 252 | y = true 253 | 254 | # indentation needed, because two statements follow the condition: 255 | if x: 256 | x = false 257 | y = false 258 | 259 | 260 | Statements vs expressions 261 | ========================= 262 | 263 | Expressions do not: 264 | 265 | .. code-block:: nim 266 | 267 | if thisIsaLongCondition() and 268 | thisIsAnotherLongCondition(1, 269 | 2, 3, 4): 270 | x = true 271 | 272 | - Rule of thumb: optional indentation after operators, ``(`` and ``,`` 273 | - ``if``, ``case`` etc also available as expressions 274 | 275 | 276 | 277 | Type system 278 | =========== 279 | 280 | - strict and statically typed 281 | - type system weakened for the meta-programming 282 | - value based datatypes (like in C++) 283 | - subtyping via single inheritance (``object of RootObj``) 284 | - subtyping via ``range``: ``type Natural = range[0..high(int)]`` 285 | - generics (``HashSet[string]``) 286 | - "concepts": constraints for generic types 287 | - no interfaces, use (tuple of) closures instead 288 | - no Hindley-Milner type inference, Nim embraces overloading 289 | - limited amount of flow typing 290 | 291 | 292 | Flow typing 293 | =========== 294 | 295 | .. code-block:: nim 296 | proc f(p: ref int not nil) 297 | 298 | var x: ref int 299 | if x != nil: 300 | f(x) 301 | 302 | 303 | Effect system 304 | ============= 305 | 306 | - model effects as tuples ``(T, E)`` rather than ``E[T]`` 307 | - every effect is inferred 308 | 309 | 310 | Effect system 311 | ============= 312 | 313 | - tracks side effects 314 | - tracks exceptions 315 | - tracks "tags": ReadIOEffect, WriteIoEffect, TimeEffect, 316 | ReadDirEffect, **ExecIOEffect** 317 | - tracks locking levels; deadlock prevention at compile-time 318 | - tracks "GC safety" 319 | 320 | 321 | 322 | Effect system 323 | ============= 324 | 325 | .. code-block:: nim 326 | :number-lines: 327 | 328 | proc foo() {.noSideEffect.} = 329 | echo "is IO a side effect?" 330 | 331 | 332 | Builtin types 333 | ============= 334 | 335 | enums & sets 336 | 337 | .. code-block:: nim 338 | :number-lines: 339 | 340 | type 341 | SandboxFlag* = enum ## what the interpreter should allow 342 | allowCast, ## allow unsafe language feature: 'cast' 343 | allowFFI, ## allow the FFI 344 | allowInfiniteLoops ## allow endless loops 345 | SandboxFlags* = set[SandboxFlag] 346 | 347 | proc runNimCode(code: string; flags: SandboxFlags = {allowCast, allowFFI}) = 348 | ... 349 | 350 | 351 | Builtin types 352 | ============= 353 | 354 | .. code-block:: C 355 | :number-lines: 356 | 357 | #define allowCast (1 << 0) 358 | #define allowFFI (1 << 1) 359 | #define allowInfiniteLoops (1 << 1) 360 | 361 | void runNimCode(char* code, unsigned int flags = allowCast|allowFFI); 362 | 363 | runNimCode("4+5", 700); 364 | 365 | 366 | Routines 367 | ======== 368 | 369 | - ``proc`` 370 | - ``iterator`` 371 | - ``template`` 372 | - ``macro`` 373 | - ``method`` 374 | - ``converter`` 375 | - (``func``) 376 | 377 | 378 | Templates 379 | ========= 380 | 381 | .. code-block::nim 382 | :number-lines: 383 | 384 | template `??`(a, b: untyped): untyped = 385 | let x = a 386 | (if x.isNil: b else: x) 387 | 388 | var x: string 389 | echo x ?? "woohoo" 390 | 391 | 392 | Templates 393 | ========= 394 | 395 | .. code-block:: nim 396 | :number-lines: 397 | 398 | template html(name, body) = 399 | proc name(): string = 400 | result = "" 401 | body 402 | result.add("") 403 | 404 | html mainPage: 405 | echo "colon syntax to pass statements to template" 406 | 407 | 408 | Templates 409 | ========= 410 | 411 | Templates already suffice to implement simple DSLs: 412 | 413 | .. code-block:: nim 414 | :number-lines: 415 | 416 | html mainPage: 417 | head: 418 | title "The Nim programming language" 419 | body: 420 | ul: 421 | li "efficient" 422 | li "expressive" 423 | li "elegant" 424 | 425 | echo mainPage() 426 | 427 | 428 | Produces:: 429 | 430 | 431 | The Nim programming language 432 | 433 |
      434 |
    • efficient
    • 435 |
    • expressive
    • 436 |
    • elegant
    • 437 |
    438 | 439 | 440 | 441 | 442 | Templates 443 | ========= 444 | 445 | .. code-block:: nim 446 | template html(name, body) = 447 | proc name(): string = 448 | result = "" 449 | body 450 | result.add("") 451 | 452 | template head(body) = 453 | result.add("") 454 | body 455 | result.add("") 456 | 457 | ... 458 | 459 | template title(x) = 460 | result.add("$1" % x) 461 | 462 | template li(x) = 463 | result.add("
  • $1
  • " % x) 464 | 465 | 466 | Templates 467 | ========= 468 | 469 | .. code-block:: nim 470 | :number-lines: 471 | 472 | proc mainPage(): string = 473 | result = "" 474 | result.add("") 475 | result.add("$1" % "The Nim programming language") 476 | result.add("") 477 | result.add("") 478 | result.add("
      ") 479 | result.add("
    • $1
    • " % "efficient") 480 | result.add("
    • $1
    • " % "expressive") 481 | result.add("
    • $1
    • " % "elegant") 482 | result.add("
    ") 483 | result.add("") 484 | result.add("") 485 | 486 | 487 | 488 | 489 | Macros 490 | ====== 491 | 492 | * imperative AST to AST transformations 493 | * Turing complete 494 | * ``macros`` module provides an API for dealing with Nim ASTs 495 | 496 | 497 | Macros 498 | ====== 499 | 500 | .. code-block::nim 501 | :number-lines: 502 | 503 | proc write(f: File; a: int) = 504 | echo a 505 | 506 | proc write(f: File; a: bool) = 507 | echo a 508 | 509 | proc write(f: File; a: float) = 510 | echo a 511 | 512 | proc writeNewline(f: File) = 513 | echo "\n" 514 | 515 | macro writeln(f: File; args: varargs[typed]) = 516 | result = newStmtList() 517 | for a in args: 518 | result.add newCall(bindSym"write", f, a) 519 | result.add newCall(bindSym"writeNewline", f) 520 | 521 | Macros 522 | ====== 523 | 524 | .. code-block::nim 525 | :number-lines: 526 | 527 | proc f(a, b, c: int): int = a+b+c 528 | 529 | echo curry(f, 10)(3, 4) 530 | 531 | 532 | Macros 533 | ====== 534 | 535 | .. code-block::nim 536 | :number-lines: 537 | 538 | macro curry(f: typed; args: varargs[untyped]): untyped = 539 | let ty = getType(f) 540 | assert($ty[0] == "proc", "first param is not a function") 541 | let n_remaining = ty.len - 2 - args.len 542 | assert n_remaining > 0, "cannot curry all the parameters" 543 | #echo treerepr ty 544 | 545 | var callExpr = newCall(f) 546 | args.copyChildrenTo callExpr 547 | 548 | var params: seq[NimNode] = @[] 549 | # return type 550 | params.add ty[1].type_to_nim 551 | 552 | for i in 0 .. 2 | 4 | 5 | 6 | 8 | HTML Slidy - template for basic presentations 9 | 10 | 12 | 13 | 14 | 16 | 17 | 18 |
    19 |

    Sample heading

    20 | 21 |

    This is a template file you can copy and edit on your own server.

    22 | 23 |
      24 |
    • point 1
    • 25 |
    • point 2
    • 26 |
    • . . .
    • 27 |
    28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /slidy2/graphics/bullet-fold-dim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet-fold-dim.gif -------------------------------------------------------------------------------- /slidy2/graphics/bullet-fold-dim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet-fold-dim.png -------------------------------------------------------------------------------- /slidy2/graphics/bullet-fold.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet-fold.gif -------------------------------------------------------------------------------- /slidy2/graphics/bullet-fold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet-fold.png -------------------------------------------------------------------------------- /slidy2/graphics/bullet-nofold-dim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet-nofold-dim.gif -------------------------------------------------------------------------------- /slidy2/graphics/bullet-nofold-dim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet-nofold-dim.png -------------------------------------------------------------------------------- /slidy2/graphics/bullet-nofold.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet-nofold.gif -------------------------------------------------------------------------------- /slidy2/graphics/bullet-nofold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet-nofold.png -------------------------------------------------------------------------------- /slidy2/graphics/bullet-unfold-dim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet-unfold-dim.gif -------------------------------------------------------------------------------- /slidy2/graphics/bullet-unfold-dim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet-unfold-dim.png -------------------------------------------------------------------------------- /slidy2/graphics/bullet-unfold.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet-unfold.gif -------------------------------------------------------------------------------- /slidy2/graphics/bullet-unfold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet-unfold.png -------------------------------------------------------------------------------- /slidy2/graphics/bullet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet.gif -------------------------------------------------------------------------------- /slidy2/graphics/bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/bullet.png -------------------------------------------------------------------------------- /slidy2/graphics/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/example.png -------------------------------------------------------------------------------- /slidy2/graphics/example.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | W3C Indian Office logo 6 | 7 | 8 | 9 | 10 | 14 | 17 | 22 | 27 | 30 | 34 | 37 | 42 | 48 | 55 | 57 | 59 | 61 | 62 | 66 | 69 | 72 | 73 | 75 | 77 | 78 | 79 | 87 | 91 | 96 | 98 | 103 | 104 | 105 | 106 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 128 | 129 | 130 | 134 | 135 | 136 | 137 | 138 | 139 | 144 | 145 | 146 | 153 | 154 | 155 | 156 | 157 | 158 | 169 | 170 | 171 | 172 | 173 | 174 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 194 | 195 | 196 | 204 | 205 | 206 | 207 | 208 | 209 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | -------------------------------------------------------------------------------- /slidy2/graphics/face1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/face1.gif -------------------------------------------------------------------------------- /slidy2/graphics/face2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/face2.gif -------------------------------------------------------------------------------- /slidy2/graphics/face3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/face3.gif -------------------------------------------------------------------------------- /slidy2/graphics/face4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/face4.gif -------------------------------------------------------------------------------- /slidy2/graphics/fold-bright.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/fold-bright.gif -------------------------------------------------------------------------------- /slidy2/graphics/fold-dim.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/fold-dim.bmp -------------------------------------------------------------------------------- /slidy2/graphics/fold-dim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/fold-dim.gif -------------------------------------------------------------------------------- /slidy2/graphics/fold.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/fold.bmp -------------------------------------------------------------------------------- /slidy2/graphics/fold.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/fold.gif -------------------------------------------------------------------------------- /slidy2/graphics/icon-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/icon-blue.png -------------------------------------------------------------------------------- /slidy2/graphics/keys2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/keys2.jpg -------------------------------------------------------------------------------- /slidy2/graphics/nofold-dim.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/nofold-dim.bmp -------------------------------------------------------------------------------- /slidy2/graphics/nofold-dim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/nofold-dim.gif -------------------------------------------------------------------------------- /slidy2/graphics/nofold.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/nofold.bmp -------------------------------------------------------------------------------- /slidy2/graphics/unfold-bright.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/unfold-bright.gif -------------------------------------------------------------------------------- /slidy2/graphics/unfold-dim.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/unfold-dim.bmp -------------------------------------------------------------------------------- /slidy2/graphics/unfold-dim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/unfold-dim.gif -------------------------------------------------------------------------------- /slidy2/graphics/unfold.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/unfold.bmp -------------------------------------------------------------------------------- /slidy2/graphics/unfold.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/unfold.gif -------------------------------------------------------------------------------- /slidy2/graphics/w3c-logo-blue.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/w3c-logo-blue.gif -------------------------------------------------------------------------------- /slidy2/graphics/w3c-logo-blue.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | W3C logo 4 | 5 | 6 | 7 | 8 | 9 | 10 | ® 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /slidy2/graphics/w3c-logo-slanted.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/w3c-logo-slanted.jpg -------------------------------------------------------------------------------- /slidy2/graphics/w3c-logo-white.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/graphics/w3c-logo-white.gif -------------------------------------------------------------------------------- /slidy2/graphics/w3c-logo-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | W3C logo 4 | 5 | 6 | 7 | 8 | 9 | 10 | ® 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /slidy2/help/.htaccess: -------------------------------------------------------------------------------- 1 | Options +MultiViews 2 | LanguagePriority en 3 | AddLanguage pt-br .pt-br 4 | 5 | 6 | 7 | ForceType 'text/html; charset=utf-8' 8 | 9 | 10 | 11 | 12 | 13 | ForceType 'application/xhtml+xml; charset=utf-8' 14 | 15 | 16 | 17 | 18 | 19 | ForceType 'text/css; charset=utf-8' 20 | 21 | 22 | 23 | 24 | 25 | ForceType 'text/javascript; charset=utf-8' 26 | 27 | 28 | mkdir 29 | -------------------------------------------------------------------------------- /slidy2/help/help.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Araq/oscon2015/d706ea708bb3f7663bb178c98bf6989332885e6e/slidy2/help/help.html -------------------------------------------------------------------------------- /slidy2/help/help.html.ca: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Ajuda del presentador de diapositives 13 | 21 | 22 | 23 |

    Ajuda del presentador de diapositives

    24 | 25 |

    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. 26 | 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 ">". 27 | La tecla “F” fa aparèixer/desaparèixer el menú de la línia de estat a la part de sota. 28 | 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. 29 | La tecla “F11” serveix per entrar/sortir en el mode pantalla completa del navegador, la tecla “H” dona accés a aquesta pàgina. 30 | 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.

    31 |

    Es recomana als usuaris de Firefox que instal•lin la extensió d’autoamagar per amagar les barres d’eines en entrar al mode pantalla completa.

    32 |

    Si vol saber com funciona Slidy, feu servir “Veure el codi font” per veure el codi XHTML o vegi aquesta explicació més llarga., 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 : Dave 34 | Raggett <dsr@w3.org>. 35 | Si trobeu Slidy útil podeu considerar ajudar al W3C.

    36 |

    Sou benvingut a fer servir el presentador de diapositives, les fulles d’estil , scripts i el fitxer d’ajuda sota les condicions d’ ùs de document del W3C I les normes 37 | llicència de software.

    38 | 39 | 40 | 41 |
    42 | 43 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /slidy2/help/help.html.de: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | Slide Show Help 9 | 16 | 24 | 25 | 26 |

    Hilfe für die HTML-Slidy-Präsentation

    27 | 28 |

    Diese Präsentation wird wie Power Point kontrolliert: Klicken 29 | Sie mit der Maus irgendwo ins Bild, um zur nächsten Seite zu 30 | schalten, oder drücken Sie die Leertaste. Sie können ebenfalls 31 | mit den Cursor-Tasten (links/rechts) oder den Tasten für Seite 32 | auf und ab vorwärts und rückwärts durch die Präsentation 33 | navigieren. Die Schriftgrösse wird automatisch so angepasst, dass 34 | Sie zur Fensterbreite des Browsers passt, sie kann aber auch 35 | manuell mit den Tasten "s" (kleiner) und "b" (grösser) 36 | kontrolliert werden (oder mit der Taste "<" bzw. ">"). Die 37 | Statuszeile am unteren Rand des Fensters wird mit "f" ein- und 38 | ausgeschaltet. Die Taste "k" schaltet die Funktion des Mausklicks 39 | zum Kontrollieren der Präsentation ein und aus. Sie können mit 40 | "c" ein Inhaltsverzeichnis ein- und mit einer beliebigen anderen 41 | Taste wieder ausblenden. Mit "F11" können Sie (je nach Browser) 42 | den Vollbildmodus aktivieren. Die Taste "h" zeigt diesen Hilfetext 43 | an. Es ist zu bemerken, dass nicht alle diese Tasten in jedem 44 | Browser funktionieren, da sie zum Teil mit anderen Funktionen 45 | belegt sind.

    46 | 47 |

    Firefox-Benutzer können die autohide-Erweiterung 49 | installieren, um die Werkzeugleiste im Vollbildmodus auszublenden.

    50 | 51 |

    Wenn Sie wissen möchten, wie Slidy funktioniert, schauen Sie sich 52 | den XHTML-Quellcode der Seite an oder lesen diese etwas längere Erklärung 54 | (in Englisch), die auch weitere Funktionen erläutert. Jede einzelne 55 | Folie ist als ein div-Element mit class="slide" 56 | markiert. CSS-Positionierung und prozentuale Breitenangaben für Bilder 57 | können benutzt werden, um sicherzustellen, dass die Folien bei 58 | verschiedenen Fenstergrössen optimal dargestellt werden. Der Inhalt 59 | auf Folien kann schrittweise angezeigt werden, indem den Elementen 60 | class="incremental" zugewiesen wird. Das eingebundene 61 | Style Sheet und die Skripten wurden als web-basierte Alternative zu 62 | proprietären Programmen entwickelt. Sie wurden auf verschiedensten 63 | aktuellen Browsern getestet. Ein eingebauter Editor für die Folien 64 | ist in Entwicklung. Bitte senden Sie Kommentare an Dave Raggett <dsr@w3.org>. Wenn Sie Slidy 67 | nützlich finden, möchten Sie vielleicht ein W3C Supporter werden.

    69 | 70 |

    Die Style Sheets, die Skripten der Präsentation und die 71 | zugehörigen Texte sind frei zur Benutzung unter den Bedingungen 72 | der W3C-Lizenzen document 73 | use und software 74 | licensing.

    75 | 76 | 78 | 79 |
    80 | 81 | 82 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /slidy2/help/help.html.en: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | Slide Show Help 8 | 15 | 23 | 24 | 25 |

    Slide Show Help

    26 | 27 |

    This slide show can be driven in the same way as Power Point. 28 | To advance to the next slide click pretty much anywhere on the 29 | page with the mouse, or press the space bar. You can move forwards 30 | or backwards through the slides with the Cursor left, Cursor 31 | right, Pg Up and Pg Dn keys. The font size is automatically 32 | adjusted to match the browser's window width, but you can also 33 | adjust it manually using the "S" key for smaller and the "B" key 34 | for bigger. You can also use the "<" and ">" keys. Use the 35 | "F" key to switch off/on the bottom status line. The "K" key 36 | toggles the use of mouse click to advance to the next slide. You 37 | can use "C" to show the table of contents and any other key to 38 | hide it. Press the "H" key to view this page. Use the "F11" key to 39 | toggle the browser's full screen mode. Note that not all keys are 40 | supported in all browsers, as browsers may reserve some keys for 41 | browser control and this varies from one browser to the next.

    42 | 43 |

    Firefox users may want the autohide 45 | extension to hide the toolbars when entering full screen with F11.

    46 | 47 |

    If you would like to see how Slidy works, use View Source to view 48 | the XHTML markup, or see this longer explanation, 50 | which also explains additional features. Each slide is marked up as 51 | a div element with class="slide". CSS positioning and percentage 52 | widths on images can be used to ensure your image rich slides scale 53 | to match the window size. Content to be revealed incrementally can 54 | be marked up with class="incremental". The linked style sheet and 55 | scripts were developed as a Web-based alternative to proprietary 56 | presentation tools and have been tested on a variety of recent 57 | browsers. Integrated editing support is under development. Please 58 | send your comments to Dave 59 | Raggett <dsr@w3.org>. 60 | If you find Slidy useful, you may want to consider becoming a 61 | W3C Supporter.

    62 | 63 |

    You are welcome to make use of the slide show style sheets, 64 | scripts and help file under W3C's document use 65 | and software 66 | licensing rules.

    67 | 68 | 69 | 70 |
    71 | 72 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /slidy2/help/help.html.es: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | Ayuda de Slidy 9 | 16 | 24 | 25 | 26 |

    Ayuda de "Slidy"

    27 | 28 |

    Esta presentación puede manejarse igual que una presentación hecha con Power Point. 29 | 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.

    30 | 31 |

    Los usuarios de Firefox pueden desear instalar la extensión "autohide" 32 | para ocultar las barras de herramientas cuando utilizan la función F11 para el modo a toda pantalla.

    33 | 34 |

    Si desea saber cómo funciona Slidy, utilice la Vista de Código para ver el marcado XHML, o vea esta explicación extensa, 35 | 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 Dave Raggett <dsr@w3.org>.

    36 | 37 |

    Usted puede utilizar las hojas de estilo, scripts, y el fichero de ayuda; siempre que siga las normas de uso de documentos y licencia de software del W3C.

    38 | 39 | 40 | 41 |
    42 | 43 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /slidy2/help/help.html.fr: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | Aide de Slide Show 20 | 28 | 29 | 30 | 31 | 32 |

    Aide de Slide Show

    33 | 34 | 35 | 36 |

    Cet exposé Slide Show peut être utilisé de la même manière que Powerpoint. 37 | 38 | Pour avancer au prochain transparent, cliquez n'importe où sur la page avec la 39 | souris ou appuyez sur la barre d'espace. Vous pouvez naviguer entre 40 | les transparents avec les flèches gauche/droite ainsi que les touches Pg Up et 41 | Pg Dn. 42 | 43 | La taille de la police s'adapte automatiquement à la largeur de la fenêtre 44 | du navigateur, mais vous pouvez aussi l'ajuster manuellement en utilisant les 45 | touches "S" (small) pour la diminuer et "B" (big) pour l'augmenter. Vous 46 | pouvez aussi utiliser les touches "<" et ">". 47 | 48 | Utilisez la touche "F" pour afficher ou non le statut en pied-de-page. 49 | 50 | La touche "K" active l'utilisation du clic de souris pour avancer au prochain transparent. 51 | Vous pouvez utiliser "T" pour afficher la table des matières et n'importe quelle autre touche 52 | pour la cacher. 53 | 54 | Les utilisateurs de Windows peuvent utiliser la touche "F11" pour activer le mode plein écran 55 | du navigateur. Appuyez sur la touche "H" pour obtenir cette page. À noter que certaines touches 56 | peuvent ne pas fonctionner avec certains navigateurs car elles sont réservées pour son contrôle. 57 | De plus, cela peut varier d'un navigateur à l'autre.

    58 | 59 |

    Les utilisateurs de Firefox peuvent installer l'extension autohide 61 | pour cacher les barres d'outils lorsque le mode plein écran est activé 62 | avec la touche F11.

    63 | 64 |

    Si vous voulez voir comment Slidy fonctionne, affichez le code source de la page 65 | pour voir le balisage XHTML, ou lisez cette explication plus complète (en anglais), 67 | qui explique aussi des fonctionnalités additionnelles. 68 | 69 | Chaque transparent est balisé par un élément div avec l'attribut class="slide". 70 | Il est aussi possible d'utiliser le positionnement CSS ainsi que la largeur en pourcentage 71 | pour s'assurer que vos images soient à l'échelle du transparent et correspondent ainsi à la taille 72 | de la fenêtre. Le contenu devant s'afficher progressivement doit être marqué par l'attribut 73 | class="incremental". 74 | 75 | La feuille de style reliée ainsi que les scripts ont été développés comme alternative Web 76 | aux outils de présentation propriétaires et ont été testés sur un large panel de navigateurs récents. 77 | Le support intégré pour l'édition est en cours de développement. Envoyez vos commentaires 78 | (en anglais) à Dave 79 | Raggett <dsr@w3.org>. 80 | Si vous trouvez Slidy utile, vous pouvez également devenir 81 | Supporter du W3C.

    82 | 83 | 84 | 85 |

    Veuillez utilisez les feuilles de style, scripts et fichiers d'aide 86 | 87 | en suivant le copyright 88 | 89 | et la licence du W3C.

    90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 |
    98 | 99 | 100 | 101 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /slidy2/help/help.html.hu: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Segítség a bemutatóhoz 7 | 8 | 15 | 16 | 24 | 25 | 26 | 27 |

    Segítség a bemutatóhoz

    28 | 29 |

    Ezt a bemutatót a Power Point-hoz hasonlóan lehet vezérelni. 30 | A következő oldalra való lépéshez kattintson bárhova az aktuális 31 | oldalon belül, vagy nyomja le a szóköz billentyűt. Az oldalak között 32 | a bal és jobb nyíl, illetve a Page Up és Page Down billentyűkkel mozoghat. 33 | A szöveg mérete automatikusan kerül beállításra úgy, hogy igazodjon 34 | a böngésző ablakának szélességéhez, viszont az "S" billentyűvel 35 | csökkentheti, a "B"-vel növelheti azt. Ugyanerre használhatja a "<" 36 | és a ">" billentyűket is. 37 | Az "F" billentyűvel be- és 38 | kikapcsolhatja az alsó állapotsor megjelenítését. A "K" billentyűvel 39 | letilthatja, illetve engedélyezheti, hogy egérkattintással a következő 40 | oldalra lehessen lépni. A "C" billentyűvel megjelenítheti, bármely másikkal 41 | pedig eltűntetheti a tartalomjegyzéket. Az "F11" billenytűvel válthat át 42 | a böngésző teljes képernyős üzemmódjára, vagy jöhet onnan vissza. 43 | Megjegyezzük, hogy nem minden billentyű támogatott minden böngészőben, 44 | mivel a böngészők lefoglalhatnak néhány (böngészőnként eltérő) billentyűt 45 | a saját vezérlésükre. 46 |

    47 | 48 |

    A Firefox felhasználóknak hasznos lehet az 49 | autohide 50 | bővítmény, amivel elrejthetők az eszköztárak teljes képernyős üzemmódban. 51 |

    52 | 53 |

    Ha szeretné látni, hogyan működik a Slidy, nézze meg az oldal 54 | forrásában az XHTML jelölésmódot, vagy nézze meg ezt a 55 | hosszabb magyarázatot, 56 | ami további funkciókat is bemutat. Minden oldalt egy olyan div elem jelöl, 57 | amiben be van állítva, hogy class="slide". A képek CSS-sel történő 58 | pozicionálása és szélességüknek százalékban való megadása biztosítja, 59 | hogy a sok képet tartalmazó oldalak az ablak méretének megfelelően 60 | skálázódjanak. Az oldalon belül egymás után megjelenítendő tartalom a 61 | class="incremental" megadásával jelölhető. A becsatolt stíluslapok és 62 | scriptek a védjegyzett/szabadalmaztatott/más módon védett 63 | bemutató-megjelenítő eszközök web-alapú alternatívájaként lettek 64 | fejlesztve, és sok, manapság használatos böngészővel tesztelve. 65 | Az integrált szerkesztési lehetőség jelenleg fejlesztés alatt áll. 66 | Észrevételeit a következő helyre küldje: 67 | Dave Raggett 68 | <dsr@w3.org>. 69 |

    70 | 71 |

    72 | Ön jogosult az e bemutatóhoz tartozó stíluslapok, scriptek és 73 | segítség fájl használatára, amennyiben betartja a W3C 74 | 75 | dokumentum használati és 76 | 77 | szoftver licencelési szabályait. 78 | 79 |

    80 | 81 | 82 | 83 |
    84 | 85 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /slidy2/help/help.html.nl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | Slidy Help 9 | 16 | 24 | 25 | 26 |

    Slidy Help

    27 | 28 | 29 | 30 |

    Deze sheetpresentatie kan op dezelfde manier worden aangestuurd als 31 | Powerpoint. Klik op een willekeurige plaats op de pagina met de muis, of 32 | druk op de spatiebalk om naar de volgende sheet te gaan. Je kan voor- of 33 | achterwaarts door de sheets bewegen mbv de links/rechts cursor- en de Page 34 | Up en Page Down toetsen. De lettergrootte wordt automatisch aangepast aan 35 | de breedte van het venster, maar je kunt 'm ook handmatig aanpassen met 36 | "S" en "<" voor kleiner en "B" en ">" voor groter. Gebruik de 37 | "F" om de status aan de onderkant aan/uit te schakelen. De "K" zorgt 38 | ervoor dat een muisklik je niet meer, of wel weer naar de volgende sheet 39 | brengt. Je kan de "C" gebruiken om het inhoudsoverzicht op te roepen, en 40 | een willekeurige andere toets om 'm weer te verbergen. Gebruik "F11" om de 41 | "volledig scherm" modus aan /uit te schakelen. Merk op dat niet alle 42 | toetsen in iedere browser worden ondersteund, omdat sommige browsers 43 | toetsen gebruiken voor besturing van de browser zelf. Dit varieert zelfs 44 | tussen versies van dezelfde browser.

    45 | 46 |

    Firefox gebruikers willen wellicht de "autohide" extension gebruiken om 47 | werkbalken te verbergen wanneer "volledig scherm" wordt aangeroepen met 48 | "F11".

    49 | 50 |

    Als u wilt zien hoe Slidy werkt, gebruik Bron Bekijken om de XHTML opmaak 51 | te bekijken, of bekijk deze langere uitleg, die ook extra functionaliteit 52 | uitlegt. Elke sheet is in de opmaak genoteerd als een div element met 53 | class="slide". CSS positionering and procentuele breedtes op afbeeldingen 54 | kunnen worden gebruikt om te verzekeren dat uw afbeeldingrijke sheets 55 | schalen naar de vensterbreedte. Inhoud kan stapsgewijs zichtbaar worden 56 | gemaakt met behulp van class="incremental". Het gelinkte stijlblad en de 57 | gelinkte scripts zijn ontwikkeld als een Web-gebaseerd alternatief voor 58 | gesloten presentatie programma's en zijn getest op een variëteit van 59 | recente browsers. Geintegreerde ondersteuning voor (inhoud)aanpassing 60 | wordt ontwikkeld. Zend uw opmerkingen aub naar Dave Raggett <dsr@w3.org> 61 | Als u Slidy bruikbaar vindt, wilt u wellicht overwegen W3C donateur te 62 | worden.

    63 | 64 |

    U bent welkom om gebruik te maken van de stijlbladen, scripts en dit 65 | helpbestand onder de regels van W3C's document use (document gebruik) en 66 | software licensing (software licenties)

    67 | 68 | 69 | 70 | 71 |
    72 | 73 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /slidy2/help/help.html.pl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | Slidy - pomoc 9 | 16 | 24 | 25 | 26 |

    Slidy - pomoc

    27 | 28 |

    Prezentacją steruje się tak samo, jak w Powerpoincie. 29 | Aby przejść do następnego slajdu, kliknij w dowolnym miejscu prezentacji myszą 30 | lub naciśnij spację. Możesz też poruszać się w przód / tył używając klawiszy 31 | kursora (lewo / prawo) lub klawiszy Pg Up / Pg Dn. Rozmiar czcionki jest 32 | dobierany automatycznie tak, żeby mieścił się w obszarze przeglądarki, 33 | ale możesz także dostosować go ręcznie naciskając klawisze "S", aby pomniejszyć 34 | tekst i "B", aby go powiększyć. Możesz do tego celu także użyć klawiszy "<" 35 | i ">". Użyj klawisza "F" aby 36 | ukryć / pokazać dolny pasek statusu. Klawisz "K" włącza / wyłącza tryb przechodzenia 37 | do następnego slajdu po kliknięciu myszką. Możesz użyć klawisza "C", żeby pokazać 38 | spis treści i dowolnego innego, żeby go ukryć. Klawisz 39 | "F11" włącza tryb pełnoekranowy przeglądarki. Pamiętaj, że nie wszystkie klawisze 40 | są obsługiwane we wszystkich przeglądarkach, gdyż niektóre z nich rezerwują 41 | konkretne klawisze do własnych celów, wszystko to zależy od używanej przeglądarki.

    42 | 43 |

    Jeśli używasz Firefoxa, zwróć uwagę na rozszerzenie autohide, dzięki któremu 45 | możesz ukryć paski narzędziowe w trybie pełnoekranowym (F11).

    46 | 47 |

    Jeśli chcesz dowiedzieć się, w jaki sposób działa Slidy, obejrzyj źródło strony prezentacji, żeby 48 | zobaczyć użyty XHTML lub zapoznaj się z prezentacją działania, która omawia 50 | wszystkie dodatkowe funkcje. Każdy slajd jest reprezentowany przez element div o klasie "slide". 51 | Pozycjonowanie CSS i użycie procentowych szerokości obrazków zapewni, że 52 | Twoje slajdy będą poprawnie wyświetlane w każdej skali. 53 | Zawartości slajdu, które mają być stopniowo odsłaniane oznacz klasą "incremental". 54 | Powiązany arkusz stylów CSS i skrypt zostały stworzone jako sieciowa 55 | alternatywa dla komercyjnych narzędzi prezentacyjnych. Całość została 56 | przetestowana na różnorodnych współczesnych przeglądarkach. 57 | Na etapie tworzenia jest aplikacja do zintegrowanego tworzenia i edycji prezentacji. 58 | Wszystkie komentarze prosimy kierować do Dave'a 59 | Raggetta <dsr@w3.org>.

    60 | 61 |

    Zachęcamy do używania arkuszy stylów, skryptów i pliku pomocy na warunkach licencyjnych dotyczących dokumentów 62 | i oprogramowania W3C

    63 | 64 | 65 | 66 |
    67 | 68 | 76 | 77 | -------------------------------------------------------------------------------- /slidy2/help/help.html.pt-br: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Slide Show Help 13 | 21 | 22 | 23 |

    Ajuda do Slide Show

    24 | 25 |

    Este slide show pode ser tocado do jeito do Power Point. 26 | Para avançar ao próximo eslaide, clique em qualquer ponto 27 | da página com o botão direito do mouse. Ou então use a 28 | barra de espaços. Também se pode movimentar para frente ou 29 | para trás com as teclas do cursor -- setinhas para a 30 | direita, para a esquerda, para cima e para baixo. E ainda 31 | com as teclas Page Up e Page Down. O tamanho da fonte é 32 | automaticamente ajustado à largura da janela do navegador, 33 | mas esse ajuste pode ser manual, usando as teclas "S" 34 | (de "smaller") para diminuir o tamanho, e "B" (de "bigger") 35 | para aumentar. Igualmente se pode usar as teclas "<" e 36 | ">". Use 37 | a tecla "F" para alternar entre desativada e ativada a 38 | linha de status no rodapé. A tecla "K" alterna o uso do 39 | clique do mouse para avançar ao próximo eslaide. A tecla 40 | "C" mostra a tabela de conteúdos, que será novamente 41 | ocultada apertando-se qualquer tecla. Use a tecla "F11" 42 | para alternar o modo de tela cheia do navegador. Aperte 43 | "H" (de "Help") para abrir esta página de Ajuda. Note que 44 | alguns navegadores reservam algumas dessas teclas para 45 | outras funções. Assim, experimente no seu navegador para 46 | ver se esse é o seu caso.

    47 | 48 |

    Usuários do Firefox podem querer a extensão autoocultar 50 | para esconder as barras de ferramentas quando entrarem em tela cheia 51 | com a tecla F11.

    52 | 53 |

    Se quiser ver como funciona o Slidy, use o View Source para 54 | visualizar a marcação XHTML, ou leia esta explanação mais longa, 56 | que também contém funcionalidades adicionais. Cada eslaide é 57 | marcado como um div element com 58 | classe="slide". Posicionamentos e larguras em porcentual de CSS 59 | podem ser usados para assegurar que os eslaides com rica 60 | ilustração tenham escalabilidade de acordo com o tamanho da janela. 61 | Já o conteúdo a ser revelado incrementalmente pode receber a 62 | marcação com a classe="incremental". 63 | A folha de estilos vinculados e os scripts foram desenvolvidos 64 | como uma alternativa baseada em web às ferramentas proprietárias 65 | de apresentação, e testados em diversos navegadores recentes. 66 | Suporte à edição integrada ainda está em desenvolvimento. Mande 67 | seus comentários para Dave 68 | Raggett <dsr@w3.org>. 69 | Achando que o Slidy é útil, V. talvez possa considerar a 70 | possibilidade de se tornar um 71 | Apoiador do W3C.

    72 | 73 |

    Fique à vontade para usar as folhas de estilo, os scripts 74 | e o arquivo de ajuda do show de eslaides que se encontram sob as 75 | regras de 76 | 77 | uso de documentação 78 | e 79 | licenciamento de softwaredo W3C -- Consórcio da World Wide 80 | Web.

    81 | 82 | 83 | 84 |
    85 | 86 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /slidy2/help/help.html.pt_br: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Slide Show Help 13 | 21 | 22 | 23 |

    Ajuda do Slide Show

    24 | 25 |

    Este slide show pode ser tocado do jeito do Power Point. 26 | Para avançar ao próximo eslaide, clique em qualquer ponto 27 | da página com o botão direito do mouse. Ou então use a 28 | barra de espaços. Também se pode movimentar para frente ou 29 | para trás com as teclas do cursor -- setinhas para a 30 | direita, para a esquerda, para cima e para baixo. E ainda 31 | com as teclas Page Up e Page Down. O tamanho da fonte é 32 | automaticamente ajustado à largura da janela do navegador, 33 | mas esse ajuste pode ser manual, usando as teclas "S" 34 | (de "smaller") para diminuir o tamanho, e "B" (de "bigger") 35 | para aumentar. Igualmente se pode usar as teclas "<" e 36 | ">". Use 37 | a tecla "F" para alternar entre desativada e ativada a 38 | linha de status no rodapé. A tecla "K" alterna o uso do 39 | clique do mouse para avançar ao próximo eslaide. A tecla 40 | "C" mostra a tabela de conteúdos, que será novamente 41 | ocultada apertando-se qualquer tecla. Use a tecla "F11" 42 | para alternar o modo de tela cheia do navegador. Aperte 43 | "H" (de "Help") para abrir esta página de Ajuda. Note que 44 | alguns navegadores reservam algumas dessas teclas para 45 | outras funções. Assim, experimente no seu navegador para 46 | ver se esse é o seu caso.

    47 | 48 |

    Usuários do Firefox podem querer a extensão autoocultar 50 | para esconder as barras de ferramentas quando entrarem em tela cheia 51 | com a tecla F11.

    52 | 53 |

    Se quiser ver como funciona o Slidy, use o View Source para 54 | visualizar a marcação XHTML, ou leia esta explanação mais longa, 56 | que também contém funcionalidades adicionais. Cada eslaide é 57 | marcado como um div element com 58 | classe="slide". Posicionamentos e larguras em porcentual de CSS 59 | podem ser usados para assegurar que os eslaides com rica 60 | ilustração tenham escalabilidade de acordo com o tamanho da janela. 61 | Já o conteúdo a ser revelado incrementalmente pode receber a 62 | marcação com a classe="incremental". 63 | A folha de estilos vinculados e os scripts foram desenvolvidos 64 | como uma alternativa baseada em web às ferramentas proprietárias 65 | de apresentação, e testados em diversos navegadores recentes. 66 | Suporte à edição integrada ainda está em desenvolvimento. Mande 67 | seus comentários para Dave 68 | Raggett <dsr@w3.org>. 69 | Achando que o Slidy é útil, V. talvez possa considerar a 70 | possibilidade de se tornar um 71 | Apoiador do W3C.

    72 | 73 |

    Fique à vontade para usar as folhas de estilo, os scripts 74 | e o arquivo de ajuda do show de eslaides que se encontram sob as 75 | regras de 76 | 77 | uso de documentação 78 | e 79 | licenciamento de softwaredo W3C -- Consórcio da World Wide 80 | Web.

    81 | 82 | 83 | 84 |
    85 | 86 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /slidy2/help/help.html.sv: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Hjälpsida för presentationer 15 | 23 | 24 |

    Hjälpsida för presentationer

    25 | 26 |

    Denna presentation kan användas på liknande sätt som Power Point. 27 | För att bläddra till nästa sida går det att trycka på mellanslagstangenten eller klicka med musens 28 | västra knapp så gott som var som helst på sidan. Bläddra framåt och 29 | bakåt med höger- respektive vänsterpiltangenterna eller tangenterna »Pg Dn» respektive 30 | »Pg Up». Textens storlek anpassas automatiskt efter webbläsarens 31 | fönsterbredd, men den går även att justera manuellt med 32 | tangenterna »S» och »B» för att förminska respektive förstora texten. Alternativt kan 33 | tangenterna »<» respektive »>» användas. Tangenten 34 | »F» används för att visa / dölja statusraden längst ner i fönstret. Tangenten »K» 35 | kopplar på / av möjligheten att klicka med musen för att bläddra till nästa sida. Tangenten 36 | »C» används för att visa innehållsförteckningen och en tryckning på vilken annan tangent som 37 | helst döljer den. En tryckning på tangenten »H» visar denna hjälpsida. Tangenten »F11» 38 | växlar mellan fullskärmsvisning och visning i webbläsarens fönster. Observera att vissa webbläsare kan 39 | ha reserverat några av dessa tangenttryckningar för andra funktioner; detta varierar mellan olika webbläsare.

    40 | 41 |

    Firefoxanvändare kan vid behov installera autohide 42 | för att verktygsfälten skall döljas vid övergång till fullskärmsvisning med F11.

    43 | 44 |

    För att se hur Slidy fungerar, titta på XHTML-koden genom att välja »Visa 45 | källa» (eller liknande) i webbläsarens meny eller läs följande längre 46 | beskrivning, där även ytterligare finesser beskrivs. Varje sida är markerad som 47 | div-element med attributet class="slide". CSS-positionering och procentuell bredd 48 | kan användas för att placera bilderna i rätt skala i förhållande till 49 | webbläsarens fönsterstorlek. Det som skall visas inkrementiellt 50 | markeras med class="incremental". Länkar hänvisar till några skript och stilmallar 51 | som har testats med en mängd nutida webbläsare och bildar ett webbaserat alternativ till proprietära 52 | presentationsprogram. Stöd för integrerad editering håller på att utvecklas. Skicka gärna 53 | kommentarer till Dave 54 | Raggett <dsr@w3.org>. 55 | Om du finner Slidy användbar kan du överväga att bli 56 | W3C Supporter.

    57 | 58 |

    Välkommen att använda presentationens stilmallar, skript och hjälpfiler enligt reglerna 59 | för W3C:s document use 60 | och software 61 | licensing!

    62 | 63 | 64 | 65 |
    66 | 67 | 75 | 76 | -------------------------------------------------------------------------------- /slidy2/help/help.pt-br.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Slide Show Help 13 | 21 | 22 | 23 |

    Ajuda do Slide Show

    24 | 25 |

    Este slide show pode ser tocado do jeito do Power Point. 26 | Para avançar ao próximo eslaide, clique em qualquer ponto 27 | da página com o botão direito do mouse. Ou então use a 28 | barra de espaços. Também se pode movimentar para frente ou 29 | para trás com as teclas do cursor -- setinhas para a 30 | direita, para a esquerda, para cima e para baixo. E ainda 31 | com as teclas Page Up e Page Down. O tamanho da fonte é 32 | automaticamente ajustado à largura da janela do navegador, 33 | mas esse ajuste pode ser manual, usando as teclas "S" 34 | (de "smaller") para diminuir o tamanho, e "B" (de "bigger") 35 | para aumentar. Igualmente se pode usar as teclas "<" e 36 | ">". Use 37 | a tecla "F" para alternar entre desativada e ativada a 38 | linha de status no rodapé. A tecla "K" alterna o uso do 39 | clique do mouse para avançar ao próximo eslaide. A tecla 40 | "C" mostra a tabela de conteúdos, que será novamente 41 | ocultada apertando-se qualquer tecla. Use a tecla "F11" 42 | para alternar o modo de tela cheia do navegador. Aperte 43 | "H" (de "Help") para abrir esta página de Ajuda. Note que 44 | alguns navegadores reservam algumas dessas teclas para 45 | outras funções. Assim, experimente no seu navegador para 46 | ver se esse é o seu caso.

    47 | 48 |

    Usuários do Firefox podem querer a extensão autoocultar 50 | para esconder as barras de ferramentas quando entrarem em tela cheia 51 | com a tecla F11.

    52 | 53 |

    Se quiser ver como funciona o Slidy, use o View Source para 54 | visualizar a marcação XHTML, ou leia esta explanação mais longa, 56 | que também contém funcionalidades adicionais. Cada eslaide é 57 | marcado como um div element com 58 | classe="slide". Posicionamentos e larguras em porcentual de CSS 59 | podem ser usados para assegurar que os eslaides com rica 60 | ilustração tenham escalabilidade de acordo com o tamanho da janela. 61 | Já o conteúdo a ser revelado incrementalmente pode receber a 62 | marcação com a classe="incremental". 63 | A folha de estilos vinculados e os scripts foram desenvolvidos 64 | como uma alternativa baseada em web às ferramentas proprietárias 65 | de apresentação, e testados em diversos navegadores recentes. 66 | Suporte à edição integrada ainda está em desenvolvimento. Mande 67 | seus comentários para Dave 68 | Raggett <dsr@w3.org>. 69 | Achando que o Slidy é útil, V. talvez possa considerar a 70 | possibilidade de se tornar um 71 | Apoiador do W3C.

    72 | 73 |

    Fique à vontade para usar as folhas de estilo, os scripts 74 | e o arquivo de ajuda do show de eslaides que se encontram sob as 75 | regras de 76 | 77 | uso de documentação 78 | e 79 | licenciamento de softwaredo W3C -- Consórcio da World Wide 80 | Web.

    81 | 82 | 83 | 84 |
    85 | 86 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /slidy2/scripts/.htaccess: -------------------------------------------------------------------------------- 1 | Options +MultiViews 2 | LanguagePriority en 3 | AddLanguage pt-br .pt-br 4 | 5 | 6 | 7 | ForceType 'text/html; charset=utf-8' 8 | 9 | 10 | 11 | 12 | 13 | ForceType 'application/xhtml+xml; charset=utf-8' 14 | 15 | 16 | 17 | 18 | 19 | ForceType 'text/css; charset=utf-8' 20 | 21 | 22 | 23 | 24 | 25 | ForceType 'text/javascript; charset=utf-8' 26 | 27 | 28 | mkdir 29 | -------------------------------------------------------------------------------- /slidy2/scripts/img.srcset.js: -------------------------------------------------------------------------------- 1 | /* imgsrcset - Img srcset polyfill for resolution responsive images. Authors & copyright (c) 2012: WebLinc, David Knight. */ 2 | 3 | // Imgsrcset 4 | (function(win) { 5 | 'use strict'; 6 | 7 | var _viewport = win.document.documentElement, 8 | _srcsetID = 0, 9 | _srcsets = [], 10 | _eventPrefix = '', 11 | _addEvent = win.addEventListener || (_eventPrefix = 'on') && win.attachEvent, 12 | _removeEvent = win.removeEventListener || win.detachEvent, 13 | _srcExpr = /[^\s]+/g, 14 | _digitExpr = /[0-9\.]+/g, 15 | _timer = 0, 16 | 17 | /* 18 | _matches 19 | */ 20 | _matches = function(srcset) { 21 | var srcList = (srcset.indexOf(',') !== -1 && srcset.split(',')) || [srcset], 22 | srcIndex = srcList.length - 1, 23 | srcLength = srcIndex, 24 | 25 | list = null, 26 | listIndex = 0, 27 | 28 | src = '', 29 | media = ''; 30 | 31 | if (srcIndex < 0) { 32 | return; 33 | } 34 | 35 | do { 36 | var list = srcList[srcLength - srcIndex].match(_srcExpr) || [], 37 | listIndex = list.length; 38 | 39 | while (listIndex--) { 40 | var item = list[listIndex], 41 | feature = 0, 42 | digits = 0; 43 | 44 | if (listIndex > 0) { 45 | feature = (item.indexOf('w') !== -1 && (win.innerWidth || _viewport.clientWidth)) || 46 | (item.indexOf('h') !== -1 && (win.innerHeight || _viewport.clientHeight)) || 47 | (item.indexOf('x') !== -1 && (win.devicePixelRatio || 1)); 48 | 49 | digits = Number(item.match(_digitExpr)); 50 | 51 | if (feature && digits && digits > feature) { 52 | break; 53 | } 54 | } else { 55 | src = item; 56 | media = srcList[srcIndex]; 57 | } 58 | } 59 | } while (srcIndex--); 60 | 61 | return (src && media && {src: src, media: media}) || false; 62 | }, 63 | 64 | /* 65 | watch 66 | */ 67 | _watch = function(evt) { 68 | clearTimeout(_timer); 69 | 70 | _timer = setTimeout(function() { 71 | var srcset = null, 72 | srcsetIndex = _srcsetID - 1, 73 | srcsetLength = srcsetIndex, 74 | match = false; 75 | 76 | do { 77 | srcset = _srcsets[srcsetLength - srcsetIndex]; 78 | 79 | // If img element does not have a parent, remove array index to prevent caching 80 | if (!srcset.element.parentNode) { 81 | _srcsetID--; 82 | srcset.splice(srcsetIndex, 1); 83 | continue; 84 | } 85 | 86 | match = _matches(srcset.media); 87 | 88 | if (match && (srcset.matches !== match.media)) { 89 | srcset.matches = match.media; 90 | 91 | srcset.element.src = match.src; 92 | } else if (!match) { 93 | srcset.matches = false; 94 | srcset.src && (srcset.element.src = srcset.src); 95 | } 96 | } while(srcsetIndex--); 97 | }, 10); 98 | }, 99 | 100 | /* 101 | init 102 | */ 103 | _init = function() { 104 | _removeEvent(_eventPrefix + 'load', _init); 105 | 106 | win.Imgsrcset.parse(); 107 | _watch(); 108 | 109 | // Processes '_srcsets' array and determines which source to use 110 | // '_watch' will clear out any images from the array that do not have parents, which should eliminate element caching 111 | _addEvent(_eventPrefix + 'resize', _watch); 112 | _addEvent(_eventPrefix + 'orientationchange', _watch); 113 | }; 114 | 115 | /* 116 | imgsrcset 117 | */ 118 | win.Imgsrcset = { 119 | /* 120 | parse 121 | 122 | Called on '_init' and can also be called if new images are added/removed 123 | */ 124 | parse: function() { 125 | _srcsets = []; 126 | 127 | var imgs = win.document.getElementsByTagName('img') || [], 128 | imgIndex = imgs.length - 1, 129 | imgLength = imgIndex, 130 | img = null, 131 | srcset = ''; 132 | 133 | do { 134 | img = imgs[imgLength - imgIndex]; 135 | srcset = img.getAttribute('srcset') || ''; 136 | 137 | if (!srcset) { 138 | continue; 139 | } 140 | 141 | _srcsetID = _srcsets.push({ 142 | element : img, 143 | media : srcset, 144 | matches : false, 145 | src : img.getAttribute('src') || '' 146 | }); 147 | } while(imgIndex--); 148 | } 149 | }; 150 | 151 | // Set up listeners 152 | _addEvent(_eventPrefix + 'load', _init); 153 | })(window); 154 | -------------------------------------------------------------------------------- /slidy2/styles/.htaccess: -------------------------------------------------------------------------------- 1 | Options +MultiViews 2 | LanguagePriority en 3 | AddLanguage pt-br .pt-br 4 | 5 | 6 | 7 | ForceType 'text/html; charset=utf-8' 8 | 9 | 10 | 11 | 12 | 13 | ForceType 'application/xhtml+xml; charset=utf-8' 14 | 15 | 16 | 17 | 18 | 19 | ForceType 'text/css; charset=utf-8' 20 | 21 | 22 | 23 | 24 | 25 | ForceType 'text/javascript; charset=utf-8' 26 | 27 | 28 | mkdir 29 | -------------------------------------------------------------------------------- /slidy2/styles/print.css: -------------------------------------------------------------------------------- 1 | /* print.css 2 | 3 | Copyright (c) 2005 W3C (MIT, ERCIM, Keio), All Rights Reserved. 4 | W3C liability, trademark, document use and software licensing 5 | rules apply, see: 6 | 7 | http://www.w3.org/Consortium/Legal/copyright-documents 8 | http://www.w3.org/Consortium/Legal/copyright-software 9 | */ 10 | body { 11 | color: black; 12 | font-family: sans-serif; 13 | font-size: 12pt; 14 | } 15 | 16 | div.slide { page-break-before: always; page-break-inside: avoid; } 17 | div.background { display: none; 18 | visibility: hidden; page-break-after: avoid; } 19 | div.handout { display: block; visibility: visible; } 20 | 21 | div dt 22 | { 23 | margin-left: 0; 24 | margin-top: 1em; 25 | margin-bottom: 0.5em; 26 | font-weight: bold; 27 | } 28 | div dd 29 | { 30 | margin-left: 2em; 31 | } 32 | 33 | blockquote { font-style: italic } 34 | 35 | pre { color: rgb(0,128,0); font-size: 80%; 36 | font-weight: bold; line-height: 120%; } 37 | 38 | p.copyright { font-size: smaller } 39 | 40 | a:visited { color: navy } 41 | a:link { color: blue } 42 | a:hover { color: red } 43 | a:active { color: red } 44 | 45 | a {text-decoration : none} 46 | .navbar a:link {color: white} 47 | .navbar a:visited {color: yellow} 48 | .navbar a:active {color: red} 49 | .navbar a:hover {color: red} 50 | 51 | ul { list-style-type: square; } 52 | ul ul { list-style-type: disc; } 53 | ul ul ul { list-style-type: circle; } 54 | ul ul ul ul { list-style-type: disc; } 55 | li { margin-left: 0.5em; } 56 | li li { font-size: 80%; font-style: italic } 57 | li li li { font-size: 80%; font-style: normal } 58 | 59 | -------------------------------------------------------------------------------- /slidy2/styles/slidy.css: -------------------------------------------------------------------------------- 1 | /* slidy.css 2 | 3 | Copyright (c) 2005-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved. 4 | W3C liability, trademark, document use and software licensing 5 | rules apply, see: 6 | 7 | http://www.w3.org/Consortium/Legal/copyright-documents 8 | http://www.w3.org/Consortium/Legal/copyright-software 9 | */ 10 | body 11 | { 12 | margin: 0 0 0 0; 13 | padding: 0 0 0 0; 14 | width: 100%; 15 | height: 100%; 16 | color: black; 17 | background-color: white; 18 | font-family: "Gill Sans MT", "Gill Sans", GillSans, sans-serif; 19 | font-size: 14pt; 20 | } 21 | 22 | div.toolbar { 23 | position: fixed; z-index: 200; 24 | top: auto; bottom: 0; left: 0; right: 0; 25 | height: 1.2em; text-align: right; 26 | padding-left: 1em; 27 | padding-right: 1em; 28 | font-size: 60%; 29 | color: red; 30 | background-color: rgb(240,240,240); 31 | border-top: solid 1px rgb(180,180,180); 32 | } 33 | 34 | div.toolbar span.copyright { 35 | color: black; 36 | margin-left: 0.5em; 37 | } 38 | 39 | div.initial_prompt { 40 | position: absolute; 41 | z-index: 1000; 42 | bottom: 1.2em; 43 | width: 100%; 44 | background-color: rgb(200,200,200); 45 | opacity: 0.35; 46 | background-color: rgb(200,200,200, 0.35); 47 | cursor: pointer; 48 | } 49 | 50 | div.initial_prompt p.help { 51 | text-align: center; 52 | } 53 | 54 | div.initial_prompt p.close { 55 | text-align: right; 56 | font-style: italic; 57 | } 58 | 59 | div.slidy_toc { 60 | position: absolute; 61 | z-index: 300; 62 | width: 60%; 63 | max-width: 30em; 64 | height: 30em; 65 | overflow: auto; 66 | top: auto; 67 | right: auto; 68 | left: 4em; 69 | bottom: 4em; 70 | padding: 1em; 71 | background: rgb(240,240,240); 72 | border-style: solid; 73 | border-width: 2px; 74 | font-size: 60%; 75 | } 76 | 77 | div.slidy_toc .toc_heading { 78 | text-align: center; 79 | width: 100%; 80 | margin: 0; 81 | margin-bottom: 1em; 82 | border-bottom-style: solid; 83 | border-bottom-color: rgb(180,180,180); 84 | border-bottom-width: 1px; 85 | } 86 | 87 | div.slide { 88 | z-index: 20; 89 | margin: 0 0 0 0; 90 | padding-top: 0; 91 | padding-bottom: 0; 92 | padding-left: 20px; 93 | padding-right: 20px; 94 | border-width: 0; 95 | clear: both; 96 | top: 0; 97 | bottom: 0; 98 | left: 0; 99 | right: 0; 100 | line-height: 120%; 101 | background-color: transparent; 102 | } 103 | 104 | div.background { 105 | display: none; 106 | } 107 | 108 | div.handout { 109 | margin-left: 20px; 110 | margin-right: 20px; 111 | } 112 | 113 | div.slide.titlepage { 114 | text-align: center; 115 | } 116 | 117 | div.slide.titlepage h1 { 118 | padding-top: 10%; 119 | margin-right: 0; 120 | } 121 | 122 | div.slide h1 { 123 | padding-left: 0; 124 | padding-right: 20pt; 125 | padding-top: 4pt; 126 | padding-bottom: 4pt; 127 | margin-top: 0; 128 | margin-left: 0; 129 | margin-right: 60pt; 130 | margin-bottom: 0.5em; 131 | display: block; 132 | font-size: 160%; 133 | line-height: 1.2em; 134 | background: transparent; 135 | } 136 | 137 | @media screen and (max-device-width: 1024px) 138 | { 139 | div.slide { font-size: 100%; } 140 | } 141 | 142 | @media screen and (max-device-width: 800px) 143 | { 144 | div.slide { font-size: 200%; } 145 | div.slidy_toc { 146 | top: 1em; 147 | left: 1em; 148 | right: auto; 149 | width: 80%; 150 | font-size: 180%; 151 | } 152 | } 153 | 154 | div.toc-heading { 155 | width: 100%; 156 | border-bottom: solid 1px rgb(180,180,180); 157 | margin-bottom: 1em; 158 | text-align: center; 159 | } 160 | 161 | img { 162 | image-rendering: optimize-quality; 163 | } 164 | 165 | pre { 166 | font-size: 80%; 167 | font-weight: bold; 168 | line-height: 120%; 169 | padding-top: 0.2em; 170 | padding-bottom: 0.2em; 171 | padding-left: 1em; 172 | padding-right: 1em; 173 | border-style: solid; 174 | border-left-width: 1em; 175 | border-top-width: thin; 176 | border-right-width: thin; 177 | border-bottom-width: thin; 178 | border-color: #95ABD0; 179 | color: #00428C; 180 | background-color: #E4E5E7; 181 | } 182 | 183 | li pre { margin-left: 0; } 184 | 185 | blockquote { font-style: italic } 186 | 187 | img { background-color: transparent } 188 | 189 | p.copyright { font-size: smaller } 190 | 191 | .center { text-align: center } 192 | .footnote { font-size: smaller; margin-left: 2em; } 193 | 194 | a img { border-width: 0; border-style: none } 195 | 196 | a:visited { color: navy } 197 | a:link { color: navy } 198 | a:hover { color: red; text-decoration: underline } 199 | a:active { color: red; text-decoration: underline } 200 | 201 | a {text-decoration: none} 202 | .toolbar a:link {color: blue} 203 | .toolbar a:visited {color: blue} 204 | .toolbar a:active {color: red} 205 | .toolbar a:hover {color: red} 206 | 207 | ul { list-style-type: square; } 208 | ul ul { list-style-type: disc; } 209 | ul ul ul { list-style-type: circle; } 210 | ul ul ul ul { list-style-type: disc; } 211 | li { margin-left: 0.5em; margin-top: 0.5em; } 212 | li li { font-size: 85%; font-style: italic } 213 | li li li { font-size: 85%; font-style: normal } 214 | 215 | div dt 216 | { 217 | margin-left: 0; 218 | margin-top: 1em; 219 | margin-bottom: 0.5em; 220 | font-weight: bold; 221 | } 222 | div dd 223 | { 224 | margin-left: 2em; 225 | margin-bottom: 0.5em; 226 | } 227 | 228 | 229 | p,pre,ul,ol,blockquote,h2,h3,h4,h5,h6,dl,table { 230 | margin-left: 1em; 231 | margin-right: 1em; 232 | } 233 | 234 | p.subhead { font-weight: bold; margin-top: 2em; } 235 | 236 | .smaller { font-size: smaller } 237 | .bigger { font-size: 130% } 238 | 239 | td,th { padding: 0.2em } 240 | 241 | ul { 242 | margin: 0.5em 1.5em 0.5em 1.5em; 243 | padding: 0; 244 | } 245 | 246 | ol { 247 | margin: 0.5em 1.5em 0.5em 1.5em; 248 | padding: 0; 249 | } 250 | 251 | ul { list-style-type: square; } 252 | ul ul { list-style-type: disc; } 253 | ul ul ul { list-style-type: circle; } 254 | ul ul ul ul { list-style-type: disc; } 255 | 256 | ul li { 257 | list-style: square; 258 | margin: 0.1em 0em 0.6em 0; 259 | padding: 0 0 0 0; 260 | line-height: 140%; 261 | } 262 | 263 | ol li { 264 | margin: 0.1em 0em 0.6em 1.5em; 265 | padding: 0 0 0 0px; 266 | line-height: 140%; 267 | list-style-type: decimal; 268 | } 269 | 270 | li ul li { 271 | font-size: 85%; 272 | font-style: italic; 273 | list-style-type: disc; 274 | background: transparent; 275 | padding: 0 0 0 0; 276 | } 277 | li li ul li { 278 | font-size: 85%; 279 | font-style: normal; 280 | list-style-type: circle; 281 | background: transparent; 282 | padding: 0 0 0 0; 283 | } 284 | li li li ul li { 285 | list-style-type: disc; 286 | background: transparent; 287 | padding: 0 0 0 0; 288 | } 289 | 290 | li ol li { 291 | list-style-type: decimal; 292 | } 293 | 294 | 295 | li li ol li { 296 | list-style-type: decimal; 297 | } 298 | 299 | /* 300 | setting class="outline on ol or ul makes it behave as an 301 | ouline list where blocklevel content in li elements is 302 | hidden by default and can be expanded or collapsed with 303 | mouse click. Set class="expand" on li to override default 304 | */ 305 | 306 | ol.outline li:hover { cursor: pointer } 307 | ol.outline li.nofold:hover { cursor: default } 308 | 309 | ul.outline li:hover { cursor: pointer } 310 | ul.outline li.nofold:hover { cursor: default } 311 | 312 | ol.outline { list-style:decimal; } 313 | ol.outline ol { list-style-type:lower-alpha } 314 | 315 | ol.outline li.nofold { 316 | padding: 0 0 0 20px; 317 | background: transparent url(../graphics/nofold-dim.gif) no-repeat 0px 0.5em; 318 | } 319 | ol.outline li.unfolded { 320 | padding: 0 0 0 20px; 321 | background: transparent url(../graphics/fold-dim.gif) no-repeat 0px 0.5em; 322 | } 323 | ol.outline li.folded { 324 | padding: 0 0 0 20px; 325 | background: transparent url(../graphics/unfold-dim.gif) no-repeat 0px 0.5em; 326 | } 327 | ol.outline li.unfolded:hover { 328 | padding: 0 0 0 20px; 329 | background: transparent url(../graphics/fold.gif) no-repeat 0px 0.5em; 330 | } 331 | ol.outline li.folded:hover { 332 | padding: 0 0 0 20px; 333 | background: transparent url(../graphics/unfold.gif) no-repeat 0px 0.5em; 334 | } 335 | 336 | ul.outline li.nofold { 337 | padding: 0 0 0 20px; 338 | background: transparent url(../graphics/nofold-dim.gif) no-repeat 0px 0.5em; 339 | } 340 | ul.outline li.unfolded { 341 | padding: 0 0 0 20px; 342 | background: transparent url(../graphics/fold-dim.gif) no-repeat 0px 0.5em; 343 | } 344 | ul.outline li.folded { 345 | padding: 0 0 0 20px; 346 | background: transparent url(../graphics/unfold-dim.gif) no-repeat 0px 0.5em; 347 | } 348 | ul.outline li.unfolded:hover { 349 | padding: 0 0 0 20px; 350 | background: transparent url(../graphics/fold.gif) no-repeat 0px 0.5em; 351 | } 352 | ul.outline li.folded:hover { 353 | padding: 0 0 0 20px; 354 | background: transparent url(../graphics/unfold.gif) no-repeat 0px 0.5em; 355 | } 356 | 357 | /* for slides with class "title" in table of contents */ 358 | a.titleslide { font-weight: bold; font-style: italic } 359 | 360 | /* 361 | hide images for work around for save as bug 362 | where browsers fail to save images used by CSS 363 | */ 364 | img.hidden { display: none; visibility: hidden } 365 | div.initial_prompt { display: none; visibility: hidden } 366 | 367 | div.slide { 368 | visibility: visible; 369 | position: inherit; 370 | } 371 | div.handout { 372 | border-top-style: solid; 373 | border-top-width: thin; 374 | border-top-color: black; 375 | } 376 | 377 | @media screen { 378 | .hidden { display: none; visibility: visible } 379 | 380 | div.slide.hidden { display: block; visibility: visible } 381 | div.handout.hidden { display: block; visibility: visible } 382 | div.background { display: none; visibility: hidden } 383 | body.single_slide div.initial_prompt { display: block; visibility: visible } 384 | body.single_slide div.background { display: block; visibility: visible } 385 | body.single_slide div.background.hidden { display: none; visibility: hidden } 386 | body.single_slide .invisible { visibility: hidden } 387 | body.single_slide .hidden { display: none; visibility: hidden } 388 | body.single_slide div.slide { position: absolute } 389 | body.single_slide div.handout { display: none; visibility: hidden } 390 | } 391 | 392 | @media print { 393 | .hidden { display: block; visibility: visible } 394 | 395 | div.slide { page-break-after: always; } 396 | 397 | div.slide pre { font-size: 60%; padding-left: 0.5em; } 398 | div.toolbar { display: none; visibility: hidden; } 399 | div.slidy_toc { display: none; visibility: hidden; } 400 | div.background { display: none; visibility: hidden; } 401 | 402 | div.slide { page-break-before: always } 403 | 404 | /* :first-child isn't reliable for print media */ 405 | div.slide.first-slide { page-break-before: avoid } 406 | 407 | div#pagewidth { 408 | display: inline ; 409 | } 410 | } 411 | 412 | -------------------------------------------------------------------------------- /slidy2/styles/w3c-blue.css: -------------------------------------------------------------------------------- 1 | /* w3c-blue.css 2 | 3 | Copyright (c) 2005-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved. 4 | W3C liability, trademark, document use and software licensing 5 | rules apply, see: 6 | 7 | http://www.w3.org/Consortium/Legal/copyright-documents 8 | http://www.w3.org/Consortium/Legal/copyright-software 9 | */ 10 | body 11 | { 12 | margin: 0 0 0 0; 13 | padding: 0 0 0 0; 14 | width: 100%; 15 | height: 100%; 16 | color: black; 17 | background-color: white; 18 | font-family: "Gill Sans MT", "Gill Sans", GillSans, sans-serif; 19 | font-size: 14pt; 20 | } 21 | 22 | div.slide.titlepage { 23 | text-align: center; 24 | } 25 | 26 | div.slide.titlepage h1 { 27 | padding-top: 40%; 28 | } 29 | 30 | div.slide { 31 | z-index: 20; 32 | margin: 0 0 0 0; 33 | padding: 0; 34 | border-width: 0; 35 | top: 0; 36 | bottom: 0; 37 | left: 0; 38 | right: 0; 39 | line-height: 100%; 40 | background-color: transparent; 41 | } 42 | 43 | div.background { 44 | z-index: 1; 45 | position: absolute; 46 | vertical-align: bottom; 47 | left: 0; 48 | right: 0; 49 | top: 0; 50 | bottom: auto; 51 | height: 3.8em; /*4.1em; */ 52 | padding: 0 0 0 0.2em; 53 | margin: 0 0 0 0; 54 | border-width: 0; 55 | background-color: #121220; /* #728ec2; */ 56 | } 57 | 58 | div.background img { 59 | height: 4em; 60 | } 61 | 62 | /* this rule is hidden from IE which doesn't support + selector */ 63 | div.slide + div[class].slide { page-break-before: always;} 64 | 65 | div.slide h1 { 66 | padding-left: 6em; 67 | padding-right: 3em; 68 | padding-top: 0.1em; 69 | margin-bottom: 0.8em; 70 | margin-top: 0.9em; /* -0.05em; */ 71 | margin-left: 0; 72 | margin-right: 0; 73 | min-height: 2.3em; 74 | color: white; 75 | height: 2.2em; 76 | font-size: 140%; 77 | line-height: 1.1em; 78 | } 79 | 80 | div.slide h1 a { 81 | color: white; 82 | text-decoration: none; 83 | } 84 | 85 | div.slide h1 a:link { 86 | color: white; 87 | text-decoration: none; 88 | } 89 | 90 | div.slide h1 a:visited { 91 | color: white; 92 | text-decoration: none; 93 | } 94 | 95 | div.slide h1 a:hover { 96 | color: white; 97 | text-decoration: underline; 98 | } 99 | 100 | div.slide h1 a:active { 101 | color: red; 102 | text-decoration: underline; 103 | } 104 | 105 | #head-icon { 106 | margin-top: 0.5em; 107 | margin-bottom: 0; 108 | margin-left: 0;/* 109 | margin-right: 1em; 110 | background: #121220; 111 | border-width: 0; 112 | height: 3em; 113 | max-width: 3em;*/ 114 | z-index: 2; 115 | float: left; 116 | } 117 | 118 | #head-logo { 119 | margin: 0; 120 | margin-top: 0.25em; 121 | padding-top: 0.25em; 122 | padding-bottom: 0.2em; 123 | padding-left: 0; 124 | padding-right: 0; 125 | height: 3.2em; 126 | width: 4.8em; 127 | float: right; 128 | z-index: 2; 129 | background: #121220; 130 | } 131 | 132 | #head-logo-fallback { 133 | margin: 0; 134 | padding: 0; 135 | margin-top: -0.8em; 136 | width: 4.8em; 137 | float: right; 138 | z-index: 2; 139 | } 140 | 141 | /* the next two classes support vertical and horizontal centering */ 142 | div.vbox { 143 | float: left; 144 | height: 40%; 145 | width: 50%; 146 | margin-top: -240px; 147 | } 148 | div.hbox { 149 | width:60%; 150 | margin-top: 0; 151 | margin-left:auto; 152 | margin-right:auto; 153 | height: 60%; 154 | border:1px solid silver; 155 | background:#F0F0F0; 156 | overflow:auto; 157 | text-align:left; 158 | clear:both; 159 | } 160 | 161 | /* styling for named background */ 162 | div.background.slanty { 163 | z-index: 2; 164 | bottom: 0; 165 | height: 100%; 166 | background: transparent; 167 | } 168 | 169 | div.background.slanty img { margin-top: 4em; width: 100%; height: 80% } 170 | 171 | /* the following makes the pre background translucent */ 172 | /* opacity is a CSS3 property but supported by Mozilla family */ 173 | /* filter is an IE specific feature that also requires width */ 174 | div.slide.slanty pre { 175 | width: 93%; /* needed for IE filter to work */ 176 | opacity: .8; 177 | filter: alpha(opacity=80); 178 | } 179 | 180 | img.withBorder { 181 | border: 2px solid #c60; 182 | padding: 4px; 183 | } 184 | 185 | li pre { margin-left: 0; } 186 | 187 | @media print { pre { font-size: 60% } } 188 | 189 | blockquote { font-style: italic } 190 | 191 | img { background-color: transparent } 192 | 193 | p.copyright { font-size: smaller } 194 | 195 | .center { text-align: center } 196 | .footnote { font-size: smaller; margin-left: 2em; } 197 | 198 | a img { border-width: 0; border-style: none } 199 | 200 | a:visited { color: navy } 201 | a:link { color: navy } 202 | a:hover { color: red; text-decoration: underline } 203 | a:active { color: red; text-decoration: underline } 204 | 205 | a {text-decoration: none} 206 | .navbar a:link {color: white} 207 | .navbar a:visited {color: yellow} 208 | .navbar a:active {color: red} 209 | .navbar a:hover {color: red} 210 | 211 | ul { list-style-type: square; } 212 | ul ul { list-style-type: disc; } 213 | ul ul ul { list-style-type: circle; } 214 | ul ul ul ul { list-style-type: disc; } 215 | li { margin-left: 0.5em; margin-top: 0.5em; } 216 | li li { font-size: 85%; font-style: italic } 217 | li li li { font-size: 85%; font-style: normal } 218 | 219 | div dt 220 | { 221 | margin-left: 0; 222 | margin-top: 1em; 223 | margin-bottom: 0.5em; 224 | font-weight: bold; 225 | } 226 | div dd 227 | { 228 | margin-left: 2em; 229 | margin-bottom: 0.5em; 230 | } 231 | 232 | 233 | p,pre,ul,ol,blockquote,h2,h3,h4,h5,h6,dl,table { 234 | margin-left: 1em; 235 | margin-right: 1em; 236 | } 237 | 238 | p.subhead { font-weight: bold; margin-top: 2em; } 239 | 240 | div.cover p.explanation { 241 | font-style: italic; 242 | margin-top: 3em; 243 | } 244 | 245 | 246 | .smaller { font-size: smaller } 247 | 248 | td,th { padding: 0.2em } 249 | 250 | ul { 251 | margin: 0.5em 1.5em 0.5em 1.5em; 252 | padding: 0; 253 | } 254 | 255 | ol { 256 | margin: 0.5em 1.5em 0.5em 1.5em; 257 | padding: 0; 258 | } 259 | 260 | ul { list-style-type: square; } 261 | ul ul { list-style-type: disc; } 262 | ul ul ul { list-style-type: circle; } 263 | ul ul ul ul { list-style-type: disc; } 264 | li { margin-left: 0.5em; margin-top: 0.5em; } 265 | li li { font-size: 85%; font-style: italic } 266 | li li li { font-size: 85%; font-style: normal } 267 | 268 | 269 | ul li { 270 | list-style: none; 271 | margin: 0.1em 0em 0.6em 0; 272 | padding: 0 0 0 40px; 273 | background: transparent url(../graphics/bullet.png) no-repeat 5px 0.3em; 274 | line-height: 140%; 275 | } 276 | 277 | /* workaround IE's failure to support background on li for print media */ 278 | @media print { ul li { list-style: disc; padding-left: 0; background: none; } } 279 | 280 | ol li { 281 | margin: 0.1em 0em 0.6em 1.5em; 282 | padding: 0 0 0 0px; 283 | line-height: 140%; 284 | } 285 | 286 | li li { 287 | font-size: 85%; 288 | font-style: italic; 289 | list-style-type: disc; 290 | background: transparent; 291 | padding: 0 0 0 0; 292 | } 293 | li li li { 294 | font-size: 85%; 295 | font-style: normal; 296 | list-style-type: circle; 297 | background: transparent; 298 | padding: 0 0 0 0; 299 | } 300 | li li li li { 301 | list-style-type: disc; 302 | background: transparent; 303 | padding: 0 0 0 0; 304 | } 305 | 306 | /* rectangular blue bullet + unfold/nofold/fold widget */ 307 | 308 | /* 309 | setting class="outline on ol or ul makes it behave as an 310 | ouline list where blocklevel content in li elements is 311 | hidden by default and can be expanded or collapsed with 312 | mouse click. Set class="expand" on li to override default 313 | */ 314 | 315 | ol.outline li:hover { cursor: pointer } 316 | ol.outline li.nofold:hover { cursor: default } 317 | 318 | ul.outline li:hover { cursor: pointer } 319 | ul.outline li.nofold:hover { cursor: default } 320 | 321 | ol.outline { list-style:decimal; } 322 | ol.outline ol { list-style-type:lower-alpha } 323 | 324 | ol.outline li.nofold { 325 | padding: 0 0 0 20px; 326 | background: transparent url(../graphics/nofold-dim.gif) no-repeat 0px 0.3em; 327 | } 328 | ol.outline li.unfolded { 329 | padding: 0 0 0 20px; 330 | background: transparent url(../graphics/fold-dim.gif) no-repeat 0px 0.3em; 331 | } 332 | ol.outline li.folded { 333 | padding: 0 0 0 20px; 334 | background: transparent url(../graphics/unfold-dim.gif) no-repeat 0px 0.3em; 335 | } 336 | ol.outline li.unfolded:hover { 337 | padding: 0 0 0 20px; 338 | background: transparent url(../graphics/fold.gif) no-repeat 0px 0.3em; 339 | } 340 | ol.outline li.folded:hover { 341 | padding: 0 0 0 20px; 342 | background: transparent url(../graphics/unfold.gif) no-repeat 0px 0.3em; 343 | } 344 | 345 | ul.outline li.nofold { 346 | padding: 0 0 0 52px; 347 | background: transparent url(../graphics/bullet-nofold-dim.gif) no-repeat 5px 0.3em; 348 | } 349 | ul.outline li.unfolded { 350 | padding: 0 0 0 52px; 351 | background: transparent url(../graphics/bullet-fold-dim.gif) no-repeat 5px 0.3em; 352 | } 353 | ul.outline li.folded { 354 | padding: 0 0 0 52px; 355 | background: transparent url(../graphics/bullet-unfold-dim.gif) no-repeat 5px 0.3em; 356 | } 357 | ul.outline li.unfolded:hover { 358 | padding: 0 0 0 52px; 359 | background: transparent url(../graphics/bullet-fold.gif) no-repeat 5px 0.3em; 360 | } 361 | ul.outline li.folded:hover { 362 | padding: 0 0 0 52px; 363 | background: transparent url(../graphics/bullet-unfold.gif) no-repeat 5px 0.3em; 364 | } 365 | 366 | li ul.outline li.nofold { 367 | padding: 0 0 0 21px; 368 | background: transparent url(../graphics/nofold-dim.gif) no-repeat 5px 0.3em; 369 | } 370 | li ul.outline li.unfolded { 371 | padding: 0 0 0 21px; 372 | background: transparent url(../graphics/fold-dim.gif) no-repeat 5px 0.3em; 373 | } 374 | li ul.outline li.folded { 375 | padding: 0 0 0 21px; 376 | background: transparent url(../graphics/unfold-dim.gif) no-repeat 5px 0.3em; 377 | } 378 | li ul.outline li.unfolded:hover { 379 | padding: 0 0 0 21px; 380 | background: transparent url(../graphics/fold.gif) no-repeat 5px 0.3em; 381 | } 382 | li ul.outline li.folded:hover { 383 | padding: 0 0 0 21px; 384 | background: transparent url(../graphics/unfold.gif) no-repeat 5px 0.3em; 385 | } 386 | 387 | img { 388 | image-rendering: optimize-quality; 389 | } 390 | 391 | img.withBorder { 392 | border: 2px solid #c60; 393 | padding: 4px; 394 | } 395 | 396 | div.header { 397 | position: absolute; 398 | z-index: 2; 399 | left: 0; 400 | right: 0; 401 | top: 0; 402 | bottom: auto; 403 | height: 2.95em; 404 | width: 100%; 405 | padding: 0 0 0 0; 406 | margin: 0 0 0 0; 407 | border-width: 0; 408 | border-style: solid; 409 | background-color: #005A9C; 410 | border-bottom-width: thick; 411 | border-bottom-color: #95ABD0; 412 | } 413 | 414 | div.footer { 415 | position: absolute; 416 | z-index: 80; 417 | left: 0; 418 | right: 0; 419 | top: auto; 420 | bottom: 0; 421 | height: 3.5em; 422 | margin: 0; 423 | font-size: 80%; 424 | font-weight: bold; 425 | padding-left: 1em; 426 | padding-right: 0; 427 | padding-top: 0.3em; 428 | padding-bottom: 0; 429 | color: #003366; 430 | background-color: #95ABD0; 431 | } 432 | 433 | /* this is a hack to hide property from IE6 and below */ 434 | div[class="footer"] { 435 | position: fixed; 436 | } 437 | 438 | #hidden-bullet { 439 | visibility: hidden; 440 | display: none; 441 | } 442 | 443 | div.slide.cover { 444 | color: white; 445 | background-color: #121220; 446 | padding-top: 0; 447 | padding-right: 0; 448 | padding-left: 3em; 449 | height: 100%; 450 | } 451 | 452 | div.slide.cover h1 { 453 | margin: 0; 454 | padding: 0.5em; 455 | color: white; 456 | height: auto; 457 | } 458 | 459 | div.slide.cover h2 { 460 | color: white; 461 | } 462 | 463 | div.slide.cover a { 464 | color: white; 465 | } 466 | 467 | div.slide.cover a:visited { color: white } 468 | div.slide.cover a:link { color: white } 469 | div.slide.cover a:hover { color: yellow; text-decoration: underline } 470 | div.slide.cover a:active { color: yellow; text-decoration: underline } 471 | 472 | div.slide.cover a:hover, div.slide.cover a:active { 473 | color: yellow; text-decoration: underline; 474 | } 475 | 476 | div.slide.cover img.cover { 477 | margin: 0 0 0 0; 478 | float: right; 479 | padding-bottom: 4em; 480 | width: 50%; 481 | overflow: hidden; 482 | } 483 | 484 | div.slide.cover a:hover, div.slide.cover a:active { 485 | color: yellow; text-decoration: underline; 486 | } 487 | 488 | /* for Bert as an ardent user of the old W3C slidemaker tool */ 489 | 490 | div.comment { display: none; visibility: hidden } 491 | 492 | @media print { 493 | div.slide h1 { background: transparent; color: black } 494 | div.slide.cover { background: transparent; color: black } 495 | div.slide.cover h1 { background: transparent; color: black } 496 | div.comment { display: block; visibility: visible } 497 | } 498 | --------------------------------------------------------------------------------