diff --git a/doc/docs.txt b/doc/docs.txt index 14bdd64b20..2162d65647 100644 --- a/doc/docs.txt +++ b/doc/docs.txt @@ -1,6 +1,3 @@ - Incorrect documentation is often worse than no documentation. - -- Bertrand Meyer - The documentation consists of several documents: - | `Tutorial (part I) `_ diff --git a/lib/nimbase.h b/lib/nimbase.h index fcbf80fc3a..f47ab4d292 100644 --- a/lib/nimbase.h +++ b/lib/nimbase.h @@ -481,6 +481,5 @@ static inline void GCGuard (void *ptr) { asm volatile ("" :: "X" (ptr)); } # define GC_GUARD #endif -typedef int assert_numbits[sizeof(NI) == sizeof(void*) && - NIM_INTBITS == sizeof(NI)*8 ? 1 : -1]; +typedef int assert_numbits[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1]; #endif diff --git a/tools/nimweb.nim b/tools/nimweb.nim index de9bcb4400..27e843fde4 100644 --- a/tools/nimweb.nim +++ b/tools/nimweb.nim @@ -8,16 +8,17 @@ # import - os, strutils, times, parseopt, parsecfg, streams, strtabs + os, strutils, times, parseopt, parsecfg, streams, strtabs, tables type - TKeyValPair = tuple[key, val: string] + TKeyValPair = tuple[key, id, val: string] TConfigData = object of TObject tabs, links: seq[TKeyValPair] doc, srcdoc, srcdoc2, webdoc, pdf: seq[string] authors, projectName, projectTitle, logo, infile, outdir, ticker: string vars: PStringTable nimrodArgs: string + quotations: TTable[string, tuple[quote, author: string]] proc initConfigData(c: var TConfigData) = c.tabs = @[] @@ -36,8 +37,9 @@ proc initConfigData(c: var TConfigData) = c.logo = "" c.ticker = "" c.vars = newStringTable(modeStyleInsensitive) + c.quotations = initTable[string, tuple[quote, author: string]]() -include "sunset.tmpl" +include "website.tmpl" # ------------------------- configuration file ------------------------------- @@ -132,8 +134,10 @@ proc parseIniFile(c: var TConfigData) = of "authors": c.authors = v else: quit(errorStr(p, "unknown variable: " & k.key)) of "var": nil - of "links": add(c.links, (k.key, v)) - of "tabs": add(c.tabs, (k.key, v)) + of "links": + let valID = v.split(';') + add(c.links, (k.key.replace('_', ' '), valID[1], valID[0])) + of "tabs": add(c.tabs, (k.key, "", v)) of "ticker": c.ticker = v of "documentation": case normalize(k.key) @@ -143,6 +147,10 @@ proc parseIniFile(c: var TConfigData) = of "srcdoc2": addFiles(c.srcdoc2, "lib", ".nim", split(v, {';'})) of "webdoc": addFiles(c.webdoc, "lib", ".nim", split(v, {';'})) else: quit(errorStr(p, "unknown variable: " & k.key)) + of "quotations": + let vSplit = v.split('-') + doAssert vSplit.len == 2 + c.quotations[k.key.normalize] = (vSplit[0], vSplit[1]) else: nil of cfgOption: quit(errorStr(p, "syntax error")) @@ -203,13 +211,10 @@ proc main(c: var TConfigData) = const cmd = "nimrod rst2html --compileonly $1 -o:web/$2.temp web/$2.txt" if c.ticker.len > 0: - Exec(cmd % [c.nimrodArgs, c.ticker]) - var temp = "web" / changeFileExt(c.ticker, "temp") try: - c.ticker = readFile(temp) + c.ticker = readFile("web" / c.ticker) except EIO: - quit("[Error] cannot open: " & temp) - RemoveFile(temp) + quit("[Error] cannot open: " & c.ticker) for i in 0..c.tabs.len-1: var file = c.tabs[i].val Exec(cmd % [c.nimrodArgs, file]) @@ -221,13 +226,15 @@ proc main(c: var TConfigData) = quit("[Error] cannot open: " & temp) var f: TFile var outfile = "web/upload/$#.html" % file + if not existsDir("web/upload"): + createDir("web/upload") if open(f, outfile, fmWrite): writeln(f, generateHTMLPage(c, file, content)) close(f) else: quit("[Error] cannot write file: " & outfile) removeFile(temp) - + copyDir("web/assets", "web/upload/assets") buildAddDoc(c, "web/upload") buildDoc(c, "web/upload") buildDoc(c, "doc") diff --git a/tools/sunset.tmpl b/tools/sunset.tmpl deleted file mode 100644 index fadf8d3e14..0000000000 --- a/tools/sunset.tmpl +++ /dev/null @@ -1,76 +0,0 @@ -#! stdtmpl | standard -#proc generateHTMLPage(c: var TConfigData, currentTab, content: string): string = -# result = "" - - - - - $c.projectTitle - - - - - -
- - -
- -
-# if len(c.ticker) > 0: -
-
-

latest news

-
-
- $c.ticker -
-
-# end if -# if len(c.links) > 0: -
-
-

Links

-
- -
-# end if -
-
- $content -
-
- -
- - diff --git a/tools/website.tmpl b/tools/website.tmpl new file mode 100644 index 0000000000..0ec6592670 --- /dev/null +++ b/tools/website.tmpl @@ -0,0 +1,75 @@ +#! stdtmpl | standard +#proc generateHTMLPage(c: var TConfigData, currentTab, content: string): string = +# result = "" + + + + + $c.projectTitle + + + + + +
+ + + + +
+ #for i in 0.. c.tabs.len-1: + # var name = c.tabs[i].key + # var t = c.tabs[i].val + #if currentTab == t: + $name + #end for +
+ + +
+ + + + +
+ #if c.quotations.hasKey(currentTab): +
+

+ ${c.quotations[currentTab].quote} +
+ -- ${c.quotations[currentTab].author} +

+
+ #end if + + $content +
+
+ + +
+ + diff --git a/web/assets/images/link_aporia.png b/web/assets/images/link_aporia.png new file mode 100644 index 0000000000..6256792d77 Binary files /dev/null and b/web/assets/images/link_aporia.png differ diff --git a/web/assets/images/link_forum.png b/web/assets/images/link_forum.png new file mode 100644 index 0000000000..d153231a7c Binary files /dev/null and b/web/assets/images/link_forum.png differ diff --git a/web/assets/images/link_nimbuild.png b/web/assets/images/link_nimbuild.png new file mode 100644 index 0000000000..ad94f9c823 Binary files /dev/null and b/web/assets/images/link_nimbuild.png differ diff --git a/web/assets/images/logo.png b/web/assets/images/logo.png new file mode 100644 index 0000000000..f6b95bf058 Binary files /dev/null and b/web/assets/images/logo.png differ diff --git a/web/assets/images/quote.png b/web/assets/images/quote.png new file mode 100644 index 0000000000..52d529284c Binary files /dev/null and b/web/assets/images/quote.png differ diff --git a/web/assets/images/sidebar.png b/web/assets/images/sidebar.png new file mode 100644 index 0000000000..8488f8acf4 Binary files /dev/null and b/web/assets/images/sidebar.png differ diff --git a/web/assets/images/sidebar_h2.png b/web/assets/images/sidebar_h2.png new file mode 100644 index 0000000000..5de3da2918 Binary files /dev/null and b/web/assets/images/sidebar_h2.png differ diff --git a/web/assets/images/sidebar_head.png b/web/assets/images/sidebar_head.png new file mode 100644 index 0000000000..734d5709bb Binary files /dev/null and b/web/assets/images/sidebar_head.png differ diff --git a/web/assets/images/site_foot.png b/web/assets/images/site_foot.png new file mode 100644 index 0000000000..d94632b206 Binary files /dev/null and b/web/assets/images/site_foot.png differ diff --git a/web/assets/images/site_neck.png b/web/assets/images/site_neck.png new file mode 100644 index 0000000000..cab3dc75ac Binary files /dev/null and b/web/assets/images/site_neck.png differ diff --git a/web/assets/style.css b/web/assets/style.css new file mode 100644 index 0000000000..715214a1a0 --- /dev/null +++ b/web/assets/style.css @@ -0,0 +1,210 @@ +* { cursor:default; } +a, a * { cursor:pointer; text-decoration:none; } + +html, body { + margin:0; + padding:0; + width:100%; + height:100%; + background:#121220; + font:14px arial; + letter-spacing:1px; + line-height:22px; +} + +#site { z-index:0; position:relative; margin:0 auto; width:960px; } +#site > dive { position:relative; } + + /* site_head */ + #site_head { z-index:0; height:200px; } + + #logo { + z-index:-1; + position:absolute; + top:-35px; + left:-330px; + width:868px; + height:334px; + background:url("images/logo.png") no-repeat; + } + + /* site_neck */ + #site_neck { z-index:1; float:left; width:100%; height:40px; background:url("images/site_neck.png") bottom no-repeat; } + + #site_neck > a { + display:block; + float:left; + margin-top:3px; + margin-right:10px; + padding:4px 20px 0 20px; + height:28px; + color:#959a9b; + background:#394649; + font-size:18px; + } + + #site_neck > a:hover { + margin-top:0; + border-top:3px solid #1cb4ec; + } + + #site_neck > a.active { + margin-top:0; + padding-top:7px; + color:#fff; + background:#1cb4ec; + text-shadow:0 0 4px rgba(255,255,255,0.75); + } + + #site_neck > a.active:hover { + border-top:none; + } + + /* site_body */ + #site_body { z-index:2; float:left; clear:both; width:100%; background:#d1dbe3; } + + #page { position:relative; float:left; padding:20px 30px 50px 50px; width:620px; color:#343739; } + + #page h1 { margin-top:40px; } + #page h2 { margin-top:40px; } + + #page p { text-align:justify; } + + #page .quote-image { + z-index:0; + position:absolute; + top:15px; + left:20px; + width:59px; + height:42px; + background:url("images/quote.png") no-repeat; + } + + #page p.quote { + position:relative; + color:#6187a2; + font-style:italic; + letter-spacing:2px; + word-spacing:1px; + } + + #page pre { + padding:20px; + border-left:10px solid #8f9698; + background:#f3f6f8; + font-size:15px; + font-family:courier; + letter-spacing:0; + line-height:17px; + } + + #page span.pre { + background-color: #E6EDF2; + padding: 1pt 3pt; + border-radius: 2pt; + -moz-border-radius: 2pt; + -webkit-border-radius: 2pt; + } + + #page pre > .Comment { color:#858686; font-style:italic; } + #page pre > .Keyword { color:#1cb4ec; font-weight:bold; } + #page pre > .Operator { color:#777; } + #page pre > .StringLit, #page pre > .DecNumber { color:#ff7302; } + + #page li { margin-top:10px; } + + #page a:hover { text-decoration: underline; } + + #page table.docutils { + background: none repeat scroll 0 0 #F3F6F8; + border-collapse: collapse; + font-size: 8pt; + text-align: left; + width: 480px; + border-spacing: 0; + } + + #page .docutils th { + border-bottom: 2px solid #1a1a1a; + font-size: 14px; + font-weight: normal; + padding: 8px 8px; + } + + #page .docutils td { + padding: 3px 8px; + color: #4d4d4d; + } + + #sidebar_wrap { float:right; width:260px; } + #sidebar { + z-index:0; + position:relative; + left:20px; + padding:0 10px 60px 10px; + width:200px; + background:#394649 url("images/sidebar.png") bottom no-repeat; + } + + #sidebar_head { + z-index:-1; + position:absolute; + top:-220px; + left:-30px; + width:282px; + height:400px; + background:url("images/sidebar_head.png") top no-repeat; + } + + #sidebar > h2 { + position:relative; + left:-40px; + margin:20px 0 0 0; + padding:19px 0 0 48px; + width:204px; + height:47px; + color:#fff; + background:url("images/sidebar_h2.png") no-repeat; + text-shadow:0 0 4px rgba(255,255,255,0.75); + letter-spacing:2px; + } + + #sidebar > .news { display:block; margin-bottom:20px; padding:0 10px; } + #sidebar > .news > h3 { margin:0; color:#cdd1d1; font-size:18px; letter-spacing:2px; } + #sidebar > .news > p { margin:0; color:#99a0a1; } + #sidebar > .news:hover > h3 { color:#fff; text-shadow:0 0 4px rgba(255,255,255,0.75); } + #sidebar > .news:hover > p { color:#eee; text-shadow:0 0 4px rgba(255,255,255,0.5); } + + #sidebar > .link { + display:block; + margin:0; + padding:15px 20px 0 20px; + height:41px; + color:#cdd1d1; + font-size:18px; + font-weight:bold; + } + + #sidebar > .link:hover { + color:#fff; + text-shadow:0 0 4px rgba(255,255,255,0.75); + } + + #link_forum { background:url("images/link_forum.png") top right no-repeat; } + #link_aporia { background:url("images/link_aporia.png") top right no-repeat; } + #link_nimbuild { background:url("images/link_nimbuild.png") top right no-repeat; } + + /* site_foot */ + #site_foot { z-index:3; clear:both; padding-top:40px; height:150px; background:url("images/site_foot.png") top no-repeat; } + + #legal { + float:right; + margin-top:10px; + color:#88888f; + font-size:12px; + letter-spacing:1px; + } + + #legal > a { color:#88888f; } + #legal > a:visited { color:#88888f; } + #legal > a:hover { color:#fff; } diff --git a/web/download.txt b/web/download.txt index 688ea9f02a..63b91a832f 100644 --- a/web/download.txt +++ b/web/download.txt @@ -1,6 +1,3 @@ - There are two major products that come out of Berkeley: LSD and UNIX. - We don't believe this to be a coincidence. -- Jeremy S. Anderson. - Here you can download the latest version of the Nimrod Compiler. Please choose your platform: * source-based installation: ``_ diff --git a/web/index.txt b/web/index.txt index 9b90e94dea..4a5ddeaca9 100644 --- a/web/index.txt +++ b/web/index.txt @@ -2,21 +2,15 @@ Home ==== - The most important thing in the programming language is the name. A language - will not succeed without a good name. I have recently invented a very good - name and now I am looking for a suitable language. - -- D. E. Knuth - - -**Nimrod combines Lisp's power with Python's readability and C's performance.** - Welcome to Nimrod ----------------- **Nimrod** is a statically typed, imperative programming language that tries to give the programmer ultimate power without compromises on runtime efficiency. This means it focuses on compile-time mechanisms in all their -various forms. Beneath a nice infix/indentation based syntax with a +various forms. + +Beneath a nice infix/indentation based syntax with a powerful (AST based, hygienic) macro system lies a semantic model that supports a soft realtime GC on thread local heaps. Asynchronous message passing is used between threads, so no "stop the world" mechanism is necessary. An unsafe @@ -24,16 +18,20 @@ shared memory heap is also provided for the increased efficiency that results from that model. -.. container:: snippet - *Nimrod looks like this:* - - .. code-block:: nimrod - import strutils - - # Prints the maximum integer from a list of integers - # delimited by whitespace read from stdin. - let tokens = stdin.readLine.split - echo tokens.map(parseInt).max, " is the maximum." +Nimrod looks like this: +======================= + +.. code-block:: nimrod + # compute average line length + var count = 0 + var sum = 0 + + for line in stdin.lines: + count += 1 + sum += line.len + + echo "Average line length: ", + if count > 0: sum / count else: 0 Nimrod is efficient diff --git a/web/nimrod.ini b/web/nimrod.ini index 565a021171..9c7e977c0d 100644 --- a/web/nimrod.ini +++ b/web/nimrod.ini @@ -5,9 +5,11 @@ Logo: "efficient, expressive, elegant" Authors: "Andreas Rumpf and contributors" [Links] -FORUM: "http://forum.nimrod-code.org" -APORIA: "https://github.com/nimrod-code/Aporia" -NIMBUILD: "http://build.nimrod-code.org" +# Underscores are replaced with a space. +# Everything after ; is the ID +User_Forum: "http://forum.nimrod-code.org;link_forum" +Aporia_IDE: "https://github.com/nimrod-code/Aporia;link_aporia" +Nimbuild: "http://build.nimrod-code.org;link_nimbuild" [Tabs] # Menu entry: filename @@ -19,7 +21,19 @@ community: community FAQ: question [Ticker] -file: ticker +file: ticker.txt + +[Quotations] +# Page: quote - Person +# Bad things will happen if you use multiple dashes here. +index: """The most important thing in the programming language is the name. +A language will not succeed without a good name. I have recently invented a +very good name and now I am looking for a suitable language. - D. E. Knuth""" +documentation: """Incorrect documentation is often worse than no documentation. +- Bertrand Meyer""" +download: """There are two major products that come out of Berkeley: LSD and +UNIX. We don't believe this to be a coincidence. - Jeremy S. Anderson.""" + [Documentation] doc: "endb;intern;apis;lib;manual;tut1;tut2;nimrodc;overview;filters;trmacros" diff --git a/web/ticker.txt b/web/ticker.txt index 6b247c735c..e0965238f5 100644 --- a/web/ticker.txt +++ b/web/ticker.txt @@ -1,16 +1,24 @@ -| `2012-09-23`:newsdate: -| Nimrod version 0.9.0 has been released! - Get it `here <./download.html>`_. + +

Sep 23, 2012

+

Nimrod version 0.9.0 has been released!

+
-| `2012-02-09`:newsdate: -| Nimrod version 0.8.14 has been released! + +

Feb 9, 2012

+

Nimrod version 0.8.14 has been released!

+
-| `2011-07-10`:newsdate: -| Nimrod version 0.8.12 has been released! + +

Jul 10, 2011

+

Nimrod version 0.8.12 has been released!

+
-| `2010-10-20`:newsdate: -| Nimrod version 0.8.10 has been released! - -| `2010-03-14`:newsdate: -| Nimrod version 0.8.8 has been released! + +

Oct 20, 2010

+

Nimrod version 0.8.10 has been released!

+
+ +

Mar 14, 2010

+

Nimrod version 0.8.8 has been released!

+
\ No newline at end of file