diff options
185 files changed, 21442 insertions, 24287 deletions
diff --git a/cogapp.py b/cogapp.py index 4c2e92bf0..54c5e5e3a 100644 --- a/cogapp.py +++ b/cogapp.py @@ -1,15 +1,17 @@ """ Cog code generation tool. http://nedbatchelder.com/code/cog - + Copyright 2004-2008, Ned Batchelder. """ # $Id: cogapp.py 141 2008-05-22 10:56:43Z nedbat $ +# modified to run with Python1.5.2 by Andreas Rumpf import md5, os, re, string, sys, traceback, types -import imp, compiler +import imp import copy, getopt, shlex from cStringIO import StringIO +from string import strip, split, join, replace __all__ = ['Cog', 'CogUsageError'] @@ -56,7 +58,7 @@ class CogError(Exception): Exception.__init__(self, "%s(%d): %s" % (file, line, msg)) else: Exception.__init__(self, msg) - + class CogUsageError(CogError): """ An error in usage of command-line arguments in cog. """ @@ -78,7 +80,7 @@ class Redirectable: def __init__(self): self.stdout = sys.stdout self.stderr = sys.stderr - + def setOutput(self, stdout=None, stderr=None): """ Assign new files for standard out and/or standard error. """ @@ -94,12 +96,16 @@ class CogGenerator(Redirectable): Redirectable.__init__(self) self.markers = [] self.lines = [] - + def parseMarker(self, l): self.markers.append(l) - + def parseLine(self, l): - self.lines.append(l.strip('\n')) + s = 0 + e = len(l) + while s < len(l) and l[s] == '\n': s = s + 1 + while e >= 1 and l[e-1] == '\n': e = e - 1 + self.lines.append(l[s:e+1]) def getCode(self): """ Extract the executable Python code from the generator. @@ -109,11 +115,17 @@ class CogGenerator(Redirectable): # then remove it from all the lines. prefIn = commonPrefix(self.markers + self.lines) if prefIn: - self.markers = [ l.replace(prefIn, '', 1) for l in self.markers ] - self.lines = [ l.replace(prefIn, '', 1) for l in self.lines ] + tmp = [] + for l in self.markers: tmp.append(replace(l, prefIn, '', 1)) + self.markers = tmp + tmp = [] + for l in self.lines: tmp.append(replace(l, prefIn, '', 1)) + self.lines = tmp + #self.markers = [ l.replace(prefIn, '', 1) for l in self.markers ] + #self.lines = [ l.replace(prefIn, '', 1) for l in self.lines ] return reindentBlock(self.lines, '') - + def evaluate(self, cog, globals, fname='cog generator'): # figure out the right whitespace prefix for the output prefOut = whitePrefix(self.markers) @@ -121,17 +133,22 @@ class CogGenerator(Redirectable): intext = self.getCode() if not intext: return '' - - # In Python 2.2, the last line has to end in a newline. - intext = "import cog\n" + intext + "\n" - code = compiler.compile(intext, filename=str(fname), mode='exec') + # In Python 2.2, the last line has to end in a newline. + intext = "import cog\n" + replace(intext, "\r\n", "\n") + "\n" + code = None + try: + import compiler + except ImportError: + code = compile(intext, str(fname), 'exec') + if code == None: + code = compiler.compile(intext, filename=str(fname), mode='exec') # Make sure the "cog" module has our state. cog.cogmodule.msg = self.msg cog.cogmodule.out = self.out cog.cogmodule.outl = self.outl cog.cogmodule.error = self.error - + self.outstring = '' eval(code, globals) @@ -139,31 +156,31 @@ class CogGenerator(Redirectable): # ends with a newline, or it will be joined to the # end-output line, ruining cog's idempotency. if self.outstring and self.outstring[-1] != '\n': - self.outstring += '\n' + self.outstring = self.outstring + '\n' return reindentBlock(self.outstring, prefOut) def msg(self, s): - print >>self.stdout, "Message: "+s + self.stdout.write("Message: "+s+"\n") def out(self, sOut='', dedent=False, trimblanklines=False): """ The cog.out function. """ if trimblanklines and ('\n' in sOut): - lines = sOut.split('\n') - if lines[0].strip() == '': + lines = split(sOut, '\n') + if strip(lines[0]) == '': del lines[0] - if lines and lines[-1].strip() == '': + if lines and strip(lines[-1]) == '': del lines[-1] - sOut = '\n'.join(lines)+'\n' + sOut = join(lines,'\n')+'\n' if dedent: sOut = reindentBlock(sOut) - self.outstring += sOut + self.outstring = self.outstring + sOut - def outl(self, sOut='', **kw): + def outl(self, sOut='', dedent=False, trimblanklines=False): """ The cog.outl function. """ - self.out(sOut, **kw) + self.out(sOut, dedent, trimblanklines) self.out('\n') def error(self, msg='Error raised by cog generator.'): @@ -185,7 +202,7 @@ class NumberedFileReader: def readline(self): l = self.f.readline() if l: - self.n += 1 + self.n = self.n + 1 return l def linenumber(self): @@ -211,7 +228,7 @@ class CogOptions: self.bEofCanBeEnd = False self.sSuffix = None self.bNewlines = False - + def __cmp__(self, other): """ Comparison operator for tests to use. """ @@ -225,7 +242,7 @@ class CogOptions: def addToIncludePath(self, dirs): """ Add directories to the include path. """ - dirs = dirs.split(os.pathsep) + dirs = split(dirs, os.pathsep) self.includePath.extend(dirs) def parseArgs(self, argv): @@ -244,7 +261,7 @@ class CogOptions: elif o == '-D': if a.count('=') < 1: raise CogUsageError("-D takes a name=value argument") - name, value = a.split('=', 1) + name, value = split(a, '=', 1) self.defines[name] = value elif o == '-e': self.bWarnEmpty = True @@ -281,6 +298,14 @@ class CogOptions: raise CogUsageError("Can't use -o with -r (they are opposites)") +def mydigest(hasher): + result = "" + for c in hasher.digest(): + x = hex(ord(c))[2:] + if len(x) == 1: x = "0" + x + result = result + x + return result + class Cog(Redirectable): """ The Cog engine. """ @@ -294,19 +319,19 @@ class Cog(Redirectable): self.options = CogOptions() self.sOutputMode = 'w' - + self.installCogModule() def showWarning(self, msg): - print >>self.stdout, "Warning:", msg + self.stdout.write("Warning: " + msg + "\n") def isBeginSpecLine(self, s): return string.find(s, self.sBeginSpec) >= 0 - + def isEndSpecLine(self, s): return string.find(s, self.sEndSpec) >= 0 and \ not self.isEndOutputLine(s) - + def isEndOutputLine(self, s): return string.find(s, self.sEndOutput) >= 0 @@ -317,7 +342,7 @@ class Cog(Redirectable): self.cogmodule = imp.new_module('cog') self.cogmodule.path = [] sys.modules['cog'] = self.cogmodule - + def processFile(self, fIn, fOut, fname=None, globals=None): """ Process an input file object to an output file object. fIn and fOut can be file objects, or file names. @@ -326,19 +351,19 @@ class Cog(Redirectable): sFileIn = fname or '' sFileOut = fname or '' # Convert filenames to files. - if isinstance(fIn, types.StringTypes): + if type(fIn) == type(""): # Open the input file. sFileIn = fIn fIn = open(fIn, 'r') - if isinstance(fOut, types.StringTypes): + if type(fOut) == type(""): # Open the output file. sFileOut = fOut fOut = open(fOut, self.sOutputMode) fIn = NumberedFileReader(fIn) - + bSawCog = False - + self.cogmodule.inFile = sFileIn self.cogmodule.outFile = sFileOut @@ -383,12 +408,12 @@ class Cog(Redirectable): raise CogError("Cog code markers inverted", file=sFileIn, line=firstLineNum) else: - sCode = l[beg+len(self.sBeginSpec):end].strip() + sCode = strip(l[beg+len(self.sBeginSpec):end]) gen.parseLine(sCode) else: # Deal with an ordinary code block. l = fIn.readline() - + # Get all the lines in the spec while l and not self.isEndSpecLine(l): if self.isBeginSpecLine(l): @@ -409,9 +434,9 @@ class Cog(Redirectable): if not self.options.bDeleteCode: fOut.write(l) gen.parseMarker(l) - + l = fIn.readline() - + # Eat all the lines in the output section. While reading past # them, compute the md5 hash of the old output. hasher = md5.new() @@ -424,14 +449,14 @@ class Cog(Redirectable): file=sFileIn, line=fIn.linenumber()) hasher.update(l) l = fIn.readline() - curHash = hasher.hexdigest() + curHash = mydigest(hasher) if not l and not self.options.bEofCanBeEnd: # We reached end of file before we found the end output line. raise CogError("Missing '%s' before end of file." % self.sEndOutput, file=sFileIn, line=fIn.linenumber()) - # Write the output of the spec to be the new output if we're + # Write the output of the spec to be the new output if we're # supposed to generate code. hasher = md5.new() if not self.options.bNoGenerate: @@ -440,10 +465,10 @@ class Cog(Redirectable): sGen = self.suffixLines(sGen) hasher.update(sGen) fOut.write(sGen) - newHash = hasher.hexdigest() - + newHash = mydigest(hasher) + bSawCog = True - + # Write the ending output line hashMatch = self.reEndOutput.search(l) if self.options.bHashOutput: @@ -453,17 +478,17 @@ class Cog(Redirectable): raise CogError("Output has been edited! Delete old checksum to unprotect.", file=sFileIn, line=fIn.linenumber()) # Create a new end line with the correct hash. - endpieces = l.split(hashMatch.group(0), 1) + endpieces = split(l, hashMatch.group(0), 1) else: # There was no old hash, but we want a new hash. - endpieces = l.split(self.sEndOutput, 1) - l = (self.sEndFormat % newHash).join(endpieces) + endpieces = split(l, self.sEndOutput, 1) + l = join(endpieces, (self.sEndFormat % newHash)) else: # We don't want hashes output, so if there was one, get rid of # it. if hashMatch: - l = l.replace(hashMatch.groupdict()['hashsect'], '', 1) - + l = replace(l, hashMatch.groupdict()['hashsect'], '', 1) + if not self.options.bDeleteCode: fOut.write(l) l = fIn.readline() @@ -473,14 +498,14 @@ class Cog(Redirectable): # A regex for non-empty lines, used by suffixLines. reNonEmptyLines = re.compile("^\s*\S+.*$", re.MULTILINE) - + def suffixLines(self, text): """ Add suffixes to the lines in text, if our options desire it. text is many lines, as a single string. """ if self.options.sSuffix: # Find all non-blank lines, and add the suffix to the end. - repl = r"\g<0>" + self.options.sSuffix.replace('\\', '\\\\') + repl = r"\g<0>" + replace(self.options.sSuffix, '\\', '\\\\') text = self.reNonEmptyLines.sub(repl, text) return text @@ -492,7 +517,7 @@ class Cog(Redirectable): fNew = StringIO() self.processFile(fOld, fNew, fname=fname) return fNew.getvalue() - + def replaceFile(self, sOldPath, sNewText): """ Replace file sOldPath with the contents sNewText """ @@ -500,7 +525,7 @@ class Cog(Redirectable): # Need to ensure we can write. if self.options.sMakeWritableCmd: # Use an external command to make the file writable. - cmd = self.options.sMakeWritableCmd.replace('%s', sOldPath) + cmd = replace(self.options.sMakeWritableCmd, '%s', sOldPath) self.stdout.write(os.popen(cmd).read()) if not os.access(sOldPath, os.W_OK): raise CogError("Couldn't make %s writable" % sOldPath) @@ -541,23 +566,23 @@ class Cog(Redirectable): self.sOutputMode = 'w' if self.options.bNewlines: self.sOutputMode = 'wb' - + # How we process the file depends on where the output is going. if self.options.sOutputName: self.processFile(sFile, self.options.sOutputName, sFile) elif self.options.bReplace: # We want to replace the cog file with the output, # but only if they differ. - print >>self.stdout, "Cogging %s" % sFile, + self.stdout.write("Cogging %s" % sFile) bNeedNewline = True - + try: fOldFile = open(sFile) sOldText = fOldFile.read() fOldFile.close() sNewText = self.processString(sOldText, fname=sFile) if sOldText != sNewText: - print >>self.stdout, " (changed)" + self.stdout.write(" (changed)\n") bNeedNewline = False self.replaceFile(sFile, sNewText) finally: @@ -566,7 +591,7 @@ class Cog(Redirectable): # same line, but also make sure to break the line before # any traceback. if bNeedNewline: - print >>self.stdout + self.stdout.write('\n') else: self.processFile(sFile, self.stdout, sFile) finally: @@ -594,7 +619,7 @@ class Cog(Redirectable): self.options.parseArgs(args[1:]) self.options.validate() - + if args[0][0] == '@': if self.options.sOutputName: raise CogUsageError("Can't use -o with @file") @@ -613,22 +638,22 @@ class Cog(Redirectable): # Provide help if asked for anywhere in the command line. if '-?' in argv or '-h' in argv: - print >>self.stderr, usage, + self.stderr.write(usage) return self.options.parseArgs(argv) self.options.validate() if self.options.bShowVersion: - print >>self.stdout, "Cog version %s" % __version__ + self.stdout.write("Cog version %s\n" % __version__) return if self.options.args: - for a in self.options.args: + for a in self.options.args: self.processArguments([a]) else: raise CogUsageError("No files to process") - + def main(self, argv): """ Handle the command-line execution for cog. """ @@ -637,14 +662,14 @@ class Cog(Redirectable): self.callableMain(argv) return 0 except CogUsageError, err: - print >>self.stderr, err - print >>self.stderr, "(for help use -?)" + self.stderr.write(err + "\n") + self.stderr.write("(for help use -?)\n") return 2 except CogGeneratedError, err: - print >>self.stderr, "Error: %s" % err + self.stderr.write("Error: %s\n" % err) return 3 except CogError, err: - print >>self.stderr, err + self.stderr.write(err + "\n") return 1 except: traceback.print_exc(None, self.stderr) diff --git a/config/doctempl.cfg b/config/doctempl.cfg deleted file mode 100644 index 4f99af78f..000000000 --- a/config/doctempl.cfg +++ /dev/null @@ -1,291 +0,0 @@ -# This is the config file for the documentation generator. -# (c) 2008 Andreas Rumpf -# Feel free to edit the templates as you need. - -split.item.toc = "25" -# too long entries in the table of contents get truncated -# after this number of characters - -doc.section = """ -<div class="section" id="$sectionID"> -<h1><a class="toc-backref" href="#$sectionTitleID">$sectionTitle</a></h1> -<dl class="item"> -$content -</dl></div> -""" - -doc.section.toc = """ -<li> - <a class="reference" href="#$sectionID" id="$sectionTitleID">$sectionTitle</a> - <ul class="simple"> - $content - </ul> -</li> -""" - -doc.item = """ -<dt id="$itemID"><pre>$header</pre></dt> -<dd> -$desc -</dd> -""" - -doc.item.toc = """ - <li><a class="reference" href="#$itemID">$name</a></li> -""" - -doc.toc = """ -<div class="navigation"> -<p class="topic-title first">Navigation</p> -<ul class="simple"> -$content -</ul> -</div>""" - -doc.body_toc = """ -$tableofcontents -<div class="content"> -$moduledesc -$content -</div> -""" - -doc.body_no_toc = """ -$moduledesc -$content -""" - -doc.file = """<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<!-- This file is generated by Nimrod. --> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<title>$title</title> -<style type="text/css"> - -span.DecNumber {color: blue} -span.BinNumber {color: blue} -span.HexNumber {color: blue} -span.OctNumber {color: blue} -span.FloatNumber {color: blue} -span.Identifier {color: black} -span.Keyword {font-weight: bold} -span.StringLit {color: blue} -span.LongStringLit {color: blue} -span.CharLit {color: blue} -span.EscapeSequence {color: black} -span.Operator {color: black} -span.Punctation {color: black} -span.Comment, span.LongComment {font-style:italic; color: green} -span.RegularExpression {color: pink} -span.TagStart {color: yellow} -span.TagEnd {color: yellow} -span.Key {color: blue} -span.Value {color: black} -span.RawData {color: blue} -span.Assembler {color: blue} -span.Preprocessor {color: yellow} -span.Directive {color: yellow} -span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference, -span.Other {color: black} - -div.navigation { - float: left; width: 25em; - margin: 0; padding: 0; /* - border: 1px dashed gold; */ - outline: 3px outset #99ff99; //gold; - background-color: #99ff99; -} - -div.navigation ul {list-style-type: none;} -div.navigation ul li a, div.navigation ul li a:visited { - font-weight: bold; - color: #CC0000; - text-decoration: none; -} -div.navigation ul li a:hover { - font-weight: bold; - text-decoration: none; - outline: 2px outset gold; - background-color: gold; /* #779977;*/ -} - -div.content { - margin-left: 25em; - padding: 0 1em; - border: 1px dashed gold; - min-width: 16em; -} - -dl.item dd, dl.item dd p { - margin-top:3px; -} -dl.item dd pre { - margin-left: 15pt; - border: 0px; -} -dl.item dt, dl.item dt pre { - margin: 20pt 0 0 0; -} - -pre, span.tok { - background-color:#F9F9F9; - border:1px dotted #2F6FAB; - color:black; -} - -/* -:Author: David Goodger -:Contact: goodger@python.org -:Date: Date: 2006-05-21 22:44:42 +0200 (Sun, 21 May 2006) -:Revision: Revision: 4564 -:Copyright: This stylesheet has been placed in the public domain. - -Default cascading style sheet for the HTML output of Docutils. - -See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to -customize this style sheet. -*/ -/* used to remove borders from tables and images */ -.borderless, table.borderless td, table.borderless th { border: 0 } - -table.borderless td, table.borderless th { - /* Override padding for "table.docutils td" with "! important". - The right padding separates the table cells. */ - padding: 0 0.5em 0 0 ! important } - -.first { margin-top: 0 ! important } -.last, .with-subtitle { margin-bottom: 0 ! important } -.hidden { display: none } -a.toc-backref { text-decoration: none ; color: black } -blockquote.epigraph { margin: 2em 5em ; } -dl.docutils dd { margin-bottom: 0.5em } -div.abstract { margin: 2em 5em } -div.abstract p.topic-title { font-weight: bold ; text-align: center } -div.admonition, div.attention, div.caution, div.danger, div.error, -div.hint, div.important, div.note, div.tip, div.warning { - margin: 2em ; border: medium outset ; padding: 1em } -div.admonition p.admonition-title, div.hint p.admonition-title, -div.important p.admonition-title, div.note p.admonition-title, -div.tip p.admonition-title { font-weight: bold ; font-family: sans-serif } - -div.attention p.admonition-title, div.caution p.admonition-title, -div.danger p.admonition-title, div.error p.admonition-title, -div.warning p.admonition-title { color: red ; font-weight: bold ; - font-family: sans-serif } - -/* Uncomment (and remove this text!) to get reduced vertical space in - compound paragraphs. -div.compound .compound-first, div.compound .compound-middle { - margin-bottom: 0.5em } - -div.compound .compound-last, div.compound .compound-middle { - margin-top: 0.5em } -*/ - -div.dedication { margin: 2em 5em ; text-align: center ; font-style: italic } -div.dedication p.topic-title { font-weight: bold ; font-style: normal } -div.figure { margin-left: 2em ; margin-right: 2em } -div.footer, div.header { clear: both; font-size: smaller } -div.line-block { display: block ; margin-top: 1em ; margin-bottom: 1em } -div.line-block div.line-block { margin-top: 0 ; margin-bottom: 0 ; - margin-left: 1.5em } -div.sidebar { margin-left: 1em ; border: medium outset ; - padding: 1em ; background-color: #ffffee ; width: 40% ; float: right ; - clear: right } - -div.sidebar p.rubric { font-family: sans-serif ; font-size: medium } -div.system-messages { margin: 5em } -div.system-messages h1 { color: red } -div.system-message { border: medium outset ; padding: 1em } -div.system-message p.system-message-title { color: red ; font-weight: bold } -div.topic { margin: 2em;} -h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, -h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { - margin-top: 0.4em } -h1.title { text-align: center } -h2.subtitle { text-align: center } -hr.docutils { width: 75% } -img.align-left { clear: left } -img.align-right { clear: right } -ol.simple, ul.simple { margin-bottom: 1em } -ol.arabic { list-style: decimal } -ol.loweralpha { list-style: lower-alpha } -ol.upperalpha { list-style: upper-alpha } -ol.lowerroman { list-style: lower-roman } -ol.upperroman { list-style: upper-roman } -p.attribution { text-align: right ; margin-left: 50% } -p.caption { font-style: italic } -p.credits { font-style: italic ; font-size: smaller } -p.label { white-space: nowrap } -p.rubric { font-weight:bold;font-size:larger;color:maroon;text-align:center} -p.sidebar-title {font-family: sans-serif ;font-weight: bold ;font-size: larger } -p.sidebar-subtitle {font-family: sans-serif ; font-weight: bold } -p.topic-title { font-weight: bold } -pre.address { margin-bottom: 0;margin-top:0;font-family:serif;font-size:100% } -pre.literal-block, pre.doctest-block {margin-left: 2em ;margin-right: 2em } -span.classifier {font-family: sans-serif;font-style: oblique } -span.classifier-delimiter {font-family: sans-serif;font-weight: bold } -span.interpreted {font-family: sans-serif } -span.option {white-space: nowrap } -span.pre {white-space: pre } -span.problematic {color: red } -span.section-subtitle { - /* font-size relative to parent (h1..h6 element) */ - font-size: 80% } - -table.citation { border-left: solid 1px gray; margin-left: 1px } -table.docinfo {margin: 2em 4em } -table.docutils {margin-top: 0.5em;margin-bottom: 0.5em } -table.footnote {border-left: solid 1px black;margin-left: 1px } - -table.docutils td, table.docutils th, -table.docinfo td, table.docinfo th {padding-left: 0.5em;padding-right: 0.5em; - vertical-align: top} - -table.docutils th.field-name, table.docinfo th.docinfo-name { - font-weight: bold;text-align: left;white-space: nowrap;padding-left: 0 } -h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, -h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {font-size: 100% } -ul.auto-toc { list-style-type: none } -/*a.reference { color: #E00000; font-weight:bold;} -a.reference:hover {color: #E00000;background-color: #ffff00;display: margin; - font-weight:bold;}*/ - -</style> -<script type="text/javascript"> - //<![CDATA[ - function toggleElem(id) { - var e = document.getElementById(id); - e.style.display = e.style.display == 'none' ? 'block' : 'none'; - } - - var gOpen = 'none' - function toggleAll() { - gOpen = gOpen == 'none' ? 'block' : 'none'; - var i = 1 - while (1) { - var e = document.getElementById("m"+i) - if (!e) break; - e.style.display = gOpen - i++; - } - document.getElementById('toggleButton').value = - gOpen == 'none' ? 'Show Details' : 'Hide Details'; - } - //]]> -</script> - -</head> -<body> -<div class="document" id="documentId"> -<h1 class="title">$title</h1> -$content -<small>Generated: $date $time UTC</small> -</div> -</body> -</html> -""" - diff --git a/config/my_nimrod.cfg b/config/my_nimrod.cfg index 7c74cc3ae..8c4bb8cec 100644 --- a/config/my_nimrod.cfg +++ b/config/my_nimrod.cfg @@ -9,12 +9,14 @@ # Environment variables cannot be used in the options, however! # Just call the compiler with several options: -cc = @if unix: gcc @else: vcc @end +cc = @if macosx or windows: llvm_gcc @else: gcc @end lib="$nimrod/lib" path="$lib/base" path="$lib/base/gtk" path="$lib/base/cairo" path="$lib/base/x11" +path="$lib/base/sdl" +path="$lib/base/opengl" path="$lib/windows" path="$lib/posix" path="$lib/ecmas" @@ -25,20 +27,23 @@ path="$lib/extra" stacktrace:off debugger:off line_dir:off + opt:speed @end # additional defines: #define="" # additional options always passed to the compiler: -force_build line_dir=off -cfilecache=on + +# use the new experimental symbol files for speeding up compilation: +#--symbol_files +--verbosity: "1" hint[LineTooLong]=off hint[XDeclaredButNotUsed]=off @if unix: - passl= "-ldl" + @if not bsd: passl= "-ldl" @end path = "$lib/base/gtk" @end @@ -50,10 +55,12 @@ hint[XDeclaredButNotUsed]=off # Configuration for the LLVM GCC compiler: @if windows: llvm_gcc.path = r"$nimrod\dist\llvm-gcc4.2\bin" +@elif macosx: + llvm_gcc.path = r"/Users/andreasrumpf/download/C/llvm-gcc4.2-2.3-x86-darwin8/bin" @end llvm_gcc.options.debug = "-g" llvm_gcc.options.always = "-w" -llvm_gcc.options.speed = "-O3 -ffast-math" +llvm_gcc.options.speed = "-O2 -fno-strict-aliasing -ffast-math" llvm_gcc.options.size = "-Os -ffast-math" # Configuration for the Borland C++ Compiler: @@ -62,23 +69,24 @@ llvm_gcc.options.size = "-Os -ffast-math" @end bcc.options.debug = "" # turn off warnings about unreachable code and inline procs: -bcc.options.always = "-w- -H- -q -RT- -a8 -w-8027 -w-8066" +bcc.options.always = "-H- -q -RT- -a8 -w-8027 -w-8066 -w-8004" bcc.options.speed = "-O2 -6" bcc.options.size = "-O1 -6" # Configuration for the Visual C/C++ compiler: @if vcc: - @prepend_env path r"C:\Eigenes\compiler\vcc2005\Common7\IDE;" - @prepend_env INCLUDE r"C:\Eigenes\compiler\vcc2005\VC\include;C:\Eigenes\compiler\vcc2005\VC\ATLMFC\INCLUDE;" - @prepend_env LIB r"C:\Eigenes\compiler\vcc2005\VC\lib;C:\Eigenes\compiler\vcc2005\SDK\v2.0\Lib;" + @prepend_env path r"C:\Programme\Microsoft Visual Studio 9.0\Common7\IDE;" + @prepend_env INCLUDE r"C:\Programme\Microsoft Visual Studio 9.0\VC\include;C:\Programme\Microsoft Visual Studio 9.0\VC\ATLMFC\INCLUDE;C:\Programme\Microsoft SDKs\Windows\v6.0A\Include;" + @prepend_env LIB r"C:\Programme\Microsoft Visual Studio 9.0\VC\lib;C:\Programme\Microsoft Visual Studio 9.0\SDK\v2.0\Lib;C:\Programme\Microsoft SDKs\Windows\v6.0A\Lib;" + passl: r"/F33554432" # set the stack size to 8 MB @end @if windows: - vcc.path = r"C:\Eigenes\compiler\vcc2005\VC\bin" + vcc.path = r"C:\Programme\Microsoft Visual Studio 9.0\VC\bin" @end vcc.options.debug = "/RTC1 /ZI" vcc.options.always = "/nologo" -vcc.options.speed = "/Ogityb2 /G7 /arch:SSE2" -vcc.options.size = "/O1 /G7" +vcc.options.speed = "/Ox /arch:SSE2" +vcc.options.size = "/O1" # Configuration for the Watcom C/C++ compiler: @if windows: @@ -122,10 +130,11 @@ lcc.options.size = "-O -p6" # Configuration for the Tiny C Compiler: @if windows: - tcc.path = r"C:\eigenes\compiler\tcc\bin" + tcc.path = r"C:\Eigenes\compiler\tcc-0.9.23\tcc" + tcc.options.always = r"-IC:\Eigenes\compiler\tcc-0.9.23\include " & + r"-IC:\Eigenes\compiler\tcc-0.9.23\include\winapi" @end -tcc.options.debug = "-b" -tcc.options.always = "" +tcc.options.debug = "" tcc.options.speed = "" tcc.options.size = "" @@ -146,7 +155,7 @@ icc.options.always = "-w" icc.options.speed = "-O3 -ffast-math" icc.options.size = "-Os -ffast-math" -@write "used default config file" +@write "used special config file" @if ecmascript: @write "Target is ECMAScript! No unsafe features are allowed!" diff --git a/config/nimrod.cfg b/config/nimrod.cfg index 0b4ddc6e7..eb8ad707f 100644 --- a/config/nimrod.cfg +++ b/config/nimrod.cfg @@ -1,5 +1,4 @@ # Configuration file for the Nimrod Compiler. -# Generated by the koch.py script. # (c) 2008 Andreas Rumpf # Feel free to edit the default values as you need. @@ -8,38 +7,42 @@ # @putenv "key" "val" # Environment variables cannot be used in the options, however! -# Just call the compiler with several options: -cc = @if unix: gcc @else: vcc @end +cc = @if windows: llvm_gcc @else: gcc @end lib="$nimrod/lib" path="$lib/base" path="$lib/base/gtk" path="$lib/base/cairo" path="$lib/base/x11" +path="$lib/base/sdl" +path="$lib/base/opengl" +path="$lib/base/zip" path="$lib/windows" path="$lib/posix" path="$lib/ecmas" path="$lib/extra" @if release: - checks:off + obj_checks:off + field_checks:off + range_checks:off + bound_checks:off + overflow_checks:off + assertions:off + stacktrace:off debugger:off line_dir:off + opt:speed @end -# additional defines: -#define="" # additional options always passed to the compiler: -force_build -line_dir=off -cfilecache=on +--verbosity: "1" hint[LineTooLong]=off -hint[XDeclaredButNotUsed]=off +#hint[XDeclaredButNotUsed]=off @if unix: - passl= "-ldl" - path = "$lib/base/gtk" + @if not bsd: passl= "-ldl" @end @end @if icc: @@ -50,107 +53,48 @@ hint[XDeclaredButNotUsed]=off # Configuration for the LLVM GCC compiler: @if windows: llvm_gcc.path = r"$nimrod\dist\llvm-gcc4.2\bin" +@elif macosx: + llvm_gcc.path = + r"/Users/andreasrumpf/download/C/llvm-gcc4.2-2.3-x86-darwin8/bin" @end llvm_gcc.options.debug = "-g" llvm_gcc.options.always = "-w" -llvm_gcc.options.speed = "-O3 -ffast-math" -llvm_gcc.options.size = "-Os -ffast-math" - -# Configuration for the Borland C++ Compiler: -@if windows: - bcc.path = r"C:\eigenes\compiler\cbuilder5\bin" -@end -bcc.options.debug = "" -# turn off warnings about unreachable code and inline procs: -bcc.options.always = "-w- -H- -q -RT- -a8 -w-8027 -w-8066" -bcc.options.speed = "-O2 -6" -bcc.options.size = "-O1 -6" +llvm_gcc.options.speed = "-O2" +llvm_gcc.options.size = "-Os" # Configuration for the Visual C/C++ compiler: @if vcc: - @prepend_env path r"C:\Programme\Microsoft Visual Studio 9.0\Common7\IDE;" - @prepend_env INCLUDE r"C:\Programme\Microsoft Visual Studio 9.0\VC\include;C:\Programme\Microsoft Visual Studio 9.0\VC\ATLMFC\INCLUDE;C:\Programme\Microsoft SDKs\Windows\v6.0A\Include;" - @prepend_env LIB r"C:\Programme\Microsoft Visual Studio 9.0\VC\lib;C:\Programme\Microsoft Visual Studio 9.0\SDK\v2.0\Lib;C:\Programme\Microsoft SDKs\Windows\v6.0A\Lib;" passl: r"/F33554432" # set the stack size to 8 MB @end -@if windows: - vcc.path = r"C:\Programme\Microsoft Visual Studio 9.0\VC\bin" -@end vcc.options.debug = "/RTC1 /ZI" vcc.options.always = "/nologo" -vcc.options.speed = "/Ogityb2 /G7 /arch:SSE2" -vcc.options.size = "/O1 /G7" - -# Configuration for the Watcom C/C++ compiler: -@if windows: - wcc.path = r"C:\eigenes\compiler\watcom\binnt" -@end -wcc.options.debug = "-d2" -wcc.options.always = "-6 -zw -w-" -wcc.options.speed = "-ox -on -6 -d0 -fp6 -zW" -wcc.options.size = "-ox -on -6 -d0 -fp6 -zW" +vcc.options.speed = "/Ox /arch:SSE2" +vcc.options.size = "/O1" # Configuration for the GNU C/C++ compiler: @if windows: gcc.path = r"C:\eigenes\compiler\mingw\bin" @end +#gcc.exe = "gcc-4.1" +#gcc.linkerExe = "gcc-4.1" gcc.options.debug = "-g" @if macosx: gcc.options.always = "-w -fasm-blocks" @else: gcc.options.always = "-w" @end -gcc.options.speed = "-O3 -ffast-math" -gcc.options.size = "-Os -ffast-math" +gcc.options.speed = "-O3 -fno-strict-aliasing" +gcc.options.size = "-Os" # Configuration for the Digital Mars C/C++ compiler: @if windows: dmc.path = r"C:\eigenes\compiler\d\dm\bin" @end -dmc.options.debug = "-g" -dmc.options.always = "-Jm" -dmc.options.speed = "-ff -o -6" -dmc.options.size = "-ff -o -6" - -# Configuration for the LCC compiler: -@if windows: - lcc.path = r"C:\eigenes\compiler\lcc\bin" -@end -lcc.options.debug = "-g5" -lcc.options.always = "-e1" -lcc.options.speed = "-O -p6" -lcc.options.size = "-O -p6" # Configuration for the Tiny C Compiler: @if windows: tcc.path = r"C:\Eigenes\compiler\tcc-0.9.23\tcc" tcc.options.always = r"-IC:\Eigenes\compiler\tcc-0.9.23\include " & - r"-IC:\Eigenes\compiler\tcc-0.9.23\include\winapi" -@end -tcc.options.debug = "" -tcc.options.speed = "" -tcc.options.size = "" - -# Configuration for the Pelles C compiler: -@if windows: - pcc.path = r"C:\eigenes\compiler\pellesc\bin" + r"-IC:\Eigenes\compiler\tcc-0.9.23\include\winapi" @end -pcc.options.debug = "-Zi" -pcc.options.always = "-Ze" -pcc.options.speed = "-Ox" -pcc.options.size = "-Os" - -@if windows: - icc.path = r"c:\eignes\compiler\icc\bin" -@end -icc.options.debug = "-g" -icc.options.always = "-w" -icc.options.speed = "-O3 -ffast-math" -icc.options.size = "-Os -ffast-math" - -@write "used special config file" - -@if ecmascript: - @write "Target is ECMAScript! No unsafe features are allowed!" -@end - +tcc.options.always = "-w" diff --git a/config/old_doctempl.cfg b/config/old_doctempl.cfg deleted file mode 100644 index 876086382..000000000 --- a/config/old_doctempl.cfg +++ /dev/null @@ -1,287 +0,0 @@ -# This is the config file for the documentation generator. -# (c) 2008 Andreas Rumpf -# Feel free to edit the templates as you need. - -doc.section = """ -<div class="section" id="$sectionID"> -<h1><a class="toc-backref" href="#$sectionTitleID">$sectionTitle</a></h1> -<dl class="item"> -$content -</dl></div> -""" - -doc.section.toc = """ -<li> - <a class="reference" href="#$sectionID" id="$sectionTitleID">$sectionTitle</a> - <ul class="simple"> - $content - </ul> -</li> -""" - -doc.item = """ -<dt id="$itemID"><pre>$header</pre></dt> -<dd> -$desc -</dd> -""" - -doc.item.toc = """ - <li><a class="reference" href="#$itemID">$name</a></li> -""" - -doc.toc = """ -<div class="navigation"> -<p class="topic-title first">Navigation</p> -<ul class="simple"> -$content -</ul> -</div>""" - -doc.body_toc = """ -$tableofcontents -<div class="content"> -$moduledesc -$content -</div> -""" - -doc.body_no_toc = """ -$moduledesc -$content -""" - -doc.file = """<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<!-- This file is generated by Nimrod. --> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<title>$title</title> -<style type="text/css"> - -span.DecNumber {color: blue} -span.BinNumber {color: blue} -span.HexNumber {color: blue} -span.OctNumber {color: blue} -span.FloatNumber {color: blue} -span.Identifier {color: black} -span.Keyword {font-weight: bold} -span.StringLit {color: blue} -span.LongStringLit {color: blue} -span.CharLit {color: blue} -span.EscapeSequence {color: black} -span.Operator {color: black} -span.Punctation {color: black} -span.Comment, span.LongComment {font-style:italic; color: green} -span.RegularExpression {color: pink} -span.TagStart {color: yellow} -span.TagEnd {color: yellow} -span.Key {color: blue} -span.Value {color: black} -span.RawData {color: blue} -span.Assembler {color: blue} -span.Preprocessor {color: yellow} -span.Directive {color: yellow} -span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference, -span.Other {color: black} - -div.navigation { - float: left; width: 20em; - margin: 0; padding: 0; /* - border: 1px dashed gold; */ - outline: 3px outset #99ff99; //gold; - background-color: #99ff99; -} - -div.navigation ul {list-style-type: none;} -div.navigation ul li a, div.navigation ul li a:visited { - font-weight: bold; - color: #CC0000; - text-decoration: none; -} -div.navigation ul li a:hover { - font-weight: bold; - text-decoration: none; - outline: 2px outset gold; - background-color: gold; /* #779977;*/ -} - -div.content { - margin-left: 20em; - padding: 0 1em; - border: 1px dashed gold; - min-width: 16em; -} - -dl.item dd, dl.item dd p { - margin-top:3px; -} -dl.item dd pre { - margin-left: 15pt; - border: 0px; -} -dl.item dt, dl.item dt pre { - margin: 20pt 0 0 0; -} - -pre, span.tok { - background-color:#F9F9F9; - border:1px dotted #2F6FAB; - color:black; -} - -/* -:Author: David Goodger -:Contact: goodger@python.org -:Date: Date: 2006-05-21 22:44:42 +0200 (Sun, 21 May 2006) -:Revision: Revision: 4564 -:Copyright: This stylesheet has been placed in the public domain. - -Default cascading style sheet for the HTML output of Docutils. - -See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to -customize this style sheet. -*/ -/* used to remove borders from tables and images */ -.borderless, table.borderless td, table.borderless th { border: 0 } - -table.borderless td, table.borderless th { - /* Override padding for "table.docutils td" with "! important". - The right padding separates the table cells. */ - padding: 0 0.5em 0 0 ! important } - -.first { margin-top: 0 ! important } -.last, .with-subtitle { margin-bottom: 0 ! important } -.hidden { display: none } -a.toc-backref { text-decoration: none ; color: black } -blockquote.epigraph { margin: 2em 5em ; } -dl.docutils dd { margin-bottom: 0.5em } -div.abstract { margin: 2em 5em } -div.abstract p.topic-title { font-weight: bold ; text-align: center } -div.admonition, div.attention, div.caution, div.danger, div.error, -div.hint, div.important, div.note, div.tip, div.warning { - margin: 2em ; border: medium outset ; padding: 1em } -div.admonition p.admonition-title, div.hint p.admonition-title, -div.important p.admonition-title, div.note p.admonition-title, -div.tip p.admonition-title { font-weight: bold ; font-family: sans-serif } - -div.attention p.admonition-title, div.caution p.admonition-title, -div.danger p.admonition-title, div.error p.admonition-title, -div.warning p.admonition-title { color: red ; font-weight: bold ; - font-family: sans-serif } - -/* Uncomment (and remove this text!) to get reduced vertical space in - compound paragraphs. -div.compound .compound-first, div.compound .compound-middle { - margin-bottom: 0.5em } - -div.compound .compound-last, div.compound .compound-middle { - margin-top: 0.5em } -*/ - -div.dedication { margin: 2em 5em ; text-align: center ; font-style: italic } -div.dedication p.topic-title { font-weight: bold ; font-style: normal } -div.figure { margin-left: 2em ; margin-right: 2em } -div.footer, div.header { clear: both; font-size: smaller } -div.line-block { display: block ; margin-top: 1em ; margin-bottom: 1em } -div.line-block div.line-block { margin-top: 0 ; margin-bottom: 0 ; - margin-left: 1.5em } -div.sidebar { margin-left: 1em ; border: medium outset ; - padding: 1em ; background-color: #ffffee ; width: 40% ; float: right ; - clear: right } - -div.sidebar p.rubric { font-family: sans-serif ; font-size: medium } -div.system-messages { margin: 5em } -div.system-messages h1 { color: red } -div.system-message { border: medium outset ; padding: 1em } -div.system-message p.system-message-title { color: red ; font-weight: bold } -div.topic { margin: 2em;} -h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, -h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { - margin-top: 0.4em } -h1.title { text-align: center } -h2.subtitle { text-align: center } -hr.docutils { width: 75% } -img.align-left { clear: left } -img.align-right { clear: right } -ol.simple, ul.simple { margin-bottom: 1em } -ol.arabic { list-style: decimal } -ol.loweralpha { list-style: lower-alpha } -ol.upperalpha { list-style: upper-alpha } -ol.lowerroman { list-style: lower-roman } -ol.upperroman { list-style: upper-roman } -p.attribution { text-align: right ; margin-left: 50% } -p.caption { font-style: italic } -p.credits { font-style: italic ; font-size: smaller } -p.label { white-space: nowrap } -p.rubric { font-weight:bold;font-size:larger;color:maroon;text-align:center} -p.sidebar-title {font-family: sans-serif ;font-weight: bold ;font-size: larger } -p.sidebar-subtitle {font-family: sans-serif ; font-weight: bold } -p.topic-title { font-weight: bold } -pre.address { margin-bottom: 0;margin-top:0;font-family:serif;font-size:100% } -pre.literal-block, pre.doctest-block {margin-left: 2em ;margin-right: 2em } -span.classifier {font-family: sans-serif;font-style: oblique } -span.classifier-delimiter {font-family: sans-serif;font-weight: bold } -span.interpreted {font-family: sans-serif } -span.option {white-space: nowrap } -span.pre {white-space: pre } -span.problematic {color: red } -span.section-subtitle { - /* font-size relative to parent (h1..h6 element) */ - font-size: 80% } - -table.citation { border-left: solid 1px gray; margin-left: 1px } -table.docinfo {margin: 2em 4em } -table.docutils {margin-top: 0.5em;margin-bottom: 0.5em } -table.footnote {border-left: solid 1px black;margin-left: 1px } - -table.docutils td, table.docutils th, -table.docinfo td, table.docinfo th {padding-left: 0.5em;padding-right: 0.5em; - vertical-align: top} - -table.docutils th.field-name, table.docinfo th.docinfo-name { - font-weight: bold;text-align: left;white-space: nowrap;padding-left: 0 } -h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, -h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {font-size: 100% } -ul.auto-toc { list-style-type: none } -/*a.reference { color: #E00000; font-weight:bold;} -a.reference:hover {color: #E00000;background-color: #ffff00;display: margin; - font-weight:bold;}*/ - -</style> -<script type="text/javascript"> - //<![CDATA[ - function toggleElem(id) { - var e = document.getElementById(id); - e.style.display = e.style.display == 'none' ? 'block' : 'none'; - } - - var gOpen = 'none' - function toggleAll() { - gOpen = gOpen == 'none' ? 'block' : 'none'; - var i = 1 - while (1) { - var e = document.getElementById("m"+i) - if (!e) break; - e.style.display = gOpen - i++; - } - document.getElementById('toggleButton').value = - gOpen == 'none' ? 'Show Details' : 'Hide Details'; - } - //]]> -</script> - -</head> -<body> -<div class="document" id="documentId"> -<h1 class="title">$title</h1> -$content -<small>Generated: $date $time UTC</small> -</div> -</body> -</html> -""" - diff --git a/config/old_nimrod.cfg b/config/old_nimrod.cfg deleted file mode 100644 index 250b813cf..000000000 --- a/config/old_nimrod.cfg +++ /dev/null @@ -1,165 +0,0 @@ -# Configuration file for the Nimrod Compiler. -# Generated by the koch.py script. -# (c) 2008 Andreas Rumpf - -# Feel free to edit the default values as you need. - -# You may set environment variables with -# @putenv "key" "val" -# Environment variables cannot be used in the options, however! - -# Just call the compiler with several options: -cc = @if unix: gcc @else: vcc @end -lib="$nimrod/lib" -path="$lib/base" -path="$lib/base/gtk" -path="$lib/base/cairo" -path="$lib/base/x11" -path="$lib/windows" -path="$lib/posix" -path="$lib/ecmas" -path="$lib/extra" - -@if release: - checks:off - stacktrace:off - debugger:off - line_dir:off -@end - -# additional defines: -#define="" -# additional options always passed to the compiler: -force_build -line_dir=off -cfilecache=on - -hint[LineTooLong]=off -hint[XDeclaredButNotUsed]=off - -@if unix: - passl= "-ldl" - path = "$lib/base/gtk" -@end - -@if icc: - passl = "-cxxlib" - passc = "-cxxlib" -@end - -# Configuration for the LLVM GCC compiler: -@if windows: - llvm_gcc.path = r"$nimrod\dist\llvm-gcc4.2\bin" -@end -llvm_gcc.options.debug = "-g" -llvm_gcc.options.always = "-w" -llvm_gcc.options.speed = "-O3 -ffast-math" -llvm_gcc.options.size = "-Os -ffast-math" - -# Configuration for the Borland C++ Compiler: -@if windows: - bcc.path = r"C:\eigenes\compiler\cbuilder5\bin" -@end -bcc.options.debug = "" -# turn off warnings about unreachable code and inline procs: -bcc.options.always = "-w- -H- -q -RT- -a8 -w-8027 -w-8066" -bcc.options.speed = "-O2 -6" -bcc.options.size = "-O1 -6" - -# Configuration for the Visual C/C++ compiler: -#@if vcc: -# @prepend_env path r"C:\Eigenes\compiler\vcc2005\Common7\IDE;" -# @prepend_env INCLUDE r"C:\Eigenes\compiler\vcc2005\VC\include;C:\Eigenes\compiler\vcc2005\VC\ATLMFC\INCLUDE;" -# @prepend_env LIB r"C:\Eigenes\compiler\vcc2005\VC\lib;C:\Eigenes\compiler\vcc2005\SDK\v2.0\Lib;" -#@end -#@if windows: -# vcc.path = r"C:\Eigenes\compiler\vcc2005\VC\bin" -#@end - -@if vcc: - @prepend_env path r"C:\Programme\Microsoft Visual Studio 9.0\Common7\IDE;" - @prepend_env INCLUDE r"C:\Programme\Microsoft Visual Studio 9.0\VC\include;C:\Programme\Microsoft Visual Studio 9.0\VC\ATLMFC\INCLUDE;C:\Programme\Microsoft SDKs\Windows\v6.0A\Include;" - @prepend_env LIB r"C:\Programme\Microsoft Visual Studio 9.0\VC\lib;C:\Programme\Microsoft Visual Studio 9.0\SDK\v2.0\Lib;C:\Programme\Microsoft SDKs\Windows\v6.0A\Lib;" - passl: r"/F8388608" # set the stack size to 8 MB -@end -@if windows: - vcc.path = r"C:\Programme\Microsoft Visual Studio 9.0\VC\bin" -@end -vcc.options.debug = "/RTC1 /ZI" -vcc.options.always = "/nologo" -vcc.options.speed = "/Ogityb2 /G7 /arch:SSE2" -vcc.options.size = "/O1 /G7" - -# Configuration for the Watcom C/C++ compiler: -@if windows: - wcc.path = r"C:\eigenes\compiler\watcom\binnt" -@end -wcc.options.debug = "-d2" -wcc.options.always = "-6 -zw -w-" -wcc.options.speed = "-ox -on -6 -d0 -fp6 -zW" -wcc.options.size = "-ox -on -6 -d0 -fp6 -zW" - -# Configuration for the GNU C/C++ compiler: -@if windows: - gcc.path = r"C:\eigenes\compiler\mingw\bin" -@end -gcc.options.debug = "-g" -@if macosx: - gcc.options.always = "-w -fasm-blocks" -@else: - gcc.options.always = "-w" -@end -gcc.options.speed = "-O3 -ffast-math" -gcc.options.size = "-Os -ffast-math" - -# Configuration for the Digital Mars C/C++ compiler: -@if windows: - dmc.path = r"C:\eigenes\compiler\d\dm\bin" -@end -dmc.options.debug = "-g" -dmc.options.always = "-Jm" -dmc.options.speed = "-ff -o -6" -dmc.options.size = "-ff -o -6" - -# Configuration for the LCC compiler: -@if windows: - lcc.path = r"C:\eigenes\compiler\lcc\bin" -@end -lcc.options.debug = "-g5" -lcc.options.always = "-e1" -lcc.options.speed = "-O -p6" -lcc.options.size = "-O -p6" - -# Configuration for the Tiny C Compiler: -@if windows: - tcc.path = r"C:\Eigenes\compiler\tcc-0.9.23\tcc" - tcc.options.always = r"-IC:\Eigenes\compiler\tcc-0.9.23\include " & - r"-IC:\Eigenes\compiler\tcc-0.9.23\include\winapi" -@end -tcc.options.debug = "" -tcc.options.speed = "" -tcc.options.size = "" - -# Configuration for the Pelles C compiler: -@if windows: - pcc.path = r"C:\eigenes\compiler\pellesc\bin" -@end -pcc.options.debug = "-Zi" -pcc.options.always = "-Ze" -pcc.options.speed = "-Ox" -pcc.options.size = "-Os" - -@if windows: - icc.path = r"c:\eignes\compiler\icc\bin" -@end -icc.options.debug = "-g" -icc.options.always = "-w" -icc.options.speed = "-O3 -ffast-math" -icc.options.size = "-Os -ffast-math" - -@write "used special config file" - -@if ecmascript: - @write "Target is ECMAScript! No unsafe features are allowed!" -@end - diff --git a/configure b/configure index d3fe66d92..613c79350 100644 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /usr/bin/env sh -python koch.py $@ configure +echo "there is nothing to configure" diff --git a/data/advopt.txt b/data/advopt.txt index 626a000e4..4d9dda7c2 100644 --- a/data/advopt.txt +++ b/data/advopt.txt @@ -4,21 +4,17 @@ Advanced commands:: gen_depend generate a DOT file containing the module dependency graph list_def list all defined conditionals and exit - rst2html converts a reStructuredText file to HTML check checks the project for syntax and semantic parse parses a single file (for debugging Nimrod) - scan tokenizes a single file (for debugging Nimrod) - debugtrans for debugging the transformation pass Advanced options: -w, --warnings:on|off warnings ON|OFF --warning[X]:on|off specific warning X ON|OFF --hints:on|off hints ON|OFF --hint[X]:on|off specific hint X ON|OFF - --cc:C_COMPILER set the C/C++ compiler to use --lib:PATH set the system library path -c, --compile_only compile only; do not assemble or link --no_linking compile but do not link - --gen_script generate a compile script (in the 'rod_gen' + --gen_script generate a compile script (in the 'nimcache' subdirectory named 'compile_$project$scriptext') --os:SYMBOL set the target operating system (cross-compilation) --cpu:SYMBOL set the target processor (cross-compilation) @@ -27,17 +23,13 @@ Advanced options: -l, --passl:OPTION pass an option to the linker --gen_mapping generate a mapping file containing (Nimrod, mangled) identifier pairs - --merge_output generate only one C output file --line_dir:on|off generation of #line directive ON|OFF --checkpoints:on|off turn on|off checkpoints; for debugging Nimrod --skip_cfg do not read the general configuration file --skip_proj_cfg do not read the project's configuration file --import:MODULE_FILE import the given module implicitly for each module - --maxerr:NUMBER stop compilation after NUMBER errors; broken! - --ast_cache:on|off caching of ASTs ON|OFF (default: OFF) - --c_file_cache:on|off caching of generated C files ON|OFF (default: OFF) --index:FILE use FILE to generate a documenation index file --putenv:key=value set an environment variable --list_cmd list the commands used to execute external programs - -v, --verbose show what Nimrod is doing - --version show detailed version information + --verbosity:0|1|2|3 set Nimrod's verbosity level (0 is default) + -v, --version show detailed version information diff --git a/data/ast.yml b/data/ast.yml index 72a1b02b5..6bbffae3f 100644 --- a/data/ast.yml +++ b/data/ast.yml @@ -8,61 +8,52 @@ # { -'SymFlag': [ # already 32 flags! - 'sfTypeCheck', # wether macro parameters should be type checked +'SymFlag': [ # already 26 flags! + 'sfUsed', # read access of sym (for warnings) or simply used + 'sfStar', # symbol has * visibility + 'sfMinus', # symbol has - visibility + 'sfInInterface', # symbol is in interface section declared + 'sfFromGeneric', # symbol is instantiation of a generic; this is needed + # for symbol file generation; such symbols should always + # be written into the ROD file + 'sfGlobal', # symbol is at global scope + 'sfForward', # symbol is forward directed 'sfImportc', # symbol is external; imported 'sfExportc', # symbol is exported (under a specified name) 'sfVolatile', # variable is volatile - 'sfUsed', # read access of sym (for warnings) or simply used - 'sfWrite', # write access of variable (for hints) 'sfRegister', # variable should be placed in a register 'sfPure', # object is "pure" that means it has no type-information - 'sfCodeGenerated', # wether we have already code generated for the proc - 'sfPrivate', # symbol should be made private after module compilation - 'sfGlobal', # symbol is at global scope + 'sfResult', # variable is 'result' in proc 'sfNoSideEffect', # proc has no side effects 'sfMainModule', # module is the main module 'sfSystemModule', # module is the system module 'sfNoReturn', # proc never returns (an exit proc) 'sfAddrTaken', # the variable's address is taken (ex- or implicitely) - 'sfInInterface', # symbol is in interface section declared - 'sfNoStatic', # symbol is used within an iterator (needed for codegen) - # so it cannot be 'static' in the C code - # this is called 'nostatic' in the pragma section 'sfCompilerProc', # proc is a compiler proc, that is a C proc that is # needed for the code generator - 'sfCppMethod', # proc is a C++ method + 'sfCppMethod', # proc is a C++ method (not implemented yet) 'sfDiscriminant', # field is a discriminant in a record/object 'sfDeprecated', # symbol is deprecated 'sfInClosure', # variable is accessed by a closure - 'sfIsCopy', # symbol is a copy; needed for proper name mangling - 'sfStar', # symbol has * visibility - 'sfMinus' # symbol has - visibility + 'sfTypeCheck', # wether macro parameters should be type checked + 'sfCompileTime', # proc can be evaluated at compile time + 'sfThreadVar', # variable is a thread variable + 'sfMerge', # proc can be merged with itself ], 'TypeFlag': [ - 'tfIsDistinct', # better use this flag to make it easier for accessing - # typeKind in the code generators - 'tfGeneric', # type is a generic one - 'tfExternal', # type is external - 'tfImported', # type is imported from C - 'tfInfoGenerated', # whether we have generated type information for this type - 'tfSemChecked', # used to mark types that's semantic has been checked; - # used to prevend endless loops during semantic checking - 'tfHasOutParams', # for a proc or iterator p: - # it indicates that p has out or in out parameters: this - # is used to speed up semantic checking a bit - 'tfEnumHasWholes', # enum cannot be mapped into a range 'tfVarargs', # procedure has C styled varargs - 'tfFinal' # is the object final? + 'tfFinal', # is the object final? + 'tfAcyclic', # type is acyclic (for GC optimization) + 'tfEnumHasWholes' # enum cannot be mapped into a range ], 'TypeKind': [ # order is important! # Don't forget to change hti.nim if you make a change here 'tyNone', 'tyBool', 'tyChar', - 'tyEmptySet', 'tyArrayConstr', 'tyNil', + 'tyEmpty', 'tyArrayConstr', 'tyNil', 'tyGeneric', 'tyGenericInst', # instantiated generic type 'tyGenericParam', @@ -89,7 +80,9 @@ 'nfBase2', # nfBase10 is default, so not needed 'nfBase8', 'nfBase16', - 'nfAllConst' # used to mark complex expressions constant + 'nfAllConst', # used to mark complex expressions constant + 'nfTransf', # node has been transformed + 'nfSem', # node has been checked for semantics ], 'NodeKind': [ # these are pure nodes @@ -223,6 +216,8 @@ 'nkBlockExpr', # a statement block ending in an expr; this is used # to allowe powerful multi-line templates that open a # temporary scope + 'nkStmtListType', # a statement list ending in a type; for macros + 'nkBlockType', # a statement block ending in a type; for macros 'nkVm', # indicates a virtual instruction; integer field is # used for the concrete opcode @@ -264,6 +259,8 @@ 'skEnumField', # an identifier in an enum 'skForVar', # a for loop variable 'skModule', # module identifier - 'skLabel' # a label (for block statement) + 'skLabel', # a label (for block statement) + 'skStub' # symbol is a stub and not yet loaded from the ROD + # file (it is loaded on demand, which may mean: never) ] } diff --git a/data/basicopt.txt b/data/basicopt.txt index dff49c3e8..7ff8ef136 100644 --- a/data/basicopt.txt +++ b/data/basicopt.txt @@ -1,12 +1,10 @@ Usage:: nimrod command [options] inputfile [arguments] Command:: - compile compile project with default code generator (C) - compile_to_c compile project with C code generator - compile_to_cpp compile project with C++ code generator - compile_to_ecmascript compile project to ECMAScript code (experimental) - doc generate the documentation for inputfile; - with --run switch opens it with $BROWSER + compile, c compile project with default code generator (C) + compile_to_c, cc compile project with C code generator + doc generate the documentation for inputfile + rst2html converts a reStructuredText file to HTML Arguments: arguments are passed to the program being run (if --run option is selected) Options: @@ -14,7 +12,8 @@ Options: -o, --out:FILE set the output filename -d, --define:SYMBOL define a conditional symbol -u, --undef:SYMBOL undefine a conditional symbol - -b, --force_build force rebuilding of all modules + -f, --force_build force rebuilding of all modules + --symbol_files:on|off use symbol files to speed up compilation (buggy!) --stack_trace:on|off code generation for stack trace ON|OFF --line_trace:on|off code generation for line trace ON|OFF --debugger:on|off turn Embedded Nimrod Debugger ON|OFF diff --git a/data/changes.txt b/data/changes.txt deleted file mode 100644 index a449b7a62..000000000 --- a/data/changes.txt +++ /dev/null @@ -1,22 +0,0 @@ -0.1.0 -* new config system -* new build system -* source renderer -* pas2nim integrated -* support for C++ -* local variables are always initialized -* Rod file reader and writer -* new --out, -o command line options -* fixed bug in nimconf.pas: we now have several - string token types -* changed nkIdentDef to nkIdentDefs -* added type(expr) in the parser and the grammer -* added template -* added command calls -* added case in records/objects -* added --skip_proj_cfg switch for nim.dpr -* added missing features to pasparse -* rewrote the source generator -* ``addr`` and ``cast`` are now keywords; grammar updated -* implemented ` notation; grammar updated -* specification replaced by a manual diff --git a/data/magic.yml b/data/magic.yml index 519505eab..9c03028be 100644 --- a/data/magic.yml +++ b/data/magic.yml @@ -3,16 +3,20 @@ [ 'None', 'Defined', -'New', -'NewFinalize', 'Low', 'High', 'SizeOf', -'RegisterFinalizer', +'Is', 'Succ', 'Pred', 'Inc', 'Dec', +'Ord', + +'New', +'NewFinalize', +'NewSeq', +'RegisterFinalizer', 'LengthOpenArray', 'LengthStr', 'LengthArray', @@ -20,8 +24,9 @@ 'Incl', 'Excl', 'Card', -'Ord', 'Chr', +'GCref', +'GCunref', # binary arithmetic with and without overflow checking: 'AddI', @@ -161,7 +166,6 @@ 'AppendSeqSeq', 'InRange', 'InSet', -'Is', 'Asgn', 'Repr', 'Exit', @@ -170,15 +174,34 @@ 'Assert', 'Swap', 'IsNil', +'ArrToSeq', -# magic type constructors: +# magic types: 'Array', 'OpenArray', 'Range', 'Set', 'Seq', +'Int', +'Int8', +'Int16', +'Int32', +'Int64', +'Float', +'Float32', +'Float64', +'Bool', +'Char', +'String', +'Cstring', +'Pointer', +'AnyEnum', +'EmptySet', +'IntSetBaseType', +'Nil', # magic constants: +'IsMainModule', 'CompileDate', 'CompileTime', 'NimrodVersion', diff --git a/data/messages.yml b/data/messages.yml index 8892b2c3f..a90f9e4a8 100644 --- a/data/messages.yml +++ b/data/messages.yml @@ -153,7 +153,8 @@ {'errSizeTooBig': "computing the type's size produced an overflow"}, {'errSetTooBig': 'set is too large'}, {'errBaseTypeMustBeOrdinal': 'base type of a set must be an ordinal'}, -{'errInheritanceOnlyWithNonFinalObjects': 'inheritance only works non-final objects'}, +{'errInheritanceOnlyWithNonFinalObjects': + 'inheritance only works with non-final objects'}, {'errInheritanceOnlyWithEnums': 'inheritance only works with an enum'}, {'errIllegalRecursionInTypeX': "illegal recursion in type '$1'"}, {'errCannotInstantiateX': "cannot instantiate: '$1'"}, @@ -278,16 +279,17 @@ # hints: {'hintSuccess': 'operation successful'}, +{'hintSuccessX': 'operation successful ($1 lines compiled; $2 sec total)'}, {'hintLineTooLong': 'line too long'}, {'hintXDeclaredButNotUsed': "'$1' is declared but not used"}, {'hintConvToBaseNotNeeded': 'conversion to base object is not needed'}, {'hintConvFromXtoItselfNotNeeded': 'conversion from $1 to itself is pointless'}, {'hintExprAlwaysX': "expression evaluates always to '$1'"}, -{'hintMo2FileInvalid': "mo2 file '$1' is invalid"}, -{'hintModuleHasChanged': "module '$1' has been changed"}, -{'hintCannotOpenMo2File': "mo2 file '$1' does not exist"}, {'hintQuitCalled': "quit() called"}, -{'hintProcessing': "processing"}, +{'hintProcessing': "processing $1"}, +{'hintCodeBegin': "generated code listing:"}, +{'hintCodeEnd': "end of listing"}, +{'hintConf': "used config file '$1'"}, # user hint message: {'hintUser': '$1'} diff --git a/data/readme.txt b/data/readme.txt index 9cea8806a..b72016d6e 100644 --- a/data/readme.txt +++ b/data/readme.txt @@ -1,5 +1,2 @@ -This directory contains data files in a format called YAML_. These files -are required for building Nimrod. - - -.. _YAML: http://www.yaml.org/ +This directory contains data files in Python or ordinary text format. These +files are required for building Nimrod. diff --git a/doc/filelist.txt b/doc/filelist.txt index cdb06cb9c..5d9f1125e 100644 --- a/doc/filelist.txt +++ b/doc/filelist.txt @@ -11,6 +11,7 @@ ast type definitions of the abstract syntax tree (AST) and node constructors astalgo algorithms for containers of AST nodes; converting the AST to YAML; the symbol table +passes implement the passes managemer for passes over the AST trees few algorithms for nodes; this module is less important types module for traversing type graphs; also contain several helpers for dealing with types @@ -23,19 +24,15 @@ semtypes contains the semantic checking phase for types idents implements a general mapping from identifiers to an internal representation (``PIdent``) that is used, so that a simple - pointer comparison suffices to say whether two Nimrod - identifiers are equivalent + id-comparison suffices to say whether two Nimrod identifiers + are equivalent ropes implements long strings using represented as trees for lazy evaluation; used mainly by the code generators ccgobj contains type definitions neeeded for C code generation and some helpers -ccgmangl contains the name mangler for converting Nimrod - identifiers to their C counterparts ccgutils contains helpers for the C code generator -ccgtemps contains the handling of temporary variables for the - C code generator ccgtypes the generator for C types ccgstmts the generator for statements ccgexprs the generator for expressions diff --git a/doc/grammar.txt b/doc/grammar.txt index 03f4b65b9..d8387670b 100644 --- a/doc/grammar.txt +++ b/doc/grammar.txt @@ -1,187 +1,187 @@ -module ::= ([COMMENT] [SAD] stmt)* - -optComma ::= [ ',' ] [COMMENT] [IND] -operator ::= OP0 | OR | XOR | AND | OP3 | OP4 | OP5 | IS | ISNOT | IN | NOTIN - | OP6 | DIV | MOD | SHL | SHR | OP7 | NOT - -prefixOperator ::= OP0 | OP3 | OP4 | OP5 | OP6 | OP7 | NOT - -optInd ::= [COMMENT] [IND] - - -lowestExpr ::= orExpr ( OP0 optInd orExpr )* -orExpr ::= andExpr ( OR | XOR optInd andExpr )* -andExpr ::= cmpExpr ( AND optInd cmpExpr )* -cmpExpr ::= ampExpr ( OP3 | IS | ISNOT | IN | NOTIN optInd ampExpr )* -ampExpr ::= plusExpr ( OP4 optInd plusExpr )* -plusExpr ::= mulExpr ( OP5 optInd mulExpr )* -mulExpr ::= dollarExpr ( OP6 | DIV | MOD | SHL | SHR optInd dollarExpr )* -dollarExpr ::= primary ( OP7 optInd primary )* - -namedTypeOrExpr ::= - DOTDOT [expr] - | expr [EQUALS (expr [DOTDOT expr] | typeDescK | DOTDOT [expr] ) - | DOTDOT [expr]] - | typeDescK - -castExpr ::= CAST BRACKET_LE optInd typeDesc BRACKERT_RI - PAR_LE optInd expr PAR_RI -addrExpr ::= ADDR PAR_LE optInd expr PAR_RI -symbol ::= ACC (KEYWORD | IDENT | operator | PAR_LE PAR_RI - | BRACKET_LE BRACKET_RI) ACC | IDENT -accExpr ::= KEYWORD | IDENT | operator [DOT KEYWORD | IDENT | operator] - paramList -primary ::= ( prefixOperator optInd )* ( IDENT | literal | ACC accExpr ACC - | castExpr | addrExpr ) ( - DOT optInd symbol - #| CURLY_LE namedTypeDescList CURLY_RI - | PAR_LE optInd - namedExprList - PAR_RI - | BRACKET_LE optInd - (namedTypeOrExpr optComma)* - BRACKET_RI - | CIRCUM - | pragma )* - -literal ::= INT_LIT | INT8_LIT | INT16_LIT | INT32_LIT | INT64_LIT - | FLOAT_LIT | FLOAT32_LIT | FLOAT64_LIT - | STR_LIT | RSTR_LIT | TRIPLESTR_LIT - | CHAR_LIT | RCHAR_LIT - | NIL - | BRACKET_LE optInd (expr [COLON expr] optComma )* BRACKET_RI # []-Constructor - | CURLY_LE optInd (expr [DOTDOT expr] optComma )* CURLY_RI # {}-Constructor - | PAR_LE optInd (expr [COLON expr] optComma )* PAR_RI # ()-Constructor - - -exprList ::= ( expr optComma )* - -namedExpr ::= expr [EQUALS expr] # actually this is symbol EQUALS expr|expr -namedExprList ::= ( namedExpr optComma )* - -exprOrSlice ::= expr [ DOTDOT expr ] -sliceList ::= ( exprOrSlice optComma )+ - -anonymousProc ::= LAMBDA paramList [pragma] EQUALS stmt -expr ::= lowestExpr - | anonymousProc - | IF expr COLON expr - (ELIF expr COLON expr)* - ELSE COLON expr - -namedTypeDesc ::= typeDescK | expr [EQUALS (typeDescK | expr)] -namedTypeDescList ::= ( namedTypeDesc optComma )* - -qualifiedIdent ::= symbol [ DOT symbol ] - -typeDescK ::= VAR typeDesc - | REF typeDesc - | PTR typeDesc - | TYPE expr - | TUPLE tupleDesc - | PROC paramList [pragma] - -typeDesc ::= typeDescK | primary - -optSemicolon ::= [SEMICOLON] - -macroStmt ::= COLON [stmt] (OF [sliceList] COLON stmt - | ELIF expr COLON stmt - | EXCEPT exceptList COLON stmt )* - [ELSE COLON stmt] - -simpleStmt ::= returnStmt - | yieldStmt - | discardStmt - | raiseStmt - | breakStmt - | continueStmt - | pragma - | importStmt - | fromStmt - | includeStmt - | exprStmt -complexStmt ::= ifStmt | whileStmt | caseStmt | tryStmt | forStmt - | blockStmt | asmStmt - | procDecl | iteratorDecl | macroDecl | templateDecl - | constSection | typeSection | whenStmt | varSection - -indPush ::= IND # push -stmt ::= simpleStmt [SAD] - | indPush (complexStmt | simpleStmt) - ([SAD] (complexStmt | simpleStmt) )* - DED - -exprStmt ::= lowestExpr [EQUALS expr | (expr optComma)* [macroStmt]] -returnStmt ::= RETURN [expr] -yieldStmt ::= YIELD expr -discardStmt ::= DISCARD expr -raiseStmt ::= RAISE [expr] -breakStmt ::= BREAK [symbol] -continueStmt ::= CONTINUE -ifStmt ::= IF expr COLON stmt (ELIF expr COLON stmt)* [ELSE COLON stmt] -whenStmt ::= WHEN expr COLON stmt (ELIF expr COLON stmt)* [ELSE COLON stmt] -caseStmt ::= CASE expr (OF sliceList COLON stmt)* - (ELIF expr COLON stmt)* - [ELSE COLON stmt] -whileStmt ::= WHILE expr COLON stmt -forStmt ::= FOR (symbol optComma)+ IN expr [DOTDOT expr] COLON stmt -exceptList ::= (qualifiedIdent optComma)* - -tryStmt ::= TRY COLON stmt - (EXCEPT exceptList COLON stmt)* - [FINALLY COLON stmt] -asmStmt ::= ASM [pragma] (STR_LIT | RSTR_LIT | TRIPLESTR_LIT) -blockStmt ::= BLOCK [symbol] COLON stmt -importStmt ::= IMPORT ((symbol | STR_LIT | RSTR_LIT | TRIPLESTR_LIT) [AS symbol] optComma)+ -includeStmt ::= INCLUDE ((symbol | STR_LIT | RSTR_LIT | TRIPLESTR_LIT) optComma)+ -fromStmt ::= FROM (symbol | STR_LIT | RSTR_LIT | TRIPLESTR_LIT) IMPORT (symbol optComma)+ - -pragma ::= CURLYDOT_LE (expr [COLON expr] optComma)+ (CURLYDOT_RI | CURLY_RI) - -paramList ::= [PAR_LE ((symbol optComma)+ COLON typeDesc optComma)* PAR_RI] [COLON typeDesc] - -genericParams ::= BRACKET_LE (symbol [EQUALS typeDesc] )* BRACKET_RI - -procDecl ::= PROC symbol ["*"] [genericParams] - paramList [pragma] - [EQUALS stmt] -macroDecl ::= MACRO symbol ["*"] [genericParams] paramList [pragma] - [EQUALS stmt] -iteratorDecl ::= ITERATOR symbol ["*"] [genericParams] paramList [pragma] - [EQUALS stmt] -templateDecl ::= TEMPLATE symbol ["*"] [genericParams] paramList [pragma] - [EQUALS stmt] - -colonAndEquals ::= [COLON typeDesc] EQUALS expr - -constDecl ::= symbol ["*"] [pragma] colonAndEquals [COMMENT | IND COMMENT] - | COMMENT -constSection ::= CONST indPush constDecl (SAD constDecl)* DED -typeDef ::= typeDesc | objectDef | enumDef - -objectIdentPart ::= - (symbol ["*" | "-"] [pragma] optComma)+ COLON typeDesc [COMMENT | IND COMMENT] - -objectWhen ::= WHEN expr COLON [COMMENT] objectPart - (ELIF expr COLON [COMMENT] objectPart)* - [ELSE COLON [COMMENT] objectPart] -objectCase ::= CASE expr COLON typeDesc [COMMENT] - (OF sliceList COLON [COMMENT] objectPart)* - [ELSE COLON [COMMENT] objectPart] - -objectPart ::= objectWhen | objectCase | objectIdentPart - | indPush objectPart (SAD objectPart)* DED -tupleDesc ::= BRACKET_LE optInd ((symbol optComma)+ COLON typeDesc optComma)* BRACKET_RI - -objectDef ::= OBJECT [pragma] [OF typeDesc] objectPart -enumDef ::= ENUM [OF typeDesc] (symbol [EQUALS expr] optComma [COMMENT | IND COMMENT])+ - -typeDecl ::= COMMENT - | symbol ["*"] [genericParams] [EQUALS typeDef] [COMMENT | IND COMMENT] - -typeSection ::= TYPE indPush typeDecl (SAD typeDecl)* DED - -colonOrEquals ::= COLON typeDesc [EQUALS expr] | EQUALS expr -varPart ::= (symbol ["*" | "-"] [pragma] optComma)+ colonOrEquals [COMMENT | IND COMMENT] -varSection ::= VAR (varPart | indPush (COMMENT|varPart) (SAD (COMMENT|varPart))* DED) +module ::= ([COMMENT] [SAD] stmt)* + +optComma ::= [ ',' ] [COMMENT] [IND] +operator ::= OP0 | OR | XOR | AND | OP3 | OP4 | OP5 | IS | ISNOT | IN | NOTIN + | OP6 | DIV | MOD | SHL | SHR | OP7 | NOT + +prefixOperator ::= OP0 | OP3 | OP4 | OP5 | OP6 | OP7 | NOT + +optInd ::= [COMMENT] [IND] + + +lowestExpr ::= orExpr ( OP0 optInd orExpr )* +orExpr ::= andExpr ( OR | XOR optInd andExpr )* +andExpr ::= cmpExpr ( AND optInd cmpExpr )* +cmpExpr ::= ampExpr ( OP3 | IS | ISNOT | IN | NOTIN optInd ampExpr )* +ampExpr ::= plusExpr ( OP4 optInd plusExpr )* +plusExpr ::= mulExpr ( OP5 optInd mulExpr )* +mulExpr ::= dollarExpr ( OP6 | DIV | MOD | SHL | SHR optInd dollarExpr )* +dollarExpr ::= primary ( OP7 optInd primary )* + +namedTypeOrExpr ::= + DOTDOT [expr] + | expr [EQUALS (expr [DOTDOT expr] | typeDescK | DOTDOT [expr] ) + | DOTDOT [expr]] + | typeDescK + +castExpr ::= CAST BRACKET_LE optInd typeDesc BRACKERT_RI + PAR_LE optInd expr PAR_RI +addrExpr ::= ADDR PAR_LE optInd expr PAR_RI +symbol ::= ACC (KEYWORD | IDENT | operator | PAR_LE PAR_RI + | BRACKET_LE BRACKET_RI | EQUALS | literal )+ ACC + | IDENT +primary ::= ( prefixOperator optInd )* ( symbol | constructor | + | castExpr | addrExpr ) ( + DOT optInd symbol + #| CURLY_LE namedTypeDescList CURLY_RI + | PAR_LE optInd + namedExprList + PAR_RI + | BRACKET_LE optInd + (namedTypeOrExpr optComma)* + BRACKET_RI + | CIRCUM + | pragma )* + +literal ::= INT_LIT | INT8_LIT | INT16_LIT | INT32_LIT | INT64_LIT + | FLOAT_LIT | FLOAT32_LIT | FLOAT64_LIT + | STR_LIT | RSTR_LIT | TRIPLESTR_LIT + | CHAR_LIT | RCHAR_LIT + | NIL + +constructor ::= literal + | BRACKET_LE optInd (expr [COLON expr] optComma )* BRACKET_RI # []-Constructor + | CURLY_LE optInd (expr [DOTDOT expr] optComma )* CURLY_RI # {}-Constructor + | PAR_LE optInd (expr [COLON expr] optComma )* PAR_RI # ()-Constructor + +exprList ::= ( expr optComma )* + +namedExpr ::= expr [EQUALS expr] # actually this is symbol EQUALS expr|expr +namedExprList ::= ( namedExpr optComma )* + +exprOrSlice ::= expr [ DOTDOT expr ] +sliceList ::= ( exprOrSlice optComma )+ + +anonymousProc ::= LAMBDA paramList [pragma] EQUALS stmt +expr ::= lowestExpr + | anonymousProc + | IF expr COLON expr + (ELIF expr COLON expr)* + ELSE COLON expr + +namedTypeDesc ::= typeDescK | expr [EQUALS (typeDescK | expr)] +namedTypeDescList ::= ( namedTypeDesc optComma )* + +qualifiedIdent ::= symbol [ DOT symbol ] + +typeDescK ::= VAR typeDesc + | REF typeDesc + | PTR typeDesc + | TYPE expr + | TUPLE tupleDesc + | PROC paramList [pragma] + +typeDesc ::= typeDescK | primary + +optSemicolon ::= [SEMICOLON] + +macroStmt ::= COLON [stmt] (OF [sliceList] COLON stmt + | ELIF expr COLON stmt + | EXCEPT exceptList COLON stmt )* + [ELSE COLON stmt] + +simpleStmt ::= returnStmt + | yieldStmt + | discardStmt + | raiseStmt + | breakStmt + | continueStmt + | pragma + | importStmt + | fromStmt + | includeStmt + | exprStmt +complexStmt ::= ifStmt | whileStmt | caseStmt | tryStmt | forStmt + | blockStmt | asmStmt + | procDecl | iteratorDecl | macroDecl | templateDecl + | constSection | typeSection | whenStmt | varSection + +indPush ::= IND # push +stmt ::= simpleStmt [SAD] + | indPush (complexStmt | simpleStmt) + ([SAD] (complexStmt | simpleStmt) )* + DED + +exprStmt ::= lowestExpr [EQUALS expr | (expr optComma)* [macroStmt]] +returnStmt ::= RETURN [expr] +yieldStmt ::= YIELD expr +discardStmt ::= DISCARD expr +raiseStmt ::= RAISE [expr] +breakStmt ::= BREAK [symbol] +continueStmt ::= CONTINUE +ifStmt ::= IF expr COLON stmt (ELIF expr COLON stmt)* [ELSE COLON stmt] +whenStmt ::= WHEN expr COLON stmt (ELIF expr COLON stmt)* [ELSE COLON stmt] +caseStmt ::= CASE expr (OF sliceList COLON stmt)* + (ELIF expr COLON stmt)* + [ELSE COLON stmt] +whileStmt ::= WHILE expr COLON stmt +forStmt ::= FOR (symbol optComma)+ IN expr [DOTDOT expr] COLON stmt +exceptList ::= (qualifiedIdent optComma)* + +tryStmt ::= TRY COLON stmt + (EXCEPT exceptList COLON stmt)* + [FINALLY COLON stmt] +asmStmt ::= ASM [pragma] (STR_LIT | RSTR_LIT | TRIPLESTR_LIT) +blockStmt ::= BLOCK [symbol] COLON stmt +importStmt ::= IMPORT ((symbol | STR_LIT | RSTR_LIT | TRIPLESTR_LIT) [AS symbol] optComma)+ +includeStmt ::= INCLUDE ((symbol | STR_LIT | RSTR_LIT | TRIPLESTR_LIT) optComma)+ +fromStmt ::= FROM (symbol | STR_LIT | RSTR_LIT | TRIPLESTR_LIT) IMPORT (symbol optComma)+ + +pragma ::= CURLYDOT_LE (expr [COLON expr] optComma)+ (CURLYDOT_RI | CURLY_RI) + +paramList ::= [PAR_LE ((symbol optComma)+ COLON typeDesc optComma)* PAR_RI] [COLON typeDesc] + +genericParams ::= BRACKET_LE (symbol [EQUALS typeDesc] )* BRACKET_RI + +procDecl ::= PROC symbol ["*"] [genericParams] + paramList [pragma] + [EQUALS stmt] +macroDecl ::= MACRO symbol ["*"] [genericParams] paramList [pragma] + [EQUALS stmt] +iteratorDecl ::= ITERATOR symbol ["*"] [genericParams] paramList [pragma] + [EQUALS stmt] +templateDecl ::= TEMPLATE symbol ["*"] [genericParams] paramList [pragma] + [EQUALS stmt] + +colonAndEquals ::= [COLON typeDesc] EQUALS expr + +constDecl ::= symbol ["*"] [pragma] colonAndEquals [COMMENT | IND COMMENT] + | COMMENT +constSection ::= CONST indPush constDecl (SAD constDecl)* DED +typeDef ::= typeDesc | objectDef | enumDef + +objectIdentPart ::= + (symbol ["*" | "-"] [pragma] optComma)+ COLON typeDesc [COMMENT | IND COMMENT] + +objectWhen ::= WHEN expr COLON [COMMENT] objectPart + (ELIF expr COLON [COMMENT] objectPart)* + [ELSE COLON [COMMENT] objectPart] +objectCase ::= CASE expr COLON typeDesc [COMMENT] + (OF sliceList COLON [COMMENT] objectPart)* + [ELSE COLON [COMMENT] objectPart] + +objectPart ::= objectWhen | objectCase | objectIdentPart | NIL + | indPush objectPart (SAD objectPart)* DED +tupleDesc ::= BRACKET_LE optInd ((symbol optComma)+ COLON typeDesc optComma)* BRACKET_RI + +objectDef ::= OBJECT [pragma] [OF typeDesc] objectPart +enumDef ::= ENUM [OF typeDesc] (symbol [EQUALS expr] optComma [COMMENT | IND COMMENT])+ + +typeDecl ::= COMMENT + | symbol ["*"] [genericParams] [EQUALS typeDef] [COMMENT | IND COMMENT] + +typeSection ::= TYPE indPush typeDecl (SAD typeDecl)* DED + +colonOrEquals ::= COLON typeDesc [EQUALS expr] | EQUALS expr +varPart ::= (symbol ["*" | "-"] [pragma] optComma)+ colonOrEquals [COMMENT | IND COMMENT] +varSection ::= VAR (varPart | indPush (COMMENT|varPart) (SAD (COMMENT|varPart))* DED) diff --git a/doc/intern.txt b/doc/intern.txt index 382eea947..4d65c1e55 100644 --- a/doc/intern.txt +++ b/doc/intern.txt @@ -32,7 +32,7 @@ Path Purpose ``config`` configuration files for Nimrod go into here ``lib`` the Nimrod library lives here; ``rod`` depends on it! -``web`` website of Nimrod; generated by ``genweb.py`` +``web`` website of Nimrod; generated by ``koch.py`` from the ``*.txt`` and ``*.tmpl`` files ``koch`` the Koch Build System (written for Nimrod) ``obj`` generated ``*.obj`` files go into here @@ -49,20 +49,19 @@ and Free Pascal can compile the Nimrod compiler. Requirements for bootstrapping: -- Free Pascal (I used version 2.2); it may not be needed -- Python (should work with 2.4 or higher) and the code generator *cog* - (included in this distribution!) +- Free Pascal (I used version 2.2) [optional] +- Python (should work with version 1.5 or higher) - C compiler -- one of: - * win32-lcc - * Borland C++ (tested with 5.5) + * win32-lcc (currently broken) + * Borland C++ (tested with 5.5; currently broken) * Microsoft C++ * Digital Mars C++ - * Watcom C++ (currently broken; a fix is welcome!) + * Watcom C++ (currently broken) * GCC * Intel C++ - * Pelles C + * Pelles C (currently broken) * llvm-gcc | Compiling the compiler is a simple matter of running: @@ -75,7 +74,7 @@ If you want to debug the compiler, use the command:: The ``koch.py`` script is Nimrod's maintainance script: Everything that has been automated is accessible with it. It is a replacement for make and shell -scripting with the advantage that it is more portable and is easier to read. +scripting with the advantage that it is more portable. Coding standards @@ -124,7 +123,7 @@ Complex assignments We already knew the type information as a graph in the compiler. Thus we need to serialize this graph as RTTI for C code generation. -Look at the files ``lib/typeinfo.nim``, ``lib/hti.nim`` for more information. +Look at the file ``lib/hti.nim`` for more information. The Garbage Collector @@ -135,18 +134,11 @@ Introduction We use the term *cell* here to refer to everything that is traced (sequences, refs, strings). -This section describes how the new GC works. The old algorithms -all had the same problem: Too complex to get them right. This one -tries to find the right compromise. +This section describes how the new GC works. The basic algorithm is *Deferrent reference counting* with cycle detection. References in the stack are not counted for better performance and easier C -code generation. The GC starts by traversing the hardware stack and increments -the reference count (RC) of every cell that it encounters. After the GC has -done its work the stack is traversed again and the RC of every cell -that it encounters are decremented again. Thus no marking bits in the RC are -needed. Between these stack traversals the GC has a complete accurate view over -the RCs. +code generation. Each cell has a header consisting of a RC and a pointer to its type descriptor. However the program does not know about these, so they are placed at @@ -156,72 +148,44 @@ is extremely important that ``pointer`` is not confused with a ``PCell`` as this would lead to a memory corruption. -When to trigger a collection ----------------------------- - -Since there are really two different garbage collectors (reference counting -and mark and sweep) we use two different heuristics when to run the passes. -The RC-GC pass is fairly cheap: Thus we use an additive increase (7 pages) -for the RC_Threshold and a multiple increase for the CycleThreshold. - - -The AT and ZCT sets -------------------- - -The GC maintains two sets throughout the lifetime of -the program (plus two temporary ones). The AT (*any table*) simply contains -every cell. The ZCT (*zero count table*) contains every cell whose RC is -zero. This is used to reclaim most cells fast. - -The ZCT contains redundant information -- the AT alone would suffice. -However, traversing the AT and look if the RC is zero would touch every living -cell in the heap! That's why the ZCT is updated whenever a RC drops to zero. -The ZCT is not updated when a RC is incremented from zero to one, as -this would be too costly. - - The CellSet data structure -------------------------- -The AT and ZCT depend on an extremely efficient datastructure for storing a -set of pointers - this is called a ``PCellSet`` in the source code. +The GC depends on an extremely efficient datastructure for storing a +set of pointers - this is called a ``TCellSet`` in the source code. Inserting, deleting and searching are done in constant time. However, -modifying a ``PCellSet`` during traversation leads to undefined behaviour. +modifying a ``TCellSet`` during traversation leads to undefined behaviour. .. code-block:: Nimrod type - PCellSet # hidden + TCellSet # hidden - proc allocCellSet: PCellSet # make a new set - proc deallocCellSet(s: PCellSet) # empty the set and free its memory - proc incl(s: PCellSet, elem: PCell) # include an element - proc excl(s: PCellSet, elem: PCell) # exclude an element + proc CellSetInit(s: var TCellSet) # initialize a new set + proc CellSetDeinit(s: var TCellSet) # empty the set and free its memory + proc incl(s: var TCellSet, elem: PCell) # include an element + proc excl(s: var TCellSet, elem: PCell) # exclude an element - proc `in`(elem: PCell, s: PCellSet): bool + proc `in`(elem: PCell, s: TCellSet): bool # tests membership - iterator elements(s: PCellSet): (elem: PCell) + iterator elements(s: TCellSet): (elem: PCell) -All the operations have to be performed efficiently. Because a Cellset can -become huge (the AT contains every allocated cell!) a hash table is not -suitable for this. +All the operations have to be perform efficiently. Because a Cellset can +become huge a hash table alone is not suitable for this. -We use a mixture of bitset and patricia tree for this. One node in the -patricia tree contains a bitset that decribes a page of the operating system -(not always, but that doesn't matter). -So including a cell is done as follows: +We use a mixture of bitset and hash table for this. The hash table maps *pages* +to a page descriptor. The page descriptor contains a bit for any possible cell +address within this page. So including a cell is done as follows: - Find the page descriptor for the page the cell belongs to. - Set the appropriate bit in the page descriptor indicating that the cell points to the start of a memory block. Removing a cell is analogous - the bit has to be set to zero. -Single page descriptors are never deleted from the tree. Typically a page -descriptor is only 19 words big, so it does not waste much by not deleting -it. Apart from that the AT and ZCT are rebuilt frequently, so removing a -single page descriptor from the tree is never necessary. +Single page descriptors are never deleted from the hash table. This is not +needed as the data structures need to be periodically rebuilt anyway. -Complete traversal is done like so:: +Complete traversal is done in this way:: for each page decriptor d: for each bit in d: @@ -265,103 +229,12 @@ roughly like this: Note that for systems with a continous stack (which most systems have) the check whether the ref is on the stack is very cheap (only two comparisons). Another advantage of this scheme is that the code produced is -a tiny bit smaller. +smaller. The algorithm in pseudo-code ---------------------------- -Now we come to the nitty-gritty. The algorithm works in several phases. - -Phase 1 - Consider references from stack -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -:: - - for each pointer p in the stack: incRef(p) - -This is necessary because references in the hardware stack are not traced for -better performance. After Phase 1 the RCs are accurate. - - -Phase 2 - Free the ZCT -~~~~~~~~~~~~~~~~~~~~~~ -This is how things used to (not) work:: - - for p in elements(ZCT): - if RC(p) == 0: - call finalizer of p - for c in children(p): decRef(c) # free its children recursively - # if necessary; the childrens RC >= 1, BUT they may still be in the ZCT! - free(p) - else: - remove p from the ZCT - -Instead we do it this way. Note that the recursion is gone too! -:: - - newZCT = nil - for p in elements(ZCT): - if RC(p) == 0: - call finalizer of p - for c in children(p): - assert(RC(c) > 0) - dec(RC(c)) - if RC(c) == 0: - if newZCT == nil: newZCT = allocCellSet() - incl(newZCT, c) - free(p) - else: - # nothing to do! We will use the newZCS - - deallocCellSet(ZCT) - ZCT = newZCT - -This phase is repeated until enough memory is available or the ZCT is nil. -If still not enough memory is available the cyclic detector gets its chance -to do something. - - -Phase 3 - Cycle detection -~~~~~~~~~~~~~~~~~~~~~~~~~ -Cycle detection works by subtracting internal reference counts:: - - newAT = allocCellSet() - - for y in elements(AT): - # pretend that y is dead: - for c in children(y): - dec(RC(c)) - # note that this should not be done recursively as we have all needed - # pointers in the AT! This makes it more efficient too! - - proc restore(y: PCell) = - # unfortunately, the recursion here cannot be eliminated easily - if y not_in newAT: - incl(newAT, y) - for c in children(y): - inc(RC(c)) # restore proper reference counts! - restore(c) - - for y in elements(AT) with rc > 0: - restore(y) - - for y in elements(AT) with rc == 0: - free(y) # if pretending worked, it was part of a cycle - - AT = newAT - - -Phase 4 - Ignore references from stack again -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -:: - - for each pointer p in the stack: - dec(RC(p)) - if RC(p) == 0: incl(ZCT, p) - -Now the RCs correctly discard any references from the stack. One can also see -this as a temporary marking operation. Things that are referenced from stack -are marked during the GC's operarion and now have to be unmarked. - +To be written. The compiler's architecture diff --git a/doc/lib.txt b/doc/lib.txt index 2fef5934d..ccd97aa6e 100644 --- a/doc/lib.txt +++ b/doc/lib.txt @@ -1,131 +1,216 @@ -======================= -Nimrod Standard Library -======================= - -:Author: Andreas Rumpf -:Version: |nimrodversion| - -Though the Nimrod Standard Library is still evolving, it is already quite -usable. It is divided into basic libraries that contains modules that virtually -every program will need and advanced libraries which are more heavy weight. -Advanced libraries are in the ``lib/base`` directory. - -Basic libraries -=============== - -* `system <system.html>`_ - Basic procs and operators that every program needs. It also provides IO - facilities for reading and writing text and binary files. It is imported - implicitly by the compiler. Do not import it directly. It relies on compiler - magic to work. - -* `strutils <strutils.html>`_ - This module contains common string handling operations like converting a - string into uppercase, splitting a string into substrings, searching for - substrings, replacing substrings. - -* `os <os.html>`_ - Basic operating system facilities like retrieving environment variables, - reading command line arguments, working with directories, running shell - commands, etc. This module is -- like any other basic library -- - platform independant. - -* `math <math.html>`_ - Mathematical operations like cosine, square root. - -* `complex <complex.html>`_ - This module implements complex numbers and their mathematical operations. - -* `times <times.html>`_ - The ``times`` module contains basic support for working with time. - -* `parseopt <parseopt.html>`_ - The ``parseopt`` module implements a command line option parser. This - supports long and short command options with optional values and command line - arguments. - -* `parsecfg <parsecfg.html>`_ - The ``parsecfg`` module implements a high performance configuration file - parser. The configuration file's syntax is similar to the Windows ``.ini`` - format, but much more powerful, as it is not a line based parser. String - literals, raw string literals and triple quote string literals are supported - as in the Nimrod programming language. - -* `strtabs <strtabs.html>`_ - The ``strtabs`` module implements an efficient hash table that is a mapping - from strings to strings. Supports a case-sensitive, case-insensitive and - style-insensitive mode. An efficient string substitution operator ``%`` - for the string table is also provided. - -* `hashes <hashes.html>`_ - This module implements efficient computations of hash values for diverse - Nimrod types. - -* `lexbase <lexbase.html>`_ - This is a low leve module that implements an extremely efficent buffering - scheme for lexers and parsers. This is used by the ``parsecfg`` module. - - -Advanced libaries -================= - -* `regexprs <regexprs.html>`_ - This module contains procedures and operators for handling regular - expressions. - -* `dialogs <dialogs.html>`_ - This module implements portable dialogs for Nimrod; the implementation - builds on the GTK interface. On Windows, native dialogs are shown if - appropriate. - - -Wrappers -======== - -Note that the generated HTML for some of these wrappers is so huge, that it is -not contained in the distribution. You can then find them on the website. - -* `posix <posix.html>`_ - Contains a wrapper for the POSIX standard. -* `windows <windows.html>`_ - Contains a wrapper for the Win32 API. -* `shellapi <shellapi.html>`_ - Contains a wrapper for the ``shellapi.h`` header. -* `shfolder <shfolder.html>`_ - Contains a wrapper for the ``shfolder.h`` header. -* `mmsystem <mmsystem.html>`_ - Contains a wrapper for the ``mmsystem.h`` header. -* `ole2 <ole2.html>`_ - Contains GUIDs for OLE2 automation support. -* `nb30 <nb30.html>`_ - This module contains the definitions for portable NetBIOS 3.0 support. -* `cairo <cairo.html>`_ - Wrapper for the cairo library. -* `cairoft <cairoft.html>`_ - Wrapper for the cairoft library. -* `cairowin32 <cairowin32.html>`_ - Wrapper for the cairowin32 library. -* `cairoxlib <cairoxlib.html>`_ - Wrapper for the cairoxlib library. -* `atk <atk.html>`_ - Wrapper for the atk library. -* `gdk2 <gdk2.html>`_ - Wrapper for the gdk2 library. -* `gdk2pixbuf <gdk2pixbuf.html>`_ - Wrapper for the gdk2pixbuf library. -* `gdkglext <gdkglext.html>`_ - Wrapper for the gdkglext library. -* `glib2 <glib2.html>`_ - Wrapper for the glib2 library. -* `gtk2 <gtk2.html>`_ - Wrapper for the gtk2 library. -* `gtkglext <gtkglext.html>`_ - Wrapper for the gtkglext library. -* `gtkhtml <gtkhtml.html>`_ - Wrapper for the gtkhtml library. -* `libglade2 <libglade2.html>`_ - Wrapper for the libglade2 library. -* `pango <pango.html>`_ - Wrapper for the pango library. -* `pangoutils <pangoutils.html>`_ - Wrapper for the pangoutils library. +======================= +Nimrod Standard Library +======================= + +:Author: Andreas Rumpf +:Version: |nimrodversion| + +Though the Nimrod Standard Library is still evolving, it is already quite +usable. It is divided into basic libraries that contains modules that virtually +every program will need and advanced libraries which are more heavy weight. +Advanced libraries are in the ``lib/base`` directory. + +Basic libraries +=============== + +* `system <system.html>`_ + Basic procs and operators that every program needs. It also provides IO + facilities for reading and writing text and binary files. It is imported + implicitly by the compiler. Do not import it directly. It relies on compiler + magic to work. + +* `strutils <strutils.html>`_ + This module contains common string handling operations like converting a + string into uppercase, splitting a string into substrings, searching for + substrings, replacing substrings. + +* `os <os.html>`_ + Basic operating system facilities like retrieving environment variables, + reading command line arguments, working with directories, running shell + commands, etc. This module is -- like any other basic library -- + platform independant. + +* `math <math.html>`_ + Mathematical operations like cosine, square root. + +* `complex <complex.html>`_ + This module implements complex numbers and their mathematical operations. + +* `times <times.html>`_ + The ``times`` module contains basic support for working with time. + +* `parseopt <parseopt.html>`_ + The ``parseopt`` module implements a command line option parser. This + supports long and short command options with optional values and command line + arguments. + +* `parsecfg <parsecfg.html>`_ + The ``parsecfg`` module implements a high performance configuration file + parser. The configuration file's syntax is similar to the Windows ``.ini`` + format, but much more powerful, as it is not a line based parser. String + literals, raw string literals and triple quote string literals are supported + as in the Nimrod programming language. + +* `strtabs <strtabs.html>`_ + The ``strtabs`` module implements an efficient hash table that is a mapping + from strings to strings. Supports a case-sensitive, case-insensitive and + style-insensitive mode. An efficient string substitution operator ``%`` + for the string table is also provided. + +* `streams <streams.html>`_ + This module provides a stream interface and two implementations thereof: + the `PFileStream` and the `PStringStream` which implement the stream + interface for Nimrod file objects (`TFile`) and strings. Other modules + may provide other implementations for this standard stream interface. + +* `hashes <hashes.html>`_ + This module implements efficient computations of hash values for diverse + Nimrod types. + +* `lexbase <lexbase.html>`_ + This is a low level module that implements an extremely efficent buffering + scheme for lexers and parsers. This is used by the ``parsecfg`` module. + + +Advanced libaries +================= + +* `regexprs <regexprs.html>`_ + This module contains procedures and operators for handling regular + expressions. + +* `dialogs <dialogs.html>`_ + This module implements portable dialogs for Nimrod; the implementation + builds on the GTK interface. On Windows, native dialogs are shown if + appropriate. + +* `zipfiles <zipfiles.html>`_ + This module implements a zip archive creator/reader/modifier. + +Wrappers +======== + +Note that the generated HTML for some of these wrappers is so huge, that it is +not contained in the distribution. You can then find them on the website. + +* `posix <posix.html>`_ + Contains a wrapper for the POSIX standard. +* `windows <windows.html>`_ + Contains a wrapper for the Win32 API. +* `shellapi <shellapi.html>`_ + Contains a wrapper for the ``shellapi.h`` header. +* `shfolder <shfolder.html>`_ + Contains a wrapper for the ``shfolder.h`` header. +* `mmsystem <mmsystem.html>`_ + Contains a wrapper for the ``mmsystem.h`` header. +* `ole2 <ole2.html>`_ + Contains GUIDs for OLE2 automation support. +* `nb30 <nb30.html>`_ + This module contains the definitions for portable NetBIOS 3.0 support. +* `cairo <cairo.html>`_ + Wrapper for the cairo library. +* `cairoft <cairoft.html>`_ + Wrapper for the cairoft library. +* `cairowin32 <cairowin32.html>`_ + Wrapper for the cairowin32 library. +* `cairoxlib <cairoxlib.html>`_ + Wrapper for the cairoxlib library. +* `atk <atk.html>`_ + Wrapper for the atk library. +* `gdk2 <gdk2.html>`_ + Wrapper for the gdk2 library. +* `gdk2pixbuf <gdk2pixbuf.html>`_ + Wrapper for the gdk2pixbuf library. +* `gdkglext <gdkglext.html>`_ + Wrapper for the gdkglext library. +* `glib2 <glib2.html>`_ + Wrapper for the glib2 library. +* `gtk2 <gtk2.html>`_ + Wrapper for the gtk2 library. +* `gtkglext <gtkglext.html>`_ + Wrapper for the gtkglext library. +* `gtkhtml <gtkhtml.html>`_ + Wrapper for the gtkhtml library. +* `libglade2 <libglade2.html>`_ + Wrapper for the libglade2 library. +* `pango <pango.html>`_ + Wrapper for the pango library. +* `pangoutils <pangoutils.html>`_ + Wrapper for the pangoutils library. +* `gl <gl.html>`_ + Part of the wrapper for OpenGL. +* `glext <glext.html>`_ + Part of the wrapper for OpenGL. +* `glu <glu.html>`_ + Part of the wrapper for OpenGL. +* `glut <glut.html>`_ + Part of the wrapper for OpenGL. +* `glx <glx.html>`_ + Part of the wrapper for OpenGL. +* `wingl <wingl.html>`_ + Part of the wrapper for OpenGL. +* `lua <lua.html>`_ + Part of the wrapper for Lua. +* `lualib <lualib.html>`_ + Part of the wrapper for Lua. +* `lauxlib <lauxlib.html>`_ + Part of the wrapper for Lua. +* `odbcsql <odbcsql.nim>`_ + interface to the ODBC driver. +* `zlib <zlib.nim>`_ + Wrapper for the zlib library. +* `sdl <sdl.html>`_ + Part of the wrapper for SDL. +* `sdl_gfx <sdl_gfx.html>`_ + Part of the wrapper for SDL. +* `sdl_image <sdl_image.html>`_ + Part of the wrapper for SDL. +* `sdl_mixer <sdl_mixer.html>`_ + Part of the wrapper for SDL. +* `sdl_net <sdl_net.html>`_ + Part of the wrapper for SDL. +* `sdl_ttf <sdl_ttf.html>`_ + Part of the wrapper for SDL. +* `smpeg <smpeg.html>`_ + Part of the wrapper for SDL. +* `cursorfont <cursorfont.html>`_ + Part of the wrapper for X11. +* `keysym <keysym.html>`_ + Part of the wrapper for X11. +* `x <x.html>`_ + Part of the wrapper for X11. +* `xatom <xatom.html>`_ + Part of the wrapper for X11. +* `xcms <xcms.html>`_ + Part of the wrapper for X11. +* `xf86dga <xf86dga.html>`_ + Part of the wrapper for X11. +* `xf86vmode <xf86vmode.html>`_ + Part of the wrapper for X11. +* `xi <xi.html>`_ + Part of the wrapper for X11. +* `xinerama <xinerama.html>`_ + Part of the wrapper for X11. +* `xkb <xkb.html>`_ + Part of the wrapper for X11. +* `xkblib <xkblib.html>`_ + Part of the wrapper for X11. +* `xlib <xlib.html>`_ + Part of the wrapper for X11. +* `xrandr <xrandr.html>`_ + Part of the wrapper for X11. +* `xrender <xrender.html>`_ + Part of the wrapper for X11. +* `xresource <xresource.html>`_ + Part of the wrapper for X11. +* `xshm <xshm.html>`_ + Part of the wrapper for X11. +* `xutil <xutil.html>`_ + Part of the wrapper for X11. +* `xv <xv.html>`_ + Part of the wrapper for X11. +* `xvlib <xvlib.html>`_ + Part of the wrapper for X11. +* `libzip <libzip.html>`_ + Interface to the `lib zip <http://www.nih.at/libzip/index.html>`_ library by + Dieter Baron and Thomas Klausner. diff --git a/doc/manual.txt b/doc/manual.txt index babd96813..1c8faf4ac 100644 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -160,8 +160,8 @@ case-sensitive and even underscores are ignored: this is that this allows programmers to use their own prefered spelling style and libraries written by different programmers cannot use incompatible conventions. The editors or IDE can show the identifiers as preferred. Another -advantage is that it frees the programmer from remembering the spelling of an -identifier. +advantage is that it frees the programmer from remembering the exact spelling +of an identifier. Literal strings @@ -601,20 +601,20 @@ Array and sequence types has the same type. Arrays always have a fixed length which is specified at compile time (except for open arrays). They can be indexed by any ordinal type. A parameter ``A`` may be an *open array*, in which case it is indexed by -integers from 0 to ``len(A)-1``. +integers from 0 to ``len(A)-1``. An array expression may be constructed by the +array constructor ``[]``. `Sequences`:idx: are similar to arrays but of dynamic length which may change during runtime (like strings). A sequence ``S`` is always indexed by integers -from 0 to ``len(S)-1`` and its bounds are checked. Sequences can also be -constructed by the array constructor ``[]``. +from 0 to ``len(S)-1`` and its bounds are checked. Sequences can be +constructed by the array constructor ``[]`` in conjunction with the array to +sequence operator ``@``. Another way to allocate space for a sequence is to +call the built-in ``newSeq`` procedure. A sequence may be passed to a parameter that is of type *open array*, but not to a multi-dimensional open array, because it is impossible to do so in an efficient manner. -An array expression may be constructed by the array constructor ``[]``. -A constructed array is assignment compatible to a sequence. - Example: .. code-block:: nimrod @@ -625,13 +625,13 @@ Example: var x: TIntArray y: TIntSeq - x = [1, 2, 3, 4, 5, 6] # [] this is the array constructor that is compatible - # with arrays, open arrays and - y = [1, 2, 3, 4, 5, 6] # sequences + x = [1, 2, 3, 4, 5, 6] # [] this is the array constructor + y = @[1, 2, 3, 4, 5, 6] # the @ turns the array into a sequence -The lower bound of an array may be received by the built-in proc +The lower bound of an array or sequence may be received by the built-in proc ``low()``, the higher bound by ``high()``. The length may be -received by ``len()``. +received by ``len()``. ``low()`` for a sequence or an open array always returns +0, as this is the first valid index. Arrays are always bounds checked (at compile-time or at runtime). These checks can be disabled via pragmas or invoking the compiler with the @@ -644,15 +644,15 @@ A variable of a `tuple`:idx: or `object`:idx: type is a heterogenous storage container. A tuple or object defines various named *fields* of a type. A tuple defines an *order* of the fields additionally. Tuples are meant for heterogenous storage -types with no overhead and few abstraction possibilities. The constructor ``()`` -can be used to construct tuples. The order of the fields in the constructor -must match the order of the tuple's definition. Different tuple-types are -*equivalent* if they specify the same fields of the same type in the same -order. +types with no overhead and few abstraction possibilities. The constructor ``()`` +can be used to construct tuples. The order of the fields in the constructor +must match the order of the tuple's definition. Different tuple-types are +*equivalent* if they specify the same fields of the same type in the same +order. -The assignment operator for tuples copies each component. -The default assignment operator for objects is not defined. The programmer may -provide one, however. +The assignment operator for tuples copies each component. +The default assignment operator for objects is not defined. The programmer may +provide one, however. .. code-block:: nimrod @@ -662,7 +662,7 @@ provide one, however. # and an age var person: TPerson - person = (name: "Peter", age: 30) + person = (name: "Peter", age: 30) # the same, but less readable: person = ("Peter", 30) @@ -670,8 +670,8 @@ The implementation aligns the fields for best access performance. The alignment is done in a way that is compatible the way the C compiler does it. Objects provide many features that tuples do not. Object provide inheritance -and information hiding. Objects have access to their type at runtime, so that -the ``is`` operator can be used to determine the object's type. +and information hiding. Objects have access to their type at runtime, so that +the ``is`` operator can be used to determine the object's type. .. code-block:: nimrod @@ -689,9 +689,51 @@ the ``is`` operator can be used to determine the object's type. assert(student is TStudent) # is true Object fields that should be visible outside from the defining module, have to -marked by ``*``. In contrast to tuples, different object types are +marked by ``*``. In contrast to tuples, different object types are never *equivalent*. +Object variants +~~~~~~~~~~~~~~~ +Often an object hierarchy is overkill in certain situations where simple +`variant`:idx: types are needed. + +An example: + +.. code-block:: nimrod + + # This is an example how an abstract syntax tree could be modelled in Nimrod + type + TNodeKind = enum # the different node types + nkInt, # a leaf with an integer value + nkFloat, # a leaf with a float value + nkString, # a leaf with a string value + nkAdd, # an addition + nkSub, # a subtraction + nkIf # an if statement + PNode = ref TNode + TNode = object + case kind: TNodeKind # the ``kind`` field is the discriminator + of nkInt: intVal: int + of nkFloat: floavVal: float + of nkString: strVal: string + of nkAdd, nkSub: + leftOp, rightOp: PNode + of nkIf: + condition, thenPart, elsePart: PNode + + var + n: PNode + new(n) # creates a new node + n.kind = nkFloat + n.floatVal = 0.0 # valid, because ``n.kind==nkFloat``, so that it fits + # the following statement raises an `EInvalidField` exception, because + # n.kind's value does not fit: + n.strVal = "" + +As can been seen from the example, an advantage to an object hierarchy is that +no casting between different object types is needed. Yet, access to invalid +object fields raises an exception. + Set type ~~~~~~~~ @@ -749,7 +791,7 @@ The ``^`` operator can be used to derefer a reference, the ``addr`` procedure returns the address of an item. An address is always an untraced reference. Thus the usage of ``addr`` is an *unsafe* feature. -The ``.`` (access a tuple/object field operator) +The ``.`` (access a tuple/object field operator) and ``[]`` (array/string/sequence index operator) operators perform implicit dereferencing operations for reference types: @@ -773,7 +815,7 @@ further information. Special care has to be taken if an untraced object contains traced objects like traced references, strings or sequences: In order to free everything properly, -the built-in procedure ``finalize`` has to be called before freeing the +the built-in procedure ``GCunref`` has to be called before freeing the untraced memory manually! .. XXX finalizers for traced objects @@ -867,7 +909,7 @@ statement. Statements are separated into `simple statements`:idx: and `complex statements`:idx:. -Simple statements are statements that cannot contain other statements, like +Simple statements are statements that cannot contain other statements like assignments, calls or the ``return`` statement; complex statements can contain other statements. To avoid the `dangling else problem`:idx:, complex statements always have to be intended:: @@ -1028,10 +1070,10 @@ Example: The `case`:idx: statement is similar to the if statement, but it represents a multi-branch selection. The expression after the keyword ``case`` is evaluated and if its value is in a *vallist* the corresponding statements -(after the ``of`` keyword) are executed. If the value is no given *vallist* -the ``else`` part is executed. If there is no ``else`` part and not all -possible values that ``expr`` can hold occur in a ``vallist``, a static -error is given. This holds only for expressions of ordinal types. +(after the ``of`` keyword) are executed. If the value is not in any +given *slicelist* the ``else`` part is executed. If there is no ``else`` +part and not all possible values that ``expr`` can hold occur in a ``vallist``, +a static error is given. This holds only for expressions of ordinal types. If the expression is not of an ordinal type, and no ``else`` part is given, control just passes after the ``case`` statement. @@ -1331,10 +1373,8 @@ is used if the caller does not provide a value for this parameter. Example: `Operators`:idx: are procedures with a special operator symbol as identifier: .. code-block:: nimrod - proc `$` (x: int): string = # converts an integer to a string; - # since it has one parameter this is a prefix - # operator. With two parameters it would be - # an infix operator. + proc `$` (x: int): string = + # converts an integer to a string; this is a prefix operator. return intToStr(x) Calling a procedure can be done in many different ways: @@ -1544,7 +1584,7 @@ own file. Modules enable `information hiding`:idx: and `separate compilation`:idx:. A module may gain access to symbols of another module by the `import`:idx: statement. `Recursive module dependancies`:idx: are allowed, but slightly subtle. Only top-level symbols that are marked with an -asterisk (``*``) are exported. +asterisk (``*``) are exported. The algorithm for compiling modules is: @@ -1557,8 +1597,8 @@ This is best illustrated by an example: .. code-block:: nimrod # Module A type - T1* = int - import B # the compiler starts parsing B + T1* = int # Module A exports the type ``T1`` + import B # the compiler starts parsing B proc main() = var i = p(3) # works because B has been parsed completely here @@ -1660,12 +1700,19 @@ Nimrod source code. The conditional symbols go into a special symbol table. The compiler defines the target processor and the target operating system as conditional symbols. +Warning: The ``define`` pragma is deprecated as it conflicts with separate +compilation! One should use boolean constants as a replacement - this is +cleaner anyway. + undef pragma ------------ The `undef`:idx: pragma the counterpart to the define pragma. It undefines a conditional symbol. +Warning: The ``undef`` pragma is deprecated as it conflicts with separate +compilation! + error pragma ------------ diff --git a/doc/nimrodc.txt b/doc/nimrodc.txt index e49dfacb6..0bd9bdc91 100644 --- a/doc/nimrodc.txt +++ b/doc/nimrodc.txt @@ -34,8 +34,15 @@ Advanced command line switches are: Configuration file ------------------ -The ``nimrod`` executable loads the configuration file ``config/nimrod.cfg`` -unless this is suppressed by the ``--skip_cfg`` command line option. +The default configuration file is ``nimrod.cfg``. The ``nimrod`` executable +looks for it in the following directories (in this order): + +1. ``/home/$user/.config/nimrod.cfg`` (UNIX) or ``$APPDATA/nimrod.cfg`` (Windows) +2. ``$nimrod/config/nimrod.cfg`` (UNIX, Windows) +3. ``/etc/nimrod.cfg`` (UNIX) + +The search stops as soon as a configuration file has been found. The reading +of ``nimrod.cfg`` can be suppressed by the ``--skip_cfg`` command line option. Configuration settings can be overwritten in a project specific configuration file that is read automatically. This specific file has to be in the same directory as the project and be of the same name, except @@ -47,11 +54,10 @@ Command line settings have priority over configuration file settings. Nimrod's directory structure ---------------------------- The generated files that Nimrod produces all go into a subdirectory called -``rod_gen``. This makes it easy to write a script that deletes all generated -files. For example the generated C code for the module ``path/modA.nim`` -will become ``path/rod_gen/modA.c``. +``nimcache`` in your project directory. This makes it easy to delete all +generated files. -However, the generated C code is not platform independant! C code generated for +However, the generated C code is not platform independant. C code generated for Linux does not compile on Windows, for instance. The comment on top of the C file lists the OS, CPU and CC the file has been compiled for. @@ -77,10 +83,46 @@ Because Nimrod generates C code it needs some "red tape" to work properly. Thus lots of options and pragmas for tweaking the generated C code are available. +Importc Pragma +~~~~~~~~~~~~~~ +The `importc`:idx: pragma provides a means to import a type, a variable, or a +procedure from C. The optional argument is a string containing the C +identifier. If the argument is missing, the C name is the Nimrod +identifier *exactly as spelled*: + +.. code-block:: + proc printf(formatstr: cstring) {.importc: "printf", varargs.} + + +Exportc Pragma +~~~~~~~~~~~~~~ +The `exportc`:idx: pragma provides a means to export a type, a variable, or a +procedure to C. The optional argument is a string containing the C +identifier. If the argument is missing, the C name is the Nimrod +identifier *exactly as spelled*: + +.. code-block:: Nimrod + proc callme(formatstr: cstring) {.exportc: "callMe", varargs.} + + +Dynlib Pragma +~~~~~~~~~~~~~ +With the `dynlib`:idx: pragma a procedure or a variable can be imported from +a dynamic library (``.dll`` files for Windows, ``lib*.so`` files for UNIX). The +non-optional argument has to be the name of the dynamic library: + +.. code-block:: Nimrod + proc gtk_image_new(): PGtkWidget {.cdecl, dynlib: "libgtk-x11-2.0.so", importc.} + +In general, importing a dynamic library does not require any special linker +options or linking with import libraries. This also +implies that no *devel* packages need to be installed. + + No_decl Pragma ~~~~~~~~~~~~~~ The `no_decl`:idx: pragma can be applied to almost any symbol (variable, proc, -type, etc.) and is one of the most important for interoperability with C: +type, etc.) and is sometimes useful for interoperability with C: It tells Nimrod that it should not generate a declaration for the symbol in the C code. Thus it makes the following possible, for example: @@ -89,17 +131,7 @@ the C code. Thus it makes the following possible, for example: EOF {.importc: "EOF", no_decl.}: cint # pretend EOF was a variable, as # Nimrod does not know its value -Varargs Pragma -~~~~~~~~~~~~~~ -The `varargs`:idx: pragma can be applied to procedures only. It tells Nimrod -that the proc can take a variable number of parameters after the last -specified parameter. Nimrod string values will be converted to C -strings automatically: - -.. code-block:: Nimrod - proc printf(formatstr: cstring) {.nodecl, varargs.} - - printf("hallo %s", "world") # "world" will be passed as C string +However, the ``header`` pragma is often the better alternative. Header Pragma @@ -119,12 +151,25 @@ in angle brackets: ``<>``. If no angle brackets are given, Nimrod encloses the header file in ``""`` in the generated C code. +Varargs Pragma +~~~~~~~~~~~~~~ +The `varargs`:idx: pragma can be applied to procedures only. It tells Nimrod +that the proc can take a variable number of parameters after the last +specified parameter. Nimrod string values will be converted to C +strings automatically: + +.. code-block:: Nimrod + proc printf(formatstr: cstring) {.nodecl, varargs.} + + printf("hallo %s", "world") # "world" will be passed as C string + + No_static Pragma ~~~~~~~~~~~~~~~~ The `no_static`:idx: pragma can be applied to almost any symbol and specifies that it shall not be declared ``static`` in the generated C code. Note that symbols in the interface part of a module never get declared ``static``, so -only in special cases is this pragma necessary. +only in very special cases this pragma is necessary. Line_dir Option @@ -171,8 +216,29 @@ The `register`:idx: pragma is for variables only. It declares the variable as in a hardware register for faster access. C compilers usually ignore this though and for good reason: Often they do a better job without it anyway. -In highly specific cases (a dispatch loop of interpreters for example) it -may provide benefits, though. +In highly specific cases (a dispatch loop of an bytecode interpreter for +example) it may provide benefits, though. + + +Acyclic Pragma +~~~~~~~~~~~~~~ +The `acyclic`:idx: pragma can be used for object types to mark them as acyclic +even though they seem to be cyclic. This is an **optimization** for the garbage +collector to not consider objects of this type as part of a cycle:: + + type + PNode = ref TNode + TNode {.acyclic, final.} = object + left, right: PNode + data: string + +In the example a tree structure is declared with the ``TNode`` type. Note that +the type definition is recursive thus the GC has to assume that objects of +this type may form a cyclic graph. The ``acyclic`` pragma passes the +information that this cannot happen to the GC. If the programmer uses the +``acyclic`` pragma for data types that are in reality cyclic, the GC may leak +memory, but nothing worse happens. + Disabling certain messages @@ -244,12 +310,17 @@ efficient than any hand-coded scheme. The ECMAScript code generator ============================= +Note: As of version 0.7.0 the ECMAScript code generator is not maintained any +longer. Help if you are interested. + Note: I use the term `ECMAScript`:idx: here instead of `JavaScript`:idx:, since it is the proper term. +The ECMAScript code generator is experimental! + Nimrod targets ECMAScript 1.5 which is supported by any widely used browser. Since ECMAScript does not have a portable means to include another module, -Nimrod just generate a long ``.js`` file. +Nimrod just generates a long ``.js`` file. Features or modules that the ECMAScript platform does not support are not available. This includes: diff --git a/doc/spec.txt b/doc/spec.txt deleted file mode 100644 index 3bad06e97..000000000 --- a/doc/spec.txt +++ /dev/null @@ -1,1297 +0,0 @@ -==================== -Nimrod Specification -==================== - -:Author: Andreas Rumpf - -.. contents:: - - -About this document -=================== - -This document describes the lexis, the syntax, and the semantics of Nimrod. -However, this is only a first draft. Some parts need to be more precise, -features may be added to the language, etc. - -The language constructs are explained using an extended BNF, in -which ``(a)*`` means 0 or more ``a``'s, ``a+`` means 1 or more ``a``'s, and -``(a)?`` means an optional *a*; an alternative spelling for optional parts is -``[a]``. The ``|`` symbol is used to mark alternatives -and has the lowest precedence. Parentheses may be used to group elements. -Non-terminals are in lowercase, terminal symbols (including keywords) are in -UPPERCASE. An example:: - - if_stmt ::= IF expr COLON stmts (ELIF expr COLON stmts)* [ELSE stmts] - - -Definitions -=========== - -The following defintions are the same as their counterparts in the -specification of the Modula-3 programming language. - -A Nimrod program specifies a computation that acts on a sequence of digital -components called `locations`. A variable is a set of locations that -represents a mathematical value according to a convention determined by the -variable's *type*. If a value can be represented by some variable of type -``T``, then we say that the value is a *member* of ``T`` and ``T`` *contains* -the value. - -An *identifier* is a symbol declared as a name for a variable, type, -procedure, etc. The region of the program over which a declaration applies is -called the *scope* of the declaration. Scopes can be nested. The meaning of an -identifier is determined by the smallest enclosing scope in which the -identifier is declared. - -An expression specifies a computation that produces a value or variable. -Expressions that produce variables are called `designators`. A designator -can denote either a variable or the value of that variable, depending on -the context. Some designators are *readonly*, which means that they cannot -be used in contexts that might change the value of the variable. A -designator that is not readonly is called *writable*. Expressions whose -values can be determined statically are called *constant expressions*; -they are never designators. - -A `static error` is an error that the implementation must detect before -program execution. Violations of the language definition are static -errors unless they are explicitly classified as runtime errors. - -A `checked runtime error` is an error that the implementation must detect -and report at runtime. The method for reporting such errors is via *raising -exceptions*. However, an implementation may provide a means to disable these -runtime checks. See the section *pragmas* for details. - -An `unchecked runtime error` is an error that is not guaranteed to be -detected, and can cause the subsequent behavior of the computation to -be arbitrary. Unchecked runtime errors cannot occur if only `safe` -language features are used. - - -Lexical Analysis -================ - -Indentation ------------ - -Nimrod's standard grammar describes an `indentation sensitive` language. -This means that all the control structures are recognized by the indentation. -Indentation consists only of spaces; tabulators are not allowed. - -The terminals ``IND`` (indentation), ``DED`` (dedentation) and ``SAD`` -(same indentation) are generated by the scanner, denoting an indentation. -Using tabulators for the indentation is not allowed. - -These terminals are only generated for *logical lines*, i.e. not for an empty -line and not for a line with only whitespace or comments. - -The parser and the scanner communicate over a stack which indentation terminal -should be generated: The stack consists of integers counting the spaces. The -stack is initialized with a zero on its top. The scanner reads from the stack: -If the current indentation token consists of more spaces than the entry at the -top of the stack, a ``IND`` token is generated, else if it consists of the same -number of spaces, a ``SAD`` token is generated. If it consists of fewer spaces, -a ``DED`` token is generated for any item on the stack that is greater than the -current. These items are then popped from the stack by the scanner. At the end -of the file, a ``DED`` token is generated for each number remaining on the -stack that is larger than zero. - -Because the grammar contains some optional ``IND`` tokens, the scanner cannot -push new indentation levels. This has to be done by the parser. The symbol -``IND_PUSH`` indicates that the ``IND`` token should be pushed onto the stack -by the parser. - -An Example how this works:: - - if_stmt ::= IF expr COLON stmts (ELIF expr COLON stmts)* (ELSE stmts)? - stmts ::= IND_PUSH (stmt [SAD])+ DED | stmt [SAD] - - if expr0: - stmt1 # would be valid because, SAD is not generated any longer! - - if expr0: - stmt1 # scanner: IND; parser pushes 2 onto the stack - if expr3: stmt5 # DED; ... SAD eaten by stmt5 - else: stmt6 # - if expr4: stmt7 - if expr: - stmt1 # scanner: IND; the parser pushes 2 onto the stack - stmt2 # scanner: SAD (because indentation is 2) - elif expr2: # scanner: DED (because indentation is 0) - stmts3 # scanner: IND; the parser pushes 2 onto the stack - else: # scanner: DED; - stmt4 # scanner: IND; the parser pushes 2 onto the stack - # scanner generates 1 DED, because end of file and 1 item on stack - - - -Identifiers & Keywords ----------------------- - -`Identifiers` in Nimrod can be any string of letters, digits -and underscores, beginning with a letter. Two immediate following -underscores ``__`` are not allowed:: - - letter ::= 'A'..'Z' | 'a'..'z' - digit ::= '0'..'9' - IDENTIFIER ::= letter ( ['_'] letter | digit )* - -The following `keywords` are reserved and cannot be used as identifiers:: - - ${keywords} - -Some keywords are unused; they are reserved for future developments of the -language. - -Nimrod is a `style-insensitive` language. This means that it is not -case-sensitive and even underscores are ignored: -**type** is a reserved word, and so is **TYPE** or **T_Y_P_E**. The idea behind -this is, that this allows programmers to use their own prefered spelling style. -Editors can show the identifiers as configured. - - -Literal strings ---------------- - -`Literal strings` can be delimited by matching double quotes, and can contain -the following `escape sequences`: - -================== ================================== - Escape sequence Meaning -================== ================================== - ``\n`` `newline` - ``\r`` `carriage return` - ``\l`` `line feed` - ``\f`` `form feed` - ``\t`` `tabulator` - ``\v`` `vertical tabulator` - ``\\`` `backslash` - ``\"`` `quotation mark` - ``\'`` `apostrophe` - ``\y`` `character with number y` - ``\a`` `alert` - ``\b`` `backspace` - ``\e`` `escape` `[ESC]` -================== ================================== - - -Strings in Nimrod may contain any 8-bit value, except embedded zeros, -which are not allowed for compability with `C`. - -Literal strings can also be delimited by three double squotes -``"""`` ... ``"""``. -Literals in this form may run for several lines, may contain ``"`` and do not -interpret any escape sequences. -For convenience, when the opening ``"""`` is immediately -followed by a newline, the newline is not included in the string. -`Raw string literals` are preceded with the letter ``r`` (or ``R``) -and are delimited by matching double quotes (just like ordinary string -literals) and do not interpret the escape sequences. - - -Literal characters ------------------- - -Character literals are enclosed in single quotes ``''`` and can contain the -same escape sequences as strings - with one exception: ``\n`` is not allowed -as it may be wider than one character (often it is the pair CR/LF for example). - - -Numerical constants -------------------- - -`Numerical constants` are of a single type and have the form:: - - hexdigit ::= digit | 'A'..'F' | 'a'..'f' - octdigit ::= '0'..'7' - bindigit ::= '0'..'1' - INT_LIT ::= digit ( ['_'] digit )* - | '0' ('x' | 'X' ) hexdigit ( ['_'] hexdigit )* - | '0o' octdigit ( ['_'] octdigit )* - | '0' ('b' | 'B' ) bindigit ( ['_'] bindigit )* - - INT8_LIT ::= INT_LIT '\'' ('i' | 'I' ) '8' - INT16_LIT ::= INT_LIT '\'' ('i' | 'I' ) '16' - INT32_LIT ::= INT_LIT '\'' ('i' | 'I' ) '32' - INT64_LIT ::= INT_LIT '\'' ('i' | 'I' ) '64' - - exponent ::= ('e' | 'E' ) ['+' | '-'] digit ( ['_'] digit )* - FLOAT_LIT ::= digit (['_'] digit)* ('.' (['_'] digit)* [exponent] |exponent) - FLOAT32_LIT ::= ( FLOAT_LIT | INT_LIT ) '\'' ('f' | 'F') '32' - FLOAT64_LIT ::= ( FLOAT_LIT | INT_LIT ) '\'' ('f' | 'F') '64' - - -As can be seen in the productions, numerical constants can contain unterscores -for readability. Integer and floating point literals may be given in decimal (no -prefix), binary (prefix ``0b``), octal (prefix ``0o``) and -hexadecimal (prefix ``0x``) notation. - -There exists a literal for each numerical type that are -defined. The suffix starting with an apostophe ('\'') is called a -`type suffix`. Literals without a type prefix are of the type ``int``, unless -the literal contains a dot or an ``E`` in which case it is of type ``float``. - -The following table specifies type suffixes: - -================= ========================= - Type Suffix Resulting type of literal -================= ========================= - ``'i8`` int8 - ``'i16`` int16 - ``'i32`` int32 - ``'i64`` int64 - ``'f32`` float32 - ``'f64`` float64 -================= ========================= - -Floating point literals may also be in binary, octal or hexadecimal -notation: -``0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64`` -is approximately 1.72826e35 according to the IEEE floating point standard. - - - - -Comments --------- - -`Comments` start anywhere outside a string with the hash character ``#``. -Comments run until the end of the line. Comments are tokens; they are only -allowed at certain places in the input file as they belong to the syntax. This -is essential for performing correct source-to-source transformations or -documentation generators. - - -Other tokens ------------- - -The following strings denote other tokens:: - - ( ) { } [ ] , ; [. .] {. .} (. .) - : = ^ .. ` - -``..`` takes precedence over other tokens that contain a dot: ``{..}`` are the -three tokens ``{``, ``..``, ``}`` and not the two tokens ``{.``, ``.}``. - -In Nimrod one can define his own operators. An `operator` is any -combination of the following characters that are not listed above:: - - + - * / < > - = @ $ ~ & % - ! ? ^ . | - -These keywords are also operators: -``and or not xor shl shr div mod in notin is isnot``. - - -Syntax -====== - -This section lists Nimrod's standard syntax in ENBF. How the parser receives -indentation tokens is already described in the Lexical Analysis section. - -Nimrod allows user-definable operators. -Binary operators have 8 different levels of precedence. For user-defined -operators, the precedence depends on the first character the operator consists -of. All binary operators are left-associative. - -================ ============================================== ================== =============== -Precedence level Operators First characters Terminal symbol -================ ============================================== ================== =============== - 7 (highest) ``$`` OP7 - 6 ``* / div mod shl shr %`` ``* % \ /`` OP6 - 5 ``+ -`` ``+ ~ |`` OP5 - 4 ``&`` ``&`` OP4 - 3 ``== <= < >= > != in not_in is isnot`` ``= < > !`` OP3 - 2 ``and`` OP2 - 1 ``or xor`` OP1 - 0 (lowest) ``? @ ^ ` : .`` OP0 -================ ============================================== ================== =============== - - -The grammar's start symbol is ``module``. The grammar is LL(1) and therefore -not ambigious. - -.. include:: grammar.txt - :literal: - - - -Semantics -========= - -Constants ---------- - -Constants are symbols which are bound to a value. The constant's value -cannot change. The compiler must be able to evaluate the expression in a -constant declaration at compile time. This means that most of the functions in -the runtime library cannot be used in a constant declaration. - -Operators such as ``+, -, *, /, not, and, or, div, mod`` and the procedures -``addr, ord, chr, sizeof, trunc, round, frac, odd, abs`` can be used, however. -An implementation may restrict the usage of ``addr`` in constant expressions. - - -Types ------ - -All expressions have a type which is known at compile time. Thus Nimrod is -statically typed. One can declare new types, which is in -essence defining an identifier that can be used to denote this custom type -when declaring variables further in the source code. - -These are the major type classes: - -* ordinal types (consist of integer, bool, character, enumeration - (and subranges thereof) types) -* floating point types -* string type -* structured types -* reference (pointer) type -* procedural type - - -Ordinal types -~~~~~~~~~~~~~ -Ordinal types have the following characteristics: - -- Ordinal types are countable and ordered. This property allows - the operation of functions as Inc, Ord, Dec on ordinal types to be defined. -- Ordinal values have a smallest possible value. Trying to count farther - down than the smallest value gives a checked runtime or static error. -- Ordinal values have a largest possible value. Trying to count farther - than the largest value gives a checked runtime or static error. - -Signed integers, bool, characters and enumeration types (and subrange of these -types) belong to ordinal types. Unsigned integer types are special in the way -that over- and underflows generate no errors, but wrap around. - -Pre-defined numerical types -~~~~~~~~~~~~~~~~~~~~~~~~~~~ -These integer types are pre-defined: - -``int`` - the generic signed integer type; its size is platform dependant - (a compiler should choose the processor's fastest integer type) - this type should be used in general. An integer literal that has no type - suffix is of this type. - -intXX - an implementation may define additional signed integer types - of XX bits using this naming scheme (example: int16 is a 16 bit wide integer). - The current implementation supports ``int8``, ``int16``, ``int32``, ``int64``. - Literals of these types have the suffix 'iXX. - - -There are no unsigned integer types, only *unsigned operations* that treat their -arguments as unsigned. Unsigned operations all wrap around; they may not lead to -over- or underflow errors. - -The following floating point types are pre-defined: - -``float`` - the generic floating point type; its size is platform dependant - (a compiler should choose the processor's fastest floating point type) - this type should be used in general - -floatXX - an implementation may define additional floating point types of XX bits using - this naming scheme (example: float64 is a 64 bit wide float). The current - implementation supports ``float32`` and ``float64``. Literals of these types - have the suffix 'fXX. - -Automatic type conversion in expressions where different kinds -of integer types are used is performed. However, if the type conversion -loses information, the `EConvertError` exception is raised. An implementation -may detect certain cases of the convert error at compile time. - -Automatic type conversion in expressions with different kinds -of floating point types is performed: The smaller type is -converted to the larger. Arithmetic performed on floating point types -follows the IEEE standard. - - -Boolean type -~~~~~~~~~~~~ -The boolean type is named ``bool`` in Nimrod and can be one of the two -pre-defined values ``true`` and ``false``. Conditions in while, -if, elif, when statements need to be of type bool. - -This condition should hold:: - - ord(false) == 0 and ord(true) == 1 - -The operators ``not, and, or, xor`` are defined for the bool type. -The ``and`` and ``or`` operators perform short-cut evaluation. -Example:: - - while p != nil and p.name != "xyz": - # p.name is not evaluated if p == nil - p = p.next - - -The size of the bool type is implementation-dependant, typically it is -one byte. - - -Character type -~~~~~~~~~~~~~~ -The character type is named ``char`` in Nimrod and uses the platform's -native encoding. Thus on nearly every platform its size is one byte due to -the popular UTF-8 encoding. -Character literals are enclosed in single quotes ``''``. - -.. Note:: For platform-independant character handling is the ``encoding`` - standard module. - - -Enumeration types -~~~~~~~~~~~~~~~~~ -Enumeration types define a new type whose values consist only of the ones -specified. -The values are ordered by the order in enum's declaration. Example:: - - type - TDirection = enum - north, east, south, west - - -Now the following holds:: - - ord(north) == 0 - ord(east) == 1 - ord(south) == 2 - ord(west) == 3 - -Thus, north < east < south < west. The comparison operators can be used -with enumeration types. - -An implemenation should store enumeration types with the minimal number of -bytes required for the particular enum, unless efficiency would be affected by -doing so. - -For better interfacing to other programming languages, the fields of enum -types can be assigned an explicit ordinal value. However, the ordinal values -have to be in ascending order appropriately. A field whose ordinal value that -is not explicitly given, gets the value of the previous field + 1. - -An explicit ordered enum can have *wholes*:: - - type - TTokenType = enum - a = 2, b = 4, c = 89 # wholes are valid - -However, it is then not an ordinal anymore, so it is not possible to use these -enums as an index type for arrays. The procedures ``inc``, ``dec``, ``succ`` -and ``pred`` are not available for them. - - -Subrange types -~~~~~~~~~~~~~~ -A subrange type is a range of values from an ordinal type (the host type). -To define a subrange type, one must specify it's limiting values: the highest -and lowest value of the type:: - - type - TSubrange = range[0..5] - - -``TSubrange`` is a subrange of an integer which can only hold the values 0 -to 5. Assigning an other value to a variable of type ``TSubrange`` is a -checked runtime error (or static error if it can be statically -determined). Assignments from the base type to one of its subrange types -(and vice versa) are allowed. - -An implemenation should give it the same size as its base type. - - -String type -~~~~~~~~~~~ -All string literals are of the type string. A string in Nimrod is very -similar to a sequence of characters. However, strings in Nimrod both are -zero-terminated and have a length field. One can retrieve the length with the -builtin ``length`` procedure; the length never counts the terminating zero. -The assignment operator for strings always copies the string. - -Strings are compared by their lexicographical order. All comparison operators -are available. String can be indexed like arrays (lower bound is 0). Unlike -arrays, they can be used in case statements:: - - case paramStr(i) - of "-v": incl(options, optVerbose) - of "-h", "-?": incl(options, optHelp) - else: write(stdout, "invalid command line option!\n") - - -Structured types -~~~~~~~~~~~~~~~~ -A variable of a structured type can hold multiple values at the same time. -Stuctured types can be nested to unlimited levels. Arrays, sequences, records, -objects and sets belong to the structured types. - -Array type -~~~~~~~~~~ -Arrays are a homogenous type, meaning that each element in the array has the -same type. Arrays always have a fixed length which is specified at compile time -(except for open arrays). They can be indexed by any ordinal type. A parameter -may leave out the index type in the declaration making it an -*open array*. An open array ``A`` is always indexed by integers from 0 to -``length(A)-1``. - -A sequence may be passed to a parameter that is of type *open array*, but -not to a multi-dimensional open array, because it is impossible to do so in an -efficient manner. - -An array expression may be constructed by the array constructor ``[]``. -A constructed array is assignment compatible to a sequence. - -Example:: - - type - TIntArray = array[0..5, int] - var - x: TIntArray - x = [1, 2, 3, 4, 5, 6] # this is the array constructor - -The lower bound of an array may be received by the built-in proc -``low()``, the higher bound by ``high()``. The length may be -received by ``length()``. - -Arrays are always bounds checked (at compile-time or at runtime). An -implementation may provide a means to disable these checks. - - -Sequence type -~~~~~~~~~~~~~ -Sequences are similar to arrays but of dynamic length which may change -during runtime (like strings). A sequence ``S`` is always indexed by integers -from 0 to ``length(S)-1`` and its bounds are checked. Sequences can also be -constructed by the array constructor ``[]``. - - -Record and object types -~~~~~~~~~~~~~~~~~~~~~~~ -A variable of a record or object type is a heterogenous storage container. -A record or object defines various named *fields* of a type. The assignment -operator for records and objects always copies the whole record/object. The -constructor ``[]`` can be used to initialize records/objects. A field may -be given a default value. Fields with default values do not have to be listed -in a record construction, all other fields have to be listed. -:: - - type - TPerson = record # type representing a person - name: string # a person consists of a name - age: int = 30 # and an age which default value is 30 - - var - person: TPerson - person = (name: "Peter") # person.age is its default value (30) - -An implementation may align or even reorder the fields for best access -performance. The alignment may be specified with the `align` -pragma. If an alignment is specified the compiler shall not reorder the fields. - -The difference between records and objects is that objects allow inheritance. -Objects have access to their type at runtime, so that the ``is`` operator -can be used to determine the object's type. Assignment from an object to its -parents' object leads to a static or runtime error (the -`EInvalidObjectAssignment` exception is raised). -:: - - type - TPerson = object - name: string - age: int - - TStudent = object of TPerson # a student is a person - id: int # with an id field - - var - student: TStudent - person: TPerson - student = (name: "Peter", age: 89, id: 3) - person = (name: "Mary", age: 17) - assert(student is TStudent) # is true - person = student # this is an error; person has no storage for id. - - -Set type -~~~~~~~~ -The `set type` models the mathematical notion of a set. The set's -basetype can only be an ordinal type. The reason is that sets are implemented -as bit vectors. Sets are designed for high performance computing. - -.. Note:: The sets module can be used for sets of other types. - -Sets can be constructed via the set constructor: ``{}`` is the empty set. The -empty set is type combatible with any special set type. The constructor -can also be used to include elements (and ranges of elements) in the set:: - - {'a'..'z', '0'..'9'} # This constructs a set that conains the - # letters from 'a' to 'z' and the digits - # from '0' to '9' - -These operations are supported by sets: - -================== ========================================================== -operation meaning -================== ========================================================== - A + B union of two sets - A * B intersection of two sets - A - B difference of two sets (A without B's elements) - A == B set equality - A <= B subset relation (A is subset of B or equal to B) - A < B strong subset relation (A is a real subset of B) - e in A set membership (A contains element e) - A >< B symmetric set difference (= (A - B) + (B - A)) - card(A) the cardinality of A (number of elements in A) - incl(A, elem) same as A = A + {elem}, but may be faster - excl(A, elem) same as A = A - {elem}, but may be faster -================== ========================================================== - -Reference type -~~~~~~~~~~~~~~ -References (similiar to `pointers` in other programming languages) are a way to -introduce many-to-one relationships. This means different references can point -to and modify the same location in memory. References should be used sparingly -in a program. They are only needed for constructing graphs. - -Nimrod distinguishes between *traced* and *untraced* references. Untraced -references are also called `pointers`. The difference between them is that -traced references are garbage collected, untraced are not. Thus untraced -references are *unsafe*. However for certain low-level operations (accessing -the hardware) untraced references are unavoidable. - -Traced references are declared with the **ref** keyword, untraced references -are declared with the **ptr** keyword. - -The ``^`` operator can be used to derefer a reference, the ``addr`` procedure -returns the address of an item. An address is always an untraced reference. -Thus the usage of ``addr`` is an *unsafe* feature. - -The ``.`` (access a record field operator) and ``[]`` (array/string/sequence -index operator) operators perform implicit dereferencing operations for -reference types:: - - type - PNode = ref TNode - TNode = record - le, ri: PNode - data: int - - var - n: PNode - new(n) - n.data = 9 # no need to write n^.data - -As can be seen by the example, reference types are the only types that can be -used in *implicit forward declarations*: TNode may be used before it is -defined, because only a refence to it is needed. - -To allocate a new traced object, the built-in procedure ``new`` has to be used. -To deal with untraced memory, the procedures ``alloc``, ``dealloc`` and -``realloc`` can be used. The documentation of the system module contains -further information. - -Special care has to be taken if an untraced object contains traced objects like -traced references, strings or sequences: In order to free everything properly, -the built-in procedure ``finalize`` has to be called before freeing the -untraced memory manually! - -.. XXX finalizers for traced objects - -Procedural type -~~~~~~~~~~~~~~~ -A procedural type is internally a pointer to procedure. Thus ``nil`` is an -allowed value for variables of a procedural type. Nimrod uses procedural types -to achieve `functional` programming techniques. Dynamic dispatch for OOP -constructs can also be implemented with procedural types. - -Example:: - - type - TCallback = proc (x: int) {.cdecl.} - - proc printItem(x: Int) = ... - - proc forEach(c: TCallback) = - ... - - forEach(printItem) # this will NOT work because calling conventions differ - -A subtle issue with procedural types is that the calling convention of the -procedure influences the type compability: Procedural types are only compatible -if they have the same calling convention. - -Altough a Nimrod implementation may provide additional calling conventions -the following shall always exist: - -``cdecl`` - is used for interfacing with C; indicates that a proc shall - use the same calling convention as the C compiler. - -``inline`` - indicates that the caller of the proc should not call it, - but rather inline its code in place for improved efficiency. Note that - this is only a hint for the compiler: It may completely ignore it and - it may inline procedures that are not marked as ``inline``. - -``closure`` - indicates that the procedure expects a context, a `closure` that needs - to be passed to the procedure. - - -Statements ----------- -Nimrod uses the common statement/expression paradigma: Statements do not -produce a value in contrast to expressions. Call expressions are statements. -If the called procedure returns a value, it is not a valid statement -as statements do not produce values. To evaluate an expression for -side-effects and throwing its value away, one can use the ``discard`` -statement. - -Statements are separated into `simple statements` and `complex statements`. -Simple statements are statements that cannot contain other statements, like -assignments, calls or the ``return`` statement; complex statements can -contain other statements. To avoid the `dangling else problem`, complex -statements always have to be intended:: - - XXX - - - -Discard statement -~~~~~~~~~~~~~~~~~ - -Syntax:: - - discard_stmt ::= discard expr - -The `discard` statement evaluates its expression for side-effects and throws -the expression's resulting value away. If the expression has no side-effects, -this shall generate at least a warning from the compiler. - - -Var statement -~~~~~~~~~~~~~ - -Syntax:: - - varlist ::= identlist [asgn_opr expr doc] - var_section ::= var varlist - | var INDENT(x > I[-1]) PUSH(x) varlist - { INDENT(x) varlist } POP - -`Var` statements simply declare new local and global variables and may -initialize them. A comma seperated list of variables can be used to specify -variables of the same type:: - - var - a: int = 0 - x, y, z: int - -However, an initializer is not allowed for such a list as its semantic -would be ambigious in some cases. If an initializer is given the type -can be omitted: The variable is of the same type as the initializing -expression. - - -If statement -~~~~~~~~~~~~ - -Syntax:: - - if_stmt ::= PUSH(x = I[-1]) if expr ":" stmts - { INDENT(x) elif expr ":" stmts } - [ INDENT(x) else ":" stmts ] - POP - -The `if` statement is a simple way to make a branch in the control flow: -The expression after the keyword ``if`` is evaluated, if it is true -the corresponding statements after the ``:`` are executed. Otherwise -the expression after the ``elif`` is evaluated (if there is an -``elif`` branch), if it is true the corresponding statements after -the ``:`` are executed. This goes on until the last ``elif``. If all -conditions fail, the ``else`` part is executed. If there is no ``else`` -part, execution continues with the statement after the ``if`` statement. - - -Case statement -~~~~~~~~~~~~~~ - -Syntax:: - - case_stmt ::= PUSH(I[-1]) case expr - INDENT(x>=I[-1]) of vallist ":" stmts - { INDENT(x) of vallist ":" stmts } - { INDENT(x) elif expr ":" stmts } - [ INDENT(x) else ":" stmts ] - POP - -The `case` statement is similar to the if statement, but it represents -a multi-branch selection. The expression after the keyword ``case`` is -evaluated and if its value is in a *vallist* the corresponding statements -(after the ``of`` keyword) are executed. If the value is no given *vallist* -the ``else`` part is executed. If there is no ``else`` part and not all -possible values that ``expr`` can hold occur in a ``vallist``, a static -error shall be given. This holds only for expressions of ordinal types. -If the expression is not of an ordinal type, and no ``else`` part is -given, control just passes after the ``case`` statement. - -To suppress the static error in the ordinal case the programmer needs -to write an ``else`` part with a ``nil`` statement. - - -When statement -~~~~~~~~~~~~~~ - -Syntax:: - - when_stmt ::= PUSH(x=I[-1]) when expr ":" stmts - { INDENT(x) elif expr ":" stmts } - [ INDENT(x) else ":" stmts ] - POP - -The `when` statement is almost identical to the ``if`` statement with some -exceptions: - -* Each ``expr`` has to be a constant expression of type ``bool``. -* The statements do not open a new scope if they introduce new identifiers. -* The statements that belong to the expression that evaluated to true are - translated by the compiler, the other statements are not checked for - syntax or semantics at all! This holds also for any ``expr`` coming - after the expression that evaluated to true. - -The ``when`` statement enables conditional compilation techniques. As -a special syntatic extension, the ``when `` construct is also available -within ``record`` or ``object`` definitions. - - -Raise statement -~~~~~~~~~~~~~~~ - -Syntax:: - - raise_stmt ::= raise [qualified_identifier [comma expr]] - -Apart from built-in operations like array indexing, memory allocation, etc. -the ``raise`` statement is the only way to raise an exception. The -identifier has to be the name of a previously declared exception. A -comma followed by an expression may follow; the expression must be of type -``string`` or ``cstring``; this is an error message that can be extracted -with the `getCurrentExceptionMsg` procedure in the module ``system``. - -If no exception name is given, the current exception is `re-raised`. The -`ENoExceptionToReraise` exception is raised if there is no exception to -re-raise. It follows that the ``raise`` statement *always* raises an -exception. - - -Try statement -~~~~~~~~~~~~~ - -Syntax:: - - try_stmt ::= PUSH(x=I[-1]) try ":" stmts - { INDENT(x) except exceptlist ":" stmts } - [ INDENT(x) except ":" stmts ] - [ INDENT(x) finally ":" stmts ] - POP - -The statements after the ``try`` are executed in sequential order unless -an exception ``e`` is raised. If the exception type of ``e`` matches any -of the list ``exceptlist`` the corresponding statements are executed. -The statements following the ``except`` clauses are called -`exception handlers`. - -The empty ``except`` clause is executed if there is an exception that is -in no list. It is similiar to an ``else`` clause in ``if`` statements. - -If there is a ``finally`` clause given, it is always executed after the -exception handlers. - -The exception is *consumed* in an exception handler. However, an -exception handler may raise another exception. If the exception is not -handled, it is propagated through the call stack. This means that often -the rest of the procedure - that is not within a ``finally`` clause - -is not executed (if an exception occurs). - - -Block statement -~~~~~~~~~~~~~~~ - -Syntax:: - - block_stmt ::= block [IDENTIFIER] ":" stmts - -The block statement is a means to group statements to a (named) `block`. -Inside the block, the ``break`` statement is allowed to leave the block -immediately. A ``break`` statement can contain a name of a surrounding -block to specify which block is to leave. - - -Break statement -~~~~~~~~~~~~~~~ - -Syntax:: - - break_stmt ::= break [IDENTIFIER] - -The break statement is used to leave a block immediately. If ``IDENTIFIER`` -is given, it is the name of the enclosing block that is to leave. If it is -absent, the innermost block is leaved. - - -While statement -~~~~~~~~~~~~~~~ - -Syntax:: - - while_stmt ::= WHILE expr COLON stmts - -The `while` statement is executed until the ``expr`` evaluates to false. -Endless loops are no error. ``while`` statements open an `implicit block`, -so that they can be aborted by a ``break`` statement. - - -For statement & iterators -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Syntax:: - - for_stmt ::= PUSH(x=I[-1]) for exprlist in expr [".." expr] ":" stmts - POP - -The `for` statement is an abstract mechanism to iterate over the elements -of a container. It relies on an *iterator* to do so. Like ``while`` -statements, ``for`` statements open an `implicit block`, so that they -can be aborted by a ``break`` statement. - -XXX - - - -Assembler statement -~~~~~~~~~~~~~~~~~~~ -Syntax:: - - asm_stmt ::= asm [CHAR_LITERAL] STRING_LITERAL - -The direct embedding of assembler code into Nimrod code is supported by the -unsafe ``asm`` statement. Identifiers in the assembler code that refer to -Nimrod identifiers shall be enclosed in a special character which can be -specified right after the ``asm`` keyword. The default special character is -``'!'``. An implementation does not need to support the assembler statement, -giving a static error if it encounters one. - - -Modules -------- -Nimrod supports splitting a program into pieces by a module concept. Modules -make separate compilation possible. Each module needs to be in its own file. -Modules consist of an interface and an implementation section. The interface -section lists the symbols that can be imported from other modules. Thus modules -enable `information hiding`. The interface section may not contain any -code that is executable. This means that only the headers of procedures can -appear in the interface. A module may gain access to symbols of another module -by the `import` statement. Recursive module dependancies are allowed, but -slightly subtle. - -The algorithm for compiling modules is: - -- Compile the whole module as usual, following import statements recursively -- if we have a cycle only import the already parsed symbols (in the interface - of course); if an unknown identifier occurs then abort - -This is best illustrated by an example:: - - # Module A - interface - type - T1 = int - import B # the compiler starts parsing B - - implementation - - proc main() = - var i = p(3) # works because B has been parsed completely here - - main() - - - # Module B - interface - import A # A is not parsed here! Only the already known symbols - # of A are imported here. - - proc p(x: A.T1): A.T1 # this works because the compiler has already - # added T1 to A's interface symbol table - - implementation - - proc p(x: A.T1): A.T1 = return x + 1 - - -Scope rules ------------ -Identifiers are valid from the point of their declaration until the end of -the block in which the declaration occurred. The range where the identifier -is known is the `scope` of the identifier. The exact scope of an identifier -depends on the way it was declared. - -Block scope -~~~~~~~~~~~ -The *scope* of a variable declared in the declaration part of a block -is valid from the point of declaration until the end of the block. If a -block contains a second block, in which the identifier is redeclared, -then inside this block, the second declaration will be valid. Upon -leaving the inner block, the first declaration is valid again. An -identifier cannot be redefined in the same block, except if valid for -procedure or iterator overloading purposes. - - -Record or object scope -~~~~~~~~~~~~~~~~~~~~~~ -The field identifiers inside a record or object definition are valid in the -following places: - -* To the end of the record definition -* Field designators of a variable of the given record type. -* In all descendent types of the object type. - -Module scope -~~~~~~~~~~~~ -All identifiers in the interface part of a module are valid from the point of -declaration, until the end of the module. Furthermore, the identifiers are -known in other modules that import the module. Identifiers from indirectly -dependent modules are *not* available. Identifiers declared in the -implementation part of a module are valid from the point of declaration to -the end of the module. The ``system`` module is automatically imported in -all other modules. - -If a module imports an identifier by two different modules, -each occurance of the identifier has to be qualified, unless it is an -overloaded procedure or iterator in which case the overloading -resolution takes place:: - - # Module A - interface - var x: string - - # Module B - interface - var x: int - - # Module C - import A, B, io - write(stdout, x) # error: x is ambigious - write(sdtout, A.x) # no error: qualifier used - - -Messages -======== - -A Nimrod compiler has to emit different kinds of messages: `hint`, -`warning`, and `error` messages. `errors` have to be emitted if the compiler -encounters any static errors. If and when the other two message kinds are -emitted is not specified, unless a message is requested with the -``hint`` or ``warning`` pragma. - -Pragmas -======= -Pragmas are Nimrod's method to give the compiler additional information/ -commands without introducing a massive number of new keywords. Pragmas are -processed on the fly during parsing. Pragmas are always enclosed in the -special ``{.`` and ``.}`` curly brackets. There are a number of pragmas -that a compiler has to process; a compiler may define additional pragmas -not specified here. - - -define pragma -------------- -The `define` pragma defines a conditional symbol. This symbol may only be -used in other pragmas and in the ``defined`` expression and not in ordinary -Nimrod source code. The conditional symbols go into a special symbol table. -The compiler shall define the target processor and the target operating -system as conditional symbols. See `Annex A <XXX>`_ for a list of specified -processors and operating systems. The Syntax of the define pragma is:: - - define_pragma ::= curlydot_le "define" colon IDENTIFIER curlydot_ri - - -undef pragma ------------- -The `undef` pragma the counterpart to the define pragma. It undefines a -conditional symbol. Syntax:: - - undef_pragma ::= curlydot_le "undef" colon IDENTIFIER curlydot_ri - - -error pragma ------------- -The `error` pragma is used to make the compiler output an error message with -the given content. Compilation may abort after an error (or not). Syntax:: - - error_pragma ::= curlydot_le "error" colon STRING_LITERAL curlydot_ri - - -fatal pragma ------------- -The `fatal` pragma is used to make the compiler output an error message with -the given content. In contrast to the ``error`` pragma, compilation -is guaranteed to be aborted by this pragma. Syntax:: - - fatal_pragma ::= curlydot_le "fatal" colon STRING_LITERAL curlydot_ri - - -warning pragma --------------- -The `warning` pragma is used to make the compiler output a warning message with -the given content. Compilation continues after the warning. Syntax:: - - warning_pragma ::= curlydot_le "warning" colon STRING_LITERAL curlydot_ri - - -hint pragma ------------ -The `hint` pragma is used to make the compiler output a hint message with -the given content. Compilation continues after the hint. Syntax:: - - - hint_pragma ::= curlydot_le "hint" colon STRING_LITERAL curlydot_ri - - - -compilation option pragmas --------------------------- -The listed pragmas here can be used to override the code generation options -for a section of code. -:: - - "{." pragma: val {pragma: val} ".}" - - -An implementation should provide at least the following possible options (it can -add various others). If an implementation does not recognize the option, a -warning shall be given to the user. - -=============== =============== ============================================ -pragma allowed values description -=============== =============== ============================================ -checks on|off Turns the code generation for all runtime - checks on or off. -bound_checks on|off Turns the code generation for array bound - checks on or off. -overflow_checks on|off Turns the code generation for over- or - underflow checks on or off. -nil_checks on|off Turns the code generation for nil pointer - checks on or off. -assertions on|off Turns the code generation for assertions - on or off. -warnings on|off Turns the warning messages of the compiler - on or off. -hints on|off Turns the hint messages of the compiler - on or off. -optimization none|speed|size Optimize the code for speed or size, or - disable optimization. For non-optimizing - compilers this option has no effect. - Neverless they must parse it properly. -callconv cdecl|... Specifies the default calling convention for - all procedures (and procedure types) that - follow. -=============== =============== ============================================ - -Example:: - - {.checks: off, optimization: speed.} - # compile without runtime checks and optimize for speed - - -push and pop pragmas --------------------- -The push/pop pragmas are very similar to the option directive, -but are used to override the settings temporarily. Example:: - - {.push checks: off.} - # compile this section without runtime checks as it is - # speed critical - # ... some code ... - {.pop.} # restore old settings - - -Annex A: List of conditional symbols -==================================== - -``posix`` is defined on any POSIX compatible operating system. - -+----------------------------+-----------------+ -| Operating System | Symbols | -+============================+=================+ -| AIX | aix, posix | -+----------------------------+-----------------+ -| Compaq Tru64 UNIX | tru64, posix | -+----------------------------+-----------------+ -| Digital UNIX | tru64, posix | -+----------------------------+-----------------+ -| OSF/1 | tru64, posix | -+----------------------------+-----------------+ -| FreeBSD | freebsd, | -| | posix, | -| | bsd | -+----------------------------+-----------------+ -| GNU/Linux | linux, | -| | posix | -+----------------------------+-----------------+ -| HP-UX | hpux, | -| | posix | -+----------------------------+-----------------+ -| Irix | irix, | -| | posix | -+----------------------------+-----------------+ -| MacOS X | macosx, | -| | posix | -+----------------------------+-----------------+ -| NetBSD | netbsd, | -| | posix, | -| | bsd | -+----------------------------+-----------------+ -| OpenBSD | openbsd, | -| | posix, | -| | bsd | -+----------------------------+-----------------+ -| Solaris | solaris, | -| | posix | -+----------------------------+-----------------+ -| Windows (all variants) | windows | -+----------------------------+-----------------+ - - -+----------------------------+-----------------+ -| Processor | Symbols | -+============================+=================+ -| Compaq Alpha | alpha | -+----------------------------+-----------------+ -| HP Precision Architecture | hppa | -+----------------------------+-----------------+ -| INTEL x86 | x86 | -+----------------------------+-----------------+ -| AMD/INTEL x86 64bit | x86_64, | -| | amd64 | -+----------------------------+-----------------+ -| MIPS RISC | mips | -+----------------------------+-----------------+ -| IBM Power PC | powerpc | -+----------------------------+-----------------+ -| SPARC | sparc | -+----------------------------+-----------------+ -| MicroSPARC | sparc | -+----------------------------+-----------------+ -| UltraSPARC | sparc | -+----------------------------+-----------------+ - -On targets for 16, 32 or 64 bit processors the symbols ``cpu16``, ``cpu32`` -or ``cpu64`` shall be defined respectively. On little endian machines the -symbol ``little_endian`` and on big endian ones the symbol ``big_endian`` -are defined. diff --git a/doc/theindex.txt b/doc/theindex.txt index 0c0e621e7..997329242 100644 --- a/doc/theindex.txt +++ b/doc/theindex.txt @@ -1,4873 +1,7470 @@ - -===== -Index -===== - -.. index:: - - - `!=`:idx: - `system.html#235 <system.html#235>`_ - - `$`:idx: - * `system.html#328 <system.html#328>`_ - * `system.html#329 <system.html#329>`_ - * `system.html#330 <system.html#330>`_ - * `system.html#331 <system.html#331>`_ - * `system.html#332 <system.html#332>`_ - * `system.html#333 <system.html#333>`_ - * `system.html#334 <system.html#334>`_ - * `times.html#109 <times.html#109>`_ - * `times.html#110 <times.html#110>`_ - - `%`:idx: - * `strutils.html#129 <strutils.html#129>`_ - * `strutils.html#130 <strutils.html#130>`_ - * `strtabs.html#112 <strtabs.html#112>`_ - - `%%`:idx: - * `system.html#320 <system.html#320>`_ - * `system.html#321 <system.html#321>`_ - - `&`:idx: - * `system.html#245 <system.html#245>`_ - * `system.html#246 <system.html#246>`_ - * `system.html#247 <system.html#247>`_ - * `system.html#248 <system.html#248>`_ - * `system.html#358 <system.html#358>`_ - * `system.html#359 <system.html#359>`_ - * `system.html#360 <system.html#360>`_ - * `system.html#361 <system.html#361>`_ - - `*`:idx: - * `system.html#159 <system.html#159>`_ - * `system.html#178 <system.html#178>`_ - * `system.html#196 <system.html#196>`_ - * `system.html#207 <system.html#207>`_ - * `complex.html#107 <complex.html#107>`_ - - `*%`:idx: - * `system.html#316 <system.html#316>`_ - * `system.html#317 <system.html#317>`_ - - `+`:idx: - * `system.html#154 <system.html#154>`_ - * `system.html#157 <system.html#157>`_ - * `system.html#173 <system.html#173>`_ - * `system.html#176 <system.html#176>`_ - * `system.html#192 <system.html#192>`_ - * `system.html#194 <system.html#194>`_ - * `system.html#208 <system.html#208>`_ - * `complex.html#103 <complex.html#103>`_ - - `+%`:idx: - * `system.html#312 <system.html#312>`_ - * `system.html#313 <system.html#313>`_ - - `-`:idx: - * `system.html#155 <system.html#155>`_ - * `system.html#158 <system.html#158>`_ - * `system.html#174 <system.html#174>`_ - * `system.html#177 <system.html#177>`_ - * `system.html#193 <system.html#193>`_ - * `system.html#195 <system.html#195>`_ - * `system.html#209 <system.html#209>`_ - * `complex.html#104 <complex.html#104>`_ - * `complex.html#105 <complex.html#105>`_ - * `times.html#113 <times.html#113>`_ - - `-%`:idx: - * `system.html#314 <system.html#314>`_ - * `system.html#315 <system.html#315>`_ - - `-+-`:idx: - `system.html#210 <system.html#210>`_ - - `/`:idx: - * `system.html#197 <system.html#197>`_ - * `os.html#117 <os.html#117>`_ - * `complex.html#106 <complex.html#106>`_ - - `/%`:idx: - * `system.html#318 <system.html#318>`_ - * `system.html#319 <system.html#319>`_ - - `/../`:idx: - `os.html#121 <os.html#121>`_ - - `<`:idx: - * `system.html#169 <system.html#169>`_ - * `system.html#188 <system.html#188>`_ - * `system.html#200 <system.html#200>`_ - * `system.html#227 <system.html#227>`_ - * `system.html#228 <system.html#228>`_ - * `system.html#229 <system.html#229>`_ - * `system.html#230 <system.html#230>`_ - * `system.html#231 <system.html#231>`_ - * `system.html#232 <system.html#232>`_ - * `system.html#233 <system.html#233>`_ - * `system.html#234 <system.html#234>`_ - - `<%`:idx: - * `system.html#324 <system.html#324>`_ - * `system.html#325 <system.html#325>`_ - - `<=`:idx: - * `system.html#168 <system.html#168>`_ - * `system.html#187 <system.html#187>`_ - * `system.html#199 <system.html#199>`_ - * `system.html#220 <system.html#220>`_ - * `system.html#221 <system.html#221>`_ - * `system.html#222 <system.html#222>`_ - * `system.html#223 <system.html#223>`_ - * `system.html#224 <system.html#224>`_ - * `system.html#225 <system.html#225>`_ - * `system.html#226 <system.html#226>`_ - - `<=%`:idx: - * `system.html#322 <system.html#322>`_ - * `system.html#323 <system.html#323>`_ - - `==`:idx: - * `system.html#167 <system.html#167>`_ - * `system.html#186 <system.html#186>`_ - * `system.html#198 <system.html#198>`_ - * `system.html#211 <system.html#211>`_ - * `system.html#212 <system.html#212>`_ - * `system.html#213 <system.html#213>`_ - * `system.html#214 <system.html#214>`_ - * `system.html#215 <system.html#215>`_ - * `system.html#216 <system.html#216>`_ - * `system.html#217 <system.html#217>`_ - * `system.html#218 <system.html#218>`_ - * `system.html#219 <system.html#219>`_ - * `system.html#363 <system.html#363>`_ - * `complex.html#102 <complex.html#102>`_ - - `>`:idx: - `system.html#237 <system.html#237>`_ - - `>%`:idx: - `system.html#327 <system.html#327>`_ - - `>=`:idx: - `system.html#236 <system.html#236>`_ - - `>=%`:idx: - `system.html#326 <system.html#326>`_ - - `[]`:idx: - `strtabs.html#107 <strtabs.html#107>`_ - - `[]=`:idx: - `strtabs.html#106 <strtabs.html#106>`_ - - `[ESC]`:idx: - `manual.html#134 <manual.html#134>`_ - - `ABDAY_1`:idx: - `posix.html#400 <posix.html#400>`_ - - `ABDAY_2`:idx: - `posix.html#401 <posix.html#401>`_ - - `ABDAY_3`:idx: - `posix.html#402 <posix.html#402>`_ - - `ABDAY_4`:idx: - `posix.html#403 <posix.html#403>`_ - - `ABDAY_5`:idx: - `posix.html#404 <posix.html#404>`_ - - `ABDAY_6`:idx: - `posix.html#405 <posix.html#405>`_ - - `ABDAY_7`:idx: - `posix.html#406 <posix.html#406>`_ - - `ABMON_1`:idx: - `posix.html#419 <posix.html#419>`_ - - `ABMON_10`:idx: - `posix.html#428 <posix.html#428>`_ - - `ABMON_11`:idx: - `posix.html#429 <posix.html#429>`_ - - `ABMON_12`:idx: - `posix.html#430 <posix.html#430>`_ - - `ABMON_2`:idx: - `posix.html#420 <posix.html#420>`_ - - `ABMON_3`:idx: - `posix.html#421 <posix.html#421>`_ - - `ABMON_4`:idx: - `posix.html#422 <posix.html#422>`_ - - `ABMON_5`:idx: - `posix.html#423 <posix.html#423>`_ - - `ABMON_6`:idx: - `posix.html#424 <posix.html#424>`_ - - `ABMON_7`:idx: - `posix.html#425 <posix.html#425>`_ - - `ABMON_8`:idx: - `posix.html#426 <posix.html#426>`_ - - `ABMON_9`:idx: - `posix.html#427 <posix.html#427>`_ - - `abs`:idx: - * `system.html#170 <system.html#170>`_ - * `system.html#189 <system.html#189>`_ - * `system.html#201 <system.html#201>`_ - * `complex.html#108 <complex.html#108>`_ - - `access`:idx: - `posix.html#959 <posix.html#959>`_ - - `add`:idx: - * `system.html#249 <system.html#249>`_ - * `system.html#250 <system.html#250>`_ - * `system.html#251 <system.html#251>`_ - * `system.html#252 <system.html#252>`_ - * `system.html#253 <system.html#253>`_ - - `addQuitProc`:idx: - `system.html#287 <system.html#287>`_ - - `AIO_ALLDONE`:idx: - `posix.html#204 <posix.html#204>`_ - - `aio_cancel`:idx: - `posix.html#778 <posix.html#778>`_ - - `AIO_CANCELED`:idx: - `posix.html#205 <posix.html#205>`_ - - `aio_error`:idx: - `posix.html#779 <posix.html#779>`_ - - `aio_fsync`:idx: - `posix.html#780 <posix.html#780>`_ - - `AIO_NOTCANCELED`:idx: - `posix.html#206 <posix.html#206>`_ - - `aio_read`:idx: - `posix.html#781 <posix.html#781>`_ - - `aio_return`:idx: - `posix.html#782 <posix.html#782>`_ - - `aio_suspend`:idx: - `posix.html#783 <posix.html#783>`_ - - `aio_write`:idx: - `posix.html#784 <posix.html#784>`_ - - `alarm`:idx: - `posix.html#960 <posix.html#960>`_ - - `alert`:idx: - `manual.html#131 <manual.html#131>`_ - - `allCharsInSet`:idx: - `strutils.html#134 <strutils.html#134>`_ - - `alloc`:idx: - `system.html#296 <system.html#296>`_ - - `alloc0`:idx: - `system.html#297 <system.html#297>`_ - - `ALT_DIGITS`:idx: - `posix.html#435 <posix.html#435>`_ - - `AltSep`:idx: - `os.html#104 <os.html#104>`_ - - `AM_STR`:idx: - `posix.html#391 <posix.html#391>`_ - - `and`:idx: - * `system.html#164 <system.html#164>`_ - * `system.html#183 <system.html#183>`_ - * `system.html#204 <system.html#204>`_ - - `apostrophe`:idx: - `manual.html#129 <manual.html#129>`_ - - `AppendFileExt`:idx: - `os.html#127 <os.html#127>`_ - - `arccos`:idx: - `math.html#115 <math.html#115>`_ - - `arcsin`:idx: - `math.html#116 <math.html#116>`_ - - `arctan`:idx: - `math.html#117 <math.html#117>`_ - - `arctan2`:idx: - `math.html#118 <math.html#118>`_ - - `array`:idx: - `system.html#108 <system.html#108>`_ - - `Arrays`:idx: - `manual.html#153 <manual.html#153>`_ - - `asctime`:idx: - `posix.html#1085 <posix.html#1085>`_ - - `asctime_r`:idx: - `posix.html#1086 <posix.html#1086>`_ - - `assembler`:idx: - `manual.html#197 <manual.html#197>`_ - - `assert`:idx: - `system.html#301 <system.html#301>`_ - - `Automatic type conversion`:idx: - `manual.html#145 <manual.html#145>`_ - - `backslash`:idx: - * `manual.html#127 <manual.html#127>`_ - * `regexprs.html#101 <regexprs.html#101>`_ - - `backspace`:idx: - `manual.html#132 <manual.html#132>`_ - - `basename`:idx: - `posix.html#838 <posix.html#838>`_ - - `BiggestFloat`:idx: - `system.html#257 <system.html#257>`_ - - `BiggestInt`:idx: - `system.html#256 <system.html#256>`_ - - `block`:idx: - `manual.html#193 <manual.html#193>`_ - - `boolean`:idx: - `manual.html#147 <manual.html#147>`_ - - `break`:idx: - `manual.html#194 <manual.html#194>`_ - - `breakpoint`:idx: - `endb.html#103 <endb.html#103>`_ - - `bsd_signal`:idx: - `posix.html#1115 <posix.html#1115>`_ - - `Byte`:idx: - `system.html#112 <system.html#112>`_ - - `C`:idx: - `manual.html#136 <manual.html#136>`_ - - `calling conventions`:idx: - `manual.html#163 <manual.html#163>`_ - - `capitalize`:idx: - `strutils.html#110 <strutils.html#110>`_ - - `card`:idx: - `system.html#151 <system.html#151>`_ - - `carriage return`:idx: - `manual.html#122 <manual.html#122>`_ - - `case`:idx: - `manual.html#181 <manual.html#181>`_ - - `catclose`:idx: - `posix.html#1142 <posix.html#1142>`_ - - `catgets`:idx: - `posix.html#1143 <posix.html#1143>`_ - - `catopen`:idx: - `posix.html#1144 <posix.html#1144>`_ - - `cchar`:idx: - `system.html#258 <system.html#258>`_ - - `cdecl`:idx: - `manual.html#165 <manual.html#165>`_ - - `cdouble`:idx: - `system.html#265 <system.html#265>`_ - - `cfloat`:idx: - `system.html#264 <system.html#264>`_ - - `ChangeFileExt`:idx: - `os.html#128 <os.html#128>`_ - - `character type`:idx: - `manual.html#148 <manual.html#148>`_ - - `character with decimal value d`:idx: - `manual.html#130 <manual.html#130>`_ - - `character with hex value HH`:idx: - `manual.html#135 <manual.html#135>`_ - - `chdir`:idx: - `posix.html#961 <posix.html#961>`_ - - `checked runtime error`:idx: - `manual.html#110 <manual.html#110>`_ - - `chmod`:idx: - `posix.html#1051 <posix.html#1051>`_ - - `ChooseDir`:idx: - `dialogs.html#108 <dialogs.html#108>`_ - - `ChooseFilesToOpen`:idx: - `dialogs.html#106 <dialogs.html#106>`_ - - `ChooseFileToOpen`:idx: - `dialogs.html#105 <dialogs.html#105>`_ - - `ChooseFileToSave`:idx: - `dialogs.html#107 <dialogs.html#107>`_ - - `chown`:idx: - `posix.html#962 <posix.html#962>`_ - - `chr`:idx: - `system.html#153 <system.html#153>`_ - - `cint`:idx: - `system.html#261 <system.html#261>`_ - - `C_IRGRP`:idx: - `posix.html#104 <posix.html#104>`_ - - `C_IROTH`:idx: - `posix.html#107 <posix.html#107>`_ - - `C_IRUSR`:idx: - `posix.html#101 <posix.html#101>`_ - - `C_ISBLK`:idx: - `posix.html#116 <posix.html#116>`_ - - `C_ISCHR`:idx: - `posix.html#117 <posix.html#117>`_ - - `C_ISCTG`:idx: - `posix.html#118 <posix.html#118>`_ - - `C_ISDIR`:idx: - `posix.html#113 <posix.html#113>`_ - - `C_ISFIFO`:idx: - `posix.html#114 <posix.html#114>`_ - - `C_ISGID`:idx: - `posix.html#111 <posix.html#111>`_ - - `C_ISLNK`:idx: - `posix.html#119 <posix.html#119>`_ - - `C_ISREG`:idx: - `posix.html#115 <posix.html#115>`_ - - `C_ISSOCK`:idx: - `posix.html#120 <posix.html#120>`_ - - `C_ISUID`:idx: - `posix.html#110 <posix.html#110>`_ - - `C_ISVTX`:idx: - `posix.html#112 <posix.html#112>`_ - - `C_IWGRP`:idx: - `posix.html#105 <posix.html#105>`_ - - `C_IWOTH`:idx: - `posix.html#108 <posix.html#108>`_ - - `C_IWUSR`:idx: - `posix.html#102 <posix.html#102>`_ - - `C_IXGRP`:idx: - `posix.html#106 <posix.html#106>`_ - - `C_IXOTH`:idx: - `posix.html#109 <posix.html#109>`_ - - `C_IXUSR`:idx: - `posix.html#103 <posix.html#103>`_ - - `classify`:idx: - `math.html#102 <math.html#102>`_ - - `clock`:idx: - `posix.html#1087 <posix.html#1087>`_ - - `clock_getcpuclockid`:idx: - `posix.html#1088 <posix.html#1088>`_ - - `clock_getres`:idx: - `posix.html#1089 <posix.html#1089>`_ - - `clock_gettime`:idx: - `posix.html#1090 <posix.html#1090>`_ - - `CLOCK_MONOTONIC`:idx: - `posix.html#697 <posix.html#697>`_ - - `clock_nanosleep`:idx: - `posix.html#1091 <posix.html#1091>`_ - - `CLOCK_PROCESS_CPUTIME_ID`:idx: - `posix.html#693 <posix.html#693>`_ - - `CLOCK_REALTIME`:idx: - `posix.html#695 <posix.html#695>`_ - - `clock_settime`:idx: - `posix.html#1092 <posix.html#1092>`_ - - `CLOCKS_PER_SEC`:idx: - `posix.html#692 <posix.html#692>`_ - - `CLOCK_THREAD_CPUTIME_ID`:idx: - `posix.html#694 <posix.html#694>`_ - - `clong`:idx: - `system.html#262 <system.html#262>`_ - - `clongdouble`:idx: - `system.html#266 <system.html#266>`_ - - `clonglong`:idx: - `system.html#263 <system.html#263>`_ - - `close`:idx: - * `parsecfg.html#106 <parsecfg.html#106>`_ - * `posix.html#963 <posix.html#963>`_ - - `closedir`:idx: - `posix.html#794 <posix.html#794>`_ - - `CloseFile`:idx: - `system.html#378 <system.html#378>`_ - - `closure`:idx: - `manual.html#170 <manual.html#170>`_ - - `cmp`:idx: - * `system.html#243 <system.html#243>`_ - * `system.html#244 <system.html#244>`_ - - `cmpIgnoreCase`:idx: - `strutils.html#119 <strutils.html#119>`_ - - `cmpIgnoreStyle`:idx: - `strutils.html#120 <strutils.html#120>`_ - - `cmpPaths`:idx: - `os.html#126 <os.html#126>`_ - - `CODESET`:idx: - `posix.html#386 <posix.html#386>`_ - - `comment pieces`:idx: - `manual.html#115 <manual.html#115>`_ - - `Comments`:idx: - `manual.html#114 <manual.html#114>`_ - - `CompileDate`:idx: - `system.html#275 <system.html#275>`_ - - `CompileTime`:idx: - `system.html#276 <system.html#276>`_ - - `complex statements`:idx: - `manual.html#175 <manual.html#175>`_ - - `confstr`:idx: - `posix.html#964 <posix.html#964>`_ - - `const`:idx: - `manual.html#179 <manual.html#179>`_ - - `constant expressions`:idx: - `manual.html#108 <manual.html#108>`_ - - `Constants`:idx: - `manual.html#140 <manual.html#140>`_ - - `continue`:idx: - `manual.html#196 <manual.html#196>`_ - - `copy`:idx: - * `system.html#288 <system.html#288>`_ - * `system.html#289 <system.html#289>`_ - - `copyFile`:idx: - `os.html#131 <os.html#131>`_ - - `copyMem`:idx: - `system.html#293 <system.html#293>`_ - - `cos`:idx: - `math.html#119 <math.html#119>`_ - - `cosh`:idx: - `math.html#120 <math.html#120>`_ - - `countBits`:idx: - `math.html#105 <math.html#105>`_ - - `countdown`:idx: - `system.html#344 <system.html#344>`_ - - `countup`:idx: - `system.html#345 <system.html#345>`_ - - `cpuEndian`:idx: - `system.html#281 <system.html#281>`_ - - `creat`:idx: - `posix.html#805 <posix.html#805>`_ - - `createDir`:idx: - `os.html#135 <os.html#135>`_ - - `CRNCYSTR`:idx: - `posix.html#440 <posix.html#440>`_ - - `crypt`:idx: - `posix.html#965 <posix.html#965>`_ - - `cschar`:idx: - `system.html#259 <system.html#259>`_ - - `cshort`:idx: - `system.html#260 <system.html#260>`_ - - `cSIG_HOLD`:idx: - `posix.html#718 <posix.html#718>`_ - - `CS_PATH`:idx: - `posix.html#479 <posix.html#479>`_ - - `CS_POSIX_V6_ILP32_OFF32_CFLAGS`:idx: - `posix.html#480 <posix.html#480>`_ - - `CS_POSIX_V6_ILP32_OFF32_LDFLAGS`:idx: - `posix.html#481 <posix.html#481>`_ - - `CS_POSIX_V6_ILP32_OFF32_LIBS`:idx: - `posix.html#482 <posix.html#482>`_ - - `CS_POSIX_V6_ILP32_OFFBIG_CFLAGS`:idx: - `posix.html#483 <posix.html#483>`_ - - `CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS`:idx: - `posix.html#484 <posix.html#484>`_ - - `CS_POSIX_V6_ILP32_OFFBIG_LIBS`:idx: - `posix.html#485 <posix.html#485>`_ - - `CS_POSIX_V6_LP64_OFF64_CFLAGS`:idx: - `posix.html#486 <posix.html#486>`_ - - `CS_POSIX_V6_LP64_OFF64_LDFLAGS`:idx: - `posix.html#487 <posix.html#487>`_ - - `CS_POSIX_V6_LP64_OFF64_LIBS`:idx: - `posix.html#488 <posix.html#488>`_ - - `CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS`:idx: - `posix.html#489 <posix.html#489>`_ - - `CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS`:idx: - `posix.html#490 <posix.html#490>`_ - - `CS_POSIX_V6_LPBIG_OFFBIG_LIBS`:idx: - `posix.html#491 <posix.html#491>`_ - - `CS_POSIX_V6_WIDTH_RESTRICTED_ENVS`:idx: - `posix.html#492 <posix.html#492>`_ - - `cstringArray`:idx: - `system.html#267 <system.html#267>`_ - - `ctermid`:idx: - `posix.html#966 <posix.html#966>`_ - - `ctime`:idx: - `posix.html#1093 <posix.html#1093>`_ - - `ctime_r`:idx: - `posix.html#1094 <posix.html#1094>`_ - - `CurDir`:idx: - `os.html#101 <os.html#101>`_ - - `dangling else problem`:idx: - `manual.html#176 <manual.html#176>`_ - - `DAY_1`:idx: - `posix.html#393 <posix.html#393>`_ - - `DAY_2`:idx: - `posix.html#394 <posix.html#394>`_ - - `DAY_3`:idx: - `posix.html#395 <posix.html#395>`_ - - `DAY_4`:idx: - `posix.html#396 <posix.html#396>`_ - - `DAY_5`:idx: - `posix.html#397 <posix.html#397>`_ - - `DAY_6`:idx: - `posix.html#398 <posix.html#398>`_ - - `DAY_7`:idx: - `posix.html#399 <posix.html#399>`_ - - `daylight`:idx: - `posix.html#698 <posix.html#698>`_ - - `dbgLineHook`:idx: - `system.html#340 <system.html#340>`_ - - `dealloc`:idx: - `system.html#299 <system.html#299>`_ - - `debugger`:idx: - `nimrodc.html#108 <nimrodc.html#108>`_ - - `dec`:idx: - `system.html#144 <system.html#144>`_ - - `define`:idx: - `manual.html#223 <manual.html#223>`_ - - `defined`:idx: - `system.html#101 <system.html#101>`_ - - `deinitBaseLexer`:idx: - `lexbase.html#106 <lexbase.html#106>`_ - - `deleteStr`:idx: - `strutils.html#115 <strutils.html#115>`_ - - `D_FMT`:idx: - `posix.html#388 <posix.html#388>`_ - - `difftime`:idx: - `posix.html#1095 <posix.html#1095>`_ - - `dirname`:idx: - `posix.html#839 <posix.html#839>`_ - - `DirSep`:idx: - `os.html#103 <os.html#103>`_ - - `discard`:idx: - `manual.html#177 <manual.html#177>`_ - - `div`:idx: - * `system.html#160 <system.html#160>`_ - * `system.html#179 <system.html#179>`_ - - `dlclose`:idx: - `posix.html#801 <posix.html#801>`_ - - `dlerror`:idx: - `posix.html#802 <posix.html#802>`_ - - `dlopen`:idx: - `posix.html#803 <posix.html#803>`_ - - `dlsym`:idx: - `posix.html#804 <posix.html#804>`_ - - `dom`:idx: - `nimrodc.html#116 <nimrodc.html#116>`_ - - `domain specific languages`:idx: - `manual.html#212 <manual.html#212>`_ - - `D_T_FMT`:idx: - `posix.html#387 <posix.html#387>`_ - - `dup`:idx: - `posix.html#967 <posix.html#967>`_ - - `dup2`:idx: - `posix.html#968 <posix.html#968>`_ - - `dynamic type`:idx: - `manual.html#104 <manual.html#104>`_ - - `E2BIG`:idx: - `posix.html#217 <posix.html#217>`_ - - `EACCES`:idx: - `posix.html#218 <posix.html#218>`_ - - `EAccessViolation`:idx: - `system.html#127 <system.html#127>`_ - - `EADDRINUSE`:idx: - `posix.html#219 <posix.html#219>`_ - - `EADDRNOTAVAIL`:idx: - `posix.html#220 <posix.html#220>`_ - - `EAFNOSUPPORT`:idx: - `posix.html#221 <posix.html#221>`_ - - `EAGAIN`:idx: - `posix.html#222 <posix.html#222>`_ - - `EALREADY`:idx: - `posix.html#223 <posix.html#223>`_ - - `EArithmetic`:idx: - `system.html#124 <system.html#124>`_ - - `EAssertionFailed`:idx: - `system.html#128 <system.html#128>`_ - - `EAsynch`:idx: - `system.html#118 <system.html#118>`_ - - `EBADF`:idx: - `posix.html#224 <posix.html#224>`_ - - `EBADMSG`:idx: - `posix.html#225 <posix.html#225>`_ - - `E_Base`:idx: - `system.html#117 <system.html#117>`_ - - `EBUSY`:idx: - `posix.html#226 <posix.html#226>`_ - - `ECANCELED`:idx: - `posix.html#227 <posix.html#227>`_ - - `ECHILD`:idx: - `posix.html#228 <posix.html#228>`_ - - `echo`:idx: - `system.html#371 <system.html#371>`_ - - `ECMAScript`:idx: - `nimrodc.html#111 <nimrodc.html#111>`_ - - `ECONNABORTED`:idx: - `posix.html#229 <posix.html#229>`_ - - `ECONNREFUSED`:idx: - `posix.html#230 <posix.html#230>`_ - - `ECONNRESET`:idx: - `posix.html#231 <posix.html#231>`_ - - `EControlC`:idx: - `system.html#129 <system.html#129>`_ - - `EDEADLK`:idx: - `posix.html#232 <posix.html#232>`_ - - `EDESTADDRREQ`:idx: - `posix.html#233 <posix.html#233>`_ - - `EDivByZero`:idx: - `system.html#125 <system.html#125>`_ - - `EDOM`:idx: - `posix.html#234 <posix.html#234>`_ - - `EDQUOT`:idx: - `posix.html#235 <posix.html#235>`_ - - `EEXIST`:idx: - `posix.html#236 <posix.html#236>`_ - - `EFAULT`:idx: - `posix.html#237 <posix.html#237>`_ - - `EFBIG`:idx: - `posix.html#238 <posix.html#238>`_ - - `EHOSTUNREACH`:idx: - `posix.html#239 <posix.html#239>`_ - - `EIDRM`:idx: - `posix.html#240 <posix.html#240>`_ - - `EILSEQ`:idx: - `posix.html#241 <posix.html#241>`_ - - `EINPROGRESS`:idx: - `posix.html#242 <posix.html#242>`_ - - `EINTR`:idx: - `posix.html#243 <posix.html#243>`_ - - `EINVAL`:idx: - `posix.html#244 <posix.html#244>`_ - - `EInvalidField`:idx: - `system.html#133 <system.html#133>`_ - - `EInvalidIndex`:idx: - `system.html#132 <system.html#132>`_ - - `EInvalidObjectAssignment`:idx: - `system.html#137 <system.html#137>`_ - - `EInvalidObjectConversion`:idx: - `system.html#138 <system.html#138>`_ - - `EInvalidRegEx`:idx: - `regexprs.html#104 <regexprs.html#104>`_ - - `EInvalidValue`:idx: - * `manual.html#146 <manual.html#146>`_ - * `system.html#130 <system.html#130>`_ - - `EIO`:idx: - * `system.html#121 <system.html#121>`_ - * `posix.html#245 <posix.html#245>`_ - - `EISCONN`:idx: - `posix.html#246 <posix.html#246>`_ - - `EISDIR`:idx: - `posix.html#247 <posix.html#247>`_ - - `ELOOP`:idx: - `posix.html#248 <posix.html#248>`_ - - `Embedded Nimrod Debugger`:idx: - `endb.html#101 <endb.html#101>`_ - - `EMFILE`:idx: - `posix.html#249 <posix.html#249>`_ - - `EMLINK`:idx: - `posix.html#250 <posix.html#250>`_ - - `EMSGSIZE`:idx: - `posix.html#251 <posix.html#251>`_ - - `EMULTIHOP`:idx: - `posix.html#252 <posix.html#252>`_ - - `ENAMETOOLONG`:idx: - `posix.html#253 <posix.html#253>`_ - - `encrypt`:idx: - `posix.html#969 <posix.html#969>`_ - - `ENDB`:idx: - `endb.html#102 <endb.html#102>`_ - - `endgrent`:idx: - `posix.html#832 <posix.html#832>`_ - - `EndOfFile`:idx: - * `system.html#379 <system.html#379>`_ - * `lexbase.html#101 <lexbase.html#101>`_ - - `endpwent`:idx: - `posix.html#856 <posix.html#856>`_ - - `endsWith`:idx: - `strutils.html#133 <strutils.html#133>`_ - - `ENETDOWN`:idx: - `posix.html#254 <posix.html#254>`_ - - `ENETRESET`:idx: - `posix.html#255 <posix.html#255>`_ - - `ENETUNREACH`:idx: - `posix.html#256 <posix.html#256>`_ - - `ENFILE`:idx: - `posix.html#257 <posix.html#257>`_ - - `ENOBUFS`:idx: - `posix.html#258 <posix.html#258>`_ - - `ENODATA`:idx: - `posix.html#259 <posix.html#259>`_ - - `ENODEV`:idx: - `posix.html#260 <posix.html#260>`_ - - `ENOENT`:idx: - `posix.html#261 <posix.html#261>`_ - - `ENoExceptionToReraise`:idx: - * `manual.html#185 <manual.html#185>`_ - * `system.html#136 <system.html#136>`_ - - `ENOEXEC`:idx: - `posix.html#262 <posix.html#262>`_ - - `ENOLCK`:idx: - `posix.html#263 <posix.html#263>`_ - - `ENOLINK`:idx: - `posix.html#264 <posix.html#264>`_ - - `ENOMEM`:idx: - `posix.html#265 <posix.html#265>`_ - - `ENOMSG`:idx: - `posix.html#266 <posix.html#266>`_ - - `ENOPROTOOPT`:idx: - `posix.html#267 <posix.html#267>`_ - - `ENOSPC`:idx: - `posix.html#268 <posix.html#268>`_ - - `ENOSR`:idx: - `posix.html#269 <posix.html#269>`_ - - `ENOSTR`:idx: - `posix.html#270 <posix.html#270>`_ - - `ENOSYS`:idx: - `posix.html#271 <posix.html#271>`_ - - `ENOTCONN`:idx: - `posix.html#272 <posix.html#272>`_ - - `ENOTDIR`:idx: - `posix.html#273 <posix.html#273>`_ - - `ENOTEMPTY`:idx: - `posix.html#274 <posix.html#274>`_ - - `ENOTSOCK`:idx: - `posix.html#275 <posix.html#275>`_ - - `ENOTSUP`:idx: - `posix.html#276 <posix.html#276>`_ - - `ENOTTY`:idx: - `posix.html#277 <posix.html#277>`_ - - `Enumeration`:idx: - `manual.html#149 <manual.html#149>`_ - - `ENXIO`:idx: - `posix.html#278 <posix.html#278>`_ - - `EOPNOTSUPP`:idx: - `posix.html#279 <posix.html#279>`_ - - `EOS`:idx: - `system.html#122 <system.html#122>`_ - - `EOutOfMemory`:idx: - `system.html#131 <system.html#131>`_ - - `EOutOfRange`:idx: - `system.html#134 <system.html#134>`_ - - `EOverflow`:idx: - `system.html#126 <system.html#126>`_ - - `EOVERFLOW`:idx: - `posix.html#280 <posix.html#280>`_ - - `EPERM`:idx: - `posix.html#281 <posix.html#281>`_ - - `EPIPE`:idx: - `posix.html#282 <posix.html#282>`_ - - `EPROTO`:idx: - `posix.html#283 <posix.html#283>`_ - - `EPROTONOSUPPORT`:idx: - `posix.html#284 <posix.html#284>`_ - - `EPROTOTYPE`:idx: - `posix.html#285 <posix.html#285>`_ - - `equalMem`:idx: - `system.html#295 <system.html#295>`_ - - `ERA`:idx: - `posix.html#431 <posix.html#431>`_ - - `ERA_D_FMT`:idx: - `posix.html#432 <posix.html#432>`_ - - `ERA_D_T_FMT`:idx: - `posix.html#433 <posix.html#433>`_ - - `ERANGE`:idx: - `posix.html#286 <posix.html#286>`_ - - `ERA_T_FMT`:idx: - `posix.html#434 <posix.html#434>`_ - - `ERessourceExhausted`:idx: - `system.html#123 <system.html#123>`_ - - `EROFS`:idx: - `posix.html#287 <posix.html#287>`_ - - `errno`:idx: - `posix.html#216 <posix.html#216>`_ - - `error`:idx: - * `manual.html#222 <manual.html#222>`_ - * `manual.html#225 <manual.html#225>`_ - * `dialogs.html#104 <dialogs.html#104>`_ - - `escape`:idx: - `manual.html#133 <manual.html#133>`_ - - `escape sequences`:idx: - `manual.html#120 <manual.html#120>`_ - - `ESPIPE`:idx: - `posix.html#288 <posix.html#288>`_ - - `ESRCH`:idx: - `posix.html#289 <posix.html#289>`_ - - `EStackOverflow`:idx: - `system.html#135 <system.html#135>`_ - - `ESTALE`:idx: - `posix.html#290 <posix.html#290>`_ - - `ESynch`:idx: - `system.html#119 <system.html#119>`_ - - `ESystem`:idx: - `system.html#120 <system.html#120>`_ - - `ETIME`:idx: - `posix.html#291 <posix.html#291>`_ - - `ETIMEDOUT`:idx: - `posix.html#292 <posix.html#292>`_ - - `ETXTBSY`:idx: - `posix.html#293 <posix.html#293>`_ - - `EWOULDBLOCK`:idx: - `posix.html#294 <posix.html#294>`_ - - `except`:idx: - `manual.html#188 <manual.html#188>`_ - - `exception handlers`:idx: - `manual.html#187 <manual.html#187>`_ - - `excl`:idx: - `system.html#150 <system.html#150>`_ - - `EXDEV`:idx: - `posix.html#295 <posix.html#295>`_ - - `execl`:idx: - `posix.html#970 <posix.html#970>`_ - - `execle`:idx: - `posix.html#971 <posix.html#971>`_ - - `execlp`:idx: - `posix.html#972 <posix.html#972>`_ - - `executeProcess`:idx: - `os.html#129 <os.html#129>`_ - - `executeShellCommand`:idx: - `os.html#130 <os.html#130>`_ - - `execv`:idx: - `posix.html#973 <posix.html#973>`_ - - `execve`:idx: - `posix.html#974 <posix.html#974>`_ - - `execvp`:idx: - `posix.html#975 <posix.html#975>`_ - - `existsDir`:idx: - `os.html#136 <os.html#136>`_ - - `existsEnv`:idx: - `os.html#141 <os.html#141>`_ - - `ExistsFile`:idx: - `os.html#115 <os.html#115>`_ - - `exp`:idx: - `math.html#112 <math.html#112>`_ - - `expandFilename`:idx: - `os.html#114 <os.html#114>`_ - - `extractDir`:idx: - `os.html#124 <os.html#124>`_ - - `extractFilename`:idx: - `os.html#125 <os.html#125>`_ - - `ExtSep`:idx: - `os.html#107 <os.html#107>`_ - - `fastcall`:idx: - `manual.html#168 <manual.html#168>`_ - - `fatal`:idx: - `manual.html#226 <manual.html#226>`_ - - `fchdir`:idx: - `posix.html#977 <posix.html#977>`_ - - `fchmod`:idx: - `posix.html#1052 <posix.html#1052>`_ - - `fchown`:idx: - `posix.html#976 <posix.html#976>`_ - - `fcntl`:idx: - `posix.html#806 <posix.html#806>`_ - - `fdatasync`:idx: - `posix.html#978 <posix.html#978>`_ - - `FD_CLOEXEC`:idx: - `posix.html#306 <posix.html#306>`_ - - `FD_CLR`:idx: - `posix.html#1154 <posix.html#1154>`_ - - `FD_ISSET`:idx: - `posix.html#1155 <posix.html#1155>`_ - - `FD_SET`:idx: - `posix.html#1156 <posix.html#1156>`_ - - `FD_SETSIZE`:idx: - `posix.html#771 <posix.html#771>`_ - - `F_DUPFD`:idx: - `posix.html#296 <posix.html#296>`_ - - `FD_ZERO`:idx: - `posix.html#1157 <posix.html#1157>`_ - - `FE_ALL_EXCEPT`:idx: - `posix.html#334 <posix.html#334>`_ - - `feclearexcept`:idx: - `posix.html#810 <posix.html#810>`_ - - `FE_DFL_ENV`:idx: - `posix.html#339 <posix.html#339>`_ - - `FE_DIVBYZERO`:idx: - `posix.html#329 <posix.html#329>`_ - - `FE_DOWNWARD`:idx: - `posix.html#335 <posix.html#335>`_ - - `fegetenv`:idx: - `posix.html#817 <posix.html#817>`_ - - `fegetexceptflag`:idx: - `posix.html#811 <posix.html#811>`_ - - `fegetround`:idx: - `posix.html#815 <posix.html#815>`_ - - `feholdexcept`:idx: - `posix.html#818 <posix.html#818>`_ - - `FE_INEXACT`:idx: - `posix.html#330 <posix.html#330>`_ - - `FE_INVALID`:idx: - `posix.html#331 <posix.html#331>`_ - - `FE_OVERFLOW`:idx: - `posix.html#332 <posix.html#332>`_ - - `feraiseexcept`:idx: - `posix.html#812 <posix.html#812>`_ - - `fesetenv`:idx: - `posix.html#819 <posix.html#819>`_ - - `fesetexceptflag`:idx: - `posix.html#813 <posix.html#813>`_ - - `fesetround`:idx: - `posix.html#816 <posix.html#816>`_ - - `fetestexcept`:idx: - `posix.html#814 <posix.html#814>`_ - - `FE_TONEAREST`:idx: - `posix.html#336 <posix.html#336>`_ - - `FE_TOWARDZERO`:idx: - `posix.html#337 <posix.html#337>`_ - - `FE_UNDERFLOW`:idx: - `posix.html#333 <posix.html#333>`_ - - `feupdateenv`:idx: - `posix.html#820 <posix.html#820>`_ - - `FE_UPWARD`:idx: - `posix.html#338 <posix.html#338>`_ - - `F_GETFD`:idx: - `posix.html#297 <posix.html#297>`_ - - `F_GETFL`:idx: - `posix.html#299 <posix.html#299>`_ - - `F_GETLK`:idx: - `posix.html#301 <posix.html#301>`_ - - `F_GETOWN`:idx: - `posix.html#304 <posix.html#304>`_ - - `fileNewer`:idx: - `os.html#138 <os.html#138>`_ - - `FileSystemCaseSensitive`:idx: - `os.html#106 <os.html#106>`_ - - `finally`:idx: - `manual.html#189 <manual.html#189>`_ - - `find`:idx: - * `regexprs.html#109 <regexprs.html#109>`_ - * `regexprs.html#110 <regexprs.html#110>`_ - - `findSubStr`:idx: - * `strutils.html#112 <strutils.html#112>`_ - * `strutils.html#113 <strutils.html#113>`_ - - `F_LOCK`:idx: - `posix.html#493 <posix.html#493>`_ - - `FlushFile`:idx: - `system.html#381 <system.html#381>`_ - - `fmtmsg`:idx: - `posix.html#821 <posix.html#821>`_ - - `fnmatch`:idx: - `posix.html#822 <posix.html#822>`_ - - `FNM_NOESCAPE`:idx: - `posix.html#362 <posix.html#362>`_ - - `FNM_NOMATCH`:idx: - `posix.html#359 <posix.html#359>`_ - - `FNM_NOSYS`:idx: - `posix.html#363 <posix.html#363>`_ - - `FNM_PATHNAME`:idx: - `posix.html#360 <posix.html#360>`_ - - `FNM_PERIOD`:idx: - `posix.html#361 <posix.html#361>`_ - - `F_OK`:idx: - `posix.html#475 <posix.html#475>`_ - - `for`:idx: - `manual.html#204 <manual.html#204>`_ - - `fork`:idx: - `posix.html#979 <posix.html#979>`_ - - `form feed`:idx: - `manual.html#124 <manual.html#124>`_ - - `forward`:idx: - `manual.html#201 <manual.html#201>`_ - - `fpathconf`:idx: - `posix.html#980 <posix.html#980>`_ - - `F_RDLCK`:idx: - `posix.html#307 <posix.html#307>`_ - - `frexp`:idx: - `math.html#113 <math.html#113>`_ - - `F_SETFD`:idx: - `posix.html#298 <posix.html#298>`_ - - `F_SETFL`:idx: - `posix.html#300 <posix.html#300>`_ - - `F_SETLK`:idx: - `posix.html#302 <posix.html#302>`_ - - `F_SETLKW`:idx: - `posix.html#303 <posix.html#303>`_ - - `F_SETOWN`:idx: - `posix.html#305 <posix.html#305>`_ - - `fstat`:idx: - `posix.html#1053 <posix.html#1053>`_ - - `fstatvfs`:idx: - `posix.html#1050 <posix.html#1050>`_ - - `fsync`:idx: - `posix.html#981 <posix.html#981>`_ - - `F_TEST`:idx: - `posix.html#494 <posix.html#494>`_ - - `F_TLOCK`:idx: - `posix.html#495 <posix.html#495>`_ - - `ftok`:idx: - `posix.html#1048 <posix.html#1048>`_ - - `ftruncate`:idx: - `posix.html#982 <posix.html#982>`_ - - `ftw`:idx: - `posix.html#823 <posix.html#823>`_ - - `FTW_CHDIR`:idx: - `posix.html#374 <posix.html#374>`_ - - `FTW_D`:idx: - `posix.html#365 <posix.html#365>`_ - - `FTW_DEPTH`:idx: - `posix.html#373 <posix.html#373>`_ - - `FTW_DNR`:idx: - `posix.html#366 <posix.html#366>`_ - - `FTW_DP`:idx: - `posix.html#367 <posix.html#367>`_ - - `FTW_F`:idx: - `posix.html#364 <posix.html#364>`_ - - `FTW_MOUNT`:idx: - `posix.html#372 <posix.html#372>`_ - - `FTW_NS`:idx: - `posix.html#368 <posix.html#368>`_ - - `FTW_PHYS`:idx: - `posix.html#371 <posix.html#371>`_ - - `FTW_SL`:idx: - `posix.html#369 <posix.html#369>`_ - - `FTW_SLN`:idx: - `posix.html#370 <posix.html#370>`_ - - `F_ULOCK`:idx: - `posix.html#496 <posix.html#496>`_ - - `functional`:idx: - `manual.html#162 <manual.html#162>`_ - - `F_UNLCK`:idx: - `posix.html#308 <posix.html#308>`_ - - `funtions`:idx: - `manual.html#199 <manual.html#199>`_ - - `F_WRLCK`:idx: - `posix.html#309 <posix.html#309>`_ - - `GC_disable`:idx: - `system.html#364 <system.html#364>`_ - - `GC_disableMarkAndSweep`:idx: - `system.html#370 <system.html#370>`_ - - `GC_enable`:idx: - `system.html#365 <system.html#365>`_ - - `GC_enableMarkAndSweep`:idx: - `system.html#369 <system.html#369>`_ - - `GC_fullCollect`:idx: - `system.html#366 <system.html#366>`_ - - `GC_setStrategy`:idx: - `system.html#368 <system.html#368>`_ - - `generic character types`:idx: - `regexprs.html#102 <regexprs.html#102>`_ - - `Generics`:idx: - `manual.html#208 <manual.html#208>`_ - - `getApplicationDir`:idx: - `os.html#108 <os.html#108>`_ - - `getApplicationFilename`:idx: - `os.html#109 <os.html#109>`_ - - `getClockStr`:idx: - `times.html#112 <times.html#112>`_ - - `getColNumber`:idx: - `lexbase.html#108 <lexbase.html#108>`_ - - `getColumn`:idx: - `parsecfg.html#108 <parsecfg.html#108>`_ - - `getConfigDir`:idx: - `os.html#113 <os.html#113>`_ - - `getcontext`:idx: - `posix.html#1181 <posix.html#1181>`_ - - `getCurrentDir`:idx: - `os.html#110 <os.html#110>`_ - - `getCurrentExceptionMsg`:idx: - * `manual.html#183 <manual.html#183>`_ - * `system.html#336 <system.html#336>`_ - - `getCurrentLine`:idx: - `lexbase.html#107 <lexbase.html#107>`_ - - `getcwd`:idx: - `posix.html#983 <posix.html#983>`_ - - `getdate`:idx: - `posix.html#1096 <posix.html#1096>`_ - - `getDateStr`:idx: - `times.html#111 <times.html#111>`_ - - `getegid`:idx: - `posix.html#984 <posix.html#984>`_ - - `getEnv`:idx: - `os.html#140 <os.html#140>`_ - - `geteuid`:idx: - `posix.html#985 <posix.html#985>`_ - - `getFilename`:idx: - `parsecfg.html#110 <parsecfg.html#110>`_ - - `getFilePos`:idx: - `system.html#401 <system.html#401>`_ - - `getFileSize`:idx: - `system.html#393 <system.html#393>`_ - - `getFreeMem`:idx: - `system.html#342 <system.html#342>`_ - - `getgid`:idx: - `posix.html#986 <posix.html#986>`_ - - `getGMTime`:idx: - `times.html#107 <times.html#107>`_ - - `getgrent`:idx: - `posix.html#831 <posix.html#831>`_ - - `getgrgid`:idx: - `posix.html#827 <posix.html#827>`_ - - `getgrgid_r`:idx: - `posix.html#829 <posix.html#829>`_ - - `getgrnam`:idx: - `posix.html#828 <posix.html#828>`_ - - `getgrnam_r`:idx: - `posix.html#830 <posix.html#830>`_ - - `getgroups`:idx: - `posix.html#987 <posix.html#987>`_ - - `getHomeDir`:idx: - `os.html#112 <os.html#112>`_ - - `gethostid`:idx: - `posix.html#988 <posix.html#988>`_ - - `gethostname`:idx: - `posix.html#989 <posix.html#989>`_ - - `getLastModificationTime`:idx: - `os.html#137 <os.html#137>`_ - - `getLine`:idx: - `parsecfg.html#109 <parsecfg.html#109>`_ - - `getLocalTime`:idx: - `times.html#106 <times.html#106>`_ - - `getlogin`:idx: - `posix.html#990 <posix.html#990>`_ - - `getlogin_r`:idx: - `posix.html#991 <posix.html#991>`_ - - `getOccupiedMem`:idx: - `system.html#341 <system.html#341>`_ - - `getopt`:idx: - * `parseopt.html#106 <parseopt.html#106>`_ - * `posix.html#992 <posix.html#992>`_ - - `getpgid`:idx: - `posix.html#993 <posix.html#993>`_ - - `getpgrp`:idx: - `posix.html#994 <posix.html#994>`_ - - `getpid`:idx: - `posix.html#995 <posix.html#995>`_ - - `getppid`:idx: - `posix.html#996 <posix.html#996>`_ - - `getpwent`:idx: - `posix.html#857 <posix.html#857>`_ - - `getpwnam`:idx: - `posix.html#853 <posix.html#853>`_ - - `getpwuid`:idx: - `posix.html#854 <posix.html#854>`_ - - `getpwuid_r`:idx: - `posix.html#855 <posix.html#855>`_ - - `getRefcount`:idx: - `system.html#335 <system.html#335>`_ - - `getRestOfCommandLine`:idx: - `parseopt.html#105 <parseopt.html#105>`_ - - `getsid`:idx: - `posix.html#997 <posix.html#997>`_ - - `getStartMilsecs`:idx: - `times.html#114 <times.html#114>`_ - - `getTime`:idx: - `times.html#105 <times.html#105>`_ - - `getTotalMem`:idx: - `system.html#343 <system.html#343>`_ - - `getuid`:idx: - `posix.html#998 <posix.html#998>`_ - - `getwd`:idx: - `posix.html#999 <posix.html#999>`_ - - `glob`:idx: - `posix.html#825 <posix.html#825>`_ - - `GLOB_ABORTED`:idx: - `posix.html#382 <posix.html#382>`_ - - `GLOB_APPEND`:idx: - `posix.html#375 <posix.html#375>`_ - - `GLOB_DOOFFS`:idx: - `posix.html#376 <posix.html#376>`_ - - `GLOB_ERR`:idx: - `posix.html#377 <posix.html#377>`_ - - `globfree`:idx: - `posix.html#826 <posix.html#826>`_ - - `GLOB_MARK`:idx: - `posix.html#378 <posix.html#378>`_ - - `GLOB_NOCHECK`:idx: - `posix.html#379 <posix.html#379>`_ - - `GLOB_NOESCAPE`:idx: - `posix.html#380 <posix.html#380>`_ - - `GLOB_NOMATCH`:idx: - `posix.html#383 <posix.html#383>`_ - - `GLOB_NOSORT`:idx: - `posix.html#381 <posix.html#381>`_ - - `GLOB_NOSPACE`:idx: - `posix.html#384 <posix.html#384>`_ - - `GLOB_NOSYS`:idx: - `posix.html#385 <posix.html#385>`_ - - `gmtime`:idx: - `posix.html#1097 <posix.html#1097>`_ - - `gmtime_r`:idx: - `posix.html#1098 <posix.html#1098>`_ - - `HandleCR`:idx: - `lexbase.html#109 <lexbase.html#109>`_ - - `HandleLF`:idx: - `lexbase.html#110 <lexbase.html#110>`_ - - `hash`:idx: - * `hashes.html#103 <hashes.html#103>`_ - * `hashes.html#104 <hashes.html#104>`_ - * `hashes.html#105 <hashes.html#105>`_ - * `hashes.html#106 <hashes.html#106>`_ - * `hashes.html#107 <hashes.html#107>`_ - - `hashData`:idx: - `hashes.html#102 <hashes.html#102>`_ - - `hashIgnoreCase`:idx: - `hashes.html#109 <hashes.html#109>`_ - - `hashIgnoreStyle`:idx: - `hashes.html#108 <hashes.html#108>`_ - - `hasKey`:idx: - `strtabs.html#108 <strtabs.html#108>`_ - - `header`:idx: - `nimrodc.html#103 <nimrodc.html#103>`_ - - `high`:idx: - `system.html#105 <system.html#105>`_ - - `hint`:idx: - * `manual.html#220 <manual.html#220>`_ - * `manual.html#228 <manual.html#228>`_ - - `htonl`:idx: - `posix.html#786 <posix.html#786>`_ - - `htons`:idx: - `posix.html#787 <posix.html#787>`_ - - `hypot`:idx: - `math.html#121 <math.html#121>`_ - - `iconv`:idx: - `posix.html#835 <posix.html#835>`_ - - `iconv_close`:idx: - `posix.html#836 <posix.html#836>`_ - - `iconv_open`:idx: - `posix.html#834 <posix.html#834>`_ - - `identifier`:idx: - `manual.html#105 <manual.html#105>`_ - - `Identifiers`:idx: - `manual.html#116 <manual.html#116>`_ - - `if`:idx: - `manual.html#180 <manual.html#180>`_ - - `implicit block`:idx: - `manual.html#206 <manual.html#206>`_ - - `import`:idx: - `manual.html#216 <manual.html#216>`_ - - `in`:idx: - `system.html#239 <system.html#239>`_ - - `inc`:idx: - `system.html#143 <system.html#143>`_ - - `incl`:idx: - `system.html#149 <system.html#149>`_ - - `indentation sensitive`:idx: - `manual.html#113 <manual.html#113>`_ - - `inet_addr`:idx: - `posix.html#790 <posix.html#790>`_ - - `inet_ntoa`:idx: - `posix.html#791 <posix.html#791>`_ - - `inet_ntop`:idx: - `posix.html#792 <posix.html#792>`_ - - `inet_pton`:idx: - `posix.html#793 <posix.html#793>`_ - - `inf`:idx: - `system.html#337 <system.html#337>`_ - - `info`:idx: - `dialogs.html#102 <dialogs.html#102>`_ - - `information hiding`:idx: - `manual.html#214 <manual.html#214>`_ - - `init`:idx: - `parseopt.html#103 <parseopt.html#103>`_ - - `initBaseLexer`:idx: - `lexbase.html#104 <lexbase.html#104>`_ - - `initBaseLexerFromBuffer`:idx: - `lexbase.html#105 <lexbase.html#105>`_ - - `inline`:idx: - `manual.html#167 <manual.html#167>`_ - - `in_Operator`:idx: - * `strutils.html#121 <strutils.html#121>`_ - * `strutils.html#122 <strutils.html#122>`_ - - `in_Operator`:idx: - `system.html#238 <system.html#238>`_ - - `intToStr`:idx: - `strutils.html#124 <strutils.html#124>`_ - - `IPC_CREAT`:idx: - `posix.html#639 <posix.html#639>`_ - - `IPC_EXCL`:idx: - `posix.html#640 <posix.html#640>`_ - - `IPC_NOWAIT`:idx: - `posix.html#641 <posix.html#641>`_ - - `IPC_PRIVATE`:idx: - `posix.html#642 <posix.html#642>`_ - - `IPC_RMID`:idx: - `posix.html#643 <posix.html#643>`_ - - `IPC_SET`:idx: - `posix.html#644 <posix.html#644>`_ - - `IPC_STAT`:idx: - `posix.html#645 <posix.html#645>`_ - - `is`:idx: - `system.html#241 <system.html#241>`_ - - `isatty`:idx: - `posix.html#1000 <posix.html#1000>`_ - - `isNil`:idx: - * `system.html#352 <system.html#352>`_ - * `system.html#353 <system.html#353>`_ - * `system.html#354 <system.html#354>`_ - * `system.html#355 <system.html#355>`_ - * `system.html#356 <system.html#356>`_ - * `system.html#357 <system.html#357>`_ - - `is_not`:idx: - `system.html#242 <system.html#242>`_ - - `isPowerOfTwo`:idx: - `math.html#103 <math.html#103>`_ - - `items`:idx: - * `system.html#346 <system.html#346>`_ - * `system.html#347 <system.html#347>`_ - * `system.html#348 <system.html#348>`_ - * `system.html#349 <system.html#349>`_ - * `system.html#350 <system.html#350>`_ - * `system.html#351 <system.html#351>`_ - - `iterator`:idx: - `manual.html#205 <manual.html#205>`_ - - `iterOverEnvironment`:idx: - `os.html#145 <os.html#145>`_ - - `JavaScript`:idx: - `nimrodc.html#112 <nimrodc.html#112>`_ - - `JoinPath`:idx: - * `os.html#116 <os.html#116>`_ - * `os.html#118 <os.html#118>`_ - - `keywords`:idx: - `manual.html#117 <manual.html#117>`_ - - `kill`:idx: - `posix.html#1116 <posix.html#1116>`_ - - `killpg`:idx: - `posix.html#1117 <posix.html#1117>`_ - - `l-values`:idx: - `manual.html#107 <manual.html#107>`_ - - `LC_ALL`:idx: - `posix.html#441 <posix.html#441>`_ - - `LC_COLLATE`:idx: - `posix.html#442 <posix.html#442>`_ - - `LC_CTYPE`:idx: - `posix.html#443 <posix.html#443>`_ - - `lchown`:idx: - `posix.html#1001 <posix.html#1001>`_ - - `LC_MESSAGES`:idx: - `posix.html#444 <posix.html#444>`_ - - `LC_MONETARY`:idx: - `posix.html#445 <posix.html#445>`_ - - `LC_NUMERIC`:idx: - `posix.html#446 <posix.html#446>`_ - - `LC_TIME`:idx: - `posix.html#447 <posix.html#447>`_ - - `len`:idx: - * `system.html#145 <system.html#145>`_ - * `system.html#146 <system.html#146>`_ - * `system.html#147 <system.html#147>`_ - * `system.html#148 <system.html#148>`_ - * `strtabs.html#109 <strtabs.html#109>`_ - - `line feed`:idx: - `manual.html#123 <manual.html#123>`_ - - `line_dir`:idx: - `nimrodc.html#105 <nimrodc.html#105>`_ - - `lines`:idx: - `system.html#402 <system.html#402>`_ - - `line_trace`:idx: - `nimrodc.html#107 <nimrodc.html#107>`_ - - `link`:idx: - `posix.html#1002 <posix.html#1002>`_ - - `lio_listio`:idx: - `posix.html#785 <posix.html#785>`_ - - `LIO_NOP`:idx: - `posix.html#207 <posix.html#207>`_ - - `LIO_NOWAIT`:idx: - `posix.html#208 <posix.html#208>`_ - - `LIO_READ`:idx: - `posix.html#209 <posix.html#209>`_ - - `LIO_WAIT`:idx: - `posix.html#210 <posix.html#210>`_ - - `LIO_WRITE`:idx: - `posix.html#211 <posix.html#211>`_ - - `Literal strings`:idx: - `manual.html#119 <manual.html#119>`_ - - `ln`:idx: - `math.html#109 <math.html#109>`_ - - `localeconv`:idx: - `posix.html#840 <posix.html#840>`_ - - `localtime`:idx: - `posix.html#1099 <posix.html#1099>`_ - - `localtime_r`:idx: - `posix.html#1100 <posix.html#1100>`_ - - `locations`:idx: - `manual.html#101 <manual.html#101>`_ - - `lockf`:idx: - `posix.html#1003 <posix.html#1003>`_ - - `log10`:idx: - `math.html#110 <math.html#110>`_ - - `log2`:idx: - `math.html#111 <math.html#111>`_ - - `low`:idx: - `system.html#106 <system.html#106>`_ - - `lseek`:idx: - `posix.html#1004 <posix.html#1004>`_ - - `lstat`:idx: - `posix.html#1054 <posix.html#1054>`_ - - `Macros`:idx: - `manual.html#211 <manual.html#211>`_ - - `makecontext`:idx: - `posix.html#1182 <posix.html#1182>`_ - - `MAP_FAILED`:idx: - `posix.html#683 <posix.html#683>`_ - - `MAP_FIXED`:idx: - `posix.html#677 <posix.html#677>`_ - - `MAP_PRIVATE`:idx: - `posix.html#676 <posix.html#676>`_ - - `MAP_SHARED`:idx: - `posix.html#675 <posix.html#675>`_ - - `match`:idx: - * `regexprs.html#106 <regexprs.html#106>`_ - * `regexprs.html#107 <regexprs.html#107>`_ - - `matchLen`:idx: - `regexprs.html#108 <regexprs.html#108>`_ - - `math`:idx: - `nimrodc.html#114 <nimrodc.html#114>`_ - - `max`:idx: - * `system.html#172 <system.html#172>`_ - * `system.html#191 <system.html#191>`_ - * `system.html#203 <system.html#203>`_ - - `MaxSubpatterns`:idx: - `regexprs.html#105 <regexprs.html#105>`_ - - `MCL_CURRENT`:idx: - `posix.html#681 <posix.html#681>`_ - - `MCL_FUTURE`:idx: - `posix.html#682 <posix.html#682>`_ - - `methods`:idx: - `manual.html#198 <manual.html#198>`_ - - `min`:idx: - * `system.html#171 <system.html#171>`_ - * `system.html#190 <system.html#190>`_ - * `system.html#202 <system.html#202>`_ - - `MINSIGSTKSZ`:idx: - `posix.html#763 <posix.html#763>`_ - - `mkdir`:idx: - `posix.html#1055 <posix.html#1055>`_ - - `mkfifo`:idx: - `posix.html#1056 <posix.html#1056>`_ - - `mknod`:idx: - `posix.html#1057 <posix.html#1057>`_ - - `mktime`:idx: - `posix.html#1101 <posix.html#1101>`_ - - `mlock`:idx: - `posix.html#1071 <posix.html#1071>`_ - - `mlockall`:idx: - `posix.html#1072 <posix.html#1072>`_ - - `mmap`:idx: - `posix.html#1073 <posix.html#1073>`_ - - `MM_APPL`:idx: - `posix.html#343 <posix.html#343>`_ - - `MM_CONSOLE`:idx: - `posix.html#354 <posix.html#354>`_ - - `MM_ERROR`:idx: - `posix.html#349 <posix.html#349>`_ - - `MM_FIRM`:idx: - `posix.html#342 <posix.html#342>`_ - - `MM_HALT`:idx: - `posix.html#348 <posix.html#348>`_ - - `MM_HARD`:idx: - `posix.html#340 <posix.html#340>`_ - - `MM_INFO`:idx: - `posix.html#351 <posix.html#351>`_ - - `MM_NOCON`:idx: - `posix.html#358 <posix.html#358>`_ - - `MM_NOMSG`:idx: - `posix.html#357 <posix.html#357>`_ - - `MM_NOSEV`:idx: - `posix.html#352 <posix.html#352>`_ - - `MM_NOTOK`:idx: - `posix.html#356 <posix.html#356>`_ - - `MM_NRECOV`:idx: - `posix.html#347 <posix.html#347>`_ - - `MM_NULLACT`:idx: - `posix.html#125 <posix.html#125>`_ - - `MM_NULLLBL`:idx: - `posix.html#121 <posix.html#121>`_ - - `MM_NULLMC`:idx: - `posix.html#123 <posix.html#123>`_ - - `MM_NULLSEV`:idx: - `posix.html#122 <posix.html#122>`_ - - `MM_NULLTAG`:idx: - `posix.html#126 <posix.html#126>`_ - - `MM_NULLTXT`:idx: - `posix.html#124 <posix.html#124>`_ - - `MM_OK`:idx: - `posix.html#355 <posix.html#355>`_ - - `MM_OPSYS`:idx: - `posix.html#345 <posix.html#345>`_ - - `MM_PRINT`:idx: - `posix.html#353 <posix.html#353>`_ - - `MM_RECOVER`:idx: - `posix.html#346 <posix.html#346>`_ - - `MM_SOFT`:idx: - `posix.html#341 <posix.html#341>`_ - - `MM_UTIL`:idx: - `posix.html#344 <posix.html#344>`_ - - `MM_WARNING`:idx: - `posix.html#350 <posix.html#350>`_ - - `mod`:idx: - * `system.html#161 <system.html#161>`_ - * `system.html#180 <system.html#180>`_ - - `module`:idx: - `manual.html#213 <manual.html#213>`_ - - `MON_1`:idx: - `posix.html#407 <posix.html#407>`_ - - `MON_10`:idx: - `posix.html#416 <posix.html#416>`_ - - `MON_11`:idx: - `posix.html#417 <posix.html#417>`_ - - `MON_12`:idx: - `posix.html#418 <posix.html#418>`_ - - `MON_2`:idx: - `posix.html#408 <posix.html#408>`_ - - `MON_3`:idx: - `posix.html#409 <posix.html#409>`_ - - `MON_4`:idx: - `posix.html#410 <posix.html#410>`_ - - `MON_5`:idx: - `posix.html#411 <posix.html#411>`_ - - `MON_6`:idx: - `posix.html#412 <posix.html#412>`_ - - `MON_7`:idx: - `posix.html#413 <posix.html#413>`_ - - `MON_8`:idx: - `posix.html#414 <posix.html#414>`_ - - `MON_9`:idx: - `posix.html#415 <posix.html#415>`_ - - `moveFile`:idx: - `os.html#132 <os.html#132>`_ - - `moveMem`:idx: - `system.html#294 <system.html#294>`_ - - `mprotect`:idx: - `posix.html#1074 <posix.html#1074>`_ - - `mq_close`:idx: - `posix.html#843 <posix.html#843>`_ - - `mq_getattr`:idx: - `posix.html#844 <posix.html#844>`_ - - `mq_notify`:idx: - `posix.html#845 <posix.html#845>`_ - - `mq_open`:idx: - `posix.html#846 <posix.html#846>`_ - - `mq_receive`:idx: - `posix.html#847 <posix.html#847>`_ - - `mq_send`:idx: - `posix.html#848 <posix.html#848>`_ - - `mq_setattr`:idx: - `posix.html#849 <posix.html#849>`_ - - `mq_timedreceive`:idx: - `posix.html#850 <posix.html#850>`_ - - `mq_timedsend`:idx: - `posix.html#851 <posix.html#851>`_ - - `mq_unlink`:idx: - `posix.html#852 <posix.html#852>`_ - - `MS_ASYNC`:idx: - `posix.html#678 <posix.html#678>`_ - - `MS_INVALIDATE`:idx: - `posix.html#680 <posix.html#680>`_ - - `MS_SYNC`:idx: - `posix.html#679 <posix.html#679>`_ - - `msync`:idx: - `posix.html#1075 <posix.html#1075>`_ - - `munlock`:idx: - `posix.html#1076 <posix.html#1076>`_ - - `munlockall`:idx: - `posix.html#1077 <posix.html#1077>`_ - - `munmap`:idx: - `posix.html#1078 <posix.html#1078>`_ - - `nan`:idx: - `system.html#339 <system.html#339>`_ - - `nanosleep`:idx: - `posix.html#1102 <posix.html#1102>`_ - - `Natural`:idx: - `system.html#113 <system.html#113>`_ - - `neginf`:idx: - `system.html#338 <system.html#338>`_ - - `new`:idx: - * `system.html#103 <system.html#103>`_ - * `system.html#104 <system.html#104>`_ - - `newline`:idx: - `manual.html#121 <manual.html#121>`_ - - `NewLines`:idx: - `lexbase.html#102 <lexbase.html#102>`_ - - `newString`:idx: - `system.html#291 <system.html#291>`_ - - `newStringTable`:idx: - * `strtabs.html#104 <strtabs.html#104>`_ - * `strtabs.html#105 <strtabs.html#105>`_ - - `next`:idx: - * `parseopt.html#104 <parseopt.html#104>`_ - * `parsecfg.html#107 <parsecfg.html#107>`_ - - `nextPowerOfTwo`:idx: - `math.html#104 <math.html#104>`_ - - `nftw`:idx: - `posix.html#824 <posix.html#824>`_ - - `nice`:idx: - `posix.html#1005 <posix.html#1005>`_ - - `nimcall`:idx: - `manual.html#169 <manual.html#169>`_ - - `NimrodMajor`:idx: - `system.html#278 <system.html#278>`_ - - `NimrodMinor`:idx: - `system.html#279 <system.html#279>`_ - - `NimrodPatch`:idx: - `system.html#280 <system.html#280>`_ - - `NimrodVersion`:idx: - `system.html#277 <system.html#277>`_ - - `nl`:idx: - `strutils.html#104 <strutils.html#104>`_ - - `NL_CAT_LOCALE`:idx: - `posix.html#766 <posix.html#766>`_ - - `nl_langinfo`:idx: - `posix.html#837 <posix.html#837>`_ - - `NL_SETD`:idx: - `posix.html#765 <posix.html#765>`_ - - `noconv`:idx: - `manual.html#172 <manual.html#172>`_ - - `no_decl`:idx: - `nimrodc.html#101 <nimrodc.html#101>`_ - - `NOEXPR`:idx: - `posix.html#439 <posix.html#439>`_ - - `normalize`:idx: - `strutils.html#111 <strutils.html#111>`_ - - `no_static`:idx: - `nimrodc.html#104 <nimrodc.html#104>`_ - - `not`:idx: - * `system.html#102 <system.html#102>`_ - * `system.html#156 <system.html#156>`_ - * `system.html#175 <system.html#175>`_ - - `not_in`:idx: - `system.html#240 <system.html#240>`_ - - `ntohl`:idx: - `posix.html#788 <posix.html#788>`_ - - `ntohs`:idx: - `posix.html#789 <posix.html#789>`_ - - `Numerical constants`:idx: - `manual.html#137 <manual.html#137>`_ - - `O_ACCMODE`:idx: - `posix.html#319 <posix.html#319>`_ - - `O_APPEND`:idx: - `posix.html#314 <posix.html#314>`_ - - `object`:idx: - `manual.html#156 <manual.html#156>`_ - - `O_CREAT`:idx: - `posix.html#310 <posix.html#310>`_ - - `O_DSYNC`:idx: - `posix.html#315 <posix.html#315>`_ - - `O_EXCL`:idx: - `posix.html#311 <posix.html#311>`_ - - `O_NOCTTY`:idx: - `posix.html#312 <posix.html#312>`_ - - `O_NONBLOCK`:idx: - `posix.html#316 <posix.html#316>`_ - - `open`:idx: - `posix.html#807 <posix.html#807>`_ - - `Open`:idx: - `parsecfg.html#104 <parsecfg.html#104>`_ - - `openarray`:idx: - `system.html#109 <system.html#109>`_ - - `opendir`:idx: - `posix.html#795 <posix.html#795>`_ - - `OpenFile`:idx: - `system.html#377 <system.html#377>`_ - - `OpenFromBuffer`:idx: - `parsecfg.html#105 <parsecfg.html#105>`_ - - `operator`:idx: - `manual.html#139 <manual.html#139>`_ - - `Operators`:idx: - `manual.html#203 <manual.html#203>`_ - - `or`:idx: - * `system.html#165 <system.html#165>`_ - * `system.html#184 <system.html#184>`_ - * `system.html#205 <system.html#205>`_ - - `ord`:idx: - `system.html#152 <system.html#152>`_ - - `Ordinal types`:idx: - `manual.html#142 <manual.html#142>`_ - - `O_RDONLY`:idx: - `posix.html#320 <posix.html#320>`_ - - `O_RDWR`:idx: - `posix.html#321 <posix.html#321>`_ - - `O_RSYNC`:idx: - `posix.html#317 <posix.html#317>`_ - - `O_SYNC`:idx: - `posix.html#318 <posix.html#318>`_ - - `O_TRUNC`:idx: - `posix.html#313 <posix.html#313>`_ - - `O_WRONLY`:idx: - `posix.html#322 <posix.html#322>`_ - - `pairs`:idx: - `strtabs.html#110 <strtabs.html#110>`_ - - `P_ALL`:idx: - `posix.html#713 <posix.html#713>`_ - - `paramCount`:idx: - `os.html#142 <os.html#142>`_ - - `paramStr`:idx: - `os.html#143 <os.html#143>`_ - - `ParDir`:idx: - `os.html#102 <os.html#102>`_ - - `parentDir`:idx: - `os.html#120 <os.html#120>`_ - - `ParseBiggestInt`:idx: - `strutils.html#126 <strutils.html#126>`_ - - `ParseFloat`:idx: - `strutils.html#127 <strutils.html#127>`_ - - `ParseInt`:idx: - `strutils.html#125 <strutils.html#125>`_ - - `pathconf`:idx: - `posix.html#1006 <posix.html#1006>`_ - - `PathSep`:idx: - `os.html#105 <os.html#105>`_ - - `pause`:idx: - `posix.html#1007 <posix.html#1007>`_ - - `PC_2_SYMLINKS`:idx: - `posix.html#497 <posix.html#497>`_ - - `PC_ALLOC_SIZE_MIN`:idx: - `posix.html#498 <posix.html#498>`_ - - `PC_ASYNC_IO`:idx: - `posix.html#499 <posix.html#499>`_ - - `PC_CHOWN_RESTRICTED`:idx: - `posix.html#500 <posix.html#500>`_ - - `PC_FILESIZEBITS`:idx: - `posix.html#501 <posix.html#501>`_ - - `PC_LINK_MAX`:idx: - `posix.html#502 <posix.html#502>`_ - - `PC_MAX_CANON`:idx: - `posix.html#503 <posix.html#503>`_ - - `PC_MAX_INPUT`:idx: - `posix.html#504 <posix.html#504>`_ - - `PC_NAME_MAX`:idx: - `posix.html#505 <posix.html#505>`_ - - `PC_NO_TRUNC`:idx: - `posix.html#506 <posix.html#506>`_ - - `PC_PATH_MAX`:idx: - `posix.html#507 <posix.html#507>`_ - - `PC_PIPE_BUF`:idx: - `posix.html#508 <posix.html#508>`_ - - `PC_PRIO_IO`:idx: - `posix.html#509 <posix.html#509>`_ - - `PC_REC_INCR_XFER_SIZE`:idx: - `posix.html#510 <posix.html#510>`_ - - `PC_REC_MIN_XFER_SIZE`:idx: - `posix.html#511 <posix.html#511>`_ - - `PC_REC_XFER_ALIGN`:idx: - `posix.html#512 <posix.html#512>`_ - - `PC_SYMLINK_MAX`:idx: - `posix.html#513 <posix.html#513>`_ - - `PC_SYNC_IO`:idx: - `posix.html#514 <posix.html#514>`_ - - `PC_VDISABLE`:idx: - `posix.html#515 <posix.html#515>`_ - - `PFloat32`:idx: - `system.html#269 <system.html#269>`_ - - `PFloat64`:idx: - `system.html#270 <system.html#270>`_ - - `PInt32`:idx: - `system.html#272 <system.html#272>`_ - - `PInt64`:idx: - `system.html#271 <system.html#271>`_ - - `pipe`:idx: - `posix.html#1008 <posix.html#1008>`_ - - `PM_STR`:idx: - `posix.html#392 <posix.html#392>`_ - - `PObject`:idx: - `system.html#116 <system.html#116>`_ - - `pointers`:idx: - `manual.html#158 <manual.html#158>`_ - - `Positive`:idx: - `system.html#114 <system.html#114>`_ - - `POSIX_ASYNC_IO`:idx: - `posix.html#472 <posix.html#472>`_ - - `POSIX_FADV_DONTNEED`:idx: - `posix.html#327 <posix.html#327>`_ - - `posix_fadvise`:idx: - `posix.html#808 <posix.html#808>`_ - - `POSIX_FADV_NOREUSE`:idx: - `posix.html#328 <posix.html#328>`_ - - `POSIX_FADV_NORMAL`:idx: - `posix.html#323 <posix.html#323>`_ - - `POSIX_FADV_RANDOM`:idx: - `posix.html#325 <posix.html#325>`_ - - `POSIX_FADV_SEQUENTIAL`:idx: - `posix.html#324 <posix.html#324>`_ - - `POSIX_FADV_WILLNEED`:idx: - `posix.html#326 <posix.html#326>`_ - - `posix_fallocate`:idx: - `posix.html#809 <posix.html#809>`_ - - `POSIX_MADV_DONTNEED`:idx: - `posix.html#688 <posix.html#688>`_ - - `posix_madvise`:idx: - `posix.html#1079 <posix.html#1079>`_ - - `POSIX_MADV_NORMAL`:idx: - `posix.html#684 <posix.html#684>`_ - - `POSIX_MADV_RANDOM`:idx: - `posix.html#686 <posix.html#686>`_ - - `POSIX_MADV_SEQUENTIAL`:idx: - `posix.html#685 <posix.html#685>`_ - - `POSIX_MADV_WILLNEED`:idx: - `posix.html#687 <posix.html#687>`_ - - `posix_mem_offset`:idx: - `posix.html#1080 <posix.html#1080>`_ - - `POSIX_PRIO_IO`:idx: - `posix.html#473 <posix.html#473>`_ - - `posix_spawn`:idx: - `posix.html#1160 <posix.html#1160>`_ - - `posix_spawnattr_destroy`:idx: - `posix.html#1166 <posix.html#1166>`_ - - `posix_spawnattr_getflags`:idx: - `posix.html#1168 <posix.html#1168>`_ - - `posix_spawnattr_getpgroup`:idx: - `posix.html#1169 <posix.html#1169>`_ - - `posix_spawnattr_getschedparam`:idx: - `posix.html#1170 <posix.html#1170>`_ - - `posix_spawnattr_getschedpolicy`:idx: - `posix.html#1171 <posix.html#1171>`_ - - `posix_spawnattr_getsigdefault`:idx: - `posix.html#1167 <posix.html#1167>`_ - - `posix_spawnattr_getsigmask`:idx: - `posix.html#1172 <posix.html#1172>`_ - - `posix_spawnattr_init`:idx: - `posix.html#1173 <posix.html#1173>`_ - - `posix_spawnattr_setflags`:idx: - `posix.html#1175 <posix.html#1175>`_ - - `posix_spawnattr_setpgroup`:idx: - `posix.html#1176 <posix.html#1176>`_ - - `posix_spawnattr_setschedparam`:idx: - `posix.html#1177 <posix.html#1177>`_ - - `posix_spawnattr_setschedpolicy`:idx: - `posix.html#1178 <posix.html#1178>`_ - - `posix_spawnattr_setsigdefault`:idx: - `posix.html#1174 <posix.html#1174>`_ - - `posix_spawnattr_setsigmask`:idx: - `posix.html#1179 <posix.html#1179>`_ - - `posix_spawn_file_actions_addclose`:idx: - `posix.html#1161 <posix.html#1161>`_ - - `posix_spawn_file_actions_adddup2`:idx: - `posix.html#1162 <posix.html#1162>`_ - - `posix_spawn_file_actions_addopen`:idx: - `posix.html#1163 <posix.html#1163>`_ - - `posix_spawn_file_actions_destroy`:idx: - `posix.html#1164 <posix.html#1164>`_ - - `posix_spawn_file_actions_init`:idx: - `posix.html#1165 <posix.html#1165>`_ - - `posix_spawnp`:idx: - `posix.html#1180 <posix.html#1180>`_ - - `POSIX_SPAWN_RESETIDS`:idx: - `posix.html#772 <posix.html#772>`_ - - `POSIX_SPAWN_SETPGROUP`:idx: - `posix.html#773 <posix.html#773>`_ - - `POSIX_SPAWN_SETSCHEDPARAM`:idx: - `posix.html#774 <posix.html#774>`_ - - `POSIX_SPAWN_SETSCHEDULER`:idx: - `posix.html#775 <posix.html#775>`_ - - `POSIX_SPAWN_SETSIGDEF`:idx: - `posix.html#776 <posix.html#776>`_ - - `POSIX_SPAWN_SETSIGMASK`:idx: - `posix.html#777 <posix.html#777>`_ - - `POSIX_SYNC_IO`:idx: - `posix.html#474 <posix.html#474>`_ - - `POSIX_TYPED_MEM_ALLOCATE`:idx: - `posix.html#689 <posix.html#689>`_ - - `POSIX_TYPED_MEM_ALLOCATE_CONTIG`:idx: - `posix.html#690 <posix.html#690>`_ - - `posix_typed_mem_get_info`:idx: - `posix.html#1081 <posix.html#1081>`_ - - `POSIX_TYPED_MEM_MAP_ALLOCATABLE`:idx: - `posix.html#691 <posix.html#691>`_ - - `posix_typed_mem_open`:idx: - `posix.html#1082 <posix.html#1082>`_ - - `pow`:idx: - `math.html#125 <math.html#125>`_ - - `P_PGID`:idx: - `posix.html#715 <posix.html#715>`_ - - `P_PID`:idx: - `posix.html#714 <posix.html#714>`_ - - `pread`:idx: - `posix.html#1009 <posix.html#1009>`_ - - `pred`:idx: - `system.html#142 <system.html#142>`_ - - `procedural type`:idx: - `manual.html#161 <manual.html#161>`_ - - `procedures`:idx: - `manual.html#200 <manual.html#200>`_ - - `PROT_EXEC`:idx: - `posix.html#673 <posix.html#673>`_ - - `PROT_NONE`:idx: - `posix.html#674 <posix.html#674>`_ - - `PROT_READ`:idx: - `posix.html#671 <posix.html#671>`_ - - `PROT_WRITE`:idx: - `posix.html#672 <posix.html#672>`_ - - `pselect`:idx: - `posix.html#1158 <posix.html#1158>`_ - - `PStringTable`:idx: - `strtabs.html#103 <strtabs.html#103>`_ - - `pthread_atfork`:idx: - `posix.html#860 <posix.html#860>`_ - - `pthread_attr_destroy`:idx: - `posix.html#861 <posix.html#861>`_ - - `pthread_attr_getdetachstate`:idx: - `posix.html#862 <posix.html#862>`_ - - `pthread_attr_getguardsize`:idx: - `posix.html#863 <posix.html#863>`_ - - `pthread_attr_getinheritsched`:idx: - `posix.html#864 <posix.html#864>`_ - - `pthread_attr_getschedparam`:idx: - `posix.html#865 <posix.html#865>`_ - - `pthread_attr_getschedpolicy`:idx: - `posix.html#866 <posix.html#866>`_ - - `pthread_attr_getscope`:idx: - `posix.html#867 <posix.html#867>`_ - - `pthread_attr_getstack`:idx: - `posix.html#868 <posix.html#868>`_ - - `pthread_attr_getstackaddr`:idx: - `posix.html#869 <posix.html#869>`_ - - `pthread_attr_getstacksize`:idx: - `posix.html#870 <posix.html#870>`_ - - `pthread_attr_init`:idx: - `posix.html#871 <posix.html#871>`_ - - `pthread_attr_setdetachstate`:idx: - `posix.html#872 <posix.html#872>`_ - - `pthread_attr_setguardsize`:idx: - `posix.html#873 <posix.html#873>`_ - - `pthread_attr_setinheritsched`:idx: - `posix.html#874 <posix.html#874>`_ - - `pthread_attr_setschedparam`:idx: - `posix.html#875 <posix.html#875>`_ - - `pthread_attr_setschedpolicy`:idx: - `posix.html#876 <posix.html#876>`_ - - `pthread_attr_setscope`:idx: - `posix.html#877 <posix.html#877>`_ - - `pthread_attr_setstack`:idx: - `posix.html#878 <posix.html#878>`_ - - `pthread_attr_setstackaddr`:idx: - `posix.html#879 <posix.html#879>`_ - - `pthread_attr_setstacksize`:idx: - `posix.html#880 <posix.html#880>`_ - - `pthread_barrierattr_destroy`:idx: - `posix.html#884 <posix.html#884>`_ - - `pthread_barrierattr_getpshared`:idx: - `posix.html#885 <posix.html#885>`_ - - `pthread_barrierattr_init`:idx: - `posix.html#886 <posix.html#886>`_ - - `pthread_barrierattr_setpshared`:idx: - `posix.html#887 <posix.html#887>`_ - - `pthread_barrier_destroy`:idx: - `posix.html#881 <posix.html#881>`_ - - `pthread_barrier_init`:idx: - `posix.html#882 <posix.html#882>`_ - - `PTHREAD_BARRIER_SERIAL_THREAD`:idx: - `posix.html#448 <posix.html#448>`_ - - `pthread_barrier_wait`:idx: - `posix.html#883 <posix.html#883>`_ - - `pthread_cancel`:idx: - `posix.html#888 <posix.html#888>`_ - - `PTHREAD_CANCEL_ASYNCHRONOUS`:idx: - `posix.html#449 <posix.html#449>`_ - - `PTHREAD_CANCEL_DEFERRED`:idx: - `posix.html#451 <posix.html#451>`_ - - `PTHREAD_CANCEL_DISABLE`:idx: - `posix.html#452 <posix.html#452>`_ - - `PTHREAD_CANCELED`:idx: - `posix.html#453 <posix.html#453>`_ - - `PTHREAD_CANCEL_ENABLE`:idx: - `posix.html#450 <posix.html#450>`_ - - `pthread_cleanup_pop`:idx: - `posix.html#890 <posix.html#890>`_ - - `pthread_cleanup_push`:idx: - `posix.html#889 <posix.html#889>`_ - - `pthread_condattr_destroy`:idx: - `posix.html#897 <posix.html#897>`_ - - `pthread_condattr_getclock`:idx: - `posix.html#898 <posix.html#898>`_ - - `pthread_condattr_getpshared`:idx: - `posix.html#899 <posix.html#899>`_ - - `pthread_condattr_init`:idx: - `posix.html#900 <posix.html#900>`_ - - `pthread_condattr_setclock`:idx: - `posix.html#901 <posix.html#901>`_ - - `pthread_condattr_setpshared`:idx: - `posix.html#902 <posix.html#902>`_ - - `pthread_cond_broadcast`:idx: - `posix.html#891 <posix.html#891>`_ - - `pthread_cond_destroy`:idx: - `posix.html#892 <posix.html#892>`_ - - `pthread_cond_init`:idx: - `posix.html#893 <posix.html#893>`_ - - `PTHREAD_COND_INITIALIZER`:idx: - `posix.html#454 <posix.html#454>`_ - - `pthread_cond_signal`:idx: - `posix.html#894 <posix.html#894>`_ - - `pthread_cond_timedwait`:idx: - `posix.html#895 <posix.html#895>`_ - - `pthread_cond_wait`:idx: - `posix.html#896 <posix.html#896>`_ - - `pthread_create`:idx: - `posix.html#903 <posix.html#903>`_ - - `PTHREAD_CREATE_DETACHED`:idx: - `posix.html#455 <posix.html#455>`_ - - `PTHREAD_CREATE_JOINABLE`:idx: - `posix.html#456 <posix.html#456>`_ - - `pthread_detach`:idx: - `posix.html#904 <posix.html#904>`_ - - `pthread_equal`:idx: - `posix.html#905 <posix.html#905>`_ - - `pthread_exit`:idx: - `posix.html#906 <posix.html#906>`_ - - `PTHREAD_EXPLICIT_SCHED`:idx: - `posix.html#457 <posix.html#457>`_ - - `pthread_getconcurrency`:idx: - `posix.html#907 <posix.html#907>`_ - - `pthread_getcpuclockid`:idx: - `posix.html#908 <posix.html#908>`_ - - `pthread_getschedparam`:idx: - `posix.html#909 <posix.html#909>`_ - - `pthread_getspecific`:idx: - `posix.html#910 <posix.html#910>`_ - - `PTHREAD_INHERIT_SCHED`:idx: - `posix.html#458 <posix.html#458>`_ - - `pthread_join`:idx: - `posix.html#911 <posix.html#911>`_ - - `pthread_key_create`:idx: - `posix.html#912 <posix.html#912>`_ - - `pthread_key_delete`:idx: - `posix.html#913 <posix.html#913>`_ - - `pthread_kill`:idx: - `posix.html#1118 <posix.html#1118>`_ - - `pthread_mutexattr_destroy`:idx: - `posix.html#922 <posix.html#922>`_ - - `pthread_mutexattr_getprioceiling`:idx: - `posix.html#923 <posix.html#923>`_ - - `pthread_mutexattr_getprotocol`:idx: - `posix.html#924 <posix.html#924>`_ - - `pthread_mutexattr_getpshared`:idx: - `posix.html#925 <posix.html#925>`_ - - `pthread_mutexattr_gettype`:idx: - `posix.html#926 <posix.html#926>`_ - - `pthread_mutexattr_init`:idx: - `posix.html#927 <posix.html#927>`_ - - `pthread_mutexattr_setprioceiling`:idx: - `posix.html#928 <posix.html#928>`_ - - `pthread_mutexattr_setprotocol`:idx: - `posix.html#929 <posix.html#929>`_ - - `pthread_mutexattr_setpshared`:idx: - `posix.html#930 <posix.html#930>`_ - - `pthread_mutexattr_settype`:idx: - `posix.html#931 <posix.html#931>`_ - - `PTHREAD_MUTEX_DEFAULT`:idx: - `posix.html#459 <posix.html#459>`_ - - `pthread_mutex_destroy`:idx: - `posix.html#914 <posix.html#914>`_ - - `PTHREAD_MUTEX_ERRORCHECK`:idx: - `posix.html#460 <posix.html#460>`_ - - `pthread_mutex_getprioceiling`:idx: - `posix.html#915 <posix.html#915>`_ - - `pthread_mutex_init`:idx: - `posix.html#916 <posix.html#916>`_ - - `PTHREAD_MUTEX_INITIALIZER`:idx: - `posix.html#461 <posix.html#461>`_ - - `pthread_mutex_lock`:idx: - `posix.html#917 <posix.html#917>`_ - - `PTHREAD_MUTEX_NORMAL`:idx: - `posix.html#462 <posix.html#462>`_ - - `PTHREAD_MUTEX_RECURSIVE`:idx: - `posix.html#463 <posix.html#463>`_ - - `pthread_mutex_setprioceiling`:idx: - `posix.html#918 <posix.html#918>`_ - - `pthread_mutex_timedlock`:idx: - `posix.html#919 <posix.html#919>`_ - - `pthread_mutex_trylock`:idx: - `posix.html#920 <posix.html#920>`_ - - `pthread_mutex_unlock`:idx: - `posix.html#921 <posix.html#921>`_ - - `pthread_once`:idx: - `posix.html#932 <posix.html#932>`_ - - `PTHREAD_ONCE_INIT`:idx: - `posix.html#464 <posix.html#464>`_ - - `PTHREAD_PRIO_INHERIT`:idx: - `posix.html#465 <posix.html#465>`_ - - `PTHREAD_PRIO_NONE`:idx: - `posix.html#466 <posix.html#466>`_ - - `PTHREAD_PRIO_PROTECT`:idx: - `posix.html#467 <posix.html#467>`_ - - `PTHREAD_PROCESS_PRIVATE`:idx: - `posix.html#469 <posix.html#469>`_ - - `PTHREAD_PROCESS_SHARED`:idx: - `posix.html#468 <posix.html#468>`_ - - `pthread_rwlockattr_destroy`:idx: - `posix.html#942 <posix.html#942>`_ - - `pthread_rwlockattr_getpshared`:idx: - `posix.html#943 <posix.html#943>`_ - - `pthread_rwlockattr_init`:idx: - `posix.html#944 <posix.html#944>`_ - - `pthread_rwlockattr_setpshared`:idx: - `posix.html#945 <posix.html#945>`_ - - `pthread_rwlock_destroy`:idx: - `posix.html#933 <posix.html#933>`_ - - `pthread_rwlock_init`:idx: - `posix.html#934 <posix.html#934>`_ - - `pthread_rwlock_rdlock`:idx: - `posix.html#935 <posix.html#935>`_ - - `pthread_rwlock_timedrdlock`:idx: - `posix.html#936 <posix.html#936>`_ - - `pthread_rwlock_timedwrlock`:idx: - `posix.html#937 <posix.html#937>`_ - - `pthread_rwlock_tryrdlock`:idx: - `posix.html#938 <posix.html#938>`_ - - `pthread_rwlock_trywrlock`:idx: - `posix.html#939 <posix.html#939>`_ - - `pthread_rwlock_unlock`:idx: - `posix.html#940 <posix.html#940>`_ - - `pthread_rwlock_wrlock`:idx: - `posix.html#941 <posix.html#941>`_ - - `PTHREAD_SCOPE_PROCESS`:idx: - `posix.html#470 <posix.html#470>`_ - - `PTHREAD_SCOPE_SYSTEM`:idx: - `posix.html#471 <posix.html#471>`_ - - `pthread_self`:idx: - `posix.html#946 <posix.html#946>`_ - - `pthread_setcancelstate`:idx: - `posix.html#947 <posix.html#947>`_ - - `pthread_setcanceltype`:idx: - `posix.html#948 <posix.html#948>`_ - - `pthread_setconcurrency`:idx: - `posix.html#949 <posix.html#949>`_ - - `pthread_setschedparam`:idx: - `posix.html#950 <posix.html#950>`_ - - `pthread_setschedprio`:idx: - `posix.html#951 <posix.html#951>`_ - - `pthread_setspecific`:idx: - `posix.html#952 <posix.html#952>`_ - - `pthread_sigmask`:idx: - `posix.html#1119 <posix.html#1119>`_ - - `pthread_spin_destroy`:idx: - `posix.html#953 <posix.html#953>`_ - - `pthread_spin_init`:idx: - `posix.html#954 <posix.html#954>`_ - - `pthread_spin_lock`:idx: - `posix.html#955 <posix.html#955>`_ - - `pthread_spin_trylock`:idx: - `posix.html#956 <posix.html#956>`_ - - `pthread_spin_unlock`:idx: - `posix.html#957 <posix.html#957>`_ - - `pthread_testcancel`:idx: - `posix.html#958 <posix.html#958>`_ - - `push/pop`:idx: - `manual.html#229 <manual.html#229>`_ - - `putEnv`:idx: - `os.html#139 <os.html#139>`_ - - `PWindow`:idx: - `dialogs.html#101 <dialogs.html#101>`_ - - `pwrite`:idx: - `posix.html#1010 <posix.html#1010>`_ - - `quit`:idx: - `system.html#286 <system.html#286>`_ - - `QuitFailure`:idx: - `system.html#274 <system.html#274>`_ - - `QuitSuccess`:idx: - `system.html#273 <system.html#273>`_ - - `quotation mark`:idx: - `manual.html#128 <manual.html#128>`_ - - `quoteIfSpaceExists`:idx: - `strutils.html#135 <strutils.html#135>`_ - - `RADIXCHAR`:idx: - `posix.html#436 <posix.html#436>`_ - - `raise`:idx: - `posix.html#1120 <posix.html#1120>`_ - - `random`:idx: - `math.html#106 <math.html#106>`_ - - `randomize`:idx: - `math.html#107 <math.html#107>`_ - - `range`:idx: - `system.html#107 <system.html#107>`_ - - `re-raised`:idx: - `manual.html#184 <manual.html#184>`_ - - `read`:idx: - `posix.html#1011 <posix.html#1011>`_ - - `readBuffer`:idx: - `system.html#396 <system.html#396>`_ - - `ReadBytes`:idx: - `system.html#394 <system.html#394>`_ - - `readChar`:idx: - `system.html#380 <system.html#380>`_ - - `ReadChars`:idx: - `system.html#395 <system.html#395>`_ - - `readdir`:idx: - `posix.html#796 <posix.html#796>`_ - - `readdir_r`:idx: - `posix.html#797 <posix.html#797>`_ - - `readFile`:idx: - `system.html#382 <system.html#382>`_ - - `readLine`:idx: - `system.html#390 <system.html#390>`_ - - `readlink`:idx: - `posix.html#1012 <posix.html#1012>`_ - - `realloc`:idx: - `system.html#298 <system.html#298>`_ - - `Recursive module dependancies`:idx: - `manual.html#217 <manual.html#217>`_ - - `register`:idx: - `nimrodc.html#110 <nimrodc.html#110>`_ - - `removeDir`:idx: - `os.html#134 <os.html#134>`_ - - `removeFile`:idx: - `os.html#133 <os.html#133>`_ - - `repeatChar`:idx: - `strutils.html#131 <strutils.html#131>`_ - - `replaceStr`:idx: - `strutils.html#114 <strutils.html#114>`_ - - `repr`:idx: - `system.html#254 <system.html#254>`_ - - `result`:idx: - * `manual.html#191 <manual.html#191>`_ - * `manual.html#202 <manual.html#202>`_ - - `return`:idx: - `manual.html#190 <manual.html#190>`_ - - `rewinddir`:idx: - `posix.html#798 <posix.html#798>`_ - - `rmdir`:idx: - `posix.html#1013 <posix.html#1013>`_ - - `R_OK`:idx: - `posix.html#476 <posix.html#476>`_ - - `round`:idx: - `math.html#114 <math.html#114>`_ - - `RTLD_GLOBAL`:idx: - `posix.html#214 <posix.html#214>`_ - - `RTLD_LAZY`:idx: - `posix.html#212 <posix.html#212>`_ - - `RTLD_LOCAL`:idx: - `posix.html#215 <posix.html#215>`_ - - `RTLD_NOW`:idx: - `posix.html#213 <posix.html#213>`_ - - `safe`:idx: - `manual.html#112 <manual.html#112>`_ - - `safecall`:idx: - `manual.html#166 <manual.html#166>`_ - - `sameFile`:idx: - `os.html#144 <os.html#144>`_ - - `SA_NOCLDSTOP`:idx: - `posix.html#751 <posix.html#751>`_ - - `SA_NOCLDWAIT`:idx: - `posix.html#759 <posix.html#759>`_ - - `SA_NODEFER`:idx: - `posix.html#760 <posix.html#760>`_ - - `SA_ONSTACK`:idx: - `posix.html#755 <posix.html#755>`_ - - `SA_RESETHAND`:idx: - `posix.html#756 <posix.html#756>`_ - - `SA_RESTART`:idx: - `posix.html#757 <posix.html#757>`_ - - `SA_SIGINFO`:idx: - `posix.html#758 <posix.html#758>`_ - - `SC_2_C_BIND`:idx: - `posix.html#516 <posix.html#516>`_ - - `SC_2_C_DEV`:idx: - `posix.html#517 <posix.html#517>`_ - - `SC_2_CHAR_TERM`:idx: - `posix.html#518 <posix.html#518>`_ - - `SC_2_FORT_DEV`:idx: - `posix.html#519 <posix.html#519>`_ - - `SC_2_FORT_RUN`:idx: - `posix.html#520 <posix.html#520>`_ - - `SC_2_LOCALEDEF`:idx: - `posix.html#521 <posix.html#521>`_ - - `SC_2_PBS`:idx: - `posix.html#522 <posix.html#522>`_ - - `SC_2_PBS_ACCOUNTING`:idx: - `posix.html#523 <posix.html#523>`_ - - `SC_2_PBS_CHECKPOINT`:idx: - `posix.html#524 <posix.html#524>`_ - - `SC_2_PBS_LOCATE`:idx: - `posix.html#525 <posix.html#525>`_ - - `SC_2_PBS_MESSAGE`:idx: - `posix.html#526 <posix.html#526>`_ - - `SC_2_PBS_TRACK`:idx: - `posix.html#527 <posix.html#527>`_ - - `SC_2_SW_DEV`:idx: - `posix.html#528 <posix.html#528>`_ - - `SC_2_UPE`:idx: - `posix.html#529 <posix.html#529>`_ - - `SC_2_VERSION`:idx: - `posix.html#530 <posix.html#530>`_ - - `SC_ADVISORY_INFO`:idx: - `posix.html#531 <posix.html#531>`_ - - `SC_AIO_LISTIO_MAX`:idx: - `posix.html#532 <posix.html#532>`_ - - `SC_AIO_MAX`:idx: - `posix.html#533 <posix.html#533>`_ - - `SC_AIO_PRIO_DELTA_MAX`:idx: - `posix.html#534 <posix.html#534>`_ - - `SC_ARG_MAX`:idx: - `posix.html#535 <posix.html#535>`_ - - `SC_ASYNCHRONOUS_IO`:idx: - `posix.html#536 <posix.html#536>`_ - - `SC_ATEXIT_MAX`:idx: - `posix.html#537 <posix.html#537>`_ - - `SC_BARRIERS`:idx: - `posix.html#538 <posix.html#538>`_ - - `SC_BC_BASE_MAX`:idx: - `posix.html#539 <posix.html#539>`_ - - `SC_BC_DIM_MAX`:idx: - `posix.html#540 <posix.html#540>`_ - - `SC_BC_SCALE_MAX`:idx: - `posix.html#541 <posix.html#541>`_ - - `SC_BC_STRING_MAX`:idx: - `posix.html#542 <posix.html#542>`_ - - `SC_CHILD_MAX`:idx: - `posix.html#543 <posix.html#543>`_ - - `SC_CLK_TCK`:idx: - `posix.html#544 <posix.html#544>`_ - - `SC_CLOCK_SELECTION`:idx: - `posix.html#545 <posix.html#545>`_ - - `SC_COLL_WEIGHTS_MAX`:idx: - `posix.html#546 <posix.html#546>`_ - - `SC_CPUTIME`:idx: - `posix.html#547 <posix.html#547>`_ - - `SC_DELAYTIMER_MAX`:idx: - `posix.html#548 <posix.html#548>`_ - - `SC_EXPR_NEST_MAX`:idx: - `posix.html#549 <posix.html#549>`_ - - `SC_FSYNC`:idx: - `posix.html#550 <posix.html#550>`_ - - `SC_GETGR_R_SIZE_MAX`:idx: - `posix.html#551 <posix.html#551>`_ - - `SC_GETPW_R_SIZE_MAX`:idx: - `posix.html#552 <posix.html#552>`_ - - `SCHED_FIFO`:idx: - `posix.html#767 <posix.html#767>`_ - - `sched_getparam`:idx: - `posix.html#1147 <posix.html#1147>`_ - - `sched_get_priority_max`:idx: - `posix.html#1145 <posix.html#1145>`_ - - `sched_get_priority_min`:idx: - `posix.html#1146 <posix.html#1146>`_ - - `sched_getscheduler`:idx: - `posix.html#1148 <posix.html#1148>`_ - - `SCHED_OTHER`:idx: - `posix.html#770 <posix.html#770>`_ - - `SCHED_RR`:idx: - `posix.html#768 <posix.html#768>`_ - - `sched_rr_get_interval`:idx: - `posix.html#1149 <posix.html#1149>`_ - - `sched_setparam`:idx: - `posix.html#1150 <posix.html#1150>`_ - - `sched_setscheduler`:idx: - `posix.html#1151 <posix.html#1151>`_ - - `SCHED_SPORADIC`:idx: - `posix.html#769 <posix.html#769>`_ - - `sched_yield`:idx: - `posix.html#1152 <posix.html#1152>`_ - - `SC_HOST_NAME_MAX`:idx: - `posix.html#553 <posix.html#553>`_ - - `SC_IOV_MAX`:idx: - `posix.html#554 <posix.html#554>`_ - - `SC_IPV6`:idx: - `posix.html#555 <posix.html#555>`_ - - `SC_JOB_CONTROL`:idx: - `posix.html#556 <posix.html#556>`_ - - `SC_LINE_MAX`:idx: - `posix.html#557 <posix.html#557>`_ - - `SC_LOGIN_NAME_MAX`:idx: - `posix.html#558 <posix.html#558>`_ - - `SC_MAPPED_FILES`:idx: - `posix.html#559 <posix.html#559>`_ - - `SC_MEMLOCK`:idx: - `posix.html#560 <posix.html#560>`_ - - `SC_MEMLOCK_RANGE`:idx: - `posix.html#561 <posix.html#561>`_ - - `SC_MEMORY_PROTECTION`:idx: - `posix.html#562 <posix.html#562>`_ - - `SC_MESSAGE_PASSING`:idx: - `posix.html#563 <posix.html#563>`_ - - `SC_MONOTONIC_CLOCK`:idx: - `posix.html#564 <posix.html#564>`_ - - `SC_MQ_OPEN_MAX`:idx: - `posix.html#565 <posix.html#565>`_ - - `SC_MQ_PRIO_MAX`:idx: - `posix.html#566 <posix.html#566>`_ - - `SC_NGROUPS_MAX`:idx: - `posix.html#567 <posix.html#567>`_ - - `scope`:idx: - * `manual.html#106 <manual.html#106>`_ - * `manual.html#218 <manual.html#218>`_ - - `SC_OPEN_MAX`:idx: - `posix.html#568 <posix.html#568>`_ - - `SC_PAGE_SIZE`:idx: - `posix.html#569 <posix.html#569>`_ - - `SC_PRIORITIZED_IO`:idx: - `posix.html#570 <posix.html#570>`_ - - `SC_PRIORITY_SCHEDULING`:idx: - `posix.html#571 <posix.html#571>`_ - - `SC_RAW_SOCKETS`:idx: - `posix.html#572 <posix.html#572>`_ - - `SC_READER_WRITER_LOCKS`:idx: - `posix.html#574 <posix.html#574>`_ - - `SC_REALTIME_SIGNALS`:idx: - `posix.html#575 <posix.html#575>`_ - - `SC_RE_DUP_MAX`:idx: - `posix.html#573 <posix.html#573>`_ - - `SC_REGEXP`:idx: - `posix.html#576 <posix.html#576>`_ - - `SC_RTSIG_MAX`:idx: - `posix.html#577 <posix.html#577>`_ - - `SC_SAVED_IDS`:idx: - `posix.html#578 <posix.html#578>`_ - - `SC_SEMAPHORES`:idx: - `posix.html#581 <posix.html#581>`_ - - `SC_SEM_NSEMS_MAX`:idx: - `posix.html#579 <posix.html#579>`_ - - `SC_SEM_VALUE_MAX`:idx: - `posix.html#580 <posix.html#580>`_ - - `SC_SHARED_MEMORY_OBJECTS`:idx: - `posix.html#582 <posix.html#582>`_ - - `SC_SHELL`:idx: - `posix.html#583 <posix.html#583>`_ - - `SC_SIGQUEUE_MAX`:idx: - `posix.html#584 <posix.html#584>`_ - - `SC_SPAWN`:idx: - `posix.html#585 <posix.html#585>`_ - - `SC_SPIN_LOCKS`:idx: - `posix.html#586 <posix.html#586>`_ - - `SC_SPORADIC_SERVER`:idx: - `posix.html#587 <posix.html#587>`_ - - `SC_SS_REPL_MAX`:idx: - `posix.html#588 <posix.html#588>`_ - - `SC_STREAM_MAX`:idx: - `posix.html#589 <posix.html#589>`_ - - `SC_SYMLOOP_MAX`:idx: - `posix.html#590 <posix.html#590>`_ - - `SC_SYNCHRONIZED_IO`:idx: - `posix.html#591 <posix.html#591>`_ - - `SC_THREAD_ATTR_STACKADDR`:idx: - `posix.html#592 <posix.html#592>`_ - - `SC_THREAD_ATTR_STACKSIZE`:idx: - `posix.html#593 <posix.html#593>`_ - - `SC_THREAD_CPUTIME`:idx: - `posix.html#594 <posix.html#594>`_ - - `SC_THREAD_DESTRUCTOR_ITERATIONS`:idx: - `posix.html#595 <posix.html#595>`_ - - `SC_THREAD_KEYS_MAX`:idx: - `posix.html#596 <posix.html#596>`_ - - `SC_THREAD_PRIO_INHERIT`:idx: - `posix.html#597 <posix.html#597>`_ - - `SC_THREAD_PRIO_PROTECT`:idx: - `posix.html#598 <posix.html#598>`_ - - `SC_THREAD_PRIORITY_SCHEDULING`:idx: - `posix.html#599 <posix.html#599>`_ - - `SC_THREAD_PROCESS_SHARED`:idx: - `posix.html#600 <posix.html#600>`_ - - `SC_THREADS`:idx: - `posix.html#605 <posix.html#605>`_ - - `SC_THREAD_SAFE_FUNCTIONS`:idx: - `posix.html#601 <posix.html#601>`_ - - `SC_THREAD_SPORADIC_SERVER`:idx: - `posix.html#602 <posix.html#602>`_ - - `SC_THREAD_STACK_MIN`:idx: - `posix.html#603 <posix.html#603>`_ - - `SC_THREAD_THREADS_MAX`:idx: - `posix.html#604 <posix.html#604>`_ - - `SC_TIMEOUTS`:idx: - `posix.html#606 <posix.html#606>`_ - - `SC_TIMER_MAX`:idx: - `posix.html#607 <posix.html#607>`_ - - `SC_TIMERS`:idx: - `posix.html#608 <posix.html#608>`_ - - `SC_TRACE`:idx: - `posix.html#609 <posix.html#609>`_ - - `SC_TRACE_EVENT_FILTER`:idx: - `posix.html#610 <posix.html#610>`_ - - `SC_TRACE_EVENT_NAME_MAX`:idx: - `posix.html#611 <posix.html#611>`_ - - `SC_TRACE_INHERIT`:idx: - `posix.html#612 <posix.html#612>`_ - - `SC_TRACE_LOG`:idx: - `posix.html#613 <posix.html#613>`_ - - `SC_TRACE_NAME_MAX`:idx: - `posix.html#614 <posix.html#614>`_ - - `SC_TRACE_SYS_MAX`:idx: - `posix.html#615 <posix.html#615>`_ - - `SC_TRACE_USER_EVENT_MAX`:idx: - `posix.html#616 <posix.html#616>`_ - - `SC_TTY_NAME_MAX`:idx: - `posix.html#617 <posix.html#617>`_ - - `SC_TYPED_MEMORY_OBJECTS`:idx: - `posix.html#618 <posix.html#618>`_ - - `SC_TZNAME_MAX`:idx: - `posix.html#619 <posix.html#619>`_ - - `SC_V6_ILP32_OFF32`:idx: - `posix.html#620 <posix.html#620>`_ - - `SC_V6_ILP32_OFFBIG`:idx: - `posix.html#621 <posix.html#621>`_ - - `SC_V6_LP64_OFF64`:idx: - `posix.html#622 <posix.html#622>`_ - - `SC_V6_LPBIG_OFFBIG`:idx: - `posix.html#623 <posix.html#623>`_ - - `SC_VERSION`:idx: - `posix.html#624 <posix.html#624>`_ - - `SC_XBS5_ILP32_OFF32`:idx: - `posix.html#625 <posix.html#625>`_ - - `SC_XBS5_ILP32_OFFBIG`:idx: - `posix.html#626 <posix.html#626>`_ - - `SC_XBS5_LP64_OFF64`:idx: - `posix.html#627 <posix.html#627>`_ - - `SC_XBS5_LPBIG_OFFBIG`:idx: - `posix.html#628 <posix.html#628>`_ - - `SC_XOPEN_CRYPT`:idx: - `posix.html#629 <posix.html#629>`_ - - `SC_XOPEN_ENH_I18N`:idx: - `posix.html#630 <posix.html#630>`_ - - `SC_XOPEN_LEGACY`:idx: - `posix.html#631 <posix.html#631>`_ - - `SC_XOPEN_REALTIME`:idx: - `posix.html#632 <posix.html#632>`_ - - `SC_XOPEN_REALTIME_THREADS`:idx: - `posix.html#633 <posix.html#633>`_ - - `SC_XOPEN_SHM`:idx: - `posix.html#634 <posix.html#634>`_ - - `SC_XOPEN_STREAMS`:idx: - `posix.html#635 <posix.html#635>`_ - - `SC_XOPEN_UNIX`:idx: - `posix.html#636 <posix.html#636>`_ - - `SC_XOPEN_VERSION`:idx: - `posix.html#637 <posix.html#637>`_ - - `seekdir`:idx: - `posix.html#799 <posix.html#799>`_ - - `select`:idx: - `posix.html#1159 <posix.html#1159>`_ - - `sem_close`:idx: - `posix.html#1038 <posix.html#1038>`_ - - `sem_destroy`:idx: - `posix.html#1039 <posix.html#1039>`_ - - `SEM_FAILED`:idx: - `posix.html#638 <posix.html#638>`_ - - `sem_getvalue`:idx: - `posix.html#1040 <posix.html#1040>`_ - - `sem_init`:idx: - `posix.html#1041 <posix.html#1041>`_ - - `sem_open`:idx: - `posix.html#1042 <posix.html#1042>`_ - - `sem_post`:idx: - `posix.html#1043 <posix.html#1043>`_ - - `sem_timedwait`:idx: - `posix.html#1044 <posix.html#1044>`_ - - `sem_trywait`:idx: - `posix.html#1045 <posix.html#1045>`_ - - `sem_unlink`:idx: - `posix.html#1046 <posix.html#1046>`_ - - `sem_wait`:idx: - `posix.html#1047 <posix.html#1047>`_ - - `separate compilation`:idx: - `manual.html#215 <manual.html#215>`_ - - `seq`:idx: - `system.html#110 <system.html#110>`_ - - `seqToPtr`:idx: - `system.html#362 <system.html#362>`_ - - `Sequences`:idx: - `manual.html#154 <manual.html#154>`_ - - `set`:idx: - `system.html#111 <system.html#111>`_ - - `set type`:idx: - `manual.html#157 <manual.html#157>`_ - - `setcontext`:idx: - `posix.html#1183 <posix.html#1183>`_ - - `setCurrentDir`:idx: - `os.html#111 <os.html#111>`_ - - `setegid`:idx: - `posix.html#1014 <posix.html#1014>`_ - - `seteuid`:idx: - `posix.html#1015 <posix.html#1015>`_ - - `setFilePos`:idx: - `system.html#400 <system.html#400>`_ - - `setgid`:idx: - `posix.html#1016 <posix.html#1016>`_ - - `setgrent`:idx: - `posix.html#833 <posix.html#833>`_ - - `setLen`:idx: - * `system.html#290 <system.html#290>`_ - * `system.html#300 <system.html#300>`_ - - `setlocale`:idx: - `posix.html#841 <posix.html#841>`_ - - `setpgid`:idx: - `posix.html#1017 <posix.html#1017>`_ - - `setpgrp`:idx: - `posix.html#1018 <posix.html#1018>`_ - - `setpwent`:idx: - `posix.html#858 <posix.html#858>`_ - - `setregid`:idx: - `posix.html#1019 <posix.html#1019>`_ - - `setreuid`:idx: - `posix.html#1020 <posix.html#1020>`_ - - `setsid`:idx: - `posix.html#1021 <posix.html#1021>`_ - - `setuid`:idx: - `posix.html#1022 <posix.html#1022>`_ - - `shl`:idx: - * `system.html#163 <system.html#163>`_ - * `system.html#182 <system.html#182>`_ - - `shm_open`:idx: - `posix.html#1083 <posix.html#1083>`_ - - `shm_unlink`:idx: - `posix.html#1084 <posix.html#1084>`_ - - `shr`:idx: - * `system.html#162 <system.html#162>`_ - * `system.html#181 <system.html#181>`_ - - `S_IFBLK`:idx: - `posix.html#647 <posix.html#647>`_ - - `S_IFCHR`:idx: - `posix.html#648 <posix.html#648>`_ - - `S_IFDIR`:idx: - `posix.html#651 <posix.html#651>`_ - - `S_IFIFO`:idx: - `posix.html#649 <posix.html#649>`_ - - `S_IFLNK`:idx: - `posix.html#652 <posix.html#652>`_ - - `S_IFMT`:idx: - `posix.html#646 <posix.html#646>`_ - - `S_IFREG`:idx: - `posix.html#650 <posix.html#650>`_ - - `S_IFSOCK`:idx: - `posix.html#653 <posix.html#653>`_ - - `SIGABRT`:idx: - `posix.html#723 <posix.html#723>`_ - - `sigaction`:idx: - `posix.html#1121 <posix.html#1121>`_ - - `sigaddset`:idx: - `posix.html#1122 <posix.html#1122>`_ - - `SIGALRM`:idx: - `posix.html#724 <posix.html#724>`_ - - `sigaltstack`:idx: - `posix.html#1123 <posix.html#1123>`_ - - `SIG_BLOCK`:idx: - `posix.html#752 <posix.html#752>`_ - - `SIGBUS`:idx: - `posix.html#725 <posix.html#725>`_ - - `SIGCHLD`:idx: - `posix.html#726 <posix.html#726>`_ - - `SIGCONT`:idx: - `posix.html#727 <posix.html#727>`_ - - `sigdelset`:idx: - `posix.html#1124 <posix.html#1124>`_ - - `SIG_DFL`:idx: - `posix.html#716 <posix.html#716>`_ - - `sigemptyset`:idx: - `posix.html#1125 <posix.html#1125>`_ - - `SIG_ERR`:idx: - `posix.html#717 <posix.html#717>`_ - - `SIGEV_NONE`:idx: - `posix.html#720 <posix.html#720>`_ - - `SIGEV_SIGNAL`:idx: - `posix.html#721 <posix.html#721>`_ - - `SIGEV_THREAD`:idx: - `posix.html#722 <posix.html#722>`_ - - `sigfillset`:idx: - `posix.html#1126 <posix.html#1126>`_ - - `SIGFPE`:idx: - `posix.html#728 <posix.html#728>`_ - - `sighold`:idx: - `posix.html#1127 <posix.html#1127>`_ - - `SIGHUP`:idx: - `posix.html#729 <posix.html#729>`_ - - `SIG_IGN`:idx: - `posix.html#719 <posix.html#719>`_ - - `sigignore`:idx: - `posix.html#1128 <posix.html#1128>`_ - - `SIGILL`:idx: - `posix.html#730 <posix.html#730>`_ - - `SIGINT`:idx: - `posix.html#731 <posix.html#731>`_ - - `siginterrupt`:idx: - `posix.html#1129 <posix.html#1129>`_ - - `sigismember`:idx: - `posix.html#1130 <posix.html#1130>`_ - - `SIGKILL`:idx: - `posix.html#732 <posix.html#732>`_ - - `signal`:idx: - `posix.html#1131 <posix.html#1131>`_ - - `sigpause`:idx: - `posix.html#1132 <posix.html#1132>`_ - - `sigpending`:idx: - `posix.html#1133 <posix.html#1133>`_ - - `SIGPIPE`:idx: - `posix.html#733 <posix.html#733>`_ - - `SIGPOLL`:idx: - `posix.html#743 <posix.html#743>`_ - - `sigprocmask`:idx: - `posix.html#1134 <posix.html#1134>`_ - - `SIGPROF`:idx: - `posix.html#744 <posix.html#744>`_ - - `sigqueue`:idx: - `posix.html#1135 <posix.html#1135>`_ - - `SIGQUIT`:idx: - `posix.html#734 <posix.html#734>`_ - - `sigrelse`:idx: - `posix.html#1136 <posix.html#1136>`_ - - `SIGSEGV`:idx: - `posix.html#735 <posix.html#735>`_ - - `sigset`:idx: - `posix.html#1137 <posix.html#1137>`_ - - `SIG_SETMASK`:idx: - `posix.html#754 <posix.html#754>`_ - - `SIGSTKSZ`:idx: - `posix.html#764 <posix.html#764>`_ - - `SIGSTOP`:idx: - `posix.html#736 <posix.html#736>`_ - - `sigsuspend`:idx: - `posix.html#1138 <posix.html#1138>`_ - - `SIGSYS`:idx: - `posix.html#745 <posix.html#745>`_ - - `SIGTERM`:idx: - `posix.html#737 <posix.html#737>`_ - - `sigtimedwait`:idx: - `posix.html#1139 <posix.html#1139>`_ - - `SIGTRAP`:idx: - `posix.html#746 <posix.html#746>`_ - - `SIGTSTP`:idx: - `posix.html#738 <posix.html#738>`_ - - `SIGTTIN`:idx: - `posix.html#739 <posix.html#739>`_ - - `SIGTTOU`:idx: - `posix.html#740 <posix.html#740>`_ - - `SIG_UNBLOCK`:idx: - `posix.html#753 <posix.html#753>`_ - - `SIGURG`:idx: - `posix.html#747 <posix.html#747>`_ - - `SIGUSR1`:idx: - `posix.html#741 <posix.html#741>`_ - - `SIGUSR2`:idx: - `posix.html#742 <posix.html#742>`_ - - `SIGVTALRM`:idx: - `posix.html#748 <posix.html#748>`_ - - `sigwait`:idx: - `posix.html#1140 <posix.html#1140>`_ - - `sigwaitinfo`:idx: - `posix.html#1141 <posix.html#1141>`_ - - `SIGXCPU`:idx: - `posix.html#749 <posix.html#749>`_ - - `SIGXFSZ`:idx: - `posix.html#750 <posix.html#750>`_ - - `simple assertions`:idx: - `regexprs.html#103 <regexprs.html#103>`_ - - `simple statements`:idx: - `manual.html#174 <manual.html#174>`_ - - `sinh`:idx: - `math.html#122 <math.html#122>`_ - - `S_IRGRP`:idx: - `posix.html#659 <posix.html#659>`_ - - `S_IROTH`:idx: - `posix.html#663 <posix.html#663>`_ - - `S_IRUSR`:idx: - `posix.html#655 <posix.html#655>`_ - - `S_IRWXG`:idx: - `posix.html#658 <posix.html#658>`_ - - `S_IRWXO`:idx: - `posix.html#662 <posix.html#662>`_ - - `S_IRWXU`:idx: - `posix.html#654 <posix.html#654>`_ - - `S_ISBLK`:idx: - `posix.html#1060 <posix.html#1060>`_ - - `S_ISCHR`:idx: - `posix.html#1061 <posix.html#1061>`_ - - `S_ISDIR`:idx: - `posix.html#1062 <posix.html#1062>`_ - - `S_ISFIFO`:idx: - `posix.html#1063 <posix.html#1063>`_ - - `S_ISGID`:idx: - `posix.html#667 <posix.html#667>`_ - - `S_ISLNK`:idx: - `posix.html#1065 <posix.html#1065>`_ - - `S_ISREG`:idx: - `posix.html#1064 <posix.html#1064>`_ - - `S_ISSOCK`:idx: - `posix.html#1066 <posix.html#1066>`_ - - `S_ISUID`:idx: - `posix.html#666 <posix.html#666>`_ - - `S_ISVTX`:idx: - `posix.html#668 <posix.html#668>`_ - - `S_IWGRP`:idx: - `posix.html#660 <posix.html#660>`_ - - `S_IWOTH`:idx: - `posix.html#664 <posix.html#664>`_ - - `S_IWUSR`:idx: - `posix.html#656 <posix.html#656>`_ - - `S_IXGRP`:idx: - `posix.html#661 <posix.html#661>`_ - - `S_IXOTH`:idx: - `posix.html#665 <posix.html#665>`_ - - `S_IXUSR`:idx: - `posix.html#657 <posix.html#657>`_ - - `sizeof`:idx: - `system.html#140 <system.html#140>`_ - - `sleep`:idx: - `posix.html#1023 <posix.html#1023>`_ - - `split`:idx: - `strutils.html#117 <strutils.html#117>`_ - - `SplitFilename`:idx: - `os.html#123 <os.html#123>`_ - - `SplitPath`:idx: - `os.html#119 <os.html#119>`_ - - `splitSeq`:idx: - `strutils.html#118 <strutils.html#118>`_ - - `sqrt`:idx: - * `math.html#108 <math.html#108>`_ - * `complex.html#109 <complex.html#109>`_ - - `SS_DISABLE`:idx: - `posix.html#762 <posix.html#762>`_ - - `SS_ONSTACK`:idx: - `posix.html#761 <posix.html#761>`_ - - `stack_trace`:idx: - `nimrodc.html#106 <nimrodc.html#106>`_ - - `startsWith`:idx: - `strutils.html#132 <strutils.html#132>`_ - - `stat`:idx: - `posix.html#1058 <posix.html#1058>`_ - - `Statements`:idx: - `manual.html#173 <manual.html#173>`_ - - `static error`:idx: - `manual.html#109 <manual.html#109>`_ - - `static type`:idx: - `manual.html#103 <manual.html#103>`_ - - `statvfs`:idx: - `posix.html#1049 <posix.html#1049>`_ - - `stdcall`:idx: - `manual.html#164 <manual.html#164>`_ - - `stderr`:idx: - `system.html#376 <system.html#376>`_ - - `stdin`:idx: - `system.html#374 <system.html#374>`_ - - `stdout`:idx: - `system.html#375 <system.html#375>`_ - - `ST_NOSUID`:idx: - `posix.html#670 <posix.html#670>`_ - - `ST_RDONLY`:idx: - `posix.html#669 <posix.html#669>`_ - - `strerror`:idx: - `posix.html#1153 <posix.html#1153>`_ - - `strfmon`:idx: - `posix.html#842 <posix.html#842>`_ - - `strftime`:idx: - `posix.html#1103 <posix.html#1103>`_ - - `string`:idx: - `manual.html#151 <manual.html#151>`_ - - `strip`:idx: - `strutils.html#105 <strutils.html#105>`_ - - `strptime`:idx: - `posix.html#1104 <posix.html#1104>`_ - - `strStart`:idx: - `strutils.html#103 <strutils.html#103>`_ - - `structured type`:idx: - `manual.html#152 <manual.html#152>`_ - - `strutils`:idx: - `nimrodc.html#113 <nimrodc.html#113>`_ - - `style-insensitive`:idx: - `manual.html#118 <manual.html#118>`_ - - `S_TYPEISMQ`:idx: - `posix.html#1067 <posix.html#1067>`_ - - `S_TYPEISSEM`:idx: - `posix.html#1068 <posix.html#1068>`_ - - `S_TYPEISSHM`:idx: - `posix.html#1069 <posix.html#1069>`_ - - `S_TYPEISTMO`:idx: - `posix.html#1070 <posix.html#1070>`_ - - `subrange`:idx: - `manual.html#150 <manual.html#150>`_ - - `succ`:idx: - `system.html#141 <system.html#141>`_ - - `swab`:idx: - `posix.html#1024 <posix.html#1024>`_ - - `swap`:idx: - `system.html#302 <system.html#302>`_ - - `swapcontext`:idx: - `posix.html#1184 <posix.html#1184>`_ - - `symlink`:idx: - `posix.html#1025 <posix.html#1025>`_ - - `sync`:idx: - `posix.html#1026 <posix.html#1026>`_ - - `syscall`:idx: - `manual.html#171 <manual.html#171>`_ - - `sysconf`:idx: - `posix.html#1027 <posix.html#1027>`_ - - `system`:idx: - `manual.html#219 <manual.html#219>`_ - - `tabulator`:idx: - `manual.html#125 <manual.html#125>`_ - - `TAddress`:idx: - `system.html#255 <system.html#255>`_ - - `Taiocb`:idx: - `posix.html#127 <posix.html#127>`_ - - `tan`:idx: - `math.html#123 <math.html#123>`_ - - `tanh`:idx: - `math.html#124 <math.html#124>`_ - - `TBaseLexer`:idx: - `lexbase.html#103 <lexbase.html#103>`_ - - `Tblkcnt`:idx: - `posix.html#141 <posix.html#141>`_ - - `Tblksize`:idx: - `posix.html#142 <posix.html#142>`_ - - `TCfgEvent`:idx: - `parsecfg.html#102 <parsecfg.html#102>`_ - - `TCfgEventKind`:idx: - `parsecfg.html#101 <parsecfg.html#101>`_ - - `TCfgParser`:idx: - `parsecfg.html#103 <parsecfg.html#103>`_ - - `tcgetpgrp`:idx: - `posix.html#1028 <posix.html#1028>`_ - - `TCharSet`:idx: - `strutils.html#101 <strutils.html#101>`_ - - `TClock`:idx: - `posix.html#143 <posix.html#143>`_ - - `TClockId`:idx: - `posix.html#144 <posix.html#144>`_ - - `TCmdLineKind`:idx: - `parseopt.html#101 <parseopt.html#101>`_ - - `TComplex`:idx: - `complex.html#101 <complex.html#101>`_ - - `tcsetpgrp`:idx: - `posix.html#1029 <posix.html#1029>`_ - - `TDev`:idx: - `posix.html#145 <posix.html#145>`_ - - `TDIR`:idx: - `posix.html#128 <posix.html#128>`_ - - `Tdirent`:idx: - `posix.html#129 <posix.html#129>`_ - - `telldir`:idx: - `posix.html#800 <posix.html#800>`_ - - `template`:idx: - `manual.html#210 <manual.html#210>`_ - - `TEndian`:idx: - `system.html#268 <system.html#268>`_ - - `Tfd_set`:idx: - `posix.html#199 <posix.html#199>`_ - - `Tfenv`:idx: - `posix.html#131 <posix.html#131>`_ - - `Tfexcept`:idx: - `posix.html#132 <posix.html#132>`_ - - `TFile`:idx: - `system.html#372 <system.html#372>`_ - - `TFileMode`:idx: - `system.html#373 <system.html#373>`_ - - `TFloatClass`:idx: - `math.html#101 <math.html#101>`_ - - `Tflock`:idx: - `posix.html#130 <posix.html#130>`_ - - `T_FMT`:idx: - `posix.html#389 <posix.html#389>`_ - - `T_FMT_AMPM`:idx: - `posix.html#390 <posix.html#390>`_ - - `TFormatFlag`:idx: - `strtabs.html#111 <strtabs.html#111>`_ - - `Tfsblkcnt`:idx: - `posix.html#146 <posix.html#146>`_ - - `Tfsfilcnt`:idx: - `posix.html#147 <posix.html#147>`_ - - `TFTW`:idx: - `posix.html#133 <posix.html#133>`_ - - `TGC_Strategy`:idx: - `system.html#367 <system.html#367>`_ - - `TGid`:idx: - `posix.html#148 <posix.html#148>`_ - - `TGlob`:idx: - `posix.html#134 <posix.html#134>`_ - - `TGroup`:idx: - `posix.html#135 <posix.html#135>`_ - - `THash`:idx: - `hashes.html#101 <hashes.html#101>`_ - - `THOUSEP`:idx: - `posix.html#437 <posix.html#437>`_ - - `Ticonv`:idx: - `posix.html#136 <posix.html#136>`_ - - `Tid`:idx: - `posix.html#149 <posix.html#149>`_ - - `time`:idx: - `posix.html#1105 <posix.html#1105>`_ - - `TimeInfoToTime`:idx: - `times.html#108 <times.html#108>`_ - - `TIMER_ABSTIME`:idx: - `posix.html#696 <posix.html#696>`_ - - `timer_create`:idx: - `posix.html#1106 <posix.html#1106>`_ - - `timer_delete`:idx: - `posix.html#1107 <posix.html#1107>`_ - - `timer_getoverrun`:idx: - `posix.html#1109 <posix.html#1109>`_ - - `timer_gettime`:idx: - `posix.html#1108 <posix.html#1108>`_ - - `timer_settime`:idx: - `posix.html#1110 <posix.html#1110>`_ - - `times`:idx: - `nimrodc.html#115 <nimrodc.html#115>`_ - - `timezone`:idx: - `posix.html#699 <posix.html#699>`_ - - `Tino`:idx: - `posix.html#150 <posix.html#150>`_ - - `Tipc_perm`:idx: - `posix.html#180 <posix.html#180>`_ - - `titimerspec`:idx: - `posix.html#186 <posix.html#186>`_ - - `TKey`:idx: - `posix.html#151 <posix.html#151>`_ - - `Tlconv`:idx: - `posix.html#137 <posix.html#137>`_ - - `Tmcontext`:idx: - `posix.html#202 <posix.html#202>`_ - - `TMode`:idx: - `posix.html#152 <posix.html#152>`_ - - `TMonth`:idx: - `times.html#101 <times.html#101>`_ - - `TMqAttr`:idx: - `posix.html#139 <posix.html#139>`_ - - `TMqd`:idx: - `posix.html#138 <posix.html#138>`_ - - `Tnl_catd`:idx: - `posix.html#196 <posix.html#196>`_ - - `TNlink`:idx: - `posix.html#153 <posix.html#153>`_ - - `Tnl_item`:idx: - `posix.html#195 <posix.html#195>`_ - - `toBiggestFloat`:idx: - `system.html#283 <system.html#283>`_ - - `toBiggestInt`:idx: - `system.html#285 <system.html#285>`_ - - `toBin`:idx: - `strutils.html#137 <strutils.html#137>`_ - - `TObject`:idx: - `system.html#115 <system.html#115>`_ - - `TOff`:idx: - `posix.html#154 <posix.html#154>`_ - - `toFloat`:idx: - `system.html#282 <system.html#282>`_ - - `toHex`:idx: - `strutils.html#123 <strutils.html#123>`_ - - `toInt`:idx: - `system.html#284 <system.html#284>`_ - - `toLower`:idx: - * `strutils.html#106 <strutils.html#106>`_ - * `strutils.html#107 <strutils.html#107>`_ - - `toOct`:idx: - `strutils.html#136 <strutils.html#136>`_ - - `toOctal`:idx: - `strutils.html#116 <strutils.html#116>`_ - - `TOptParser`:idx: - `parseopt.html#102 <parseopt.html#102>`_ - - `toString`:idx: - `strutils.html#128 <strutils.html#128>`_ - - `toU16`:idx: - `system.html#310 <system.html#310>`_ - - `toU32`:idx: - `system.html#311 <system.html#311>`_ - - `toU8`:idx: - `system.html#309 <system.html#309>`_ - - `toUpper`:idx: - * `strutils.html#108 <strutils.html#108>`_ - * `strutils.html#109 <strutils.html#109>`_ - - `TPasswd`:idx: - `posix.html#140 <posix.html#140>`_ - - `TPid`:idx: - `posix.html#155 <posix.html#155>`_ - - `Tposix_spawnattr`:idx: - `posix.html#200 <posix.html#200>`_ - - `Tposix_spawn_file_actions`:idx: - `posix.html#201 <posix.html#201>`_ - - `Tposix_typed_mem_info`:idx: - `posix.html#183 <posix.html#183>`_ - - `Tpthread`:idx: - `posix.html#168 <posix.html#168>`_ - - `Tpthread_attr`:idx: - `posix.html#156 <posix.html#156>`_ - - `Tpthread_barrier`:idx: - `posix.html#157 <posix.html#157>`_ - - `Tpthread_barrierattr`:idx: - `posix.html#158 <posix.html#158>`_ - - `Tpthread_cond`:idx: - `posix.html#159 <posix.html#159>`_ - - `Tpthread_condattr`:idx: - `posix.html#160 <posix.html#160>`_ - - `Tpthread_key`:idx: - `posix.html#161 <posix.html#161>`_ - - `Tpthread_mutex`:idx: - `posix.html#162 <posix.html#162>`_ - - `Tpthread_mutexattr`:idx: - `posix.html#163 <posix.html#163>`_ - - `Tpthread_once`:idx: - `posix.html#164 <posix.html#164>`_ - - `Tpthread_rwlock`:idx: - `posix.html#165 <posix.html#165>`_ - - `Tpthread_rwlockattr`:idx: - `posix.html#166 <posix.html#166>`_ - - `Tpthread_spinlock`:idx: - `posix.html#167 <posix.html#167>`_ - - `traced`:idx: - `manual.html#159 <manual.html#159>`_ - - `TResult`:idx: - `system.html#139 <system.html#139>`_ - - `truncate`:idx: - `posix.html#1030 <posix.html#1030>`_ - - `try`:idx: - `manual.html#186 <manual.html#186>`_ - - `Tsched_param`:idx: - `posix.html#197 <posix.html#197>`_ - - `TSem`:idx: - `posix.html#179 <posix.html#179>`_ - - `TSigaction`:idx: - `posix.html#191 <posix.html#191>`_ - - `Tsig_atomic`:idx: - `posix.html#187 <posix.html#187>`_ - - `TsigEvent`:idx: - `posix.html#189 <posix.html#189>`_ - - `TsigInfo`:idx: - `posix.html#194 <posix.html#194>`_ - - `Tsigset`:idx: - `posix.html#188 <posix.html#188>`_ - - `TSigStack`:idx: - `posix.html#193 <posix.html#193>`_ - - `TsigVal`:idx: - `posix.html#190 <posix.html#190>`_ - - `TStack`:idx: - `posix.html#192 <posix.html#192>`_ - - `TStat`:idx: - `posix.html#181 <posix.html#181>`_ - - `TStatvfs`:idx: - `posix.html#182 <posix.html#182>`_ - - `TStringTable`:idx: - `strtabs.html#102 <strtabs.html#102>`_ - - `TStringTableMode`:idx: - `strtabs.html#101 <strtabs.html#101>`_ - - `Tsuseconds`:idx: - `posix.html#169 <posix.html#169>`_ - - `Ttime`:idx: - `posix.html#170 <posix.html#170>`_ - - `TTime`:idx: - `times.html#103 <times.html#103>`_ - - `TTimeInfo`:idx: - `times.html#104 <times.html#104>`_ - - `Ttimer`:idx: - `posix.html#171 <posix.html#171>`_ - - `Ttimespec`:idx: - `posix.html#185 <posix.html#185>`_ - - `Ttimeval`:idx: - `posix.html#198 <posix.html#198>`_ - - `Ttm`:idx: - `posix.html#184 <posix.html#184>`_ - - `Ttrace_attr`:idx: - `posix.html#172 <posix.html#172>`_ - - `Ttrace_event_id`:idx: - `posix.html#173 <posix.html#173>`_ - - `Ttrace_event_set`:idx: - `posix.html#174 <posix.html#174>`_ - - `Ttrace_id`:idx: - `posix.html#175 <posix.html#175>`_ - - `ttyname`:idx: - `posix.html#1031 <posix.html#1031>`_ - - `ttyname_r`:idx: - `posix.html#1032 <posix.html#1032>`_ - - `Tucontext`:idx: - `posix.html#203 <posix.html#203>`_ - - `Tuid`:idx: - `posix.html#176 <posix.html#176>`_ - - `tuple`:idx: - `manual.html#155 <manual.html#155>`_ - - `Tuseconds`:idx: - `posix.html#177 <posix.html#177>`_ - - `Tutsname`:idx: - `posix.html#178 <posix.html#178>`_ - - `TWeekDay`:idx: - `times.html#102 <times.html#102>`_ - - `type`:idx: - * `manual.html#102 <manual.html#102>`_ - * `manual.html#141 <manual.html#141>`_ - * `manual.html#207 <manual.html#207>`_ - - `type parameters`:idx: - `manual.html#209 <manual.html#209>`_ - - `type suffix`:idx: - `manual.html#138 <manual.html#138>`_ - - `tzset`:idx: - `posix.html#1111 <posix.html#1111>`_ - - `ualarm`:idx: - `posix.html#1033 <posix.html#1033>`_ - - `umask`:idx: - `posix.html#1059 <posix.html#1059>`_ - - `uname`:idx: - `posix.html#859 <posix.html#859>`_ - - `unchecked runtime error`:idx: - `manual.html#111 <manual.html#111>`_ - - `undef`:idx: - `manual.html#224 <manual.html#224>`_ - - `UnixToNativePath`:idx: - `os.html#122 <os.html#122>`_ - - `unlink`:idx: - `posix.html#1034 <posix.html#1034>`_ - - `unsigned integer`:idx: - `manual.html#143 <manual.html#143>`_ - - `unsigned operations`:idx: - `manual.html#144 <manual.html#144>`_ - - `untraced`:idx: - `manual.html#160 <manual.html#160>`_ - - `usleep`:idx: - `posix.html#1035 <posix.html#1035>`_ - - `Var`:idx: - `manual.html#178 <manual.html#178>`_ - - `varargs`:idx: - `nimrodc.html#102 <nimrodc.html#102>`_ - - `vertical tabulator`:idx: - `manual.html#126 <manual.html#126>`_ - - `vfork`:idx: - `posix.html#1036 <posix.html#1036>`_ - - `volatile`:idx: - `nimrodc.html#109 <nimrodc.html#109>`_ - - `wait`:idx: - `posix.html#1112 <posix.html#1112>`_ - - `waitid`:idx: - `posix.html#1113 <posix.html#1113>`_ - - `waitpid`:idx: - `posix.html#1114 <posix.html#1114>`_ - - `walkFiles`:idx: - `os.html#146 <os.html#146>`_ - - `warning`:idx: - * `manual.html#221 <manual.html#221>`_ - * `manual.html#227 <manual.html#227>`_ - * `dialogs.html#103 <dialogs.html#103>`_ - - `WCONTINUED`:idx: - `posix.html#711 <posix.html#711>`_ - - `WEXITED`:idx: - `posix.html#709 <posix.html#709>`_ - - `WEXITSTATUS`:idx: - `posix.html#702 <posix.html#702>`_ - - `when`:idx: - `manual.html#182 <manual.html#182>`_ - - `while`:idx: - `manual.html#195 <manual.html#195>`_ - - `Whitespace`:idx: - `strutils.html#102 <strutils.html#102>`_ - - `WIFCONTINUED`:idx: - `posix.html#703 <posix.html#703>`_ - - `WIFEXITED`:idx: - `posix.html#704 <posix.html#704>`_ - - `WIFSIGNALED`:idx: - `posix.html#705 <posix.html#705>`_ - - `WIFSTOPPED`:idx: - `posix.html#706 <posix.html#706>`_ - - `WNOHANG`:idx: - `posix.html#700 <posix.html#700>`_ - - `WNOWAIT`:idx: - `posix.html#712 <posix.html#712>`_ - - `W_OK`:idx: - `posix.html#477 <posix.html#477>`_ - - `write`:idx: - * `system.html#383 <system.html#383>`_ - * `system.html#384 <system.html#384>`_ - * `system.html#385 <system.html#385>`_ - * `system.html#386 <system.html#386>`_ - * `system.html#387 <system.html#387>`_ - * `system.html#388 <system.html#388>`_ - * `system.html#389 <system.html#389>`_ - * `posix.html#1037 <posix.html#1037>`_ - - `writeBuffer`:idx: - `system.html#399 <system.html#399>`_ - - `writeBytes`:idx: - `system.html#397 <system.html#397>`_ - - `writeChars`:idx: - `system.html#398 <system.html#398>`_ - - `writeln`:idx: - * `system.html#391 <system.html#391>`_ - * `system.html#392 <system.html#392>`_ - - `WSTOPPED`:idx: - `posix.html#710 <posix.html#710>`_ - - `WSTOPSIG`:idx: - `posix.html#707 <posix.html#707>`_ - - `WTERMSIG`:idx: - `posix.html#708 <posix.html#708>`_ - - `WUNTRACED`:idx: - `posix.html#701 <posix.html#701>`_ - - `X_OK`:idx: - `posix.html#478 <posix.html#478>`_ - - `xor`:idx: - * `system.html#166 <system.html#166>`_ - * `system.html#185 <system.html#185>`_ - * `system.html#206 <system.html#206>`_ - - `YESEXPR`:idx: - `posix.html#438 <posix.html#438>`_ - - `yield`:idx: - `manual.html#192 <manual.html#192>`_ - - `ze`:idx: - * `system.html#303 <system.html#303>`_ - * `system.html#304 <system.html#304>`_ - - `ze64`:idx: - * `system.html#305 <system.html#305>`_ - * `system.html#306 <system.html#306>`_ - * `system.html#307 <system.html#307>`_ - * `system.html#308 <system.html#308>`_ - - `zeroMem`:idx: - `system.html#292 <system.html#292>`_ \ No newline at end of file + +===== +Index +===== + +.. index:: + + + `!=`:idx: + `system.html#351 <system.html#351>`_ + + `$`:idx: + * `system.html#420 <system.html#420>`_ + * `system.html#421 <system.html#421>`_ + * `system.html#422 <system.html#422>`_ + * `system.html#423 <system.html#423>`_ + * `system.html#424 <system.html#424>`_ + * `system.html#425 <system.html#425>`_ + * `system.html#426 <system.html#426>`_ + * `times.html#109 <times.html#109>`_ + * `times.html#110 <times.html#110>`_ + + `%`:idx: + * `strutils.html#132 <strutils.html#132>`_ + * `strutils.html#133 <strutils.html#133>`_ + * `strtabs.html#112 <strtabs.html#112>`_ + + `%%`:idx: + * `system.html#293 <system.html#293>`_ + * `system.html#294 <system.html#294>`_ + * `system.html#295 <system.html#295>`_ + * `system.html#296 <system.html#296>`_ + * `system.html#297 <system.html#297>`_ + + `&`:idx: + * `system.html#362 <system.html#362>`_ + * `system.html#363 <system.html#363>`_ + * `system.html#364 <system.html#364>`_ + * `system.html#365 <system.html#365>`_ + * `system.html#450 <system.html#450>`_ + * `system.html#451 <system.html#451>`_ + * `system.html#452 <system.html#452>`_ + * `system.html#453 <system.html#453>`_ + + `*`:idx: + * `system.html#203 <system.html#203>`_ + * `system.html#204 <system.html#204>`_ + * `system.html#205 <system.html#205>`_ + * `system.html#206 <system.html#206>`_ + * `system.html#207 <system.html#207>`_ + * `system.html#312 <system.html#312>`_ + * `system.html#323 <system.html#323>`_ + * `complex.html#107 <complex.html#107>`_ + + `*%`:idx: + * `system.html#283 <system.html#283>`_ + * `system.html#284 <system.html#284>`_ + * `system.html#285 <system.html#285>`_ + * `system.html#286 <system.html#286>`_ + * `system.html#287 <system.html#287>`_ + + `+`:idx: + * `system.html#178 <system.html#178>`_ + * `system.html#179 <system.html#179>`_ + * `system.html#180 <system.html#180>`_ + * `system.html#181 <system.html#181>`_ + * `system.html#182 <system.html#182>`_ + * `system.html#193 <system.html#193>`_ + * `system.html#194 <system.html#194>`_ + * `system.html#195 <system.html#195>`_ + * `system.html#196 <system.html#196>`_ + * `system.html#197 <system.html#197>`_ + * `system.html#308 <system.html#308>`_ + * `system.html#310 <system.html#310>`_ + * `system.html#324 <system.html#324>`_ + * `complex.html#103 <complex.html#103>`_ + + `+%`:idx: + * `system.html#273 <system.html#273>`_ + * `system.html#274 <system.html#274>`_ + * `system.html#275 <system.html#275>`_ + * `system.html#276 <system.html#276>`_ + * `system.html#277 <system.html#277>`_ + + `-`:idx: + * `system.html#183 <system.html#183>`_ + * `system.html#184 <system.html#184>`_ + * `system.html#185 <system.html#185>`_ + * `system.html#186 <system.html#186>`_ + * `system.html#187 <system.html#187>`_ + * `system.html#198 <system.html#198>`_ + * `system.html#199 <system.html#199>`_ + * `system.html#200 <system.html#200>`_ + * `system.html#201 <system.html#201>`_ + * `system.html#202 <system.html#202>`_ + * `system.html#309 <system.html#309>`_ + * `system.html#311 <system.html#311>`_ + * `system.html#325 <system.html#325>`_ + * `complex.html#104 <complex.html#104>`_ + * `complex.html#105 <complex.html#105>`_ + * `times.html#113 <times.html#113>`_ + + `-%`:idx: + * `system.html#278 <system.html#278>`_ + * `system.html#279 <system.html#279>`_ + * `system.html#280 <system.html#280>`_ + * `system.html#281 <system.html#281>`_ + * `system.html#282 <system.html#282>`_ + + `-+-`:idx: + `system.html#326 <system.html#326>`_ + + `/`:idx: + * `system.html#313 <system.html#313>`_ + * `os.html#119 <os.html#119>`_ + * `complex.html#106 <complex.html#106>`_ + + `/%`:idx: + * `system.html#288 <system.html#288>`_ + * `system.html#289 <system.html#289>`_ + * `system.html#290 <system.html#290>`_ + * `system.html#291 <system.html#291>`_ + * `system.html#292 <system.html#292>`_ + + `/../`:idx: + `os.html#123 <os.html#123>`_ + + `<`:idx: + * `system.html#253 <system.html#253>`_ + * `system.html#254 <system.html#254>`_ + * `system.html#255 <system.html#255>`_ + * `system.html#256 <system.html#256>`_ + * `system.html#257 <system.html#257>`_ + * `system.html#316 <system.html#316>`_ + * `system.html#343 <system.html#343>`_ + * `system.html#344 <system.html#344>`_ + * `system.html#345 <system.html#345>`_ + * `system.html#346 <system.html#346>`_ + * `system.html#347 <system.html#347>`_ + * `system.html#348 <system.html#348>`_ + * `system.html#349 <system.html#349>`_ + * `system.html#350 <system.html#350>`_ + * `times.html#114 <times.html#114>`_ + + `<%`:idx: + * `system.html#303 <system.html#303>`_ + * `system.html#304 <system.html#304>`_ + * `system.html#305 <system.html#305>`_ + * `system.html#306 <system.html#306>`_ + * `system.html#307 <system.html#307>`_ + + `<=`:idx: + `times.html#115 <times.html#115>`_ + + `<=`:idx: + * `system.html#248 <system.html#248>`_ + * `system.html#249 <system.html#249>`_ + * `system.html#250 <system.html#250>`_ + * `system.html#251 <system.html#251>`_ + * `system.html#252 <system.html#252>`_ + * `system.html#315 <system.html#315>`_ + * `system.html#336 <system.html#336>`_ + * `system.html#337 <system.html#337>`_ + * `system.html#338 <system.html#338>`_ + * `system.html#339 <system.html#339>`_ + * `system.html#340 <system.html#340>`_ + * `system.html#341 <system.html#341>`_ + * `system.html#342 <system.html#342>`_ + + `<=%`:idx: + * `system.html#298 <system.html#298>`_ + * `system.html#299 <system.html#299>`_ + * `system.html#300 <system.html#300>`_ + * `system.html#301 <system.html#301>`_ + * `system.html#302 <system.html#302>`_ + + `==`:idx: + * `system.html#243 <system.html#243>`_ + * `system.html#244 <system.html#244>`_ + * `system.html#245 <system.html#245>`_ + * `system.html#246 <system.html#246>`_ + * `system.html#247 <system.html#247>`_ + * `system.html#314 <system.html#314>`_ + * `system.html#327 <system.html#327>`_ + * `system.html#328 <system.html#328>`_ + * `system.html#329 <system.html#329>`_ + * `system.html#330 <system.html#330>`_ + * `system.html#331 <system.html#331>`_ + * `system.html#332 <system.html#332>`_ + * `system.html#333 <system.html#333>`_ + * `system.html#334 <system.html#334>`_ + * `system.html#335 <system.html#335>`_ + * `system.html#455 <system.html#455>`_ + * `complex.html#102 <complex.html#102>`_ + + `>`:idx: + `system.html#353 <system.html#353>`_ + + `>%`:idx: + `system.html#419 <system.html#419>`_ + + `>=`:idx: + `system.html#352 <system.html#352>`_ + + `>=%`:idx: + `system.html#418 <system.html#418>`_ + + `@`:idx: + `system.html#361 <system.html#361>`_ + + `[]`:idx: + `strtabs.html#107 <strtabs.html#107>`_ + + `[]=`:idx: + `strtabs.html#106 <strtabs.html#106>`_ + + `[ESC]`:idx: + `manual.html#134 <manual.html#134>`_ + + `ABDAY_1`:idx: + `posix.html#403 <posix.html#403>`_ + + `ABDAY_2`:idx: + `posix.html#404 <posix.html#404>`_ + + `ABDAY_3`:idx: + `posix.html#405 <posix.html#405>`_ + + `ABDAY_4`:idx: + `posix.html#406 <posix.html#406>`_ + + `ABDAY_5`:idx: + `posix.html#407 <posix.html#407>`_ + + `ABDAY_6`:idx: + `posix.html#408 <posix.html#408>`_ + + `ABDAY_7`:idx: + `posix.html#409 <posix.html#409>`_ + + `ABMON_1`:idx: + `posix.html#422 <posix.html#422>`_ + + `ABMON_10`:idx: + `posix.html#431 <posix.html#431>`_ + + `ABMON_11`:idx: + `posix.html#432 <posix.html#432>`_ + + `ABMON_12`:idx: + `posix.html#433 <posix.html#433>`_ + + `ABMON_2`:idx: + `posix.html#423 <posix.html#423>`_ + + `ABMON_3`:idx: + `posix.html#424 <posix.html#424>`_ + + `ABMON_4`:idx: + `posix.html#425 <posix.html#425>`_ + + `ABMON_5`:idx: + `posix.html#426 <posix.html#426>`_ + + `ABMON_6`:idx: + `posix.html#427 <posix.html#427>`_ + + `ABMON_7`:idx: + `posix.html#428 <posix.html#428>`_ + + `ABMON_8`:idx: + `posix.html#429 <posix.html#429>`_ + + `ABMON_9`:idx: + `posix.html#430 <posix.html#430>`_ + + `abs`:idx: + * `system.html#258 <system.html#258>`_ + * `system.html#259 <system.html#259>`_ + * `system.html#260 <system.html#260>`_ + * `system.html#261 <system.html#261>`_ + * `system.html#262 <system.html#262>`_ + * `system.html#317 <system.html#317>`_ + * `complex.html#108 <complex.html#108>`_ + + `access`:idx: + `posix.html#966 <posix.html#966>`_ + + `acyclic`:idx: + `nimrodc.html#114 <nimrodc.html#114>`_ + + `add`:idx: + * `system.html#366 <system.html#366>`_ + * `system.html#367 <system.html#367>`_ + * `system.html#368 <system.html#368>`_ + * `system.html#369 <system.html#369>`_ + * `system.html#370 <system.html#370>`_ + + `addFile`:idx: + * `zipfiles.html#105 <zipfiles.html#105>`_ + * `zipfiles.html#106 <zipfiles.html#106>`_ + * `zipfiles.html#107 <zipfiles.html#107>`_ + + `addQuitProc`:idx: + `system.html#402 <system.html#402>`_ + + `adler32`:idx: + `zlib.html#174 <zlib.html#174>`_ + + `AIO_ALLDONE`:idx: + `posix.html#207 <posix.html#207>`_ + + `aio_cancel`:idx: + `posix.html#784 <posix.html#784>`_ + + `AIO_CANCELED`:idx: + `posix.html#208 <posix.html#208>`_ + + `aio_error`:idx: + `posix.html#785 <posix.html#785>`_ + + `aio_fsync`:idx: + `posix.html#786 <posix.html#786>`_ + + `AIO_NOTCANCELED`:idx: + `posix.html#209 <posix.html#209>`_ + + `aio_read`:idx: + `posix.html#787 <posix.html#787>`_ + + `aio_return`:idx: + `posix.html#788 <posix.html#788>`_ + + `aio_suspend`:idx: + `posix.html#789 <posix.html#789>`_ + + `aio_write`:idx: + `posix.html#790 <posix.html#790>`_ + + `alarm`:idx: + `posix.html#967 <posix.html#967>`_ + + `alert`:idx: + `manual.html#131 <manual.html#131>`_ + + `allCharsInSet`:idx: + `strutils.html#137 <strutils.html#137>`_ + + `alloc`:idx: + `system.html#411 <system.html#411>`_ + + `alloc0`:idx: + `system.html#412 <system.html#412>`_ + + `ALT_DIGITS`:idx: + `posix.html#438 <posix.html#438>`_ + + `AltSep`:idx: + `os.html#104 <os.html#104>`_ + + `AM_STR`:idx: + `posix.html#394 <posix.html#394>`_ + + `and`:idx: + * `system.html#228 <system.html#228>`_ + * `system.html#229 <system.html#229>`_ + * `system.html#230 <system.html#230>`_ + * `system.html#231 <system.html#231>`_ + * `system.html#232 <system.html#232>`_ + * `system.html#320 <system.html#320>`_ + + `apostrophe`:idx: + `manual.html#129 <manual.html#129>`_ + + `AppendFileExt`:idx: + `os.html#131 <os.html#131>`_ + + `arccos`:idx: + `math.html#117 <math.html#117>`_ + + `arcsin`:idx: + `math.html#118 <math.html#118>`_ + + `arctan`:idx: + `math.html#119 <math.html#119>`_ + + `arctan2`:idx: + `math.html#120 <math.html#120>`_ + + `array`:idx: + `system.html#121 <system.html#121>`_ + + `Arrays`:idx: + `manual.html#153 <manual.html#153>`_ + + `asctime`:idx: + `posix.html#1092 <posix.html#1092>`_ + + `asctime_r`:idx: + `posix.html#1093 <posix.html#1093>`_ + + `assembler`:idx: + `manual.html#198 <manual.html#198>`_ + + `assert`:idx: + `system.html#416 <system.html#416>`_ + + `Automatic type conversion`:idx: + `manual.html#145 <manual.html#145>`_ + + `backslash`:idx: + * `manual.html#127 <manual.html#127>`_ + * `regexprs.html#101 <regexprs.html#101>`_ + + `backspace`:idx: + `manual.html#132 <manual.html#132>`_ + + `basename`:idx: + `posix.html#844 <posix.html#844>`_ + + `BiggestFloat`:idx: + `system.html#374 <system.html#374>`_ + + `BiggestInt`:idx: + `system.html#373 <system.html#373>`_ + + `block`:idx: + `manual.html#194 <manual.html#194>`_ + + `bool`:idx: + `system.html#109 <system.html#109>`_ + + `boolean`:idx: + `manual.html#147 <manual.html#147>`_ + + `break`:idx: + `manual.html#195 <manual.html#195>`_ + + `breakpoint`:idx: + `endb.html#103 <endb.html#103>`_ + + `bsd_signal`:idx: + `posix.html#1122 <posix.html#1122>`_ + + `Byte`:idx: + `system.html#125 <system.html#125>`_ + + `C`:idx: + `manual.html#136 <manual.html#136>`_ + + `calling conventions`:idx: + `manual.html#164 <manual.html#164>`_ + + `capitalize`:idx: + `strutils.html#110 <strutils.html#110>`_ + + `card`:idx: + `system.html#166 <system.html#166>`_ + + `carriage return`:idx: + `manual.html#122 <manual.html#122>`_ + + `case`:idx: + `manual.html#182 <manual.html#182>`_ + + `catclose`:idx: + `posix.html#1149 <posix.html#1149>`_ + + `catgets`:idx: + `posix.html#1150 <posix.html#1150>`_ + + `catopen`:idx: + `posix.html#1151 <posix.html#1151>`_ + + `cchar`:idx: + `system.html#375 <system.html#375>`_ + + `cdecl`:idx: + `manual.html#166 <manual.html#166>`_ + + `cdouble`:idx: + `system.html#382 <system.html#382>`_ + + `cfloat`:idx: + `system.html#381 <system.html#381>`_ + + `ChangeFileExt`:idx: + `os.html#132 <os.html#132>`_ + + `char`:idx: + `system.html#110 <system.html#110>`_ + + `character type`:idx: + `manual.html#148 <manual.html#148>`_ + + `character with decimal value d`:idx: + `manual.html#130 <manual.html#130>`_ + + `character with hex value HH`:idx: + `manual.html#135 <manual.html#135>`_ + + `chdir`:idx: + `posix.html#968 <posix.html#968>`_ + + `checked runtime error`:idx: + `manual.html#110 <manual.html#110>`_ + + `chmod`:idx: + `posix.html#1058 <posix.html#1058>`_ + + `ChooseDir`:idx: + `dialogs.html#108 <dialogs.html#108>`_ + + `ChooseFilesToOpen`:idx: + `dialogs.html#106 <dialogs.html#106>`_ + + `ChooseFileToOpen`:idx: + `dialogs.html#105 <dialogs.html#105>`_ + + `ChooseFileToSave`:idx: + `dialogs.html#107 <dialogs.html#107>`_ + + `chown`:idx: + `posix.html#969 <posix.html#969>`_ + + `chr`:idx: + `system.html#168 <system.html#168>`_ + + `cint`:idx: + `system.html#378 <system.html#378>`_ + + `C_IRGRP`:idx: + `posix.html#104 <posix.html#104>`_ + + `C_IROTH`:idx: + `posix.html#107 <posix.html#107>`_ + + `C_IRUSR`:idx: + `posix.html#101 <posix.html#101>`_ + + `C_ISBLK`:idx: + `posix.html#116 <posix.html#116>`_ + + `C_ISCHR`:idx: + `posix.html#117 <posix.html#117>`_ + + `C_ISCTG`:idx: + `posix.html#118 <posix.html#118>`_ + + `C_ISDIR`:idx: + `posix.html#113 <posix.html#113>`_ + + `C_ISFIFO`:idx: + `posix.html#114 <posix.html#114>`_ + + `C_ISGID`:idx: + `posix.html#111 <posix.html#111>`_ + + `C_ISLNK`:idx: + `posix.html#119 <posix.html#119>`_ + + `C_ISREG`:idx: + `posix.html#115 <posix.html#115>`_ + + `C_ISSOCK`:idx: + `posix.html#120 <posix.html#120>`_ + + `C_ISUID`:idx: + `posix.html#110 <posix.html#110>`_ + + `C_ISVTX`:idx: + `posix.html#112 <posix.html#112>`_ + + `C_IWGRP`:idx: + `posix.html#105 <posix.html#105>`_ + + `C_IWOTH`:idx: + `posix.html#108 <posix.html#108>`_ + + `C_IWUSR`:idx: + `posix.html#102 <posix.html#102>`_ + + `C_IXGRP`:idx: + `posix.html#106 <posix.html#106>`_ + + `C_IXOTH`:idx: + `posix.html#109 <posix.html#109>`_ + + `C_IXUSR`:idx: + `posix.html#103 <posix.html#103>`_ + + `classify`:idx: + `math.html#104 <math.html#104>`_ + + `clock`:idx: + `posix.html#1094 <posix.html#1094>`_ + + `clock_getcpuclockid`:idx: + `posix.html#1095 <posix.html#1095>`_ + + `clock_getres`:idx: + `posix.html#1096 <posix.html#1096>`_ + + `clock_gettime`:idx: + `posix.html#1097 <posix.html#1097>`_ + + `CLOCK_MONOTONIC`:idx: + `posix.html#700 <posix.html#700>`_ + + `clock_nanosleep`:idx: + `posix.html#1098 <posix.html#1098>`_ + + `CLOCK_PROCESS_CPUTIME_ID`:idx: + `posix.html#696 <posix.html#696>`_ + + `CLOCK_REALTIME`:idx: + `posix.html#698 <posix.html#698>`_ + + `clock_settime`:idx: + `posix.html#1099 <posix.html#1099>`_ + + `CLOCKS_PER_SEC`:idx: + `posix.html#695 <posix.html#695>`_ + + `CLOCK_THREAD_CPUTIME_ID`:idx: + `posix.html#697 <posix.html#697>`_ + + `clong`:idx: + `system.html#379 <system.html#379>`_ + + `clongdouble`:idx: + `system.html#383 <system.html#383>`_ + + `clonglong`:idx: + `system.html#380 <system.html#380>`_ + + `close`:idx: + * `lexbase.html#105 <lexbase.html#105>`_ + * `parsecfg.html#105 <parsecfg.html#105>`_ + * `posix.html#970 <posix.html#970>`_ + * `zipfiles.html#103 <zipfiles.html#103>`_ + + `closedir`:idx: + `posix.html#800 <posix.html#800>`_ + + `CloseFile`:idx: + `system.html#484 <system.html#484>`_ + + `closure`:idx: + `manual.html#171 <manual.html#171>`_ + + `cmp`:idx: + * `system.html#359 <system.html#359>`_ + * `system.html#360 <system.html#360>`_ + + `cmpIgnoreCase`:idx: + `strutils.html#122 <strutils.html#122>`_ + + `cmpIgnoreStyle`:idx: + `strutils.html#123 <strutils.html#123>`_ + + `cmpPaths`:idx: + `os.html#130 <os.html#130>`_ + + `CODESET`:idx: + `posix.html#389 <posix.html#389>`_ + + `comment pieces`:idx: + `manual.html#115 <manual.html#115>`_ + + `Comments`:idx: + `manual.html#114 <manual.html#114>`_ + + `CompileDate`:idx: + `system.html#391 <system.html#391>`_ + + `CompileTime`:idx: + `system.html#392 <system.html#392>`_ + + `complex statements`:idx: + `manual.html#176 <manual.html#176>`_ + + `compress`:idx: + `zlib.html#154 <zlib.html#154>`_ + + `compress2`:idx: + `zlib.html#155 <zlib.html#155>`_ + + `confstr`:idx: + `posix.html#971 <posix.html#971>`_ + + `const`:idx: + `manual.html#180 <manual.html#180>`_ + + `constant expressions`:idx: + `manual.html#108 <manual.html#108>`_ + + `Constants`:idx: + `manual.html#140 <manual.html#140>`_ + + `constZIP_SOURCE_FREE`:idx: + `libzip.html#169 <libzip.html#169>`_ + + `continue`:idx: + `manual.html#197 <manual.html#197>`_ + + `copy`:idx: + * `system.html#403 <system.html#403>`_ + * `system.html#404 <system.html#404>`_ + + `copyFile`:idx: + `os.html#134 <os.html#134>`_ + + `copyMem`:idx: + `system.html#408 <system.html#408>`_ + + `cos`:idx: + `math.html#121 <math.html#121>`_ + + `cosh`:idx: + `math.html#122 <math.html#122>`_ + + `countBits`:idx: + `math.html#107 <math.html#107>`_ + + `countdown`:idx: + `system.html#436 <system.html#436>`_ + + `countup`:idx: + `system.html#437 <system.html#437>`_ + + `cpuEndian`:idx: + `system.html#397 <system.html#397>`_ + + `crc32`:idx: + `zlib.html#175 <zlib.html#175>`_ + + `creat`:idx: + `posix.html#811 <posix.html#811>`_ + + `createDir`:idx: + * `os.html#138 <os.html#138>`_ + * `zipfiles.html#104 <zipfiles.html#104>`_ + + `CRNCYSTR`:idx: + `posix.html#443 <posix.html#443>`_ + + `crypt`:idx: + `posix.html#972 <posix.html#972>`_ + + `cschar`:idx: + `system.html#376 <system.html#376>`_ + + `cshort`:idx: + `system.html#377 <system.html#377>`_ + + `cSIG_HOLD`:idx: + `posix.html#721 <posix.html#721>`_ + + `CS_PATH`:idx: + `posix.html#482 <posix.html#482>`_ + + `CS_POSIX_V6_ILP32_OFF32_CFLAGS`:idx: + `posix.html#483 <posix.html#483>`_ + + `CS_POSIX_V6_ILP32_OFF32_LDFLAGS`:idx: + `posix.html#484 <posix.html#484>`_ + + `CS_POSIX_V6_ILP32_OFF32_LIBS`:idx: + `posix.html#485 <posix.html#485>`_ + + `CS_POSIX_V6_ILP32_OFFBIG_CFLAGS`:idx: + `posix.html#486 <posix.html#486>`_ + + `CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS`:idx: + `posix.html#487 <posix.html#487>`_ + + `CS_POSIX_V6_ILP32_OFFBIG_LIBS`:idx: + `posix.html#488 <posix.html#488>`_ + + `CS_POSIX_V6_LP64_OFF64_CFLAGS`:idx: + `posix.html#489 <posix.html#489>`_ + + `CS_POSIX_V6_LP64_OFF64_LDFLAGS`:idx: + `posix.html#490 <posix.html#490>`_ + + `CS_POSIX_V6_LP64_OFF64_LIBS`:idx: + `posix.html#491 <posix.html#491>`_ + + `CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS`:idx: + `posix.html#492 <posix.html#492>`_ + + `CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS`:idx: + `posix.html#493 <posix.html#493>`_ + + `CS_POSIX_V6_LPBIG_OFFBIG_LIBS`:idx: + `posix.html#494 <posix.html#494>`_ + + `CS_POSIX_V6_WIDTH_RESTRICTED_ENVS`:idx: + `posix.html#495 <posix.html#495>`_ + + `cstring`:idx: + `system.html#112 <system.html#112>`_ + + `cstringArray`:idx: + `system.html#384 <system.html#384>`_ + + `ctermid`:idx: + `posix.html#973 <posix.html#973>`_ + + `ctime`:idx: + `posix.html#1100 <posix.html#1100>`_ + + `ctime_r`:idx: + `posix.html#1101 <posix.html#1101>`_ + + `CurDir`:idx: + `os.html#101 <os.html#101>`_ + + `dangling else problem`:idx: + `manual.html#177 <manual.html#177>`_ + + `DAY_1`:idx: + `posix.html#396 <posix.html#396>`_ + + `DAY_2`:idx: + `posix.html#397 <posix.html#397>`_ + + `DAY_3`:idx: + `posix.html#398 <posix.html#398>`_ + + `DAY_4`:idx: + `posix.html#399 <posix.html#399>`_ + + `DAY_5`:idx: + `posix.html#400 <posix.html#400>`_ + + `DAY_6`:idx: + `posix.html#401 <posix.html#401>`_ + + `DAY_7`:idx: + `posix.html#402 <posix.html#402>`_ + + `daylight`:idx: + `posix.html#701 <posix.html#701>`_ + + `dbgLineHook`:idx: + `system.html#432 <system.html#432>`_ + + `dealloc`:idx: + `system.html#414 <system.html#414>`_ + + `debugger`:idx: + `nimrodc.html#111 <nimrodc.html#111>`_ + + `dec`:idx: + `system.html#157 <system.html#157>`_ + + `define`:idx: + `manual.html#224 <manual.html#224>`_ + + `defined`:idx: + `system.html#114 <system.html#114>`_ + + `deflate`:idx: + `zlib.html#143 <zlib.html#143>`_ + + `deflateCopy`:idx: + `zlib.html#148 <zlib.html#148>`_ + + `deflateEnd`:idx: + `zlib.html#144 <zlib.html#144>`_ + + `deflateInit`:idx: + `zlib.html#178 <zlib.html#178>`_ + + `deflateInit2`:idx: + `zlib.html#182 <zlib.html#182>`_ + + `deflateInit2u`:idx: + `zlib.html#180 <zlib.html#180>`_ + + `deflateInitu`:idx: + `zlib.html#176 <zlib.html#176>`_ + + `deflateParams`:idx: + `zlib.html#150 <zlib.html#150>`_ + + `deflateReset`:idx: + `zlib.html#149 <zlib.html#149>`_ + + `deflateSetDictionary`:idx: + `zlib.html#147 <zlib.html#147>`_ + + `deleteStr`:idx: + `strutils.html#116 <strutils.html#116>`_ + + `D_FMT`:idx: + `posix.html#391 <posix.html#391>`_ + + `difftime`:idx: + `posix.html#1102 <posix.html#1102>`_ + + `dirname`:idx: + `posix.html#845 <posix.html#845>`_ + + `DirSep`:idx: + `os.html#103 <os.html#103>`_ + + `discard`:idx: + `manual.html#178 <manual.html#178>`_ + + `div`:idx: + * `system.html#208 <system.html#208>`_ + * `system.html#209 <system.html#209>`_ + * `system.html#210 <system.html#210>`_ + * `system.html#211 <system.html#211>`_ + * `system.html#212 <system.html#212>`_ + + `dlclose`:idx: + `posix.html#807 <posix.html#807>`_ + + `dlerror`:idx: + `posix.html#808 <posix.html#808>`_ + + `dlopen`:idx: + `posix.html#809 <posix.html#809>`_ + + `dlsym`:idx: + `posix.html#810 <posix.html#810>`_ + + `dom`:idx: + `nimrodc.html#120 <nimrodc.html#120>`_ + + `domain specific languages`:idx: + `manual.html#213 <manual.html#213>`_ + + `D_T_FMT`:idx: + `posix.html#390 <posix.html#390>`_ + + `dup`:idx: + `posix.html#974 <posix.html#974>`_ + + `dup2`:idx: + `posix.html#975 <posix.html#975>`_ + + `dynamic type`:idx: + `manual.html#104 <manual.html#104>`_ + + `dynlib`:idx: + `nimrodc.html#103 <nimrodc.html#103>`_ + + `E`:idx: + `math.html#102 <math.html#102>`_ + + `E2BIG`:idx: + `posix.html#220 <posix.html#220>`_ + + `EACCES`:idx: + `posix.html#221 <posix.html#221>`_ + + `EAccessViolation`:idx: + `system.html#140 <system.html#140>`_ + + `EADDRINUSE`:idx: + `posix.html#222 <posix.html#222>`_ + + `EADDRNOTAVAIL`:idx: + `posix.html#223 <posix.html#223>`_ + + `EAFNOSUPPORT`:idx: + `posix.html#224 <posix.html#224>`_ + + `EAGAIN`:idx: + `posix.html#225 <posix.html#225>`_ + + `EALREADY`:idx: + `posix.html#226 <posix.html#226>`_ + + `EArithmetic`:idx: + `system.html#137 <system.html#137>`_ + + `EAssertionFailed`:idx: + `system.html#141 <system.html#141>`_ + + `EAsynch`:idx: + `system.html#131 <system.html#131>`_ + + `EBADF`:idx: + `posix.html#227 <posix.html#227>`_ + + `EBADMSG`:idx: + `posix.html#228 <posix.html#228>`_ + + `E_Base`:idx: + `system.html#130 <system.html#130>`_ + + `EBUSY`:idx: + `posix.html#229 <posix.html#229>`_ + + `ECANCELED`:idx: + `posix.html#230 <posix.html#230>`_ + + `ECHILD`:idx: + `posix.html#231 <posix.html#231>`_ + + `echo`:idx: + `system.html#471 <system.html#471>`_ + + `ECMAScript`:idx: + `nimrodc.html#115 <nimrodc.html#115>`_ + + `ECONNABORTED`:idx: + `posix.html#232 <posix.html#232>`_ + + `ECONNREFUSED`:idx: + `posix.html#233 <posix.html#233>`_ + + `ECONNRESET`:idx: + `posix.html#234 <posix.html#234>`_ + + `EControlC`:idx: + `system.html#142 <system.html#142>`_ + + `EDEADLK`:idx: + `posix.html#235 <posix.html#235>`_ + + `EDESTADDRREQ`:idx: + `posix.html#236 <posix.html#236>`_ + + `editDistance`:idx: + `strutils.html#142 <strutils.html#142>`_ + + `EDivByZero`:idx: + `system.html#138 <system.html#138>`_ + + `EDOM`:idx: + `posix.html#237 <posix.html#237>`_ + + `EDQUOT`:idx: + `posix.html#238 <posix.html#238>`_ + + `EEXIST`:idx: + `posix.html#239 <posix.html#239>`_ + + `EFAULT`:idx: + `posix.html#240 <posix.html#240>`_ + + `EFBIG`:idx: + `posix.html#241 <posix.html#241>`_ + + `EHOSTUNREACH`:idx: + `posix.html#242 <posix.html#242>`_ + + `EIDRM`:idx: + `posix.html#243 <posix.html#243>`_ + + `EILSEQ`:idx: + `posix.html#244 <posix.html#244>`_ + + `EINPROGRESS`:idx: + `posix.html#245 <posix.html#245>`_ + + `EINTR`:idx: + `posix.html#246 <posix.html#246>`_ + + `EINVAL`:idx: + `posix.html#247 <posix.html#247>`_ + + `EInvalidField`:idx: + `system.html#146 <system.html#146>`_ + + `EInvalidIndex`:idx: + `system.html#145 <system.html#145>`_ + + `EInvalidObjectAssignment`:idx: + `system.html#150 <system.html#150>`_ + + `EInvalidObjectConversion`:idx: + `system.html#151 <system.html#151>`_ + + `EInvalidRegEx`:idx: + `regexprs.html#104 <regexprs.html#104>`_ + + `EInvalidValue`:idx: + * `manual.html#146 <manual.html#146>`_ + * `system.html#143 <system.html#143>`_ + + `EIO`:idx: + * `system.html#134 <system.html#134>`_ + * `posix.html#248 <posix.html#248>`_ + + `EISCONN`:idx: + `posix.html#249 <posix.html#249>`_ + + `EISDIR`:idx: + `posix.html#250 <posix.html#250>`_ + + `ELOOP`:idx: + `posix.html#251 <posix.html#251>`_ + + `Embedded Nimrod Debugger`:idx: + `endb.html#101 <endb.html#101>`_ + + `EMFILE`:idx: + `posix.html#252 <posix.html#252>`_ + + `EMLINK`:idx: + `posix.html#253 <posix.html#253>`_ + + `EMSGSIZE`:idx: + `posix.html#254 <posix.html#254>`_ + + `EMULTIHOP`:idx: + `posix.html#255 <posix.html#255>`_ + + `ENAMETOOLONG`:idx: + `posix.html#256 <posix.html#256>`_ + + `encrypt`:idx: + `posix.html#976 <posix.html#976>`_ + + `ENDB`:idx: + `endb.html#102 <endb.html#102>`_ + + `endgrent`:idx: + `posix.html#838 <posix.html#838>`_ + + `EndOfFile`:idx: + * `system.html#485 <system.html#485>`_ + * `lexbase.html#101 <lexbase.html#101>`_ + + `endpwent`:idx: + `posix.html#863 <posix.html#863>`_ + + `endsWith`:idx: + `strutils.html#136 <strutils.html#136>`_ + + `ENETDOWN`:idx: + `posix.html#257 <posix.html#257>`_ + + `ENETRESET`:idx: + `posix.html#258 <posix.html#258>`_ + + `ENETUNREACH`:idx: + `posix.html#259 <posix.html#259>`_ + + `ENFILE`:idx: + `posix.html#260 <posix.html#260>`_ + + `ENOBUFS`:idx: + `posix.html#261 <posix.html#261>`_ + + `ENODATA`:idx: + `posix.html#262 <posix.html#262>`_ + + `ENODEV`:idx: + `posix.html#263 <posix.html#263>`_ + + `ENOENT`:idx: + `posix.html#264 <posix.html#264>`_ + + `ENoExceptionToReraise`:idx: + * `manual.html#186 <manual.html#186>`_ + * `system.html#149 <system.html#149>`_ + + `ENOEXEC`:idx: + `posix.html#265 <posix.html#265>`_ + + `ENOLCK`:idx: + `posix.html#266 <posix.html#266>`_ + + `ENOLINK`:idx: + `posix.html#267 <posix.html#267>`_ + + `ENOMEM`:idx: + `posix.html#268 <posix.html#268>`_ + + `ENOMSG`:idx: + `posix.html#269 <posix.html#269>`_ + + `ENOPROTOOPT`:idx: + `posix.html#270 <posix.html#270>`_ + + `ENOSPC`:idx: + `posix.html#271 <posix.html#271>`_ + + `ENOSR`:idx: + `posix.html#272 <posix.html#272>`_ + + `ENOSTR`:idx: + `posix.html#273 <posix.html#273>`_ + + `ENOSYS`:idx: + `posix.html#274 <posix.html#274>`_ + + `ENOTCONN`:idx: + `posix.html#275 <posix.html#275>`_ + + `ENOTDIR`:idx: + `posix.html#276 <posix.html#276>`_ + + `ENOTEMPTY`:idx: + `posix.html#277 <posix.html#277>`_ + + `ENOTSOCK`:idx: + `posix.html#278 <posix.html#278>`_ + + `ENOTSUP`:idx: + `posix.html#279 <posix.html#279>`_ + + `ENOTTY`:idx: + `posix.html#280 <posix.html#280>`_ + + `Enumeration`:idx: + `manual.html#149 <manual.html#149>`_ + + `ENXIO`:idx: + `posix.html#281 <posix.html#281>`_ + + `EOPNOTSUPP`:idx: + `posix.html#282 <posix.html#282>`_ + + `EOS`:idx: + `system.html#135 <system.html#135>`_ + + `EOutOfMemory`:idx: + `system.html#144 <system.html#144>`_ + + `EOutOfRange`:idx: + `system.html#147 <system.html#147>`_ + + `EOVERFLOW`:idx: + `posix.html#283 <posix.html#283>`_ + + `EOverflow`:idx: + `system.html#139 <system.html#139>`_ + + `EPERM`:idx: + `posix.html#284 <posix.html#284>`_ + + `EPIPE`:idx: + `posix.html#285 <posix.html#285>`_ + + `EPROTO`:idx: + `posix.html#286 <posix.html#286>`_ + + `EPROTONOSUPPORT`:idx: + `posix.html#287 <posix.html#287>`_ + + `EPROTOTYPE`:idx: + `posix.html#288 <posix.html#288>`_ + + `equalMem`:idx: + `system.html#410 <system.html#410>`_ + + `ERA`:idx: + `posix.html#434 <posix.html#434>`_ + + `ERA_D_FMT`:idx: + `posix.html#435 <posix.html#435>`_ + + `ERA_D_T_FMT`:idx: + `posix.html#436 <posix.html#436>`_ + + `ERANGE`:idx: + `posix.html#289 <posix.html#289>`_ + + `ERA_T_FMT`:idx: + `posix.html#437 <posix.html#437>`_ + + `ERessourceExhausted`:idx: + `system.html#136 <system.html#136>`_ + + `EROFS`:idx: + `posix.html#290 <posix.html#290>`_ + + `errno`:idx: + `posix.html#219 <posix.html#219>`_ + + `error`:idx: + * `manual.html#223 <manual.html#223>`_ + * `manual.html#226 <manual.html#226>`_ + * `dialogs.html#104 <dialogs.html#104>`_ + + `errorStr`:idx: + `parsecfg.html#110 <parsecfg.html#110>`_ + + `escape`:idx: + * `manual.html#133 <manual.html#133>`_ + * `strutils.html#141 <strutils.html#141>`_ + + `escape sequences`:idx: + `manual.html#120 <manual.html#120>`_ + + `ESPIPE`:idx: + `posix.html#291 <posix.html#291>`_ + + `ESRCH`:idx: + `posix.html#292 <posix.html#292>`_ + + `EStackOverflow`:idx: + `system.html#148 <system.html#148>`_ + + `ESTALE`:idx: + `posix.html#293 <posix.html#293>`_ + + `ESynch`:idx: + `system.html#132 <system.html#132>`_ + + `ESystem`:idx: + `system.html#133 <system.html#133>`_ + + `ETIME`:idx: + `posix.html#294 <posix.html#294>`_ + + `ETIMEDOUT`:idx: + `posix.html#295 <posix.html#295>`_ + + `ETXTBSY`:idx: + `posix.html#296 <posix.html#296>`_ + + `EWOULDBLOCK`:idx: + `posix.html#297 <posix.html#297>`_ + + `except`:idx: + `manual.html#189 <manual.html#189>`_ + + `exception handlers`:idx: + `manual.html#188 <manual.html#188>`_ + + `excl`:idx: + `system.html#165 <system.html#165>`_ + + `EXDEV`:idx: + `posix.html#298 <posix.html#298>`_ + + `execl`:idx: + `posix.html#977 <posix.html#977>`_ + + `execle`:idx: + `posix.html#978 <posix.html#978>`_ + + `execlp`:idx: + `posix.html#979 <posix.html#979>`_ + + `executeShellCommand`:idx: + `os.html#133 <os.html#133>`_ + + `execv`:idx: + `posix.html#980 <posix.html#980>`_ + + `execve`:idx: + `posix.html#981 <posix.html#981>`_ + + `execvp`:idx: + `posix.html#982 <posix.html#982>`_ + + `ExeExt`:idx: + `os.html#107 <os.html#107>`_ + + `existsDir`:idx: + `os.html#139 <os.html#139>`_ + + `existsEnv`:idx: + `os.html#144 <os.html#144>`_ + + `ExistsFile`:idx: + `os.html#117 <os.html#117>`_ + + `exp`:idx: + `math.html#114 <math.html#114>`_ + + `expandFilename`:idx: + `os.html#116 <os.html#116>`_ + + `exportc`:idx: + `nimrodc.html#102 <nimrodc.html#102>`_ + + `extractDir`:idx: + `os.html#126 <os.html#126>`_ + + `extractFileExt`:idx: + `os.html#128 <os.html#128>`_ + + `extractFilename`:idx: + `os.html#127 <os.html#127>`_ + + `extractFileTrunk`:idx: + `os.html#129 <os.html#129>`_ + + `ExtSep`:idx: + `os.html#109 <os.html#109>`_ + + `fastcall`:idx: + `manual.html#169 <manual.html#169>`_ + + `fatal`:idx: + `manual.html#227 <manual.html#227>`_ + + `fchdir`:idx: + `posix.html#984 <posix.html#984>`_ + + `fchmod`:idx: + `posix.html#1059 <posix.html#1059>`_ + + `fchown`:idx: + `posix.html#983 <posix.html#983>`_ + + `fcntl`:idx: + `posix.html#812 <posix.html#812>`_ + + `fdatasync`:idx: + `posix.html#985 <posix.html#985>`_ + + `FD_CLOEXEC`:idx: + `posix.html#309 <posix.html#309>`_ + + `FD_CLR`:idx: + `posix.html#1161 <posix.html#1161>`_ + + `FD_ISSET`:idx: + `posix.html#1162 <posix.html#1162>`_ + + `FD_SET`:idx: + `posix.html#1163 <posix.html#1163>`_ + + `FD_SETSIZE`:idx: + `posix.html#774 <posix.html#774>`_ + + `F_DUPFD`:idx: + `posix.html#299 <posix.html#299>`_ + + `FD_ZERO`:idx: + `posix.html#1164 <posix.html#1164>`_ + + `FE_ALL_EXCEPT`:idx: + `posix.html#337 <posix.html#337>`_ + + `feclearexcept`:idx: + `posix.html#816 <posix.html#816>`_ + + `FE_DFL_ENV`:idx: + `posix.html#342 <posix.html#342>`_ + + `FE_DIVBYZERO`:idx: + `posix.html#332 <posix.html#332>`_ + + `FE_DOWNWARD`:idx: + `posix.html#338 <posix.html#338>`_ + + `fegetenv`:idx: + `posix.html#823 <posix.html#823>`_ + + `fegetexceptflag`:idx: + `posix.html#817 <posix.html#817>`_ + + `fegetround`:idx: + `posix.html#821 <posix.html#821>`_ + + `feholdexcept`:idx: + `posix.html#824 <posix.html#824>`_ + + `FE_INEXACT`:idx: + `posix.html#333 <posix.html#333>`_ + + `FE_INVALID`:idx: + `posix.html#334 <posix.html#334>`_ + + `FE_OVERFLOW`:idx: + `posix.html#335 <posix.html#335>`_ + + `feraiseexcept`:idx: + `posix.html#818 <posix.html#818>`_ + + `fesetenv`:idx: + `posix.html#825 <posix.html#825>`_ + + `fesetexceptflag`:idx: + `posix.html#819 <posix.html#819>`_ + + `fesetround`:idx: + `posix.html#822 <posix.html#822>`_ + + `fetestexcept`:idx: + `posix.html#820 <posix.html#820>`_ + + `FE_TONEAREST`:idx: + `posix.html#339 <posix.html#339>`_ + + `FE_TOWARDZERO`:idx: + `posix.html#340 <posix.html#340>`_ + + `FE_UNDERFLOW`:idx: + `posix.html#336 <posix.html#336>`_ + + `feupdateenv`:idx: + `posix.html#826 <posix.html#826>`_ + + `FE_UPWARD`:idx: + `posix.html#341 <posix.html#341>`_ + + `F_GETFD`:idx: + `posix.html#300 <posix.html#300>`_ + + `F_GETFL`:idx: + `posix.html#302 <posix.html#302>`_ + + `F_GETLK`:idx: + `posix.html#304 <posix.html#304>`_ + + `F_GETOWN`:idx: + `posix.html#307 <posix.html#307>`_ + + `fileHandle`:idx: + `system.html#509 <system.html#509>`_ + + `fileNewer`:idx: + `os.html#141 <os.html#141>`_ + + `FileSystemCaseSensitive`:idx: + `os.html#106 <os.html#106>`_ + + `finally`:idx: + `manual.html#190 <manual.html#190>`_ + + `find`:idx: + * `system.html#456 <system.html#456>`_ + * `regexprs.html#109 <regexprs.html#109>`_ + * `regexprs.html#110 <regexprs.html#110>`_ + + `findSubStr`:idx: + * `strutils.html#112 <strutils.html#112>`_ + * `strutils.html#113 <strutils.html#113>`_ + + `float`:idx: + `system.html#106 <system.html#106>`_ + + `float32`:idx: + `system.html#107 <system.html#107>`_ + + `float64`:idx: + `system.html#108 <system.html#108>`_ + + `F_LOCK`:idx: + `posix.html#496 <posix.html#496>`_ + + `FlushFile`:idx: + `system.html#487 <system.html#487>`_ + + `fmtmsg`:idx: + `posix.html#827 <posix.html#827>`_ + + `fnmatch`:idx: + `posix.html#828 <posix.html#828>`_ + + `FNM_NOESCAPE`:idx: + `posix.html#365 <posix.html#365>`_ + + `FNM_NOMATCH`:idx: + `posix.html#362 <posix.html#362>`_ + + `FNM_NOSYS`:idx: + `posix.html#366 <posix.html#366>`_ + + `FNM_PATHNAME`:idx: + `posix.html#363 <posix.html#363>`_ + + `FNM_PERIOD`:idx: + `posix.html#364 <posix.html#364>`_ + + `F_OK`:idx: + `posix.html#478 <posix.html#478>`_ + + `for`:idx: + `manual.html#205 <manual.html#205>`_ + + `fork`:idx: + `posix.html#986 <posix.html#986>`_ + + `form feed`:idx: + `manual.html#124 <manual.html#124>`_ + + `forward`:idx: + `manual.html#202 <manual.html#202>`_ + + `fpathconf`:idx: + `posix.html#987 <posix.html#987>`_ + + `F_RDLCK`:idx: + `posix.html#310 <posix.html#310>`_ + + `FreeEnvironmentStringsA`:idx: + `os.html#151 <os.html#151>`_ + + `frexp`:idx: + `math.html#115 <math.html#115>`_ + + `F_SETFD`:idx: + `posix.html#301 <posix.html#301>`_ + + `F_SETFL`:idx: + `posix.html#303 <posix.html#303>`_ + + `F_SETLK`:idx: + `posix.html#305 <posix.html#305>`_ + + `F_SETLKW`:idx: + `posix.html#306 <posix.html#306>`_ + + `F_SETOWN`:idx: + `posix.html#308 <posix.html#308>`_ + + `fstat`:idx: + `posix.html#1060 <posix.html#1060>`_ + + `fstatvfs`:idx: + `posix.html#1057 <posix.html#1057>`_ + + `fsync`:idx: + `posix.html#988 <posix.html#988>`_ + + `F_TEST`:idx: + `posix.html#497 <posix.html#497>`_ + + `F_TLOCK`:idx: + `posix.html#498 <posix.html#498>`_ + + `ftok`:idx: + `posix.html#1055 <posix.html#1055>`_ + + `ftruncate`:idx: + `posix.html#989 <posix.html#989>`_ + + `ftw`:idx: + `posix.html#829 <posix.html#829>`_ + + `FTW_CHDIR`:idx: + `posix.html#377 <posix.html#377>`_ + + `FTW_D`:idx: + `posix.html#368 <posix.html#368>`_ + + `FTW_DEPTH`:idx: + `posix.html#376 <posix.html#376>`_ + + `FTW_DNR`:idx: + `posix.html#369 <posix.html#369>`_ + + `FTW_DP`:idx: + `posix.html#370 <posix.html#370>`_ + + `FTW_F`:idx: + `posix.html#367 <posix.html#367>`_ + + `FTW_MOUNT`:idx: + `posix.html#375 <posix.html#375>`_ + + `FTW_NS`:idx: + `posix.html#371 <posix.html#371>`_ + + `FTW_PHYS`:idx: + `posix.html#374 <posix.html#374>`_ + + `FTW_SL`:idx: + `posix.html#372 <posix.html#372>`_ + + `FTW_SLN`:idx: + `posix.html#373 <posix.html#373>`_ + + `F_ULOCK`:idx: + `posix.html#499 <posix.html#499>`_ + + `functional`:idx: + `manual.html#163 <manual.html#163>`_ + + `F_UNLCK`:idx: + `posix.html#311 <posix.html#311>`_ + + `funtions`:idx: + `manual.html#200 <manual.html#200>`_ + + `F_WRLCK`:idx: + `posix.html#312 <posix.html#312>`_ + + `GC_disable`:idx: + `system.html#457 <system.html#457>`_ + + `GC_disableMarkAndSweep`:idx: + `system.html#463 <system.html#463>`_ + + `GC_enable`:idx: + `system.html#458 <system.html#458>`_ + + `GC_enableMarkAndSweep`:idx: + `system.html#462 <system.html#462>`_ + + `GC_fullCollect`:idx: + `system.html#459 <system.html#459>`_ + + `GC_getStatistics`:idx: + `system.html#464 <system.html#464>`_ + + `GC_ref`:idx: + * `system.html#465 <system.html#465>`_ + * `system.html#466 <system.html#466>`_ + * `system.html#467 <system.html#467>`_ + + `GC_setStrategy`:idx: + `system.html#461 <system.html#461>`_ + + `GC_unref`:idx: + * `system.html#468 <system.html#468>`_ + * `system.html#469 <system.html#469>`_ + * `system.html#470 <system.html#470>`_ + + `generic character types`:idx: + `regexprs.html#102 <regexprs.html#102>`_ + + `Generics`:idx: + `manual.html#209 <manual.html#209>`_ + + `getApplicationDir`:idx: + `os.html#110 <os.html#110>`_ + + `getApplicationFilename`:idx: + `os.html#111 <os.html#111>`_ + + `getClockStr`:idx: + `times.html#112 <times.html#112>`_ + + `getColNumber`:idx: + `lexbase.html#107 <lexbase.html#107>`_ + + `getColumn`:idx: + `parsecfg.html#107 <parsecfg.html#107>`_ + + `getConfigDir`:idx: + `os.html#115 <os.html#115>`_ + + `getcontext`:idx: + `posix.html#1188 <posix.html#1188>`_ + + `get_crc_table`:idx: + `zlib.html#186 <zlib.html#186>`_ + + `getCurrentDir`:idx: + `os.html#112 <os.html#112>`_ + + `getCurrentExceptionMsg`:idx: + * `manual.html#184 <manual.html#184>`_ + * `system.html#428 <system.html#428>`_ + + `getCurrentLine`:idx: + `lexbase.html#106 <lexbase.html#106>`_ + + `getcwd`:idx: + `posix.html#990 <posix.html#990>`_ + + `getdate`:idx: + `posix.html#1103 <posix.html#1103>`_ + + `getDateStr`:idx: + `times.html#111 <times.html#111>`_ + + `getegid`:idx: + `posix.html#991 <posix.html#991>`_ + + `getEnv`:idx: + `os.html#143 <os.html#143>`_ + + `GetEnvironmentStringsA`:idx: + `os.html#150 <os.html#150>`_ + + `geteuid`:idx: + `posix.html#992 <posix.html#992>`_ + + `getFilename`:idx: + `parsecfg.html#109 <parsecfg.html#109>`_ + + `getFilePos`:idx: + `system.html#507 <system.html#507>`_ + + `getFileSize`:idx: + `system.html#499 <system.html#499>`_ + + `getFreeMem`:idx: + `system.html#434 <system.html#434>`_ + + `getgid`:idx: + `posix.html#993 <posix.html#993>`_ + + `getGMTime`:idx: + `times.html#107 <times.html#107>`_ + + `getgrent`:idx: + `posix.html#837 <posix.html#837>`_ + + `getgrgid`:idx: + `posix.html#833 <posix.html#833>`_ + + `getgrgid_r`:idx: + `posix.html#835 <posix.html#835>`_ + + `getgrnam`:idx: + `posix.html#834 <posix.html#834>`_ + + `getgrnam_r`:idx: + `posix.html#836 <posix.html#836>`_ + + `getgroups`:idx: + `posix.html#994 <posix.html#994>`_ + + `getHomeDir`:idx: + `os.html#114 <os.html#114>`_ + + `gethostid`:idx: + `posix.html#995 <posix.html#995>`_ + + `gethostname`:idx: + `posix.html#996 <posix.html#996>`_ + + `getLastModificationTime`:idx: + `os.html#140 <os.html#140>`_ + + `getLine`:idx: + `parsecfg.html#108 <parsecfg.html#108>`_ + + `getLocalTime`:idx: + `times.html#106 <times.html#106>`_ + + `getlogin`:idx: + `posix.html#997 <posix.html#997>`_ + + `getlogin_r`:idx: + `posix.html#998 <posix.html#998>`_ + + `getOccupiedMem`:idx: + `system.html#433 <system.html#433>`_ + + `getopt`:idx: + * `parseopt.html#106 <parseopt.html#106>`_ + * `posix.html#999 <posix.html#999>`_ + + `getpgid`:idx: + `posix.html#1000 <posix.html#1000>`_ + + `getpgrp`:idx: + `posix.html#1001 <posix.html#1001>`_ + + `getpid`:idx: + `posix.html#1002 <posix.html#1002>`_ + + `getppid`:idx: + `posix.html#1003 <posix.html#1003>`_ + + `getpwent`:idx: + `posix.html#864 <posix.html#864>`_ + + `getpwnam`:idx: + `posix.html#859 <posix.html#859>`_ + + `getpwnam_r`:idx: + `posix.html#861 <posix.html#861>`_ + + `getpwuid`:idx: + `posix.html#860 <posix.html#860>`_ + + `getpwuid_r`:idx: + `posix.html#862 <posix.html#862>`_ + + `getRefcount`:idx: + `system.html#427 <system.html#427>`_ + + `getRestOfCommandLine`:idx: + `parseopt.html#105 <parseopt.html#105>`_ + + `getsid`:idx: + `posix.html#1004 <posix.html#1004>`_ + + `getStartMilsecs`:idx: + `times.html#116 <times.html#116>`_ + + `getStream`:idx: + `zipfiles.html#109 <zipfiles.html#109>`_ + + `getTime`:idx: + `times.html#105 <times.html#105>`_ + + `getTotalMem`:idx: + `system.html#435 <system.html#435>`_ + + `getuid`:idx: + `posix.html#1005 <posix.html#1005>`_ + + `getwd`:idx: + `posix.html#1006 <posix.html#1006>`_ + + `glob`:idx: + `posix.html#831 <posix.html#831>`_ + + `GLOB_ABORTED`:idx: + `posix.html#385 <posix.html#385>`_ + + `GLOB_APPEND`:idx: + `posix.html#378 <posix.html#378>`_ + + `GLOB_DOOFFS`:idx: + `posix.html#379 <posix.html#379>`_ + + `GLOB_ERR`:idx: + `posix.html#380 <posix.html#380>`_ + + `globfree`:idx: + `posix.html#832 <posix.html#832>`_ + + `GLOB_MARK`:idx: + `posix.html#381 <posix.html#381>`_ + + `GLOB_NOCHECK`:idx: + `posix.html#382 <posix.html#382>`_ + + `GLOB_NOESCAPE`:idx: + `posix.html#383 <posix.html#383>`_ + + `GLOB_NOMATCH`:idx: + `posix.html#386 <posix.html#386>`_ + + `GLOB_NOSORT`:idx: + `posix.html#384 <posix.html#384>`_ + + `GLOB_NOSPACE`:idx: + `posix.html#387 <posix.html#387>`_ + + `GLOB_NOSYS`:idx: + `posix.html#388 <posix.html#388>`_ + + `gmtime`:idx: + `posix.html#1104 <posix.html#1104>`_ + + `gmtime_r`:idx: + `posix.html#1105 <posix.html#1105>`_ + + `gzclose`:idx: + `zlib.html#172 <zlib.html#172>`_ + + `gzdopen`:idx: + `zlib.html#158 <zlib.html#158>`_ + + `gzeof`:idx: + `zlib.html#171 <zlib.html#171>`_ + + `gzerror`:idx: + `zlib.html#173 <zlib.html#173>`_ + + `gzFile`:idx: + `zlib.html#115 <zlib.html#115>`_ + + `gzflush`:idx: + `zlib.html#167 <zlib.html#167>`_ + + `gzgetc`:idx: + `zlib.html#166 <zlib.html#166>`_ + + `gzgets`:idx: + `zlib.html#164 <zlib.html#164>`_ + + `gzopen`:idx: + `zlib.html#157 <zlib.html#157>`_ + + `gzprintf`:idx: + `zlib.html#162 <zlib.html#162>`_ + + `gzputc`:idx: + `zlib.html#165 <zlib.html#165>`_ + + `gzputs`:idx: + `zlib.html#163 <zlib.html#163>`_ + + `gzread`:idx: + `zlib.html#160 <zlib.html#160>`_ + + `gzrewind`:idx: + `zlib.html#169 <zlib.html#169>`_ + + `gzseek`:idx: + `zlib.html#168 <zlib.html#168>`_ + + `gzsetparams`:idx: + `zlib.html#159 <zlib.html#159>`_ + + `gztell`:idx: + `zlib.html#170 <zlib.html#170>`_ + + `gzwrite`:idx: + `zlib.html#161 <zlib.html#161>`_ + + `HandleCR`:idx: + `lexbase.html#108 <lexbase.html#108>`_ + + `HandleLF`:idx: + `lexbase.html#109 <lexbase.html#109>`_ + + `hash`:idx: + * `hashes.html#103 <hashes.html#103>`_ + * `hashes.html#104 <hashes.html#104>`_ + * `hashes.html#105 <hashes.html#105>`_ + * `hashes.html#106 <hashes.html#106>`_ + * `hashes.html#107 <hashes.html#107>`_ + + `hashData`:idx: + `hashes.html#102 <hashes.html#102>`_ + + `hashIgnoreCase`:idx: + `hashes.html#109 <hashes.html#109>`_ + + `hashIgnoreStyle`:idx: + `hashes.html#108 <hashes.html#108>`_ + + `hasKey`:idx: + `strtabs.html#108 <strtabs.html#108>`_ + + `header`:idx: + `nimrodc.html#105 <nimrodc.html#105>`_ + + `high`:idx: + `system.html#118 <system.html#118>`_ + + `hint`:idx: + * `manual.html#221 <manual.html#221>`_ + * `manual.html#229 <manual.html#229>`_ + + `htonl`:idx: + `posix.html#792 <posix.html#792>`_ + + `htons`:idx: + `posix.html#793 <posix.html#793>`_ + + `hypot`:idx: + `math.html#123 <math.html#123>`_ + + `iconv`:idx: + `posix.html#841 <posix.html#841>`_ + + `iconv_close`:idx: + `posix.html#842 <posix.html#842>`_ + + `iconv_open`:idx: + `posix.html#840 <posix.html#840>`_ + + `identifier`:idx: + `manual.html#105 <manual.html#105>`_ + + `Identifiers`:idx: + `manual.html#116 <manual.html#116>`_ + + `if`:idx: + `manual.html#181 <manual.html#181>`_ + + `implicit block`:idx: + `manual.html#207 <manual.html#207>`_ + + `import`:idx: + `manual.html#217 <manual.html#217>`_ + + `importc`:idx: + `nimrodc.html#101 <nimrodc.html#101>`_ + + `in`:idx: + `system.html#355 <system.html#355>`_ + + `inc`:idx: + `system.html#156 <system.html#156>`_ + + `incl`:idx: + `system.html#164 <system.html#164>`_ + + `indentation sensitive`:idx: + `manual.html#113 <manual.html#113>`_ + + `inet_addr`:idx: + `posix.html#796 <posix.html#796>`_ + + `inet_ntoa`:idx: + `posix.html#797 <posix.html#797>`_ + + `inet_ntop`:idx: + `posix.html#798 <posix.html#798>`_ + + `inet_pton`:idx: + `posix.html#799 <posix.html#799>`_ + + `inf`:idx: + `system.html#429 <system.html#429>`_ + + `inflate`:idx: + `zlib.html#145 <zlib.html#145>`_ + + `inflateEnd`:idx: + `zlib.html#146 <zlib.html#146>`_ + + `inflateInit`:idx: + `zlib.html#179 <zlib.html#179>`_ + + `inflateInit2`:idx: + `zlib.html#183 <zlib.html#183>`_ + + `inflateInit2u`:idx: + `zlib.html#181 <zlib.html#181>`_ + + `inflateInitu`:idx: + `zlib.html#177 <zlib.html#177>`_ + + `inflateReset`:idx: + `zlib.html#153 <zlib.html#153>`_ + + `inflateSetDictionary`:idx: + `zlib.html#151 <zlib.html#151>`_ + + `inflateSync`:idx: + `zlib.html#152 <zlib.html#152>`_ + + `inflateSyncPoint`:idx: + `zlib.html#185 <zlib.html#185>`_ + + `info`:idx: + `dialogs.html#102 <dialogs.html#102>`_ + + `information hiding`:idx: + `manual.html#215 <manual.html#215>`_ + + `init`:idx: + `parseopt.html#103 <parseopt.html#103>`_ + + `inline`:idx: + `manual.html#168 <manual.html#168>`_ + + `in_Operator`:idx: + `system.html#354 <system.html#354>`_ + + `in_Operator`:idx: + * `strutils.html#124 <strutils.html#124>`_ + * `strutils.html#125 <strutils.html#125>`_ + + `int`:idx: + `system.html#101 <system.html#101>`_ + + `int16`:idx: + `system.html#103 <system.html#103>`_ + + `int32`:idx: + `system.html#104 <system.html#104>`_ + + `int64`:idx: + `system.html#105 <system.html#105>`_ + + `int8`:idx: + `system.html#102 <system.html#102>`_ + + `intToStr`:idx: + `strutils.html#127 <strutils.html#127>`_ + + `IPC_CREAT`:idx: + `posix.html#642 <posix.html#642>`_ + + `IPC_EXCL`:idx: + `posix.html#643 <posix.html#643>`_ + + `IPC_NOWAIT`:idx: + `posix.html#644 <posix.html#644>`_ + + `IPC_PRIVATE`:idx: + `posix.html#645 <posix.html#645>`_ + + `IPC_RMID`:idx: + `posix.html#646 <posix.html#646>`_ + + `IPC_SET`:idx: + `posix.html#647 <posix.html#647>`_ + + `IPC_STAT`:idx: + `posix.html#648 <posix.html#648>`_ + + `is`:idx: + `system.html#357 <system.html#357>`_ + + `isatty`:idx: + `posix.html#1007 <posix.html#1007>`_ + + `isMainModule`:idx: + `system.html#390 <system.html#390>`_ + + `isNil`:idx: + * `system.html#444 <system.html#444>`_ + * `system.html#445 <system.html#445>`_ + * `system.html#446 <system.html#446>`_ + * `system.html#447 <system.html#447>`_ + * `system.html#448 <system.html#448>`_ + * `system.html#449 <system.html#449>`_ + + `is_not`:idx: + `system.html#358 <system.html#358>`_ + + `isPowerOfTwo`:idx: + `math.html#105 <math.html#105>`_ + + `items`:idx: + * `system.html#438 <system.html#438>`_ + * `system.html#439 <system.html#439>`_ + * `system.html#440 <system.html#440>`_ + * `system.html#441 <system.html#441>`_ + * `system.html#442 <system.html#442>`_ + * `system.html#443 <system.html#443>`_ + + `iterator`:idx: + `manual.html#206 <manual.html#206>`_ + + `iterOverEnvironment`:idx: + `os.html#152 <os.html#152>`_ + + `JavaScript`:idx: + `nimrodc.html#116 <nimrodc.html#116>`_ + + `JoinPath`:idx: + * `os.html#118 <os.html#118>`_ + * `os.html#120 <os.html#120>`_ + + `keywords`:idx: + `manual.html#117 <manual.html#117>`_ + + `kill`:idx: + `posix.html#1123 <posix.html#1123>`_ + + `killpg`:idx: + `posix.html#1124 <posix.html#1124>`_ + + `l-values`:idx: + `manual.html#107 <manual.html#107>`_ + + `LC_ALL`:idx: + `posix.html#444 <posix.html#444>`_ + + `LC_COLLATE`:idx: + `posix.html#445 <posix.html#445>`_ + + `LC_CTYPE`:idx: + `posix.html#446 <posix.html#446>`_ + + `lchown`:idx: + `posix.html#1008 <posix.html#1008>`_ + + `LC_MESSAGES`:idx: + `posix.html#447 <posix.html#447>`_ + + `LC_MONETARY`:idx: + `posix.html#448 <posix.html#448>`_ + + `LC_NUMERIC`:idx: + `posix.html#449 <posix.html#449>`_ + + `LC_TIME`:idx: + `posix.html#450 <posix.html#450>`_ + + `len`:idx: + * `system.html#159 <system.html#159>`_ + * `system.html#160 <system.html#160>`_ + * `system.html#161 <system.html#161>`_ + * `system.html#162 <system.html#162>`_ + * `system.html#163 <system.html#163>`_ + * `strtabs.html#109 <strtabs.html#109>`_ + + `line feed`:idx: + `manual.html#123 <manual.html#123>`_ + + `line_dir`:idx: + `nimrodc.html#108 <nimrodc.html#108>`_ + + `lines`:idx: + `system.html#508 <system.html#508>`_ + + `line_trace`:idx: + `nimrodc.html#110 <nimrodc.html#110>`_ + + `link`:idx: + `posix.html#1009 <posix.html#1009>`_ + + `lio_listio`:idx: + `posix.html#791 <posix.html#791>`_ + + `LIO_NOP`:idx: + `posix.html#210 <posix.html#210>`_ + + `LIO_NOWAIT`:idx: + `posix.html#211 <posix.html#211>`_ + + `LIO_READ`:idx: + `posix.html#212 <posix.html#212>`_ + + `LIO_WAIT`:idx: + `posix.html#213 <posix.html#213>`_ + + `LIO_WRITE`:idx: + `posix.html#214 <posix.html#214>`_ + + `Literal strings`:idx: + `manual.html#119 <manual.html#119>`_ + + `ln`:idx: + `math.html#111 <math.html#111>`_ + + `localeconv`:idx: + `posix.html#846 <posix.html#846>`_ + + `localtime`:idx: + `posix.html#1106 <posix.html#1106>`_ + + `localtime_r`:idx: + `posix.html#1107 <posix.html#1107>`_ + + `locations`:idx: + `manual.html#101 <manual.html#101>`_ + + `lockf`:idx: + `posix.html#1010 <posix.html#1010>`_ + + `log10`:idx: + `math.html#112 <math.html#112>`_ + + `log2`:idx: + `math.html#113 <math.html#113>`_ + + `low`:idx: + `system.html#119 <system.html#119>`_ + + `lseek`:idx: + `posix.html#1011 <posix.html#1011>`_ + + `lstat`:idx: + `posix.html#1061 <posix.html#1061>`_ + + `Macros`:idx: + `manual.html#212 <manual.html#212>`_ + + `makecontext`:idx: + `posix.html#1189 <posix.html#1189>`_ + + `MAP_FAILED`:idx: + `posix.html#686 <posix.html#686>`_ + + `MAP_FIXED`:idx: + `posix.html#680 <posix.html#680>`_ + + `MAP_PRIVATE`:idx: + `posix.html#679 <posix.html#679>`_ + + `MAP_SHARED`:idx: + `posix.html#678 <posix.html#678>`_ + + `match`:idx: + * `regexprs.html#106 <regexprs.html#106>`_ + * `regexprs.html#107 <regexprs.html#107>`_ + + `matchLen`:idx: + `regexprs.html#108 <regexprs.html#108>`_ + + `math`:idx: + `nimrodc.html#118 <nimrodc.html#118>`_ + + `max`:idx: + * `system.html#268 <system.html#268>`_ + * `system.html#269 <system.html#269>`_ + * `system.html#270 <system.html#270>`_ + * `system.html#271 <system.html#271>`_ + * `system.html#272 <system.html#272>`_ + * `system.html#319 <system.html#319>`_ + + `MaxSubpatterns`:idx: + `regexprs.html#105 <regexprs.html#105>`_ + + `MCL_CURRENT`:idx: + `posix.html#684 <posix.html#684>`_ + + `MCL_FUTURE`:idx: + `posix.html#685 <posix.html#685>`_ + + `methods`:idx: + `manual.html#199 <manual.html#199>`_ + + `min`:idx: + * `system.html#263 <system.html#263>`_ + * `system.html#264 <system.html#264>`_ + * `system.html#265 <system.html#265>`_ + * `system.html#266 <system.html#266>`_ + * `system.html#267 <system.html#267>`_ + * `system.html#318 <system.html#318>`_ + + `MINSIGSTKSZ`:idx: + `posix.html#766 <posix.html#766>`_ + + `mkdir`:idx: + `posix.html#1062 <posix.html#1062>`_ + + `mkfifo`:idx: + `posix.html#1063 <posix.html#1063>`_ + + `mknod`:idx: + `posix.html#1064 <posix.html#1064>`_ + + `mktime`:idx: + `posix.html#1108 <posix.html#1108>`_ + + `mlock`:idx: + `posix.html#1078 <posix.html#1078>`_ + + `mlockall`:idx: + `posix.html#1079 <posix.html#1079>`_ + + `mmap`:idx: + `posix.html#1080 <posix.html#1080>`_ + + `MM_APPL`:idx: + `posix.html#346 <posix.html#346>`_ + + `MM_CONSOLE`:idx: + `posix.html#357 <posix.html#357>`_ + + `MM_ERROR`:idx: + `posix.html#352 <posix.html#352>`_ + + `MM_FIRM`:idx: + `posix.html#345 <posix.html#345>`_ + + `MM_HALT`:idx: + `posix.html#351 <posix.html#351>`_ + + `MM_HARD`:idx: + `posix.html#343 <posix.html#343>`_ + + `MM_INFO`:idx: + `posix.html#354 <posix.html#354>`_ + + `MM_NOCON`:idx: + `posix.html#361 <posix.html#361>`_ + + `MM_NOMSG`:idx: + `posix.html#360 <posix.html#360>`_ + + `MM_NOSEV`:idx: + `posix.html#355 <posix.html#355>`_ + + `MM_NOTOK`:idx: + `posix.html#359 <posix.html#359>`_ + + `MM_NRECOV`:idx: + `posix.html#350 <posix.html#350>`_ + + `MM_NULLACT`:idx: + `posix.html#125 <posix.html#125>`_ + + `MM_NULLLBL`:idx: + `posix.html#121 <posix.html#121>`_ + + `MM_NULLMC`:idx: + `posix.html#123 <posix.html#123>`_ + + `MM_NULLSEV`:idx: + `posix.html#122 <posix.html#122>`_ + + `MM_NULLTAG`:idx: + `posix.html#126 <posix.html#126>`_ + + `MM_NULLTXT`:idx: + `posix.html#124 <posix.html#124>`_ + + `MM_OK`:idx: + `posix.html#358 <posix.html#358>`_ + + `MM_OPSYS`:idx: + `posix.html#348 <posix.html#348>`_ + + `MM_PRINT`:idx: + `posix.html#356 <posix.html#356>`_ + + `MM_RECOVER`:idx: + `posix.html#349 <posix.html#349>`_ + + `MM_SOFT`:idx: + `posix.html#344 <posix.html#344>`_ + + `MM_UTIL`:idx: + `posix.html#347 <posix.html#347>`_ + + `MM_WARNING`:idx: + `posix.html#353 <posix.html#353>`_ + + `mod`:idx: + * `system.html#213 <system.html#213>`_ + * `system.html#214 <system.html#214>`_ + * `system.html#215 <system.html#215>`_ + * `system.html#216 <system.html#216>`_ + * `system.html#217 <system.html#217>`_ + + `module`:idx: + `manual.html#214 <manual.html#214>`_ + + `MON_1`:idx: + `posix.html#410 <posix.html#410>`_ + + `MON_10`:idx: + `posix.html#419 <posix.html#419>`_ + + `MON_11`:idx: + `posix.html#420 <posix.html#420>`_ + + `MON_12`:idx: + `posix.html#421 <posix.html#421>`_ + + `MON_2`:idx: + `posix.html#411 <posix.html#411>`_ + + `MON_3`:idx: + `posix.html#412 <posix.html#412>`_ + + `MON_4`:idx: + `posix.html#413 <posix.html#413>`_ + + `MON_5`:idx: + `posix.html#414 <posix.html#414>`_ + + `MON_6`:idx: + `posix.html#415 <posix.html#415>`_ + + `MON_7`:idx: + `posix.html#416 <posix.html#416>`_ + + `MON_8`:idx: + `posix.html#417 <posix.html#417>`_ + + `MON_9`:idx: + `posix.html#418 <posix.html#418>`_ + + `moveFile`:idx: + `os.html#135 <os.html#135>`_ + + `moveMem`:idx: + `system.html#409 <system.html#409>`_ + + `mprotect`:idx: + `posix.html#1081 <posix.html#1081>`_ + + `mq_close`:idx: + `posix.html#849 <posix.html#849>`_ + + `mq_getattr`:idx: + `posix.html#850 <posix.html#850>`_ + + `mq_notify`:idx: + `posix.html#851 <posix.html#851>`_ + + `mq_open`:idx: + `posix.html#852 <posix.html#852>`_ + + `mq_receive`:idx: + `posix.html#853 <posix.html#853>`_ + + `mq_send`:idx: + `posix.html#854 <posix.html#854>`_ + + `mq_setattr`:idx: + `posix.html#855 <posix.html#855>`_ + + `mq_timedreceive`:idx: + `posix.html#856 <posix.html#856>`_ + + `mq_timedsend`:idx: + `posix.html#857 <posix.html#857>`_ + + `mq_unlink`:idx: + `posix.html#858 <posix.html#858>`_ + + `MS_ASYNC`:idx: + `posix.html#681 <posix.html#681>`_ + + `MS_INVALIDATE`:idx: + `posix.html#683 <posix.html#683>`_ + + `MS_SYNC`:idx: + `posix.html#682 <posix.html#682>`_ + + `msync`:idx: + `posix.html#1082 <posix.html#1082>`_ + + `munlock`:idx: + `posix.html#1083 <posix.html#1083>`_ + + `munlockall`:idx: + `posix.html#1084 <posix.html#1084>`_ + + `munmap`:idx: + `posix.html#1085 <posix.html#1085>`_ + + `nan`:idx: + `system.html#431 <system.html#431>`_ + + `nanosleep`:idx: + `posix.html#1109 <posix.html#1109>`_ + + `Natural`:idx: + `system.html#126 <system.html#126>`_ + + `neginf`:idx: + `system.html#430 <system.html#430>`_ + + `new`:idx: + * `system.html#116 <system.html#116>`_ + * `system.html#117 <system.html#117>`_ + + `newFileStream`:idx: + * `streams.html#120 <streams.html#120>`_ + * `streams.html#121 <streams.html#121>`_ + + `newline`:idx: + `manual.html#121 <manual.html#121>`_ + + `NewLines`:idx: + `lexbase.html#102 <lexbase.html#102>`_ + + `newSeq`:idx: + `system.html#158 <system.html#158>`_ + + `newString`:idx: + `system.html#406 <system.html#406>`_ + + `newStringStream`:idx: + `streams.html#117 <streams.html#117>`_ + + `newStringTable`:idx: + * `strtabs.html#104 <strtabs.html#104>`_ + * `strtabs.html#105 <strtabs.html#105>`_ + + `next`:idx: + * `parseopt.html#104 <parseopt.html#104>`_ + * `parsecfg.html#106 <parsecfg.html#106>`_ + + `nextPowerOfTwo`:idx: + `math.html#106 <math.html#106>`_ + + `nftw`:idx: + `posix.html#830 <posix.html#830>`_ + + `nice`:idx: + `posix.html#1012 <posix.html#1012>`_ + + `nimcall`:idx: + `manual.html#170 <manual.html#170>`_ + + `NimrodMajor`:idx: + `system.html#394 <system.html#394>`_ + + `NimrodMinor`:idx: + `system.html#395 <system.html#395>`_ + + `NimrodPatch`:idx: + `system.html#396 <system.html#396>`_ + + `NimrodVersion`:idx: + `system.html#393 <system.html#393>`_ + + `nl`:idx: + `strutils.html#104 <strutils.html#104>`_ + + `NL_CAT_LOCALE`:idx: + `posix.html#769 <posix.html#769>`_ + + `nl_langinfo`:idx: + `posix.html#843 <posix.html#843>`_ + + `NL_SETD`:idx: + `posix.html#768 <posix.html#768>`_ + + `noconv`:idx: + `manual.html#173 <manual.html#173>`_ + + `no_decl`:idx: + `nimrodc.html#104 <nimrodc.html#104>`_ + + `NOEXPR`:idx: + `posix.html#442 <posix.html#442>`_ + + `normalize`:idx: + `strutils.html#111 <strutils.html#111>`_ + + `no_static`:idx: + `nimrodc.html#107 <nimrodc.html#107>`_ + + `not`:idx: + * `system.html#115 <system.html#115>`_ + * `system.html#188 <system.html#188>`_ + * `system.html#189 <system.html#189>`_ + * `system.html#190 <system.html#190>`_ + * `system.html#191 <system.html#191>`_ + * `system.html#192 <system.html#192>`_ + + `not_in`:idx: + `system.html#356 <system.html#356>`_ + + `ntohl`:idx: + `posix.html#794 <posix.html#794>`_ + + `ntohs`:idx: + `posix.html#795 <posix.html#795>`_ + + `Numerical constants`:idx: + `manual.html#137 <manual.html#137>`_ + + `O_ACCMODE`:idx: + `posix.html#322 <posix.html#322>`_ + + `O_APPEND`:idx: + `posix.html#317 <posix.html#317>`_ + + `object`:idx: + `manual.html#156 <manual.html#156>`_ + + `O_CREAT`:idx: + `posix.html#313 <posix.html#313>`_ + + `ODBC_ADD_DSN`:idx: + `odbcsql.html#621 <odbcsql.html#621>`_ + + `ODBC_ADD_SYS_DSN`:idx: + `odbcsql.html#624 <odbcsql.html#624>`_ + + `ODBC_CONFIG_DSN`:idx: + `odbcsql.html#622 <odbcsql.html#622>`_ + + `ODBC_CONFIG_SYS_DSN`:idx: + `odbcsql.html#625 <odbcsql.html#625>`_ + + `ODBC_REMOVE_DSN`:idx: + `odbcsql.html#623 <odbcsql.html#623>`_ + + `ODBC_REMOVE_SYS_DSN`:idx: + `odbcsql.html#626 <odbcsql.html#626>`_ + + `O_DSYNC`:idx: + `posix.html#318 <posix.html#318>`_ + + `O_EXCL`:idx: + `posix.html#314 <posix.html#314>`_ + + `O_NOCTTY`:idx: + `posix.html#315 <posix.html#315>`_ + + `O_NONBLOCK`:idx: + `posix.html#319 <posix.html#319>`_ + + `open`:idx: + * `lexbase.html#104 <lexbase.html#104>`_ + * `parsecfg.html#104 <parsecfg.html#104>`_ + * `posix.html#813 <posix.html#813>`_ + * `zipfiles.html#102 <zipfiles.html#102>`_ + + `openarray`:idx: + `system.html#122 <system.html#122>`_ + + `opendir`:idx: + `posix.html#801 <posix.html#801>`_ + + `OpenFile`:idx: + * `system.html#482 <system.html#482>`_ + * `system.html#483 <system.html#483>`_ + + `operator`:idx: + `manual.html#139 <manual.html#139>`_ + + `Operators`:idx: + `manual.html#204 <manual.html#204>`_ + + `or`:idx: + * `system.html#233 <system.html#233>`_ + * `system.html#234 <system.html#234>`_ + * `system.html#235 <system.html#235>`_ + * `system.html#236 <system.html#236>`_ + * `system.html#237 <system.html#237>`_ + * `system.html#321 <system.html#321>`_ + + `ord`:idx: + `system.html#167 <system.html#167>`_ + + `Ordinal types`:idx: + `manual.html#142 <manual.html#142>`_ + + `O_RDONLY`:idx: + `posix.html#323 <posix.html#323>`_ + + `O_RDWR`:idx: + `posix.html#324 <posix.html#324>`_ + + `O_RSYNC`:idx: + `posix.html#320 <posix.html#320>`_ + + `OSError`:idx: + `os.html#147 <os.html#147>`_ + + `O_SYNC`:idx: + `posix.html#321 <posix.html#321>`_ + + `O_TRUNC`:idx: + `posix.html#316 <posix.html#316>`_ + + `O_WRONLY`:idx: + `posix.html#325 <posix.html#325>`_ + + `pairs`:idx: + `strtabs.html#110 <strtabs.html#110>`_ + + `P_ALL`:idx: + `posix.html#716 <posix.html#716>`_ + + `paramCount`:idx: + `os.html#145 <os.html#145>`_ + + `paramStr`:idx: + `os.html#146 <os.html#146>`_ + + `ParDir`:idx: + `os.html#102 <os.html#102>`_ + + `parentDir`:idx: + `os.html#122 <os.html#122>`_ + + `ParseBiggestInt`:idx: + `strutils.html#129 <strutils.html#129>`_ + + `parseCmdLine`:idx: + `os.html#156 <os.html#156>`_ + + `ParseFloat`:idx: + `strutils.html#130 <strutils.html#130>`_ + + `ParseInt`:idx: + `strutils.html#128 <strutils.html#128>`_ + + `pathconf`:idx: + `posix.html#1013 <posix.html#1013>`_ + + `PathSep`:idx: + `os.html#105 <os.html#105>`_ + + `pause`:idx: + `posix.html#1014 <posix.html#1014>`_ + + `pbyte`:idx: + `zlib.html#106 <zlib.html#106>`_ + + `pbytef`:idx: + `zlib.html#107 <zlib.html#107>`_ + + `PC_2_SYMLINKS`:idx: + `posix.html#500 <posix.html#500>`_ + + `PC_ALLOC_SIZE_MIN`:idx: + `posix.html#501 <posix.html#501>`_ + + `PC_ASYNC_IO`:idx: + `posix.html#502 <posix.html#502>`_ + + `PC_CHOWN_RESTRICTED`:idx: + `posix.html#503 <posix.html#503>`_ + + `PC_FILESIZEBITS`:idx: + `posix.html#504 <posix.html#504>`_ + + `PC_LINK_MAX`:idx: + `posix.html#505 <posix.html#505>`_ + + `PC_MAX_CANON`:idx: + `posix.html#506 <posix.html#506>`_ + + `PC_MAX_INPUT`:idx: + `posix.html#507 <posix.html#507>`_ + + `PC_NAME_MAX`:idx: + `posix.html#508 <posix.html#508>`_ + + `PC_NO_TRUNC`:idx: + `posix.html#509 <posix.html#509>`_ + + `PC_PATH_MAX`:idx: + `posix.html#510 <posix.html#510>`_ + + `PC_PIPE_BUF`:idx: + `posix.html#511 <posix.html#511>`_ + + `PC_PRIO_IO`:idx: + `posix.html#512 <posix.html#512>`_ + + `PC_REC_INCR_XFER_SIZE`:idx: + `posix.html#513 <posix.html#513>`_ + + `PC_REC_MIN_XFER_SIZE`:idx: + `posix.html#514 <posix.html#514>`_ + + `PC_REC_XFER_ALIGN`:idx: + `posix.html#515 <posix.html#515>`_ + + `PC_SYMLINK_MAX`:idx: + `posix.html#516 <posix.html#516>`_ + + `PC_SYNC_IO`:idx: + `posix.html#517 <posix.html#517>`_ + + `PC_VDISABLE`:idx: + `posix.html#518 <posix.html#518>`_ + + `PFileStream`:idx: + `streams.html#118 <streams.html#118>`_ + + `PFloat32`:idx: + `system.html#386 <system.html#386>`_ + + `PFloat64`:idx: + `system.html#387 <system.html#387>`_ + + `PI`:idx: + `math.html#101 <math.html#101>`_ + + `PInt32`:idx: + `system.html#389 <system.html#389>`_ + + `PInt64`:idx: + `system.html#388 <system.html#388>`_ + + `PInternalState`:idx: + `zlib.html#111 <zlib.html#111>`_ + + `pipe`:idx: + `posix.html#1015 <posix.html#1015>`_ + + `PM_STR`:idx: + `posix.html#395 <posix.html#395>`_ + + `PObject`:idx: + `system.html#129 <system.html#129>`_ + + `pointer`:idx: + `system.html#113 <system.html#113>`_ + + `pointers`:idx: + `manual.html#159 <manual.html#159>`_ + + `Positive`:idx: + `system.html#127 <system.html#127>`_ + + `POSIX_ASYNC_IO`:idx: + `posix.html#475 <posix.html#475>`_ + + `POSIX_FADV_DONTNEED`:idx: + `posix.html#330 <posix.html#330>`_ + + `posix_fadvise`:idx: + `posix.html#814 <posix.html#814>`_ + + `POSIX_FADV_NOREUSE`:idx: + `posix.html#331 <posix.html#331>`_ + + `POSIX_FADV_NORMAL`:idx: + `posix.html#326 <posix.html#326>`_ + + `POSIX_FADV_RANDOM`:idx: + `posix.html#328 <posix.html#328>`_ + + `POSIX_FADV_SEQUENTIAL`:idx: + `posix.html#327 <posix.html#327>`_ + + `POSIX_FADV_WILLNEED`:idx: + `posix.html#329 <posix.html#329>`_ + + `posix_fallocate`:idx: + `posix.html#815 <posix.html#815>`_ + + `POSIX_MADV_DONTNEED`:idx: + `posix.html#691 <posix.html#691>`_ + + `posix_madvise`:idx: + `posix.html#1086 <posix.html#1086>`_ + + `POSIX_MADV_NORMAL`:idx: + `posix.html#687 <posix.html#687>`_ + + `POSIX_MADV_RANDOM`:idx: + `posix.html#689 <posix.html#689>`_ + + `POSIX_MADV_SEQUENTIAL`:idx: + `posix.html#688 <posix.html#688>`_ + + `POSIX_MADV_WILLNEED`:idx: + `posix.html#690 <posix.html#690>`_ + + `posix_mem_offset`:idx: + `posix.html#1087 <posix.html#1087>`_ + + `POSIX_PRIO_IO`:idx: + `posix.html#476 <posix.html#476>`_ + + `posix_spawn`:idx: + `posix.html#1167 <posix.html#1167>`_ + + `posix_spawnattr_destroy`:idx: + `posix.html#1173 <posix.html#1173>`_ + + `posix_spawnattr_getflags`:idx: + `posix.html#1175 <posix.html#1175>`_ + + `posix_spawnattr_getpgroup`:idx: + `posix.html#1176 <posix.html#1176>`_ + + `posix_spawnattr_getschedparam`:idx: + `posix.html#1177 <posix.html#1177>`_ + + `posix_spawnattr_getschedpolicy`:idx: + `posix.html#1178 <posix.html#1178>`_ + + `posix_spawnattr_getsigdefault`:idx: + `posix.html#1174 <posix.html#1174>`_ + + `posix_spawnattr_getsigmask`:idx: + `posix.html#1179 <posix.html#1179>`_ + + `posix_spawnattr_init`:idx: + `posix.html#1180 <posix.html#1180>`_ + + `posix_spawnattr_setflags`:idx: + `posix.html#1182 <posix.html#1182>`_ + + `posix_spawnattr_setpgroup`:idx: + `posix.html#1183 <posix.html#1183>`_ + + `posix_spawnattr_setschedparam`:idx: + `posix.html#1184 <posix.html#1184>`_ + + `posix_spawnattr_setschedpolicy`:idx: + `posix.html#1185 <posix.html#1185>`_ + + `posix_spawnattr_setsigdefault`:idx: + `posix.html#1181 <posix.html#1181>`_ + + `posix_spawnattr_setsigmask`:idx: + `posix.html#1186 <posix.html#1186>`_ + + `posix_spawn_file_actions_addclose`:idx: + `posix.html#1168 <posix.html#1168>`_ + + `posix_spawn_file_actions_adddup2`:idx: + `posix.html#1169 <posix.html#1169>`_ + + `posix_spawn_file_actions_addopen`:idx: + `posix.html#1170 <posix.html#1170>`_ + + `posix_spawn_file_actions_destroy`:idx: + `posix.html#1171 <posix.html#1171>`_ + + `posix_spawn_file_actions_init`:idx: + `posix.html#1172 <posix.html#1172>`_ + + `posix_spawnp`:idx: + `posix.html#1187 <posix.html#1187>`_ + + `POSIX_SPAWN_RESETIDS`:idx: + `posix.html#778 <posix.html#778>`_ + + `POSIX_SPAWN_SETPGROUP`:idx: + `posix.html#779 <posix.html#779>`_ + + `POSIX_SPAWN_SETSCHEDPARAM`:idx: + `posix.html#780 <posix.html#780>`_ + + `POSIX_SPAWN_SETSCHEDULER`:idx: + `posix.html#781 <posix.html#781>`_ + + `POSIX_SPAWN_SETSIGDEF`:idx: + `posix.html#782 <posix.html#782>`_ + + `POSIX_SPAWN_SETSIGMASK`:idx: + `posix.html#783 <posix.html#783>`_ + + `POSIX_SYNC_IO`:idx: + `posix.html#477 <posix.html#477>`_ + + `POSIX_TYPED_MEM_ALLOCATE`:idx: + `posix.html#692 <posix.html#692>`_ + + `POSIX_TYPED_MEM_ALLOCATE_CONTIG`:idx: + `posix.html#693 <posix.html#693>`_ + + `posix_typed_mem_get_info`:idx: + `posix.html#1088 <posix.html#1088>`_ + + `POSIX_TYPED_MEM_MAP_ALLOCATABLE`:idx: + `posix.html#694 <posix.html#694>`_ + + `posix_typed_mem_open`:idx: + `posix.html#1089 <posix.html#1089>`_ + + `pow`:idx: + `math.html#127 <math.html#127>`_ + + `P_PGID`:idx: + `posix.html#718 <posix.html#718>`_ + + `P_PID`:idx: + `posix.html#717 <posix.html#717>`_ + + `pread`:idx: + `posix.html#1016 <posix.html#1016>`_ + + `pred`:idx: + `system.html#155 <system.html#155>`_ + + `procedural type`:idx: + `manual.html#162 <manual.html#162>`_ + + `procedures`:idx: + `manual.html#201 <manual.html#201>`_ + + `PROT_EXEC`:idx: + `posix.html#676 <posix.html#676>`_ + + `PROT_NONE`:idx: + `posix.html#677 <posix.html#677>`_ + + `PROT_READ`:idx: + `posix.html#674 <posix.html#674>`_ + + `PROT_WRITE`:idx: + `posix.html#675 <posix.html#675>`_ + + `pselect`:idx: + `posix.html#1165 <posix.html#1165>`_ + + `PSQLCHAR`:idx: + `odbcsql.html#116 <odbcsql.html#116>`_ + + `PSQL_DATE_STRUCT`:idx: + `odbcsql.html#232 <odbcsql.html#232>`_ + + `PSQLDOUBLE`:idx: + `odbcsql.html#122 <odbcsql.html#122>`_ + + `PSQLFLOAT`:idx: + `odbcsql.html#123 <odbcsql.html#123>`_ + + `PSQLHANDLE`:idx: + `odbcsql.html#124 <odbcsql.html#124>`_ + + `PSQLINTEGER`:idx: + `odbcsql.html#117 <odbcsql.html#117>`_ + + `PSQLREAL`:idx: + `odbcsql.html#121 <odbcsql.html#121>`_ + + `PSQLSMALLINT`:idx: + `odbcsql.html#119 <odbcsql.html#119>`_ + + `PSQL_TIMESTAMP_STRUCT`:idx: + `odbcsql.html#236 <odbcsql.html#236>`_ + + `PSQL_TIME_STRUCT`:idx: + `odbcsql.html#234 <odbcsql.html#234>`_ + + `PSQLUINTEGER`:idx: + `odbcsql.html#118 <odbcsql.html#118>`_ + + `PSQLUSMALLINT`:idx: + `odbcsql.html#120 <odbcsql.html#120>`_ + + `PStream`:idx: + `streams.html#101 <streams.html#101>`_ + + `PStringStream`:idx: + `streams.html#115 <streams.html#115>`_ + + `PStringTable`:idx: + `strtabs.html#103 <strtabs.html#103>`_ + + `pthread_atfork`:idx: + `posix.html#867 <posix.html#867>`_ + + `pthread_attr_destroy`:idx: + `posix.html#868 <posix.html#868>`_ + + `pthread_attr_getdetachstate`:idx: + `posix.html#869 <posix.html#869>`_ + + `pthread_attr_getguardsize`:idx: + `posix.html#870 <posix.html#870>`_ + + `pthread_attr_getinheritsched`:idx: + `posix.html#871 <posix.html#871>`_ + + `pthread_attr_getschedparam`:idx: + `posix.html#872 <posix.html#872>`_ + + `pthread_attr_getschedpolicy`:idx: + `posix.html#873 <posix.html#873>`_ + + `pthread_attr_getscope`:idx: + `posix.html#874 <posix.html#874>`_ + + `pthread_attr_getstack`:idx: + `posix.html#875 <posix.html#875>`_ + + `pthread_attr_getstackaddr`:idx: + `posix.html#876 <posix.html#876>`_ + + `pthread_attr_getstacksize`:idx: + `posix.html#877 <posix.html#877>`_ + + `pthread_attr_init`:idx: + `posix.html#878 <posix.html#878>`_ + + `pthread_attr_setdetachstate`:idx: + `posix.html#879 <posix.html#879>`_ + + `pthread_attr_setguardsize`:idx: + `posix.html#880 <posix.html#880>`_ + + `pthread_attr_setinheritsched`:idx: + `posix.html#881 <posix.html#881>`_ + + `pthread_attr_setschedparam`:idx: + `posix.html#882 <posix.html#882>`_ + + `pthread_attr_setschedpolicy`:idx: + `posix.html#883 <posix.html#883>`_ + + `pthread_attr_setscope`:idx: + `posix.html#884 <posix.html#884>`_ + + `pthread_attr_setstack`:idx: + `posix.html#885 <posix.html#885>`_ + + `pthread_attr_setstackaddr`:idx: + `posix.html#886 <posix.html#886>`_ + + `pthread_attr_setstacksize`:idx: + `posix.html#887 <posix.html#887>`_ + + `pthread_barrierattr_destroy`:idx: + `posix.html#891 <posix.html#891>`_ + + `pthread_barrierattr_getpshared`:idx: + `posix.html#892 <posix.html#892>`_ + + `pthread_barrierattr_init`:idx: + `posix.html#893 <posix.html#893>`_ + + `pthread_barrierattr_setpshared`:idx: + `posix.html#894 <posix.html#894>`_ + + `pthread_barrier_destroy`:idx: + `posix.html#888 <posix.html#888>`_ + + `pthread_barrier_init`:idx: + `posix.html#889 <posix.html#889>`_ + + `PTHREAD_BARRIER_SERIAL_THREAD`:idx: + `posix.html#451 <posix.html#451>`_ + + `pthread_barrier_wait`:idx: + `posix.html#890 <posix.html#890>`_ + + `pthread_cancel`:idx: + `posix.html#895 <posix.html#895>`_ + + `PTHREAD_CANCEL_ASYNCHRONOUS`:idx: + `posix.html#452 <posix.html#452>`_ + + `PTHREAD_CANCEL_DEFERRED`:idx: + `posix.html#454 <posix.html#454>`_ + + `PTHREAD_CANCEL_DISABLE`:idx: + `posix.html#455 <posix.html#455>`_ + + `PTHREAD_CANCELED`:idx: + `posix.html#456 <posix.html#456>`_ + + `PTHREAD_CANCEL_ENABLE`:idx: + `posix.html#453 <posix.html#453>`_ + + `pthread_cleanup_pop`:idx: + `posix.html#897 <posix.html#897>`_ + + `pthread_cleanup_push`:idx: + `posix.html#896 <posix.html#896>`_ + + `pthread_condattr_destroy`:idx: + `posix.html#904 <posix.html#904>`_ + + `pthread_condattr_getclock`:idx: + `posix.html#905 <posix.html#905>`_ + + `pthread_condattr_getpshared`:idx: + `posix.html#906 <posix.html#906>`_ + + `pthread_condattr_init`:idx: + `posix.html#907 <posix.html#907>`_ + + `pthread_condattr_setclock`:idx: + `posix.html#908 <posix.html#908>`_ + + `pthread_condattr_setpshared`:idx: + `posix.html#909 <posix.html#909>`_ + + `pthread_cond_broadcast`:idx: + `posix.html#898 <posix.html#898>`_ + + `pthread_cond_destroy`:idx: + `posix.html#899 <posix.html#899>`_ + + `pthread_cond_init`:idx: + `posix.html#900 <posix.html#900>`_ + + `PTHREAD_COND_INITIALIZER`:idx: + `posix.html#457 <posix.html#457>`_ + + `pthread_cond_signal`:idx: + `posix.html#901 <posix.html#901>`_ + + `pthread_cond_timedwait`:idx: + `posix.html#902 <posix.html#902>`_ + + `pthread_cond_wait`:idx: + `posix.html#903 <posix.html#903>`_ + + `pthread_create`:idx: + `posix.html#910 <posix.html#910>`_ + + `PTHREAD_CREATE_DETACHED`:idx: + `posix.html#458 <posix.html#458>`_ + + `PTHREAD_CREATE_JOINABLE`:idx: + `posix.html#459 <posix.html#459>`_ + + `pthread_detach`:idx: + `posix.html#911 <posix.html#911>`_ + + `pthread_equal`:idx: + `posix.html#912 <posix.html#912>`_ + + `pthread_exit`:idx: + `posix.html#913 <posix.html#913>`_ + + `PTHREAD_EXPLICIT_SCHED`:idx: + `posix.html#460 <posix.html#460>`_ + + `pthread_getconcurrency`:idx: + `posix.html#914 <posix.html#914>`_ + + `pthread_getcpuclockid`:idx: + `posix.html#915 <posix.html#915>`_ + + `pthread_getschedparam`:idx: + `posix.html#916 <posix.html#916>`_ + + `pthread_getspecific`:idx: + `posix.html#917 <posix.html#917>`_ + + `PTHREAD_INHERIT_SCHED`:idx: + `posix.html#461 <posix.html#461>`_ + + `pthread_join`:idx: + `posix.html#918 <posix.html#918>`_ + + `pthread_key_create`:idx: + `posix.html#919 <posix.html#919>`_ + + `pthread_key_delete`:idx: + `posix.html#920 <posix.html#920>`_ + + `pthread_kill`:idx: + `posix.html#1125 <posix.html#1125>`_ + + `pthread_mutexattr_destroy`:idx: + `posix.html#929 <posix.html#929>`_ + + `pthread_mutexattr_getprioceiling`:idx: + `posix.html#930 <posix.html#930>`_ + + `pthread_mutexattr_getprotocol`:idx: + `posix.html#931 <posix.html#931>`_ + + `pthread_mutexattr_getpshared`:idx: + `posix.html#932 <posix.html#932>`_ + + `pthread_mutexattr_gettype`:idx: + `posix.html#933 <posix.html#933>`_ + + `pthread_mutexattr_init`:idx: + `posix.html#934 <posix.html#934>`_ + + `pthread_mutexattr_setprioceiling`:idx: + `posix.html#935 <posix.html#935>`_ + + `pthread_mutexattr_setprotocol`:idx: + `posix.html#936 <posix.html#936>`_ + + `pthread_mutexattr_setpshared`:idx: + `posix.html#937 <posix.html#937>`_ + + `pthread_mutexattr_settype`:idx: + `posix.html#938 <posix.html#938>`_ + + `PTHREAD_MUTEX_DEFAULT`:idx: + `posix.html#462 <posix.html#462>`_ + + `pthread_mutex_destroy`:idx: + `posix.html#921 <posix.html#921>`_ + + `PTHREAD_MUTEX_ERRORCHECK`:idx: + `posix.html#463 <posix.html#463>`_ + + `pthread_mutex_getprioceiling`:idx: + `posix.html#922 <posix.html#922>`_ + + `pthread_mutex_init`:idx: + `posix.html#923 <posix.html#923>`_ + + `PTHREAD_MUTEX_INITIALIZER`:idx: + `posix.html#464 <posix.html#464>`_ + + `pthread_mutex_lock`:idx: + `posix.html#924 <posix.html#924>`_ + + `PTHREAD_MUTEX_NORMAL`:idx: + `posix.html#465 <posix.html#465>`_ + + `PTHREAD_MUTEX_RECURSIVE`:idx: + `posix.html#466 <posix.html#466>`_ + + `pthread_mutex_setprioceiling`:idx: + `posix.html#925 <posix.html#925>`_ + + `pthread_mutex_timedlock`:idx: + `posix.html#926 <posix.html#926>`_ + + `pthread_mutex_trylock`:idx: + `posix.html#927 <posix.html#927>`_ + + `pthread_mutex_unlock`:idx: + `posix.html#928 <posix.html#928>`_ + + `pthread_once`:idx: + `posix.html#939 <posix.html#939>`_ + + `PTHREAD_ONCE_INIT`:idx: + `posix.html#467 <posix.html#467>`_ + + `PTHREAD_PRIO_INHERIT`:idx: + `posix.html#468 <posix.html#468>`_ + + `PTHREAD_PRIO_NONE`:idx: + `posix.html#469 <posix.html#469>`_ + + `PTHREAD_PRIO_PROTECT`:idx: + `posix.html#470 <posix.html#470>`_ + + `PTHREAD_PROCESS_PRIVATE`:idx: + `posix.html#472 <posix.html#472>`_ + + `PTHREAD_PROCESS_SHARED`:idx: + `posix.html#471 <posix.html#471>`_ + + `pthread_rwlockattr_destroy`:idx: + `posix.html#949 <posix.html#949>`_ + + `pthread_rwlockattr_getpshared`:idx: + `posix.html#950 <posix.html#950>`_ + + `pthread_rwlockattr_init`:idx: + `posix.html#951 <posix.html#951>`_ + + `pthread_rwlockattr_setpshared`:idx: + `posix.html#952 <posix.html#952>`_ + + `pthread_rwlock_destroy`:idx: + `posix.html#940 <posix.html#940>`_ + + `pthread_rwlock_init`:idx: + `posix.html#941 <posix.html#941>`_ + + `pthread_rwlock_rdlock`:idx: + `posix.html#942 <posix.html#942>`_ + + `pthread_rwlock_timedrdlock`:idx: + `posix.html#943 <posix.html#943>`_ + + `pthread_rwlock_timedwrlock`:idx: + `posix.html#944 <posix.html#944>`_ + + `pthread_rwlock_tryrdlock`:idx: + `posix.html#945 <posix.html#945>`_ + + `pthread_rwlock_trywrlock`:idx: + `posix.html#946 <posix.html#946>`_ + + `pthread_rwlock_unlock`:idx: + `posix.html#947 <posix.html#947>`_ + + `pthread_rwlock_wrlock`:idx: + `posix.html#948 <posix.html#948>`_ + + `PTHREAD_SCOPE_PROCESS`:idx: + `posix.html#473 <posix.html#473>`_ + + `PTHREAD_SCOPE_SYSTEM`:idx: + `posix.html#474 <posix.html#474>`_ + + `pthread_self`:idx: + `posix.html#953 <posix.html#953>`_ + + `pthread_setcancelstate`:idx: + `posix.html#954 <posix.html#954>`_ + + `pthread_setcanceltype`:idx: + `posix.html#955 <posix.html#955>`_ + + `pthread_setconcurrency`:idx: + `posix.html#956 <posix.html#956>`_ + + `pthread_setschedparam`:idx: + `posix.html#957 <posix.html#957>`_ + + `pthread_setschedprio`:idx: + `posix.html#958 <posix.html#958>`_ + + `pthread_setspecific`:idx: + `posix.html#959 <posix.html#959>`_ + + `pthread_sigmask`:idx: + `posix.html#1126 <posix.html#1126>`_ + + `pthread_spin_destroy`:idx: + `posix.html#960 <posix.html#960>`_ + + `pthread_spin_init`:idx: + `posix.html#961 <posix.html#961>`_ + + `pthread_spin_lock`:idx: + `posix.html#962 <posix.html#962>`_ + + `pthread_spin_trylock`:idx: + `posix.html#963 <posix.html#963>`_ + + `pthread_spin_unlock`:idx: + `posix.html#964 <posix.html#964>`_ + + `pthread_testcancel`:idx: + `posix.html#965 <posix.html#965>`_ + + `Pulongf`:idx: + `zlib.html#104 <zlib.html#104>`_ + + `push/pop`:idx: + `manual.html#230 <manual.html#230>`_ + + `putEnv`:idx: + `os.html#142 <os.html#142>`_ + + `PWindow`:idx: + `dialogs.html#101 <dialogs.html#101>`_ + + `pwrite`:idx: + `posix.html#1017 <posix.html#1017>`_ + + `Pzip`:idx: + `libzip.html#105 <libzip.html#105>`_ + + `Pzip_file`:idx: + `libzip.html#106 <libzip.html#106>`_ + + `PZipFileStream`:idx: + `zipfiles.html#108 <zipfiles.html#108>`_ + + `Pzip_source`:idx: + `libzip.html#107 <libzip.html#107>`_ + + `Pzip_stat`:idx: + `libzip.html#103 <libzip.html#103>`_ + + `PZstream`:idx: + `zlib.html#114 <zlib.html#114>`_ + + `quit`:idx: + * `system.html#474 <system.html#474>`_ + * `system.html#475 <system.html#475>`_ + + `QuitFailure`:idx: + `system.html#473 <system.html#473>`_ + + `QuitSuccess`:idx: + `system.html#472 <system.html#472>`_ + + `quotation mark`:idx: + `manual.html#128 <manual.html#128>`_ + + `quoteIfSpaceExists`:idx: + `strutils.html#138 <strutils.html#138>`_ + + `RADIXCHAR`:idx: + `posix.html#439 <posix.html#439>`_ + + `raise`:idx: + `posix.html#1127 <posix.html#1127>`_ + + `random`:idx: + `math.html#108 <math.html#108>`_ + + `randomize`:idx: + `math.html#109 <math.html#109>`_ + + `range`:idx: + `system.html#120 <system.html#120>`_ + + `re-raised`:idx: + `manual.html#185 <manual.html#185>`_ + + `read`:idx: + `posix.html#1018 <posix.html#1018>`_ + + `readBool`:idx: + `streams.html#106 <streams.html#106>`_ + + `readBuffer`:idx: + `system.html#502 <system.html#502>`_ + + `ReadBytes`:idx: + `system.html#500 <system.html#500>`_ + + `readChar`:idx: + * `system.html#486 <system.html#486>`_ + * `streams.html#105 <streams.html#105>`_ + + `ReadChars`:idx: + `system.html#501 <system.html#501>`_ + + `readdir`:idx: + `posix.html#802 <posix.html#802>`_ + + `readdir_r`:idx: + `posix.html#803 <posix.html#803>`_ + + `readFile`:idx: + `system.html#488 <system.html#488>`_ + + `readFloat32`:idx: + `streams.html#111 <streams.html#111>`_ + + `readFloat64`:idx: + `streams.html#112 <streams.html#112>`_ + + `readInt16`:idx: + `streams.html#108 <streams.html#108>`_ + + `readInt32`:idx: + `streams.html#109 <streams.html#109>`_ + + `readInt64`:idx: + `streams.html#110 <streams.html#110>`_ + + `readInt8`:idx: + `streams.html#107 <streams.html#107>`_ + + `readLine`:idx: + * `system.html#496 <system.html#496>`_ + * `streams.html#114 <streams.html#114>`_ + + `readlink`:idx: + `posix.html#1019 <posix.html#1019>`_ + + `readStr`:idx: + `streams.html#113 <streams.html#113>`_ + + `realloc`:idx: + `system.html#413 <system.html#413>`_ + + `Recursive module dependancies`:idx: + `manual.html#218 <manual.html#218>`_ + + `register`:idx: + `nimrodc.html#113 <nimrodc.html#113>`_ + + `removeDir`:idx: + `os.html#137 <os.html#137>`_ + + `removeFile`:idx: + `os.html#136 <os.html#136>`_ + + `repeatChar`:idx: + `strutils.html#134 <strutils.html#134>`_ + + `replaceStr`:idx: + * `strutils.html#114 <strutils.html#114>`_ + * `strutils.html#115 <strutils.html#115>`_ + + `repr`:idx: + `system.html#371 <system.html#371>`_ + + `result`:idx: + * `manual.html#192 <manual.html#192>`_ + * `manual.html#203 <manual.html#203>`_ + + `return`:idx: + `manual.html#191 <manual.html#191>`_ + + `rewinddir`:idx: + `posix.html#804 <posix.html#804>`_ + + `rmdir`:idx: + `posix.html#1020 <posix.html#1020>`_ + + `R_OK`:idx: + `posix.html#479 <posix.html#479>`_ + + `round`:idx: + `math.html#116 <math.html#116>`_ + + `RTLD_GLOBAL`:idx: + `posix.html#217 <posix.html#217>`_ + + `RTLD_LAZY`:idx: + `posix.html#215 <posix.html#215>`_ + + `RTLD_LOCAL`:idx: + `posix.html#218 <posix.html#218>`_ + + `RTLD_NOW`:idx: + `posix.html#216 <posix.html#216>`_ + + `safe`:idx: + `manual.html#112 <manual.html#112>`_ + + `safecall`:idx: + `manual.html#167 <manual.html#167>`_ + + `sameFile`:idx: + `os.html#148 <os.html#148>`_ + + `sameFileContent`:idx: + `os.html#149 <os.html#149>`_ + + `SA_NOCLDSTOP`:idx: + `posix.html#754 <posix.html#754>`_ + + `SA_NOCLDWAIT`:idx: + `posix.html#762 <posix.html#762>`_ + + `SA_NODEFER`:idx: + `posix.html#763 <posix.html#763>`_ + + `SA_ONSTACK`:idx: + `posix.html#758 <posix.html#758>`_ + + `SA_RESETHAND`:idx: + `posix.html#759 <posix.html#759>`_ + + `SA_RESTART`:idx: + `posix.html#760 <posix.html#760>`_ + + `SA_SIGINFO`:idx: + `posix.html#761 <posix.html#761>`_ + + `SC_2_C_BIND`:idx: + `posix.html#519 <posix.html#519>`_ + + `SC_2_C_DEV`:idx: + `posix.html#520 <posix.html#520>`_ + + `SC_2_CHAR_TERM`:idx: + `posix.html#521 <posix.html#521>`_ + + `SC_2_FORT_DEV`:idx: + `posix.html#522 <posix.html#522>`_ + + `SC_2_FORT_RUN`:idx: + `posix.html#523 <posix.html#523>`_ + + `SC_2_LOCALEDEF`:idx: + `posix.html#524 <posix.html#524>`_ + + `SC_2_PBS`:idx: + `posix.html#525 <posix.html#525>`_ + + `SC_2_PBS_ACCOUNTING`:idx: + `posix.html#526 <posix.html#526>`_ + + `SC_2_PBS_CHECKPOINT`:idx: + `posix.html#527 <posix.html#527>`_ + + `SC_2_PBS_LOCATE`:idx: + `posix.html#528 <posix.html#528>`_ + + `SC_2_PBS_MESSAGE`:idx: + `posix.html#529 <posix.html#529>`_ + + `SC_2_PBS_TRACK`:idx: + `posix.html#530 <posix.html#530>`_ + + `SC_2_SW_DEV`:idx: + `posix.html#531 <posix.html#531>`_ + + `SC_2_UPE`:idx: + `posix.html#532 <posix.html#532>`_ + + `SC_2_VERSION`:idx: + `posix.html#533 <posix.html#533>`_ + + `SC_ADVISORY_INFO`:idx: + `posix.html#534 <posix.html#534>`_ + + `SC_AIO_LISTIO_MAX`:idx: + `posix.html#535 <posix.html#535>`_ + + `SC_AIO_MAX`:idx: + `posix.html#536 <posix.html#536>`_ + + `SC_AIO_PRIO_DELTA_MAX`:idx: + `posix.html#537 <posix.html#537>`_ + + `SC_ARG_MAX`:idx: + `posix.html#538 <posix.html#538>`_ + + `SC_ASYNCHRONOUS_IO`:idx: + `posix.html#539 <posix.html#539>`_ + + `SC_ATEXIT_MAX`:idx: + `posix.html#540 <posix.html#540>`_ + + `SC_BARRIERS`:idx: + `posix.html#541 <posix.html#541>`_ + + `SC_BC_BASE_MAX`:idx: + `posix.html#542 <posix.html#542>`_ + + `SC_BC_DIM_MAX`:idx: + `posix.html#543 <posix.html#543>`_ + + `SC_BC_SCALE_MAX`:idx: + `posix.html#544 <posix.html#544>`_ + + `SC_BC_STRING_MAX`:idx: + `posix.html#545 <posix.html#545>`_ + + `SC_CHILD_MAX`:idx: + `posix.html#546 <posix.html#546>`_ + + `SC_CLK_TCK`:idx: + `posix.html#547 <posix.html#547>`_ + + `SC_CLOCK_SELECTION`:idx: + `posix.html#548 <posix.html#548>`_ + + `SC_COLL_WEIGHTS_MAX`:idx: + `posix.html#549 <posix.html#549>`_ + + `SC_CPUTIME`:idx: + `posix.html#550 <posix.html#550>`_ + + `SC_DELAYTIMER_MAX`:idx: + `posix.html#551 <posix.html#551>`_ + + `SC_EXPR_NEST_MAX`:idx: + `posix.html#552 <posix.html#552>`_ + + `SC_FSYNC`:idx: + `posix.html#553 <posix.html#553>`_ + + `SC_GETGR_R_SIZE_MAX`:idx: + `posix.html#554 <posix.html#554>`_ + + `SC_GETPW_R_SIZE_MAX`:idx: + `posix.html#555 <posix.html#555>`_ + + `SCHED_FIFO`:idx: + `posix.html#770 <posix.html#770>`_ + + `sched_getparam`:idx: + `posix.html#1154 <posix.html#1154>`_ + + `sched_get_priority_max`:idx: + `posix.html#1152 <posix.html#1152>`_ + + `sched_get_priority_min`:idx: + `posix.html#1153 <posix.html#1153>`_ + + `sched_getscheduler`:idx: + `posix.html#1155 <posix.html#1155>`_ + + `SCHED_OTHER`:idx: + `posix.html#773 <posix.html#773>`_ + + `SCHED_RR`:idx: + `posix.html#771 <posix.html#771>`_ + + `sched_rr_get_interval`:idx: + `posix.html#1156 <posix.html#1156>`_ + + `sched_setparam`:idx: + `posix.html#1157 <posix.html#1157>`_ + + `sched_setscheduler`:idx: + `posix.html#1158 <posix.html#1158>`_ + + `SCHED_SPORADIC`:idx: + `posix.html#772 <posix.html#772>`_ + + `sched_yield`:idx: + `posix.html#1159 <posix.html#1159>`_ + + `SC_HOST_NAME_MAX`:idx: + `posix.html#556 <posix.html#556>`_ + + `SC_IOV_MAX`:idx: + `posix.html#557 <posix.html#557>`_ + + `SC_IPV6`:idx: + `posix.html#558 <posix.html#558>`_ + + `SC_JOB_CONTROL`:idx: + `posix.html#559 <posix.html#559>`_ + + `SC_LINE_MAX`:idx: + `posix.html#560 <posix.html#560>`_ + + `SC_LOGIN_NAME_MAX`:idx: + `posix.html#561 <posix.html#561>`_ + + `SC_MAPPED_FILES`:idx: + `posix.html#562 <posix.html#562>`_ + + `SC_MEMLOCK`:idx: + `posix.html#563 <posix.html#563>`_ + + `SC_MEMLOCK_RANGE`:idx: + `posix.html#564 <posix.html#564>`_ + + `SC_MEMORY_PROTECTION`:idx: + `posix.html#565 <posix.html#565>`_ + + `SC_MESSAGE_PASSING`:idx: + `posix.html#566 <posix.html#566>`_ + + `SC_MONOTONIC_CLOCK`:idx: + `posix.html#567 <posix.html#567>`_ + + `SC_MQ_OPEN_MAX`:idx: + `posix.html#568 <posix.html#568>`_ + + `SC_MQ_PRIO_MAX`:idx: + `posix.html#569 <posix.html#569>`_ + + `SC_NGROUPS_MAX`:idx: + `posix.html#570 <posix.html#570>`_ + + `scope`:idx: + * `manual.html#106 <manual.html#106>`_ + * `manual.html#219 <manual.html#219>`_ + + `SC_OPEN_MAX`:idx: + `posix.html#571 <posix.html#571>`_ + + `SC_PAGE_SIZE`:idx: + `posix.html#572 <posix.html#572>`_ + + `SC_PRIORITIZED_IO`:idx: + `posix.html#573 <posix.html#573>`_ + + `SC_PRIORITY_SCHEDULING`:idx: + `posix.html#574 <posix.html#574>`_ + + `SC_RAW_SOCKETS`:idx: + `posix.html#575 <posix.html#575>`_ + + `SC_READER_WRITER_LOCKS`:idx: + `posix.html#577 <posix.html#577>`_ + + `SC_REALTIME_SIGNALS`:idx: + `posix.html#578 <posix.html#578>`_ + + `SC_RE_DUP_MAX`:idx: + `posix.html#576 <posix.html#576>`_ + + `SC_REGEXP`:idx: + `posix.html#579 <posix.html#579>`_ + + `ScriptExt`:idx: + `os.html#108 <os.html#108>`_ + + `SC_RTSIG_MAX`:idx: + `posix.html#580 <posix.html#580>`_ + + `SC_SAVED_IDS`:idx: + `posix.html#581 <posix.html#581>`_ + + `SC_SEMAPHORES`:idx: + `posix.html#584 <posix.html#584>`_ + + `SC_SEM_NSEMS_MAX`:idx: + `posix.html#582 <posix.html#582>`_ + + `SC_SEM_VALUE_MAX`:idx: + `posix.html#583 <posix.html#583>`_ + + `SC_SHARED_MEMORY_OBJECTS`:idx: + `posix.html#585 <posix.html#585>`_ + + `SC_SHELL`:idx: + `posix.html#586 <posix.html#586>`_ + + `SC_SIGQUEUE_MAX`:idx: + `posix.html#587 <posix.html#587>`_ + + `SC_SPAWN`:idx: + `posix.html#588 <posix.html#588>`_ + + `SC_SPIN_LOCKS`:idx: + `posix.html#589 <posix.html#589>`_ + + `SC_SPORADIC_SERVER`:idx: + `posix.html#590 <posix.html#590>`_ + + `SC_SS_REPL_MAX`:idx: + `posix.html#591 <posix.html#591>`_ + + `SC_STREAM_MAX`:idx: + `posix.html#592 <posix.html#592>`_ + + `SC_SYMLOOP_MAX`:idx: + `posix.html#593 <posix.html#593>`_ + + `SC_SYNCHRONIZED_IO`:idx: + `posix.html#594 <posix.html#594>`_ + + `SC_THREAD_ATTR_STACKADDR`:idx: + `posix.html#595 <posix.html#595>`_ + + `SC_THREAD_ATTR_STACKSIZE`:idx: + `posix.html#596 <posix.html#596>`_ + + `SC_THREAD_CPUTIME`:idx: + `posix.html#597 <posix.html#597>`_ + + `SC_THREAD_DESTRUCTOR_ITERATIONS`:idx: + `posix.html#598 <posix.html#598>`_ + + `SC_THREAD_KEYS_MAX`:idx: + `posix.html#599 <posix.html#599>`_ + + `SC_THREAD_PRIO_INHERIT`:idx: + `posix.html#600 <posix.html#600>`_ + + `SC_THREAD_PRIO_PROTECT`:idx: + `posix.html#601 <posix.html#601>`_ + + `SC_THREAD_PRIORITY_SCHEDULING`:idx: + `posix.html#602 <posix.html#602>`_ + + `SC_THREAD_PROCESS_SHARED`:idx: + `posix.html#603 <posix.html#603>`_ + + `SC_THREADS`:idx: + `posix.html#608 <posix.html#608>`_ + + `SC_THREAD_SAFE_FUNCTIONS`:idx: + `posix.html#604 <posix.html#604>`_ + + `SC_THREAD_SPORADIC_SERVER`:idx: + `posix.html#605 <posix.html#605>`_ + + `SC_THREAD_STACK_MIN`:idx: + `posix.html#606 <posix.html#606>`_ + + `SC_THREAD_THREADS_MAX`:idx: + `posix.html#607 <posix.html#607>`_ + + `SC_TIMEOUTS`:idx: + `posix.html#609 <posix.html#609>`_ + + `SC_TIMER_MAX`:idx: + `posix.html#610 <posix.html#610>`_ + + `SC_TIMERS`:idx: + `posix.html#611 <posix.html#611>`_ + + `SC_TRACE`:idx: + `posix.html#612 <posix.html#612>`_ + + `SC_TRACE_EVENT_FILTER`:idx: + `posix.html#613 <posix.html#613>`_ + + `SC_TRACE_EVENT_NAME_MAX`:idx: + `posix.html#614 <posix.html#614>`_ + + `SC_TRACE_INHERIT`:idx: + `posix.html#615 <posix.html#615>`_ + + `SC_TRACE_LOG`:idx: + `posix.html#616 <posix.html#616>`_ + + `SC_TRACE_NAME_MAX`:idx: + `posix.html#617 <posix.html#617>`_ + + `SC_TRACE_SYS_MAX`:idx: + `posix.html#618 <posix.html#618>`_ + + `SC_TRACE_USER_EVENT_MAX`:idx: + `posix.html#619 <posix.html#619>`_ + + `SC_TTY_NAME_MAX`:idx: + `posix.html#620 <posix.html#620>`_ + + `SC_TYPED_MEMORY_OBJECTS`:idx: + `posix.html#621 <posix.html#621>`_ + + `SC_TZNAME_MAX`:idx: + `posix.html#622 <posix.html#622>`_ + + `SC_V6_ILP32_OFF32`:idx: + `posix.html#623 <posix.html#623>`_ + + `SC_V6_ILP32_OFFBIG`:idx: + `posix.html#624 <posix.html#624>`_ + + `SC_V6_LP64_OFF64`:idx: + `posix.html#625 <posix.html#625>`_ + + `SC_V6_LPBIG_OFFBIG`:idx: + `posix.html#626 <posix.html#626>`_ + + `SC_VERSION`:idx: + `posix.html#627 <posix.html#627>`_ + + `SC_XBS5_ILP32_OFF32`:idx: + `posix.html#628 <posix.html#628>`_ + + `SC_XBS5_ILP32_OFFBIG`:idx: + `posix.html#629 <posix.html#629>`_ + + `SC_XBS5_LP64_OFF64`:idx: + `posix.html#630 <posix.html#630>`_ + + `SC_XBS5_LPBIG_OFFBIG`:idx: + `posix.html#631 <posix.html#631>`_ + + `SC_XOPEN_CRYPT`:idx: + `posix.html#632 <posix.html#632>`_ + + `SC_XOPEN_ENH_I18N`:idx: + `posix.html#633 <posix.html#633>`_ + + `SC_XOPEN_LEGACY`:idx: + `posix.html#634 <posix.html#634>`_ + + `SC_XOPEN_REALTIME`:idx: + `posix.html#635 <posix.html#635>`_ + + `SC_XOPEN_REALTIME_THREADS`:idx: + `posix.html#636 <posix.html#636>`_ + + `SC_XOPEN_SHM`:idx: + `posix.html#637 <posix.html#637>`_ + + `SC_XOPEN_STREAMS`:idx: + `posix.html#638 <posix.html#638>`_ + + `SC_XOPEN_UNIX`:idx: + `posix.html#639 <posix.html#639>`_ + + `SC_XOPEN_VERSION`:idx: + `posix.html#640 <posix.html#640>`_ + + `SEEK_CUR`:idx: + `posix.html#776 <posix.html#776>`_ + + `seekdir`:idx: + `posix.html#805 <posix.html#805>`_ + + `SEEK_END`:idx: + `posix.html#777 <posix.html#777>`_ + + `SEEK_SET`:idx: + `posix.html#775 <posix.html#775>`_ + + `select`:idx: + `posix.html#1166 <posix.html#1166>`_ + + `sem_close`:idx: + `posix.html#1045 <posix.html#1045>`_ + + `sem_destroy`:idx: + `posix.html#1046 <posix.html#1046>`_ + + `SEM_FAILED`:idx: + `posix.html#641 <posix.html#641>`_ + + `sem_getvalue`:idx: + `posix.html#1047 <posix.html#1047>`_ + + `sem_init`:idx: + `posix.html#1048 <posix.html#1048>`_ + + `sem_open`:idx: + `posix.html#1049 <posix.html#1049>`_ + + `sem_post`:idx: + `posix.html#1050 <posix.html#1050>`_ + + `sem_timedwait`:idx: + `posix.html#1051 <posix.html#1051>`_ + + `sem_trywait`:idx: + `posix.html#1052 <posix.html#1052>`_ + + `sem_unlink`:idx: + `posix.html#1053 <posix.html#1053>`_ + + `sem_wait`:idx: + `posix.html#1054 <posix.html#1054>`_ + + `separate compilation`:idx: + `manual.html#216 <manual.html#216>`_ + + `seq`:idx: + `system.html#123 <system.html#123>`_ + + `seqToPtr`:idx: + `system.html#454 <system.html#454>`_ + + `Sequences`:idx: + `manual.html#154 <manual.html#154>`_ + + `set`:idx: + `system.html#124 <system.html#124>`_ + + `set type`:idx: + `manual.html#158 <manual.html#158>`_ + + `setcontext`:idx: + `posix.html#1190 <posix.html#1190>`_ + + `setCurrentDir`:idx: + `os.html#113 <os.html#113>`_ + + `setegid`:idx: + `posix.html#1021 <posix.html#1021>`_ + + `seteuid`:idx: + `posix.html#1022 <posix.html#1022>`_ + + `setFilePos`:idx: + `system.html#506 <system.html#506>`_ + + `setgid`:idx: + `posix.html#1023 <posix.html#1023>`_ + + `setgrent`:idx: + `posix.html#839 <posix.html#839>`_ + + `setLen`:idx: + * `system.html#405 <system.html#405>`_ + * `system.html#415 <system.html#415>`_ + + `setlocale`:idx: + `posix.html#847 <posix.html#847>`_ + + `setpgid`:idx: + `posix.html#1024 <posix.html#1024>`_ + + `setpgrp`:idx: + `posix.html#1025 <posix.html#1025>`_ + + `setpwent`:idx: + `posix.html#865 <posix.html#865>`_ + + `setregid`:idx: + `posix.html#1026 <posix.html#1026>`_ + + `setreuid`:idx: + `posix.html#1027 <posix.html#1027>`_ + + `setsid`:idx: + `posix.html#1028 <posix.html#1028>`_ + + `setuid`:idx: + `posix.html#1029 <posix.html#1029>`_ + + `shl`:idx: + * `system.html#223 <system.html#223>`_ + * `system.html#224 <system.html#224>`_ + * `system.html#225 <system.html#225>`_ + * `system.html#226 <system.html#226>`_ + * `system.html#227 <system.html#227>`_ + + `shm_open`:idx: + `posix.html#1090 <posix.html#1090>`_ + + `shm_unlink`:idx: + `posix.html#1091 <posix.html#1091>`_ + + `shr`:idx: + * `system.html#218 <system.html#218>`_ + * `system.html#219 <system.html#219>`_ + * `system.html#220 <system.html#220>`_ + * `system.html#221 <system.html#221>`_ + * `system.html#222 <system.html#222>`_ + + `S_IFBLK`:idx: + `posix.html#650 <posix.html#650>`_ + + `S_IFCHR`:idx: + `posix.html#651 <posix.html#651>`_ + + `S_IFDIR`:idx: + `posix.html#654 <posix.html#654>`_ + + `S_IFIFO`:idx: + `posix.html#652 <posix.html#652>`_ + + `S_IFLNK`:idx: + `posix.html#655 <posix.html#655>`_ + + `S_IFMT`:idx: + `posix.html#649 <posix.html#649>`_ + + `S_IFREG`:idx: + `posix.html#653 <posix.html#653>`_ + + `S_IFSOCK`:idx: + `posix.html#656 <posix.html#656>`_ + + `SIGABRT`:idx: + `posix.html#726 <posix.html#726>`_ + + `sigaction`:idx: + `posix.html#1128 <posix.html#1128>`_ + + `sigaddset`:idx: + `posix.html#1129 <posix.html#1129>`_ + + `SIGALRM`:idx: + `posix.html#727 <posix.html#727>`_ + + `sigaltstack`:idx: + `posix.html#1130 <posix.html#1130>`_ + + `SIG_BLOCK`:idx: + `posix.html#755 <posix.html#755>`_ + + `SIGBUS`:idx: + `posix.html#728 <posix.html#728>`_ + + `SIGCHLD`:idx: + `posix.html#729 <posix.html#729>`_ + + `SIGCONT`:idx: + `posix.html#730 <posix.html#730>`_ + + `sigdelset`:idx: + `posix.html#1131 <posix.html#1131>`_ + + `SIG_DFL`:idx: + `posix.html#719 <posix.html#719>`_ + + `sigemptyset`:idx: + `posix.html#1132 <posix.html#1132>`_ + + `SIG_ERR`:idx: + `posix.html#720 <posix.html#720>`_ + + `SIGEV_NONE`:idx: + `posix.html#723 <posix.html#723>`_ + + `SIGEV_SIGNAL`:idx: + `posix.html#724 <posix.html#724>`_ + + `SIGEV_THREAD`:idx: + `posix.html#725 <posix.html#725>`_ + + `sigfillset`:idx: + `posix.html#1133 <posix.html#1133>`_ + + `SIGFPE`:idx: + `posix.html#731 <posix.html#731>`_ + + `sighold`:idx: + `posix.html#1134 <posix.html#1134>`_ + + `SIGHUP`:idx: + `posix.html#732 <posix.html#732>`_ + + `SIG_IGN`:idx: + `posix.html#722 <posix.html#722>`_ + + `sigignore`:idx: + `posix.html#1135 <posix.html#1135>`_ + + `SIGILL`:idx: + `posix.html#733 <posix.html#733>`_ + + `SIGINT`:idx: + `posix.html#734 <posix.html#734>`_ + + `siginterrupt`:idx: + `posix.html#1136 <posix.html#1136>`_ + + `sigismember`:idx: + `posix.html#1137 <posix.html#1137>`_ + + `SIGKILL`:idx: + `posix.html#735 <posix.html#735>`_ + + `signal`:idx: + `posix.html#1138 <posix.html#1138>`_ + + `sigpause`:idx: + `posix.html#1139 <posix.html#1139>`_ + + `sigpending`:idx: + `posix.html#1140 <posix.html#1140>`_ + + `SIGPIPE`:idx: + `posix.html#736 <posix.html#736>`_ + + `SIGPOLL`:idx: + `posix.html#746 <posix.html#746>`_ + + `sigprocmask`:idx: + `posix.html#1141 <posix.html#1141>`_ + + `SIGPROF`:idx: + `posix.html#747 <posix.html#747>`_ + + `sigqueue`:idx: + `posix.html#1142 <posix.html#1142>`_ + + `SIGQUIT`:idx: + `posix.html#737 <posix.html#737>`_ + + `sigrelse`:idx: + `posix.html#1143 <posix.html#1143>`_ + + `SIGSEGV`:idx: + `posix.html#738 <posix.html#738>`_ + + `sigset`:idx: + `posix.html#1144 <posix.html#1144>`_ + + `SIG_SETMASK`:idx: + `posix.html#757 <posix.html#757>`_ + + `SIGSTKSZ`:idx: + `posix.html#767 <posix.html#767>`_ + + `SIGSTOP`:idx: + `posix.html#739 <posix.html#739>`_ + + `sigsuspend`:idx: + `posix.html#1145 <posix.html#1145>`_ + + `SIGSYS`:idx: + `posix.html#748 <posix.html#748>`_ + + `SIGTERM`:idx: + `posix.html#740 <posix.html#740>`_ + + `sigtimedwait`:idx: + `posix.html#1146 <posix.html#1146>`_ + + `SIGTRAP`:idx: + `posix.html#749 <posix.html#749>`_ + + `SIGTSTP`:idx: + `posix.html#741 <posix.html#741>`_ + + `SIGTTIN`:idx: + `posix.html#742 <posix.html#742>`_ + + `SIGTTOU`:idx: + `posix.html#743 <posix.html#743>`_ + + `SIG_UNBLOCK`:idx: + `posix.html#756 <posix.html#756>`_ + + `SIGURG`:idx: + `posix.html#750 <posix.html#750>`_ + + `SIGUSR1`:idx: + `posix.html#744 <posix.html#744>`_ + + `SIGUSR2`:idx: + `posix.html#745 <posix.html#745>`_ + + `SIGVTALRM`:idx: + `posix.html#751 <posix.html#751>`_ + + `sigwait`:idx: + `posix.html#1147 <posix.html#1147>`_ + + `sigwaitinfo`:idx: + `posix.html#1148 <posix.html#1148>`_ + + `SIGXCPU`:idx: + `posix.html#752 <posix.html#752>`_ + + `SIGXFSZ`:idx: + `posix.html#753 <posix.html#753>`_ + + `simple assertions`:idx: + `regexprs.html#103 <regexprs.html#103>`_ + + `simple statements`:idx: + `manual.html#175 <manual.html#175>`_ + + `sinh`:idx: + `math.html#124 <math.html#124>`_ + + `S_IRGRP`:idx: + `posix.html#662 <posix.html#662>`_ + + `S_IROTH`:idx: + `posix.html#666 <posix.html#666>`_ + + `S_IRUSR`:idx: + `posix.html#658 <posix.html#658>`_ + + `S_IRWXG`:idx: + `posix.html#661 <posix.html#661>`_ + + `S_IRWXO`:idx: + `posix.html#665 <posix.html#665>`_ + + `S_IRWXU`:idx: + `posix.html#657 <posix.html#657>`_ + + `S_ISBLK`:idx: + `posix.html#1067 <posix.html#1067>`_ + + `S_ISCHR`:idx: + `posix.html#1068 <posix.html#1068>`_ + + `S_ISDIR`:idx: + `posix.html#1069 <posix.html#1069>`_ + + `S_ISFIFO`:idx: + `posix.html#1070 <posix.html#1070>`_ + + `S_ISGID`:idx: + `posix.html#670 <posix.html#670>`_ + + `S_ISLNK`:idx: + `posix.html#1072 <posix.html#1072>`_ + + `S_ISREG`:idx: + `posix.html#1071 <posix.html#1071>`_ + + `S_ISSOCK`:idx: + `posix.html#1073 <posix.html#1073>`_ + + `S_ISUID`:idx: + `posix.html#669 <posix.html#669>`_ + + `S_ISVTX`:idx: + `posix.html#671 <posix.html#671>`_ + + `S_IWGRP`:idx: + `posix.html#663 <posix.html#663>`_ + + `S_IWOTH`:idx: + `posix.html#667 <posix.html#667>`_ + + `S_IWUSR`:idx: + `posix.html#659 <posix.html#659>`_ + + `S_IXGRP`:idx: + `posix.html#664 <posix.html#664>`_ + + `S_IXOTH`:idx: + `posix.html#668 <posix.html#668>`_ + + `S_IXUSR`:idx: + `posix.html#660 <posix.html#660>`_ + + `sizeof`:idx: + `system.html#153 <system.html#153>`_ + + `sleep`:idx: + `posix.html#1030 <posix.html#1030>`_ + + `split`:idx: + `strutils.html#118 <strutils.html#118>`_ + + `SplitFilename`:idx: + `os.html#125 <os.html#125>`_ + + `splitLines`:idx: + `strutils.html#119 <strutils.html#119>`_ + + `splitLinesSeq`:idx: + `strutils.html#120 <strutils.html#120>`_ + + `SplitPath`:idx: + `os.html#121 <os.html#121>`_ + + `splitSeq`:idx: + `strutils.html#121 <strutils.html#121>`_ + + `SQL_ACCESS_MODE`:idx: + `odbcsql.html#406 <odbcsql.html#406>`_ + + `SQL_ADD`:idx: + `odbcsql.html#317 <odbcsql.html#317>`_ + + `SQLAllocHandle`:idx: + `odbcsql.html#627 <odbcsql.html#627>`_ + + `SQL_ALL_TYPES`:idx: + `odbcsql.html#492 <odbcsql.html#492>`_ + + `SQL_API_SQLDESCRIBEPARAM`:idx: + `odbcsql.html#229 <odbcsql.html#229>`_ + + `SQL_ARD_TYPE`:idx: + `odbcsql.html#494 <odbcsql.html#494>`_ + + `SQL_ASYNC_ENABLE`:idx: + `odbcsql.html#383 <odbcsql.html#383>`_ + + `SQL_ATTR_ACCESS_MODE`:idx: + `odbcsql.html#415 <odbcsql.html#415>`_ + + `SQL_ATTR_APP_PARAM_DESC`:idx: + `odbcsql.html#374 <odbcsql.html#374>`_ + + `SQL_ATTR_APP_ROW_DESC`:idx: + `odbcsql.html#373 <odbcsql.html#373>`_ + + `SQL_ATTR_AUTOCOMMIT`:idx: + `odbcsql.html#400 <odbcsql.html#400>`_ + + `SQL_ATTR_AUTO_IPD`:idx: + `odbcsql.html#371 <odbcsql.html#371>`_ + + `SQL_ATTR_CONCURRENCY`:idx: + `odbcsql.html#395 <odbcsql.html#395>`_ + + `SQL_ATTR_CONNECTION_DEAD`:idx: + `odbcsql.html#416 <odbcsql.html#416>`_ + + `SQL_ATTR_CONNECTION_TIMEOUT`:idx: + `odbcsql.html#417 <odbcsql.html#417>`_ + + `SQL_ATTR_CURRENT_CATALOG`:idx: + `odbcsql.html#418 <odbcsql.html#418>`_ + + `SQL_ATTR_CURSOR_SCROLLABLE`:idx: + `odbcsql.html#377 <odbcsql.html#377>`_ + + `SQL_ATTR_CURSOR_SENSITIVITY`:idx: + `odbcsql.html#378 <odbcsql.html#378>`_ + + `SQL_ATTR_CURSOR_TYPE`:idx: + `odbcsql.html#394 <odbcsql.html#394>`_ + + `SQL_ATTR_DISCONNECT_BEHAVIOR`:idx: + `odbcsql.html#419 <odbcsql.html#419>`_ + + `SQL_ATTR_ENLIST_IN_DTC`:idx: + `odbcsql.html#420 <odbcsql.html#420>`_ + + `SQL_ATTR_ENLIST_IN_XA`:idx: + `odbcsql.html#421 <odbcsql.html#421>`_ + + `SQL_ATTR_FETCH_BOOKMARK_PTR`:idx: + `odbcsql.html#396 <odbcsql.html#396>`_ + + `SQL_ATTR_IMP_PARAM_DESC`:idx: + `odbcsql.html#376 <odbcsql.html#376>`_ + + `SQL_ATTR_IMP_ROW_DESC`:idx: + `odbcsql.html#375 <odbcsql.html#375>`_ + + `SQL_ATTR_LOGIN_TIMEOUT`:idx: + `odbcsql.html#422 <odbcsql.html#422>`_ + + `SQL_ATTR_MAX_ROWS`:idx: + `odbcsql.html#404 <odbcsql.html#404>`_ + + `SQL_ATTR_METADATA_ID`:idx: + `odbcsql.html#372 <odbcsql.html#372>`_ + + `SQL_ATTR_ODBC_CURSORS`:idx: + `odbcsql.html#341 <odbcsql.html#341>`_ + + `SQL_ATTR_ODBC_VERSION`:idx: + `odbcsql.html#240 <odbcsql.html#240>`_ + + `SQL_ATTR_OUTPUT_NTS`:idx: + `odbcsql.html#370 <odbcsql.html#370>`_ + + `SQL_ATTR_PACKET_SIZE`:idx: + `odbcsql.html#423 <odbcsql.html#423>`_ + + `SQL_ATTR_QUIET_MODE`:idx: + `odbcsql.html#424 <odbcsql.html#424>`_ + + `SQL_ATTR_ROW_ARRAY_SIZE`:idx: + `odbcsql.html#620 <odbcsql.html#620>`_ + + `SQL_ATTR_ROW_NUMBER`:idx: + `odbcsql.html#401 <odbcsql.html#401>`_ + + `SQL_ATTR_ROWS_FETCHED_PTR`:idx: + `odbcsql.html#398 <odbcsql.html#398>`_ + + `SQL_ATTR_ROW_STATUS_PTR`:idx: + `odbcsql.html#397 <odbcsql.html#397>`_ + + `SQL_ATTR_TRACE`:idx: + `odbcsql.html#425 <odbcsql.html#425>`_ + + `SQL_ATTR_TRACEFILE`:idx: + `odbcsql.html#426 <odbcsql.html#426>`_ + + `SQL_ATTR_TRANSLATE_LIB`:idx: + `odbcsql.html#427 <odbcsql.html#427>`_ + + `SQL_ATTR_TRANSLATE_OPTION`:idx: + `odbcsql.html#428 <odbcsql.html#428>`_ + + `SQL_ATTR_TXN_ISOLATION`:idx: + `odbcsql.html#403 <odbcsql.html#403>`_ + + `SQL_ATTR_USE_BOOKMARKS`:idx: + `odbcsql.html#405 <odbcsql.html#405>`_ + + `SQL_AUTOCOMMIT`:idx: + `odbcsql.html#399 <odbcsql.html#399>`_ + + `SQL_AUTOCOMMIT_DEFAULT`:idx: + `odbcsql.html#434 <odbcsql.html#434>`_ + + `SQL_AUTOCOMMIT_OFF`:idx: + `odbcsql.html#432 <odbcsql.html#432>`_ + + `SQL_AUTOCOMMIT_ON`:idx: + `odbcsql.html#433 <odbcsql.html#433>`_ + + `SQL_BEST_ROWID`:idx: + `odbcsql.html#523 <odbcsql.html#523>`_ + + `SQL_BIGINT`:idx: + `odbcsql.html#130 <odbcsql.html#130>`_ + + `SQL_BINARY`:idx: + `odbcsql.html#127 <odbcsql.html#127>`_ + + `SQLBindCol`:idx: + `odbcsql.html#652 <odbcsql.html#652>`_ + + `SQLBindParameter`:idx: + `odbcsql.html#660 <odbcsql.html#660>`_ + + `SQL_BIND_TYPE`:idx: + `odbcsql.html#384 <odbcsql.html#384>`_ + + `SQL_BIT`:idx: + `odbcsql.html#132 <odbcsql.html#132>`_ + + `SQL_BOOKMARK_PERSISTENCE`:idx: + `odbcsql.html#262 <odbcsql.html#262>`_ + + `SQL_BP_CLOSE`:idx: + `odbcsql.html#264 <odbcsql.html#264>`_ + + `SQL_BP_DELETE`:idx: + `odbcsql.html#265 <odbcsql.html#265>`_ + + `SQL_BP_DROP`:idx: + `odbcsql.html#266 <odbcsql.html#266>`_ + + `SQL_BP_OTHER_HSTMT`:idx: + `odbcsql.html#269 <odbcsql.html#269>`_ + + `SQL_BP_SCROLL`:idx: + `odbcsql.html#270 <odbcsql.html#270>`_ + + `SQL_BP_TRANSACTION`:idx: + `odbcsql.html#267 <odbcsql.html#267>`_ + + `SQL_BP_UPDATE`:idx: + `odbcsql.html#268 <odbcsql.html#268>`_ + + `SQLBrowseConnect`:idx: + `odbcsql.html#636 <odbcsql.html#636>`_ + + `SQLBulkOperations`:idx: + `odbcsql.html#650 <odbcsql.html#650>`_ + + `SQL_CA1_ABSOLUTE`:idx: + `odbcsql.html#282 <odbcsql.html#282>`_ + + `SQL_CA1_BOOKMARK`:idx: + `odbcsql.html#284 <odbcsql.html#284>`_ + + `SQL_CA1_BULK_ADD`:idx: + `odbcsql.html#295 <odbcsql.html#295>`_ + + `SQL_CA1_BULK_DELETE_BY_BOOKMARK`:idx: + `odbcsql.html#297 <odbcsql.html#297>`_ + + `SQL_CA1_BULK_FETCH_BY_BOOKMARK`:idx: + `odbcsql.html#298 <odbcsql.html#298>`_ + + `SQL_CA1_BULK_UPDATE_BY_BOOKMARK`:idx: + `odbcsql.html#296 <odbcsql.html#296>`_ + + `SQL_CA1_LOCK_EXCLUSIVE`:idx: + `odbcsql.html#286 <odbcsql.html#286>`_ + + `SQL_CA1_LOCK_NO_CHANGE`:idx: + `odbcsql.html#285 <odbcsql.html#285>`_ + + `SQL_CA1_LOCK_UNLOCK`:idx: + `odbcsql.html#287 <odbcsql.html#287>`_ + + `SQL_CA1_NEXT`:idx: + `odbcsql.html#281 <odbcsql.html#281>`_ + + `SQL_CA1_POS_DELETE`:idx: + `odbcsql.html#290 <odbcsql.html#290>`_ + + `SQL_CA1_POSITIONED_DELETE`:idx: + `odbcsql.html#293 <odbcsql.html#293>`_ + + `SQL_CA1_POSITIONED_UPDATE`:idx: + `odbcsql.html#292 <odbcsql.html#292>`_ + + `SQL_CA1_POS_POSITION`:idx: + `odbcsql.html#288 <odbcsql.html#288>`_ + + `SQL_CA1_POS_REFRESH`:idx: + `odbcsql.html#291 <odbcsql.html#291>`_ + + `SQL_CA1_POS_UPDATE`:idx: + `odbcsql.html#289 <odbcsql.html#289>`_ + + `SQL_CA1_RELATIVE`:idx: + `odbcsql.html#283 <odbcsql.html#283>`_ + + `SQL_CA1_SELECT_FOR_UPDATE`:idx: + `odbcsql.html#294 <odbcsql.html#294>`_ + + `SQL_CA2_CRC_APPROXIMATE`:idx: + `odbcsql.html#313 <odbcsql.html#313>`_ + + `SQL_CA2_CRC_EXACT`:idx: + `odbcsql.html#312 <odbcsql.html#312>`_ + + `SQL_CA2_LOCK_CONCURRENCY`:idx: + `odbcsql.html#300 <odbcsql.html#300>`_ + + `SQL_CA2_MAX_ROWS_AFFECTS_ALL`:idx: + `odbcsql.html#311 <odbcsql.html#311>`_ + + `SQL_CA2_MAX_ROWS_CATALOG`:idx: + `odbcsql.html#310 <odbcsql.html#310>`_ + + `SQL_CA2_MAX_ROWS_DELETE`:idx: + `odbcsql.html#308 <odbcsql.html#308>`_ + + `SQL_CA2_MAX_ROWS_INSERT`:idx: + `odbcsql.html#307 <odbcsql.html#307>`_ + + `SQL_CA2_MAX_ROWS_SELECT`:idx: + `odbcsql.html#306 <odbcsql.html#306>`_ + + `SQL_CA2_MAX_ROWS_UPDATE`:idx: + `odbcsql.html#309 <odbcsql.html#309>`_ + + `SQL_CA2_OPT_ROWVER_CONCURRENCY`:idx: + `odbcsql.html#301 <odbcsql.html#301>`_ + + `SQL_CA2_OPT_VALUES_CONCURRENCY`:idx: + `odbcsql.html#302 <odbcsql.html#302>`_ + + `SQL_CA2_READ_ONLY_CONCURRENCY`:idx: + `odbcsql.html#299 <odbcsql.html#299>`_ + + `SQL_CA2_SENSITIVITY_ADDITIONS`:idx: + `odbcsql.html#303 <odbcsql.html#303>`_ + + `SQL_CA2_SENSITIVITY_DELETIONS`:idx: + `odbcsql.html#304 <odbcsql.html#304>`_ + + `SQL_CA2_SENSITIVITY_UPDATES`:idx: + `odbcsql.html#305 <odbcsql.html#305>`_ + + `SQL_CA2_SIMULATE_NON_UNIQUE`:idx: + `odbcsql.html#314 <odbcsql.html#314>`_ + + `SQL_CA2_SIMULATE_TRY_UNIQUE`:idx: + `odbcsql.html#315 <odbcsql.html#315>`_ + + `SQL_CA2_SIMULATE_UNIQUE`:idx: + `odbcsql.html#316 <odbcsql.html#316>`_ + + `SQL_CATALOG_NAME`:idx: + `odbcsql.html#545 <odbcsql.html#545>`_ + + `SQL_C_BINARY`:idx: + `odbcsql.html#212 <odbcsql.html#212>`_ + + `SQL_C_BIT`:idx: + `odbcsql.html#213 <odbcsql.html#213>`_ + + `SQL_C_BOOKMARK`:idx: + `odbcsql.html#223 <odbcsql.html#223>`_ + + `SQL_C_CHAR`:idx: + `odbcsql.html#184 <odbcsql.html#184>`_ + + `SQL_C_DATE`:idx: + `odbcsql.html#193 <odbcsql.html#193>`_ + + `SQL_C_DEFAULT`:idx: + `odbcsql.html#190 <odbcsql.html#190>`_ + + `SQL_C_DOUBLE`:idx: + `odbcsql.html#188 <odbcsql.html#188>`_ + + `SQL_C_FLOAT`:idx: + `odbcsql.html#187 <odbcsql.html#187>`_ + + `SQL_C_GUID`:idx: + `odbcsql.html#224 <odbcsql.html#224>`_ + + `SQL_CHAR`:idx: + `odbcsql.html#136 <odbcsql.html#136>`_ + + `SQL_C_INTERVAL_DAY`:idx: + `odbcsql.html#201 <odbcsql.html#201>`_ + + `SQL_C_INTERVAL_DAY_TO_HOUR`:idx: + `odbcsql.html#206 <odbcsql.html#206>`_ + + `SQL_C_INTERVAL_DAY_TO_MINUTE`:idx: + `odbcsql.html#207 <odbcsql.html#207>`_ + + `SQL_C_INTERVAL_DAY_TO_SECOND`:idx: + `odbcsql.html#208 <odbcsql.html#208>`_ + + `SQL_C_INTERVAL_HOUR`:idx: + `odbcsql.html#202 <odbcsql.html#202>`_ + + `SQL_C_INTERVAL_HOUR_TO_MINUTE`:idx: + `odbcsql.html#209 <odbcsql.html#209>`_ + + `SQL_C_INTERVAL_HOUR_TO_SECOND`:idx: + `odbcsql.html#210 <odbcsql.html#210>`_ + + `SQL_C_INTERVAL_MINUTE`:idx: + `odbcsql.html#203 <odbcsql.html#203>`_ + + `SQL_C_INTERVAL_MINUTE_TO_SECOND`:idx: + `odbcsql.html#211 <odbcsql.html#211>`_ + + `SQL_C_INTERVAL_MONTH`:idx: + `odbcsql.html#200 <odbcsql.html#200>`_ + + `SQL_C_INTERVAL_SECOND`:idx: + `odbcsql.html#204 <odbcsql.html#204>`_ + + `SQL_C_INTERVAL_YEAR`:idx: + `odbcsql.html#199 <odbcsql.html#199>`_ + + `SQL_C_INTERVAL_YEAR_TO_MONTH`:idx: + `odbcsql.html#205 <odbcsql.html#205>`_ + + `SQL_C_LONG`:idx: + `odbcsql.html#185 <odbcsql.html#185>`_ + + `SQL_CLOSE`:idx: + `odbcsql.html#503 <odbcsql.html#503>`_ + + `SQLCloseCursor`:idx: + `odbcsql.html#639 <odbcsql.html#639>`_ + + `SQL_C_NUMERIC`:idx: + `odbcsql.html#189 <odbcsql.html#189>`_ + + `SQL_CODE_DATE`:idx: + `odbcsql.html#495 <odbcsql.html#495>`_ + + `SQL_CODE_DAY`:idx: + `odbcsql.html#156 <odbcsql.html#156>`_ + + `SQL_CODE_DAY_TO_HOUR`:idx: + `odbcsql.html#161 <odbcsql.html#161>`_ + + `SQL_CODE_DAY_TO_MINUTE`:idx: + `odbcsql.html#162 <odbcsql.html#162>`_ + + `SQL_CODE_DAY_TO_SECOND`:idx: + `odbcsql.html#163 <odbcsql.html#163>`_ + + `SQL_CODE_HOUR`:idx: + `odbcsql.html#157 <odbcsql.html#157>`_ + + `SQL_CODE_HOUR_TO_MINUTE`:idx: + `odbcsql.html#164 <odbcsql.html#164>`_ + + `SQL_CODE_HOUR_TO_SECOND`:idx: + `odbcsql.html#165 <odbcsql.html#165>`_ + + `SQL_CODE_MINUTE`:idx: + `odbcsql.html#158 <odbcsql.html#158>`_ + + `SQL_CODE_MINUTE_TO_SECOND`:idx: + `odbcsql.html#166 <odbcsql.html#166>`_ + + `SQL_CODE_MONTH`:idx: + `odbcsql.html#155 <odbcsql.html#155>`_ + + `SQL_CODE_SECOND`:idx: + `odbcsql.html#159 <odbcsql.html#159>`_ + + `SQL_CODE_TIME`:idx: + `odbcsql.html#496 <odbcsql.html#496>`_ + + `SQL_CODE_TIMESTAMP`:idx: + `odbcsql.html#497 <odbcsql.html#497>`_ + + `SQL_CODE_YEAR`:idx: + `odbcsql.html#154 <odbcsql.html#154>`_ + + `SQL_CODE_YEAR_TO_MONTH`:idx: + `odbcsql.html#160 <odbcsql.html#160>`_ + + `SQL_COLATT_OPT_MAX`:idx: + `odbcsql.html#588 <odbcsql.html#588>`_ + + `SQLColAttribute`:idx: + `odbcsql.html#662 <odbcsql.html#662>`_ + + `SQL_COLLATION_SEQ`:idx: + `odbcsql.html#546 <odbcsql.html#546>`_ + + `SQL_COLUMN_AUTO_INCREMENT`:idx: + `odbcsql.html#580 <odbcsql.html#580>`_ + + `SQL_COLUMN_CASE_SENSITIVE`:idx: + `odbcsql.html#581 <odbcsql.html#581>`_ + + `SQL_COLUMN_COUNT`:idx: + `odbcsql.html#569 <odbcsql.html#569>`_ + + `SQL_COLUMN_DISPLAY_SIZE`:idx: + `odbcsql.html#575 <odbcsql.html#575>`_ + + `SQL_COLUMN_DRIVER_START`:idx: + `odbcsql.html#589 <odbcsql.html#589>`_ + + `SQL_COLUMN_LABEL`:idx: + `odbcsql.html#587 <odbcsql.html#587>`_ + + `SQL_COLUMN_LENGTH`:idx: + `odbcsql.html#572 <odbcsql.html#572>`_ + + `SQL_COLUMN_MONEY`:idx: + `odbcsql.html#578 <odbcsql.html#578>`_ + + `SQL_COLUMN_NAME`:idx: + `odbcsql.html#570 <odbcsql.html#570>`_ + + `SQL_COLUMN_NULLABLE`:idx: + `odbcsql.html#576 <odbcsql.html#576>`_ + + `SQL_COLUMN_OWNER_NAME`:idx: + `odbcsql.html#585 <odbcsql.html#585>`_ + + `SQL_COLUMN_PRECISION`:idx: + `odbcsql.html#573 <odbcsql.html#573>`_ + + `SQL_COLUMN_QUALIFIER_NAME`:idx: + `odbcsql.html#586 <odbcsql.html#586>`_ + + `SQLColumns`:idx: + `odbcsql.html#665 <odbcsql.html#665>`_ + + `SQL_COLUMN_SCALE`:idx: + `odbcsql.html#574 <odbcsql.html#574>`_ + + `SQL_COLUMN_SEARCHABLE`:idx: + `odbcsql.html#582 <odbcsql.html#582>`_ + + `SQL_COLUMN_TABLE_NAME`:idx: + `odbcsql.html#584 <odbcsql.html#584>`_ + + `SQL_COLUMN_TYPE`:idx: + `odbcsql.html#571 <odbcsql.html#571>`_ + + `SQL_COLUMN_TYPE_NAME`:idx: + `odbcsql.html#583 <odbcsql.html#583>`_ + + `SQL_COLUMN_UNSIGNED`:idx: + `odbcsql.html#577 <odbcsql.html#577>`_ + + `SQL_COLUMN_UPDATABLE`:idx: + `odbcsql.html#579 <odbcsql.html#579>`_ + + `SQL_COMMIT`:idx: + `odbcsql.html#618 <odbcsql.html#618>`_ + + `SQL_CONCUR_DEFAULT`:idx: + `odbcsql.html#446 <odbcsql.html#446>`_ + + `SQL_CONCUR_LOCK`:idx: + `odbcsql.html#443 <odbcsql.html#443>`_ + + `SQL_CONCUR_READ_ONLY`:idx: + `odbcsql.html#442 <odbcsql.html#442>`_ + + `SQL_CONCURRENCY`:idx: + `odbcsql.html#386 <odbcsql.html#386>`_ + + `SQL_CONCUR_ROWVER`:idx: + `odbcsql.html#444 <odbcsql.html#444>`_ + + `SQL_CONCUR_VALUES`:idx: + `odbcsql.html#445 <odbcsql.html#445>`_ + + `SQLConnect`:idx: + `odbcsql.html#633 <odbcsql.html#633>`_ + + `SQL_C_SBIGINT`:idx: + `odbcsql.html#214 <odbcsql.html#214>`_ + + `SQL_C_SHORT`:idx: + `odbcsql.html#186 <odbcsql.html#186>`_ + + `SQL_C_SLONG`:idx: + `odbcsql.html#217 <odbcsql.html#217>`_ + + `SQL_C_SSHORT`:idx: + `odbcsql.html#218 <odbcsql.html#218>`_ + + `SQL_C_STINYINT`:idx: + `odbcsql.html#219 <odbcsql.html#219>`_ + + `SQL_C_TIME`:idx: + `odbcsql.html#194 <odbcsql.html#194>`_ + + `SQL_C_TIMESTAMP`:idx: + `odbcsql.html#195 <odbcsql.html#195>`_ + + `SQL_C_TINYINT`:idx: + `odbcsql.html#216 <odbcsql.html#216>`_ + + `SQL_C_TYPE_DATE`:idx: + `odbcsql.html#196 <odbcsql.html#196>`_ + + `SQL_C_TYPE_TIME`:idx: + `odbcsql.html#197 <odbcsql.html#197>`_ + + `SQL_C_TYPE_TIMESTAMP`:idx: + `odbcsql.html#198 <odbcsql.html#198>`_ + + `SQL_C_UBIGINT`:idx: + `odbcsql.html#215 <odbcsql.html#215>`_ + + `SQL_C_ULONG`:idx: + `odbcsql.html#220 <odbcsql.html#220>`_ + + `SQL_CUR_DEFAULT`:idx: + `odbcsql.html#345 <odbcsql.html#345>`_ + + `SQL_CURRENT_QUALIFIER`:idx: + `odbcsql.html#412 <odbcsql.html#412>`_ + + `SQL_CURSOR_DYNAMIC`:idx: + `odbcsql.html#439 <odbcsql.html#439>`_ + + `SQL_CURSOR_FORWARD_ONLY`:idx: + `odbcsql.html#437 <odbcsql.html#437>`_ + + `SQL_CURSOR_KEYSET_DRIVEN`:idx: + `odbcsql.html#438 <odbcsql.html#438>`_ + + `SQL_CURSOR_SENSITIVITY`:idx: + `odbcsql.html#543 <odbcsql.html#543>`_ + + `SQL_CURSOR_STATIC`:idx: + `odbcsql.html#440 <odbcsql.html#440>`_ + + `SQL_CURSOR_TYPE`:idx: + `odbcsql.html#385 <odbcsql.html#385>`_ + + `SQL_CURSOR_TYPE_DEFAULT`:idx: + `odbcsql.html#441 <odbcsql.html#441>`_ + + `SQL_CUR_USE_DRIVER`:idx: + `odbcsql.html#344 <odbcsql.html#344>`_ + + `SQL_CUR_USE_IF_NEEDED`:idx: + `odbcsql.html#342 <odbcsql.html#342>`_ + + `SQL_CUR_USE_ODBC`:idx: + `odbcsql.html#343 <odbcsql.html#343>`_ + + `SQL_C_USHORT`:idx: + `odbcsql.html#221 <odbcsql.html#221>`_ + + `SQL_C_UTINYINT`:idx: + `odbcsql.html#222 <odbcsql.html#222>`_ + + `SQL_C_VARBOOKMARK`:idx: + `odbcsql.html#228 <odbcsql.html#228>`_ + + `SQL_DATA_AT_EXEC`:idx: + `odbcsql.html#353 <odbcsql.html#353>`_ + + `SQLDataSources`:idx: + `odbcsql.html#654 <odbcsql.html#654>`_ + + `SQL_DATE`:idx: + `odbcsql.html#149 <odbcsql.html#149>`_ + + `SQL_DATE_LEN`:idx: + `odbcsql.html#363 <odbcsql.html#363>`_ + + `SQL_DATE_STRUCT`:idx: + `odbcsql.html#231 <odbcsql.html#231>`_ + + `SQL_DATETIME`:idx: + `odbcsql.html#144 <odbcsql.html#144>`_ + + `SQL_DECIMAL`:idx: + `odbcsql.html#138 <odbcsql.html#138>`_ + + `SQL_DEFAULT`:idx: + `odbcsql.html#493 <odbcsql.html#493>`_ + + `SQL_DELETE`:idx: + `odbcsql.html#325 <odbcsql.html#325>`_ + + `SQL_DELETE_BY_BOOKMARK`:idx: + `odbcsql.html#320 <odbcsql.html#320>`_ + + `SQL_DESC_ALLOC_TYPE`:idx: + `odbcsql.html#460 <odbcsql.html#460>`_ + + `SQL_DESC_ARRAY_SIZE`:idx: + `odbcsql.html#590 <odbcsql.html#590>`_ + + `SQL_DESC_ARRAY_STATUS_PTR`:idx: + `odbcsql.html#591 <odbcsql.html#591>`_ + + `SQL_DESC_AUTO_UNIQUE_VALUE`:idx: + `odbcsql.html#592 <odbcsql.html#592>`_ + + `SQL_DESC_BASE_COLUMN_NAME`:idx: + `odbcsql.html#593 <odbcsql.html#593>`_ + + `SQL_DESC_BASE_TABLE_NAME`:idx: + `odbcsql.html#594 <odbcsql.html#594>`_ + + `SQL_DESC_BIND_OFFSET_PTR`:idx: + `odbcsql.html#595 <odbcsql.html#595>`_ + + `SQL_DESC_BIND_TYPE`:idx: + `odbcsql.html#596 <odbcsql.html#596>`_ + + `SQL_DESC_CASE_SENSITIVE`:idx: + `odbcsql.html#597 <odbcsql.html#597>`_ + + `SQL_DESC_CATALOG_NAME`:idx: + `odbcsql.html#598 <odbcsql.html#598>`_ + + `SQL_DESC_CONCISE_TYPE`:idx: + `odbcsql.html#599 <odbcsql.html#599>`_ + + `SQL_DESC_COUNT`:idx: + `odbcsql.html#447 <odbcsql.html#447>`_ + + `SQL_DESC_DATA_PTR`:idx: + `odbcsql.html#456 <odbcsql.html#456>`_ + + `SQL_DESC_DATETIME_INTERVAL_CODE`:idx: + `odbcsql.html#453 <odbcsql.html#453>`_ + + `SQL_DESC_DATETIME_INTERVAL_PRECISION`:idx: + `odbcsql.html#600 <odbcsql.html#600>`_ + + `SQL_DESC_DISPLAY_SIZE`:idx: + `odbcsql.html#601 <odbcsql.html#601>`_ + + `SQL_DESC_FIXED_PREC_SCALE`:idx: + `odbcsql.html#602 <odbcsql.html#602>`_ + + `SQL_DESC_INDICATOR_PTR`:idx: + `odbcsql.html#455 <odbcsql.html#455>`_ + + `SQL_DESC_LABEL`:idx: + `odbcsql.html#603 <odbcsql.html#603>`_ + + `SQL_DESC_LENGTH`:idx: + `odbcsql.html#449 <odbcsql.html#449>`_ + + `SQL_DESC_LITERAL_PREFIX`:idx: + `odbcsql.html#604 <odbcsql.html#604>`_ + + `SQL_DESC_LITERAL_SUFFIX`:idx: + `odbcsql.html#605 <odbcsql.html#605>`_ + + `SQL_DESC_LOCAL_TYPE_NAME`:idx: + `odbcsql.html#606 <odbcsql.html#606>`_ + + `SQL_DESC_MAXIMUM_SCALE`:idx: + `odbcsql.html#607 <odbcsql.html#607>`_ + + `SQL_DESC_MINIMUM_SCALE`:idx: + `odbcsql.html#608 <odbcsql.html#608>`_ + + `SQL_DESC_NAME`:idx: + `odbcsql.html#457 <odbcsql.html#457>`_ + + `SQL_DESC_NULLABLE`:idx: + `odbcsql.html#454 <odbcsql.html#454>`_ + + `SQL_DESC_NUM_PREC_RADIX`:idx: + `odbcsql.html#609 <odbcsql.html#609>`_ + + `SQL_DESC_OCTET_LENGTH`:idx: + `odbcsql.html#459 <odbcsql.html#459>`_ + + `SQL_DESC_OCTET_LENGTH_PTR`:idx: + `odbcsql.html#450 <odbcsql.html#450>`_ + + `SQL_DESC_PARAMETER_TYPE`:idx: + `odbcsql.html#610 <odbcsql.html#610>`_ + + `SQL_DESC_PRECISION`:idx: + `odbcsql.html#451 <odbcsql.html#451>`_ + + `SQLDescribeCol`:idx: + `odbcsql.html#643 <odbcsql.html#643>`_ + + `SQL_DESCRIBE_PARAMETER`:idx: + `odbcsql.html#544 <odbcsql.html#544>`_ + + `SQL_DESC_ROWS_PROCESSED_PTR`:idx: + `odbcsql.html#611 <odbcsql.html#611>`_ + + `SQL_DESC_SCALE`:idx: + `odbcsql.html#452 <odbcsql.html#452>`_ + + `SQL_DESC_SCHEMA_NAME`:idx: + `odbcsql.html#612 <odbcsql.html#612>`_ + + `SQL_DESC_SEARCHABLE`:idx: + `odbcsql.html#613 <odbcsql.html#613>`_ + + `SQL_DESC_TABLE_NAME`:idx: + `odbcsql.html#615 <odbcsql.html#615>`_ + + `SQL_DESC_TYPE`:idx: + `odbcsql.html#448 <odbcsql.html#448>`_ + + `SQL_DESC_TYPE_NAME`:idx: + `odbcsql.html#614 <odbcsql.html#614>`_ + + `SQL_DESC_UNNAMED`:idx: + `odbcsql.html#458 <odbcsql.html#458>`_ + + `SQL_DESC_UNSIGNED`:idx: + `odbcsql.html#616 <odbcsql.html#616>`_ + + `SQL_DESC_UPDATABLE`:idx: + `odbcsql.html#617 <odbcsql.html#617>`_ + + `SQL_DIAG_ALTER_TABLE`:idx: + `odbcsql.html#473 <odbcsql.html#473>`_ + + `SQL_DIAG_CLASS_ORIGIN`:idx: + `odbcsql.html#468 <odbcsql.html#468>`_ + + `SQL_DIAG_CONNECTION_NAME`:idx: + `odbcsql.html#470 <odbcsql.html#470>`_ + + `SQL_DIAG_CREATE_INDEX`:idx: + `odbcsql.html#474 <odbcsql.html#474>`_ + + `SQL_DIAG_CREATE_TABLE`:idx: + `odbcsql.html#475 <odbcsql.html#475>`_ + + `SQL_DIAG_CREATE_VIEW`:idx: + `odbcsql.html#476 <odbcsql.html#476>`_ + + `SQL_DIAG_DELETE_WHERE`:idx: + `odbcsql.html#477 <odbcsql.html#477>`_ + + `SQL_DIAG_DROP_INDEX`:idx: + `odbcsql.html#478 <odbcsql.html#478>`_ + + `SQL_DIAG_DROP_TABLE`:idx: + `odbcsql.html#479 <odbcsql.html#479>`_ + + `SQL_DIAG_DROP_VIEW`:idx: + `odbcsql.html#480 <odbcsql.html#480>`_ + + `SQL_DIAG_DYNAMIC_DELETE_CURSOR`:idx: + `odbcsql.html#481 <odbcsql.html#481>`_ + + `SQL_DIAG_DYNAMIC_FUNCTION`:idx: + `odbcsql.html#467 <odbcsql.html#467>`_ + + `SQL_DIAG_DYNAMIC_FUNCTION_CODE`:idx: + `odbcsql.html#472 <odbcsql.html#472>`_ + + `SQL_DIAG_DYNAMIC_UPDATE_CURSOR`:idx: + `odbcsql.html#482 <odbcsql.html#482>`_ + + `SQL_DIAG_GRANT`:idx: + `odbcsql.html#483 <odbcsql.html#483>`_ + + `SQL_DIAG_INSERT`:idx: + `odbcsql.html#484 <odbcsql.html#484>`_ + + `SQL_DIAG_MESSAGE_TEXT`:idx: + `odbcsql.html#466 <odbcsql.html#466>`_ + + `SQL_DIAG_NATIVE`:idx: + `odbcsql.html#465 <odbcsql.html#465>`_ + + `SQL_DIAG_NUMBER`:idx: + `odbcsql.html#462 <odbcsql.html#462>`_ + + `SQL_DIAG_RETURNCODE`:idx: + `odbcsql.html#461 <odbcsql.html#461>`_ + + `SQL_DIAG_REVOKE`:idx: + `odbcsql.html#485 <odbcsql.html#485>`_ + + `SQL_DIAG_ROW_COUNT`:idx: + `odbcsql.html#463 <odbcsql.html#463>`_ + + `SQL_DIAG_SELECT_CURSOR`:idx: + `odbcsql.html#486 <odbcsql.html#486>`_ + + `SQL_DIAG_SERVER_NAME`:idx: + `odbcsql.html#471 <odbcsql.html#471>`_ + + `SQL_DIAG_SQLSTATE`:idx: + `odbcsql.html#464 <odbcsql.html#464>`_ + + `SQL_DIAG_SUBCLASS_ORIGIN`:idx: + `odbcsql.html#469 <odbcsql.html#469>`_ + + `SQL_DIAG_UNKNOWN_STATEMENT`:idx: + `odbcsql.html#487 <odbcsql.html#487>`_ + + `SQL_DIAG_UPDATE_WHERE`:idx: + `odbcsql.html#488 <odbcsql.html#488>`_ + + `SQLDisconnect`:idx: + `odbcsql.html#634 <odbcsql.html#634>`_ + + `SQL_DOUBLE`:idx: + `odbcsql.html#143 <odbcsql.html#143>`_ + + `SQL_DRIVER_COMPLETE`:idx: + `odbcsql.html#242 <odbcsql.html#242>`_ + + `SQL_DRIVER_COMPLETE_REQUIRED`:idx: + `odbcsql.html#244 <odbcsql.html#244>`_ + + `SQLDriverConnect`:idx: + `odbcsql.html#635 <odbcsql.html#635>`_ + + `SQL_DRIVER_NOPROMPT`:idx: + `odbcsql.html#241 <odbcsql.html#241>`_ + + `SQL_DRIVER_PROMPT`:idx: + `odbcsql.html#243 <odbcsql.html#243>`_ + + `SQLDrivers`:idx: + `odbcsql.html#655 <odbcsql.html#655>`_ + + `SQL_DROP`:idx: + `odbcsql.html#504 <odbcsql.html#504>`_ + + `SQL_DYNAMIC_CURSOR_ATTRIBUTES1`:idx: + `odbcsql.html#271 <odbcsql.html#271>`_ + + `SQL_DYNAMIC_CURSOR_ATTRIBUTES2`:idx: + `odbcsql.html#272 <odbcsql.html#272>`_ + + `SQLEndTran`:idx: + `odbcsql.html#663 <odbcsql.html#663>`_ + + `SQL_ENSURE`:idx: + `odbcsql.html#529 <odbcsql.html#529>`_ + + `SQL_ERROR`:idx: + `odbcsql.html#357 <odbcsql.html#357>`_ + + `SQLExecDirect`:idx: + `odbcsql.html#637 <odbcsql.html#637>`_ + + `SQLExecute`:idx: + `odbcsql.html#640 <odbcsql.html#640>`_ + + `SQLExtendedFetch`:idx: + `odbcsql.html#645 <odbcsql.html#645>`_ + + `SQL_FALSE`:idx: + `odbcsql.html#498 <odbcsql.html#498>`_ + + `SQLFetch`:idx: + `odbcsql.html#641 <odbcsql.html#641>`_ + + `SQL_FETCH_ABSOLUTE`:idx: + `odbcsql.html#513 <odbcsql.html#513>`_ + + `SQL_FETCH_BOOKMARK`:idx: + `odbcsql.html#250 <odbcsql.html#250>`_ + + `SQL_FETCH_BY_BOOKMARK`:idx: + `odbcsql.html#321 <odbcsql.html#321>`_ + + `SQL_FETCH_FIRST`:idx: + `odbcsql.html#508 <odbcsql.html#508>`_ + + `SQL_FETCH_FIRST_SYSTEM`:idx: + `odbcsql.html#510 <odbcsql.html#510>`_ + + `SQL_FETCH_FIRST_USER`:idx: + `odbcsql.html#509 <odbcsql.html#509>`_ + + `SQL_FETCH_LAST`:idx: + `odbcsql.html#511 <odbcsql.html#511>`_ + + `SQL_FETCH_NEXT`:idx: + `odbcsql.html#507 <odbcsql.html#507>`_ + + `SQL_FETCH_PRIOR`:idx: + `odbcsql.html#512 <odbcsql.html#512>`_ + + `SQL_FETCH_RELATIVE`:idx: + `odbcsql.html#514 <odbcsql.html#514>`_ + + `SQLFetchScroll`:idx: + `odbcsql.html#644 <odbcsql.html#644>`_ + + `SQL_FLOAT`:idx: + `odbcsql.html#141 <odbcsql.html#141>`_ + + `SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1`:idx: + `odbcsql.html#273 <odbcsql.html#273>`_ + + `SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2`:idx: + `odbcsql.html#274 <odbcsql.html#274>`_ + + `SQLFreeHandle`:idx: + `odbcsql.html#630 <odbcsql.html#630>`_ + + `SQLFreeStmt`:idx: + `odbcsql.html#661 <odbcsql.html#661>`_ + + `SQL_GET_BOOKMARK`:idx: + `odbcsql.html#392 <odbcsql.html#392>`_ + + `SQLGetCursorName`:idx: + `odbcsql.html#657 <odbcsql.html#657>`_ + + `SQLGetData`:idx: + `odbcsql.html#646 <odbcsql.html#646>`_ + + `SQLGetDiagField`:idx: + `odbcsql.html#632 <odbcsql.html#632>`_ + + `SQLGetDiagRec`:idx: + `odbcsql.html#631 <odbcsql.html#631>`_ + + `SQLGetEnvAttr`:idx: + `odbcsql.html#629 <odbcsql.html#629>`_ + + `SQLGetInfo`:idx: + `odbcsql.html#649 <odbcsql.html#649>`_ + + `SQLGetStmtAttr`:idx: + `odbcsql.html#648 <odbcsql.html#648>`_ + + `SQL_GUID`:idx: + `odbcsql.html#153 <odbcsql.html#153>`_ + + `SQL_HANDLE_DBC`:idx: + `odbcsql.html#367 <odbcsql.html#367>`_ + + `SQL_HANDLE_DESC`:idx: + `odbcsql.html#369 <odbcsql.html#369>`_ + + `SQL_HANDLE_ENV`:idx: + `odbcsql.html#366 <odbcsql.html#366>`_ + + `SQL_HANDLE_STMT`:idx: + `odbcsql.html#368 <odbcsql.html#368>`_ + + `SQL_INDEX_ALL`:idx: + `odbcsql.html#527 <odbcsql.html#527>`_ + + `SQL_INDEX_CLUSTERED`:idx: + `odbcsql.html#531 <odbcsql.html#531>`_ + + `SQL_INDEX_HASHED`:idx: + `odbcsql.html#532 <odbcsql.html#532>`_ + + `SQL_INDEX_KEYWORDS`:idx: + `odbcsql.html#275 <odbcsql.html#275>`_ + + `SQL_INDEX_OTHER`:idx: + `odbcsql.html#533 <odbcsql.html#533>`_ + + `SQL_INDEX_UNIQUE`:idx: + `odbcsql.html#526 <odbcsql.html#526>`_ + + `SQL_INFO_SCHEMA_VIEWS`:idx: + `odbcsql.html#276 <odbcsql.html#276>`_ + + `SQL_INSENSITIVE`:idx: + `odbcsql.html#490 <odbcsql.html#490>`_ + + `SQL_INTEGER`:idx: + `odbcsql.html#139 <odbcsql.html#139>`_ + + `SQL_INTERVAL`:idx: + `odbcsql.html#152 <odbcsql.html#152>`_ + + `SQL_INTERVAL_DAY`:idx: + `odbcsql.html#169 <odbcsql.html#169>`_ + + `SQL_INTERVAL_DAY_TO_HOUR`:idx: + `odbcsql.html#174 <odbcsql.html#174>`_ + + `SQL_INTERVAL_DAY_TO_MINUTE`:idx: + `odbcsql.html#175 <odbcsql.html#175>`_ + + `SQL_INTERVAL_DAY_TO_SECOND`:idx: + `odbcsql.html#176 <odbcsql.html#176>`_ + + `SQL_INTERVAL_HOUR`:idx: + `odbcsql.html#170 <odbcsql.html#170>`_ + + `SQL_INTERVAL_HOUR_TO_MINUTE`:idx: + `odbcsql.html#177 <odbcsql.html#177>`_ + + `SQL_INTERVAL_HOUR_TO_SECOND`:idx: + `odbcsql.html#178 <odbcsql.html#178>`_ + + `SQL_INTERVAL_MINUTE`:idx: + `odbcsql.html#171 <odbcsql.html#171>`_ + + `SQL_INTERVAL_MINUTE_TO_SECOND`:idx: + `odbcsql.html#179 <odbcsql.html#179>`_ + + `SQL_INTERVAL_MONTH`:idx: + `odbcsql.html#168 <odbcsql.html#168>`_ + + `SQL_INTERVAL_SECOND`:idx: + `odbcsql.html#172 <odbcsql.html#172>`_ + + `SQL_INTERVAL_YEAR`:idx: + `odbcsql.html#167 <odbcsql.html#167>`_ + + `SQL_INTERVAL_YEAR_TO_MONTH`:idx: + `odbcsql.html#173 <odbcsql.html#173>`_ + + `SQL_INVALID_HANDLE`:idx: + `odbcsql.html#358 <odbcsql.html#358>`_ + + `SQL_IS_INTEGER`:idx: + `odbcsql.html#247 <odbcsql.html#247>`_ + + `SQL_IS_POINTER`:idx: + `odbcsql.html#245 <odbcsql.html#245>`_ + + `SQL_IS_SMALLINT`:idx: + `odbcsql.html#249 <odbcsql.html#249>`_ + + `SQL_IS_UINTEGER`:idx: + `odbcsql.html#246 <odbcsql.html#246>`_ + + `SQL_IS_USMALLINT`:idx: + `odbcsql.html#248 <odbcsql.html#248>`_ + + `SQL_KEYSET_CURSOR_ATTRIBUTES1`:idx: + `odbcsql.html#277 <odbcsql.html#277>`_ + + `SQL_KEYSET_CURSOR_ATTRIBUTES2`:idx: + `odbcsql.html#278 <odbcsql.html#278>`_ + + `SQL_KEYSET_SIZE`:idx: + `odbcsql.html#387 <odbcsql.html#387>`_ + + `SQL_LOCK_EXCLUSIVE`:idx: + `odbcsql.html#327 <odbcsql.html#327>`_ + + `SQL_LOCK_NO_CHANGE`:idx: + `odbcsql.html#326 <odbcsql.html#326>`_ + + `SQL_LOCK_UNLOCK`:idx: + `odbcsql.html#328 <odbcsql.html#328>`_ + + `SQL_LOGIN_TIMEOUT`:idx: + `odbcsql.html#407 <odbcsql.html#407>`_ + + `SQL_LONGVARBINARY`:idx: + `odbcsql.html#129 <odbcsql.html#129>`_ + + `SQL_LONGVARCHAR`:idx: + `odbcsql.html#126 <odbcsql.html#126>`_ + + `SQL_MAX_DSN_LENGTH`:idx: + `odbcsql.html#338 <odbcsql.html#338>`_ + + `SQL_MAX_IDENTIFIER_LEN`:idx: + `odbcsql.html#547 <odbcsql.html#547>`_ + + `SQL_MAXIMUM_IDENTIFIER_LENGTH`:idx: + `odbcsql.html#548 <odbcsql.html#548>`_ + + `SQL_MAX_LENGTH`:idx: + `odbcsql.html#382 <odbcsql.html#382>`_ + + `SQL_MAX_MESSAGE_LENGTH`:idx: + `odbcsql.html#362 <odbcsql.html#362>`_ + + `SQL_MAX_OPTION_STRING_LENGTH`:idx: + `odbcsql.html#339 <odbcsql.html#339>`_ + + `SQL_MAX_ROWS`:idx: + `odbcsql.html#380 <odbcsql.html#380>`_ + + `SQL_MODE_DEFAULT`:idx: + `odbcsql.html#431 <odbcsql.html#431>`_ + + `SQL_MODE_READ_ONLY`:idx: + `odbcsql.html#430 <odbcsql.html#430>`_ + + `SQL_MODE_READ_WRITE`:idx: + `odbcsql.html#429 <odbcsql.html#429>`_ + + `SQL_NAME_LEN`:idx: + `odbcsql.html#237 <odbcsql.html#237>`_ + + `SQL_NEED_DATA`:idx: + `odbcsql.html#360 <odbcsql.html#360>`_ + + `SQL_NO_DATA`:idx: + `odbcsql.html#356 <odbcsql.html#356>`_ + + `SQL_NONSCROLLABLE`:idx: + `odbcsql.html#435 <odbcsql.html#435>`_ + + `SQL_NO_NULLS`:idx: + `odbcsql.html#500 <odbcsql.html#500>`_ + + `SQL_NOSCAN`:idx: + `odbcsql.html#381 <odbcsql.html#381>`_ + + `SQL_NO_TOTAL`:idx: + `odbcsql.html#230 <odbcsql.html#230>`_ + + `SQL_NTS`:idx: + `odbcsql.html#361 <odbcsql.html#361>`_ + + `SQL_NULLABLE`:idx: + `odbcsql.html#501 <odbcsql.html#501>`_ + + `SQL_NULLABLE_UNKNOWN`:idx: + `odbcsql.html#502 <odbcsql.html#502>`_ + + `SQL_NULL_DATA`:idx: + `odbcsql.html#352 <odbcsql.html#352>`_ + + `SQL_NULL_HANDLE`:idx: + `odbcsql.html#519 <odbcsql.html#519>`_ + + `SQL_NULL_HDBC`:idx: + `odbcsql.html#516 <odbcsql.html#516>`_ + + `SQL_NULL_HDESC`:idx: + `odbcsql.html#518 <odbcsql.html#518>`_ + + `SQL_NULL_HENV`:idx: + `odbcsql.html#515 <odbcsql.html#515>`_ + + `SQL_NULL_HSTMT`:idx: + `odbcsql.html#517 <odbcsql.html#517>`_ + + `SQL_NUMERIC`:idx: + `odbcsql.html#137 <odbcsql.html#137>`_ + + `SQLNumResultCols`:idx: + `odbcsql.html#642 <odbcsql.html#642>`_ + + `SQL_ODBC_CURSORS`:idx: + `odbcsql.html#340 <odbcsql.html#340>`_ + + `SQL_OJ_CAPABILITIES`:idx: + `odbcsql.html#540 <odbcsql.html#540>`_ + + `SQL_OPT_TRACE`:idx: + `odbcsql.html#408 <odbcsql.html#408>`_ + + `SQL_OPT_TRACEFILE`:idx: + `odbcsql.html#409 <odbcsql.html#409>`_ + + `SQL_OUTER_JOIN_CAPABILITIES`:idx: + `odbcsql.html#541 <odbcsql.html#541>`_ + + `SQL_OV_ODBC2`:idx: + `odbcsql.html#239 <odbcsql.html#239>`_ + + `SQL_OV_ODBC3`:idx: + `odbcsql.html#238 <odbcsql.html#238>`_ + + `SQL_PACKET_SIZE`:idx: + `odbcsql.html#414 <odbcsql.html#414>`_ + + `SQL_PARAM_INPUT`:idx: + `odbcsql.html#347 <odbcsql.html#347>`_ + + `SQL_PARAM_INPUT_OUTPUT`:idx: + `odbcsql.html#348 <odbcsql.html#348>`_ + + `SQL_PARAM_OUTPUT`:idx: + `odbcsql.html#350 <odbcsql.html#350>`_ + + `SQL_PARAM_TYPE_UNKNOWN`:idx: + `odbcsql.html#346 <odbcsql.html#346>`_ + + `SQL_POSITION`:idx: + `odbcsql.html#322 <odbcsql.html#322>`_ + + `SQLPrepare`:idx: + `odbcsql.html#638 <odbcsql.html#638>`_ + + `SQLPrimaryKeys`:idx: + `odbcsql.html#668 <odbcsql.html#668>`_ + + `SQLProcedureColumns`:idx: + `odbcsql.html#669 <odbcsql.html#669>`_ + + `SQLProcedures`:idx: + `odbcsql.html#667 <odbcsql.html#667>`_ + + `SQLPutData`:idx: + `odbcsql.html#651 <odbcsql.html#651>`_ + + `SQL_QUERY_TIMEOUT`:idx: + `odbcsql.html#379 <odbcsql.html#379>`_ + + `SQL_QUICK`:idx: + `odbcsql.html#528 <odbcsql.html#528>`_ + + `SQL_QUIET_MODE`:idx: + `odbcsql.html#413 <odbcsql.html#413>`_ + + `SQL_REAL`:idx: + `odbcsql.html#142 <odbcsql.html#142>`_ + + `SQL_REFRESH`:idx: + `odbcsql.html#323 <odbcsql.html#323>`_ + + `SQL_RESET_PARAMS`:idx: + `odbcsql.html#506 <odbcsql.html#506>`_ + + `SQL_RESULT_COL`:idx: + `odbcsql.html#349 <odbcsql.html#349>`_ + + `SQL_RETRIEVE_DATA`:idx: + `odbcsql.html#390 <odbcsql.html#390>`_ + + `SQL_RETURN_VALUE`:idx: + `odbcsql.html#351 <odbcsql.html#351>`_ + + `SQL_ROLLBACK`:idx: + `odbcsql.html#619 <odbcsql.html#619>`_ + + `SQL_ROW_ADDED`:idx: + `odbcsql.html#333 <odbcsql.html#333>`_ + + `SQLRowCount`:idx: + `odbcsql.html#659 <odbcsql.html#659>`_ + + `SQL_ROW_DELETED`:idx: + `odbcsql.html#330 <odbcsql.html#330>`_ + + `SQL_ROW_ERROR`:idx: + `odbcsql.html#334 <odbcsql.html#334>`_ + + `SQL_ROW_IDENTIFIER`:idx: + `odbcsql.html#525 <odbcsql.html#525>`_ + + `SQL_ROW_IGNORE`:idx: + `odbcsql.html#337 <odbcsql.html#337>`_ + + `SQL_ROW_NOROW`:idx: + `odbcsql.html#332 <odbcsql.html#332>`_ + + `SQL_ROW_NUMBER`:idx: + `odbcsql.html#393 <odbcsql.html#393>`_ + + `SQL_ROW_PROCEED`:idx: + `odbcsql.html#336 <odbcsql.html#336>`_ + + `SQL_ROWSET_SIZE`:idx: + `odbcsql.html#388 <odbcsql.html#388>`_ + + `SQL_ROW_SUCCESS`:idx: + `odbcsql.html#329 <odbcsql.html#329>`_ + + `SQL_ROW_SUCCESS_WITH_INFO`:idx: + `odbcsql.html#335 <odbcsql.html#335>`_ + + `SQL_ROW_UPDATED`:idx: + `odbcsql.html#331 <odbcsql.html#331>`_ + + `SQL_ROWVER`:idx: + `odbcsql.html#524 <odbcsql.html#524>`_ + + `SQL_SCCO_LOCK`:idx: + `odbcsql.html#550 <odbcsql.html#550>`_ + + `SQL_SCCO_OPT_ROWVER`:idx: + `odbcsql.html#551 <odbcsql.html#551>`_ + + `SQL_SCCO_OPT_VALUES`:idx: + `odbcsql.html#552 <odbcsql.html#552>`_ + + `SQL_SCCO_READ_ONLY`:idx: + `odbcsql.html#549 <odbcsql.html#549>`_ + + `SQL_SCOPE_CURROW`:idx: + `odbcsql.html#520 <odbcsql.html#520>`_ + + `SQL_SCOPE_SESSION`:idx: + `odbcsql.html#522 <odbcsql.html#522>`_ + + `SQL_SCOPE_TRANSACTION`:idx: + `odbcsql.html#521 <odbcsql.html#521>`_ + + `SQL_SCROLLABLE`:idx: + `odbcsql.html#436 <odbcsql.html#436>`_ + + `SQL_SCROLL_CONCURRENCY`:idx: + `odbcsql.html#534 <odbcsql.html#534>`_ + + `SQL_SCROLL_OPTIONS`:idx: + `odbcsql.html#251 <odbcsql.html#251>`_ + + `SQL_SENSITIVE`:idx: + `odbcsql.html#491 <odbcsql.html#491>`_ + + `SQLSetConnectAttr`:idx: + `odbcsql.html#656 <odbcsql.html#656>`_ + + `SQLSetCursorName`:idx: + `odbcsql.html#658 <odbcsql.html#658>`_ + + `SQLSetEnvAttr`:idx: + `odbcsql.html#628 <odbcsql.html#628>`_ + + `SQLSetPos`:idx: + `odbcsql.html#653 <odbcsql.html#653>`_ + + `SQL_SETPOS_MAX_OPTION_VALUE`:idx: + `odbcsql.html#318 <odbcsql.html#318>`_ + + `SQLSetStmtAttr`:idx: + `odbcsql.html#647 <odbcsql.html#647>`_ + + `SQL_SIGNED_OFFSET`:idx: + `odbcsql.html#191 <odbcsql.html#191>`_ + + `SQL_SIMULATE_CURSOR`:idx: + `odbcsql.html#389 <odbcsql.html#389>`_ + + `SQL_SMALLINT`:idx: + `odbcsql.html#140 <odbcsql.html#140>`_ + + `SQL_SO_DYNAMIC`:idx: + `odbcsql.html#259 <odbcsql.html#259>`_ + + `SQL_SO_FORWARD_ONLY`:idx: + `odbcsql.html#257 <odbcsql.html#257>`_ + + `SQL_SO_KEYSET_DRIVEN`:idx: + `odbcsql.html#258 <odbcsql.html#258>`_ + + `SQL_SO_MIXED`:idx: + `odbcsql.html#260 <odbcsql.html#260>`_ + + `SQL_SO_STATIC`:idx: + `odbcsql.html#261 <odbcsql.html#261>`_ + + `SQLSpecialColumns`:idx: + `odbcsql.html#666 <odbcsql.html#666>`_ + + `SQL_SS_ADDITIONS`:idx: + `odbcsql.html#566 <odbcsql.html#566>`_ + + `SQL_SS_DELETIONS`:idx: + `odbcsql.html#567 <odbcsql.html#567>`_ + + `SQL_SS_UPDATES`:idx: + `odbcsql.html#568 <odbcsql.html#568>`_ + + `SQL_STATIC_CURSOR_ATTRIBUTES1`:idx: + `odbcsql.html#279 <odbcsql.html#279>`_ + + `SQL_STATIC_CURSOR_ATTRIBUTES2`:idx: + `odbcsql.html#280 <odbcsql.html#280>`_ + + `SQL_STATIC_SENSITIVITY`:idx: + `odbcsql.html#263 <odbcsql.html#263>`_ + + `SQLStatistics`:idx: + `odbcsql.html#670 <odbcsql.html#670>`_ + + `SQL_STILL_EXECUTING`:idx: + `odbcsql.html#359 <odbcsql.html#359>`_ + + `SQL_SUCCESS`:idx: + `odbcsql.html#354 <odbcsql.html#354>`_ + + `SQL_SUCCESS_WITH_INFO`:idx: + `odbcsql.html#355 <odbcsql.html#355>`_ + + `SQLTables`:idx: + `odbcsql.html#664 <odbcsql.html#664>`_ + + `SQL_TABLE_STAT`:idx: + `odbcsql.html#530 <odbcsql.html#530>`_ + + `SQL_TC_ALL`:idx: + `odbcsql.html#555 <odbcsql.html#555>`_ + + `SQL_TC_DDL_COMMIT`:idx: + `odbcsql.html#556 <odbcsql.html#556>`_ + + `SQL_TC_DDL_IGNORE`:idx: + `odbcsql.html#557 <odbcsql.html#557>`_ + + `SQL_TC_DML`:idx: + `odbcsql.html#554 <odbcsql.html#554>`_ + + `SQL_TC_NONE`:idx: + `odbcsql.html#553 <odbcsql.html#553>`_ + + `SQL_TIME`:idx: + `odbcsql.html#150 <odbcsql.html#150>`_ + + `SQL_TIME_LEN`:idx: + `odbcsql.html#364 <odbcsql.html#364>`_ + + `SQL_TIMESTAMP`:idx: + `odbcsql.html#151 <odbcsql.html#151>`_ + + `SQL_TIMESTAMP_LEN`:idx: + `odbcsql.html#365 <odbcsql.html#365>`_ + + `SQL_TIMESTAMP_STRUCT`:idx: + `odbcsql.html#235 <odbcsql.html#235>`_ + + `SQL_TIME_STRUCT`:idx: + `odbcsql.html#233 <odbcsql.html#233>`_ + + `SQL_TINYINT`:idx: + `odbcsql.html#131 <odbcsql.html#131>`_ + + `SQL_TRANSACTION_CAPABLE`:idx: + `odbcsql.html#536 <odbcsql.html#536>`_ + + `SQL_TRANSACTION_ISOLATION_OPTION`:idx: + `odbcsql.html#539 <odbcsql.html#539>`_ + + `SQL_TRANSACTION_READ_COMMITTED`:idx: + `odbcsql.html#561 <odbcsql.html#561>`_ + + `SQL_TRANSACTION_READ_UNCOMMITTED`:idx: + `odbcsql.html#559 <odbcsql.html#559>`_ + + `SQL_TRANSACTION_REPEATABLE_READ`:idx: + `odbcsql.html#563 <odbcsql.html#563>`_ + + `SQL_TRANSACTION_SERIALIZABLE`:idx: + `odbcsql.html#565 <odbcsql.html#565>`_ + + `SQL_TRANSLATE_DLL`:idx: + `odbcsql.html#410 <odbcsql.html#410>`_ + + `SQL_TRANSLATE_OPTION`:idx: + `odbcsql.html#411 <odbcsql.html#411>`_ + + `SQL_TRUE`:idx: + `odbcsql.html#499 <odbcsql.html#499>`_ + + `SQL_TXN_CAPABLE`:idx: + `odbcsql.html#535 <odbcsql.html#535>`_ + + `SQL_TXN_ISOLATION`:idx: + `odbcsql.html#402 <odbcsql.html#402>`_ + + `SQL_TXN_ISOLATION_OPTION`:idx: + `odbcsql.html#538 <odbcsql.html#538>`_ + + `SQL_TXN_READ_COMMITTED`:idx: + `odbcsql.html#560 <odbcsql.html#560>`_ + + `SQL_TXN_READ_UNCOMMITTED`:idx: + `odbcsql.html#558 <odbcsql.html#558>`_ + + `SQL_TXN_REPEATABLE_READ`:idx: + `odbcsql.html#562 <odbcsql.html#562>`_ + + `SQL_TXN_SERIALIZABLE`:idx: + `odbcsql.html#564 <odbcsql.html#564>`_ + + `SQL_TYPE_DATE`:idx: + `odbcsql.html#146 <odbcsql.html#146>`_ + + `SQL_TYPE_MAX`:idx: + `odbcsql.html#227 <odbcsql.html#227>`_ + + `SQL_TYPE_MIN`:idx: + `odbcsql.html#226 <odbcsql.html#226>`_ + + `SQL_TYPE_NULL`:idx: + `odbcsql.html#225 <odbcsql.html#225>`_ + + `SQL_TYPE_TIME`:idx: + `odbcsql.html#147 <odbcsql.html#147>`_ + + `SQL_TYPE_TIMESTAMP`:idx: + `odbcsql.html#148 <odbcsql.html#148>`_ + + `SQL_UB_DEFAULT`:idx: + `odbcsql.html#254 <odbcsql.html#254>`_ + + `SQL_UB_FIXED`:idx: + `odbcsql.html#255 <odbcsql.html#255>`_ + + `SQL_UB_OFF`:idx: + `odbcsql.html#252 <odbcsql.html#252>`_ + + `SQL_UB_ON`:idx: + `odbcsql.html#253 <odbcsql.html#253>`_ + + `SQL_UB_VARIABLE`:idx: + `odbcsql.html#256 <odbcsql.html#256>`_ + + `SQL_UNBIND`:idx: + `odbcsql.html#505 <odbcsql.html#505>`_ + + `SQL_UNICODE`:idx: + `odbcsql.html#180 <odbcsql.html#180>`_ + + `SQL_UNICODE_CHAR`:idx: + `odbcsql.html#183 <odbcsql.html#183>`_ + + `SQL_UNICODE_LONGVARCHAR`:idx: + `odbcsql.html#182 <odbcsql.html#182>`_ + + `SQL_UNICODE_VARCHAR`:idx: + `odbcsql.html#181 <odbcsql.html#181>`_ + + `SQL_UNKNOWN_TYPE`:idx: + `odbcsql.html#125 <odbcsql.html#125>`_ + + `SQL_UNSIGNED_OFFSET`:idx: + `odbcsql.html#192 <odbcsql.html#192>`_ + + `SQL_UNSPECIFIED`:idx: + `odbcsql.html#489 <odbcsql.html#489>`_ + + `SQL_UPDATE`:idx: + `odbcsql.html#324 <odbcsql.html#324>`_ + + `SQL_UPDATE_BY_BOOKMARK`:idx: + `odbcsql.html#319 <odbcsql.html#319>`_ + + `SQL_USE_BOOKMARKS`:idx: + `odbcsql.html#391 <odbcsql.html#391>`_ + + `SQL_USER_NAME`:idx: + `odbcsql.html#537 <odbcsql.html#537>`_ + + `SQL_VARBINARY`:idx: + `odbcsql.html#128 <odbcsql.html#128>`_ + + `SQL_VARCHAR`:idx: + `odbcsql.html#145 <odbcsql.html#145>`_ + + `SQL_WCHAR`:idx: + `odbcsql.html#133 <odbcsql.html#133>`_ + + `SQL_WLONGVARCHAR`:idx: + `odbcsql.html#135 <odbcsql.html#135>`_ + + `SQL_WVARCHAR`:idx: + `odbcsql.html#134 <odbcsql.html#134>`_ + + `SQL_XOPEN_CLI_YEAR`:idx: + `odbcsql.html#542 <odbcsql.html#542>`_ + + `sqrt`:idx: + * `math.html#110 <math.html#110>`_ + * `complex.html#109 <complex.html#109>`_ + + `SS_DISABLE`:idx: + `posix.html#765 <posix.html#765>`_ + + `SS_ONSTACK`:idx: + `posix.html#764 <posix.html#764>`_ + + `stack_trace`:idx: + `nimrodc.html#109 <nimrodc.html#109>`_ + + `startsWith`:idx: + `strutils.html#135 <strutils.html#135>`_ + + `stat`:idx: + `posix.html#1065 <posix.html#1065>`_ + + `Statements`:idx: + `manual.html#174 <manual.html#174>`_ + + `static error`:idx: + `manual.html#109 <manual.html#109>`_ + + `static type`:idx: + `manual.html#103 <manual.html#103>`_ + + `statvfs`:idx: + `posix.html#1056 <posix.html#1056>`_ + + `stdcall`:idx: + `manual.html#165 <manual.html#165>`_ + + `stderr`:idx: + `system.html#481 <system.html#481>`_ + + `STDERR_FILENO`:idx: + `posix.html#127 <posix.html#127>`_ + + `stdin`:idx: + `system.html#479 <system.html#479>`_ + + `STDIN_FILENO`:idx: + `posix.html#128 <posix.html#128>`_ + + `stdout`:idx: + `system.html#480 <system.html#480>`_ + + `STDOUT_FILENO`:idx: + `posix.html#129 <posix.html#129>`_ + + `ST_NOSUID`:idx: + `posix.html#673 <posix.html#673>`_ + + `ST_RDONLY`:idx: + `posix.html#672 <posix.html#672>`_ + + `strerror`:idx: + `posix.html#1160 <posix.html#1160>`_ + + `strfmon`:idx: + `posix.html#848 <posix.html#848>`_ + + `strftime`:idx: + `posix.html#1110 <posix.html#1110>`_ + + `string`:idx: + * `manual.html#151 <manual.html#151>`_ + * `system.html#111 <system.html#111>`_ + + `strip`:idx: + `strutils.html#105 <strutils.html#105>`_ + + `strptime`:idx: + `posix.html#1111 <posix.html#1111>`_ + + `strStart`:idx: + `strutils.html#103 <strutils.html#103>`_ + + `structured type`:idx: + `manual.html#152 <manual.html#152>`_ + + `strutils`:idx: + `nimrodc.html#117 <nimrodc.html#117>`_ + + `style-insensitive`:idx: + `manual.html#118 <manual.html#118>`_ + + `S_TYPEISMQ`:idx: + `posix.html#1074 <posix.html#1074>`_ + + `S_TYPEISSEM`:idx: + `posix.html#1075 <posix.html#1075>`_ + + `S_TYPEISSHM`:idx: + `posix.html#1076 <posix.html#1076>`_ + + `S_TYPEISTMO`:idx: + `posix.html#1077 <posix.html#1077>`_ + + `subrange`:idx: + `manual.html#150 <manual.html#150>`_ + + `succ`:idx: + `system.html#154 <system.html#154>`_ + + `swab`:idx: + `posix.html#1031 <posix.html#1031>`_ + + `swap`:idx: + `system.html#417 <system.html#417>`_ + + `swapcontext`:idx: + `posix.html#1191 <posix.html#1191>`_ + + `symlink`:idx: + `posix.html#1032 <posix.html#1032>`_ + + `sync`:idx: + `posix.html#1033 <posix.html#1033>`_ + + `syscall`:idx: + `manual.html#172 <manual.html#172>`_ + + `sysconf`:idx: + `posix.html#1034 <posix.html#1034>`_ + + `system`:idx: + `manual.html#220 <manual.html#220>`_ + + `tabulator`:idx: + `manual.html#125 <manual.html#125>`_ + + `TAddress`:idx: + `system.html#372 <system.html#372>`_ + + `Taiocb`:idx: + `posix.html#204 <posix.html#204>`_ + + `TAllocfunc`:idx: + `zlib.html#108 <zlib.html#108>`_ + + `tan`:idx: + `math.html#125 <math.html#125>`_ + + `tanh`:idx: + `math.html#126 <math.html#126>`_ + + `TBaseLexer`:idx: + `lexbase.html#103 <lexbase.html#103>`_ + + `Tblkcnt`:idx: + `posix.html#143 <posix.html#143>`_ + + `Tblksize`:idx: + `posix.html#144 <posix.html#144>`_ + + `TCfgEvent`:idx: + `parsecfg.html#102 <parsecfg.html#102>`_ + + `TCfgEventKind`:idx: + `parsecfg.html#101 <parsecfg.html#101>`_ + + `TCfgParser`:idx: + `parsecfg.html#103 <parsecfg.html#103>`_ + + `tcgetpgrp`:idx: + `posix.html#1035 <posix.html#1035>`_ + + `TCharSet`:idx: + `strutils.html#101 <strutils.html#101>`_ + + `TClock`:idx: + `posix.html#145 <posix.html#145>`_ + + `TClockId`:idx: + `posix.html#146 <posix.html#146>`_ + + `TCmdLineKind`:idx: + `parseopt.html#101 <parseopt.html#101>`_ + + `TComplex`:idx: + `complex.html#101 <complex.html#101>`_ + + `tcsetpgrp`:idx: + `posix.html#1036 <posix.html#1036>`_ + + `TDev`:idx: + `posix.html#147 <posix.html#147>`_ + + `TDIR`:idx: + `posix.html#130 <posix.html#130>`_ + + `Tdirent`:idx: + `posix.html#131 <posix.html#131>`_ + + `telldir`:idx: + `posix.html#806 <posix.html#806>`_ + + `template`:idx: + `manual.html#211 <manual.html#211>`_ + + `TEndian`:idx: + `system.html#385 <system.html#385>`_ + + `Tfd_set`:idx: + `posix.html#201 <posix.html#201>`_ + + `Tfenv`:idx: + `posix.html#133 <posix.html#133>`_ + + `Tfexcept`:idx: + `posix.html#134 <posix.html#134>`_ + + `TFile`:idx: + `system.html#476 <system.html#476>`_ + + `TFileHandle`:idx: + `system.html#478 <system.html#478>`_ + + `TFileMode`:idx: + `system.html#477 <system.html#477>`_ + + `TFileStream`:idx: + `streams.html#119 <streams.html#119>`_ + + `TFloatClass`:idx: + `math.html#103 <math.html#103>`_ + + `Tflock`:idx: + `posix.html#132 <posix.html#132>`_ + + `T_FMT`:idx: + `posix.html#392 <posix.html#392>`_ + + `T_FMT_AMPM`:idx: + `posix.html#393 <posix.html#393>`_ + + `TFormatFlag`:idx: + `strtabs.html#111 <strtabs.html#111>`_ + + `TFreeFunc`:idx: + `zlib.html#109 <zlib.html#109>`_ + + `Tfsblkcnt`:idx: + `posix.html#148 <posix.html#148>`_ + + `Tfsfilcnt`:idx: + `posix.html#149 <posix.html#149>`_ + + `TFTW`:idx: + `posix.html#135 <posix.html#135>`_ + + `TGC_Strategy`:idx: + `system.html#460 <system.html#460>`_ + + `TGid`:idx: + `posix.html#150 <posix.html#150>`_ + + `TGlob`:idx: + `posix.html#136 <posix.html#136>`_ + + `TGroup`:idx: + `posix.html#137 <posix.html#137>`_ + + `THash`:idx: + `hashes.html#101 <hashes.html#101>`_ + + `THOUSEP`:idx: + `posix.html#440 <posix.html#440>`_ + + `Ticonv`:idx: + `posix.html#138 <posix.html#138>`_ + + `Tid`:idx: + `posix.html#151 <posix.html#151>`_ + + `time`:idx: + `posix.html#1112 <posix.html#1112>`_ + + `TimeInfoToTime`:idx: + `times.html#108 <times.html#108>`_ + + `TIMER_ABSTIME`:idx: + `posix.html#699 <posix.html#699>`_ + + `timer_create`:idx: + `posix.html#1113 <posix.html#1113>`_ + + `timer_delete`:idx: + `posix.html#1114 <posix.html#1114>`_ + + `timer_getoverrun`:idx: + `posix.html#1116 <posix.html#1116>`_ + + `timer_gettime`:idx: + `posix.html#1115 <posix.html#1115>`_ + + `timer_settime`:idx: + `posix.html#1117 <posix.html#1117>`_ + + `times`:idx: + `nimrodc.html#119 <nimrodc.html#119>`_ + + `timezone`:idx: + `posix.html#702 <posix.html#702>`_ + + `Tino`:idx: + `posix.html#152 <posix.html#152>`_ + + `TInternalState`:idx: + `zlib.html#110 <zlib.html#110>`_ + + `Tipc_perm`:idx: + `posix.html#182 <posix.html#182>`_ + + `titimerspec`:idx: + `posix.html#188 <posix.html#188>`_ + + `TKey`:idx: + `posix.html#153 <posix.html#153>`_ + + `Tlconv`:idx: + `posix.html#139 <posix.html#139>`_ + + `Tmcontext`:idx: + `posix.html#202 <posix.html#202>`_ + + `TMode`:idx: + `posix.html#154 <posix.html#154>`_ + + `TMonth`:idx: + `times.html#101 <times.html#101>`_ + + `TMqAttr`:idx: + `posix.html#141 <posix.html#141>`_ + + `TMqd`:idx: + `posix.html#140 <posix.html#140>`_ + + `Tnl_catd`:idx: + `posix.html#198 <posix.html#198>`_ + + `TNlink`:idx: + `posix.html#155 <posix.html#155>`_ + + `Tnl_item`:idx: + `posix.html#197 <posix.html#197>`_ + + `toBiggestFloat`:idx: + `system.html#399 <system.html#399>`_ + + `toBiggestInt`:idx: + `system.html#401 <system.html#401>`_ + + `toBin`:idx: + `strutils.html#140 <strutils.html#140>`_ + + `TObject`:idx: + `system.html#128 <system.html#128>`_ + + `TOff`:idx: + `posix.html#156 <posix.html#156>`_ + + `toFloat`:idx: + `system.html#398 <system.html#398>`_ + + `toHex`:idx: + `strutils.html#126 <strutils.html#126>`_ + + `toInt`:idx: + `system.html#400 <system.html#400>`_ + + `toLower`:idx: + * `strutils.html#106 <strutils.html#106>`_ + * `strutils.html#107 <strutils.html#107>`_ + + `toOct`:idx: + `strutils.html#139 <strutils.html#139>`_ + + `toOctal`:idx: + `strutils.html#117 <strutils.html#117>`_ + + `TOptParser`:idx: + `parseopt.html#102 <parseopt.html#102>`_ + + `toString`:idx: + `strutils.html#131 <strutils.html#131>`_ + + `toU16`:idx: + `system.html#176 <system.html#176>`_ + + `toU32`:idx: + `system.html#177 <system.html#177>`_ + + `toU8`:idx: + `system.html#175 <system.html#175>`_ + + `toUpper`:idx: + * `strutils.html#108 <strutils.html#108>`_ + * `strutils.html#109 <strutils.html#109>`_ + + `TPasswd`:idx: + `posix.html#142 <posix.html#142>`_ + + `TPathComponent`:idx: + `os.html#154 <os.html#154>`_ + + `TPid`:idx: + `posix.html#157 <posix.html#157>`_ + + `Tposix_spawnattr`:idx: + `posix.html#205 <posix.html#205>`_ + + `Tposix_spawn_file_actions`:idx: + `posix.html#206 <posix.html#206>`_ + + `Tposix_typed_mem_info`:idx: + `posix.html#185 <posix.html#185>`_ + + `Tpthread`:idx: + `posix.html#170 <posix.html#170>`_ + + `Tpthread_attr`:idx: + `posix.html#158 <posix.html#158>`_ + + `Tpthread_barrier`:idx: + `posix.html#159 <posix.html#159>`_ + + `Tpthread_barrierattr`:idx: + `posix.html#160 <posix.html#160>`_ + + `Tpthread_cond`:idx: + `posix.html#161 <posix.html#161>`_ + + `Tpthread_condattr`:idx: + `posix.html#162 <posix.html#162>`_ + + `Tpthread_key`:idx: + `posix.html#163 <posix.html#163>`_ + + `Tpthread_mutex`:idx: + `posix.html#164 <posix.html#164>`_ + + `Tpthread_mutexattr`:idx: + `posix.html#165 <posix.html#165>`_ + + `Tpthread_once`:idx: + `posix.html#166 <posix.html#166>`_ + + `Tpthread_rwlock`:idx: + `posix.html#167 <posix.html#167>`_ + + `Tpthread_rwlockattr`:idx: + `posix.html#168 <posix.html#168>`_ + + `Tpthread_spinlock`:idx: + `posix.html#169 <posix.html#169>`_ + + `traced`:idx: + `manual.html#160 <manual.html#160>`_ + + `TResult`:idx: + `system.html#152 <system.html#152>`_ + + `truncate`:idx: + `posix.html#1037 <posix.html#1037>`_ + + `try`:idx: + `manual.html#187 <manual.html#187>`_ + + `Tsched_param`:idx: + `posix.html#199 <posix.html#199>`_ + + `TSem`:idx: + `posix.html#181 <posix.html#181>`_ + + `TSigaction`:idx: + `posix.html#193 <posix.html#193>`_ + + `Tsig_atomic`:idx: + `posix.html#189 <posix.html#189>`_ + + `TsigEvent`:idx: + `posix.html#191 <posix.html#191>`_ + + `TsigInfo`:idx: + `posix.html#196 <posix.html#196>`_ + + `Tsigset`:idx: + `posix.html#190 <posix.html#190>`_ + + `TSigStack`:idx: + `posix.html#195 <posix.html#195>`_ + + `TsigVal`:idx: + `posix.html#192 <posix.html#192>`_ + + `TSqlChar`:idx: + `odbcsql.html#101 <odbcsql.html#101>`_ + + `TSqlDouble`:idx: + `odbcsql.html#113 <odbcsql.html#113>`_ + + `TSqlFloat`:idx: + `odbcsql.html#114 <odbcsql.html#114>`_ + + `TSqlHandle`:idx: + `odbcsql.html#104 <odbcsql.html#104>`_ + + `TSqlHDBC`:idx: + `odbcsql.html#106 <odbcsql.html#106>`_ + + `TSqlHDesc`:idx: + `odbcsql.html#108 <odbcsql.html#108>`_ + + `TSqlHEnv`:idx: + `odbcsql.html#105 <odbcsql.html#105>`_ + + `TSqlHStmt`:idx: + `odbcsql.html#107 <odbcsql.html#107>`_ + + `TSqlHWND`:idx: + `odbcsql.html#115 <odbcsql.html#115>`_ + + `TSqlInteger`:idx: + `odbcsql.html#109 <odbcsql.html#109>`_ + + `TSqlPointer`:idx: + `odbcsql.html#111 <odbcsql.html#111>`_ + + `TSqlReal`:idx: + `odbcsql.html#112 <odbcsql.html#112>`_ + + `TSqlSmallInt`:idx: + `odbcsql.html#102 <odbcsql.html#102>`_ + + `TSqlUInteger`:idx: + `odbcsql.html#110 <odbcsql.html#110>`_ + + `TSqlUSmallInt`:idx: + `odbcsql.html#103 <odbcsql.html#103>`_ + + `TStack`:idx: + `posix.html#194 <posix.html#194>`_ + + `TStat`:idx: + `posix.html#183 <posix.html#183>`_ + + `TStatvfs`:idx: + `posix.html#184 <posix.html#184>`_ + + `TStream`:idx: + `streams.html#102 <streams.html#102>`_ + + `TStringStream`:idx: + `streams.html#116 <streams.html#116>`_ + + `TStringTable`:idx: + `strtabs.html#102 <strtabs.html#102>`_ + + `TStringTableMode`:idx: + `strtabs.html#101 <strtabs.html#101>`_ + + `Tsuseconds`:idx: + `posix.html#171 <posix.html#171>`_ + + `Ttime`:idx: + `posix.html#172 <posix.html#172>`_ + + `TTime`:idx: + `times.html#103 <times.html#103>`_ + + `TTimeInfo`:idx: + `times.html#104 <times.html#104>`_ + + `Ttimer`:idx: + `posix.html#173 <posix.html#173>`_ + + `Ttimespec`:idx: + `posix.html#187 <posix.html#187>`_ + + `Ttimeval`:idx: + `posix.html#200 <posix.html#200>`_ + + `Ttm`:idx: + `posix.html#186 <posix.html#186>`_ + + `Ttrace_attr`:idx: + `posix.html#174 <posix.html#174>`_ + + `Ttrace_event_id`:idx: + `posix.html#175 <posix.html#175>`_ + + `Ttrace_event_set`:idx: + `posix.html#176 <posix.html#176>`_ + + `Ttrace_id`:idx: + `posix.html#177 <posix.html#177>`_ + + `ttyname`:idx: + `posix.html#1038 <posix.html#1038>`_ + + `ttyname_r`:idx: + `posix.html#1039 <posix.html#1039>`_ + + `Tucontext`:idx: + `posix.html#203 <posix.html#203>`_ + + `Tuid`:idx: + `posix.html#178 <posix.html#178>`_ + + `tuple`:idx: + `manual.html#155 <manual.html#155>`_ + + `Tuseconds`:idx: + `posix.html#179 <posix.html#179>`_ + + `Tutsname`:idx: + `posix.html#180 <posix.html#180>`_ + + `TWeekDay`:idx: + `times.html#102 <times.html#102>`_ + + `type`:idx: + * `manual.html#102 <manual.html#102>`_ + * `manual.html#141 <manual.html#141>`_ + * `manual.html#208 <manual.html#208>`_ + + `type parameters`:idx: + `manual.html#210 <manual.html#210>`_ + + `type suffix`:idx: + `manual.html#138 <manual.html#138>`_ + + `TZipArchive`:idx: + `zipfiles.html#101 <zipfiles.html#101>`_ + + `Tzip_source_callback`:idx: + `libzip.html#102 <libzip.html#102>`_ + + `Tzip_source_cmd`:idx: + `libzip.html#101 <libzip.html#101>`_ + + `Tzip_stat`:idx: + `libzip.html#104 <libzip.html#104>`_ + + `tzset`:idx: + `posix.html#1118 <posix.html#1118>`_ + + `TZStream`:idx: + `zlib.html#112 <zlib.html#112>`_ + + `TZStreamRec`:idx: + `zlib.html#113 <zlib.html#113>`_ + + `ualarm`:idx: + `posix.html#1040 <posix.html#1040>`_ + + `Uint`:idx: + `zlib.html#101 <zlib.html#101>`_ + + `Ulong`:idx: + `zlib.html#102 <zlib.html#102>`_ + + `Ulongf`:idx: + `zlib.html#103 <zlib.html#103>`_ + + `umask`:idx: + `posix.html#1066 <posix.html#1066>`_ + + `uname`:idx: + `posix.html#866 <posix.html#866>`_ + + `unchecked runtime error`:idx: + `manual.html#111 <manual.html#111>`_ + + `uncompress`:idx: + `zlib.html#156 <zlib.html#156>`_ + + `undef`:idx: + `manual.html#225 <manual.html#225>`_ + + `UnixToNativePath`:idx: + `os.html#124 <os.html#124>`_ + + `unlink`:idx: + `posix.html#1041 <posix.html#1041>`_ + + `unsigned integer`:idx: + `manual.html#143 <manual.html#143>`_ + + `unsigned operations`:idx: + `manual.html#144 <manual.html#144>`_ + + `untraced`:idx: + `manual.html#161 <manual.html#161>`_ + + `usleep`:idx: + `posix.html#1042 <posix.html#1042>`_ + + `Var`:idx: + `manual.html#179 <manual.html#179>`_ + + `varargs`:idx: + `nimrodc.html#106 <nimrodc.html#106>`_ + + `variant`:idx: + `manual.html#157 <manual.html#157>`_ + + `vertical tabulator`:idx: + `manual.html#126 <manual.html#126>`_ + + `vfork`:idx: + `posix.html#1043 <posix.html#1043>`_ + + `volatile`:idx: + `nimrodc.html#112 <nimrodc.html#112>`_ + + `wait`:idx: + `posix.html#1119 <posix.html#1119>`_ + + `waitid`:idx: + `posix.html#1120 <posix.html#1120>`_ + + `waitpid`:idx: + `posix.html#1121 <posix.html#1121>`_ + + `walkDir`:idx: + `os.html#155 <os.html#155>`_ + + `walkFiles`:idx: + * `os.html#153 <os.html#153>`_ + * `zipfiles.html#110 <zipfiles.html#110>`_ + + `warning`:idx: + * `manual.html#222 <manual.html#222>`_ + * `manual.html#228 <manual.html#228>`_ + * `dialogs.html#103 <dialogs.html#103>`_ + + `WCONTINUED`:idx: + `posix.html#714 <posix.html#714>`_ + + `WEXITED`:idx: + `posix.html#712 <posix.html#712>`_ + + `WEXITSTATUS`:idx: + `posix.html#705 <posix.html#705>`_ + + `when`:idx: + `manual.html#183 <manual.html#183>`_ + + `while`:idx: + `manual.html#196 <manual.html#196>`_ + + `Whitespace`:idx: + `strutils.html#102 <strutils.html#102>`_ + + `WIFCONTINUED`:idx: + `posix.html#706 <posix.html#706>`_ + + `WIFEXITED`:idx: + `posix.html#707 <posix.html#707>`_ + + `WIFSIGNALED`:idx: + `posix.html#708 <posix.html#708>`_ + + `WIFSTOPPED`:idx: + `posix.html#709 <posix.html#709>`_ + + `WNOHANG`:idx: + `posix.html#703 <posix.html#703>`_ + + `WNOWAIT`:idx: + `posix.html#715 <posix.html#715>`_ + + `W_OK`:idx: + `posix.html#480 <posix.html#480>`_ + + `write`:idx: + * `system.html#489 <system.html#489>`_ + * `system.html#490 <system.html#490>`_ + * `system.html#491 <system.html#491>`_ + * `system.html#492 <system.html#492>`_ + * `system.html#493 <system.html#493>`_ + * `system.html#494 <system.html#494>`_ + * `system.html#495 <system.html#495>`_ + * `posix.html#1044 <posix.html#1044>`_ + * `streams.html#103 <streams.html#103>`_ + * `streams.html#104 <streams.html#104>`_ + + `writeBuffer`:idx: + `system.html#505 <system.html#505>`_ + + `writeBytes`:idx: + `system.html#503 <system.html#503>`_ + + `writeChars`:idx: + `system.html#504 <system.html#504>`_ + + `writeln`:idx: + * `system.html#497 <system.html#497>`_ + * `system.html#498 <system.html#498>`_ + + `WSTOPPED`:idx: + `posix.html#713 <posix.html#713>`_ + + `WSTOPSIG`:idx: + `posix.html#710 <posix.html#710>`_ + + `WTERMSIG`:idx: + `posix.html#711 <posix.html#711>`_ + + `WUNTRACED`:idx: + `posix.html#704 <posix.html#704>`_ + + `X_OK`:idx: + `posix.html#481 <posix.html#481>`_ + + `xor`:idx: + * `system.html#238 <system.html#238>`_ + * `system.html#239 <system.html#239>`_ + * `system.html#240 <system.html#240>`_ + * `system.html#241 <system.html#241>`_ + * `system.html#242 <system.html#242>`_ + * `system.html#322 <system.html#322>`_ + + `YESEXPR`:idx: + `posix.html#441 <posix.html#441>`_ + + `yield`:idx: + `manual.html#193 <manual.html#193>`_ + + `Z_ASCII`:idx: + `zlib.html#138 <zlib.html#138>`_ + + `Z_BEST_COMPRESSION`:idx: + `zlib.html#132 <zlib.html#132>`_ + + `Z_BEST_SPEED`:idx: + `zlib.html#131 <zlib.html#131>`_ + + `Z_BINARY`:idx: + `zlib.html#137 <zlib.html#137>`_ + + `Z_BUF_ERROR`:idx: + `zlib.html#128 <zlib.html#128>`_ + + `Z_DATA_ERROR`:idx: + `zlib.html#126 <zlib.html#126>`_ + + `Z_DEFAULT_COMPRESSION`:idx: + `zlib.html#133 <zlib.html#133>`_ + + `Z_DEFAULT_STRATEGY`:idx: + `zlib.html#136 <zlib.html#136>`_ + + `Z_DEFLATED`:idx: + `zlib.html#140 <zlib.html#140>`_ + + `ze`:idx: + * `system.html#169 <system.html#169>`_ + * `system.html#170 <system.html#170>`_ + + `ze64`:idx: + * `system.html#171 <system.html#171>`_ + * `system.html#172 <system.html#172>`_ + * `system.html#173 <system.html#173>`_ + * `system.html#174 <system.html#174>`_ + + `zeroMem`:idx: + `system.html#407 <system.html#407>`_ + + `Z_ERRNO`:idx: + `zlib.html#124 <zlib.html#124>`_ + + `zError`:idx: + `zlib.html#184 <zlib.html#184>`_ + + `Z_FILTERED`:idx: + `zlib.html#134 <zlib.html#134>`_ + + `Z_FINISH`:idx: + `zlib.html#120 <zlib.html#120>`_ + + `Z_FULL_FLUSH`:idx: + `zlib.html#119 <zlib.html#119>`_ + + `Z_HUFFMAN_ONLY`:idx: + `zlib.html#135 <zlib.html#135>`_ + + `zip_add`:idx: + `libzip.html#170 <libzip.html#170>`_ + + `zip_add_dir`:idx: + `libzip.html#171 <libzip.html#171>`_ + + `ZIP_AFL_TORRENT`:idx: + `libzip.html#116 <libzip.html#116>`_ + + `ZIP_CHECKCONS`:idx: + `libzip.html#110 <libzip.html#110>`_ + + `zip_close`:idx: + `libzip.html#172 <libzip.html#172>`_ + + `ZIP_CM_BZIP2`:idx: + `libzip.html#155 <libzip.html#155>`_ + + `ZIP_CM_DEFAULT`:idx: + `libzip.html#144 <libzip.html#144>`_ + + `ZIP_CM_DEFLATE`:idx: + `libzip.html#152 <libzip.html#152>`_ + + `ZIP_CM_DEFLATE64`:idx: + `libzip.html#153 <libzip.html#153>`_ + + `ZIP_CM_IMPLODE`:idx: + `libzip.html#151 <libzip.html#151>`_ + + `ZIP_CM_LZ77`:idx: + `libzip.html#158 <libzip.html#158>`_ + + `ZIP_CM_LZMA`:idx: + `libzip.html#156 <libzip.html#156>`_ + + `ZIP_CM_PKWARE_IMPLODE`:idx: + `libzip.html#154 <libzip.html#154>`_ + + `ZIP_CM_PPMD`:idx: + `libzip.html#160 <libzip.html#160>`_ + + `ZIP_CM_REDUCE_1`:idx: + `libzip.html#147 <libzip.html#147>`_ + + `ZIP_CM_REDUCE_2`:idx: + `libzip.html#148 <libzip.html#148>`_ + + `ZIP_CM_REDUCE_3`:idx: + `libzip.html#149 <libzip.html#149>`_ + + `ZIP_CM_REDUCE_4`:idx: + `libzip.html#150 <libzip.html#150>`_ + + `ZIP_CM_SHRINK`:idx: + `libzip.html#146 <libzip.html#146>`_ + + `ZIP_CM_STORE`:idx: + `libzip.html#145 <libzip.html#145>`_ + + `ZIP_CM_TERSE`:idx: + `libzip.html#157 <libzip.html#157>`_ + + `ZIP_CM_WAVPACK`:idx: + `libzip.html#159 <libzip.html#159>`_ + + `ZIP_CREATE`:idx: + `libzip.html#108 <libzip.html#108>`_ + + `zip_delete`:idx: + `libzip.html#173 <libzip.html#173>`_ + + `ZIP_EM_NONE`:idx: + `libzip.html#161 <libzip.html#161>`_ + + `ZIP_EM_TRAD_PKWARE`:idx: + `libzip.html#162 <libzip.html#162>`_ + + `ZIP_EM_UNKNOWN`:idx: + `libzip.html#163 <libzip.html#163>`_ + + `ZIP_ER_CHANGED`:idx: + `libzip.html#132 <libzip.html#132>`_ + + `ZIP_ER_CLOSE`:idx: + `libzip.html#120 <libzip.html#120>`_ + + `ZIP_ER_COMPNOTSUPP`:idx: + `libzip.html#133 <libzip.html#133>`_ + + `ZIP_ER_CRC`:idx: + `libzip.html#124 <libzip.html#124>`_ + + `ZIP_ER_DELETED`:idx: + `libzip.html#140 <libzip.html#140>`_ + + `ZIP_ER_EOF`:idx: + `libzip.html#134 <libzip.html#134>`_ + + `ZIP_ER_EXISTS`:idx: + `libzip.html#127 <libzip.html#127>`_ + + `ZIP_ER_INCONS`:idx: + `libzip.html#138 <libzip.html#138>`_ + + `ZIP_ER_INTERNAL`:idx: + `libzip.html#137 <libzip.html#137>`_ + + `ZIP_ER_INVAL`:idx: + `libzip.html#135 <libzip.html#135>`_ + + `ZIP_ER_MEMORY`:idx: + `libzip.html#131 <libzip.html#131>`_ + + `ZIP_ER_MULTIDISK`:idx: + `libzip.html#118 <libzip.html#118>`_ + + `ZIP_ER_NOENT`:idx: + `libzip.html#126 <libzip.html#126>`_ + + `ZIP_ER_NOZIP`:idx: + `libzip.html#136 <libzip.html#136>`_ + + `ZIP_ER_OK`:idx: + `libzip.html#117 <libzip.html#117>`_ + + `ZIP_ER_OPEN`:idx: + `libzip.html#128 <libzip.html#128>`_ + + `ZIP_ER_READ`:idx: + `libzip.html#122 <libzip.html#122>`_ + + `ZIP_ER_REMOVE`:idx: + `libzip.html#139 <libzip.html#139>`_ + + `ZIP_ER_RENAME`:idx: + `libzip.html#119 <libzip.html#119>`_ + + `zip_error_clear`:idx: + `libzip.html#174 <libzip.html#174>`_ + + `zip_error_get`:idx: + `libzip.html#175 <libzip.html#175>`_ + + `zip_error_get_sys_type`:idx: + `libzip.html#176 <libzip.html#176>`_ + + `zip_error_to_str`:idx: + `libzip.html#177 <libzip.html#177>`_ + + `ZIP_ER_SEEK`:idx: + `libzip.html#121 <libzip.html#121>`_ + + `ZIP_ER_TMPOPEN`:idx: + `libzip.html#129 <libzip.html#129>`_ + + `ZIP_ER_WRITE`:idx: + `libzip.html#123 <libzip.html#123>`_ + + `ZIP_ER_ZIPCLOSED`:idx: + `libzip.html#125 <libzip.html#125>`_ + + `ZIP_ER_ZLIB`:idx: + `libzip.html#130 <libzip.html#130>`_ + + `ZIP_ET_NONE`:idx: + `libzip.html#141 <libzip.html#141>`_ + + `ZIP_ET_SYS`:idx: + `libzip.html#142 <libzip.html#142>`_ + + `ZIP_ET_ZLIB`:idx: + `libzip.html#143 <libzip.html#143>`_ + + `ZIP_EXCL`:idx: + `libzip.html#109 <libzip.html#109>`_ + + `zip_fclose`:idx: + `libzip.html#178 <libzip.html#178>`_ + + `zip_file_error_clear`:idx: + `libzip.html#179 <libzip.html#179>`_ + + `zip_file_error_get`:idx: + `libzip.html#180 <libzip.html#180>`_ + + `zip_file_strerror`:idx: + `libzip.html#181 <libzip.html#181>`_ + + `ZIP_FL_COMPRESSED`:idx: + `libzip.html#113 <libzip.html#113>`_ + + `ZIP_FL_NOCASE`:idx: + `libzip.html#111 <libzip.html#111>`_ + + `ZIP_FL_NODIR`:idx: + `libzip.html#112 <libzip.html#112>`_ + + `ZIP_FL_RECOMPRESS`:idx: + `libzip.html#115 <libzip.html#115>`_ + + `ZIP_FL_UNCHANGED`:idx: + `libzip.html#114 <libzip.html#114>`_ + + `zip_fopen`:idx: + `libzip.html#182 <libzip.html#182>`_ + + `zip_fopen_index`:idx: + `libzip.html#183 <libzip.html#183>`_ + + `zip_fread`:idx: + `libzip.html#184 <libzip.html#184>`_ + + `zip_get_archive_comment`:idx: + `libzip.html#185 <libzip.html#185>`_ + + `zip_get_archive_flag`:idx: + `libzip.html#186 <libzip.html#186>`_ + + `zip_get_file_comment`:idx: + `libzip.html#187 <libzip.html#187>`_ + + `zip_get_name`:idx: + `libzip.html#188 <libzip.html#188>`_ + + `zip_get_num_files`:idx: + `libzip.html#189 <libzip.html#189>`_ + + `zip_name_locate`:idx: + `libzip.html#190 <libzip.html#190>`_ + + `zip_open`:idx: + `libzip.html#191 <libzip.html#191>`_ + + `zip_rename`:idx: + `libzip.html#192 <libzip.html#192>`_ + + `zip_replace`:idx: + `libzip.html#193 <libzip.html#193>`_ + + `zip_set_archive_comment`:idx: + `libzip.html#194 <libzip.html#194>`_ + + `zip_set_archive_flag`:idx: + `libzip.html#195 <libzip.html#195>`_ + + `zip_set_file_comment`:idx: + `libzip.html#196 <libzip.html#196>`_ + + `zip_source_buffer`:idx: + `libzip.html#197 <libzip.html#197>`_ + + `ZIP_SOURCE_CLOSE`:idx: + `libzip.html#166 <libzip.html#166>`_ + + `ZIP_SOURCE_ERROR`:idx: + `libzip.html#168 <libzip.html#168>`_ + + `zip_source_file`:idx: + `libzip.html#198 <libzip.html#198>`_ + + `zip_source_filep`:idx: + `libzip.html#199 <libzip.html#199>`_ + + `zip_source_free`:idx: + `libzip.html#200 <libzip.html#200>`_ + + `zip_source_function`:idx: + `libzip.html#201 <libzip.html#201>`_ + + `ZIP_SOURCE_OPEN`:idx: + `libzip.html#164 <libzip.html#164>`_ + + `ZIP_SOURCE_READ`:idx: + `libzip.html#165 <libzip.html#165>`_ + + `ZIP_SOURCE_STAT`:idx: + `libzip.html#167 <libzip.html#167>`_ + + `zip_source_zip`:idx: + `libzip.html#202 <libzip.html#202>`_ + + `zip_stat`:idx: + `libzip.html#203 <libzip.html#203>`_ + + `zip_stat_index`:idx: + `libzip.html#204 <libzip.html#204>`_ + + `zip_stat_init`:idx: + `libzip.html#205 <libzip.html#205>`_ + + `zip_strerror`:idx: + `libzip.html#206 <libzip.html#206>`_ + + `zip_unchange`:idx: + `libzip.html#207 <libzip.html#207>`_ + + `zip_unchange_all`:idx: + `libzip.html#208 <libzip.html#208>`_ + + `zip_unchange_archive`:idx: + `libzip.html#209 <libzip.html#209>`_ + + `zlibAllocMem`:idx: + `zlib.html#187 <zlib.html#187>`_ + + `zlibFreeMem`:idx: + `zlib.html#188 <zlib.html#188>`_ + + `zlibVersion`:idx: + `zlib.html#142 <zlib.html#142>`_ + + `Z_MEM_ERROR`:idx: + `zlib.html#127 <zlib.html#127>`_ + + `Z_NEED_DICT`:idx: + `zlib.html#123 <zlib.html#123>`_ + + `Z_NO_COMPRESSION`:idx: + `zlib.html#130 <zlib.html#130>`_ + + `Z_NO_FLUSH`:idx: + `zlib.html#116 <zlib.html#116>`_ + + `Z_NULL`:idx: + `zlib.html#141 <zlib.html#141>`_ + + `z_off_t`:idx: + `zlib.html#105 <zlib.html#105>`_ + + `Z_OK`:idx: + `zlib.html#121 <zlib.html#121>`_ + + `Z_PARTIAL_FLUSH`:idx: + `zlib.html#117 <zlib.html#117>`_ + + `Z_STREAM_END`:idx: + `zlib.html#122 <zlib.html#122>`_ + + `Z_STREAM_ERROR`:idx: + `zlib.html#125 <zlib.html#125>`_ + + `Z_SYNC_FLUSH`:idx: + `zlib.html#118 <zlib.html#118>`_ + + `Z_UNKNOWN`:idx: + `zlib.html#139 <zlib.html#139>`_ + + `Z_VERSION_ERROR`:idx: + `zlib.html#129 <zlib.html#129>`_ \ No newline at end of file diff --git a/ide/main.nim b/ide/main.nim index 0e985c985..22ab88d67 100644 --- a/ide/main.nim +++ b/ide/main.nim @@ -1,5 +1,7 @@ +# The beginning of an IDE for Nimrod +# (c) 2008 Andreas Rumpf -import glib2, gtk2, libglade2, dialogs +import glib2, gtk2, libglade2, dialogs, parseopt proc on_window_destroy(obj: PGtkObject, data: pointer) {.cdecl.} = gtk_main_quit() diff --git a/install.txt b/install.txt index 2b1422107..60d52e228 100644 --- a/install.txt +++ b/install.txt @@ -9,18 +9,19 @@ Note: A C compiler is required - knowledge of C is not! The GNU C Compiler is fully supported, other compilers may work. The C compiler -should be in your ``$PATH`` (most likely the case). Note that some Linux +should be in your ``$PATH`` (most likely the case). Note that some few Linux distributions do not ship with a GCC compiler preinstalled - then you have to install it. -After you have made sure that a C compiler is available, install Nimrod -by downloading the appropriate ``.zip`` file and extracting it to a -directory of your choice. The Nimrod Compiler will stay in this -directory; do not use a temporary one! Good choices are ``/opt/nimrod`` or - -if you don't have root access - ``~/programs/nimrod``. +Install Nimrod by downloading the appropriate ``.zip`` file and extracting it +to a directory of your choice. The Nimrod Compiler will stay in this +directory (unless you copy it somewhere else). The compiler does not need +write access to its directory anymore, so copying the nimrod folder to ``/opt`` +does work. + Then run the following command:: - python koch.py install + sh build.sh Unlike other software, Nimrod does not distribute its files over the whole file hierarchy. This has the advantage that you can deinstall it by just deleting @@ -39,48 +40,26 @@ need to install Apple's developer's tools for the GNU Compiler Collection though. -Installation on Windows - the easy way --------------------------------------- +Installation on Windows +----------------------- Install Nimrod by downloading and running -the ``nimrod_windows_$version.exe`` file. The installation procedure detects -which C compilers are installed and writes the ``config/nimrod.cfg`` file -for you. If no installed C compiler is found, the ``LLVM-GCC`` compiler is -used that is bundled with this installer. So it should just work. - +the ``nimrod_$version.exe`` file. As default, the ``LLVM-GCC`` +compiler is used that is bundled with this installer. You can change +the configuration file to use another C compiler. -Installation on Windows - the hard way --------------------------------------- - -Windows does not ship with a C compiler; you have to install one. The -following C compilers are supported under Windows: +Currently, the following C compilers are supported under Windows: - | Microsoft's Visual C++ | http://msdn.microsoft.com/visualc - | (You may need the SDK too - but not the full one: Essential are only + | (You need the SDK too - but not the full one: Essential are only the win32api header files and import libraries.) -- | Borland C++ (5.5 or above; including Borland C++Builder) - | http://www.borland.com/downloads/download_cbuilder.html - | (Download the package under "compiler" - this requires registration though.) - | Gnu C Compiler (the mingw version; the cygwin version has not been tested!) | http://www.mingw.org/download.shtml - | LLVM with GNU C/C++ frontend | http://llvm.org/releases/download.html#2.2 - | Digital Mars C++ | http://www.digitalmars.com/download/freecompiler.html -- | Pelles C Compiler (bootstrapping does not work with PCC!) - | http://www.smorgasbordet.com/pellesc -- | Lcc-win32 (bootstrapping does not work with LCC!) - | http://www.cs.virginia.edu/~lcc-win32 - -All of the above compilers are available for free! -(The first three are the easiest to install.) If you want a small download, -choose Digital Mars C++ -- it is easy to install and only about 3 MB. -If you want the highest possible performance, go for Microsoft's Visual C++ or -LLVM. - -After you have made sure that a C compiler is available, install -Nimrod by downloading the appropriate .zip file and extracting it to a -directory of your choice. The Nimrod Compiler will stay in this -directory; do not use a temporary one! Then adapt the ``config/nimrod.cfg`` -file appropriately. You should add Nimrod to your ``$PATH``. + +For faster compile times I recommend Digital Mars C++ -- it is easy to install +and a small package. diff --git a/koch.py b/koch.py index 5dc380e82..d8d42a02b 100644 --- a/koch.py +++ b/koch.py @@ -7,20 +7,18 @@ ## ## ########################################################################## -import os, os.path, sys, re, zipfile, shutil, cPickle, time -import string, getopt, textwrap, glob, shutil, getopt, string, stat +import os, os.path, sys, re, shutil, cPickle, time, getopt, glob, zlib +from string import split, replace, lower, join, find, strip +if sys.version[0] >= "3": # this script does not work with Python 3.0 + sys.exit("wrong python version: use Python 1.5.2 - 2.6") -if sys.version_info[0] >= 3: # this script does not work with Python 3.0 - sys.exit("wrong python version: use Python 2.x") - -from kochmod import * +True = 0 == 0 # Python 1.5 does not have True and False :-( +False = 0 == 1 # --------------------- constants ---------------------------------------- -CC_FLAGS = "-w" # modify to set flags to the first compilation step - -NIMROD_VERSION = '0.6.0' +NIMROD_VERSION = '0.7.0' # This string contains Nimrod's version. It is the only place # where the version needs to be updated. The rest is done by # the build process automatically. It is replaced **everywhere** @@ -32,26 +30,6 @@ NIMROD_VERSION = '0.6.0' # backwards-compatible) # Patch level: is increased for every patch -SUPPORTED_OSES = "linux macosx windows solaris".split() -# The list of supported operating systems -SUPPORTED_CPUS = "i386 amd64 sparc".split() -# The list of supported CPUs - -SUPPORTED_PLATTFORMS = """ -linux_i386* linux_amd64* linux_sparc -macosx_i386* macosx_amd64 -solaris_i386 solaris_amd64 solaris_sparc -windows_i386* windows_amd64 -""".split() -# a star marks the tested ones - -NICE_NAMES = { - "linux": "Linux", - "macosx": "Mac OS X", - "windows": "Windows", - "solaris": "Solaris", -} - EXPLAIN = True force = False @@ -61,44 +39,309 @@ GENERATE_DIFF = False # on underpowered systems. USE_FPC = True -INNOSETUP = r"c:\programme\innosetup5\iscc.exe /Q " -PYINSTALLER = r"C:\Eigenes\DownLoad\Python\pyinstaller-1.3" + +BOOTCMD = "%s cc --compile:build/platdef.c %s rod/nimrod.nim" +# the command used for bootstrapping # -------------------------------------------------------------------------- -DOC = """endb intern lib manual nimrodc steps - overview""".split() -SRCDOC = """system os strutils base/regexprs math complex times +DOC = split("""endb intern lib manual nimrodc steps overview""") +SRCDOC = split("""system os strutils base/regexprs math complex times parseopt hashes strtabs lexbase parsecfg base/dialogs posix/posix - """.split() + streams base/odbcsql + base/zip/zipfiles base/zip/zlib base/zip/libzip + """) -ADD_SRCDOC = """windows/windows windows/mmsystem windows/nb30 - windows/ole2 windows/shellapi windows/shfolder +ADD_SRCDOC = split(""" base/cairo/cairo base/cairo/cairoft base/cairo/cairowin32 base/cairo/cairoxlib base/gtk/atk base/gtk/gdk2 base/gtk/gdk2pixbuf base/gtk/gdkglext base/gtk/glib2 base/gtk/gtk2 base/gtk/gtkglext base/gtk/gtkhtml base/gtk/libglade2 base/gtk/pango base/gtk/pangoutils - """.split() + windows/windows windows/mmsystem windows/nb30 + windows/ole2 windows/shellapi windows/shfolder + base/x11/*.nim + base/opengl/*.nim + base/sdl/*.nim + base/lua/*.nim + """) # -------------------------------------------------------------------------- -def ask(): - return sys.stdin.readline().strip("\t \n\r\f").lower() +def Error(msg): sys.exit("[Koch] *** ERROR: " + msg) +def Warn(msg): print "[Koch] *** WARNING: " + msg +def Echo(msg): print "[Koch] " + msg +def _Info(msg): print "[Koch] " + msg + +_FINGERPRINTS_FILE = "koch.dat" + # in this file all the fingerprints are kept to allow recognizing when a file + # has changed. This works reliably, which cannot be said from just taking + # filetime-stamps. + +def FileCmp(filenameA, filenameB): + SIZE = 4096*2 + result = True + a = open(filenameA, "rb") + b = open(filenameB, "rb") + while True: + x = a.read(SIZE) + y = b.read(SIZE) + if x != y: + result = False + break + elif len(x) < SIZE: # EOF? + break + a.close() + b.close() + return result + +def Subs(frmt, **substitution): + import string + chars = string.digits+string.letters+"_" + d = substitution + result = [] + i = 0 + while i < len(frmt): + if frmt[i] == '$': + i = i+1 + if frmt[i] == '$': + result.append('$') + i = i+1 + elif frmt[i] == '{': + i = i+1 + j = i + while frmt[i] != '}': i = i+1 + i = i+1 # skip } + result.append(d[frmt[j:i-1]]) + elif frmt[i] in string.letters+"_": + j = i + i = i+1 + while i < len(frmt) and frmt[i] in chars: i = i + 1 + result.append(d[frmt[j:i]]) + else: + assert(false) + else: + result.append(frmt[i]) + i = i+1 + return join(result, "") + +def SplitArg(s): + if ':' in s: c = ':' + elif '=' in s: c = '=' + else: return (s, '') + i = s.find(c) + return (s[:i], s[i+1:]) + +_baseDir = os.getcwd() +BaseDir = _baseDir + +def Path(a): + # Gets a UNIX like path and converts it to a path on this platform. + # With UNIX like, I mean: slashes, not backslashes, only relative + # paths ('../etc' can be used) + result = a + if os.sep != "/": result = replace(result, "/", os.sep) + if os.pardir != "..": result = replace(result, "..", os.pardir) + return result + +def Join(*args): + result = [] + for a in args[:-1]: + result.append(a) + if result[-1] != "/": result.append("/") + result.append(args[-1]) + return replace(join(result, ""), "//", "/") + +def Exec(command): + c = Path(command) + Echo(c) + result = os.system(c) + if result != 0: Error("execution of an external program failed") + return result + +def TryExec(command): + c = Path(command) + Echo(c) + result = os.system(c) + return result + +def RawExec(command): + Echo(command) + result = os.system(command) + if result != 0: Error("execution of an external program failed") + return result + +def Remove(f): + try: + os.remove(Path(f)) + except OSError: + Warn("could not remove: %s" % f) + +def Move(src, dest): + try: + m = shutil.move + except AttributeError: + def f(src, dest): + shutil.copy(src, dest) + Remove(src) + m = f + s = Path(src) + d = Path(dest) + try: + m(s, d) + except IOError, OSError: + Warn("could not move %s to %s" % (s, d)) + +def Copy(src, dest): + s = Path(src) + d = Path(dest) + try: + shutil.copyfile(s, d) + except IOError, OSError: + Warn("could not copy %s to %s" % (s, d)) + +def RemoveDir(f): + try: + shutil.rmtree(Path(f)) + except OSError: + Warn("could not remove: %s" % f) + +def Exists(f): return os.path.exists(Path(f)) + +def Chdir(dest): + d = Path(dest) + try: + os.chdir(d) + except OSError: + Warn("could not switch to directory: " + d) + +def Mkdir(dest): + d = Path(dest) + try: + os.mkdir(d) + except OSError: + Warn("could not create directory: " + d) + +def Glob(pattern): # needed because glob.glob() is buggy on Windows 95: + # things like tests/t*.mor won't work + global _baseDir + (head, tail) = os.path.split(Path(pattern)) + result = [] + try: + os.chdir(os.path.join(_baseDir, head)) + try: + for f in glob.glob(tail): result.append(os.path.join(head, f)) + except OSError: + result = [] + finally: + os.chdir(_baseDir) + return result + +def FilenameNoExt(f): + return os.path.splitext(os.path.basename(f))[0] + +def _Ext(trunc, posixFormat, winFormat): + (head, tail) = os.path.split(Path(trunc)) + if os.name == "posix": frmt = posixFormat + else: frmt = winFormat + return os.path.join(head, Subs(frmt, trunc=tail)) + +def DynExt(trunc): + return _Ext(trunc, 'lib${trunc}.so', '${trunc}.dll') + +def LibExt(trunc): + return _Ext(trunc, '${trunc}.a', '${trunc}.lib') + +def ScriptExt(trunc): + return _Ext(trunc, '${trunc}.sh', '${trunc}.bat') + +def ExeExt(trunc): + return _Ext(trunc, '${trunc}', '${trunc}.exe') + +def MakeExecutable(file): + os.chmod(file, 493) + +class Changed: + """ Returns a Changed object. This object evals to true if one of the + given files has changed, false otherwise in a boolean context. You have + to call the object's success() method if the building has been a success. + + Example: + + c = Changed("unique_name", "file1.pas file2.pas file3.pas") + if c.check(): + Exec("fpc file1.pas") + # Exec raises an exception if it fails, thus if we get to here, it was + # a success: + c.success() + """ + def __init__(self, id, files, explain=False, + fingerprintsfile=_FINGERPRINTS_FILE): + # load the fingerprints file: + # fingerprints is a dict[target, files] where files is a dict[filename, hash] + self.fingers = {} # default value + if Exists(fingerprintsfile): + try: + self.fingers = cPickle.load(open(fingerprintsfile)) + except OSError: + Error("Cannot read from " + fingerprintsfile) + self.filename = fingerprintsfile + self.id = id + self.files = files + self._hashStr = zlib.adler32 # our hash function + self.explain = explain + + def _hashFile(self, f): + x = open(f) + result = self._hashStr(x.read()) + x.close() # for other Python implementations + return result + + def check(self): + if type(self.files) == type(""): + self.files = split(self.files) + result = False + target = self.id + if not self.fingers.has_key(target): + self.fingers[target] = {} + if self.explain: _Info("no entries for target '%s'" % target) + result = True + for d in self.files: + if Exists(d): + n = self._hashFile(d) + if not self.fingers[target].has_key(d) or n != self.fingers[target][d]: + result = True + if self.explain: _Info("'%s' modified since last build" % d) + self.fingers[target][d] = n + else: + Warn("'%s' does not exist!" % d) + result = True + return result + + def update(self, filename): + self.fingers[self.id][filename] = self._hashFile(filename) + + def success(self): + cPickle.dump(self.fingers, open(self.filename, "w+")) + + +# -------------------------------------------------------------------------- def CogRule(name, filename, dependson): - def processCog(): + def processCog(filename): from cogapp import Cog ret = Cog().main([sys.argv[0], "-r", Path(filename)]) return ret c = Changed(name, filename + " " + dependson, EXPLAIN) - if c or force: - if processCog() == 0: + if c.check() or force: + if processCog(filename) == 0: c.update(filename) c.success() + else: + Error("Cog failed") _nim_exe = os.path.join(os.getcwd(), "bin", ExeExt("nim")) _output_obj = os.path.join(os.getcwd(), "obj") @@ -118,10 +361,10 @@ def cmd_nim(): CogRule("paslex", "nim/paslex.pas", "data/pas_keyw.yml") CogRule("wordrecg", "nim/wordrecg.pas", "data/keywords.txt") CogRule("commands", "nim/commands.pas", - "data/basicopt.txt data/advopt.txt data/changes.txt") + "data/basicopt.txt data/advopt.txt") CogRule("macros", "lib/macros.nim", "koch.py data/ast.yml") c = Changed("nim", Glob("nim/*.pas"), EXPLAIN) - if c or force: + if c.check() or force: Exec(FPC_CMD) if Exists(ExeExt("bin/nim")): c.success() @@ -133,7 +376,7 @@ def cmd_rod(options): "lib/nimbase.h", "lib/dlmalloc.c", "lib/dlmalloc.h", "config/nimrod.cfg"] c = Changed("rod", prereqs, EXPLAIN) - if cmd_nim() or c or force: + if c.check() or cmd_nim() or force: buildRod(options) if Exists(ExeExt("bin/nimrod")): c.success() @@ -146,37 +389,32 @@ HELP = """\ | Version %s| | (c) 2008 Andreas Rumpf | +-----------------------------------------------------------------+ +Your Python version: %s Usage: koch.py [options] command [options for command] Options: --force, -f, -B, -b forces rebuild --diff generates a diff.log file when bootstrapping - --no_fpc bootstrap without FPC --help, -h shows this help and quits + --no_fpc bootstrap without FPC Possible Commands: - install [options] installs the Nimrod Compiler: options - are --cc=<compile command>, --ld=<link command> nim builds the Pascal version of Nimrod rod [options] builds the Nimrod version of Nimrod (with options) - installer builds the installer (needs Inno Setup 5 on Windows) - configure configures the environment for developing Nimrod doc builds the documentation in HTML clean cleans Nimrod project; removes generated files - dist [os] [cpu] produces a distribution as nimrod_$os_$cpu.zip - alldist produces all sensible download packages boot [options] bootstraps with given command line options rodsrc generates Nimrod version from Pascal version web generates the website (requires Cheetah) - tests [options] run the testsuite (with options) -""" % (NIMROD_VERSION + ' ' * (44-len(NIMROD_VERSION))) + profile profile the Nimrod compiler +""" % (NIMROD_VERSION + ' ' * (44-len(NIMROD_VERSION)), sys.version) def main(args): if len(args) == 0: print HELP else: i = 0 - while args[i].startswith("-"): + while args[i][:1] == "-": a = args[i] if a in ("--force", "-f", "-B", "-b"): global force @@ -192,28 +430,16 @@ def main(args): USE_FPC = False else: Error("illegal option: " + a) - i += 1 + i = i + 1 cmd = args[i] - if cmd == "rod": cmd_rod(" ".join(args[i+1:])) + if cmd == "rod": cmd_rod(join(args[i+1:])) elif cmd == "nim": cmd_nim() - elif cmd == "installer": cmd_installer() - elif cmd == "configure": cmd_configure() elif cmd == "doc": cmd_doc() elif cmd == "clean": cmd_clean() - elif cmd == "dist": - if i < len(args)-2: - cmd_dist(args[i+1], args[i+2]) - elif i < len(args)-1: - cmd_dist(args[i+1]) - else: - cmd_dist() - elif cmd == "alldist": cmd_alldist() - elif cmd == "boot": cmd_boot(" ".join(args[i+1:])) - #elif cmd == "tests": cmd_tests(" ".join(args[i+1:])) - elif cmd == "install": cmd_install(args[i+1:]) + elif cmd == "boot": cmd_boot(join(args[i+1:])) elif cmd == "rodsrc": cmd_rodsrc() elif cmd == "web": cmd_web() - elif cmd == "tests": cmd_tests(" ".join(args[i+1:])) + elif cmd == "profile": cmd_profile() else: Error("illegal command: " + cmd) # -------------------------- bootstrap ---------------------------------------- @@ -221,15 +447,15 @@ def main(args): def readCFiles(): result = {} if GENERATE_DIFF: - for f in Glob("rod/rod_gen/*.c") + Glob("lib/rod_gen/*.c"): + for f in Glob("rod/nimcache/rod/*.c") + Glob("rod/nimcache/lib/*.c"): x = os.path.split(f)[1] - result[x] = file(f).readlines()[1:] + result[x] = open(f).readlines()[1:] return result def genBootDiff(genA, genB): def interestingDiff(a, b): - a = re.sub(r"([a-zA-Z_]+)([0-9]+)", r"\1____", a) - b = re.sub(r"([a-zA-Z_]+)([0-9]+)", r"\1____", b) + #a = re.sub(r"([a-zA-Z_]+)([0-9]+)", r"\1____", a) + #b = re.sub(r"([a-zA-Z_]+)([0-9]+)", r"\1____", b) return a != b BOOTLOG = "bootdiff.log" @@ -241,9 +467,6 @@ def genBootDiff(genA, genB): if len(genA) != len(genB): Warn("number of generated files differ!") for filename, acontent in genA.iteritems(): bcontent = genB[filename] - #g = difflib.unified_diff(acontent, bcontent, filename + " generation A", - # filename + " generation B", lineterm='') - #for d in g: lines.append(d) if bcontent != acontent: lines.append("------------------------------------------------------") lines.append(filename + " differs") @@ -262,15 +485,15 @@ def genBootDiff(genA, genB): marker = "+" for i in range(min(len(acontent), len(bcontent)), len(cont)): lines.append("%6d %s %s" % (i, marker, cont[i])) - file(os.path.join("diff", "a_"+filename), "w+").write("".join(acontent)) - file(os.path.join("diff", "b_"+filename), "w+").write("".join(bcontent)) + open(os.path.join("diff", "a_"+filename), "w+").write(join(acontent, "")) + open(os.path.join("diff", "b_"+filename), "w+").write(join(bcontent, "")) if lines: result = True - file(BOOTLOG, "w+").write("\n".join(lines)) + open(BOOTLOG, "w+").write(join(lines, "\n")) return result def cmd_rodsrc(): "converts the src/*.pas files into Nimrod syntax" - PAS_FILES_BLACKLIST = """nsystem nmath nos ntime strutils""".split() + PAS_FILES_BLACKLIST = split("""nsystem nmath nos ntime strutils""") if USE_FPC and detect("fpc -h"): cmd_nim() compiler = "nim" @@ -282,19 +505,23 @@ def cmd_rodsrc(): f = FilenameNoExt(fi) if f in PAS_FILES_BLACKLIST: continue c = Changed(f+"__rodsrc", fi, EXPLAIN) - if c or force: + if c.check() or force: Exec(CMD % (compiler, f, f+".pas")) Exec("%s parse rod/%s.nim" % (compiler, f)) c.success() result = True return result +def moveExes(): + Move(ExeExt("rod/nimrod"), ExeExt("bin/nimrod")) + def cmd_boot(args): - def moveExes(): - if Exists(ExeExt("rod/nimrod")): - Move(ExeExt("rod/nimrod"), ExeExt("bin/nimrod")) - else: - Move(ExeExt("rod/rod_gen/nimrod"), ExeExt("bin/nimrod")) + def myExec(compiler, args=args): + Exec(BOOTCMD % (compiler, args)) + # some C compilers (PellesC) output the executable to the + # wrong directory. We work around this bug here: + if Exists(ExeExt("rod/nimcache/nimrod")): + Move(ExeExt("rod/nimcache/nimrod"), ExeExt("rod/nimrod")) writePlatdefC(getNimrodPath()) d = detect("fpc -h") @@ -303,21 +530,18 @@ def cmd_boot(args): cmd_nim() compiler = "nim" else: - if not detect("nimrod") and not detect("bin/nimrod"): cmd_install(args) compiler = "nimrod" cmd_rodsrc() # regenerate nimrod version of the files # move the new executable to bin directory (is done by cmd_rod()) # use the new executable to compile the files in the bootstrap directory: - BOOTCMD = "%s compile --listcmd --debuginfo --compile:build/platdef.c " \ - "--cfilecache:off %s rod/nimrod.nim" - Exec(BOOTCMD % (compiler, args)) + myExec(compiler) genA = readCFiles() # first generation of generated C files # move the new executable to bin directory: moveExes() # compile again and compare: - Exec(BOOTCMD % ("nimrod", args)) + myExec("nimrod") genB = readCFiles() # second generation of generated C files diff = genBootDiff(genA, genB) if diff: @@ -325,7 +549,7 @@ def cmd_boot(args): # check if the executables are the same (they should!): if FileCmp(Path(ExeExt("rod/nimrod")), Path(ExeExt("bin/nimrod"))): - Echo("executables are equal: everything seems fine!") + Echo("executables are equal: SUCCESS!") else: Echo("executables are not equal: cycle once again...") diff = True @@ -333,13 +557,19 @@ def cmd_boot(args): # move the new executable to bin directory: moveExes() # use the new executable to compile Nimrod: - Exec(BOOTCMD % ("nimrod", args)) + myExec("nimrod") if FileCmp(Path(ExeExt("rod/nimrod")), Path(ExeExt("bin/nimrod"))): Echo("executables are equal: SUCCESS!") else: Warn("executables are still not equal") +# ------------------ profile -------------------------------------------------- +def cmd_profile(): + Exec(BOOTCMD % ("nimrod", "-d:release --profiler:on")) + moveExes() + Exec(BOOTCMD % ("nimrod", "--compile_only")) + # ------------------ web ------------------------------------------------------ def buildDoc(destPath): @@ -356,89 +586,23 @@ def buildDoc(destPath): def buildAddDoc(destPath): # build additional documentation (without the index): - for d in ADD_SRCDOC: + def build(d): c = Changed("web__"+d, ["lib/"+d+".nim"], EXPLAIN) - if c or force: + if c.check() or force: Exec("nimrod doc --putenv:nimrodversion=%s -o:%s/%s.html " " lib/%s" % (NIMROD_VERSION, destPath, FilenameNoExt(d), d)) c.success() - -def buildDownloadTxt(): - result = """\ - "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: -""" - for p in SUPPORTED_PLATTFORMS: - ops, cpu = p.split("_") - n = NICE_NAMES[ops] - if cpu[-1] == '*': - cpu = cpu[:-1] - tested = "" + + for a in ADD_SRCDOC: + if '*' in a: + for d in Glob("lib/" + a): build(d) else: - tested = ", untested!" - result += Subs("* source for $nice (${cpu}${tested}): `<download/" - "nimrod_${ops}_${cpu}_${version}.zip>`_\n", - nice=n, ops=ops, cpu=cpu, tested=tested, - version=NIMROD_VERSION) - result += Subs("""\ -* installer for Windows (i386): `<download/nimrod_windows_${version}.exe>`_ - (includes LLVM and everything else you need) - -.. include:: ../install.txt -""", version=NIMROD_VERSION) - return result - + build(a) def cmd_web(): - import Cheetah.Template - # write the web/download.txt file, because maintaining it sucks: - f = file("web/download.txt", "w+") - f.write(buildDownloadTxt()) - f.close() - - TABS = [ # Our tabs: (Menu entry, filename) - ("home", "index"), - ("news", "news"), - ("documentation", "documentation"), - ("download", "download"), - ("FAQ", "question"), - ("links", "links") - ] - TEMPLATE_FILE = "web/sunset.tmpl" - CMD = "nimrod rst2html --compileonly " \ - " --putenv:nimrodversion=%s -o:web/%s.temp web/%s.txt" - - buildAddDoc("web/upload") - c = Changed("web", Glob("web/*.txt") + [TEMPLATE_FILE, "koch.py"] + - Glob("doc/*.txt") + Glob("lib/*.txt") + Glob("lib/*.nim")+ - Glob("config/*.cfg") + ["install.txt"], - EXPLAIN) - if c or force: - cmd_nim() # we need Nimrod for processing the documentation - Exec(CMD % (NIMROD_VERSION, "ticker","ticker")) - tickerText = file("web/ticker.temp").read() - for t in TABS: - Exec(CMD % (NIMROD_VERSION, t[1],t[1])) - - tmpl = Cheetah.Template.Template(file=TEMPLATE_FILE) - tmpl.content = file("web/%s.temp" % t[1]).read() - tmpl.ticker = tickerText - tmpl.tab = t[1] - tmpl.tabs = TABS - tmpl.lastupdate = time.strftime("%Y-%m-%d %X", time.gmtime()) - f = file("web/upload/%s.html" % t[1], "w+") - f.write(str(tmpl)) - f.close() - # remove temporaries: - Remove("web/ticker.temp") - for t in TABS: Remove("web/%s.temp" % t[1]) - buildDoc("web/upload") - if Exists("web/upload/index.html"): - c.success() - + Exec("nimrod cc -r tools/nimweb.nim web/nimrod --putenv:nimrodversion=%s" + % NIMROD_VERSION) + # ------------------ doc ------------------------------------------------------ def cmd_doc(): @@ -446,7 +610,7 @@ def cmd_doc(): Glob("doc/*.txt") + Glob("lib/*.txt") + Glob("lib/*.nim")+ Glob("config/*.cfg"), EXPLAIN) - if c or force: + if c.check() or force: cmd_nim() # we need Nimrod for processing the documentation buildDoc("doc") if Exists("doc/overview.html"): @@ -462,96 +626,41 @@ def getVersion(): CLEAN_EXT = "ppu o obj dcu ~pas ~inc ~dsk ~dpr map tds err bak pyc exe rod" def cmd_clean(dir = "."): - extRegEx = re.compile("|".join([r".*\."+ x +"$" for x in CLEAN_EXT.split()])) - Remove("koch.dat") + L = [] + for x in split(CLEAN_EXT): + L.append(r".*\."+ x +"$") + extRegEx = re.compile(join(L, "|")) + if Exists("koch.dat"): Remove("koch.dat") for f in Glob("*.pdb"): Remove(f) for f in Glob("*.idb"): Remove(f) for f in Glob("web/*.html"): Remove(f) for f in Glob("doc/*.html"): Remove(f) for f in Glob("rod/*.nim"): Remove(f) # remove generated source code - - for root, dirs, files in os.walk(dir, topdown=False): - for name in files: - if (extRegEx.match(name) - or (root == "tests" and ('.' not in name))): - x = os.path.join(root, name) - if "/dist/" not in x and "\\dist\\" not in x: - Echo("removing: " + x) - Remove(os.path.join(root, name)) - for name in dirs: - if name == "rod_gen": - shutil.rmtree(path=os.path.join(root, name), ignore_errors=True) - -# ----------------- distributions --------------------------------------------- - -# Here are listed all files that should be included in the different -# distributions. - -distlist = { - 'common': ( - "*.txt", - "*.html", - "*.py", - - "lib/nimbase.h -> lib/nimbase.h", - "lib/*.nim -> lib", - - "rod/*.* -> rod", - "build/empty.txt -> build/empty.txt", - "nim/*.* -> nim", - - "data/*.yml -> data", - "data/*.txt -> data", - "obj/*.txt", - "diff/*.txt", - - "config/doctempl.cfg -> config/doctempl.cfg", - # other config file is generated - - # documentation: - "doc/*.txt", - "doc/*.html", - "doc/*.cfg", - # tests: - "tests/*.nim", - "tests/*.html", - "tests/*.txt", - "tests/*.cfg", - "tests/gtk/*.nim", - # library: - "lib/base/*.c -> lib/base", - "lib/base/*.nim -> lib/base", - "lib/base/gtk/*.nim -> lib/base/gtk", - "lib/base/cairo/*.nim -> lib/base/cairo", - "lib/windows/*.nim -> lib/windows", - "lib/posix/*.nim -> lib/posix", - # don't be too clever here; maybe useful on Linux - # for cross-compiling to Windows? - ), - 'windows': ( - "bin/nim.exe -> bin/nim.exe", - "bin/nimrod.exe -> bin/nimrod.exe", - "lib/dlmalloc.h -> lib/dlmalloc.h", - "lib/dlmalloc.c -> lib/dlmalloc.c", - "dist/llvm-gcc4.2", - ), - 'unix': ( - "bin/empty.txt -> bin/empty.txt", - "lib/rod_gen/*.c -> build", - "rod/rod_gen/*.c -> build", - "lib/*.h -> build", - "lib/*.c -> build", - "lib/dlmalloc.h -> lib/dlmalloc.h", - "lib/dlmalloc.c -> lib/dlmalloc.c", - ) -} + def visit(extRegEx, dirname, names): + if os.path.split(dirname)[1] == "nimcache": + shutil.rmtree(path=dirname, ignore_errors=True) + del names + else: + for name in names: + x = os.path.join(dirname, name) + if os.path.isdir(x): continue + if (extRegEx.match(name) + or (os.path.split(dirname)[1] == "tests" and ('.' not in name))): + if find(x, "/dist/") < 0 and find(x, "\\dist\\") < 0: + Echo("removing: " + x) + Remove(x) + os.path.walk(dir, visit, extRegEx) def getHost(): - if os.name == 'nt': return "windows" - elif "linux" in sys.platform: return "linux" - elif "darwin" in sys.platform: return "macosx" # probably Mac OS X - # a heuristic that could work (most likely not :-): - else: return re.sub(r"[0-9]+$", r"", sys.platform).lower() + # incomplete list that sys.platform may return: + # win32 aix3 aix4 atheos beos5 darwin freebsd2 freebsd3 freebsd4 freebsd5 + # freebsd6 freebsd7 generic irix5 irix6 linux2 mac netbsd1 next3 os2emx + # riscos sunos5 unixware7 + x = replace(lower(re.sub(r"[0-9]+$", r"", sys.platform)), "-", "") + if x == "win": return "windows" + elif x == "darwin": return "macosx" # probably Mac OS X + elif x == "sunos": return "solaris" + else: return x def mydirwalker(dir, L): for name in os.listdir(dir): @@ -561,854 +670,22 @@ def mydirwalker(dir, L): else: L.append(path) -def iterInstallFiles(target=getHost()): - for section in ['common', target]: - for rule in distlist[section]: - splittedRule = re.split(r"\s*\-\>\s*", rule) - if len(splittedRule) == 2: - source, dest = splittedRule - if '*' in source: - for f in Glob(source): - if not stat.S_ISDIR(os.stat(f)[stat.ST_MODE]): - yield (Path(f), Path(dest + '/' + os.path.split(f)[1])) - else: - yield (Path(source), Path(dest)) - elif os.path.isdir(Path(rule)): - L = [] - mydirwalker(Path(rule), L) - for f in L: - yield f, f - else: - for f in Glob(rule): - if not stat.S_ISDIR(os.stat(f)[stat.ST_MODE]): - yield (Path(f), Path(f)) - -def cmd_dist(ops="", cpu="i386"): - from zipfile import ZipFile - if not ops: ops = getHost() - Exec("nimrod compile --cfilecache:off --compileonly " \ - " --os:%s --cpu:%s rod/nimrod.nim" % (ops, cpu)) - # assure that we transfer the right C files to the archive - distfile = Path('web/upload/download/nimrod_%s_%s_%s.zip' % - (ops, cpu, getVersion())) - Echo("creating: %s..." % distfile) - z = ZipFile(distfile, 'w', zipfile.ZIP_DEFLATED) - if ops == "windows": target = "windows" - else: target = "unix" - for source, dest in iterInstallFiles(target): - z.write(source, os.path.join("nimrod", Path(dest))) - z.close() - Echo("... done!") - -def cmd_alldist(): - cmd_rodsrc() - cmd_doc() # assure that the docs are packed - if getHost() == "windows": - # build the Windows installer too: - cmd_installer() - for p in SUPPORTED_PLATTFORMS: - o, c = p.split("_") - c = c.replace("*", "") - cmd_dist(o, c) - -# ------------------ config template ----------------------------------------- - -CONFIG_TEMPLATE = r"""# Configuration file for the Nimrod Compiler. -# Template from the koch.py script. -# (c) 2008 Andreas Rumpf - -# Feel free to edit the default values as you need. - -# You may set environment variables with -# @putenv "key" "val" -# Environment variables cannot be used in the options, however! - -# Just call the compiler with several options: -cc = $defaultcc -lib="$$nimrod/lib" -path="$$lib/base" -path="$$lib/base/gtk" -path="$$lib/base/cairo" -path="$$lib/base/x11" -path="$$lib/windows" -path="$$lib/posix" -path="$$lib/ecmas" -path="$$lib/extra" - -@if release: - checks:off - stacktrace:off - debugger:off - line_dir:off -@end - -# additional defines: -#define="" -# additional options always passed to the compiler: -force_build -line_dir=off - -hint[LineTooLong]=off -hint[XDeclaredButNotUsed]=off - -@if unix: - passl= "-ldl" -@end - -@if icc: - passl = "-cxxlib" - passc = "-cxxlib" -@end - -# Configuration for the LLVM GCC compiler: -@if windows: - llvm_gcc.path = r"$$nimrod\dist\llvm-gcc4.2\bin" -@end -llvm_gcc.options.debug = "-g" -llvm_gcc.options.always = "-w" -llvm_gcc.options.speed = "-O3 -ffast-math" -llvm_gcc.options.size = "-Os -ffast-math" - -# Configuration for the Borland C++ Compiler: -@if windows: - bcc.path = r"${bcc_path}" -@end -bcc.options.debug = "" -# turn off warnings about unreachable code and inline procs: -bcc.options.always = "-w- -H- -q -RT- -a8 -w-8027 -w-8066" -bcc.options.speed = "-O2 -6" -bcc.options.size = "-O1 -6" - -# Configuration for the Visual C/C++ compiler: -@if vcc: - @prepend_env path r"${vcc_path}\..\..\Common7\IDE;" - @prepend_env INCLUDE r"${vcc_path}\..\include;$vcc_path\..\ATLMFC\INCLUDE;" - @prepend_env LIB r"${vcc_path}\..\lib;$vcc_path\..\..\SDK\v2.0\Lib;" - passl: r"/F33554432" # set the stack size to 32 MB -@end -@if windows: - vcc.path = r"${vcc_path}" -@end -vcc.options.debug = "/RTC1 /ZI" -vcc.options.always = "/nologo" -vcc.options.speed = "/Ogityb2 /G7 /arch:SSE2" -vcc.options.size = "/O1 /G7" - -# Configuration for the Watcom C/C++ compiler: -@if windows: - wcc.path = r"" -@end -wcc.options.debug = "-d2" -wcc.options.always = "-6 -zw -w-" -wcc.options.speed = "-ox -on -6 -d0 -fp6 -zW" -wcc.options.size = "-ox -on -6 -d0 -fp6 -zW" - -# Configuration for the GNU C/C++ compiler: -@if windows: - gcc.path = r"${gcc_path}" -@end -gcc.options.debug = "-g" -@if macosx: - gcc.options.always = "-w -fasm-blocks" -@else: - gcc.options.always = "-w" -@end -gcc.options.speed = "-O3 -ffast-math" -gcc.options.size = "-Os -ffast-math" - -# Configuration for the Digital Mars C/C++ compiler: -@if windows: - dmc.path = r"${dmc_path}" -@end -dmc.options.debug = "-g" -dmc.options.always = "-Jm" -dmc.options.speed = "-ff -o -6" -dmc.options.size = "-ff -o -6" - -# Configuration for the LCC compiler: -@if windows: - lcc.path = r"${lcc_path}" -@end -lcc.options.debug = "-g5" -lcc.options.always = "-e1" -lcc.options.speed = "-O -p6" -lcc.options.size = "-O -p6" - -# Configuration for the Tiny C Compiler: -@if windows: - tcc.path = r"" -@end -tcc.options.debug = "-b" -tcc.options.always = "" -tcc.options.speed = "" -tcc.options.size = "" - -# Configuration for the Pelles C compiler: -@if windows: - pcc.path = r"${pcc_path}" -@end -pcc.options.debug = "-Zi" -pcc.options.always = "-Ze" -pcc.options.speed = "-Ox" -pcc.options.size = "-Os" - -@if windows: - icc.path = r"" -@end -icc.options.debug = "-g" -icc.options.always = "-w" -icc.options.speed = "-O3 -ffast-math" -icc.options.size = "-Os -ffast-math" - -@write "used default config file" -""" - -# ------------------------------ windows installer ---------------------------- - -WIN_INSTALLER_TEMPLATE = (r""" -; File generated by koch.py -; Template by Andreas Rumpf -[Setup] -AppName=Nimrod Compiler -AppVerName=Nimrod Compiler $version -DefaultDirName={code:GiveMeAPath|nimrod} -DefaultGroupName=Nimrod -AllowNoIcons=yes -LicenseFile=nim\copying.txt -OutputDir=web\upload\download -OutputBaseFilename=nimrod_windows_$version -Compression=lzma -SolidCompression=yes -PrivilegesRequired=none -ChangesEnvironment=yes - -[Languages] -Name: english; MessagesFile: compiler:Default.isl - -[Files] -$files - -[Icons] -Name: {group}\Console for Nimrod; Filename: {cmd} -Name: {group}\Documentation; Filename: {app}\doc\overview.html -Name: {group}\{cm:UninstallProgram,Nimrod Compiler}; Filename: {uninstallexe} - -[UninstallDelete] -Type: files; Name: "{app}\config\nimrod.cfg" - -;[Run] -;Filename: "{app}\bin\nimconf.exe"; Description: "Launch configuration"; """ + -r"""Flags: postinstall nowait skipifsilent - -[Tasks] -Name: generateconfigfile; """ + -r"""Description: &Generate configuration file; -Name: modifypath; Description: """ + -r"""&Add Nimrod your system path (if not in path already); - -[Code] -function GiveMeAPath(const DefaultPathName: string): string; -begin - if IsAdminLoggedOn then Result := ExpandConstant('{pf}') - else Result := ExpandConstant('{userdocs}'); - Result := Result + '\' + DefaultPathName; -end; - -// ---------------------------------------------------------------------------- -// -// Inno Setup Ver: 5.2.1 -// Script Version: 1.3.1 -// Author: Jared Breland <jbreland@legroom.net> -// Homepage: http://www.legroom.net/software -// -// Script Function: -// Enable modification of system path directly from Inno Setup installers -// -// Instructions: -// Copy modpath.iss to the same directory as your setup script -// -// Add this statement to your [Setup] section -// ChangesEnvironment=yes -// -// Add this statement to your [Tasks] section -// You can change the Description or Flags, but the Name must be modifypath -// Name: modifypath; Description: &Add application directory to your -// system path; Flags: unchecked -// -// Add the following to the end of your [Code] section -// setArrayLength must specify the total number of dirs to be added -// Dir[0] contains first directory, Dir[1] contains second, etc. - -function ModPathDir(): TArrayOfString; -begin - setArrayLength(result, 2); - result[0] := ExpandConstant('{app}') + '\bin'; - result[1] := ExpandConstant('{app}') + '\dist\llvm-gcc4.2\bin'; -end; - -// ---------------------------------------------------------------------------- - -procedure ModPath(); -var - oldpath, newpath, aExecFile: String; - pathArr, aExecArr, pathdir: TArrayOfString; - i, d: Integer; -begin - // Get array of new directories and act on each individually - pathdir := ModPathDir(); - for d := 0 to GetArrayLength(pathdir)-1 do begin - // Modify WinNT path - if UsingWinNT() then begin - // Get current path, split into an array - RegQueryStringValue(HKEY_LOCAL_MACHINE, - 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', - 'Path', oldpath); - oldpath := oldpath + ';'; - i := 0; - while (Pos(';', oldpath) > 0) do begin - SetArrayLength(pathArr, i+1); - pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1); - oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath)); - i := i + 1; - // Check if current directory matches app dir - if pathdir[d] = pathArr[i-1] then begin - // if uninstalling, remove dir from path - if IsUninstaller() then continue - // if installing, abort because dir was already in path - else abort; - end; - // Add current directory to new path - if i = 1 then newpath := pathArr[i-1] - else newpath := newpath + ';' + pathArr[i-1]; - end; - // Append app dir to path if not already included - if not IsUninstaller() then - newpath := newpath + ';' + pathdir[d]; - // Write new path - RegWriteStringValue(HKEY_LOCAL_MACHINE, - 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', - 'Path', newpath); - end - else begin - // Modify Win9x path - // Convert to shortened dirname - pathdir[d] := GetShortName(pathdir[d]); - // If autoexec.bat exists, check if app dir already exists in path - aExecFile := 'C:\AUTOEXEC.BAT'; - if FileExists(aExecFile) then begin - LoadStringsFromFile(aExecFile, aExecArr); - for i := 0 to GetArrayLength(aExecArr)-1 do begin - if not IsUninstaller() then begin - // If app dir already exists while installing, abort add - if (Pos(pathdir[d], aExecArr[i]) > 0) then - abort; - end - else begin - // If app dir exists and = what we originally set, - // then delete at uninstall - if aExecArr[i] = 'SET PATH=%PATH%;' + pathdir[d] then - aExecArr[i] := ''; - end; - end; - end; - // If app dir not found, or autoexec.bat didn't exist, then - // (create and) append to current path - if not IsUninstaller() then begin - SaveStringToFile(aExecFile, #13#10 + 'SET PATH=%PATH%;' + pathdir[d], - True); - end - else begin - // If uninstalling, write the full autoexec out - SaveStringsToFile(aExecFile, aExecArr, False); - end; - end; - - // Write file to flag modifypath was selected - // Workaround since IsTaskSelected() cannot be called at uninstall and - // AppName and AppId cannot be "read" in Code section - if not IsUninstaller() then - SaveStringToFile(ExpandConstant('{app}') + '\uninsTasks.txt', - WizardSelectedTasks(False), False); - end; -end; - -// We check for C compilers in the following order: -// Visual C++ (via registry), Borland C++ (via registry), -// Lcc (via registry), Pcc (via registry), DMC (via PATH), -// LLVM-GCC (via PATH), GCC (via PATH) -// The user is informed which C compilers have been found and whether -// LLVM-GCC should be installed -const - IdxVisualC = 0; - IdxBorlandC = 1; - IdxLcc = 2; - IdxPcc = 3; - IdxDMC = 4; - IdxLLVMGCC = 5; - IdxGCC = 6; - NumberCC = 7; // number of C compilers - -function idxToLongName(idx: integer): string; -begin - case idx of - IdxVisualC: result := 'Microsoft Visual C/C++ Compiler'; - IdxBorlandC: result := 'Borland C/C++ Compiler'; - IdxLcc: result := 'Jacob Navia''s LCC-win32'; - IdxPcc: result := 'Pelles C Compiler'; - IdxDMC: result := 'Digital Mars C/C++ Compiler'; - IdxLLVMGCC: result := 'LLVM GCC Compiler'; - IdxGCC: result := 'GNU C/C++ Compiler'; - else result := ''; - end -end; - -function idxToShortName(idx: integer): string; -begin - case idx of - IdxVisualC: result := 'vcc'; - IdxBorlandC: result := 'bcc'; - IdxLcc: result := 'lcc'; - IdxPcc: result := 'pcc'; - IdxDMC: result := 'dmc'; - IdxLLVMGCC: result := 'llvm_gcc'; - IdxGCC: result := 'gcc'; - else result := ''; - end -end; - -function idxToExe(idx: integer): string; -begin - case idx of - IdxVisualC: result := 'cl.exe'; - IdxBorlandC: result := 'bcc32.exe'; - IdxLcc: result := 'lcc.exe'; - IdxPcc: result := 'cc.exe'; - IdxDMC: result := 'dmc.exe'; - IdxLLVMGCC: result := 'llvm-gcc.exe'; - IdxGCC: result := 'gcc.exe'; - else result := ''; - end -end; - -function ReadStrFromRegistry(const RootKey: Integer; - const SubKeyName, ValueName: String): string; -begin - result := ''; - RegQueryStringValue(rootKey, removeBackslash(subkeyName), - valueName, result); -end; - -function detectCCompiler(idx: integer): string; -var - i: integer; -begin - result := ''; - case idx of - IdxVisualC: begin - for i := 20 downto 6 do begin - result := ReadStrFromRegistry(HKEY_LOCAL_MACHINE, - 'SOFTWARE\Microsoft\DevStudio\' + IntToStr(i) + - '.0\Products\Microsoft Visual C++\', 'ProductDir'); - if result <> '' then begin - result := result + '\bin'; // the path we want needs a \bin - break - end; - result := ReadStrFromRegistry(HKEY_LOCAL_MACHINE, - 'SOFTWARE\Microsoft\VisualStudio\' + IntToStr(i) + - '.0\Setup', 'Dbghelp_path'); - if result <> '' then - result := ReadStrFromRegistry(HKEY_LOCAL_MACHINE, - 'SOFTWARE\Microsoft\VCExpress\' + IntToStr(i) + - '.0\', 'InstallDir'); - if result <> '' then begin - // something like: 'C:\eigenes\compiler\vcc2005\Common7\IDE\' - // we need: 'C:\eigenes\compiler\vcc2005\vc\bin' - result := ExtractFilePath(RemoveBackslash( - ExtractFilePath(RemoveBackslash(result)))) - + 'vc\bin'; // the path we want needs a vc\bin - break - end - end - end; - IdxBorlandC: begin - for i := 20 downto 2 do begin - result := ReadStrFromRegistry(HKEY_LOCAL_MACHINE, - 'SOFTWARE\Borland\C++Builder\' + IntToStr(i) + '.0\', 'RootDir'); - if result <> '' then begin - result := result + '\bin'; - break - end - end - end; - IdxLcc: begin - result := ReadStrFromRegistry(HKEY_CURRENT_USER, - 'Software\lcc\compiler\', 'includepath'); - if result <> '' then begin - result := RemoveBackslash(ExtractFilePath(result)) + '\bin'; - // because we get something like 'c:\..\lcc\include' - end - end; - IdxPcc: begin - result := ReadStrFromRegistry(HKEY_LOCAL_MACHINE, - 'SOFTWARE\PellesC', ''); - if result <> '' then - result := result + '\bin'; - end; - else begin end - end; - if (result <> '') then - if not FileExists(RemoveBackslash(result) + '\' + idxToExe(idx)) then - result := ''; -end; - -function myfind(const x: string; const inArray: array of string): integer; -var - i: integer; -begin - i := 0; - while i < GetArrayLength(inArray)-1 do begin - if CompareText(x, inArray[i]) = 0 then begin - result := i; exit - end; - i := i + 2; - end; - result := -1 -end; - -function mycopy(const s: string; a, b: integer): string; -begin - result := copy(s, a, b-a+1); -end; - -function isPatternChar(c: Char): boolean; -begin - result := (c >= 'a') and (c <= 'z') or - (c >= 'A') and (c <= 'Z') or - (c >= '0') and (c <= '9') or - (c = '_'); -end; - -function myformat(const f: string; const args: array of string): string; -var - i, j, x: integer; -begin - result := ''; - i := 1; - while i <= length(f) do - if f[i] = '$' then begin - case f[i+1] of - '$': begin - result := result + '$'; - i := i + 2; - end; - '1', '2', '3', '4', '5', '6', '7', '8', '9': begin - result := result + args[ord(f[i+1]) - ord('0') - 1]; - i := i + 2; - end; - '{': begin - j := i+1; - while (j <= length(f)) and (f[j] <> '}') do j := j+1; - x := myfind(mycopy(f, i+2, j-1), args); - if (x >= 0) and (x < GetArrayLength(args)-1) then - result := result + args[x+1]; - i := j+1 - end; - else if isPatternChar(f[i+1]) then begin - j := i+1; - while (j <= length(f)) and isPatternChar(f[j]) do j := j +1; - x := myfind(mycopy(f, i+1, j-1), args); - if (x >= 0) and (x < GetArrayLength(args)-1) then - result := result + args[x+1]; - i := j - end - else i := i + 1; - end - end - else begin - result := result + f[i]; - i := i + 1; - end -end; - -$config_template - -procedure generateconfigfile(); -var - data: TArrayOfString; - i: integer; - outfile, d: string; -begin - // set default compiler: - setArrayLength(data, (NumberCC+2) * 2); // *2 for key: value pairs - data[0] := 'defaultcc'; - for i := 0 to NumberCC-1 do begin - data[4+i*2] := idxToShortName(i) + '_path'; - d := detectCCompiler(i); - data[5+i*2] := d; - if d <> '' then begin - if data[1] = '' then data[1] := idxToShortName(i); - // first found C compiler is default - end - end; - if data[1] = '' then data[1] := 'llvm_gcc'; - // set the library path: - data[2] := 'libpath'; - data[3] := ExpandConstant('{app}') + '\lib'; - // write the file: - outfile := ExpandConstant('{app}') + '\config\nimrod.cfg'; - SaveStringToFile(outfile, myformat(template, data), false); -end; - -procedure CurStepChanged(CurStep: TSetupStep); -begin - if CurStep = ssPostInstall then begin - if IsTaskSelected('modifypath') then - ModPath(); - if IsTaskSelected('generateconfigfile') then - generateconfigfile(); - end -end; - -procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); -var - appdir, selectedTasks: String; -begin - appdir := ExpandConstant('{app}'); - if CurUninstallStep = usUninstall then begin - if LoadStringFromFile(appdir + '\uninsTasks.txt', selectedTasks) then - if Pos('modifypath', selectedTasks) > 0 then - ModPath(); - DeleteFile(appdir + '\uninsTasks.txt') - end; -end; - -function NeedRestart(): Boolean; -begin - result := IsTaskSelected('modifypath') and not UsingWinNT() -end; -""") - -def makeKochExe(): - c = Changed("kochexe", - ("docmacro.py kochmod.py koch.py " + - "misc/koch.ico").split(), EXPLAIN) - if c or force: - Exec("python " + Join(PYINSTALLER, "Makespec.py") + - " --onefile --ascii --icon=misc/koch.ico koch.py") - Exec("python " + Join(PYINSTALLER, "Build.py") + " koch.spec") - Remove("koch.spec") - Remove("warnkoch.txt") - RemoveDir("buildkoch") - c.success() - -def cmd_wininstaller(): - FILENAME = "install_nimrod.iss" - cmd_doc() - # generate an installer file - files = "" - for source, dest in iterInstallFiles("windows"): - files += ("Source: " + source + "; DestDir: {app}\\" + - os.path.split(dest)[0] + "; Flags: ignoreversion\n") - f = file(FILENAME, "w+") - pasconfig = "const template = ''" - for line in CONFIG_TEMPLATE.splitlines(): - pasconfig += " + '%s'+#13#10\n" % line - pasconfig += ";\n" - f.write(SafeSubs(WIN_INSTALLER_TEMPLATE, files=files, version=getVersion(), - config_template=pasconfig)) - f.close() - if RawExec(INNOSETUP + FILENAME) == 0: - # we cannot use ``Exec()`` here as this would - # mangle the ``/Q`` switch to ``\Q`` - Remove(FILENAME) - -# -------------------------- testing the compiler ----------------------------- - -# This part verifies Nimrod against the testcases. -# The testcases may contain the directives '#ERROR' or '#ERROR_IN'. -# '#ERROR' is used to indicate that the compiler should report -# an error in the marked line (the line that contains the '#ERROR' -# directive.) -# The format for '#ERROR_IN' is: -# #ERROR_IN filename linenumber -# One can omit the extension of the filename ('.nim' is then assumed). -# Tests which contain none of the two directives should compile. Thus they -# are executed after successful compilation and their output is verified -# against the results specified with the '#OUT' directive. -# (Tests which require user interaction are not possible.) -# Tests can have an #ERROR_MSG directive specifiying the error message -# Nimrod shall produce. - -def runProg(cmd): - pipe = os.popen4(cmd)[1] - result = "" - for line in pipe: - result += line - pipe.close() - return result - -class Spec(object): pass # specification object - -def parseTest(filename): - # spec is a table - reError = re.compile(r"#ERROR$") - reErrorIn = re.compile(r"#ERROR_IN\s*(\S*)\s*(\d*)") - reErrorMsg = re.compile(r"#ERROR_MSG\s*(.*)") - reOut = re.compile(r"#OUT\s*(.*)") - - i = 0 # the line counter - spec = Spec() - spec.line = None # line number where compiler should throw an error - spec.file = None # file where compiler should throw an error - spec.err = False # true if the specification says there should be an error - spec.out = None # output that should be produced - - for s in file(filename, 'rU'): - i += 1 # our line-counter - obj = reOut.search(s) - if obj: - spec.out = obj.group(1) - break - obj = reError.search(s) - if obj: - spec.line = i - spec.file = filename - spec.err = True - break - obj = reErrorIn.search(s) - if obj: - spec.file = obj.group(1) - spec.line = int(obj.group(2)) - spec.err = True - if '.' not in specfile: specfile += ".nim" - break - obj = reErrorMsg.search(s) - if obj: - spec.out = obj.group(1) - spec.err = True - break - return spec - -def doTest(filename, spec, options): - # call the compiler - # short filename for messages (better readability): - shortfile = os.path.split(filename)[1] - - comp = Spec() - comp.line = 0 - comp.file = None - comp.out = None - comp.err = False - # call the compiler and read the compiler message: - results = runProg("nimrod compile --hints:on " + options + " " + filename) - #print results - # compiled regular expressions: - reLineInfoError = re.compile(r"^((.*)\((\d+), \d+\)\s*Error\:\s*(.*))", - re.MULTILINE) - reError = re.compile(r"^Error\:\s*(.*)", re.MULTILINE) - reSuccess = re.compile(r"^Hint\:\s*operation successful", re.MULTILINE) - obj = reLineInfoError.search(results) - if obj: - comp.err = True - comp.file = obj.group(2) - comp.line = int(obj.group(3)) - comp.out = obj.group(1) - comp.puremsg = obj.group(4) - else: - comp.puremsg = '' - obj = reError.search(results) - if obj: - comp.err = True - comp.out = results - comp.puremsg = obj.group(1) - comp.line = 1 - else: - obj = reSuccess.search(results) - if not obj: comp.err = True - else: comp.out = "Success" - - if comp.err and not comp.out: - # the compiler did not say "[Error]" nor "Compilation sucessful" - Echo("[Tester] %s -- FAILED; COMPILER BROKEN" % shortfile) - return False - - if (spec.err != comp.err - or (spec.line and (abs(spec.line - comp.line) > 1)) - or (spec.file and (spec.file.lower() != comp.file.lower())) - or (spec.out and not (spec.out.strip() in comp.puremsg.strip()))): - if spec.out: - Echo("[Tester] %s -- FAILED\n" - "Compiler says: %s\n" - "But specification says: Output %s" - % (shortfile, comp.out, spec.out) ) - elif spec.err: - if spec.file is None: spec.file = filename - if spec.line is None: spec.line = -1 - Echo("[Tester] %s -- FAILED\n" - "Compiler says: %s\n" - "But specification says: Error in %s line %d" - % (shortfile, comp.out, spec.file, spec.line) ) - else: - Echo("[Tester] %s -- FAILED\n" - "Compiler says: %s\n" - "But specification says: no error" - % (shortfile, comp.out) ) - return False - else: - if spec.err: - Echo("[Tester] " + shortfile + ' -- OK') # error correctly reported - return True - else: - # run the compiled program and check if it works - fileNoExt = os.path.splitext(filename)[0] - if os.path.isfile(ExeExt(fileNoExt)): - if spec.out: - buf = runProg(fileNoExt) - if buf.strip() == spec.out.strip(): - Echo("[Tester] " + shortfile + " -- compiled program OK") - return True - else: - Echo("[Tester] " + shortfile + " -- compiled program FAILED") - return False - else: - Echo("[Tester] " + shortfile + ' -- OK') - return True - # we have no output to validate against, but compilation succeeded, - # so it's okay - elif '--compile_only' in options: - Echo("[Tester] " + shortfile + ' -- OK') - return True - else: - Echo("[Tester] " + shortfile + " -- FAILED\n" - "no compiled program found") - return False - -def cmd_tests(options): # run the testsuite - """runs the complete testsuite""" - #clean(True) # first clean before running the testsuite - total = 0 - passed = 0 - for filename in Glob("tests/t*.nim"): - spec = parseTest(filename) - res = doTest(filename, spec, options) - assert(res is not None) - if res: passed += 1 - total += 1 - break - Echo("[Tester] %d/%d tests passed\n" % (passed, total)) - # --------------- install target ---------------------------------------------- -def writePlatdefC(nimrodpath): - import os +def getOSandProcessor(): host = getHost() if host == "windows": processor = "i386" # BUGFIX else: processor = os.uname()[4] - if processor.lower() in ("i686", "i586", "i468", "i386"): + if lower(processor) in ("i686", "i586", "i468", "i386"): processor = "i386" - if "sparc" in processor.lower(): + if find(lower(processor), "sparc") >= 0: processor = "sparc" - f = file(os.path.join(nimrodpath, "build/platdef.c"), "w+") + return (host, processor) + +def writePlatdefC(nimrodpath): + import os + host, processor = getOSandProcessor() + f = open(os.path.join(nimrodpath, "build/platdef.c"), "w+") f.write('/* Generated by koch.py */\n' 'char* nimOS(void) { return "%s"; }\n' 'char* nimCPU(void) { return "%s"; }\n' @@ -1416,136 +693,30 @@ def writePlatdefC(nimrodpath): f.close() def detect(cmd, lookFor="version"): - pipe = os.popen4(cmd)[1] + try: + pipe = os.popen4(cmd)[1] + except AttributeError: + pipe = os.popen(cmd) result = None - for line in pipe: - if lookFor in line.lower(): + for line in pipe.readlines(): + if find(lower(line), lookFor) >= 0: result = line[:-1] break pipe.close() + if not result: + # don't give up yet; it may have written to stderr + if os.system(cmd) == 0: + result = cmd return result -def lookForCC(): - if "CC" in os.environ: - Echo("using $CC environment variable (%s)" % os.environ["CC"]) - return os.environ["CC"] - d = detect("gcc -v") - if d: - Echo("'%s' detected" % d) - return "gcc" - Echo("GCC not found. Testing for generic CC...") - d = detect("cc -v") - if d: - Echo("'%s' detected" % d) - return "ucc" - Echo("...not found!") - Error("No C compiler could be found!") - return "" - def getNimrodPath(): if os.name == "posix": # Does not work 100% reliably. It is the best solution though. - p = sys.argv[0].replace("./", "") + p = replace(sys.argv[0], "./", "") return os.path.split(os.path.join(os.getcwd(), p))[0] else: # Windows return os.path.split(sys.argv[0])[0] -def writeCfg(nimrodpath, ccSymbol=None): - if not ccSymbol: - ccSymbol = lookForCC() - configFile = os.path.join(nimrodpath, os.path.join("config", "nimrod.cfg")) - script = Subs(CONFIG_TEMPLATE, defaultcc=ccSymbol, - gcc_path="", lcc_path="", llvm_gcc_path="", - pcc_path="", bcc_path="", dmc_path="", - vcc_path="", wcc_path="") - try: - config = file(configFile) - except IOError: - config = None - if config: - if config.read().strip() != script.strip(): - config.close() - Echo("Configuration file already exists and " - "seems to have been modified.\n" - "Do you want to override it? (y/n) ") - while True: - a = ask() - if a in ("y", "yes"): - f = file(configFile, "w+") - f.write(script) - f.close() - break - elif a in ("n", "no"): - break - else: - Echo("What do you mean? (y/n) ") - else: - config.close() - else: - file(configFile, "w+").write(script) - return ccSymbol - -def cmd_install(args): - nimrodpath = getNimrodPath() - Echo("Nimrod should be in '%s'" % nimrodpath) - # We know that the user has already unzipped this archive into the - # final directory. So we just create the config file and build Nimrod. - - try: - opts, args = getopt.getopt(args, "", ["cc=", "ld="]) - except getopt.GetoptError: - # print help information and exit: - Error("Command line contains errors") - ccSymbol = None - ldSymbol = None - for o, a in opts: - if o == "--cc": ccSymbol = a - elif o == "--ld": ldSymbol = a - - # write the configuration file, but check if one exists! - ccSymbol = writeCfg(nimrodpath, ccSymbol) - if not ldSymbol: - ldSymbol = ccSymbol.split()[0] + " -ldl -lm -o bin/nimrod " - - writePlatdefC(nimrodpath) - - # build Nimrod - link = "" # store the .o files in here for final linking step - for f in Glob("build/*.c"): - objfile = os.path.splitext(f)[0] + ".o" - link += " " + objfile - # compile only: - if Exec(ccSymbol + " " + CC_FLAGS + " -c -o " + objfile + " " + f) != 0: - Error("the C compiler did not like: " + f) - if link == "": - Error("could not find Nimrod's sources\n" - " (they should be in the build subdirectory)") - # now link the stuff together: - if Exec(ldSymbol + link) != 0: - Error("the linking step failed!") - # now we have a Nimrod executable :-) - # remove the generated .o files as they take 1 MB easily: - for f in Glob("build/*.o"): Remove(f) - Echo("SUCCESS!") - -def cmd_installer(): - if os.name == "posix": - Echo("Nothing to do") - else: # Windows - cmd_wininstaller() - - -# ------------------ configure ------------------------------------------------ - -def cmd_configure(): - d = detect("fpc -h") - if d: - Echo("'%s' detected" % d) - else: - Warn("Free Pascal is not installed, bootstrapping may not work properly.") - writeCfg(getNimrodPath()) - Echo("Configuration sucessful!") - # ------------------- main ---------------------------------------------------- if __name__ == "__main__": diff --git a/kochmod.py b/kochmod.py deleted file mode 100644 index ca303cadf..000000000 --- a/kochmod.py +++ /dev/null @@ -1,662 +0,0 @@ -# This is kochmod, a simple module for make-like functionality. -# For further documentation see koch.txt or koch.html. -# (c) 2007 Andreas Rumpf - -VERSION = "1.0.4" - -import os, os.path, inspect, re, shutil, glob, cPickle, zlib, string, \ - getopt, sys -from types import * - -def Error(msg): sys.exit("[Koch] *** ERROR: " + msg) -def Warn(msg): print "[Koch] *** WARNING: " + msg -def Echo(msg): print "[Koch] " + msg -def _Info(msg): print "[Koch] " + msg - -_FINGERPRINTS_FILE = "koch.dat" - # in this file all the fingerprints are kept to allow recognizing when a file - # has changed. This works reliably, which cannot be said from just taking - # filetime-stamps. - -# ----------------------------------------------------------------------------- - -def FileCmp(filenameA, filenameB): - SIZE = 4096*2 - result = True - a = file(filenameA, "rb") - b = file(filenameB, "rb") - while True: - x = a.read(SIZE) - y = b.read(SIZE) - if x != y: - result = False - break - elif len(x) < SIZE: # EOF? - break - a.close() - b.close() - return result - -# ---------------- C Compilers ------------------------------------------------ - -# We support the following C compilers: -C_Compilers = ["gcc", "lcc", "bcc", "dmc", "wcc", "tcc", "pcc", "ucc", "llvm"] - -_CC_Info = [ - dict( - name = "gcc", - objExt = "o", - optSpeed = " -O3 -ffast-math ", - optSize = " -Os -ffast-math ", - comp = "gcc -c $options $include -o $objfile $file", - buildGui = " -mwindows", - buildDll = " -mdll", - link = "gcc $options $buildgui $builddll -o $exefile $objfiles", - includeCmd = " -I", - debug = "", - defineValue = " -D$name=$value", - define = " -D$name", - undef = " -U$name", - pic = "-fPIC" - ), dict( - name = "lcc", - objExt = "obj", - optSpeed = " -O -p6 ", - optSize = " -O -p6 ", - comp = "lcc -e1 $options $include -Fo$objfile $file", - buildGui = " -subsystem windows", - buildDll = " -dll", - link = "lcclnk $options $buildgui $builddll -O $exefile $objfiles", - includeCmd = " -I", - debug = " -g5 ", - defineValue = " -D$name=$value", - define = " -D$name", - undef = " -U$name", - pic = "" - ), dict( - name = "bcc", - objExt = "obj", - optSpeed = " -O2 -6 ", - optSize = " -O1 -6 ", - comp = "bcc32 -c -H- -q -RT- -a8 $options $include -o$objfile $file", - buildGui = " -tW", - buildDll = " -tWD", - link = "bcc32 $options $buildgui $builddll -e$exefile $objfiles", - includeCmd = " -I", - debug = "", - defineValue = " -D$name=$value", - define = " -D$name", - undef = " -U$name", - pic = "" - ), dict( - name = "dmc", - objExt = "obj", - optSpeed = " -ff -o -6 ", - optSize = " -ff -o -6 ", - comp = "dmc -c -Jm $options $include -o$objfile $file", - buildGui = " -L/exet:nt/su:windows", - buildDll = " -WD", - link = "dmc $options $buildgui $builddll -o$exefile $objfiles", - includeCmd = " -I", - debug = " -g ", - defineValue = " -D$name=$value", - define = " -D$name", - undef = " -U$name", # XXX: dmc does not have -U ? - pic = "" - ), dict( - name = "wcc", - objExt = "obj", - optSpeed = " -ox -on -6 -d0 -fp6 -zW ", - optSize = "", - comp = "wcl386 -c -6 -zw $options $include -fo=$objfile $file", - buildGui = " -bw", - buildDll = " -bd", - link = "wcl386 $options $buildgui $builddll -fe=$exefile $objfiles ", - includeCmd = " -i=", - debug = " -d2 ", - defineValue = " -d$name=$value", - define = " -d$name", - undef = " -u$name", - pic = "" - ), dict( - name = "vcc", - objExt = "obj", - optSpeed = " /Ogityb2 /G7 /arch:SSE2 ", - optSize = " /O1 /G7 ", - comp = "cl /c $options $include /Fo$objfile $file", - buildGui = " /link /SUBSYSTEM:WINDOWS ", - buildDll = " /LD", - link = "cl $options $builddll /Fe$exefile $objfiles $buildgui", - includeCmd = " /I", - debug = " /GZ /Zi ", - defineValue = " /D$name=$value", - define = " /D$name", - undef = " /U$name", - pic = "" - ), dict( - name = "tcc", - objExt = "o", - optSpeed = "", # Tiny C has no optimizer - optSize = "", - comp = "tcc -c $options $include -o $objfile $file", - buildGui = "UNAVAILABLE!", - buildDll = " -shared", - link = "tcc -o $exefile $options $buildgui $builddll $objfiles", - includeCmd = " -I", - debug = " -b ", - defineValue = " -D$name=$value", - define = " -D$name", - undef = " -U$name", - pic = "" - ), dict( - name = "pcc", # Pelles C - objExt = "obj", - optSpeed = " -Ox ", - optSize = " -Os ", - comp = "cc -c $options $include -Fo$objfile $file", - buildGui = " -SUBSYSTEM:WINDOWS", - buildDll = " -DLL", - link = "cc $options $buildgui $builddll -OUT:$exefile $objfiles", - includeCmd = " -I", - debug = " -Zi ", - defineValue = " -D$name=$value", - define = " -D$name", - undef = " -U$name", - pic = "" - ), dict( - name = "ucc", - objExt = "o", - optSpeed = " -O3 ", - optSize = " -O1 ", - comp = "cc -c $options $include -o $objfile $file", - buildGui = "", - buildDll = " -shared ", - link = "cc -o $exefile $options $buildgui $builddll $objfiles", - includeCmd = " -I", - debug = "", - defineValue = " -D$name=$value", - define = " -D$name", - undef = " -U$name", - pic = "" - ), dict( - name = "llvm_gcc", # its options are the same as GCC's - objExt = "o", - optSpeed = " -O3 -ffast-math ", - optSize = " -Os -ffast-math ", - comp = "llvm-gcc -c $options $include -o $objfile $file", - buildGui = " -mwindows", - buildDll = " -mdll", - link = "llvm-gcc $options $buildgui $builddll -o $exefile $objfiles", - includeCmd = " -I", - debug = "", - defineValue = " -D$name=$value", - define = " -D$name", - undef = " -U$name", - pic = "-fPIC" - ) -] - -# --------------- little helpers --------------------------------------------- - -def Subs(frmt, **substitution): - if isinstance(frmt, basestring): - return string.Template(frmt).substitute(substitution) - else: - return tuple([string.Template(x).substitute(substitution) for x in frmt]) - -def SafeSubs(frmt, **substitution): - return string.Template(frmt).safe_substitute(substitution) - -_baseDir = os.getcwd() -BaseDir = _baseDir - -def Path(a): - # Gets a UNIX like path and converts it to a path on this platform. - # With UNIX like, I mean: slashes, not backslashes, only relative - # paths ('../etc' can be used) - result = a - if os.sep != "/": result = result.replace("/", os.sep) - if os.pardir != "..": result = result.replace("..", os.pardir) - return result - -def Join(*args): - result = "" - for a in args[:-1]: - result += a - if result[-1] != "/": - result += "/" - result += args[-1] - return result.replace("//", "/") - -def Exec(command): - c = Path(command) - Echo(c) - result = os.system(c) - if result != 0: Error("execution of an external program failed") - return result - -def TryExec(command): - c = Path(command) - Echo(c) - result = os.system(c) - return result - -def RawExec(command): - Echo(command) - result = os.system(command) - if result != 0: Error("execution of an external program failed") - return result - -def Move(src, dest): - s = Path(src) - d = Path(dest) - try: - shutil.move(s, d) - except IOError, OSError: - Warn("could not move %s to %s" % (s, d)) - -def Copy(src, dest): - s = Path(src) - d = Path(dest) - try: - shutil.copyfile(s, d) - except IOError, OSError: - Warn("could not copy %s to %s" % (s, d)) - -def Remove(f): - try: - os.remove(Path(f)) - except OSError: - Warn("could not remove: %s" % f) - -def RemoveDir(f): - try: - shutil.rmtree(Path(f)) - except OSError: - Warn("could not remove: %s" % f) - -def Exists(f): return os.path.exists(Path(f)) - -def Chdir(dest): - d = Path(dest) - try: - os.chdir(d) - except OSError: - Warn("could not switch to directory: " + d) - -def Mkdir(dest): - d = Path(dest) - try: - os.mkdir(d) - except OSError: - Warn("could not create directory: " + d) - -def Glob(pattern): # needed because glob.glob() is buggy on Windows 95: - # things like tests/t*.mor won't work - global _baseDir - (head, tail) = os.path.split(Path(pattern)) - try: - os.chdir(os.path.join(_baseDir, head)) - result = [] - for f in glob.glob(tail): - result.append(os.path.join(head, f)) - except OSError: - result = [] - finally: - os.chdir(_baseDir) - return result - -def FilenameNoExt(f): - return os.path.splitext(os.path.basename(f))[0] - -def _Ext(trunc, posixFormat, winFormat): - (head, tail) = os.path.split(Path(trunc)) - if os.name == "posix": frmt = posixFormat - else: frmt = winFormat - return os.path.join(head, Subs(frmt, trunc=tail)) - -def DynExt(trunc): - """Makes a dynamic library out of a trunc. This means it either - does '${trunc}.dll' or 'lib${trunc}.so'. - """ - return _Ext(trunc, 'lib${trunc}.so', '${trunc}.dll') - -def LibExt(trunc): - """Makes a static library out of a trunc. This means it either - does '${trunc}.lib' or '${trunc}.a'. - """ - return _Ext(trunc, '${trunc}.a', '${trunc}.lib') - -def ScriptExt(trunc): - """Makes a script out of a trunc. This means it either - does '${trunc}.bat' or '${trunc}.sh'. - """ - return _Ext(trunc, '${trunc}.sh', '${trunc}.bat') - -def ExeExt(trunc): - """Makes an executable out of a trunc. This means it either - does '${trunc}.exe' or '${trunc}'. - """ - return _Ext(trunc, '${trunc}', '${trunc}.exe') - -def MakeExecutable(file): - os.chmod(file, 493) - -# ----------------- Dependency Analyser Core --------------------------------- -# We simply store the rules in a list until building the things. Checking is -# also delayed. -_rules = {} -_importantTargets = [] # used for command line switches -_commands = {} # other commands -# a command is a tuple: (name, description, function, number of arguments) - -def Command(name, desc, func, args=0): - """if args == -1, a variable number of arguments is given to the ``func`` - as a list""" - _commands[name] = (desc, func, args) - -def _applyPath(x): - if type(x) == ListType: - return map(Path, x) - else: - return Path(x) - -def Rule(name = None, desc = "", prereqs = [], cmds = None, outputfile = None, - modifies = []): - """Defines a rule. Name must be a single word, not a file!""" - if not name: - t = "#" + str(len(_rules.keys())) - else: - t = name - if t in _rules: Error("target '%s' already exists!" % t) - _rules[t] = (_applyPath(prereqs), cmds, outputfile, _applyPath(modifies)) - if desc: - _importantTargets.append((t, desc)) - - -class Changed(object): - """ Returns a Changed object. This object evals to true if one of the - given files has changed, false otherwise in a boolean context. You have - to call the object's success() method if the building has been a success. - - Example: - - c = Changed("unique_name", "file1.pas file2.pas file3.pas") - if c: - Exec("fpc file1.pas") - # Exec raises an exception if it fails, thus if we get to here, it was - # a success: - c.success() - """ - def __init__(self, id, files, explain=False, - fingerprintsfile=_FINGERPRINTS_FILE): - # load the fingerprints file: - # fingerprints is a dict[target, files] where files is a dict[filename, hash] - self.fingers = {} # default value - if Exists(fingerprintsfile): - try: - self.fingers = cPickle.load(file(fingerprintsfile)) - except OSError: - Error("Cannot read from " + fingerprintsfile) - self.filename = fingerprintsfile - self.id = id - self.files = files - self._hashStr = zlib.adler32 # our hash function - self.explain = explain - - def _hashFile(self, f): - x = file(f) - result = self._hashStr(x.read()) - x.close() # for other Python implementations - return result - - def __nonzero__(self): - if type(self.files) == type(""): - self.files = self.files.split() - result = False - target = self.id - if not (target in self.fingers): - self.fingers[target] = {} - if self.explain: _Info("no entries for target '%s'" % target) - result = True - for d in self.files: - if Exists(d): - n = self._hashFile(d) - if d not in self.fingers[target] or n != self.fingers[target][d]: - result = True - if self.explain: _Info("'%s' modified since last build" % d) - self.fingers[target][d] = n - else: - Warn("'%s' does not exist!" % d) - result = True - return result - - def update(self, filename): - self.fingers[self.id][filename] = self._hashFile(filename) - - def success(self): - cPickle.dump(self.fingers, file(self.filename, "w+")) - - -class _Koch(object): - def _loadFingerprints(self, filename): - # fingerprints is a dict[target, files] where files is a dict[filename, hash] - if Exists(filename): - try: - self.fingers = cPickle.load(file(filename)) - except OSError: - Error("Cannot read from " + filename) - else: - self.fingers = {} # we have no fingerprints :-( - - def _saveFingerprints(self, filename): - cPickle.dump(self.fingers, file(filename, "w+")) - - def __init__(self, options): - self._loadFingerprints(_FINGERPRINTS_FILE) - self.newfingers = {} - self.rules = _rules - self._hashStr = zlib.adler32 # our hash function - self.options = options - - def _doRebuild(self, cmd): - if cmd is None: return 0 - if type(cmd) is StringType: - if cmd: - c = Path(cmd) - _Info(c) - return os.system(c) - else: - return 0 - elif type(cmd) is FunctionType: - return cmd() - elif type(cmd) is ListType: - for c in cmd: - res = self._doRebuild(c) - if res != 0: break - return res - else: - Error("invalid rule: command must be a string or a function") - - def _hashFile(self, f): - x = file(f) - result = self._hashStr(x.read()) - x.close() # for other Python implementations - return result - - def _getDeps(self, target): - depslist = self.rules[target][0] - if type(depslist) is StringType: - result = depslist.split() - elif type(depslist) is FunctionType: - result = depslist() - elif type(depslist) is ListType: - result = [] - for d in depslist: - if type(d) is StringType: - result.append(d) - elif type(d) is FunctionType: - result.append(d()) - else: - Error("invalid rule: prereqs must be a string, list, or a function") - for i in range(0, len(result)): - result[i] = Path(result[i]) - return result - - def _hasChanged(self, target, d): - if not (target in self.newfingers): - self.newfingers[target] = {} - if Exists(d): - n = self._hashFile(d) - self.newfingers[target][d] = n - if not (target in self.fingers): return True - if not (d in self.fingers[target]): return True - return n != self.fingers[target][d] - else: - Warn("'%s' does not exist!" % d) - return True - - def _makeAux(self, target, callstack={}): - # returns "uptodate", "updated", "failed" - UPTODATE = 1 - UPDATED = 2 - FAILED = 3 - - if target in callstack: return callstack[target] - - def explain(msg): - if 'explain' in self.options: _Info(msg) - - if not (target in self.rules): return UPTODATE # target is up to date - callstack[target] = UPTODATE # assume uptodate until proven otherwise - result = UPTODATE - - # retrieve the dependencies: - deps = self._getDeps(target) - for d in deps: - if d[0] == '#': - t = d[1:] - if not (t in self.rules): - Error("reference to unknown target '%s'" % t) - # it is a target! - #callstack[t] = # XXX: prevend endless recursion! - res = self._makeAux(t, callstack) - result = max(result, res) - if res == UPDATED: - explain("will build '%s' because '%s' modified since last build" % - (target, d)) - elif res == FAILED: - explain("cannot build '%s' because '%s' failed" % - (target, d)) - elif self._hasChanged(target, d): - explain("will build '%s' because '%s' modified since last build" % - (target, d)) - result = max(result, UPDATED) - if self.rules[target][2]: # check if output file exists: - if not Exists(self.rules[target][2]): - explain("will build '%s' because output file '%s' does not exist" % - (target, self.rules[target][2])) - result = max(result, UPDATED) - - if result == UPTODATE and 'force' in self.options: - explain("will build '%s' because forced" % target) - result = max(result, UPDATED) - - if result == UPDATED: - _Info("building target '%s'" % target) - buildRes = self._doRebuild(self.rules[target][1]) - if buildRes is None: - Error("builder for target '%s' did not return an int" % target) - result = FAILED - elif buildRes != 0: - result = FAILED - elif result == UPTODATE: - _Info("'%s' is up to date" % target) - callstack[target] = result - if result == UPDATED: # building was successful, so update fingerprints: - if not (target in self.newfingers): - # for phony targets this check is needed - self.newfingers[target] = {} - for m in self.rules[target][3]: # look for changed files - self._hasChanged(target, m) # call for its side-effects - self.fingers[target] = self.newfingers[target] - return result - - def make(self, target): - self._makeAux(target) - self._saveFingerprints(_FINGERPRINTS_FILE) - -# ----------------------------------------------------------------------------- - -def SplitArg(s): - if ':' in s: c = ':' - elif '=' in s: c = '=' - else: return (s, '') - i = s.find(c) - return (s[:i], s[i+1:]) - -# ----------------------------------------------------------------------------- - -def _writeUsage(): - print("Usage: koch.py [options] command/target [command/target...]\n" - "Options:\n" - " --force, -b, -f forces rebuilding\n" - " --help, -h shows this help\n" - " --explain, -e explain why a target is built\n" - "Available targets:") - for t in _importantTargets: - print(" " + t[0] + " " * (23-len(t[0])) + t[1]) - if len(_commands) > 0: - print("Available commands:") - for k, v in _commands.iteritems(): - print(" " + k + " " * (23-len(k)) + v[0]) - sys.exit(2) - -def Koch(defaultTarget): - argv = sys.argv[1:] - - options = {} - i = 0 - # process general options: - while i < len(argv): - if argv[i][0] == '-': - if argv[i] in ("-h", "--help"): _writeUsage() - elif argv[i] in ("-b", "-B", "--force", "-f"): options['force'] = True - elif argv[i] in ("--explain", "-e"): options['explain'] = True - else: Error("invalid option: '%s'" % argv[i]) - else: break # BUGFIX - i += 1 - - k = _Koch(options) - - # process commands: - i = 0 - while i < len(argv): - if argv[i][0] != '-': # process target/command - if argv[i] in _rules: - k.make(argv[i]) - elif argv[i] in _commands: - cmd = argv[i] - n = _commands[cmd][2] - args = [] - if n < 0: upperBound = len(argv)-1 - else: upperBound = i+n - while i+1 <= upperBound: - if i+1 >= len(argv): - Error("command '%s' expects %d arguments" % (cmd, n)) - args.append(argv[i+1]) - i += 1 - if n < 0: _commands[cmd][1](args) - else: _commands[cmd][1](*args) - else: - Error("Invalid target/command: " + argv[i]) - - i += 1 - if len(argv) == 0: - k.make(defaultTarget) - -if __name__ == "__main__": - Error("You should execute the file 'koch.py' or consult\n" - "the documentation to see how to build this software.") - - diff --git a/lib/ansi_c.nim b/lib/ansi_c.nim index 6691ca4cc..8e39c9e39 100644 --- a/lib/ansi_c.nim +++ b/lib/ansi_c.nim @@ -47,7 +47,7 @@ else: # only Mac OS X has this shit proc c_longjmp(jmpb: C_JmpBuf, retval: cint) {.nodecl, importc: "longjmp".} -proc c_setjmp(jmpb: var C_JmpBuf) {.nodecl, importc: "setjmp".} +proc c_setjmp(jmpb: var C_JmpBuf): cint {.nodecl, importc: "setjmp".} proc c_signal(sig: cint, handler: proc (a: cint) {.noconv.}) {. importc: "signal", header: "<signal.h>".} diff --git a/lib/arithm.nim b/lib/arithm.nim index c8abded91..91a2232c9 100644 --- a/lib/arithm.nim +++ b/lib/arithm.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2006 Andreas Rumpf +# (c) Copyright 2008 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -10,11 +10,11 @@ # simple integer arithmetic with overflow checking -proc raiseOverflow {.exportc: "raiseOverflow".} = +proc raiseOverflow {.compilerproc, noinline.} = # a single proc to reduce code size to a minimum raise newException(EOverflow, "over- or underflow") -proc raiseDivByZero {.exportc: "raiseDivByZero".} = +proc raiseDivByZero {.exportc: "raiseDivByZero", noinline.} = raise newException(EDivByZero, "divison by zero") proc addInt64(a, b: int64): int64 {.compilerProc, inline.} = @@ -75,9 +75,9 @@ proc mulInt64(a, b: int64): int64 {.compilerproc.} = var resAsFloat, floatProd: float64 result = a *% b - floatProd = float64(a) # conversion - floatProd = floatProd * float64(b) - resAsFloat = float64(result) + floatProd = toBiggestFloat(a) # conversion + floatProd = floatProd * toBiggestFloat(b) + resAsFloat = toBiggestFloat(result) # Fast path for normal case: small multiplicands, and no info # is lost in either method. @@ -101,16 +101,14 @@ proc absInt(a: int): int {.compilerProc, inline.} = else: return -a raiseOverflow() -when defined(I386) and (defined(vcc) or defined(wcc) or defined(dmc)): - # or defined(gcc)): - {.define: asmVersion.} - # my Version of Borland C++Builder does not have - # tasm32, which is needed for assembler blocks - # this is why Borland is not included in the 'when' -else: - {.define: useInline.} +const + asmVersion = defined(I386) and (defined(vcc) or defined(wcc) or defined(dmc)) + # my Version of Borland C++Builder does not have + # tasm32, which is needed for assembler blocks + # this is why Borland is not included in the 'when' + useInline = not asmVersion -when defined(asmVersion) and defined(gcc): +when asmVersion and defined(gcc): proc addInt(a, b: int): int {.compilerProc, pure, inline.} proc subInt(a, b: int): int {.compilerProc, pure, inline.} proc mulInt(a, b: int): int {.compilerProc, pure, inline.} @@ -118,7 +116,7 @@ when defined(asmVersion) and defined(gcc): proc modInt(a, b: int): int {.compilerProc, pure, inline.} proc negInt(a: int): int {.compilerProc, pure, inline.} -elif defined(asmVersion): +elif asmVersion: proc addInt(a, b: int): int {.compilerProc, pure.} proc subInt(a, b: int): int {.compilerProc, pure.} proc mulInt(a, b: int): int {.compilerProc, pure.} @@ -126,7 +124,7 @@ elif defined(asmVersion): proc modInt(a, b: int): int {.compilerProc, pure.} proc negInt(a: int): int {.compilerProc, pure.} -elif defined(useInline): +elif useInline: proc addInt(a, b: int): int {.compilerProc, inline.} proc subInt(a, b: int): int {.compilerProc, inline.} proc mulInt(a, b: int): int {.compilerProc.} @@ -145,7 +143,7 @@ else: # implementation: -when defined(asmVersion) and not defined(gcc): +when asmVersion and not defined(gcc): # assembler optimized versions for compilers that # have an intel syntax assembler: proc addInt(a, b: int): int = @@ -210,7 +208,7 @@ when defined(asmVersion) and not defined(gcc): theEnd: """ -elif defined(asmVersion) and defined(gcc): +elif asmVersion and defined(gcc): proc addInt(a, b: int): int = asm """ "addl %1,%%eax\n" "jno 1\n" diff --git a/lib/assign.nim b/lib/assign.nim index 5ac475ef0..3d4bf4d61 100644 --- a/lib/assign.nim +++ b/lib/assign.nim @@ -1,120 +1,120 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2006 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -#when defined(debugGC): -# {.define: logAssign.} -proc genericAssign(dest, src: Pointer, mt: PNimType) {.compilerProc.} -proc genericAssignAux(dest, src: Pointer, n: ptr TNimNode) = - var - d = cast[TAddress](dest) - s = cast[TAddress](src) - case n.kind - of nkNone: assert(false) - of nkSlot: - genericAssign(cast[pointer](d +% n.offset), cast[pointer](s +% n.offset), - n.typ) - of nkList: - for i in 0..n.len-1: - genericAssignAux(dest, src, n.sons[i]) - of nkCase: - copyMem(cast[pointer](d +% n.offset), cast[pointer](s +% n.offset), - n.typ.size) - var m = selectBranch(src, n) - if m != nil: genericAssignAux(dest, src, m) - -proc genericAssign(dest, src: Pointer, mt: PNimType) = - var - d = cast[TAddress](dest) - s = cast[TAddress](src) - - assert(mt != nil) - case mt.Kind - of tySequence: - var s2 = cast[ppointer](src)^ - var seq = cast[PGenericSeq](s2) - if s2 == nil: # this can happen! nil sequences are allowed - var x = cast[ppointer](dest) - x^ = nil - return - assert(dest != nil) - unsureAsgnRef(cast[ppointer](dest), - newObj(mt, seq.len * mt.base.size + GenericSeqSize)) - var dst = cast[taddress](cast[ppointer](dest)^) - for i in 0..seq.len-1: - genericAssign( - cast[pointer](dst +% i*% mt.base.size +% GenericSeqSize), - cast[pointer](cast[taddress](s2) +% i *% mt.base.size +% - GenericSeqSize), - mt.Base) - var dstseq = cast[PGenericSeq](dst) - dstseq.len = seq.len - dstseq.space = seq.len - of tyObject, tyTuple, tyPureObject: - # we don't need to copy m_type field for tyObject, as they are equal anyway - genericAssignAux(dest, src, mt.node) - of tyArray, tyArrayConstr: - for i in 0..(mt.size div mt.base.size)-1: - genericAssign(cast[pointer](d +% i*% mt.base.size), - cast[pointer](s +% i*% mt.base.size), mt.base) - of tyString: # a leaf - var s2 = cast[ppointer](s)^ - if s2 != nil: # nil strings are possible! - unsureAsgnRef(cast[ppointer](dest), copyString(cast[mstring](s2))) - else: - var x = cast[ppointer](dest) - x^ = nil - return - of tyRef: # BUGFIX: a long time this has been forgotten! - unsureAsgnRef(cast[ppointer](dest), cast[ppointer](s)^) - else: - copyMem(dest, src, mt.size) # copy raw bits - -proc genericSeqAssign(dest, src: Pointer, mt: PNimType) {.compilerProc.} = - var src = src # ugly, but I like to stress the parser sometimes :-) - genericAssign(dest, addr(src), mt) - -proc genericAssignOpenArray(dest, src: pointer, len: int, - mt: PNimType) {.compilerproc.} = - var - d = cast[TAddress](dest) - s = cast[TAddress](src) - for i in 0..len-1: - genericAssign(cast[pointer](d +% i*% mt.base.size), - cast[pointer](s +% i*% mt.base.size), mt.base) - -proc objectInit(dest: Pointer, typ: PNimType) {.compilerProc.} -proc objectInitAux(dest: Pointer, n: ptr TNimNode) = - var d = cast[TAddress](dest) - case n.kind - of nkNone: assert(false) - of nkSLot: objectInit(cast[pointer](d +% n.offset), n.typ) - of nkList: - for i in 0..n.len-1: - objectInitAux(dest, n.sons[i]) - of nkCase: - var m = selectBranch(dest, n) - if m != nil: objectInitAux(dest, m) - -proc objectInit(dest: Pointer, typ: PNimType) = - # the generic init proc that takes care of initialization of complex - # objects on the stack or heap - var d = cast[TAddress](dest) - case typ.kind - of tyObject: - # iterate over any structural type - # here we have to init the type field: - var pint = cast[ptr PNimType](dest) - pint^ = typ - objectInitAux(dest, typ.node) - of tyTuple, tyPureObject: - objectInitAux(dest, typ.node) - of tyArray, tyArrayConstr: - for i in 0..(typ.size div typ.base.size)-1: - objectInit(cast[pointer](d +% i * typ.base.size), typ.base) - else: nil # nothing to do +# +# +# Nimrod's Runtime Library +# (c) Copyright 2006 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +#when defined(debugGC): +# {.define: logAssign.} +proc genericAssign(dest, src: Pointer, mt: PNimType) {.compilerProc.} +proc genericAssignAux(dest, src: Pointer, n: ptr TNimNode) = + var + d = cast[TAddress](dest) + s = cast[TAddress](src) + case n.kind + of nkNone: assert(false) + of nkSlot: + genericAssign(cast[pointer](d +% n.offset), cast[pointer](s +% n.offset), + n.typ) + of nkList: + for i in 0..n.len-1: + genericAssignAux(dest, src, n.sons[i]) + of nkCase: + copyMem(cast[pointer](d +% n.offset), cast[pointer](s +% n.offset), + n.typ.size) + var m = selectBranch(src, n) + if m != nil: genericAssignAux(dest, src, m) + +proc genericAssign(dest, src: Pointer, mt: PNimType) = + var + d = cast[TAddress](dest) + s = cast[TAddress](src) + + assert(mt != nil) + case mt.Kind + of tySequence: + var s2 = cast[ppointer](src)^ + var seq = cast[PGenericSeq](s2) + if s2 == nil: # this can happen! nil sequences are allowed + var x = cast[ppointer](dest) + x^ = nil + return + assert(dest != nil) + unsureAsgnRef(cast[ppointer](dest), + newObj(mt, seq.len * mt.base.size + GenericSeqSize)) + var dst = cast[taddress](cast[ppointer](dest)^) + for i in 0..seq.len-1: + genericAssign( + cast[pointer](dst +% i*% mt.base.size +% GenericSeqSize), + cast[pointer](cast[taddress](s2) +% i *% mt.base.size +% + GenericSeqSize), + mt.Base) + var dstseq = cast[PGenericSeq](dst) + dstseq.len = seq.len + dstseq.space = seq.len + of tyObject, tyTuple, tyPureObject: + # we don't need to copy m_type field for tyObject, as they are equal anyway + genericAssignAux(dest, src, mt.node) + of tyArray, tyArrayConstr: + for i in 0..(mt.size div mt.base.size)-1: + genericAssign(cast[pointer](d +% i*% mt.base.size), + cast[pointer](s +% i*% mt.base.size), mt.base) + of tyString: # a leaf + var s2 = cast[ppointer](s)^ + if s2 != nil: # nil strings are possible! + unsureAsgnRef(cast[ppointer](dest), copyString(cast[NimString](s2))) + else: + var x = cast[ppointer](dest) + x^ = nil + return + of tyRef: # BUGFIX: a long time this has been forgotten! + unsureAsgnRef(cast[ppointer](dest), cast[ppointer](s)^) + else: + copyMem(dest, src, mt.size) # copy raw bits + +proc genericSeqAssign(dest, src: Pointer, mt: PNimType) {.compilerProc.} = + var src = src # ugly, but I like to stress the parser sometimes :-) + genericAssign(dest, addr(src), mt) + +proc genericAssignOpenArray(dest, src: pointer, len: int, + mt: PNimType) {.compilerproc.} = + var + d = cast[TAddress](dest) + s = cast[TAddress](src) + for i in 0..len-1: + genericAssign(cast[pointer](d +% i*% mt.base.size), + cast[pointer](s +% i*% mt.base.size), mt.base) + +proc objectInit(dest: Pointer, typ: PNimType) {.compilerProc.} +proc objectInitAux(dest: Pointer, n: ptr TNimNode) = + var d = cast[TAddress](dest) + case n.kind + of nkNone: assert(false) + of nkSLot: objectInit(cast[pointer](d +% n.offset), n.typ) + of nkList: + for i in 0..n.len-1: + objectInitAux(dest, n.sons[i]) + of nkCase: + var m = selectBranch(dest, n) + if m != nil: objectInitAux(dest, m) + +proc objectInit(dest: Pointer, typ: PNimType) = + # the generic init proc that takes care of initialization of complex + # objects on the stack or heap + var d = cast[TAddress](dest) + case typ.kind + of tyObject: + # iterate over any structural type + # here we have to init the type field: + var pint = cast[ptr PNimType](dest) + pint^ = typ + objectInitAux(dest, typ.node) + of tyTuple, tyPureObject: + objectInitAux(dest, typ.node) + of tyArray, tyArrayConstr: + for i in 0..(typ.size div typ.base.size)-1: + objectInit(cast[pointer](d +% i * typ.base.size), typ.base) + else: nil # nothing to do diff --git a/lib/base/cairo/cairo.nim b/lib/base/cairo/cairo.nim index d2a99f355..6da8183f3 100644 --- a/lib/base/cairo/cairo.nim +++ b/lib/base/cairo/cairo.nim @@ -58,7 +58,7 @@ else: type PByte = cstring - cairo_status_t* = enum + TCairoStatus* = enum CAIRO_STATUS_SUCCESS = 0, CAIRO_STATUS_NO_MEMORY, CAIRO_STATUS_INVALID_RESTORE, CAIRO_STATUS_INVALID_POP_GROUP, CAIRO_STATUS_NO_CURRENT_POINT, CAIRO_STATUS_INVALID_MATRIX, @@ -69,93 +69,93 @@ type CAIRO_STATUS_PATTERN_TYPE_MISMATCH, CAIRO_STATUS_INVALID_CONTENT, CAIRO_STATUS_INVALID_FORMAT, CAIRO_STATUS_INVALID_VISUAL, CAIRO_STATUS_FILE_NOT_FOUND, CAIRO_STATUS_INVALID_DASH - cairo_operator_t* = enum + TCairoOperator* = enum CAIRO_OPERATOR_CLEAR, CAIRO_OPERATOR_SOURCE, CAIRO_OPERATOR_OVER, CAIRO_OPERATOR_IN, CAIRO_OPERATOR_OUT, CAIRO_OPERATOR_ATOP, CAIRO_OPERATOR_DEST, CAIRO_OPERATOR_DEST_OVER, CAIRO_OPERATOR_DEST_IN, CAIRO_OPERATOR_DEST_OUT, CAIRO_OPERATOR_DEST_ATOP, CAIRO_OPERATOR_XOR, CAIRO_OPERATOR_ADD, CAIRO_OPERATOR_SATURATE - cairo_antialias_t* = enum + TCairoAntialias* = enum CAIRO_ANTIALIAS_DEFAULT, CAIRO_ANTIALIAS_NONE, CAIRO_ANTIALIAS_GRAY, CAIRO_ANTIALIAS_SUBPIXEL - cairo_fill_rule_t* = enum + TCairoFillRule* = enum CAIRO_FILL_RULE_WINDING, CAIRO_FILL_RULE_EVEN_ODD - cairo_line_cap_t* = enum + TCairoLineCap* = enum CAIRO_LINE_CAP_BUTT, CAIRO_LINE_CAP_ROUND, CAIRO_LINE_CAP_SQUARE - cairo_line_join_t* = enum + TCairoLineJoin* = enum CAIRO_LINE_JOIN_MITER, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_JOIN_BEVEL - cairo_font_slant_t* = enum + TCairoFontSlant* = enum CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_SLANT_OBLIQUE - cairo_font_weight_t* = enum + TCairoFontWeight* = enum CAIRO_FONT_WEIGHT_NORMAL, CAIRO_FONT_WEIGHT_BOLD - cairo_subpixel_order_t* = enum + TCairoSubpixelOrder* = enum CAIRO_SUBPIXEL_ORDER_DEFAULT, CAIRO_SUBPIXEL_ORDER_RGB, CAIRO_SUBPIXEL_ORDER_BGR, CAIRO_SUBPIXEL_ORDER_VRGB, CAIRO_SUBPIXEL_ORDER_VBGR - cairo_hint_style_t* = enum + TCairoHintStyle* = enum CAIRO_HINT_STYLE_DEFAULT, CAIRO_HINT_STYLE_NONE, CAIRO_HINT_STYLE_SLIGHT, CAIRO_HINT_STYLE_MEDIUM, CAIRO_HINT_STYLE_FULL - cairo_hint_metrics_t* = enum + TCairoHintMetrics* = enum CAIRO_HINT_METRICS_DEFAULT, CAIRO_HINT_METRICS_OFF, CAIRO_HINT_METRICS_ON - cairo_path_data_type_t* = enum + TCairoPathDataType* = enum CAIRO_PATH_MOVE_TO, CAIRO_PATH_LINE_TO, CAIRO_PATH_CURVE_TO, CAIRO_PATH_CLOSE_PATH - cairo_content_t* = enum + TCairoContent* = enum CAIRO_CONTENT_COLOR = 0x00001000, CAIRO_CONTENT_ALPHA = 0x00002000, CAIRO_CONTENT_COLOR_ALPHA = 0x00003000 - cairo_format_t* = enum + TCairoFormat* = enum CAIRO_FORMAT_ARGB32, CAIRO_FORMAT_RGB24, CAIRO_FORMAT_A8, CAIRO_FORMAT_A1 - cairo_extend_t* = enum + TCairoExtend* = enum CAIRO_EXTEND_NONE, CAIRO_EXTEND_REPEAT, CAIRO_EXTEND_REFLECT, CAIRO_EXTEND_PAD - cairo_filter_t* = enum + TCairoFilter* = enum CAIRO_FILTER_FAST, CAIRO_FILTER_GOOD, CAIRO_FILTER_BEST, CAIRO_FILTER_NEAREST, CAIRO_FILTER_BILINEAR, CAIRO_FILTER_GAUSSIAN - cairo_font_type_t* = enum + TCairoFontType* = enum CAIRO_FONT_TYPE_TOY, CAIRO_FONT_TYPE_FT, CAIRO_FONT_TYPE_WIN32, CAIRO_FONT_TYPE_ATSUI - cairo_pattern_type_t* = enum + TCairoPatternType* = enum CAIRO_PATTERN_TYPE_SOLID, CAIRO_PATTERN_TYPE_SURFACE, CAIRO_PATTERN_TYPE_LINEAR, CAIRO_PATTERN_TYPE_RADIAL - cairo_surface_type_t* = enum + TCairoSurfaceType* = enum CAIRO_SURFACE_TYPE_IMAGE, CAIRO_SURFACE_TYPE_PDF, CAIRO_SURFACE_TYPE_PS, CAIRO_SURFACE_TYPE_XLIB, CAIRO_SURFACE_TYPE_XCB, CAIRO_SURFACE_TYPE_GLITZ, CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_SURFACE_TYPE_WIN32, CAIRO_SURFACE_TYPE_BEOS, CAIRO_SURFACE_TYPE_DIRECTFB, CAIRO_SURFACE_TYPE_SVG, CAIRO_SURFACE_TYPE_OS2 - cairo_svg_version_t* = enum + TCairoSvgVersion* = enum CAIRO_SVG_VERSION_1_1, CAIRO_SVG_VERSION_1_2 - Pcairo_surface_t* = ref cairo_surface_t - PPcairo_surface_t* = ref Pcairo_surface_t - Pcairo_t* = ref cairo_t - Pcairo_pattern_t* = ref cairo_pattern_t - Pcairo_font_options_t* = ref cairo_font_options_t - Pcairo_font_face_t* = ref cairo_font_face_t - Pcairo_scaled_font_t* = ref cairo_scaled_font_t - Pcairo_bool_t* = ref cairo_bool_t - cairo_bool_t* = int32 - Pcairo_matrix_t* = ref cairo_matrix_t - Pcairo_user_data_key_t* = ref cairo_user_data_key_t - Pcairo_glyph_t* = ref cairo_glyph_t - Pcairo_text_extents_t* = ref cairo_text_extents_t - Pcairo_font_extents_t* = ref cairo_font_extents_t - Pcairo_path_data_type_t* = ref cairo_path_data_type_t - Pcairo_path_data_t* = ref cairo_path_data_t - Pcairo_path_t* = ref cairo_path_t - Pcairo_rectangle_t* = ref cairo_rectangle_t - Pcairo_rectangle_list_t* = ref cairo_rectangle_list_t - cairo_destroy_func_t* = proc (data: Pointer){.cdecl.} - cairo_write_func_t* = proc (closure: Pointer, data: PByte, len: int32): cairo_status_t{. + PCairoSurface* = ptr TCairoSurface + PPCairoSurface* = ptr PCairoSurface + PCairo* = ptr TCairo + PCairoPattern* = ptr TCairoPattern + PCairoFontOptions* = ptr TCairoFontOptions + PCairoFontFace* = ptr TCairoFontFace + PCairoScaledFont* = ptr TCairoScaledFont + PCairoBool* = ptr TCairoBool + TCairoBool* = int32 + PCairoMatrix* = ptr TCairoMatrix + PCairoUserDataKey* = ptr TCairoUserDataKey + PCairoGlyph* = ptr TCairoGlyph + PCairoTextExtents* = ptr TCairoTextExtents + PCairoFontExtents* = ptr TCairoFontExtents + PCairoPathDataType* = ptr TCairoPathDataType + PCairoPathData* = ptr TCairoPathData + PCairoPath* = ptr TCairoPath + PCairoRectangle* = ptr TCairoRectangle + PCairoRectangleList* = ptr TCairoRectangleList + TCairoDestroyFunc* = proc (data: Pointer){.cdecl.} + TCairoWriteFunc* = proc (closure: Pointer, data: PByte, len: int32): TCairoStatus{. cdecl.} - cairo_read_func_t* = proc (closure: Pointer, data: PByte, len: int32): cairo_status_t{. + TCairoReadFunc* = proc (closure: Pointer, data: PByte, len: int32): TCairoStatus{. cdecl.} - cairo_t* {.final.} = object #OPAQUE - cairo_surface_t* {.final.} = object #OPAQUE - cairo_pattern_t* {.final.} = object #OPAQUE - cairo_scaled_font_t* {.final.} = object #OPAQUE - cairo_font_face_t* {.final.} = object #OPAQUE - cairo_font_options_t* {.final.} = object #OPAQUE - cairo_matrix_t* {.final.} = object + TCairo* {.final.} = object #OPAQUE + TCairoSurface* {.final.} = object #OPAQUE + TCairoPattern* {.final.} = object #OPAQUE + TCairoScaledFont* {.final.} = object #OPAQUE + TCairoFontFace* {.final.} = object #OPAQUE + TCairoFontOptions* {.final.} = object #OPAQUE + TCairoMatrix* {.final.} = object xx: float64 yx: float64 xy: float64 @@ -163,15 +163,15 @@ type x0: float64 y0: float64 - cairo_user_data_key_t* {.final.} = object + TCairoUserDataKey* {.final.} = object unused: int32 - cairo_glyph_t* {.final.} = object + TCairoGlyph* {.final.} = object index: int32 x: float64 y: float64 - cairo_text_extents_t* {.final.} = object + TCairoTextExtents* {.final.} = object x_bearing: float64 y_bearing: float64 width: float64 @@ -179,30 +179,30 @@ type x_advance: float64 y_advance: float64 - cairo_font_extents_t* {.final.} = object + TCairoFontExtents* {.final.} = object ascent: float64 descent: float64 height: float64 max_x_advance: float64 max_y_advance: float64 - cairo_path_data_t* {.final.} = object #* _type : cairo_path_data_type_t; - # length : LongInt; - # end + TCairoPathData* {.final.} = object #* _type : TCairoPathDataType; + # length : LongInt; + # end x: float64 y: float64 - cairo_path_t* {.final.} = object - status: cairo_status_t - data: Pcairo_path_data_t + TCairoPath* {.final.} = object + status: TCairoStatus + data: PCairoPathData num_data: int32 - cairo_rectangle_t* {.final.} = object + TCairoRectangle* {.final.} = object x, y, width, height: float64 - cairo_rectangle_list_t* {.final.} = object - status: cairo_status_t - rectangles: Pcairo_rectangle_t + TCairoRectangleList* {.final.} = object + status: TCairoStatus + rectangles: PCairoRectangle num_rectangles: int32 @@ -211,480 +211,480 @@ proc cairo_version_string*(): cstring{.cdecl, importc, dynlib: LIB_CAIRO.} #Helper function to retrieve decoded version proc cairo_version*(major, minor, micro: var int32) #* Functions for manipulating state objects -proc cairo_create*(target: Pcairo_surface_t): Pcairo_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_reference*(cr: Pcairo_t): Pcairo_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_destroy*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_reference_count*(cr: Pcairo_t): int32{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_user_data*(cr: Pcairo_t, key: Pcairo_user_data_key_t): pointer{. - cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_user_data*(cr: PCairo_t, key: Pcairo_user_data_key_t, - user_data: Pointer, destroy: cairo_destroy_func_t): cairo_status_t{. - cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_save*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_restore*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_push_group*(cr: PCairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_push_group_with_content*(cr: PCairo_t, content: cairo_content_t){. - cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pop_group*(cr: PCairo_t): Pcairo_pattern_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pop_group_to_source*(cr: PCairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_create*(target: PCairoSurface): PCairo{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_reference*(cr: PCairo): PCairo{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_destroy*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_get_reference_count*(cr: PCairo): int32{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_get_user_data*(cr: PCairo, key: PCairoUserDataKey): pointer{. + cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_set_user_data*(cr: PCairo, key: PCairoUserDataKey, + user_data: Pointer, destroy: TCairoDestroyFunc): TCairoStatus{. + cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_save*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_restore*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_push_group*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_push_group_with_content*(cr: PCairo, content: TCairoContent){. + cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_pop_group*(cr: PCairo): PCairoPattern{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_pop_group_to_source*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} #* Modify state -proc cairo_set_operator*(cr: Pcairo_t, op: cairo_operator_t){.cdecl, importc, +proc cairo_set_operator*(cr: PCairo, op: TCairoOperator){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_source*(cr: Pcairo_t, source: Pcairo_pattern_t){.cdecl, importc, +proc cairo_set_source*(cr: PCairo, source: PCairoPattern){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_source_rgb*(cr: Pcairo_t, red, green, blue: float64){.cdecl, importc, +proc cairo_set_source_rgb*(cr: PCairo, red, green, blue: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_source_rgba*(cr: Pcairo_t, red, green, blue, alpha: float64){. +proc cairo_set_source_rgba*(cr: PCairo, red, green, blue, alpha: float64){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_source_surface*(cr: Pcairo_t, surface: Pcairo_surface_t, +proc cairo_set_source_surface*(cr: PCairo, surface: PCairoSurface, x, y: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_tolerance*(cr: Pcairo_t, tolerance: float64){.cdecl, importc, +proc cairo_set_tolerance*(cr: PCairo, tolerance: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_antialias*(cr: Pcairo_t, antialias: cairo_antialias_t){.cdecl, importc, +proc cairo_set_antialias*(cr: PCairo, antialias: TCairoAntialias){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_fill_rule*(cr: Pcairo_t, fill_rule: cairo_fill_rule_t){.cdecl, importc, +proc cairo_set_fill_rule*(cr: PCairo, fill_rule: TCairoFillRule){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_line_width*(cr: Pcairo_t, width: float64){.cdecl, importc, +proc cairo_set_line_width*(cr: PCairo, width: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_line_cap*(cr: Pcairo_t, line_cap: cairo_line_cap_t){.cdecl, importc, +proc cairo_set_line_cap*(cr: PCairo, line_cap: TCairoLineCap){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_line_join*(cr: Pcairo_t, line_join: cairo_line_join_t){.cdecl, importc, +proc cairo_set_line_join*(cr: PCairo, line_join: TCairoLineJoin){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_dash*(cr: Pcairo_t, dashes: openarray[float64], +proc cairo_set_dash*(cr: PCairo, dashes: openarray[float64], offset: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_miter_limit*(cr: Pcairo_t, limit: float64){.cdecl, importc, +proc cairo_set_miter_limit*(cr: PCairo, limit: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_translate*(cr: Pcairo_t, tx, ty: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scale*(cr: Pcairo_t, sx, sy: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_rotate*(cr: Pcairo_t, angle: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_transform*(cr: Pcairo_t, matrix: Pcairo_matrix_t){.cdecl, importc, +proc cairo_translate*(cr: PCairo, tx, ty: float64){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_scale*(cr: PCairo, sx, sy: float64){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_rotate*(cr: PCairo, angle: float64){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_transform*(cr: PCairo, matrix: PCairoMatrix){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_matrix*(cr: Pcairo_t, matrix: Pcairo_matrix_t){.cdecl, importc, +proc cairo_set_matrix*(cr: PCairo, matrix: PCairoMatrix){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_identity_matrix*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_user_to_device*(cr: Pcairo_t, x, y: var float64){.cdecl, importc, +proc cairo_identity_matrix*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_user_to_device*(cr: PCairo, x, y: var float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_user_to_device_distance*(cr: Pcairo_t, dx, dy: var float64){.cdecl, importc, +proc cairo_user_to_device_distance*(cr: PCairo, dx, dy: var float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_device_to_user*(cr: Pcairo_t, x, y: var float64){.cdecl, importc, +proc cairo_device_to_user*(cr: PCairo, x, y: var float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_device_to_user_distance*(cr: Pcairo_t, dx, dy: var float64){.cdecl, importc, +proc cairo_device_to_user_distance*(cr: PCairo, dx, dy: var float64){.cdecl, importc, dynlib: LIB_CAIRO.} #* Path creation functions -proc cairo_new_path*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_move_to*(cr: Pcairo_t, x, y: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_new_sub_path*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_line_to*(cr: Pcairo_t, x, y: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_curve_to*(cr: Pcairo_t, x1, y1, x2, y2, x3, y3: float64){.cdecl, importc, +proc cairo_new_path*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_move_to*(cr: PCairo, x, y: float64){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_new_sub_path*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_line_to*(cr: PCairo, x, y: float64){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_curve_to*(cr: PCairo, x1, y1, x2, y2, x3, y3: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_arc*(cr: Pcairo_t, xc, yc, radius, angle1, angle2: float64){.cdecl, importc, +proc cairo_arc*(cr: PCairo, xc, yc, radius, angle1, angle2: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_arc_negative*(cr: Pcairo_t, xc, yc, radius, angle1, angle2: float64){. +proc cairo_arc_negative*(cr: PCairo, xc, yc, radius, angle1, angle2: float64){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_rel_move_to*(cr: Pcairo_t, dx, dy: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_rel_line_to*(cr: Pcairo_t, dx, dy: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_rel_curve_to*(cr: Pcairo_t, dx1, dy1, dx2, dy2, dx3, dy3: float64){. +proc cairo_rel_move_to*(cr: PCairo, dx, dy: float64){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_rel_line_to*(cr: PCairo, dx, dy: float64){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_rel_curve_to*(cr: PCairo, dx1, dy1, dx2, dy2, dx3, dy3: float64){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_rectangle*(cr: Pcairo_t, x, y, width, height: float64){.cdecl, importc, +proc cairo_rectangle*(cr: PCairo, x, y, width, height: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_close_path*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_close_path*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} #* Painting functions -proc cairo_paint*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_paint_with_alpha*(cr: Pcairo_t, alpha: float64){.cdecl, importc, +proc cairo_paint*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_paint_with_alpha*(cr: PCairo, alpha: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_mask*(cr: Pcairo_t, pattern: Pcairo_pattern_t){.cdecl, importc, +proc cairo_mask*(cr: PCairo, pattern: PCairoPattern){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_mask_surface*(cr: Pcairo_t, surface: Pcairo_surface_t, +proc cairo_mask_surface*(cr: PCairo, surface: PCairoSurface, surface_x, surface_y: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_stroke*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_stroke_preserve*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_fill*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_fill_preserve*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_copy_page*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_show_page*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_stroke*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_stroke_preserve*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_fill*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_fill_preserve*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_copy_page*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_show_page*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} #* Insideness testing -proc cairo_in_stroke*(cr: Pcairo_t, x, y: float64): cairo_bool_t{.cdecl, importc, +proc cairo_in_stroke*(cr: PCairo, x, y: float64): TCairoBool{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_in_fill*(cr: Pcairo_t, x, y: float64): cairo_bool_t{.cdecl, importc, +proc cairo_in_fill*(cr: PCairo, x, y: float64): TCairoBool{.cdecl, importc, dynlib: LIB_CAIRO.} #* Rectangular extents -proc cairo_stroke_extents*(cr: Pcairo_t, x1, y1, x2, y2: var float64){.cdecl, importc, +proc cairo_stroke_extents*(cr: PCairo, x1, y1, x2, y2: var float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_fill_extents*(cr: Pcairo_t, x1, y1, x2, y2: var float64){.cdecl, importc, +proc cairo_fill_extents*(cr: PCairo, x1, y1, x2, y2: var float64){.cdecl, importc, dynlib: LIB_CAIRO.} #* Clipping -proc cairo_reset_clip*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_clip*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_clip_preserve*(cr: Pcairo_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_clip_extents*(cr: Pcairo_t, x1, y1, x2, y2: var float64){.cdecl, importc, +proc cairo_reset_clip*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_clip*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_clip_preserve*(cr: PCairo){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_clip_extents*(cr: PCairo, x1, y1, x2, y2: var float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_copy_clip_rectangle_list*(cr: Pcairo_t): Pcairo_rectangle_list_t{. +proc cairo_copy_clip_rectangle_list*(cr: PCairo): PCairoRectangleList{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_rectangle_list_destroy*(rectangle_list: Pcairo_rectangle_list_t){. +proc cairo_rectangle_list_destroy*(rectangle_list: PCairoRectangleList){. cdecl, importc, dynlib: LIB_CAIRO.} #* Font/Text functions -proc cairo_font_options_create*(): Pcairo_font_options_t{.cdecl, importc, +proc cairo_font_options_create*(): PCairoFontOptions{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_copy*(original: Pcairo_font_options_t): Pcairo_font_options_t{. +proc cairo_font_options_copy*(original: PCairoFontOptions): PCairoFontOptions{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_destroy*(options: Pcairo_font_options_t){.cdecl, importc, +proc cairo_font_options_destroy*(options: PCairoFontOptions){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_status*(options: Pcairo_font_options_t): cairo_status_t{. +proc cairo_font_options_status*(options: PCairoFontOptions): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_merge*(options, other: Pcairo_font_options_t){.cdecl, importc, +proc cairo_font_options_merge*(options, other: PCairoFontOptions){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_equal*(options, other: Pcairo_font_options_t): cairo_bool_t{. +proc cairo_font_options_equal*(options, other: PCairoFontOptions): TCairoBool{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_hash*(options: Pcairo_font_options_t): int32{.cdecl, importc, +proc cairo_font_options_hash*(options: PCairoFontOptions): int32{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_set_antialias*(options: Pcairo_font_options_t, - antialias: cairo_antialias_t){.cdecl, importc, +proc cairo_font_options_set_antialias*(options: PCairoFontOptions, + antialias: TCairoAntialias){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_get_antialias*(options: Pcairo_font_options_t): cairo_antialias_t{. +proc cairo_font_options_get_antialias*(options: PCairoFontOptions): TCairoAntialias{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_set_subpixel_order*(options: Pcairo_font_options_t, - subpixel_order: cairo_subpixel_order_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_get_subpixel_order*(options: Pcairo_font_options_t): cairo_subpixel_order_t{. +proc cairo_font_options_set_subpixel_order*(options: PCairoFontOptions, + subpixel_order: TCairoSubpixelOrder){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_font_options_get_subpixel_order*(options: PCairoFontOptions): TCairoSubpixelOrder{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_set_hint_style*(options: Pcairo_font_options_t, - hint_style: cairo_hint_style_t){.cdecl, importc, +proc cairo_font_options_set_hint_style*(options: PCairoFontOptions, + hint_style: TCairoHintStyle){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_get_hint_style*(options: Pcairo_font_options_t): cairo_hint_style_t{. +proc cairo_font_options_get_hint_style*(options: PCairoFontOptions): TCairoHintStyle{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_set_hint_metrics*(options: Pcairo_font_options_t, - hint_metrics: cairo_hint_metrics_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_options_get_hint_metrics*(options: Pcairo_font_options_t): cairo_hint_metrics_t{. +proc cairo_font_options_set_hint_metrics*(options: PCairoFontOptions, + hint_metrics: TCairoHintMetrics){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_font_options_get_hint_metrics*(options: PCairoFontOptions): TCairoHintMetrics{. cdecl, importc, dynlib: LIB_CAIRO.} #* This interface is for dealing with text as text, not caring about the - # font object inside the the cairo_t. -proc cairo_select_font_face*(cr: Pcairo_t, family: cstring, - slant: cairo_font_slant_t, - weight: cairo_font_weight_t){.cdecl, importc, + # font object inside the the TCairo. +proc cairo_select_font_face*(cr: PCairo, family: cstring, + slant: TCairoFontSlant, + weight: TCairoFontWeight){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_font_size*(cr: Pcairo_t, size: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_font_matrix*(cr: Pcairo_t, matrix: Pcairo_matrix_t){.cdecl, importc, +proc cairo_set_font_size*(cr: PCairo, size: float64){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_set_font_matrix*(cr: PCairo, matrix: PCairoMatrix){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_font_matrix*(cr: Pcairo_t, matrix: Pcairo_matrix_t){.cdecl, importc, +proc cairo_get_font_matrix*(cr: PCairo, matrix: PCairoMatrix){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_font_options*(cr: Pcairo_t, options: Pcairo_font_options_t){. +proc cairo_set_font_options*(cr: PCairo, options: PCairoFontOptions){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_font_options*(cr: Pcairo_t, options: Pcairo_font_options_t){. +proc cairo_get_font_options*(cr: PCairo, options: PCairoFontOptions){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_font_face*(cr: Pcairo_t, font_face: Pcairo_font_face_t){.cdecl, importc, +proc cairo_set_font_face*(cr: PCairo, font_face: PCairoFontFace){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_font_face*(cr: Pcairo_t): Pcairo_font_face_t{.cdecl, importc, +proc cairo_get_font_face*(cr: PCairo): PCairoFontFace{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_set_scaled_font*(cr: PCairo_t, scaled_font: Pcairo_scaled_font_t){. +proc cairo_set_scaled_font*(cr: PCairo, scaled_font: PCairoScaledFont){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_scaled_font*(cr: Pcairo_t): Pcairo_scaled_font_t{.cdecl, importc, +proc cairo_get_scaled_font*(cr: PCairo): PCairoScaledFont{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_show_text*(cr: Pcairo_t, utf8: cstring){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_show_glyphs*(cr: Pcairo_t, glyphs: Pcairo_glyph_t, num_glyphs: int32){. +proc cairo_show_text*(cr: PCairo, utf8: cstring){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_show_glyphs*(cr: PCairo, glyphs: PCairoGlyph, num_glyphs: int32){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_text_path*(cr: Pcairo_t, utf8: cstring){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_glyph_path*(cr: Pcairo_t, glyphs: Pcairo_glyph_t, num_glyphs: int32){. +proc cairo_text_path*(cr: PCairo, utf8: cstring){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_glyph_path*(cr: PCairo, glyphs: PCairoGlyph, num_glyphs: int32){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_text_extents*(cr: Pcairo_t, utf8: cstring, - extents: Pcairo_text_extents_t){.cdecl, importc, +proc cairo_text_extents*(cr: PCairo, utf8: cstring, + extents: PCairoTextExtents){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_glyph_extents*(cr: Pcairo_t, glyphs: Pcairo_glyph_t, - num_glyphs: int32, extents: Pcairo_text_extents_t){. +proc cairo_glyph_extents*(cr: PCairo, glyphs: PCairoGlyph, + num_glyphs: int32, extents: PCairoTextExtents){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_extents*(cr: Pcairo_t, extents: Pcairo_font_extents_t){.cdecl, importc, +proc cairo_font_extents*(cr: PCairo, extents: PCairoFontExtents){.cdecl, importc, dynlib: LIB_CAIRO.} #* Generic identifier for a font style -proc cairo_font_face_reference*(font_face: Pcairo_font_face_t): Pcairo_font_face_t{. +proc cairo_font_face_reference*(font_face: PCairoFontFace): PCairoFontFace{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_face_destroy*(font_face: Pcairo_font_face_t){.cdecl, importc, +proc cairo_font_face_destroy*(font_face: PCairoFontFace){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_face_get_reference_count*(font_face: Pcairo_font_face_t): int32{. +proc cairo_font_face_get_reference_count*(font_face: PCairoFontFace): int32{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_face_status*(font_face: Pcairo_font_face_t): cairo_status_t{. +proc cairo_font_face_status*(font_face: PCairoFontFace): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_face_get_type*(font_face: Pcairo_font_face_t): cairo_font_type_t{. +proc cairo_font_face_get_type*(font_face: PCairoFontFace): TCairoFontType{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_face_get_user_data*(font_face: Pcairo_font_face_t, - key: Pcairo_user_data_key_t): pointer{. +proc cairo_font_face_get_user_data*(font_face: PCairoFontFace, + key: PCairoUserDataKey): pointer{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_font_face_set_user_data*(font_face: Pcairo_font_face_t, - key: Pcairo_user_data_key_t, +proc cairo_font_face_set_user_data*(font_face: PCairoFontFace, + key: PCairoUserDataKey, user_data: pointer, - destroy: cairo_destroy_func_t): cairo_status_t{. + destroy: TCairoDestroyFunc): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} #* Portable interface to general font features -proc cairo_scaled_font_create*(font_face: Pcairo_font_face_t, - font_matrix: Pcairo_matrix_t, - ctm: Pcairo_matrix_t, - options: Pcairo_font_options_t): Pcairo_scaled_font_t{. +proc cairo_scaled_font_create*(font_face: PCairoFontFace, + font_matrix: PCairoMatrix, + ctm: PCairoMatrix, + options: PCairoFontOptions): PCairoScaledFont{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_reference*(scaled_font: Pcairo_scaled_font_t): Pcairo_scaled_font_t{. +proc cairo_scaled_font_reference*(scaled_font: PCairoScaledFont): PCairoScaledFont{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_destroy*(scaled_font: Pcairo_scaled_font_t){.cdecl, importc, +proc cairo_scaled_font_destroy*(scaled_font: PCairoScaledFont){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_get_reference_count*(scaled_font: Pcairo_scaled_font_t): int32{. +proc cairo_scaled_font_get_reference_count*(scaled_font: PCairoScaledFont): int32{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_status*(scaled_font: Pcairo_scaled_font_t): cairo_status_t{. +proc cairo_scaled_font_status*(scaled_font: PCairoScaledFont): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_get_type*(scaled_font: Pcairo_scaled_font_t): cairo_font_type_t{. +proc cairo_scaled_font_get_type*(scaled_font: PCairoScaledFont): TCairoFontType{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_get_user_data*(scaled_font: Pcairo_scaled_font_t, - key: Pcairo_user_data_key_t): Pointer{. +proc cairo_scaled_font_get_user_data*(scaled_font: PCairoScaledFont, + key: PCairoUserDataKey): Pointer{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_set_user_data*(scaled_font: Pcairo_scaled_font_t, - key: Pcairo_user_data_key_t, +proc cairo_scaled_font_set_user_data*(scaled_font: PCairoScaledFont, + key: PCairoUserDataKey, user_data: Pointer, - destroy: cairo_destroy_func_t): cairo_status_t{. + destroy: TCairoDestroyFunc): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_extents*(scaled_font: Pcairo_scaled_font_t, - extents: Pcairo_font_extents_t){.cdecl, importc, +proc cairo_scaled_font_extents*(scaled_font: PCairoScaledFont, + extents: PCairoFontExtents){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_text_extents*(scaled_font: Pcairo_scaled_font_t, +proc cairo_scaled_font_text_extents*(scaled_font: PCairoScaledFont, utf8: cstring, - extents: Pcairo_text_extents_t){.cdecl, importc, + extents: PCairoTextExtents){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_glyph_extents*(scaled_font: Pcairo_scaled_font_t, - glyphs: Pcairo_glyph_t, num_glyphs: int32, - extents: Pcairo_text_extents_t){.cdecl, importc, +proc cairo_scaled_font_glyph_extents*(scaled_font: PCairoScaledFont, + glyphs: PCairoGlyph, num_glyphs: int32, + extents: PCairoTextExtents){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_get_font_face*(scaled_font: Pcairo_scaled_font_t): Pcairo_font_face_t{. +proc cairo_scaled_font_get_font_face*(scaled_font: PCairoScaledFont): PCairoFontFace{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_get_font_matrix*(scaled_font: Pcairo_scaled_font_t, - font_matrix: Pcairo_matrix_t){.cdecl, importc, +proc cairo_scaled_font_get_font_matrix*(scaled_font: PCairoScaledFont, + font_matrix: PCairoMatrix){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_get_ctm*(scaled_font: Pcairo_scaled_font_t, - ctm: Pcairo_matrix_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_scaled_font_get_font_options*(scaled_font: Pcairo_scaled_font_t, - options: Pcairo_font_options_t){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_scaled_font_get_ctm*(scaled_font: PCairoScaledFont, + ctm: PCairoMatrix){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_scaled_font_get_font_options*(scaled_font: PCairoScaledFont, + options: PCairoFontOptions){.cdecl, importc, dynlib: LIB_CAIRO.} #* Query functions -proc cairo_get_operator*(cr: Pcairo_t): cairo_operator_t{.cdecl, importc, +proc cairo_get_operator*(cr: PCairo): TCairoOperator{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_source*(cr: Pcairo_t): Pcairo_pattern_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_tolerance*(cr: Pcairo_t): float64{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_antialias*(cr: Pcairo_t): cairo_antialias_t{.cdecl, importc, +proc cairo_get_source*(cr: PCairo): PCairoPattern{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_get_tolerance*(cr: PCairo): float64{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_get_antialias*(cr: PCairo): TCairoAntialias{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_current_point*(cr: Pcairo_t, x, y: var float64){.cdecl, importc, +proc cairo_get_current_point*(cr: PCairo, x, y: var float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_fill_rule*(cr: Pcairo_t): cairo_fill_rule_t{.cdecl, importc, +proc cairo_get_fill_rule*(cr: PCairo): TCairoFillRule{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_line_width*(cr: Pcairo_t): float64{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_line_cap*(cr: Pcairo_t): cairo_line_cap_t{.cdecl, importc, +proc cairo_get_line_width*(cr: PCairo): float64{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_get_line_cap*(cr: PCairo): TCairoLineCap{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_line_join*(cr: Pcairo_t): cairo_line_join_t{.cdecl, importc, +proc cairo_get_line_join*(cr: PCairo): TCairoLineJoin{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_miter_limit*(cr: Pcairo_t): float64{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_dash_count*(cr: Pcairo_t): int32{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_dash*(cr: Pcairo_t, dashes, offset: var float64){.cdecl, importc, +proc cairo_get_miter_limit*(cr: PCairo): float64{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_get_dash_count*(cr: PCairo): int32{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_get_dash*(cr: PCairo, dashes, offset: var float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_matrix*(cr: Pcairo_t, matrix: Pcairo_matrix_t){.cdecl, importc, +proc cairo_get_matrix*(cr: PCairo, matrix: PCairoMatrix){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_target*(cr: Pcairo_t): Pcairo_surface_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_get_group_target*(cr: Pcairo_t): Pcairo_surface_t{.cdecl, importc, +proc cairo_get_target*(cr: PCairo): PCairoSurface{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_get_group_target*(cr: PCairo): PCairoSurface{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_copy_path*(cr: Pcairo_t): Pcairo_path_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_copy_path_flat*(cr: Pcairo_t): Pcairo_path_t{.cdecl, importc, +proc cairo_copy_path*(cr: PCairo): PCairoPath{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_copy_path_flat*(cr: PCairo): PCairoPath{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_append_path*(cr: Pcairo_t, path: Pcairo_path_t){.cdecl, importc, +proc cairo_append_path*(cr: PCairo, path: PCairoPath){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_path_destroy*(path: Pcairo_path_t){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_path_destroy*(path: PCairoPath){.cdecl, importc, dynlib: LIB_CAIRO.} #* Error status queries -proc cairo_status*(cr: Pcairo_t): cairo_status_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_status_to_string*(status: cairo_status_t): cstring{.cdecl, importc, +proc cairo_status*(cr: PCairo): TCairoStatus{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_status_to_string*(status: TCairoStatus): cstring{.cdecl, importc, dynlib: LIB_CAIRO.} #* Surface manipulation -proc cairo_surface_create_similar*(other: Pcairo_surface_t, - content: cairo_content_t, - width, height: int32): Pcairo_surface_t{. +proc cairo_surface_create_similar*(other: PCairoSurface, + content: TCairoContent, + width, height: int32): PCairoSurface{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_reference*(surface: Pcairo_surface_t): Pcairo_surface_t{. +proc cairo_surface_reference*(surface: PCairoSurface): PCairoSurface{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_finish*(surface: Pcairo_surface_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_destroy*(surface: Pcairo_surface_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_get_reference_count*(surface: Pcairo_surface_t): int32{. +proc cairo_surface_finish*(surface: PCairoSurface){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_surface_destroy*(surface: PCairoSurface){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_surface_get_reference_count*(surface: PCairoSurface): int32{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_status*(surface: Pcairo_surface_t): cairo_status_t{.cdecl, importc, +proc cairo_surface_status*(surface: PCairoSurface): TCairoStatus{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_get_type*(surface: Pcairo_surface_t): cairo_surface_type_t{. +proc cairo_surface_get_type*(surface: PCairoSurface): TCairoSurfaceType{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_get_content*(surface: Pcairo_surface_t): cairo_content_t{. +proc cairo_surface_get_content*(surface: PCairoSurface): TCairoContent{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_write_to_png*(surface: Pcairo_surface_t, filename: cstring): cairo_status_t{. +proc cairo_surface_write_to_png*(surface: PCairoSurface, filename: cstring): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_write_to_png_stream*(surface: Pcairo_surface_t, - write_func: cairo_write_func_t, - closure: pointer): cairo_status_t{. +proc cairo_surface_write_to_png_stream*(surface: PCairoSurface, + write_func: TCairoWriteFunc, + closure: pointer): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_get_user_data*(surface: Pcairo_surface_t, - key: Pcairo_user_data_key_t): pointer{.cdecl, importc, +proc cairo_surface_get_user_data*(surface: PCairoSurface, + key: PCairoUserDataKey): pointer{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_set_user_data*(surface: Pcairo_surface_t, - key: Pcairo_user_data_key_t, +proc cairo_surface_set_user_data*(surface: PCairoSurface, + key: PCairoUserDataKey, user_data: pointer, - destroy: cairo_destroy_func_t): cairo_status_t{. + destroy: TCairoDestroyFunc): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_get_font_options*(surface: Pcairo_surface_t, - options: Pcairo_font_options_t){.cdecl, importc, +proc cairo_surface_get_font_options*(surface: PCairoSurface, + options: PCairoFontOptions){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_flush*(surface: Pcairo_surface_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_mark_dirty*(surface: Pcairo_surface_t){.cdecl, importc, +proc cairo_surface_flush*(surface: PCairoSurface){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_surface_mark_dirty*(surface: PCairoSurface){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_mark_dirty_rectangle*(surface: Pcairo_surface_t, +proc cairo_surface_mark_dirty_rectangle*(surface: PCairoSurface, x, y, width, height: int32){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_set_device_offset*(surface: Pcairo_surface_t, +proc cairo_surface_set_device_offset*(surface: PCairoSurface, x_offset, y_offset: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_get_device_offset*(surface: Pcairo_surface_t, +proc cairo_surface_get_device_offset*(surface: PCairoSurface, x_offset, y_offset: var float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_surface_set_fallback_resolution*(surface: Pcairo_surface_t, +proc cairo_surface_set_fallback_resolution*(surface: PCairoSurface, x_pixels_per_inch, y_pixels_per_inch: float64){.cdecl, importc, dynlib: LIB_CAIRO.} #* Image-surface functions -proc cairo_image_surface_create*(format: cairo_format_t, width, height: int32): Pcairo_surface_t{. +proc cairo_image_surface_create*(format: TCairoFormat, width, height: int32): PCairoSurface{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_image_surface_create_for_data*(data: Pbyte, format: cairo_format_t, - width, height, stride: int32): Pcairo_surface_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_image_surface_get_data*(surface: Pcairo_surface_t): cstring{.cdecl, importc, +proc cairo_image_surface_create_for_data*(data: Pbyte, format: TCairoFormat, + width, height, stride: int32): PCairoSurface{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_image_surface_get_data*(surface: PCairoSurface): cstring{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_image_surface_get_format*(surface: Pcairo_surface_t): cairo_format_t{. +proc cairo_image_surface_get_format*(surface: PCairoSurface): TCairoFormat{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_image_surface_get_width*(surface: Pcairo_surface_t): int32{.cdecl, importc, +proc cairo_image_surface_get_width*(surface: PCairoSurface): int32{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_image_surface_get_height*(surface: Pcairo_surface_t): int32{.cdecl, importc, +proc cairo_image_surface_get_height*(surface: PCairoSurface): int32{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_image_surface_get_stride*(surface: Pcairo_surface_t): int32{.cdecl, importc, +proc cairo_image_surface_get_stride*(surface: PCairoSurface): int32{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_image_surface_create_from_png*(filename: cstring): Pcairo_surface_t{. +proc cairo_image_surface_create_from_png*(filename: cstring): PCairoSurface{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_image_surface_create_from_png_stream*(read_func: cairo_read_func_t, - closure: pointer): Pcairo_surface_t{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_image_surface_create_from_png_stream*(read_func: TCairoReadFunc, + closure: pointer): PCairoSurface{.cdecl, importc, dynlib: LIB_CAIRO.} #* Pattern creation functions -proc cairo_pattern_create_rgb*(red, green, blue: float64): Pcairo_pattern_t{. +proc cairo_pattern_create_rgb*(red, green, blue: float64): PCairoPattern{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_create_rgba*(red, green, blue, alpha: float64): Pcairo_pattern_t{. +proc cairo_pattern_create_rgba*(red, green, blue, alpha: float64): PCairoPattern{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_create_for_surface*(surface: Pcairo_surface_t): Pcairo_pattern_t{. +proc cairo_pattern_create_for_surface*(surface: PCairoSurface): PCairoPattern{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_create_linear*(x0, y0, x1, y1: float64): Pcairo_pattern_t{. +proc cairo_pattern_create_linear*(x0, y0, x1, y1: float64): PCairoPattern{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_create_radial*(cx0, cy0, radius0, cx1, cy1, radius1: float64): Pcairo_pattern_t{. +proc cairo_pattern_create_radial*(cx0, cy0, radius0, cx1, cy1, radius1: float64): PCairoPattern{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_reference*(pattern: Pcairo_pattern_t): Pcairo_pattern_t{. +proc cairo_pattern_reference*(pattern: PCairoPattern): PCairoPattern{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_destroy*(pattern: Pcairo_pattern_t){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_get_reference_count*(pattern: Pcairo_pattern_t): int32{. +proc cairo_pattern_destroy*(pattern: PCairoPattern){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_pattern_get_reference_count*(pattern: PCairoPattern): int32{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_status*(pattern: Pcairo_pattern_t): cairo_status_t{.cdecl, importc, +proc cairo_pattern_status*(pattern: PCairoPattern): TCairoStatus{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_get_user_data*(pattern: Pcairo_pattern_t, - key: Pcairo_user_data_key_t): Pointer{.cdecl, importc, +proc cairo_pattern_get_user_data*(pattern: PCairoPattern, + key: PCairoUserDataKey): Pointer{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_set_user_data*(pattern: Pcairo_pattern_t, - key: Pcairo_user_data_key_t, +proc cairo_pattern_set_user_data*(pattern: PCairoPattern, + key: PCairoUserDataKey, user_data: Pointer, - destroy: cairo_destroy_func_t): cairo_status_t{. + destroy: TCairoDestroyFunc): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_get_type*(pattern: Pcairo_pattern_t): cairo_pattern_type_t{. +proc cairo_pattern_get_type*(pattern: PCairoPattern): TCairoPatternType{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_add_color_stop_rgb*(pattern: Pcairo_pattern_t, +proc cairo_pattern_add_color_stop_rgb*(pattern: PCairoPattern, offset, red, green, blue: float64){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_add_color_stop_rgba*(pattern: Pcairo_pattern_t, offset, red, +proc cairo_pattern_add_color_stop_rgba*(pattern: PCairoPattern, offset, red, green, blue, alpha: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_set_matrix*(pattern: Pcairo_pattern_t, - matrix: Pcairo_matrix_t){.cdecl, importc, +proc cairo_pattern_set_matrix*(pattern: PCairoPattern, + matrix: PCairoMatrix){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_get_matrix*(pattern: Pcairo_pattern_t, - matrix: Pcairo_matrix_t){.cdecl, importc, +proc cairo_pattern_get_matrix*(pattern: PCairoPattern, + matrix: PCairoMatrix){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_set_extend*(pattern: Pcairo_pattern_t, extend: cairo_extend_t){. +proc cairo_pattern_set_extend*(pattern: PCairoPattern, extend: TCairoExtend){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_get_extend*(pattern: Pcairo_pattern_t): cairo_extend_t{. +proc cairo_pattern_get_extend*(pattern: PCairoPattern): TCairoExtend{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_set_filter*(pattern: Pcairo_pattern_t, filter: cairo_filter_t){. +proc cairo_pattern_set_filter*(pattern: PCairoPattern, filter: TCairoFilter){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_get_filter*(pattern: Pcairo_pattern_t): cairo_filter_t{. +proc cairo_pattern_get_filter*(pattern: PCairoPattern): TCairoFilter{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_get_rgba*(pattern: Pcairo_pattern_t, - red, green, blue, alpha: var float64): cairo_status_t{. +proc cairo_pattern_get_rgba*(pattern: PCairoPattern, + red, green, blue, alpha: var float64): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_get_surface*(pattern: Pcairo_pattern_t, - surface: PPcairo_surface_t): cairo_status_t{. +proc cairo_pattern_get_surface*(pattern: PCairoPattern, + surface: PPCairoSurface): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_get_color_stop_rgba*(pattern: Pcairo_pattern_t, index: int32, - offset, red, green, blue, alpha: var float64): cairo_status_t{.cdecl, importc, +proc cairo_pattern_get_color_stop_rgba*(pattern: PCairoPattern, index: int32, + offset, red, green, blue, alpha: var float64): TCairoStatus{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_get_color_stop_count*(pattern: Pcairo_pattern_t, - count: var int32): cairo_status_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_get_linear_points*(pattern: Pcairo_pattern_t, - x0, y0, x1, y1: var float64): cairo_status_t{. +proc cairo_pattern_get_color_stop_count*(pattern: PCairoPattern, + count: var int32): TCairoStatus{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_pattern_get_linear_points*(pattern: PCairoPattern, + x0, y0, x1, y1: var float64): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pattern_get_radial_circles*(pattern: Pcairo_pattern_t, - x0, y0, r0, x1, y1, r1: var float64): cairo_status_t{. +proc cairo_pattern_get_radial_circles*(pattern: PCairoPattern, + x0, y0, r0, x1, y1, r1: var float64): TCairoStatus{. cdecl, importc, dynlib: LIB_CAIRO.} #* Matrix functions -proc cairo_matrix_init*(matrix: Pcairo_matrix_t, xx, yx, xy, yy, x0, y0: float64){. +proc cairo_matrix_init*(matrix: PCairoMatrix, xx, yx, xy, yy, x0, y0: float64){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_matrix_init_identity*(matrix: Pcairo_matrix_t){.cdecl, importc, +proc cairo_matrix_init_identity*(matrix: PCairoMatrix){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_matrix_init_translate*(matrix: Pcairo_matrix_t, tx, ty: float64){. +proc cairo_matrix_init_translate*(matrix: PCairoMatrix, tx, ty: float64){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_matrix_init_scale*(matrix: Pcairo_matrix_t, sx, sy: float64){.cdecl, importc, +proc cairo_matrix_init_scale*(matrix: PCairoMatrix, sx, sy: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_matrix_init_rotate*(matrix: Pcairo_matrix_t, radians: float64){. +proc cairo_matrix_init_rotate*(matrix: PCairoMatrix, radians: float64){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_matrix_translate*(matrix: Pcairo_matrix_t, tx, ty: float64){.cdecl, importc, +proc cairo_matrix_translate*(matrix: PCairoMatrix, tx, ty: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_matrix_scale*(matrix: Pcairo_matrix_t, sx, sy: float64){.cdecl, importc, +proc cairo_matrix_scale*(matrix: PCairoMatrix, sx, sy: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_matrix_rotate*(matrix: Pcairo_matrix_t, radians: float64){.cdecl, importc, +proc cairo_matrix_rotate*(matrix: PCairoMatrix, radians: float64){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_matrix_invert*(matrix: Pcairo_matrix_t): cairo_status_t{.cdecl, importc, +proc cairo_matrix_invert*(matrix: PCairoMatrix): TCairoStatus{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_matrix_multiply*(result, a, b: Pcairo_matrix_t){.cdecl, importc, +proc cairo_matrix_multiply*(result, a, b: PCairoMatrix){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_matrix_transform_distance*(matrix: Pcairo_matrix_t, dx, dy: var float64){. +proc cairo_matrix_transform_distance*(matrix: PCairoMatrix, dx, dy: var float64){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_matrix_transform_point*(matrix: Pcairo_matrix_t, x, y: var float64){. +proc cairo_matrix_transform_point*(matrix: PCairoMatrix, x, y: var float64){. cdecl, importc, dynlib: LIB_CAIRO.} #* PDF functions proc cairo_pdf_surface_create*(filename: cstring, - width_in_points, height_in_points: float64): Pcairo_surface_t{. + width_in_points, height_in_points: float64): PCairoSurface{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pdf_surface_create_for_stream*(write_func: cairo_write_func_t, - closure: Pointer, width_in_points, height_in_points: float64): Pcairo_surface_t{. +proc cairo_pdf_surface_create_for_stream*(write_func: TCairoWriteFunc, + closure: Pointer, width_in_points, height_in_points: float64): PCairoSurface{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_pdf_surface_set_size*(surface: Pcairo_surface_t, +proc cairo_pdf_surface_set_size*(surface: PCairoSurface, width_in_points, height_in_points: float64){. cdecl, importc, dynlib: LIB_CAIRO.} #* PS functions proc cairo_ps_surface_create*(filename: cstring, - width_in_points, height_in_points: float64): Pcairo_surface_t{. + width_in_points, height_in_points: float64): PCairoSurface{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_ps_surface_create_for_stream*(write_func: cairo_write_func_t, - closure: Pointer, width_in_points, height_in_points: float64): Pcairo_surface_t{. +proc cairo_ps_surface_create_for_stream*(write_func: TCairoWriteFunc, + closure: Pointer, width_in_points, height_in_points: float64): PCairoSurface{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_ps_surface_set_size*(surface: Pcairo_surface_t, +proc cairo_ps_surface_set_size*(surface: PCairoSurface, width_in_points, height_in_points: float64){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_ps_surface_dsc_comment*(surface: Pcairo_surface_t, comment: cstring){. +proc cairo_ps_surface_dsc_comment*(surface: PCairoSurface, comment: cstring){. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_ps_surface_dsc_begin_setup*(surface: Pcairo_surface_t){.cdecl, importc, +proc cairo_ps_surface_dsc_begin_setup*(surface: PCairoSurface){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_ps_surface_dsc_begin_page_setup*(surface: Pcairo_surface_t){.cdecl, importc, +proc cairo_ps_surface_dsc_begin_page_setup*(surface: PCairoSurface){.cdecl, importc, dynlib: LIB_CAIRO.} #* SVG functions proc cairo_svg_surface_create*(filename: cstring, - width_in_points, height_in_points: float64): Pcairo_surface_t{. + width_in_points, height_in_points: float64): PCairoSurface{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_svg_surface_create_for_stream*(write_func: cairo_write_func_t, - closure: Pointer, width_in_points, height_in_points: float64): Pcairo_surface_t{. +proc cairo_svg_surface_create_for_stream*(write_func: TCairoWriteFunc, + closure: Pointer, width_in_points, height_in_points: float64): PCairoSurface{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_svg_surface_restrict_to_version*(surface: Pcairo_surface_t, - version: cairo_svg_version_t){.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_svg_surface_restrict_to_version*(surface: PCairoSurface, + version: TCairoSvgVersion){.cdecl, importc, dynlib: LIB_CAIRO.} #todo: see how translate this - #procedure cairo_svg_get_versions(cairo_svg_version_t const **versions, + #procedure cairo_svg_get_versions(TCairoSvgVersion const **versions, # int *num_versions); -proc cairo_svg_version_to_string*(version: cairo_svg_version_t): cstring{.cdecl, importc, +proc cairo_svg_version_to_string*(version: TCairoSvgVersion): cstring{.cdecl, importc, dynlib: LIB_CAIRO.} #* Functions to be used while debugging (not intended for use in production code) proc cairo_debug_reset_static_data*(){.cdecl, importc, dynlib: LIB_CAIRO.} @@ -693,6 +693,6 @@ proc cairo_debug_reset_static_data*(){.cdecl, importc, dynlib: LIB_CAIRO.} proc cairo_version(major, minor, micro: var int32) = var version: int32 version = cairo_version() - major = version div 10000 - minor = (version mod (major * 10000)) div 100 - micro = (version mod ((major * 10000) + (minor * 100))) + major = version div 10000'i32 + minor = (version mod (major * 10000'i32)) div 100'i32 + micro = (version mod ((major * 10000'i32) + (minor * 100'i32))) diff --git a/lib/base/cairo/cairoft.nim b/lib/base/cairo/cairoft.nim index c564d1afa..2418aa922 100644 --- a/lib/base/cairo/cairoft.nim +++ b/lib/base/cairo/cairoft.nim @@ -4,7 +4,7 @@ # updated to version 1.4 by Luiz Américo Pereira Câmara 2007 # -import Cairo, freetypeh +import cairo, freetypeh #todo: properly define FcPattern: #It will require translate FontConfig header @@ -20,17 +20,17 @@ import Cairo, freetypeh type FcPattern* = Pointer - PFcPattern* = ref FcPattern + PFcPattern* = ptr FcPattern -proc cairo_ft_font_face_create_for_pattern*(pattern: PFcPattern): Pcairo_font_face_t{. +proc cairo_ft_font_face_create_for_pattern*(pattern: PFcPattern): PCairoFontFace{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_ft_font_options_substitute*(options: Pcairo_font_options_t, +proc cairo_ft_font_options_substitute*(options: PCairoFontOptions, pattern: PFcPattern){.cdecl, importc, dynlib: LIB_CAIRO.} proc cairo_ft_font_face_create_for_ft_face*(face: TFT_Face, - load_flags: int32): Pcairo_font_face_t {.cdecl, importc, dynlib: LIB_CAIRO.} + load_flags: int32): PCairoFontFace {.cdecl, importc, dynlib: LIB_CAIRO.} proc cairo_ft_scaled_font_lock_face*( - scaled_font: Pcairo_scaled_font_t): TFT_Face{.cdecl, importc, dynlib: LIB_CAIRO.} + scaled_font: PCairoScaledFont): TFT_Face{.cdecl, importc, dynlib: LIB_CAIRO.} proc cairo_ft_scaled_font_unlock_face*( - scaled_font: Pcairo_scaled_font_t){.cdecl, importc, dynlib: LIB_CAIRO.} + scaled_font: PCairoScaledFont){.cdecl, importc, dynlib: LIB_CAIRO.} diff --git a/lib/base/cairo/cairowin32.nim b/lib/base/cairo/cairowin32.nim index cbd1a6d4c..5d07c2611 100644 --- a/lib/base/cairo/cairowin32.nim +++ b/lib/base/cairo/cairowin32.nim @@ -7,30 +7,30 @@ import Cairo, windows -proc cairo_win32_surface_create*(hdc: HDC): Pcairo_surface_t{.cdecl, importc, +proc cairo_win32_surface_create*(hdc: HDC): PCairoSurface{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_win32_surface_create_with_ddb*(hdc: HDC, format: cairo_format_t, - width, height: int32): Pcairo_surface_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_win32_surface_create_with_dib*(format: cairo_format_t, - width, height: int32): Pcairo_surface_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_win32_surface_get_dc*(surface: pcairo_surface_t): HDC{.cdecl, importc, +proc cairo_win32_surface_create_with_ddb*(hdc: HDC, format: TCairoFormat, + width, height: int32): PCairoSurface{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_win32_surface_create_with_dib*(format: TCairoFormat, + width, height: int32): PCairoSurface{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_win32_surface_get_dc*(surface: PCairoSurface): HDC{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_win32_surface_get_image*(surface: pcairo_surface_t): Pcairo_surface_t{. +proc cairo_win32_surface_get_image*(surface: PCairoSurface): PCairoSurface{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_win32_font_face_create_for_logfontw*(logfont: pLOGFONTW): Pcairo_font_face_t{. +proc cairo_win32_font_face_create_for_logfontw*(logfont: pLOGFONTW): PCairoFontFace{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_win32_font_face_create_for_hfont*(font: HFONT): Pcairo_font_face_t{. +proc cairo_win32_font_face_create_for_hfont*(font: HFONT): PCairoFontFace{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_win32_scaled_font_select_font*(scaled_font: pcairo_scaled_font_t, - hdc: HDC): cairo_status_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_win32_scaled_font_done_font*(scaled_font: pcairo_scaled_font_t){. +proc cairo_win32_scaled_font_select_font*(scaled_font: PCairoScaledFont, + hdc: HDC): TCairoStatus{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_win32_scaled_font_done_font*(scaled_font: PCairoScaledFont){. cdecl, importc, dynlib: LIB_CAIRO.} proc cairo_win32_scaled_font_get_metrics_factor*( - scaled_font: pcairo_scaled_font_t): float64{.cdecl, importc, dynlib: LIB_CAIRO.} + scaled_font: PCairoScaledFont): float64{.cdecl, importc, dynlib: LIB_CAIRO.} proc cairo_win32_scaled_font_get_logical_to_device*( - scaled_font: pcairo_scaled_font_t, logical_to_device: pcairo_matrix_t){. + scaled_font: PCairoScaledFont, logical_to_device: PCairoMatrix){. cdecl, importc, dynlib: LIB_CAIRO.} proc cairo_win32_scaled_font_get_device_to_logical*( - scaled_font: pcairo_scaled_font_t, device_to_logical: pcairo_matrix_t){. + scaled_font: PCairoScaledFont, device_to_logical: PCairoMatrix){. cdecl, importc, dynlib: LIB_CAIRO.} # implementation diff --git a/lib/base/cairo/cairoxlib.nim b/lib/base/cairo/cairoxlib.nim index 61a9fb283..dfe44eb87 100644 --- a/lib/base/cairo/cairoxlib.nim +++ b/lib/base/cairo/cairoxlib.nim @@ -9,32 +9,32 @@ import Cairo, x, xlib, xrender proc cairo_xlib_surface_create*(dpy: PDisplay, drawable: TDrawable, - visual: PVisual, width, height: int32): Pcairo_surface_t{. + visual: PVisual, width, height: int32): PCairoSurface{. cdecl, importc, dynlib: LIB_CAIRO.} proc cairo_xlib_surface_create_for_bitmap*(dpy: PDisplay, bitmap: TPixmap, - screen: PScreen, width, height: int32): Pcairo_surface_t{.cdecl, importc, + screen: PScreen, width, height: int32): PCairoSurface{.cdecl, importc, dynlib: LIB_CAIRO.} proc cairo_xlib_surface_create_with_xrender_format*(dpy: PDisplay, drawable: TDrawable, screen: PScreen, format: PXRenderPictFormat, - width, height: int32): Pcairo_surface_t{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_xlib_surface_get_depth*(surface: Pcairo_surface_t): int32{.cdecl, importc, + width, height: int32): PCairoSurface{.cdecl, importc, dynlib: LIB_CAIRO.} +proc cairo_xlib_surface_get_depth*(surface: PCairoSurface): int32{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_xlib_surface_get_display*(surface: Pcairo_surface_t): PDisplay{. +proc cairo_xlib_surface_get_display*(surface: PCairoSurface): PDisplay{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_xlib_surface_get_drawable*(surface: Pcairo_surface_t): TDrawable{. +proc cairo_xlib_surface_get_drawable*(surface: PCairoSurface): TDrawable{. cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_xlib_surface_get_height*(surface: Pcairo_surface_t): int32{.cdecl, importc, +proc cairo_xlib_surface_get_height*(surface: PCairoSurface): int32{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_xlib_surface_get_screen*(surface: Pcairo_surface_t): PScreen{.cdecl, importc, +proc cairo_xlib_surface_get_screen*(surface: PCairoSurface): PScreen{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_xlib_surface_get_visual*(surface: Pcairo_surface_t): PVisual{.cdecl, importc, +proc cairo_xlib_surface_get_visual*(surface: PCairoSurface): PVisual{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_xlib_surface_get_width*(surface: Pcairo_surface_t): int32{.cdecl, importc, +proc cairo_xlib_surface_get_width*(surface: PCairoSurface): int32{.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_xlib_surface_set_size*(surface: Pcairo_surface_t, +proc cairo_xlib_surface_set_size*(surface: PCairoSurface, width, height: int32){.cdecl, importc, dynlib: LIB_CAIRO.} -proc cairo_xlib_surface_set_drawable*(surface: Pcairo_surface_t, +proc cairo_xlib_surface_set_drawable*(surface: PCairoSurface, drawable: TDrawable, width, height: int32){. cdecl, importc, dynlib: LIB_CAIRO.} # implementation diff --git a/lib/base/dialogs.nim b/lib/base/dialogs.nim index cd9c7c6b8..144283a69 100644 --- a/lib/base/dialogs.nim +++ b/lib/base/dialogs.nim @@ -90,7 +90,7 @@ proc ChooseFileToOpen*(window: PWindow, root: string = ""): string = GTK_STOCK_OPEN, GTK_RESPONSE_OK, nil)) if root.len > 0: discard gtk_file_chooser_set_current_folder(chooser, root) - if gtk_dialog_run(chooser) == GTK_RESPONSE_OK: + if gtk_dialog_run(chooser) == cint(GTK_RESPONSE_OK): var x = gtk_file_chooser_get_filename(chooser) result = $x g_free(x) @@ -99,7 +99,7 @@ proc ChooseFileToOpen*(window: PWindow, root: string = ""): string = gtk_widget_destroy(chooser) proc ChooseFilesToOpen*(window: PWindow, root: string = ""): seq[string] = - ## Opens a dialog that requests filenames from the user. Returns [] + ## Opens a dialog that requests filenames from the user. Returns ``@[]`` ## if the user closed the dialog without selecting a file. On Windows, ## the native dialog is used, else the GTK dialog is used. when defined(Windows): @@ -114,7 +114,7 @@ proc ChooseFilesToOpen*(window: PWindow, root: string = ""): seq[string] = opf.lpstrFile = buf opf.nMaxFile = sizeof(buf) var res = GetOpenFileName(addr(opf)) - result = [] + result = @[] if res != 0: # parsing the result is horrible: var @@ -145,8 +145,8 @@ proc ChooseFilesToOpen*(window: PWindow, root: string = ""): seq[string] = if root.len > 0: discard gtk_file_chooser_set_current_folder(chooser, root) gtk_file_chooser_set_select_multiple(chooser, true) - result = [] - if gtk_dialog_run(chooser) == GTK_RESPONSE_OK: + result = @[] + if gtk_dialog_run(chooser) == cint(GTK_RESPONSE_OK): var L = gtk_file_chooser_get_filenames(chooser) var it = L while it != nil: @@ -187,7 +187,7 @@ proc ChooseFileToSave*(window: PWindow, root: string = ""): string = if root.len > 0: discard gtk_file_chooser_set_current_folder(chooser, root) gtk_file_chooser_set_do_overwrite_confirmation(chooser, true) - if gtk_dialog_run(chooser) == GTK_RESPONSE_OK: + if gtk_dialog_run(chooser) == cint(GTK_RESPONSE_OK): var x = gtk_file_chooser_get_filename(chooser) result = $x g_free(x) @@ -224,7 +224,7 @@ proc ChooseDir*(window: PWindow, root: string = ""): string = GTK_STOCK_OPEN, GTK_RESPONSE_OK, nil)) if root.len > 0: discard gtk_file_chooser_set_current_folder(chooser, root) - if gtk_dialog_run(chooser) == GTK_RESPONSE_OK: + if gtk_dialog_run(chooser) == cint(GTK_RESPONSE_OK): var x = gtk_file_chooser_get_filename(chooser) result = $x g_free(x) diff --git a/lib/base/gtk/atk.nim b/lib/base/gtk/atk.nim index 96fde8af6..84017bf03 100644 --- a/lib/base/gtk/atk.nim +++ b/lib/base/gtk/atk.nim @@ -2,7 +2,6 @@ import glib2 when defined(windows): - {.define: atkwin.} const atklib = "libatk-1.0-0.dll" else: diff --git a/lib/base/gtk/gdk2.nim b/lib/base/gtk/gdk2.nim index 621a64bca..497f5619f 100644 --- a/lib/base/gtk/gdk2.nim +++ b/lib/base/gtk/gdk2.nim @@ -1,13 +1,12 @@ -import +import glib2, gdk2pixbuf, pango -when defined(win32): - {.define: GDK_WINDOWING_WIN32.} - const +when defined(win32): + const gdklib = "libgdk-win32-2.0-0.dll" GDK_HAVE_WCHAR_H = 1 GDK_HAVE_WCTYPE_H = 1 -elif defined(darwin): +elif defined(darwin): # linklib gtk-x11-2.0 # linklib gdk-x11-2.0 # linklib pango-1.0.0 @@ -15,16 +14,16 @@ elif defined(darwin): # linklib gobject-2.0.0 # linklib gdk_pixbuf-2.0.0 # linklib atk-1.0.0 - const + const gdklib = "gdk-x11-2.0" -else: - const +else: + const gdklib = "libgdk-x11-2.0.so" -const +const NUMPTSTOBUFFER* = 200 GDK_MAX_TIMECOORD_AXES* = 128 -type +type PGdkDeviceClass* = ptr TGdkDeviceClass TGdkDeviceClass* = object of TGObjectClass @@ -32,7 +31,7 @@ type TGdkVisualClass* = object of TGObjectClass PGdkColor* = ptr TGdkColor - TGdkColor* {.final.} = object + TGdkColor* {.final.} = object pixel*: guint32 red*: guint16 green*: guint16 @@ -49,37 +48,37 @@ type PGdkBitmap* = ptr TGdkBitmap TGdkBitmap* = TGdkDrawable PGdkFontType* = ptr TGdkFontType - TGdkFontType* = enum + TGdkFontType* = enum GDK_FONT_FONT, GDK_FONT_FONTSET PGdkFont* = ptr TGdkFont - TGdkFont* {.final.} = object + TGdkFont* {.final.} = object `type`*: TGdkFontType ascent*: gint descent*: gint PGdkFunction* = ptr TGdkFunction - TGdkFunction* = enum - GDK_COPY, GDK_INVERT, GDK_XOR, GDK_CLEAR, GDK_AND, GDK_AND_REVERSE, - GDK_AND_INVERT, GDK_NOOP, GDK_OR, GDK_EQUIV, GDK_OR_REVERSE, + TGdkFunction* = enum + GDK_COPY, GDK_INVERT, GDK_XOR, GDK_CLEAR, GDK_AND, GDK_AND_REVERSE, + GDK_AND_INVERT, GDK_NOOP, GDK_OR, GDK_EQUIV, GDK_OR_REVERSE, GDK_COPY_INVERT, GDK_OR_INVERT, GDK_NAND, GDK_NOR, GDK_SET PGdkCapStyle* = ptr TGdkCapStyle - TGdkCapStyle* = enum + TGdkCapStyle* = enum GDK_CAP_NOT_LAST, GDK_CAP_BUTT, GDK_CAP_ROUND, GDK_CAP_PROJECTING PGdkFill* = ptr TGdkFill - TGdkFill* = enum + TGdkFill* = enum GDK_SOLID, GDK_TILED, GDK_STIPPLED, GDK_OPAQUE_STIPPLED PGdkJoinStyle* = ptr TGdkJoinStyle - TGdkJoinStyle* = enum + TGdkJoinStyle* = enum GDK_JOIN_MITER, GDK_JOIN_ROUND, GDK_JOIN_BEVEL PGdkLineStyle* = ptr TGdkLineStyle - TGdkLineStyle* = enum + TGdkLineStyle* = enum GDK_LINE_SOLID, GDK_LINE_ON_OFF_DASH, GDK_LINE_DOUBLE_DASH PGdkSubwindowMode* = ptr TGdkSubwindowMode TGdkSubwindowMode* = int PGdkGCValuesMask* = ptr TGdkGCValuesMask TGdkGCValuesMask* = int32 PGdkGCValues* = ptr TGdkGCValues - TGdkGCValues* {.final.} = object + TGdkGCValues* {.final.} = object foreground*: TGdkColor background*: TGdkColor font*: PGdkFont @@ -108,14 +107,14 @@ type colormap*: PGdkColormap PGdkImageType* = ptr TGdkImageType - TGdkImageType* = enum + TGdkImageType* = enum GDK_IMAGE_NORMAL, GDK_IMAGE_SHARED, GDK_IMAGE_FASTEST PGdkImage* = ptr TGdkImage PGdkDevice* = ptr TGdkDevice PGdkTimeCoord* = ptr TGdkTimeCoord PPGdkTimeCoord* = ptr PGdkTimeCoord PGdkRgbDither* = ptr TGdkRgbDither - TGdkRgbDither* = enum + TGdkRgbDither* = enum GDK_RGB_DITHER_NONE, GDK_RGB_DITHER_NORMAL, GDK_RGB_DITHER_MAX PGdkDisplay* = ptr TGdkDisplay PGdkScreen* = ptr TGdkScreen @@ -125,7 +124,7 @@ type TGdkInputCondition* = int32 PGdkStatus* = ptr TGdkStatus TGdkStatus* = int32 - TGdkPoint* {.final.} = object + TGdkPoint* {.final.} = object x*: gint y*: gint @@ -135,14 +134,14 @@ type PGdkWChar* = ptr TGdkWChar TGdkWChar* = guint32 PGdkSegment* = ptr TGdkSegment - TGdkSegment* {.final.} = object + TGdkSegment* {.final.} = object x1*: gint y1*: gint x2*: gint y2*: gint PGdkRectangle* = ptr TGdkRectangle - TGdkRectangle* {.final.} = object + TGdkRectangle* {.final.} = object x*: gint y*: gint width*: gint @@ -151,13 +150,13 @@ type PGdkAtom* = ptr TGdkAtom TGdkAtom* = gulong PGdkByteOrder* = ptr TGdkByteOrder - TGdkByteOrder* = enum + TGdkByteOrder* = enum GDK_LSB_FIRST, GDK_MSB_FIRST PGdkModifierType* = ptr TGdkModifierType TGdkModifierType* = gint PGdkVisualType* = ptr TGdkVisualType - TGdkVisualType* = enum - GDK_VISUAL_STATIC_GRAY, GDK_VISUAL_GRAYSCALE, GDK_VISUAL_STATIC_COLOR, + TGdkVisualType* = enum + GDK_VISUAL_STATIC_GRAY, GDK_VISUAL_GRAYSCALE, GDK_VISUAL_STATIC_COLOR, GDK_VISUAL_PSEUDO_COLOR, GDK_VISUAL_TRUE_COLOR, GDK_VISUAL_DIRECT_COLOR PGdkVisual* = ptr TGdkVisual TGdkVisual* = object of TGObject @@ -190,16 +189,16 @@ type PGdkCursorType* = ptr TGdkCursorType TGdkCursorType* = gint PGdkCursor* = ptr TGdkCursor - TGdkCursor* {.final.} = object + TGdkCursor* {.final.} = object `type`*: TGdkCursorType ref_count*: guint PGdkDragAction* = ptr TGdkDragAction TGdkDragAction* = int32 PGdkDragProtocol* = ptr TGdkDragProtocol - TGdkDragProtocol* = enum - GDK_DRAG_PROTO_MOTIF, GDK_DRAG_PROTO_XDND, GDK_DRAG_PROTO_ROOTWIN, - GDK_DRAG_PROTO_NONE, GDK_DRAG_PROTO_WIN32_DROPFILES, GDK_DRAG_PROTO_OLE2, + TGdkDragProtocol* = enum + GDK_DRAG_PROTO_MOTIF, GDK_DRAG_PROTO_XDND, GDK_DRAG_PROTO_ROOTWIN, + GDK_DRAG_PROTO_NONE, GDK_DRAG_PROTO_WIN32_DROPFILES, GDK_DRAG_PROTO_OLE2, GDK_DRAG_PROTO_LOCAL PGdkDragContext* = ptr TGdkDragContext TGdkDragContext* = object of TGObject @@ -220,46 +219,46 @@ type PGdkRegionBox* = ptr TGdkRegionBox TGdkRegionBox* = TGdkSegment PGdkRegion* = ptr TGdkRegion - TGdkRegion* {.final.} = object + TGdkRegion* {.final.} = object size*: int32 numRects*: int32 rects*: PGdkRegionBox extents*: TGdkRegionBox PPOINTBLOCK* = ptr TPOINTBLOCK - TPOINTBLOCK* {.final.} = object + TPOINTBLOCK* {.final.} = object pts*: array[0..(NUMPTSTOBUFFER) - 1, TGdkPoint] next*: PPOINTBLOCK PGdkDrawableClass* = ptr TGdkDrawableClass TGdkDrawableClass* = object of TGObjectClass - create_gc*: proc (drawable: PGdkDrawable, values: PGdkGCValues, + create_gc*: proc (drawable: PGdkDrawable, values: PGdkGCValues, mask: TGdkGCValuesMask): PGdkGC{.cdecl.} - draw_rectangle*: proc (drawable: PGdkDrawable, gc: PGdkGC, filled: gint, + draw_rectangle*: proc (drawable: PGdkDrawable, gc: PGdkGC, filled: gint, x: gint, y: gint, width: gint, height: gint){.cdecl.} - draw_arc*: proc (drawable: PGdkDrawable, gc: PGdkGC, filled: gint, x: gint, - y: gint, width: gint, height: gint, angle1: gint, + draw_arc*: proc (drawable: PGdkDrawable, gc: PGdkGC, filled: gint, x: gint, + y: gint, width: gint, height: gint, angle1: gint, angle2: gint){.cdecl.} - draw_polygon*: proc (drawable: PGdkDrawable, gc: PGdkGC, filled: gint, + draw_polygon*: proc (drawable: PGdkDrawable, gc: PGdkGC, filled: gint, points: PGdkPoint, npoints: gint){.cdecl.} - draw_text*: proc (drawable: PGdkDrawable, font: PGdkFont, gc: PGdkGC, + draw_text*: proc (drawable: PGdkDrawable, font: PGdkFont, gc: PGdkGC, x: gint, y: gint, text: cstring, text_length: gint){.cdecl.} - draw_text_wc*: proc (drawable: PGdkDrawable, font: PGdkFont, gc: PGdkGC, + draw_text_wc*: proc (drawable: PGdkDrawable, font: PGdkFont, gc: PGdkGC, x: gint, y: gint, text: PGdkWChar, text_length: gint){. cdecl.} - draw_drawable*: proc (drawable: PGdkDrawable, gc: PGdkGC, src: PGdkDrawable, - xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, + draw_drawable*: proc (drawable: PGdkDrawable, gc: PGdkGC, src: PGdkDrawable, + xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, width: gint, height: gint){.cdecl.} - draw_points*: proc (drawable: PGdkDrawable, gc: PGdkGC, points: PGdkPoint, + draw_points*: proc (drawable: PGdkDrawable, gc: PGdkGC, points: PGdkPoint, npoints: gint){.cdecl.} - draw_segments*: proc (drawable: PGdkDrawable, gc: PGdkGC, segs: PGdkSegment, + draw_segments*: proc (drawable: PGdkDrawable, gc: PGdkGC, segs: PGdkSegment, nsegs: gint){.cdecl.} - draw_lines*: proc (drawable: PGdkDrawable, gc: PGdkGC, points: PGdkPoint, + draw_lines*: proc (drawable: PGdkDrawable, gc: PGdkGC, points: PGdkPoint, npoints: gint){.cdecl.} - draw_glyphs*: proc (drawable: PGdkDrawable, gc: PGdkGC, font: PPangoFont, + draw_glyphs*: proc (drawable: PGdkDrawable, gc: PGdkGC, font: PPangoFont, x: gint, y: gint, glyphs: PPangoGlyphString){.cdecl.} - draw_image*: proc (drawable: PGdkDrawable, gc: PGdkGC, image: PGdkImage, - xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, + draw_image*: proc (drawable: PGdkDrawable, gc: PGdkGC, image: PGdkImage, + xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, width: gint, height: gint){.cdecl.} get_depth*: proc (drawable: PGdkDrawable): gint{.cdecl.} get_size*: proc (drawable: PGdkDrawable, width: Pgint, height: Pgint){.cdecl.} @@ -267,22 +266,22 @@ type get_colormap*: proc (drawable: PGdkDrawable): PGdkColormap{.cdecl.} get_visual*: proc (drawable: PGdkDrawable): PGdkVisual{.cdecl.} get_screen*: proc (drawable: PGdkDrawable): PGdkScreen{.cdecl.} - get_image*: proc (drawable: PGdkDrawable, x: gint, y: gint, width: gint, + get_image*: proc (drawable: PGdkDrawable, x: gint, y: gint, width: gint, height: gint): PGdkImage{.cdecl.} get_clip_region*: proc (drawable: PGdkDrawable): PGdkRegion{.cdecl.} get_visible_region*: proc (drawable: PGdkDrawable): PGdkRegion{.cdecl.} - get_composite_drawable*: proc (drawable: PGdkDrawable, x: gint, y: gint, - width: gint, height: gint, - composite_x_offset: Pgint, + get_composite_drawable*: proc (drawable: PGdkDrawable, x: gint, y: gint, + width: gint, height: gint, + composite_x_offset: Pgint, composite_y_offset: Pgint): PGdkDrawable{. cdecl.} - `draw_pixbuf`*: proc (drawable: PGdkDrawable, gc: PGdkGC, - pixbuf: PGdkPixbuf, src_x: gint, src_y: gint, - dest_x: gint, dest_y: gint, width: gint, height: gint, + `draw_pixbuf`*: proc (drawable: PGdkDrawable, gc: PGdkGC, + pixbuf: PGdkPixbuf, src_x: gint, src_y: gint, + dest_x: gint, dest_y: gint, width: gint, height: gint, dither: TGdkRgbDither, x_dither: gint, y_dither: gint){. cdecl.} - `copy_to_image`*: proc (drawable: PGdkDrawable, image: PGdkImage, - src_x: gint, src_y: gint, dest_x: gint, + `copy_to_image`*: proc (drawable: PGdkDrawable, image: PGdkImage, + src_x: gint, src_y: gint, dest_x: gint, dest_y: gint, width: gint, height: gint): PGdkImage{. cdecl.} `gdk_reserved1`: proc (){.cdecl.} @@ -306,7 +305,7 @@ type PGdkXEvent* = ptr TGdkXEvent TGdkXEvent* = proc () PGdkFilterReturn* = ptr TGdkFilterReturn - TGdkFilterReturn* = enum + TGdkFilterReturn* = enum GDK_FILTER_CONTINUE, GDK_FILTER_TRANSLATE, GDK_FILTER_REMOVE TGdkFilterFunc* = proc (xevent: PGdkXEvent, event: PGdkEvent, data: gpointer): TGdkFilterReturn{. cdecl.} @@ -315,34 +314,34 @@ type PGdkEventMask* = ptr TGdkEventMask TGdkEventMask* = gint32 PGdkVisibilityState* = ptr TGdkVisibilityState - TGdkVisibilityState* = enum - GDK_VISIBILITY_UNOBSCURED, GDK_VISIBILITY_PARTIAL, + TGdkVisibilityState* = enum + GDK_VISIBILITY_UNOBSCURED, GDK_VISIBILITY_PARTIAL, GDK_VISIBILITY_FULLY_OBSCURED PGdkScrollDirection* = ptr TGdkScrollDirection - TGdkScrollDirection* = enum + TGdkScrollDirection* = enum GDK_SCROLL_UP, GDK_SCROLL_DOWN, GDK_SCROLL_LEFT, GDK_SCROLL_RIGHT PGdkNotifyType* = ptr TGdkNotifyType TGdkNotifyType* = int PGdkCrossingMode* = ptr TGdkCrossingMode - TGdkCrossingMode* = enum + TGdkCrossingMode* = enum GDK_CROSSING_NORMAL, GDK_CROSSING_GRAB, GDK_CROSSING_UNGRAB PGdkPropertyState* = ptr TGdkPropertyState - TGdkPropertyState* = enum + TGdkPropertyState* = enum GDK_PROPERTY_NEW_VALUE, GDK_PROPERTY_STATE_DELETE PGdkWindowState* = ptr TGdkWindowState TGdkWindowState* = gint PGdkSettingAction* = ptr TGdkSettingAction - TGdkSettingAction* = enum - GDK_SETTING_ACTION_NEW, GDK_SETTING_ACTION_CHANGED, + TGdkSettingAction* = enum + GDK_SETTING_ACTION_NEW, GDK_SETTING_ACTION_CHANGED, GDK_SETTING_ACTION_DELETED PGdkEventAny* = ptr TGdkEventAny - TGdkEventAny* {.final.} = object + TGdkEventAny* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 PGdkEventExpose* = ptr TGdkEventExpose - TGdkEventExpose* {.final.} = object + TGdkEventExpose* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -351,20 +350,20 @@ type count*: gint PGdkEventNoExpose* = ptr TGdkEventNoExpose - TGdkEventNoExpose* {.final.} = object + TGdkEventNoExpose* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 PGdkEventVisibility* = ptr TGdkEventVisibility - TGdkEventVisibility* {.final.} = object + TGdkEventVisibility* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 state*: TGdkVisibilityState PGdkEventMotion* = ptr TGdkEventMotion - TGdkEventMotion* {.final.} = object + TGdkEventMotion* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -379,7 +378,7 @@ type y_root*: gdouble PGdkEventButton* = ptr TGdkEventButton - TGdkEventButton* {.final.} = object + TGdkEventButton* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -394,7 +393,7 @@ type y_root*: gdouble PGdkEventScroll* = ptr TGdkEventScroll - TGdkEventScroll* {.final.} = object + TGdkEventScroll* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -408,7 +407,7 @@ type y_root*: gdouble PGdkEventKey* = ptr TGdkEventKey - TGdkEventKey* {.final.} = object + TGdkEventKey* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -421,7 +420,7 @@ type group*: guint8 PGdkEventCrossing* = ptr TGdkEventCrossing - TGdkEventCrossing* {.final.} = object + TGdkEventCrossing* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -437,14 +436,14 @@ type state*: guint PGdkEventFocus* = ptr TGdkEventFocus - TGdkEventFocus* {.final.} = object + TGdkEventFocus* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 `in`*: gint16 PGdkEventConfigure* = ptr TGdkEventConfigure - TGdkEventConfigure* {.final.} = object + TGdkEventConfigure* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -454,7 +453,7 @@ type height*: gint PGdkEventProperty* = ptr TGdkEventProperty - TGdkEventProperty* {.final.} = object + TGdkEventProperty* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -464,7 +463,7 @@ type TGdkNativeWindow* = pointer PGdkEventSelection* = ptr TGdkEventSelection - TGdkEventSelection* {.final.} = object + TGdkEventSelection* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -475,7 +474,7 @@ type requestor*: TGdkNativeWindow PGdkEventProximity* = ptr TGdkEventProximity - TGdkEventProximity* {.final.} = object + TGdkEventProximity* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -483,11 +482,11 @@ type device*: PGdkDevice PmatDUMMY* = ptr TmatDUMMY - TmatDUMMY* {.final.} = object + TmatDUMMY* {.final.} = object b*: array[0..19, char] PGdkEventClient* = ptr TGdkEventClient - TGdkEventClient* {.final.} = object + TGdkEventClient* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -496,7 +495,7 @@ type b*: array[0..19, char] PGdkEventSetting* = ptr TGdkEventSetting - TGdkEventSetting* {.final.} = object + TGdkEventSetting* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -504,7 +503,7 @@ type name*: cstring PGdkEventWindowState* = ptr TGdkEventWindowState - TGdkEventWindowState* {.final.} = object + TGdkEventWindowState* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -512,7 +511,7 @@ type new_window_state*: TGdkWindowState PGdkEventDND* = ptr TGdkEventDND - TGdkEventDND* {.final.} = object + TGdkEventDND* {.final.} = object `type`*: TGdkEventType window*: PGdkWindow send_event*: gint8 @@ -521,13 +520,13 @@ type x_root*: gshort y_root*: gshort - TGdkEvent* {.final.} = object + TGdkEvent* {.final.} = object data*: array[0..255, char] # union of # `type`: TGdkEventType # any: TGdkEventAny - # expose: TGdkEventExpose - # no_expose: TGdkEventNoExpose - # visibility: TGdkEventVisibility + # expose: TGdkEventExpose + # no_expose: TGdkEventNoExpose + # visibility: TGdkEventVisibility # motion: TGdkEventMotion # button: TGdkEventButton # scroll: TGdkEventScroll @@ -542,13 +541,13 @@ type # dnd: TGdkEventDND # window_state: TGdkEventWindowState # setting: TGdkEventSetting - + PGdkGCClass* = ptr TGdkGCClass TGdkGCClass* = object of TGObjectClass get_values*: proc (gc: PGdkGC, values: PGdkGCValues){.cdecl.} set_values*: proc (gc: PGdkGC, values: PGdkGCValues, mask: TGdkGCValuesMask){. cdecl.} - set_dashes*: proc (gc: PGdkGC, dash_offset: gint, + set_dashes*: proc (gc: PGdkGC, dash_offset: gint, dash_list: openarray[gint8]){.cdecl.} `gdk_reserved1`*: proc (){.cdecl.} `gdk_reserved2`*: proc (){.cdecl.} @@ -573,24 +572,24 @@ type windowing_data*: gpointer PGdkExtensionMode* = ptr TGdkExtensionMode - TGdkExtensionMode* = enum - GDK_EXTENSION_EVENTS_NONE, GDK_EXTENSION_EVENTS_ALL, + TGdkExtensionMode* = enum + GDK_EXTENSION_EVENTS_NONE, GDK_EXTENSION_EVENTS_ALL, GDK_EXTENSION_EVENTS_CURSOR PGdkInputSource* = ptr TGdkInputSource - TGdkInputSource* = enum + TGdkInputSource* = enum GDK_SOURCE_MOUSE, GDK_SOURCE_PEN, GDK_SOURCE_ERASER, GDK_SOURCE_CURSOR PGdkInputMode* = ptr TGdkInputMode - TGdkInputMode* = enum + TGdkInputMode* = enum GDK_MODE_DISABLED, GDK_MODE_SCREEN, GDK_MODE_WINDOW PGdkAxisUse* = ptr TGdkAxisUse TGdkAxisUse* = int32 PGdkDeviceKey* = ptr TGdkDeviceKey - TGdkDeviceKey* {.final.} = object + TGdkDeviceKey* {.final.} = object keyval*: guint modifiers*: TGdkModifierType PGdkDeviceAxis* = ptr TGdkDeviceAxis - TGdkDeviceAxis* {.final.} = object + TGdkDeviceAxis* {.final.} = object use*: TGdkAxisUse min*: gdouble max*: gdouble @@ -605,12 +604,12 @@ type num_keys*: gint keys*: PGdkDeviceKey - TGdkTimeCoord* {.final.} = object + TGdkTimeCoord* {.final.} = object time*: guint32 axes*: array[0..(GDK_MAX_TIMECOORD_AXES) - 1, gdouble] PGdkKeymapKey* = ptr TGdkKeymapKey - TGdkKeymapKey* {.final.} = object + TGdkKeymapKey* {.final.} = object keycode*: guint group*: gint level*: gint @@ -624,12 +623,12 @@ type direction_changed*: proc (keymap: PGdkKeymap){.cdecl.} PGdkPangoAttrStipple* = ptr TGdkPangoAttrStipple - TGdkPangoAttrStipple* {.final.} = object + TGdkPangoAttrStipple* {.final.} = object attr*: TPangoAttribute stipple*: PGdkBitmap PGdkPangoAttrEmbossed* = ptr TGdkPangoAttrEmbossed - TGdkPangoAttrEmbossed* {.final.} = object + TGdkPangoAttrEmbossed* {.final.} = object attr*: TPangoAttribute embossed*: gboolean @@ -642,18 +641,18 @@ type TGdkPixmapObjectClass* = object of TGdkDrawableClass PGdkPropMode* = ptr TGdkPropMode - TGdkPropMode* = enum + TGdkPropMode* = enum GDK_PROP_MODE_REPLACE, GDK_PROP_MODE_PREPEND, GDK_PROP_MODE_APPEND PGdkFillRule* = ptr TGdkFillRule - TGdkFillRule* = enum + TGdkFillRule* = enum GDK_EVEN_ODD_RULE, GDK_WINDING_RULE PGdkOverlapType* = ptr TGdkOverlapType - TGdkOverlapType* = enum - GDK_OVERLAP_RECTANGLE_IN, GDK_OVERLAP_RECTANGLE_OUT, + TGdkOverlapType* = enum + GDK_OVERLAP_RECTANGLE_IN, GDK_OVERLAP_RECTANGLE_OUT, GDK_OVERLAP_RECTANGLE_PART TGdkSpanFunc* = proc (span: PGdkSpan, data: gpointer){.cdecl.} PGdkRgbCmap* = ptr TGdkRgbCmap - TGdkRgbCmap* {.final.} = object + TGdkRgbCmap* {.final.} = object colors*: array[0..255, guint32] n_colors*: gint info_list*: PGSList @@ -690,33 +689,33 @@ type get_window_at_pointer*: proc (screen: PGdkScreen, win_x: Pgint, win_y: Pgint): PGdkWindow{. cdecl.} get_n_monitors*: proc (screen: PGdkScreen): gint{.cdecl.} - get_monitor_geometry*: proc (screen: PGdkScreen, monitor_num: gint, + get_monitor_geometry*: proc (screen: PGdkScreen, monitor_num: gint, dest: PGdkRectangle){.cdecl.} PGdkGrabStatus* = ptr TGdkGrabStatus TGdkGrabStatus* = int - TGdkInputFunction* = proc (data: gpointer, source: gint, + TGdkInputFunction* = proc (data: gpointer, source: gint, condition: TGdkInputCondition){.cdecl.} TGdkDestroyNotify* = proc (data: gpointer){.cdecl.} - TGdkSpan* {.final.} = object + TGdkSpan* {.final.} = object x*: gint y*: gint width*: gint PGdkWindowClass* = ptr TGdkWindowClass - TGdkWindowClass* = enum + TGdkWindowClass* = enum GDK_INPUT_OUTPUT, GDK_INPUT_ONLY PGdkWindowType* = ptr TGdkWindowType - TGdkWindowType* = enum - GDK_WINDOW_ROOT, GDK_WINDOW_TOPLEVEL, GDK_WINDOW_CHILD, GDK_WINDOW_DIALOG, + TGdkWindowType* = enum + GDK_WINDOW_ROOT, GDK_WINDOW_TOPLEVEL, GDK_WINDOW_CHILD, GDK_WINDOW_DIALOG, GDK_WINDOW_TEMP, GDK_WINDOW_FOREIGN PGdkWindowAttributesType* = ptr TGdkWindowAttributesType TGdkWindowAttributesType* = int32 PGdkWindowHints* = ptr TGdkWindowHints TGdkWindowHints* = int32 PGdkWindowTypeHint* = ptr TGdkWindowTypeHint - TGdkWindowTypeHint* = enum - GDK_WINDOW_TYPE_HINT_NORMAL, GDK_WINDOW_TYPE_HINT_DIALOG, + TGdkWindowTypeHint* = enum + GDK_WINDOW_TYPE_HINT_NORMAL, GDK_WINDOW_TYPE_HINT_DIALOG, GDK_WINDOW_TYPE_HINT_MENU, GDK_WINDOW_TYPE_HINT_TOOLBAR PGdkWMDecoration* = ptr TGdkWMDecoration TGdkWMDecoration* = int32 @@ -725,13 +724,13 @@ type PGdkGravity* = ptr TGdkGravity TGdkGravity* = int PGdkWindowEdge* = ptr TGdkWindowEdge - TGdkWindowEdge* = enum - GDK_WINDOW_EDGE_NORTH_WEST, GDK_WINDOW_EDGE_NORTH, - GDK_WINDOW_EDGE_NORTH_EAST, GDK_WINDOW_EDGE_WEST, GDK_WINDOW_EDGE_EAST, - GDK_WINDOW_EDGE_SOUTH_WEST, GDK_WINDOW_EDGE_SOUTH, + TGdkWindowEdge* = enum + GDK_WINDOW_EDGE_NORTH_WEST, GDK_WINDOW_EDGE_NORTH, + GDK_WINDOW_EDGE_NORTH_EAST, GDK_WINDOW_EDGE_WEST, GDK_WINDOW_EDGE_EAST, + GDK_WINDOW_EDGE_SOUTH_WEST, GDK_WINDOW_EDGE_SOUTH, GDK_WINDOW_EDGE_SOUTH_EAST PGdkWindowAttr* = ptr TGdkWindowAttr - TGdkWindowAttr* {.final.} = object + TGdkWindowAttr* {.final.} = object title*: cstring event_mask*: gint x*: gint @@ -748,7 +747,7 @@ type override_redirect*: gboolean PGdkGeometry* = ptr TGdkGeometry - TGdkGeometry* {.final.} = object + TGdkGeometry* {.final.} = object min_width*: gint min_height*: gint max_width*: gint @@ -762,8 +761,8 @@ type win_gravity*: TGdkGravity PGdkPointerHooks* = ptr TGdkPointerHooks - TGdkPointerHooks* {.final.} = object - get_pointer*: proc (window: PGdkWindow, x: Pgint, y: Pgint, + TGdkPointerHooks* {.final.} = object + get_pointer*: proc (window: PGdkWindow, x: Pgint, y: Pgint, mask: PGdkModifierType): PGdkWindow{.cdecl.} window_at_pointer*: proc (screen: PGdkScreen, win_x: Pgint, win_y: Pgint): PGdkWindow{. cdecl.} @@ -793,7 +792,7 @@ type PGdkWindowObjectClass* = ptr TGdkWindowObjectClass TGdkWindowObjectClass* = object of TGdkDrawableClass - gdk_window_invalidate_maybe_recurse_child_func* = proc (para1: PGdkWindow, + gdk_window_invalidate_maybe_recurse_child_func* = proc (para1: PGdkWindow, para2: gpointer): gboolean proc GDK_TYPE_COLORMAP*(): GType @@ -803,38 +802,38 @@ proc GDK_IS_COLORMAP*(anObject: pointer): bool proc GDK_IS_COLORMAP_CLASS*(klass: pointer): bool proc GDK_COLORMAP_GET_CLASS*(obj: pointer): PGdkColormapClass proc GDK_TYPE_COLOR*(): GType -proc gdk_colormap_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_colormap_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_colormap_get_type".} proc gdk_colormap_new*(visual: PGdkVisual, allocate: gboolean): PGdkColormap{. cdecl, dynlib: gdklib, importc: "gdk_colormap_new".} -proc gdk_colormap_alloc_colors*(colormap: PGdkColormap, colors: PGdkColor, - ncolors: gint, writeable: gboolean, +proc gdk_colormap_alloc_colors*(colormap: PGdkColormap, colors: PGdkColor, + ncolors: gint, writeable: gboolean, best_match: gboolean, success: Pgboolean): gint{. cdecl, dynlib: gdklib, importc: "gdk_colormap_alloc_colors".} -proc gdk_colormap_alloc_color*(colormap: PGdkColormap, color: PGdkColor, +proc gdk_colormap_alloc_color*(colormap: PGdkColormap, color: PGdkColor, writeable: gboolean, best_match: gboolean): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_colormap_alloc_color".} -proc gdk_colormap_free_colors*(colormap: PGdkColormap, colors: PGdkColor, - ncolors: gint){.cdecl, dynlib: gdklib, +proc gdk_colormap_free_colors*(colormap: PGdkColormap, colors: PGdkColor, + ncolors: gint){.cdecl, dynlib: gdklib, importc: "gdk_colormap_free_colors".} -proc gdk_colormap_query_color*(colormap: PGdkColormap, pixel: gulong, - result: PGdkColor){.cdecl, dynlib: gdklib, +proc gdk_colormap_query_color*(colormap: PGdkColormap, pixel: gulong, + result: PGdkColor){.cdecl, dynlib: gdklib, importc: "gdk_colormap_query_color".} -proc gdk_colormap_get_visual*(colormap: PGdkColormap): PGdkVisual{.cdecl, +proc gdk_colormap_get_visual*(colormap: PGdkColormap): PGdkVisual{.cdecl, dynlib: gdklib, importc: "gdk_colormap_get_visual".} -proc gdk_color_copy*(color: PGdkColor): PGdkColor{.cdecl, dynlib: gdklib, +proc gdk_color_copy*(color: PGdkColor): PGdkColor{.cdecl, dynlib: gdklib, importc: "gdk_color_copy".} -proc gdk_color_free*(color: PGdkColor){.cdecl, dynlib: gdklib, +proc gdk_color_free*(color: PGdkColor){.cdecl, dynlib: gdklib, importc: "gdk_color_free".} -proc gdk_color_parse*(spec: cstring, color: PGdkColor): gint{.cdecl, +proc gdk_color_parse*(spec: cstring, color: PGdkColor): gint{.cdecl, dynlib: gdklib, importc: "gdk_color_parse".} -proc gdk_color_hash*(colora: PGdkColor): guint{.cdecl, dynlib: gdklib, +proc gdk_color_hash*(colora: PGdkColor): guint{.cdecl, dynlib: gdklib, importc: "gdk_color_hash".} -proc gdk_color_equal*(colora: PGdkColor, colorb: PGdkColor): gboolean{.cdecl, +proc gdk_color_equal*(colora: PGdkColor, colorb: PGdkColor): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_color_equal".} -proc gdk_color_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_color_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_color_get_type".} -const +const GDK_CURSOR_IS_PIXMAP* = - (1) GDK_X_CURSOR* = 0 GDK_ARROW* = 2 @@ -916,20 +915,20 @@ const GDK_LAST_CURSOR* = GDK_XTERM + 1 proc GDK_TYPE_CURSOR*(): GType -proc gdk_cursor_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_cursor_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_cursor_get_type".} proc gdk_cursor_new_for_screen*(screen: PGdkScreen, cursor_type: TGdkCursorType): PGdkCursor{. cdecl, dynlib: gdklib, importc: "gdk_cursor_new_for_screen".} -proc gdk_cursor_new_from_pixmap*(source: PGdkPixmap, mask: PGdkPixmap, +proc gdk_cursor_new_from_pixmap*(source: PGdkPixmap, mask: PGdkPixmap, fg: PGdkColor, bg: PGdkColor, x: gint, y: gint): PGdkCursor{. cdecl, dynlib: gdklib, importc: "gdk_cursor_new_from_pixmap".} -proc gdk_cursor_get_screen*(cursor: PGdkCursor): PGdkScreen{.cdecl, +proc gdk_cursor_get_screen*(cursor: PGdkCursor): PGdkScreen{.cdecl, dynlib: gdklib, importc: "gdk_cursor_get_screen".} -proc gdk_cursor_ref*(cursor: PGdkCursor): PGdkCursor{.cdecl, dynlib: gdklib, +proc gdk_cursor_ref*(cursor: PGdkCursor): PGdkCursor{.cdecl, dynlib: gdklib, importc: "gdk_cursor_ref".} -proc gdk_cursor_unref*(cursor: PGdkCursor){.cdecl, dynlib: gdklib, +proc gdk_cursor_unref*(cursor: PGdkCursor){.cdecl, dynlib: gdklib, importc: "gdk_cursor_unref".} -const +const GDK_ACTION_DEFAULT* = 1 shl 0 GDK_ACTION_COPY* = 1 shl 1 GDK_ACTION_MOVE* = 1 shl 2 @@ -943,45 +942,45 @@ proc GDK_DRAG_CONTEXT_CLASS*(klass: Pointer): PGdkDragContextClass proc GDK_IS_DRAG_CONTEXT*(anObject: Pointer): bool proc GDK_IS_DRAG_CONTEXT_CLASS*(klass: Pointer): bool proc GDK_DRAG_CONTEXT_GET_CLASS*(obj: Pointer): PGdkDragContextClass -proc gdk_drag_context_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_drag_context_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_drag_context_get_type".} -proc gdk_drag_context_new*(): PGdkDragContext{.cdecl, dynlib: gdklib, +proc gdk_drag_context_new*(): PGdkDragContext{.cdecl, dynlib: gdklib, importc: "gdk_drag_context_new".} -proc gdk_drag_status*(context: PGdkDragContext, action: TGdkDragAction, - time: guint32){.cdecl, dynlib: gdklib, +proc gdk_drag_status*(context: PGdkDragContext, action: TGdkDragAction, + time: guint32){.cdecl, dynlib: gdklib, importc: "gdk_drag_status".} proc gdk_drop_reply*(context: PGdkDragContext, ok: gboolean, time: guint32){. cdecl, dynlib: gdklib, importc: "gdk_drop_reply".} proc gdk_drop_finish*(context: PGdkDragContext, success: gboolean, time: guint32){. cdecl, dynlib: gdklib, importc: "gdk_drop_finish".} -proc gdk_drag_get_selection*(context: PGdkDragContext): TGdkAtom{.cdecl, +proc gdk_drag_get_selection*(context: PGdkDragContext): TGdkAtom{.cdecl, dynlib: gdklib, importc: "gdk_drag_get_selection".} proc gdk_drag_begin*(window: PGdkWindow, targets: PGList): PGdkDragContext{. cdecl, dynlib: gdklib, importc: "gdk_drag_begin".} -proc gdk_drag_get_protocol_for_display*(display: PGdkDisplay, xid: guint32, +proc gdk_drag_get_protocol_for_display*(display: PGdkDisplay, xid: guint32, protocol: PGdkDragProtocol): guint32{. cdecl, dynlib: gdklib, importc: "gdk_drag_get_protocol_for_display".} -proc gdk_drag_find_window*(context: PGdkDragContext, drag_window: PGdkWindow, - x_root: gint, y_root: gint, w: var PGdkWindow, - protocol: PGdkDragProtocol){.cdecl, dynlib: gdklib, +proc gdk_drag_find_window*(context: PGdkDragContext, drag_window: PGdkWindow, + x_root: gint, y_root: gint, w: var PGdkWindow, + protocol: PGdkDragProtocol){.cdecl, dynlib: gdklib, importc: "gdk_drag_find_window".} -proc gdk_drag_motion*(context: PGdkDragContext, dest_window: PGdkWindow, - protocol: TGdkDragProtocol, x_root: gint, y_root: gint, - suggested_action: TGdkDragAction, +proc gdk_drag_motion*(context: PGdkDragContext, dest_window: PGdkWindow, + protocol: TGdkDragProtocol, x_root: gint, y_root: gint, + suggested_action: TGdkDragAction, possible_actions: TGdkDragAction, time: guint32): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_drag_motion".} -proc gdk_drag_drop*(context: PGdkDragContext, time: guint32){.cdecl, +proc gdk_drag_drop*(context: PGdkDragContext, time: guint32){.cdecl, dynlib: gdklib, importc: "gdk_drag_drop".} -proc gdk_drag_abort*(context: PGdkDragContext, time: guint32){.cdecl, +proc gdk_drag_abort*(context: PGdkDragContext, time: guint32){.cdecl, dynlib: gdklib, importc: "gdk_drag_abort".} proc gdkregion_EXTENTCHECK*(r1, r2: PGdkRegionBox): bool proc gdkregion_EXTENTS*(r: PGdkRegionBox, idRect: PGdkRegion) proc gdkregion_MEMCHECK*(reg: PGdkRegion, ARect, firstrect: var PGdkRegionBox): bool -proc gdkregion_CHECK_PREVIOUS*(Reg: PGdkRegion, R: PGdkRegionBox, +proc gdkregion_CHECK_PREVIOUS*(Reg: PGdkRegion, R: PGdkRegionBox, Rx1, Ry1, Rx2, Ry2: gint): bool -proc gdkregion_ADDRECT*(reg: PGdkRegion, r: PGdkRegionBox, +proc gdkregion_ADDRECT*(reg: PGdkRegion, r: PGdkRegionBox, rx1, ry1, rx2, ry2: gint) -proc gdkregion_ADDRECTNOX*(reg: PGdkRegion, r: PGdkRegionBox, +proc gdkregion_ADDRECTNOX*(reg: PGdkRegion, r: PGdkRegionBox, rx1, ry1, rx2, ry2: gint) proc gdkregion_EMPTY_REGION*(pReg: PGdkRegion): bool proc gdkregion_REGION_NOT_EMPTY*(pReg: PGdkRegion): bool @@ -992,79 +991,79 @@ proc GDK_DRAWABLE_CLASS*(klass: Pointer): PGdkDrawableClass proc GDK_IS_DRAWABLE*(anObject: Pointer): bool proc GDK_IS_DRAWABLE_CLASS*(klass: Pointer): bool proc GDK_DRAWABLE_GET_CLASS*(obj: Pointer): PGdkDrawableClass -proc gdk_drawable_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_drawable_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_drawable_get_type".} proc gdk_drawable_get_size*(drawable: PGdkDrawable, width: Pgint, height: Pgint){. cdecl, dynlib: gdklib, importc: "gdk_drawable_get_size".} proc gdk_drawable_set_colormap*(drawable: PGdkDrawable, colormap: PGdkColormap){. cdecl, dynlib: gdklib, importc: "gdk_drawable_set_colormap".} -proc gdk_drawable_get_colormap*(drawable: PGdkDrawable): PGdkColormap{.cdecl, +proc gdk_drawable_get_colormap*(drawable: PGdkDrawable): PGdkColormap{.cdecl, dynlib: gdklib, importc: "gdk_drawable_get_colormap".} -proc gdk_drawable_get_visual*(drawable: PGdkDrawable): PGdkVisual{.cdecl, +proc gdk_drawable_get_visual*(drawable: PGdkDrawable): PGdkVisual{.cdecl, dynlib: gdklib, importc: "gdk_drawable_get_visual".} -proc gdk_drawable_get_depth*(drawable: PGdkDrawable): gint{.cdecl, +proc gdk_drawable_get_depth*(drawable: PGdkDrawable): gint{.cdecl, dynlib: gdklib, importc: "gdk_drawable_get_depth".} -proc gdk_drawable_get_screen*(drawable: PGdkDrawable): PGdkScreen{.cdecl, +proc gdk_drawable_get_screen*(drawable: PGdkDrawable): PGdkScreen{.cdecl, dynlib: gdklib, importc: "gdk_drawable_get_screen".} -proc gdk_drawable_get_display*(drawable: PGdkDrawable): PGdkDisplay{.cdecl, +proc gdk_drawable_get_display*(drawable: PGdkDrawable): PGdkDisplay{.cdecl, dynlib: gdklib, importc: "gdk_drawable_get_display".} proc gdk_draw_point*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, y: gint){. cdecl, dynlib: gdklib, importc: "gdk_draw_point".} -proc gdk_draw_line*(drawable: PGdkDrawable, gc: PGdkGC, x1: gint, y1: gint, - x2: gint, y2: gint){.cdecl, dynlib: gdklib, +proc gdk_draw_line*(drawable: PGdkDrawable, gc: PGdkGC, x1: gint, y1: gint, + x2: gint, y2: gint){.cdecl, dynlib: gdklib, importc: "gdk_draw_line".} -proc gdk_draw_rectangle*(drawable: PGdkDrawable, gc: PGdkGC, filled: gint, - x: gint, y: gint, width: gint, height: gint){.cdecl, +proc gdk_draw_rectangle*(drawable: PGdkDrawable, gc: PGdkGC, filled: gint, + x: gint, y: gint, width: gint, height: gint){.cdecl, dynlib: gdklib, importc: "gdk_draw_rectangle".} -proc gdk_draw_arc*(drawable: PGdkDrawable, gc: PGdkGC, filled: gint, x: gint, - y: gint, width: gint, height: gint, angle1: gint, +proc gdk_draw_arc*(drawable: PGdkDrawable, gc: PGdkGC, filled: gint, x: gint, + y: gint, width: gint, height: gint, angle1: gint, angle2: gint){.cdecl, dynlib: gdklib, importc: "gdk_draw_arc".} -proc gdk_draw_polygon*(drawable: PGdkDrawable, gc: PGdkGC, filled: gint, - points: PGdkPoint, npoints: gint){.cdecl, dynlib: gdklib, +proc gdk_draw_polygon*(drawable: PGdkDrawable, gc: PGdkGC, filled: gint, + points: PGdkPoint, npoints: gint){.cdecl, dynlib: gdklib, importc: "gdk_draw_polygon".} -proc gdk_draw_drawable*(drawable: PGdkDrawable, gc: PGdkGC, src: PGdkDrawable, - xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, - width: gint, height: gint){.cdecl, dynlib: gdklib, +proc gdk_draw_drawable*(drawable: PGdkDrawable, gc: PGdkGC, src: PGdkDrawable, + xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, + width: gint, height: gint){.cdecl, dynlib: gdklib, importc: "gdk_draw_drawable".} -proc gdk_draw_image*(drawable: PGdkDrawable, gc: PGdkGC, image: PGdkImage, - xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, - width: gint, height: gint){.cdecl, dynlib: gdklib, +proc gdk_draw_image*(drawable: PGdkDrawable, gc: PGdkGC, image: PGdkImage, + xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, + width: gint, height: gint){.cdecl, dynlib: gdklib, importc: "gdk_draw_image".} -proc gdk_draw_points*(drawable: PGdkDrawable, gc: PGdkGC, points: PGdkPoint, - npoints: gint){.cdecl, dynlib: gdklib, +proc gdk_draw_points*(drawable: PGdkDrawable, gc: PGdkGC, points: PGdkPoint, + npoints: gint){.cdecl, dynlib: gdklib, importc: "gdk_draw_points".} -proc gdk_draw_segments*(drawable: PGdkDrawable, gc: PGdkGC, segs: PGdkSegment, - nsegs: gint){.cdecl, dynlib: gdklib, +proc gdk_draw_segments*(drawable: PGdkDrawable, gc: PGdkGC, segs: PGdkSegment, + nsegs: gint){.cdecl, dynlib: gdklib, importc: "gdk_draw_segments".} -proc gdk_draw_lines*(drawable: PGdkDrawable, gc: PGdkGC, points: PGdkPoint, - npoints: gint){.cdecl, dynlib: gdklib, +proc gdk_draw_lines*(drawable: PGdkDrawable, gc: PGdkGC, points: PGdkPoint, + npoints: gint){.cdecl, dynlib: gdklib, importc: "gdk_draw_lines".} -proc gdk_draw_glyphs*(drawable: PGdkDrawable, gc: PGdkGC, font: PPangoFont, - x: gint, y: gint, glyphs: PPangoGlyphString){.cdecl, +proc gdk_draw_glyphs*(drawable: PGdkDrawable, gc: PGdkGC, font: PPangoFont, + x: gint, y: gint, glyphs: PPangoGlyphString){.cdecl, dynlib: gdklib, importc: "gdk_draw_glyphs".} -proc gdk_draw_layout_line*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, y: gint, - line: PPangoLayoutLine){.cdecl, dynlib: gdklib, +proc gdk_draw_layout_line*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, y: gint, + line: PPangoLayoutLine){.cdecl, dynlib: gdklib, importc: "gdk_draw_layout_line".} -proc gdk_draw_layout*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, y: gint, - layout: PPangoLayout){.cdecl, dynlib: gdklib, +proc gdk_draw_layout*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, y: gint, + layout: PPangoLayout){.cdecl, dynlib: gdklib, importc: "gdk_draw_layout".} -proc gdk_draw_layout_line_with_colors*(drawable: PGdkDrawable, gc: PGdkGC, - x: gint, y: gint, line: PPangoLayoutLine, - foreground: PGdkColor, - background: PGdkColor){.cdecl, +proc gdk_draw_layout_line_with_colors*(drawable: PGdkDrawable, gc: PGdkGC, + x: gint, y: gint, line: PPangoLayoutLine, + foreground: PGdkColor, + background: PGdkColor){.cdecl, dynlib: gdklib, importc: "gdk_draw_layout_line_with_colors".} -proc gdk_draw_layout_with_colors*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, - y: gint, layout: PPangoLayout, +proc gdk_draw_layout_with_colors*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, + y: gint, layout: PPangoLayout, foreground: PGdkColor, background: PGdkColor){. cdecl, dynlib: gdklib, importc: "gdk_draw_layout_with_colors".} -proc gdk_drawable_get_image*(drawable: PGdkDrawable, x: gint, y: gint, - width: gint, height: gint): PGdkImage{.cdecl, +proc gdk_drawable_get_image*(drawable: PGdkDrawable, x: gint, y: gint, + width: gint, height: gint): PGdkImage{.cdecl, dynlib: gdklib, importc: "gdk_drawable_get_image".} -proc gdk_drawable_get_clip_region*(drawable: PGdkDrawable): PGdkRegion{.cdecl, +proc gdk_drawable_get_clip_region*(drawable: PGdkDrawable): PGdkRegion{.cdecl, dynlib: gdklib, importc: "gdk_drawable_get_clip_region".} proc gdk_drawable_get_visible_region*(drawable: PGdkDrawable): PGdkRegion{. cdecl, dynlib: gdklib, importc: "gdk_drawable_get_visible_region".} -const +const GDK_NOTHING* = - (1) GDK_DELETE* = 0 GDK_DESTROY* = 1 @@ -1108,7 +1107,7 @@ const GDK_NOTIFY_UNKNOWN* = 5 proc GDK_TYPE_EVENT*(): GType -const +const G_PRIORITY_DEFAULT* = 0 GDK_PRIORITY_EVENTS* = G_PRIORITY_DEFAULT #GDK_PRIORITY_REDRAW* = G_PRIORITY_HIGH_IDLE + 20 @@ -1139,96 +1138,96 @@ const GDK_WINDOW_STATE_MAXIMIZED* = 1 shl 2 GDK_WINDOW_STATE_STICKY* = 1 shl 3 -proc gdk_event_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_event_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_event_get_type".} -proc gdk_events_pending*(): gboolean{.cdecl, dynlib: gdklib, +proc gdk_events_pending*(): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_events_pending".} -proc gdk_event_get*(): PGdkEvent{.cdecl, dynlib: gdklib, +proc gdk_event_get*(): PGdkEvent{.cdecl, dynlib: gdklib, importc: "gdk_event_get".} -proc gdk_event_peek*(): PGdkEvent{.cdecl, dynlib: gdklib, +proc gdk_event_peek*(): PGdkEvent{.cdecl, dynlib: gdklib, importc: "gdk_event_peek".} -proc gdk_event_get_graphics_expose*(window: PGdkWindow): PGdkEvent{.cdecl, +proc gdk_event_get_graphics_expose*(window: PGdkWindow): PGdkEvent{.cdecl, dynlib: gdklib, importc: "gdk_event_get_graphics_expose".} -proc gdk_event_put*(event: PGdkEvent){.cdecl, dynlib: gdklib, +proc gdk_event_put*(event: PGdkEvent){.cdecl, dynlib: gdklib, importc: "gdk_event_put".} -proc gdk_event_copy*(event: PGdkEvent): PGdkEvent{.cdecl, dynlib: gdklib, +proc gdk_event_copy*(event: PGdkEvent): PGdkEvent{.cdecl, dynlib: gdklib, importc: "gdk_event_copy".} -proc gdk_event_free*(event: PGdkEvent){.cdecl, dynlib: gdklib, +proc gdk_event_free*(event: PGdkEvent){.cdecl, dynlib: gdklib, importc: "gdk_event_free".} -proc gdk_event_get_time*(event: PGdkEvent): guint32{.cdecl, dynlib: gdklib, +proc gdk_event_get_time*(event: PGdkEvent): guint32{.cdecl, dynlib: gdklib, importc: "gdk_event_get_time".} proc gdk_event_get_state*(event: PGdkEvent, state: PGdkModifierType): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_event_get_state".} proc gdk_event_get_coords*(event: PGdkEvent, x_win: Pgdouble, y_win: Pgdouble): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_event_get_coords".} -proc gdk_event_get_root_coords*(event: PGdkEvent, x_root: Pgdouble, - y_root: Pgdouble): gboolean{.cdecl, +proc gdk_event_get_root_coords*(event: PGdkEvent, x_root: Pgdouble, + y_root: Pgdouble): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_event_get_root_coords".} -proc gdk_event_get_axis*(event: PGdkEvent, axis_use: TGdkAxisUse, - value: Pgdouble): gboolean{.cdecl, dynlib: gdklib, +proc gdk_event_get_axis*(event: PGdkEvent, axis_use: TGdkAxisUse, + value: Pgdouble): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_event_get_axis".} -proc gdk_event_handler_set*(func: TGdkEventFunc, data: gpointer, - notify: TGDestroyNotify){.cdecl, dynlib: gdklib, +proc gdk_event_handler_set*(func: TGdkEventFunc, data: gpointer, + notify: TGDestroyNotify){.cdecl, dynlib: gdklib, importc: "gdk_event_handler_set".} -proc gdk_set_show_events*(show_events: gboolean){.cdecl, dynlib: gdklib, +proc gdk_set_show_events*(show_events: gboolean){.cdecl, dynlib: gdklib, importc: "gdk_set_show_events".} -proc gdk_get_show_events*(): gboolean{.cdecl, dynlib: gdklib, +proc gdk_get_show_events*(): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_get_show_events".} proc GDK_TYPE_FONT*(): GType -proc gdk_font_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_font_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_font_get_type".} proc gdk_font_load_for_display*(display: PGdkDisplay, font_name: cstring): PGdkFont{. cdecl, dynlib: gdklib, importc: "gdk_font_load_for_display".} proc gdk_fontset_load_for_display*(display: PGdkDisplay, fontset_name: cstring): PGdkFont{. cdecl, dynlib: gdklib, importc: "gdk_fontset_load_for_display".} -proc gdk_font_from_description_for_display*(display: PGdkDisplay, - font_desc: PPangoFontDescription): PGdkFont{.cdecl, dynlib: gdklib, +proc gdk_font_from_description_for_display*(display: PGdkDisplay, + font_desc: PPangoFontDescription): PGdkFont{.cdecl, dynlib: gdklib, importc: "gdk_font_from_description_for_display".} -proc gdk_font_ref*(font: PGdkFont): PGdkFont{.cdecl, dynlib: gdklib, +proc gdk_font_ref*(font: PGdkFont): PGdkFont{.cdecl, dynlib: gdklib, importc: "gdk_font_ref".} -proc gdk_font_unref*(font: PGdkFont){.cdecl, dynlib: gdklib, +proc gdk_font_unref*(font: PGdkFont){.cdecl, dynlib: gdklib, importc: "gdk_font_unref".} -proc gdk_font_id*(font: PGdkFont): gint{.cdecl, dynlib: gdklib, +proc gdk_font_id*(font: PGdkFont): gint{.cdecl, dynlib: gdklib, importc: "gdk_font_id".} -proc gdk_font_equal*(fonta: PGdkFont, fontb: PGdkFont): gboolean{.cdecl, +proc gdk_font_equal*(fonta: PGdkFont, fontb: PGdkFont): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_font_equal".} -proc gdk_string_width*(font: PGdkFont, `string`: cstring): gint{.cdecl, +proc gdk_string_width*(font: PGdkFont, `string`: cstring): gint{.cdecl, dynlib: gdklib, importc: "gdk_string_width".} proc gdk_text_width*(font: PGdkFont, text: cstring, text_length: gint): gint{. cdecl, dynlib: gdklib, importc: "gdk_text_width".} proc gdk_text_width_wc*(font: PGdkFont, text: PGdkWChar, text_length: gint): gint{. cdecl, dynlib: gdklib, importc: "gdk_text_width_wc".} -proc gdk_char_width*(font: PGdkFont, character: gchar): gint{.cdecl, +proc gdk_char_width*(font: PGdkFont, character: gchar): gint{.cdecl, dynlib: gdklib, importc: "gdk_char_width".} -proc gdk_char_width_wc*(font: PGdkFont, character: TGdkWChar): gint{.cdecl, +proc gdk_char_width_wc*(font: PGdkFont, character: TGdkWChar): gint{.cdecl, dynlib: gdklib, importc: "gdk_char_width_wc".} -proc gdk_string_measure*(font: PGdkFont, `string`: cstring): gint{.cdecl, +proc gdk_string_measure*(font: PGdkFont, `string`: cstring): gint{.cdecl, dynlib: gdklib, importc: "gdk_string_measure".} proc gdk_text_measure*(font: PGdkFont, text: cstring, text_length: gint): gint{. cdecl, dynlib: gdklib, importc: "gdk_text_measure".} -proc gdk_char_measure*(font: PGdkFont, character: gchar): gint{.cdecl, +proc gdk_char_measure*(font: PGdkFont, character: gchar): gint{.cdecl, dynlib: gdklib, importc: "gdk_char_measure".} -proc gdk_string_height*(font: PGdkFont, `string`: cstring): gint{.cdecl, +proc gdk_string_height*(font: PGdkFont, `string`: cstring): gint{.cdecl, dynlib: gdklib, importc: "gdk_string_height".} proc gdk_text_height*(font: PGdkFont, text: cstring, text_length: gint): gint{. cdecl, dynlib: gdklib, importc: "gdk_text_height".} -proc gdk_char_height*(font: PGdkFont, character: gchar): gint{.cdecl, +proc gdk_char_height*(font: PGdkFont, character: gchar): gint{.cdecl, dynlib: gdklib, importc: "gdk_char_height".} -proc gdk_text_extents*(font: PGdkFont, text: cstring, text_length: gint, - lbearing: Pgint, rbearing: Pgint, width: Pgint, - ascent: Pgint, descent: Pgint){.cdecl, dynlib: gdklib, +proc gdk_text_extents*(font: PGdkFont, text: cstring, text_length: gint, + lbearing: Pgint, rbearing: Pgint, width: Pgint, + ascent: Pgint, descent: Pgint){.cdecl, dynlib: gdklib, importc: "gdk_text_extents".} -proc gdk_text_extents_wc*(font: PGdkFont, text: PGdkWChar, text_length: gint, - lbearing: Pgint, rbearing: Pgint, width: Pgint, - ascent: Pgint, descent: Pgint){.cdecl, dynlib: gdklib, +proc gdk_text_extents_wc*(font: PGdkFont, text: PGdkWChar, text_length: gint, + lbearing: Pgint, rbearing: Pgint, width: Pgint, + ascent: Pgint, descent: Pgint){.cdecl, dynlib: gdklib, importc: "gdk_text_extents_wc".} -proc gdk_string_extents*(font: PGdkFont, `string`: cstring, lbearing: Pgint, - rbearing: Pgint, width: Pgint, ascent: Pgint, - descent: Pgint){.cdecl, dynlib: gdklib, +proc gdk_string_extents*(font: PGdkFont, `string`: cstring, lbearing: Pgint, + rbearing: Pgint, width: Pgint, ascent: Pgint, + descent: Pgint){.cdecl, dynlib: gdklib, importc: "gdk_string_extents".} -proc gdk_font_get_display*(font: PGdkFont): PGdkDisplay{.cdecl, dynlib: gdklib, +proc gdk_font_get_display*(font: PGdkFont): PGdkDisplay{.cdecl, dynlib: gdklib, importc: "gdk_font_get_display".} -const +const GDK_GC_FOREGROUND* = 1 shl 0 GDK_GC_BACKGROUND* = 1 shl 1 GDK_GC_FONT* = 1 shl 2 @@ -1256,65 +1255,65 @@ proc GDK_GC_CLASS*(klass: Pointer): PGdkGCClass proc GDK_IS_GC*(anObject: Pointer): bool proc GDK_IS_GC_CLASS*(klass: Pointer): bool proc GDK_GC_GET_CLASS*(obj: Pointer): PGdkGCClass -proc gdk_gc_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_gc_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_gc_get_type".} -proc gdk_gc_new*(drawable: PGdkDrawable): PGdkGC{.cdecl, dynlib: gdklib, +proc gdk_gc_new*(drawable: PGdkDrawable): PGdkGC{.cdecl, dynlib: gdklib, importc: "gdk_gc_new".} -proc gdk_gc_new_with_values*(drawable: PGdkDrawable, values: PGdkGCValues, - values_mask: TGdkGCValuesMask): PGdkGC{.cdecl, +proc gdk_gc_new_with_values*(drawable: PGdkDrawable, values: PGdkGCValues, + values_mask: TGdkGCValuesMask): PGdkGC{.cdecl, dynlib: gdklib, importc: "gdk_gc_new_with_values".} -proc gdk_gc_get_values*(gc: PGdkGC, values: PGdkGCValues){.cdecl, +proc gdk_gc_get_values*(gc: PGdkGC, values: PGdkGCValues){.cdecl, dynlib: gdklib, importc: "gdk_gc_get_values".} -proc gdk_gc_set_values*(gc: PGdkGC, values: PGdkGCValues, - values_mask: TGdkGCValuesMask){.cdecl, dynlib: gdklib, +proc gdk_gc_set_values*(gc: PGdkGC, values: PGdkGCValues, + values_mask: TGdkGCValuesMask){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_values".} -proc gdk_gc_set_foreground*(gc: PGdkGC, color: PGdkColor){.cdecl, +proc gdk_gc_set_foreground*(gc: PGdkGC, color: PGdkColor){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_foreground".} -proc gdk_gc_set_background*(gc: PGdkGC, color: PGdkColor){.cdecl, +proc gdk_gc_set_background*(gc: PGdkGC, color: PGdkColor){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_background".} -proc gdk_gc_set_function*(gc: PGdkGC, `function`: TGdkFunction){.cdecl, +proc gdk_gc_set_function*(gc: PGdkGC, `function`: TGdkFunction){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_function".} -proc gdk_gc_set_fill*(gc: PGdkGC, fill: TGdkFill){.cdecl, dynlib: gdklib, +proc gdk_gc_set_fill*(gc: PGdkGC, fill: TGdkFill){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_fill".} -proc gdk_gc_set_tile*(gc: PGdkGC, tile: PGdkPixmap){.cdecl, dynlib: gdklib, +proc gdk_gc_set_tile*(gc: PGdkGC, tile: PGdkPixmap){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_tile".} -proc gdk_gc_set_stipple*(gc: PGdkGC, stipple: PGdkPixmap){.cdecl, +proc gdk_gc_set_stipple*(gc: PGdkGC, stipple: PGdkPixmap){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_stipple".} -proc gdk_gc_set_ts_origin*(gc: PGdkGC, x: gint, y: gint){.cdecl, dynlib: gdklib, +proc gdk_gc_set_ts_origin*(gc: PGdkGC, x: gint, y: gint){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_ts_origin".} -proc gdk_gc_set_clip_origin*(gc: PGdkGC, x: gint, y: gint){.cdecl, +proc gdk_gc_set_clip_origin*(gc: PGdkGC, x: gint, y: gint){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_clip_origin".} -proc gdk_gc_set_clip_mask*(gc: PGdkGC, mask: PGdkBitmap){.cdecl, dynlib: gdklib, +proc gdk_gc_set_clip_mask*(gc: PGdkGC, mask: PGdkBitmap){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_clip_mask".} -proc gdk_gc_set_clip_rectangle*(gc: PGdkGC, rectangle: PGdkRectangle){.cdecl, +proc gdk_gc_set_clip_rectangle*(gc: PGdkGC, rectangle: PGdkRectangle){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_clip_rectangle".} -proc gdk_gc_set_clip_region*(gc: PGdkGC, region: PGdkRegion){.cdecl, +proc gdk_gc_set_clip_region*(gc: PGdkGC, region: PGdkRegion){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_clip_region".} -proc gdk_gc_set_subwindow*(gc: PGdkGC, mode: TGdkSubwindowMode){.cdecl, +proc gdk_gc_set_subwindow*(gc: PGdkGC, mode: TGdkSubwindowMode){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_subwindow".} -proc gdk_gc_set_exposures*(gc: PGdkGC, exposures: gboolean){.cdecl, +proc gdk_gc_set_exposures*(gc: PGdkGC, exposures: gboolean){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_exposures".} -proc gdk_gc_set_line_attributes*(gc: PGdkGC, line_width: gint, - line_style: TGdkLineStyle, - cap_style: TGdkCapStyle, - join_style: TGdkJoinStyle){.cdecl, +proc gdk_gc_set_line_attributes*(gc: PGdkGC, line_width: gint, + line_style: TGdkLineStyle, + cap_style: TGdkCapStyle, + join_style: TGdkJoinStyle){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_line_attributes".} -proc gdk_gc_set_dashes*(gc: PGdkGC, dash_offset: gint, - dash_list: openarray[gint8]){.cdecl, dynlib: gdklib, +proc gdk_gc_set_dashes*(gc: PGdkGC, dash_offset: gint, + dash_list: openarray[gint8]){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_dashes".} -proc gdk_gc_offset*(gc: PGdkGC, x_offset: gint, y_offset: gint){.cdecl, +proc gdk_gc_offset*(gc: PGdkGC, x_offset: gint, y_offset: gint){.cdecl, dynlib: gdklib, importc: "gdk_gc_offset".} -proc gdk_gc_copy*(dst_gc: PGdkGC, src_gc: PGdkGC){.cdecl, dynlib: gdklib, +proc gdk_gc_copy*(dst_gc: PGdkGC, src_gc: PGdkGC){.cdecl, dynlib: gdklib, importc: "gdk_gc_copy".} -proc gdk_gc_set_colormap*(gc: PGdkGC, colormap: PGdkColormap){.cdecl, +proc gdk_gc_set_colormap*(gc: PGdkGC, colormap: PGdkColormap){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_colormap".} -proc gdk_gc_get_colormap*(gc: PGdkGC): PGdkColormap{.cdecl, dynlib: gdklib, +proc gdk_gc_get_colormap*(gc: PGdkGC): PGdkColormap{.cdecl, dynlib: gdklib, importc: "gdk_gc_get_colormap".} -proc gdk_gc_set_rgb_fg_color*(gc: PGdkGC, color: PGdkColor){.cdecl, +proc gdk_gc_set_rgb_fg_color*(gc: PGdkGC, color: PGdkColor){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_rgb_fg_color".} -proc gdk_gc_set_rgb_bg_color*(gc: PGdkGC, color: PGdkColor){.cdecl, +proc gdk_gc_set_rgb_bg_color*(gc: PGdkGC, color: PGdkColor){.cdecl, dynlib: gdklib, importc: "gdk_gc_set_rgb_bg_color".} -proc gdk_gc_get_screen*(gc: PGdkGC): PGdkScreen{.cdecl, dynlib: gdklib, +proc gdk_gc_get_screen*(gc: PGdkGC): PGdkScreen{.cdecl, dynlib: gdklib, importc: "gdk_gc_get_screen".} proc GDK_TYPE_IMAGE*(): GType proc GDK_IMAGE*(anObject: Pointer): PGdkImage @@ -1322,20 +1321,20 @@ proc GDK_IMAGE_CLASS*(klass: Pointer): PGdkImageClass proc GDK_IS_IMAGE*(anObject: Pointer): bool proc GDK_IS_IMAGE_CLASS*(klass: Pointer): bool proc GDK_IMAGE_GET_CLASS*(obj: Pointer): PGdkImageClass -proc gdk_image_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_image_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_image_get_type".} -proc gdk_image_new*(`type`: TGdkImageType, visual: PGdkVisual, width: gint, - height: gint): PGdkImage{.cdecl, dynlib: gdklib, +proc gdk_image_new*(`type`: TGdkImageType, visual: PGdkVisual, width: gint, + height: gint): PGdkImage{.cdecl, dynlib: gdklib, importc: "gdk_image_new".} proc gdk_image_put_pixel*(image: PGdkImage, x: gint, y: gint, pixel: guint32){. cdecl, dynlib: gdklib, importc: "gdk_image_put_pixel".} -proc gdk_image_get_pixel*(image: PGdkImage, x: gint, y: gint): guint32{.cdecl, +proc gdk_image_get_pixel*(image: PGdkImage, x: gint, y: gint): guint32{.cdecl, dynlib: gdklib, importc: "gdk_image_get_pixel".} -proc gdk_image_set_colormap*(image: PGdkImage, colormap: PGdkColormap){.cdecl, +proc gdk_image_set_colormap*(image: PGdkImage, colormap: PGdkColormap){.cdecl, dynlib: gdklib, importc: "gdk_image_set_colormap".} -proc gdk_image_get_colormap*(image: PGdkImage): PGdkColormap{.cdecl, +proc gdk_image_get_colormap*(image: PGdkImage): PGdkColormap{.cdecl, dynlib: gdklib, importc: "gdk_image_get_colormap".} -const +const GDK_AXIS_IGNORE* = 0 GDK_AXIS_X* = 1 GDK_AXIS_Y* = 2 @@ -1351,33 +1350,33 @@ proc GDK_DEVICE_CLASS*(klass: Pointer): PGdkDeviceClass proc GDK_IS_DEVICE*(anObject: Pointer): bool proc GDK_IS_DEVICE_CLASS*(klass: Pointer): bool proc GDK_DEVICE_GET_CLASS*(obj: Pointer): PGdkDeviceClass -proc gdk_device_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_device_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_device_get_type".} -proc gdk_device_set_source*(device: PGdkDevice, source: TGdkInputSource){.cdecl, +proc gdk_device_set_source*(device: PGdkDevice, source: TGdkInputSource){.cdecl, dynlib: gdklib, importc: "gdk_device_set_source".} proc gdk_device_set_mode*(device: PGdkDevice, mode: TGdkInputMode): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_device_set_mode".} -proc gdk_device_set_key*(device: PGdkDevice, index: guint, keyval: guint, - modifiers: TGdkModifierType){.cdecl, dynlib: gdklib, +proc gdk_device_set_key*(device: PGdkDevice, index: guint, keyval: guint, + modifiers: TGdkModifierType){.cdecl, dynlib: gdklib, importc: "gdk_device_set_key".} proc gdk_device_set_axis_use*(device: PGdkDevice, index: guint, use: TGdkAxisUse){. cdecl, dynlib: gdklib, importc: "gdk_device_set_axis_use".} -proc gdk_device_get_state*(device: PGdkDevice, window: PGdkWindow, - axes: Pgdouble, mask: PGdkModifierType){.cdecl, +proc gdk_device_get_state*(device: PGdkDevice, window: PGdkWindow, + axes: Pgdouble, mask: PGdkModifierType){.cdecl, dynlib: gdklib, importc: "gdk_device_get_state".} -proc gdk_device_get_history*(device: PGdkDevice, window: PGdkWindow, - start: guint32, stop: guint32, +proc gdk_device_get_history*(device: PGdkDevice, window: PGdkWindow, + start: guint32, stop: guint32, s: var PPGdkTimeCoord, n_events: Pgint): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_device_get_history".} -proc gdk_device_free_history*(events: PPGdkTimeCoord, n_events: gint){.cdecl, +proc gdk_device_free_history*(events: PPGdkTimeCoord, n_events: gint){.cdecl, dynlib: gdklib, importc: "gdk_device_free_history".} -proc gdk_device_get_axis*(device: PGdkDevice, axes: Pgdouble, use: TGdkAxisUse, - value: Pgdouble): gboolean{.cdecl, dynlib: gdklib, +proc gdk_device_get_axis*(device: PGdkDevice, axes: Pgdouble, use: TGdkAxisUse, + value: Pgdouble): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_device_get_axis".} -proc gdk_input_set_extension_events*(window: PGdkWindow, mask: gint, - mode: TGdkExtensionMode){.cdecl, +proc gdk_input_set_extension_events*(window: PGdkWindow, mask: gint, + mode: TGdkExtensionMode){.cdecl, dynlib: gdklib, importc: "gdk_input_set_extension_events".} -proc gdk_device_get_core_pointer*(): PGdkDevice{.cdecl, dynlib: gdklib, +proc gdk_device_get_core_pointer*(): PGdkDevice{.cdecl, dynlib: gdklib, importc: "gdk_device_get_core_pointer".} proc GDK_TYPE_KEYMAP*(): GType proc GDK_KEYMAP*(anObject: Pointer): PGdkKeymap @@ -1385,45 +1384,45 @@ proc GDK_KEYMAP_CLASS*(klass: Pointer): PGdkKeymapClass proc GDK_IS_KEYMAP*(anObject: Pointer): bool proc GDK_IS_KEYMAP_CLASS*(klass: Pointer): bool proc GDK_KEYMAP_GET_CLASS*(obj: Pointer): PGdkKeymapClass -proc gdk_keymap_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_keymap_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_keymap_get_type".} -proc gdk_keymap_get_for_display*(display: PGdkDisplay): PGdkKeymap{.cdecl, +proc gdk_keymap_get_for_display*(display: PGdkDisplay): PGdkKeymap{.cdecl, dynlib: gdklib, importc: "gdk_keymap_get_for_display".} proc gdk_keymap_lookup_key*(keymap: PGdkKeymap, key: PGdkKeymapKey): guint{. cdecl, dynlib: gdklib, importc: "gdk_keymap_lookup_key".} -proc gdk_keymap_translate_keyboard_state*(keymap: PGdkKeymap, - hardware_keycode: guint, state: TGdkModifierType, group: gint, - keyval: Pguint, effective_group: Pgint, level: Pgint, - consumed_modifiers: PGdkModifierType): gboolean{.cdecl, dynlib: gdklib, +proc gdk_keymap_translate_keyboard_state*(keymap: PGdkKeymap, + hardware_keycode: guint, state: TGdkModifierType, group: gint, + keyval: Pguint, effective_group: Pgint, level: Pgint, + consumed_modifiers: PGdkModifierType): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_keymap_translate_keyboard_state".} -proc gdk_keymap_get_entries_for_keyval*(keymap: PGdkKeymap, keyval: guint, +proc gdk_keymap_get_entries_for_keyval*(keymap: PGdkKeymap, keyval: guint, s: var PGdkKeymapKey, n_keys: Pgint): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_keymap_get_entries_for_keyval".} -proc gdk_keymap_get_entries_for_keycode*(keymap: PGdkKeymap, - hardware_keycode: guint, s: var PGdkKeymapKey, sasdf: var Pguint, - n_entries: Pgint): gboolean{.cdecl, dynlib: gdklib, +proc gdk_keymap_get_entries_for_keycode*(keymap: PGdkKeymap, + hardware_keycode: guint, s: var PGdkKeymapKey, sasdf: var Pguint, + n_entries: Pgint): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_keymap_get_entries_for_keycode".} -proc gdk_keymap_get_direction*(keymap: PGdkKeymap): TPangoDirection{.cdecl, +proc gdk_keymap_get_direction*(keymap: PGdkKeymap): TPangoDirection{.cdecl, dynlib: gdklib, importc: "gdk_keymap_get_direction".} -proc gdk_keyval_name*(keyval: guint): cstring{.cdecl, dynlib: gdklib, +proc gdk_keyval_name*(keyval: guint): cstring{.cdecl, dynlib: gdklib, importc: "gdk_keyval_name".} -proc gdk_keyval_from_name*(keyval_name: cstring): guint{.cdecl, dynlib: gdklib, +proc gdk_keyval_from_name*(keyval_name: cstring): guint{.cdecl, dynlib: gdklib, importc: "gdk_keyval_from_name".} proc gdk_keyval_convert_case*(symbol: guint, lower: Pguint, upper: Pguint){. cdecl, dynlib: gdklib, importc: "gdk_keyval_convert_case".} -proc gdk_keyval_to_upper*(keyval: guint): guint{.cdecl, dynlib: gdklib, +proc gdk_keyval_to_upper*(keyval: guint): guint{.cdecl, dynlib: gdklib, importc: "gdk_keyval_to_upper".} -proc gdk_keyval_to_lower*(keyval: guint): guint{.cdecl, dynlib: gdklib, +proc gdk_keyval_to_lower*(keyval: guint): guint{.cdecl, dynlib: gdklib, importc: "gdk_keyval_to_lower".} -proc gdk_keyval_is_upper*(keyval: guint): gboolean{.cdecl, dynlib: gdklib, +proc gdk_keyval_is_upper*(keyval: guint): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_keyval_is_upper".} -proc gdk_keyval_is_lower*(keyval: guint): gboolean{.cdecl, dynlib: gdklib, +proc gdk_keyval_is_lower*(keyval: guint): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_keyval_is_lower".} -proc gdk_keyval_to_unicode*(keyval: guint): guint32{.cdecl, dynlib: gdklib, +proc gdk_keyval_to_unicode*(keyval: guint): guint32{.cdecl, dynlib: gdklib, importc: "gdk_keyval_to_unicode".} -proc gdk_unicode_to_keyval*(wc: guint32): guint{.cdecl, dynlib: gdklib, +proc gdk_unicode_to_keyval*(wc: guint32): guint{.cdecl, dynlib: gdklib, importc: "gdk_unicode_to_keyval".} -const +const GDK_KEY_VoidSymbol* = 0x00FFFFFF GDK_KEY_BackSpace* = 0x0000FF08 GDK_KEY_Tab* = 0x0000FF09 @@ -2760,50 +2759,50 @@ const proc gdk_pango_context_get_for_screen*(screen: PGdkScreen): PPangoContext{. cdecl, dynlib: gdklib, importc: "gdk_pango_context_get_for_screen".} -proc gdk_pango_context_set_colormap*(context: PPangoContext, - colormap: PGdkColormap){.cdecl, +proc gdk_pango_context_set_colormap*(context: PPangoContext, + colormap: PGdkColormap){.cdecl, dynlib: gdklib, importc: "gdk_pango_context_set_colormap".} -proc gdk_pango_layout_line_get_clip_region*(line: PPangoLayoutLine, +proc gdk_pango_layout_line_get_clip_region*(line: PPangoLayoutLine, x_origin: gint, y_origin: gint, index_ranges: Pgint, n_ranges: gint): PGdkRegion{. cdecl, dynlib: gdklib, importc: "gdk_pango_layout_line_get_clip_region".} -proc gdk_pango_layout_get_clip_region*(layout: PPangoLayout, x_origin: gint, - y_origin: gint, index_ranges: Pgint, - n_ranges: gint): PGdkRegion{.cdecl, +proc gdk_pango_layout_get_clip_region*(layout: PPangoLayout, x_origin: gint, + y_origin: gint, index_ranges: Pgint, + n_ranges: gint): PGdkRegion{.cdecl, dynlib: gdklib, importc: "gdk_pango_layout_get_clip_region".} -proc gdk_pango_attr_stipple_new*(stipple: PGdkBitmap): PPangoAttribute{.cdecl, +proc gdk_pango_attr_stipple_new*(stipple: PGdkBitmap): PPangoAttribute{.cdecl, dynlib: gdklib, importc: "gdk_pango_attr_stipple_new".} -proc gdk_pango_attr_embossed_new*(embossed: gboolean): PPangoAttribute{.cdecl, +proc gdk_pango_attr_embossed_new*(embossed: gboolean): PPangoAttribute{.cdecl, dynlib: gdklib, importc: "gdk_pango_attr_embossed_new".} -proc gdk_pixbuf_render_threshold_alpha*(pixbuf: PGdkPixbuf, bitmap: PGdkBitmap, - src_x: int32, src_y: int32, - dest_x: int32, dest_y: int32, - width: int32, height: int32, - alpha_threshold: int32){.cdecl, +proc gdk_pixbuf_render_threshold_alpha*(pixbuf: PGdkPixbuf, bitmap: PGdkBitmap, + src_x: int32, src_y: int32, + dest_x: int32, dest_y: int32, + width: int32, height: int32, + alpha_threshold: int32){.cdecl, dynlib: gdklib, importc: "gdk_pixbuf_render_threshold_alpha".} -proc gdk_pixbuf_render_to_drawable*(pixbuf: PGdkPixbuf, drawable: PGdkDrawable, - gc: PGdkGC, src_x: int32, src_y: int32, - dest_x: int32, dest_y: int32, width: int32, - height: int32, dither: TGdkRgbDither, - x_dither: int32, y_dither: int32){.cdecl, +proc gdk_pixbuf_render_to_drawable*(pixbuf: PGdkPixbuf, drawable: PGdkDrawable, + gc: PGdkGC, src_x: int32, src_y: int32, + dest_x: int32, dest_y: int32, width: int32, + height: int32, dither: TGdkRgbDither, + x_dither: int32, y_dither: int32){.cdecl, dynlib: gdklib, importc: "gdk_pixbuf_render_to_drawable".} -proc gdk_pixbuf_render_to_drawable_alpha*(pixbuf: PGdkPixbuf, - drawable: PGdkDrawable, src_x: int32, src_y: int32, dest_x: int32, - dest_y: int32, width: int32, height: int32, alpha_mode: TGdkPixbufAlphaMode, - alpha_threshold: int32, dither: TGdkRgbDither, x_dither: int32, - y_dither: int32){.cdecl, dynlib: gdklib, +proc gdk_pixbuf_render_to_drawable_alpha*(pixbuf: PGdkPixbuf, + drawable: PGdkDrawable, src_x: int32, src_y: int32, dest_x: int32, + dest_y: int32, width: int32, height: int32, alpha_mode: TGdkPixbufAlphaMode, + alpha_threshold: int32, dither: TGdkRgbDither, x_dither: int32, + y_dither: int32){.cdecl, dynlib: gdklib, importc: "gdk_pixbuf_render_to_drawable_alpha".} -proc gdk_pixbuf_render_pixmap_and_mask_for_colormap*(pixbuf: PGdkPixbuf, - colormap: PGdkColormap, n: var PGdkPixmap, nasdfdsafw4e: var PGdkBitmap, +proc gdk_pixbuf_render_pixmap_and_mask_for_colormap*(pixbuf: PGdkPixbuf, + colormap: PGdkColormap, n: var PGdkPixmap, nasdfdsafw4e: var PGdkBitmap, alpha_threshold: int32){.cdecl, dynlib: gdklib, importc: "gdk_pixbuf_render_pixmap_and_mask_for_colormap".} -proc gdk_pixbuf_get_from_drawable*(dest: PGdkPixbuf, src: PGdkDrawable, - cmap: PGdkColormap, src_x: int32, - src_y: int32, dest_x: int32, dest_y: int32, +proc gdk_pixbuf_get_from_drawable*(dest: PGdkPixbuf, src: PGdkDrawable, + cmap: PGdkColormap, src_x: int32, + src_y: int32, dest_x: int32, dest_y: int32, width: int32, height: int32): PGdkPixbuf{. cdecl, dynlib: gdklib, importc: "gdk_pixbuf_get_from_drawable".} -proc gdk_pixbuf_get_from_image*(dest: PGdkPixbuf, src: PGdkImage, - cmap: PGdkColormap, src_x: int32, src_y: int32, - dest_x: int32, dest_y: int32, width: int32, - height: int32): PGdkPixbuf{.cdecl, +proc gdk_pixbuf_get_from_image*(dest: PGdkPixbuf, src: PGdkImage, + cmap: PGdkColormap, src_x: int32, src_y: int32, + dest_x: int32, dest_y: int32, width: int32, + height: int32): PGdkPixbuf{.cdecl, dynlib: gdklib, importc: "gdk_pixbuf_get_from_image".} proc GDK_TYPE_PIXMAP*(): GType proc GDK_PIXMAP*(anObject: Pointer): PGdkPixmap @@ -2812,85 +2811,85 @@ proc GDK_IS_PIXMAP*(anObject: Pointer): bool proc GDK_IS_PIXMAP_CLASS*(klass: Pointer): bool proc GDK_PIXMAP_GET_CLASS*(obj: Pointer): PGdkPixmapObjectClass proc GDK_PIXMAP_OBJECT*(anObject: Pointer): PGdkPixmapObject -proc gdk_pixmap_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_pixmap_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_pixmap_get_type".} proc gdk_pixmap_new*(window: PGdkWindow, width: gint, height: gint, depth: gint): PGdkPixmap{. cdecl, dynlib: gdklib, importc: "gdk_pixmap_new".} -proc gdk_bitmap_create_from_data*(window: PGdkWindow, data: cstring, width: gint, - height: gint): PGdkBitmap{.cdecl, +proc gdk_bitmap_create_from_data*(window: PGdkWindow, data: cstring, width: gint, + height: gint): PGdkBitmap{.cdecl, dynlib: gdklib, importc: "gdk_bitmap_create_from_data".} -proc gdk_pixmap_create_from_data*(window: PGdkWindow, data: cstring, width: gint, - height: gint, depth: gint, fg: PGdkColor, - bg: PGdkColor): PGdkPixmap{.cdecl, +proc gdk_pixmap_create_from_data*(window: PGdkWindow, data: cstring, width: gint, + height: gint, depth: gint, fg: PGdkColor, + bg: PGdkColor): PGdkPixmap{.cdecl, dynlib: gdklib, importc: "gdk_pixmap_create_from_data".} -proc gdk_pixmap_create_from_xpm*(window: PGdkWindow, k: var PGdkBitmap, +proc gdk_pixmap_create_from_xpm*(window: PGdkWindow, k: var PGdkBitmap, transparent_color: PGdkColor, filename: cstring): PGdkPixmap{. cdecl, dynlib: gdklib, importc: "gdk_pixmap_create_from_xpm".} -proc gdk_pixmap_colormap_create_from_xpm*(window: PGdkWindow, - colormap: PGdkColormap, k: var PGdkBitmap, transparent_color: PGdkColor, +proc gdk_pixmap_colormap_create_from_xpm*(window: PGdkWindow, + colormap: PGdkColormap, k: var PGdkBitmap, transparent_color: PGdkColor, filename: cstring): PGdkPixmap{.cdecl, dynlib: gdklib, importc: "gdk_pixmap_colormap_create_from_xpm".} -proc gdk_pixmap_create_from_xpm_d*(window: PGdkWindow, k: var PGdkBitmap, +proc gdk_pixmap_create_from_xpm_d*(window: PGdkWindow, k: var PGdkBitmap, transparent_color: PGdkColor, data: PPgchar): PGdkPixmap{. cdecl, dynlib: gdklib, importc: "gdk_pixmap_create_from_xpm_d".} -proc gdk_pixmap_colormap_create_from_xpm_d*(window: PGdkWindow, - colormap: PGdkColormap, k: var PGdkBitmap, transparent_color: PGdkColor, +proc gdk_pixmap_colormap_create_from_xpm_d*(window: PGdkWindow, + colormap: PGdkColormap, k: var PGdkBitmap, transparent_color: PGdkColor, data: PPgchar): PGdkPixmap{.cdecl, dynlib: gdklib, importc: "gdk_pixmap_colormap_create_from_xpm_d".} -proc gdk_pixmap_foreign_new_for_display*(display: PGdkDisplay, - anid: TGdkNativeWindow): PGdkPixmap{.cdecl, dynlib: gdklib, +proc gdk_pixmap_foreign_new_for_display*(display: PGdkDisplay, + anid: TGdkNativeWindow): PGdkPixmap{.cdecl, dynlib: gdklib, importc: "gdk_pixmap_foreign_new_for_display".} proc gdk_pixmap_lookup_for_display*(display: PGdkDisplay, anid: TGdkNativeWindow): PGdkPixmap{. cdecl, dynlib: gdklib, importc: "gdk_pixmap_lookup_for_display".} proc gdk_atom_intern*(atom_name: cstring, only_if_exists: gboolean): TGdkAtom{. cdecl, dynlib: gdklib, importc: "gdk_atom_intern".} -proc gdk_atom_name*(atom: TGdkAtom): cstring{.cdecl, dynlib: gdklib, +proc gdk_atom_name*(atom: TGdkAtom): cstring{.cdecl, dynlib: gdklib, importc: "gdk_atom_name".} -proc gdk_property_get*(window: PGdkWindow, `property`: TGdkAtom, - `type`: TGdkAtom, offset: gulong, length: gulong, - pdelete: gint, actual_property_type: PGdkAtom, - actual_format: Pgint, actual_length: Pgint, - data: PPguchar): gboolean{.cdecl, dynlib: gdklib, +proc gdk_property_get*(window: PGdkWindow, `property`: TGdkAtom, + `type`: TGdkAtom, offset: gulong, length: gulong, + pdelete: gint, actual_property_type: PGdkAtom, + actual_format: Pgint, actual_length: Pgint, + data: PPguchar): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_property_get".} -proc gdk_property_change*(window: PGdkWindow, `property`: TGdkAtom, - `type`: TGdkAtom, format: gint, mode: TGdkPropMode, - data: Pguchar, nelements: gint){.cdecl, +proc gdk_property_change*(window: PGdkWindow, `property`: TGdkAtom, + `type`: TGdkAtom, format: gint, mode: TGdkPropMode, + data: Pguchar, nelements: gint){.cdecl, dynlib: gdklib, importc: "gdk_property_change".} -proc gdk_property_delete*(window: PGdkWindow, `property`: TGdkAtom){.cdecl, +proc gdk_property_delete*(window: PGdkWindow, `property`: TGdkAtom){.cdecl, dynlib: gdklib, importc: "gdk_property_delete".} -proc gdk_text_property_to_text_list_for_display*(display: PGdkDisplay, - encoding: TGdkAtom, format: gint, text: Pguchar, length: gint, +proc gdk_text_property_to_text_list_for_display*(display: PGdkDisplay, + encoding: TGdkAtom, format: gint, text: Pguchar, length: gint, t: var PPgchar): gint{.cdecl, dynlib: gdklib, importc: "gdk_text_property_to_text_list_for_display".} -proc gdk_text_property_to_utf8_list_for_display*(display: PGdkDisplay, - encoding: TGdkAtom, format: gint, text: Pguchar, length: gint, +proc gdk_text_property_to_utf8_list_for_display*(display: PGdkDisplay, + encoding: TGdkAtom, format: gint, text: Pguchar, length: gint, t: var PPgchar): gint{.cdecl, dynlib: gdklib, importc: "gdk_text_property_to_utf8_list_for_display".} -proc gdk_utf8_to_string_target*(str: cstring): cstring{.cdecl, dynlib: gdklib, +proc gdk_utf8_to_string_target*(str: cstring): cstring{.cdecl, dynlib: gdklib, importc: "gdk_utf8_to_string_target".} -proc gdk_string_to_compound_text_for_display*(display: PGdkDisplay, str: cstring, +proc gdk_string_to_compound_text_for_display*(display: PGdkDisplay, str: cstring, encoding: PGdkAtom, format: Pgint, ctext: PPguchar, length: Pgint): gint{. cdecl, dynlib: gdklib, importc: "gdk_string_to_compound_text_for_display".} -proc gdk_utf8_to_compound_text_for_display*(display: PGdkDisplay, str: cstring, +proc gdk_utf8_to_compound_text_for_display*(display: PGdkDisplay, str: cstring, encoding: PGdkAtom, format: Pgint, ctext: PPguchar, length: Pgint): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_utf8_to_compound_text_for_display".} -proc gdk_free_text_list*(list: PPgchar){.cdecl, dynlib: gdklib, +proc gdk_free_text_list*(list: PPgchar){.cdecl, dynlib: gdklib, importc: "gdk_free_text_list".} -proc gdk_free_compound_text*(ctext: Pguchar){.cdecl, dynlib: gdklib, +proc gdk_free_compound_text*(ctext: Pguchar){.cdecl, dynlib: gdklib, importc: "gdk_free_compound_text".} -proc gdk_region_new*(): PGdkRegion{.cdecl, dynlib: gdklib, +proc gdk_region_new*(): PGdkRegion{.cdecl, dynlib: gdklib, importc: "gdk_region_new".} -proc gdk_region_polygon*(points: PGdkPoint, npoints: gint, - fill_rule: TGdkFillRule): PGdkRegion{.cdecl, +proc gdk_region_polygon*(points: PGdkPoint, npoints: gint, + fill_rule: TGdkFillRule): PGdkRegion{.cdecl, dynlib: gdklib, importc: "gdk_region_polygon".} -proc gdk_region_copy*(region: PGdkRegion): PGdkRegion{.cdecl, dynlib: gdklib, +proc gdk_region_copy*(region: PGdkRegion): PGdkRegion{.cdecl, dynlib: gdklib, importc: "gdk_region_copy".} -proc gdk_region_rectangle*(rectangle: PGdkRectangle): PGdkRegion{.cdecl, +proc gdk_region_rectangle*(rectangle: PGdkRectangle): PGdkRegion{.cdecl, dynlib: gdklib, importc: "gdk_region_rectangle".} -proc gdk_region_destroy*(region: PGdkRegion){.cdecl, dynlib: gdklib, +proc gdk_region_destroy*(region: PGdkRegion){.cdecl, dynlib: gdklib, importc: "gdk_region_destroy".} proc gdk_region_get_clipbox*(region: PGdkRegion, rectangle: PGdkRectangle){. cdecl, dynlib: gdklib, importc: "gdk_region_get_clipbox".} -proc gdk_region_get_rectangles*(region: PGdkRegion, s: var PGdkRectangle, - n_rectangles: Pgint){.cdecl, dynlib: gdklib, +proc gdk_region_get_rectangles*(region: PGdkRegion, s: var PGdkRectangle, + n_rectangles: Pgint){.cdecl, dynlib: gdklib, importc: "gdk_region_get_rectangles".} -proc gdk_region_empty*(region: PGdkRegion): gboolean{.cdecl, dynlib: gdklib, +proc gdk_region_empty*(region: PGdkRegion): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_region_empty".} proc gdk_region_equal*(region1: PGdkRegion, region2: PGdkRegion): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_region_equal".} @@ -2898,62 +2897,62 @@ proc gdk_region_point_in*(region: PGdkRegion, x: int32, y: int32): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_region_point_in".} proc gdk_region_rect_in*(region: PGdkRegion, rect: PGdkRectangle): TGdkOverlapType{. cdecl, dynlib: gdklib, importc: "gdk_region_rect_in".} -proc gdk_region_offset*(region: PGdkRegion, dx: gint, dy: gint){.cdecl, +proc gdk_region_offset*(region: PGdkRegion, dx: gint, dy: gint){.cdecl, dynlib: gdklib, importc: "gdk_region_offset".} -proc gdk_region_shrink*(region: PGdkRegion, dx: gint, dy: gint){.cdecl, +proc gdk_region_shrink*(region: PGdkRegion, dx: gint, dy: gint){.cdecl, dynlib: gdklib, importc: "gdk_region_shrink".} proc gdk_region_union_with_rect*(region: PGdkRegion, rect: PGdkRectangle){. cdecl, dynlib: gdklib, importc: "gdk_region_union_with_rect".} -proc gdk_region_intersect*(source1: PGdkRegion, source2: PGdkRegion){.cdecl, +proc gdk_region_intersect*(source1: PGdkRegion, source2: PGdkRegion){.cdecl, dynlib: gdklib, importc: "gdk_region_intersect".} -proc gdk_region_union*(source1: PGdkRegion, source2: PGdkRegion){.cdecl, +proc gdk_region_union*(source1: PGdkRegion, source2: PGdkRegion){.cdecl, dynlib: gdklib, importc: "gdk_region_union".} -proc gdk_region_subtract*(source1: PGdkRegion, source2: PGdkRegion){.cdecl, +proc gdk_region_subtract*(source1: PGdkRegion, source2: PGdkRegion){.cdecl, dynlib: gdklib, importc: "gdk_region_subtract".} -proc gdk_region_xor*(source1: PGdkRegion, source2: PGdkRegion){.cdecl, +proc gdk_region_xor*(source1: PGdkRegion, source2: PGdkRegion){.cdecl, dynlib: gdklib, importc: "gdk_region_xor".} -proc gdk_region_spans_intersect_foreach*(region: PGdkRegion, spans: PGdkSpan, +proc gdk_region_spans_intersect_foreach*(region: PGdkRegion, spans: PGdkSpan, n_spans: int32, sorted: gboolean, `function`: TGdkSpanFunc, data: gpointer){. cdecl, dynlib: gdklib, importc: "gdk_region_spans_intersect_foreach".} -proc gdk_rgb_find_color*(colormap: PGdkColormap, color: PGdkColor){.cdecl, +proc gdk_rgb_find_color*(colormap: PGdkColormap, color: PGdkColor){.cdecl, dynlib: gdklib, importc: "gdk_rgb_find_color".} -proc gdk_draw_rgb_image*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, y: gint, - width: gint, height: gint, dith: TGdkRgbDither, - rgb_buf: Pguchar, rowstride: gint){.cdecl, +proc gdk_draw_rgb_image*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, y: gint, + width: gint, height: gint, dith: TGdkRgbDither, + rgb_buf: Pguchar, rowstride: gint){.cdecl, dynlib: gdklib, importc: "gdk_draw_rgb_image".} -proc gdk_draw_rgb_image_dithalign*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, - y: gint, width: gint, height: gint, - dith: TGdkRgbDither, rgb_buf: Pguchar, +proc gdk_draw_rgb_image_dithalign*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, + y: gint, width: gint, height: gint, + dith: TGdkRgbDither, rgb_buf: Pguchar, rowstride: gint, xdith: gint, ydith: gint){. cdecl, dynlib: gdklib, importc: "gdk_draw_rgb_image_dithalign".} -proc gdk_draw_rgb_32_image*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, - y: gint, width: gint, height: gint, +proc gdk_draw_rgb_32_image*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, + y: gint, width: gint, height: gint, dith: TGdkRgbDither, buf: Pguchar, rowstride: gint){. cdecl, dynlib: gdklib, importc: "gdk_draw_rgb_32_image".} -proc gdk_draw_rgb_32_image_dithalign*(drawable: PGdkDrawable, gc: PGdkGC, - x: gint, y: gint, width: gint, - height: gint, dith: TGdkRgbDither, - buf: Pguchar, rowstride: gint, - xdith: gint, ydith: gint){.cdecl, +proc gdk_draw_rgb_32_image_dithalign*(drawable: PGdkDrawable, gc: PGdkGC, + x: gint, y: gint, width: gint, + height: gint, dith: TGdkRgbDither, + buf: Pguchar, rowstride: gint, + xdith: gint, ydith: gint){.cdecl, dynlib: gdklib, importc: "gdk_draw_rgb_32_image_dithalign".} -proc gdk_draw_gray_image*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, y: gint, - width: gint, height: gint, dith: TGdkRgbDither, - buf: Pguchar, rowstride: gint){.cdecl, dynlib: gdklib, +proc gdk_draw_gray_image*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, y: gint, + width: gint, height: gint, dith: TGdkRgbDither, + buf: Pguchar, rowstride: gint){.cdecl, dynlib: gdklib, importc: "gdk_draw_gray_image".} -proc gdk_draw_indexed_image*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, - y: gint, width: gint, height: gint, - dith: TGdkRgbDither, buf: Pguchar, rowstride: gint, - cmap: PGdkRgbCmap){.cdecl, dynlib: gdklib, +proc gdk_draw_indexed_image*(drawable: PGdkDrawable, gc: PGdkGC, x: gint, + y: gint, width: gint, height: gint, + dith: TGdkRgbDither, buf: Pguchar, rowstride: gint, + cmap: PGdkRgbCmap){.cdecl, dynlib: gdklib, importc: "gdk_draw_indexed_image".} -proc gdk_rgb_cmap_new*(colors: Pguint32, n_colors: gint): PGdkRgbCmap{.cdecl, +proc gdk_rgb_cmap_new*(colors: Pguint32, n_colors: gint): PGdkRgbCmap{.cdecl, dynlib: gdklib, importc: "gdk_rgb_cmap_new".} -proc gdk_rgb_cmap_free*(cmap: PGdkRgbCmap){.cdecl, dynlib: gdklib, +proc gdk_rgb_cmap_free*(cmap: PGdkRgbCmap){.cdecl, dynlib: gdklib, importc: "gdk_rgb_cmap_free".} -proc gdk_rgb_set_verbose*(verbose: gboolean){.cdecl, dynlib: gdklib, +proc gdk_rgb_set_verbose*(verbose: gboolean){.cdecl, dynlib: gdklib, importc: "gdk_rgb_set_verbose".} -proc gdk_rgb_set_install*(install: gboolean){.cdecl, dynlib: gdklib, +proc gdk_rgb_set_install*(install: gboolean){.cdecl, dynlib: gdklib, importc: "gdk_rgb_set_install".} -proc gdk_rgb_set_min_colors*(min_colors: gint){.cdecl, dynlib: gdklib, +proc gdk_rgb_set_min_colors*(min_colors: gint){.cdecl, dynlib: gdklib, importc: "gdk_rgb_set_min_colors".} proc GDK_TYPE_DISPLAY*(): GType proc GDK_DISPLAY_OBJECT*(anObject: pointer): PGdkDisplay @@ -2961,46 +2960,46 @@ proc GDK_DISPLAY_CLASS*(klass: pointer): PGdkDisplayClass proc GDK_IS_DISPLAY*(anObject: pointer): bool proc GDK_IS_DISPLAY_CLASS*(klass: pointer): bool proc GDK_DISPLAY_GET_CLASS*(obj: pointer): PGdkDisplayClass -proc gdk_display_open*(display_name: cstring): PGdkDisplay{.cdecl, +proc gdk_display_open*(display_name: cstring): PGdkDisplay{.cdecl, dynlib: gdklib, importc: "gdk_display_open".} -proc gdk_display_get_name*(display: PGdkDisplay): cstring{.cdecl, dynlib: gdklib, +proc gdk_display_get_name*(display: PGdkDisplay): cstring{.cdecl, dynlib: gdklib, importc: "gdk_display_get_name".} -proc gdk_display_get_n_screens*(display: PGdkDisplay): gint{.cdecl, +proc gdk_display_get_n_screens*(display: PGdkDisplay): gint{.cdecl, dynlib: gdklib, importc: "gdk_display_get_n_screens".} proc gdk_display_get_screen*(display: PGdkDisplay, screen_num: gint): PGdkScreen{. cdecl, dynlib: gdklib, importc: "gdk_display_get_screen".} -proc gdk_display_get_default_screen*(display: PGdkDisplay): PGdkScreen{.cdecl, +proc gdk_display_get_default_screen*(display: PGdkDisplay): PGdkScreen{.cdecl, dynlib: gdklib, importc: "gdk_display_get_default_screen".} -proc gdk_display_pointer_ungrab*(display: PGdkDisplay, time: guint32){.cdecl, +proc gdk_display_pointer_ungrab*(display: PGdkDisplay, time: guint32){.cdecl, dynlib: gdklib, importc: "gdk_display_pointer_ungrab".} -proc gdk_display_keyboard_ungrab*(display: PGdkDisplay, time: guint32){.cdecl, +proc gdk_display_keyboard_ungrab*(display: PGdkDisplay, time: guint32){.cdecl, dynlib: gdklib, importc: "gdk_display_keyboard_ungrab".} -proc gdk_display_pointer_is_grabbed*(display: PGdkDisplay): gboolean{.cdecl, +proc gdk_display_pointer_is_grabbed*(display: PGdkDisplay): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_display_pointer_is_grabbed".} -proc gdk_display_beep*(display: PGdkDisplay){.cdecl, dynlib: gdklib, +proc gdk_display_beep*(display: PGdkDisplay){.cdecl, dynlib: gdklib, importc: "gdk_display_beep".} -proc gdk_display_sync*(display: PGdkDisplay){.cdecl, dynlib: gdklib, +proc gdk_display_sync*(display: PGdkDisplay){.cdecl, dynlib: gdklib, importc: "gdk_display_sync".} -proc gdk_display_close*(display: PGdkDisplay){.cdecl, dynlib: gdklib, +proc gdk_display_close*(display: PGdkDisplay){.cdecl, dynlib: gdklib, importc: "gdk_display_close".} -proc gdk_display_list_devices*(display: PGdkDisplay): PGList{.cdecl, +proc gdk_display_list_devices*(display: PGdkDisplay): PGList{.cdecl, dynlib: gdklib, importc: "gdk_display_list_devices".} -proc gdk_display_get_event*(display: PGdkDisplay): PGdkEvent{.cdecl, +proc gdk_display_get_event*(display: PGdkDisplay): PGdkEvent{.cdecl, dynlib: gdklib, importc: "gdk_display_get_event".} -proc gdk_display_peek_event*(display: PGdkDisplay): PGdkEvent{.cdecl, +proc gdk_display_peek_event*(display: PGdkDisplay): PGdkEvent{.cdecl, dynlib: gdklib, importc: "gdk_display_peek_event".} -proc gdk_display_put_event*(display: PGdkDisplay, event: PGdkEvent){.cdecl, +proc gdk_display_put_event*(display: PGdkDisplay, event: PGdkEvent){.cdecl, dynlib: gdklib, importc: "gdk_display_put_event".} -proc gdk_display_add_client_message_filter*(display: PGdkDisplay, - message_type: TGdkAtom, func: TGdkFilterFunc, data: gpointer){.cdecl, +proc gdk_display_add_client_message_filter*(display: PGdkDisplay, + message_type: TGdkAtom, func: TGdkFilterFunc, data: gpointer){.cdecl, dynlib: gdklib, importc: "gdk_display_add_client_message_filter".} proc gdk_display_set_double_click_time*(display: PGdkDisplay, msec: guint){. cdecl, dynlib: gdklib, importc: "gdk_display_set_double_click_time".} proc gdk_display_set_sm_client_id*(display: PGdkDisplay, sm_client_id: cstring){. cdecl, dynlib: gdklib, importc: "gdk_display_set_sm_client_id".} -proc gdk_set_default_display*(display: PGdkDisplay){.cdecl, dynlib: gdklib, +proc gdk_set_default_display*(display: PGdkDisplay){.cdecl, dynlib: gdklib, importc: "gdk_set_default_display".} -proc gdk_get_default_display*(): PGdkDisplay{.cdecl, dynlib: gdklib, +proc gdk_get_default_display*(): PGdkDisplay{.cdecl, dynlib: gdklib, importc: "gdk_get_default_display".} proc GDK_TYPE_SCREEN*(): GType proc GDK_SCREEN*(anObject: Pointer): PGdkScreen @@ -3008,45 +3007,45 @@ proc GDK_SCREEN_CLASS*(klass: Pointer): PGdkScreenClass proc GDK_IS_SCREEN*(anObject: Pointer): bool proc GDK_IS_SCREEN_CLASS*(klass: Pointer): bool proc GDK_SCREEN_GET_CLASS*(obj: Pointer): PGdkScreenClass -proc gdk_screen_get_default_colormap*(screen: PGdkScreen): PGdkColormap{.cdecl, +proc gdk_screen_get_default_colormap*(screen: PGdkScreen): PGdkColormap{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_default_colormap".} proc gdk_screen_set_default_colormap*(screen: PGdkScreen, colormap: PGdkColormap){. cdecl, dynlib: gdklib, importc: "gdk_screen_set_default_colormap".} -proc gdk_screen_get_system_colormap*(screen: PGdkScreen): PGdkColormap{.cdecl, +proc gdk_screen_get_system_colormap*(screen: PGdkScreen): PGdkColormap{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_system_colormap".} -proc gdk_screen_get_system_visual*(screen: PGdkScreen): PGdkVisual{.cdecl, +proc gdk_screen_get_system_visual*(screen: PGdkScreen): PGdkVisual{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_system_visual".} -proc gdk_screen_get_rgb_colormap*(screen: PGdkScreen): PGdkColormap{.cdecl, +proc gdk_screen_get_rgb_colormap*(screen: PGdkScreen): PGdkColormap{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_rgb_colormap".} -proc gdk_screen_get_rgb_visual*(screen: PGdkScreen): PGdkVisual{.cdecl, +proc gdk_screen_get_rgb_visual*(screen: PGdkScreen): PGdkVisual{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_rgb_visual".} -proc gdk_screen_get_root_window*(screen: PGdkScreen): PGdkWindow{.cdecl, +proc gdk_screen_get_root_window*(screen: PGdkScreen): PGdkWindow{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_root_window".} -proc gdk_screen_get_display*(screen: PGdkScreen): PGdkDisplay{.cdecl, +proc gdk_screen_get_display*(screen: PGdkScreen): PGdkDisplay{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_display".} -proc gdk_screen_get_number*(screen: PGdkScreen): gint{.cdecl, dynlib: gdklib, +proc gdk_screen_get_number*(screen: PGdkScreen): gint{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_number".} -proc gdk_screen_get_window_at_pointer*(screen: PGdkScreen, win_x: Pgint, - win_y: Pgint): PGdkWindow{.cdecl, +proc gdk_screen_get_window_at_pointer*(screen: PGdkScreen, win_x: Pgint, + win_y: Pgint): PGdkWindow{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_window_at_pointer".} -proc gdk_screen_get_width*(screen: PGdkScreen): gint{.cdecl, dynlib: gdklib, +proc gdk_screen_get_width*(screen: PGdkScreen): gint{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_width".} -proc gdk_screen_get_height*(screen: PGdkScreen): gint{.cdecl, dynlib: gdklib, +proc gdk_screen_get_height*(screen: PGdkScreen): gint{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_height".} -proc gdk_screen_get_width_mm*(screen: PGdkScreen): gint{.cdecl, dynlib: gdklib, +proc gdk_screen_get_width_mm*(screen: PGdkScreen): gint{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_width_mm".} -proc gdk_screen_get_height_mm*(screen: PGdkScreen): gint{.cdecl, dynlib: gdklib, +proc gdk_screen_get_height_mm*(screen: PGdkScreen): gint{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_height_mm".} -proc gdk_screen_close*(screen: PGdkScreen){.cdecl, dynlib: gdklib, +proc gdk_screen_close*(screen: PGdkScreen){.cdecl, dynlib: gdklib, importc: "gdk_screen_close".} -proc gdk_screen_list_visuals*(screen: PGdkScreen): PGList{.cdecl, +proc gdk_screen_list_visuals*(screen: PGdkScreen): PGList{.cdecl, dynlib: gdklib, importc: "gdk_screen_list_visuals".} -proc gdk_screen_get_toplevel_windows*(screen: PGdkScreen): PGList{.cdecl, +proc gdk_screen_get_toplevel_windows*(screen: PGdkScreen): PGList{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_toplevel_windows".} -proc gdk_screen_get_n_monitors*(screen: PGdkScreen): gint{.cdecl, +proc gdk_screen_get_n_monitors*(screen: PGdkScreen): gint{.cdecl, dynlib: gdklib, importc: "gdk_screen_get_n_monitors".} -proc gdk_screen_get_monitor_geometry*(screen: PGdkScreen, monitor_num: gint, - dest: PGdkRectangle){.cdecl, +proc gdk_screen_get_monitor_geometry*(screen: PGdkScreen, monitor_num: gint, + dest: PGdkRectangle){.cdecl, dynlib: gdklib, importc: "gdk_screen_get_monitor_geometry".} proc gdk_screen_get_monitor_at_point*(screen: PGdkScreen, x: gint, y: gint): gint{. cdecl, dynlib: gdklib, importc: "gdk_screen_get_monitor_at_point".} @@ -3054,7 +3053,7 @@ proc gdk_screen_get_monitor_at_window*(screen: PGdkScreen, window: PGdkWindow): cdecl, dynlib: gdklib, importc: "gdk_screen_get_monitor_at_window".} proc gdk_screen_broadcast_client_message*(screen: PGdkScreen, event: PGdkEvent){. cdecl, dynlib: gdklib, importc: "gdk_screen_broadcast_client_message".} -proc gdk_get_default_screen*(): PGdkScreen{.cdecl, dynlib: gdklib, +proc gdk_get_default_screen*(): PGdkScreen{.cdecl, dynlib: gdklib, importc: "gdk_get_default_screen".} proc gdk_screen_get_setting*(screen: PGdkScreen, name: cstring, value: PGValue): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_screen_get_setting".} @@ -3074,22 +3073,22 @@ proc GDK_SELECTION_TYPE_INTEGER*(): TGdkAtom proc GDK_SELECTION_TYPE_PIXMAP*(): TGdkAtom proc GDK_SELECTION_TYPE_WINDOW*(): TGdkAtom proc GDK_SELECTION_TYPE_STRING*(): TGdkAtom -proc gdk_selection_owner_set_for_display*(display: PGdkDisplay, +proc gdk_selection_owner_set_for_display*(display: PGdkDisplay, owner: PGdkWindow, selection: TGdkAtom, time: guint32, send_event: gboolean): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_selection_owner_set_for_display".} -proc gdk_selection_owner_get_for_display*(display: PGdkDisplay, +proc gdk_selection_owner_get_for_display*(display: PGdkDisplay, selection: TGdkAtom): PGdkWindow{.cdecl, dynlib: gdklib, importc: "gdk_selection_owner_get_for_display".} -proc gdk_selection_convert*(requestor: PGdkWindow, selection: TGdkAtom, - target: TGdkAtom, time: guint32){.cdecl, +proc gdk_selection_convert*(requestor: PGdkWindow, selection: TGdkAtom, + target: TGdkAtom, time: guint32){.cdecl, dynlib: gdklib, importc: "gdk_selection_convert".} -proc gdk_selection_property_get*(requestor: PGdkWindow, data: PPguchar, +proc gdk_selection_property_get*(requestor: PGdkWindow, data: PPguchar, prop_type: PGdkAtom, prop_format: Pgint): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_selection_property_get".} -proc gdk_selection_send_notify_for_display*(display: PGdkDisplay, - requestor: guint32, selection: TGdkAtom, target: TGdkAtom, - `property`: TGdkAtom, time: guint32){.cdecl, dynlib: gdklib, +proc gdk_selection_send_notify_for_display*(display: PGdkDisplay, + requestor: guint32, selection: TGdkAtom, target: TGdkAtom, + `property`: TGdkAtom, time: guint32){.cdecl, dynlib: gdklib, importc: "gdk_selection_send_notify_for_display".} -const +const GDK_CURRENT_TIME* = 0 GDK_PARENT_RELATIVE* = 1 GDK_OK* = 0 @@ -3131,9 +3130,9 @@ proc GDK_VISUAL_CLASS*(klass: Pointer): PGdkVisualClass proc GDK_IS_VISUAL*(anObject: Pointer): bool proc GDK_IS_VISUAL_CLASS*(klass: Pointer): bool proc GDK_VISUAL_GET_CLASS*(obj: Pointer): PGdkVisualClass -proc gdk_visual_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_visual_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_visual_get_type".} -const +const GDK_WA_TITLE* = 1 shl 1 GDK_WA_X* = 1 shl 2 GDK_WA_Y* = 1 shl 3 @@ -3182,776 +3181,776 @@ proc GDK_IS_WINDOW*(anObject: Pointer): bool proc GDK_IS_WINDOW_CLASS*(klass: Pointer): bool proc GDK_WINDOW_GET_CLASS*(obj: Pointer): PGdkWindowObjectClass proc GDK_WINDOW_OBJECT*(anObject: Pointer): PGdkWindowObject -const - bm_TGdkWindowObject_guffaw_gravity* = 0x00000001 - bp_TGdkWindowObject_guffaw_gravity* = 0 - bm_TGdkWindowObject_input_only* = 0x00000002 - bp_TGdkWindowObject_input_only* = 1 - bm_TGdkWindowObject_modal_hint* = 0x00000004 - bp_TGdkWindowObject_modal_hint* = 2 - bm_TGdkWindowObject_destroyed* = 0x00000018 - bp_TGdkWindowObject_destroyed* = 3 +const + bm_TGdkWindowObject_guffaw_gravity* = 0x00000001'i16 + bp_TGdkWindowObject_guffaw_gravity* = 0'i16 + bm_TGdkWindowObject_input_only* = 0x00000002'i16 + bp_TGdkWindowObject_input_only* = 1'i16 + bm_TGdkWindowObject_modal_hint* = 0x00000004'i16 + bp_TGdkWindowObject_modal_hint* = 2'i16 + bm_TGdkWindowObject_destroyed* = 0x00000018'i16 + bp_TGdkWindowObject_destroyed* = 3'i16 proc GdkWindowObject_guffaw_gravity*(a: var TGdkWindowObject): guint -proc GdkWindowObject_set_guffaw_gravity*(a: var TGdkWindowObject, +proc GdkWindowObject_set_guffaw_gravity*(a: var TGdkWindowObject, `guffaw_gravity`: guint) proc GdkWindowObject_input_only*(a: var TGdkWindowObject): guint -proc GdkWindowObject_set_input_only*(a: var TGdkWindowObject, +proc GdkWindowObject_set_input_only*(a: var TGdkWindowObject, `input_only`: guint) proc GdkWindowObject_modal_hint*(a: var TGdkWindowObject): guint -proc GdkWindowObject_set_modal_hint*(a: var TGdkWindowObject, +proc GdkWindowObject_set_modal_hint*(a: var TGdkWindowObject, `modal_hint`: guint) proc GdkWindowObject_destroyed*(a: var TGdkWindowObject): guint proc GdkWindowObject_set_destroyed*(a: var TGdkWindowObject, `destroyed`: guint) -proc gdk_window_object_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_window_object_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_window_object_get_type".} -proc gdk_window_new*(parent: PGdkWindow, attributes: PGdkWindowAttr, - attributes_mask: gint): PGdkWindow{.cdecl, dynlib: gdklib, +proc gdk_window_new*(parent: PGdkWindow, attributes: PGdkWindowAttr, + attributes_mask: gint): PGdkWindow{.cdecl, dynlib: gdklib, importc: "gdk_window_new".} -proc gdk_window_destroy*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_destroy*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_destroy".} -proc gdk_window_get_window_type*(window: PGdkWindow): TGdkWindowType{.cdecl, +proc gdk_window_get_window_type*(window: PGdkWindow): TGdkWindowType{.cdecl, dynlib: gdklib, importc: "gdk_window_get_window_type".} -proc gdk_window_at_pointer*(win_x: Pgint, win_y: Pgint): PGdkWindow{.cdecl, +proc gdk_window_at_pointer*(win_x: Pgint, win_y: Pgint): PGdkWindow{.cdecl, dynlib: gdklib, importc: "gdk_window_at_pointer".} -proc gdk_window_show*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_show*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_show".} -proc gdk_window_hide*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_hide*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_hide".} -proc gdk_window_withdraw*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_withdraw*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_withdraw".} -proc gdk_window_show_unraised*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_show_unraised*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_show_unraised".} -proc gdk_window_move*(window: PGdkWindow, x: gint, y: gint){.cdecl, +proc gdk_window_move*(window: PGdkWindow, x: gint, y: gint){.cdecl, dynlib: gdklib, importc: "gdk_window_move".} -proc gdk_window_resize*(window: PGdkWindow, width: gint, height: gint){.cdecl, +proc gdk_window_resize*(window: PGdkWindow, width: gint, height: gint){.cdecl, dynlib: gdklib, importc: "gdk_window_resize".} -proc gdk_window_move_resize*(window: PGdkWindow, x: gint, y: gint, width: gint, - height: gint){.cdecl, dynlib: gdklib, +proc gdk_window_move_resize*(window: PGdkWindow, x: gint, y: gint, width: gint, + height: gint){.cdecl, dynlib: gdklib, importc: "gdk_window_move_resize".} -proc gdk_window_reparent*(window: PGdkWindow, new_parent: PGdkWindow, x: gint, - y: gint){.cdecl, dynlib: gdklib, +proc gdk_window_reparent*(window: PGdkWindow, new_parent: PGdkWindow, x: gint, + y: gint){.cdecl, dynlib: gdklib, importc: "gdk_window_reparent".} -proc gdk_window_clear*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_clear*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_clear".} -proc gdk_window_clear_area*(window: PGdkWindow, x: gint, y: gint, width: gint, - height: gint){.cdecl, dynlib: gdklib, +proc gdk_window_clear_area*(window: PGdkWindow, x: gint, y: gint, width: gint, + height: gint){.cdecl, dynlib: gdklib, importc: "gdk_window_clear_area".} -proc gdk_window_clear_area_e*(window: PGdkWindow, x: gint, y: gint, width: gint, - height: gint){.cdecl, dynlib: gdklib, +proc gdk_window_clear_area_e*(window: PGdkWindow, x: gint, y: gint, width: gint, + height: gint){.cdecl, dynlib: gdklib, importc: "gdk_window_clear_area_e".} -proc gdk_window_raise*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_raise*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_raise".} -proc gdk_window_lower*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_lower*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_lower".} -proc gdk_window_focus*(window: PGdkWindow, timestamp: guint32){.cdecl, +proc gdk_window_focus*(window: PGdkWindow, timestamp: guint32){.cdecl, dynlib: gdklib, importc: "gdk_window_focus".} -proc gdk_window_set_user_data*(window: PGdkWindow, user_data: gpointer){.cdecl, +proc gdk_window_set_user_data*(window: PGdkWindow, user_data: gpointer){.cdecl, dynlib: gdklib, importc: "gdk_window_set_user_data".} -proc gdk_window_set_override_redirect*(window: PGdkWindow, - override_redirect: gboolean){.cdecl, +proc gdk_window_set_override_redirect*(window: PGdkWindow, + override_redirect: gboolean){.cdecl, dynlib: gdklib, importc: "gdk_window_set_override_redirect".} -proc gdk_window_add_filter*(window: PGdkWindow, `function`: TGdkFilterFunc, - data: gpointer){.cdecl, dynlib: gdklib, +proc gdk_window_add_filter*(window: PGdkWindow, `function`: TGdkFilterFunc, + data: gpointer){.cdecl, dynlib: gdklib, importc: "gdk_window_add_filter".} -proc gdk_window_remove_filter*(window: PGdkWindow, `function`: TGdkFilterFunc, - data: gpointer){.cdecl, dynlib: gdklib, +proc gdk_window_remove_filter*(window: PGdkWindow, `function`: TGdkFilterFunc, + data: gpointer){.cdecl, dynlib: gdklib, importc: "gdk_window_remove_filter".} -proc gdk_window_scroll*(window: PGdkWindow, dx: gint, dy: gint){.cdecl, +proc gdk_window_scroll*(window: PGdkWindow, dx: gint, dy: gint){.cdecl, dynlib: gdklib, importc: "gdk_window_scroll".} -proc gdk_window_shape_combine_mask*(window: PGdkWindow, mask: PGdkBitmap, - x: gint, y: gint){.cdecl, dynlib: gdklib, +proc gdk_window_shape_combine_mask*(window: PGdkWindow, mask: PGdkBitmap, + x: gint, y: gint){.cdecl, dynlib: gdklib, importc: "gdk_window_shape_combine_mask".} -proc gdk_window_shape_combine_region*(window: PGdkWindow, - shape_region: PGdkRegion, offset_x: gint, - offset_y: gint){.cdecl, dynlib: gdklib, +proc gdk_window_shape_combine_region*(window: PGdkWindow, + shape_region: PGdkRegion, offset_x: gint, + offset_y: gint){.cdecl, dynlib: gdklib, importc: "gdk_window_shape_combine_region".} -proc gdk_window_set_child_shapes*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_set_child_shapes*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_set_child_shapes".} -proc gdk_window_merge_child_shapes*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_merge_child_shapes*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_merge_child_shapes".} -proc gdk_window_is_visible*(window: PGdkWindow): gboolean{.cdecl, +proc gdk_window_is_visible*(window: PGdkWindow): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_window_is_visible".} -proc gdk_window_is_viewable*(window: PGdkWindow): gboolean{.cdecl, +proc gdk_window_is_viewable*(window: PGdkWindow): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_window_is_viewable".} -proc gdk_window_get_state*(window: PGdkWindow): TGdkWindowState{.cdecl, +proc gdk_window_get_state*(window: PGdkWindow): TGdkWindowState{.cdecl, dynlib: gdklib, importc: "gdk_window_get_state".} proc gdk_window_set_static_gravities*(window: PGdkWindow, use_static: gboolean): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_window_set_static_gravities".} -proc gdk_window_foreign_new_for_display*(display: PGdkDisplay, - anid: TGdkNativeWindow): PGdkWindow{.cdecl, dynlib: gdklib, +proc gdk_window_foreign_new_for_display*(display: PGdkDisplay, + anid: TGdkNativeWindow): PGdkWindow{.cdecl, dynlib: gdklib, importc: "gdk_window_foreign_new_for_display".} proc gdk_window_lookup_for_display*(display: PGdkDisplay, anid: TGdkNativeWindow): PGdkWindow{. cdecl, dynlib: gdklib, importc: "gdk_window_lookup_for_display".} proc gdk_window_set_type_hint*(window: PGdkWindow, hint: TGdkWindowTypeHint){. cdecl, dynlib: gdklib, importc: "gdk_window_set_type_hint".} -proc gdk_window_set_modal_hint*(window: PGdkWindow, modal: gboolean){.cdecl, +proc gdk_window_set_modal_hint*(window: PGdkWindow, modal: gboolean){.cdecl, dynlib: gdklib, importc: "gdk_window_set_modal_hint".} -proc gdk_window_set_geometry_hints*(window: PGdkWindow, geometry: PGdkGeometry, - geom_mask: TGdkWindowHints){.cdecl, +proc gdk_window_set_geometry_hints*(window: PGdkWindow, geometry: PGdkGeometry, + geom_mask: TGdkWindowHints){.cdecl, dynlib: gdklib, importc: "gdk_window_set_geometry_hints".} -proc gdk_set_sm_client_id*(sm_client_id: cstring){.cdecl, dynlib: gdklib, +proc gdk_set_sm_client_id*(sm_client_id: cstring){.cdecl, dynlib: gdklib, importc: "gdk_set_sm_client_id".} proc gdk_window_begin_paint_rect*(window: PGdkWindow, rectangle: PGdkRectangle){. cdecl, dynlib: gdklib, importc: "gdk_window_begin_paint_rect".} proc gdk_window_begin_paint_region*(window: PGdkWindow, region: PGdkRegion){. cdecl, dynlib: gdklib, importc: "gdk_window_begin_paint_region".} -proc gdk_window_end_paint*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_end_paint*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_end_paint".} -proc gdk_window_set_title*(window: PGdkWindow, title: cstring){.cdecl, +proc gdk_window_set_title*(window: PGdkWindow, title: cstring){.cdecl, dynlib: gdklib, importc: "gdk_window_set_title".} -proc gdk_window_set_role*(window: PGdkWindow, role: cstring){.cdecl, +proc gdk_window_set_role*(window: PGdkWindow, role: cstring){.cdecl, dynlib: gdklib, importc: "gdk_window_set_role".} proc gdk_window_set_transient_for*(window: PGdkWindow, parent: PGdkWindow){. cdecl, dynlib: gdklib, importc: "gdk_window_set_transient_for".} -proc gdk_window_set_background*(window: PGdkWindow, color: PGdkColor){.cdecl, +proc gdk_window_set_background*(window: PGdkWindow, color: PGdkColor){.cdecl, dynlib: gdklib, importc: "gdk_window_set_background".} -proc gdk_window_set_back_pixmap*(window: PGdkWindow, pixmap: PGdkPixmap, - parent_relative: gboolean){.cdecl, +proc gdk_window_set_back_pixmap*(window: PGdkWindow, pixmap: PGdkPixmap, + parent_relative: gboolean){.cdecl, dynlib: gdklib, importc: "gdk_window_set_back_pixmap".} -proc gdk_window_set_cursor*(window: PGdkWindow, cursor: PGdkCursor){.cdecl, +proc gdk_window_set_cursor*(window: PGdkWindow, cursor: PGdkCursor){.cdecl, dynlib: gdklib, importc: "gdk_window_set_cursor".} -proc gdk_window_get_user_data*(window: PGdkWindow, data: gpointer){.cdecl, +proc gdk_window_get_user_data*(window: PGdkWindow, data: gpointer){.cdecl, dynlib: gdklib, importc: "gdk_window_get_user_data".} -proc gdk_window_get_geometry*(window: PGdkWindow, x: Pgint, y: Pgint, - width: Pgint, height: Pgint, depth: Pgint){.cdecl, +proc gdk_window_get_geometry*(window: PGdkWindow, x: Pgint, y: Pgint, + width: Pgint, height: Pgint, depth: Pgint){.cdecl, dynlib: gdklib, importc: "gdk_window_get_geometry".} -proc gdk_window_get_position*(window: PGdkWindow, x: Pgint, y: Pgint){.cdecl, +proc gdk_window_get_position*(window: PGdkWindow, x: Pgint, y: Pgint){.cdecl, dynlib: gdklib, importc: "gdk_window_get_position".} proc gdk_window_get_origin*(window: PGdkWindow, x: Pgint, y: Pgint): gint{. cdecl, dynlib: gdklib, importc: "gdk_window_get_origin".} -proc gdk_window_get_root_origin*(window: PGdkWindow, x: Pgint, y: Pgint){.cdecl, +proc gdk_window_get_root_origin*(window: PGdkWindow, x: Pgint, y: Pgint){.cdecl, dynlib: gdklib, importc: "gdk_window_get_root_origin".} proc gdk_window_get_frame_extents*(window: PGdkWindow, rect: PGdkRectangle){. cdecl, dynlib: gdklib, importc: "gdk_window_get_frame_extents".} -proc gdk_window_get_pointer*(window: PGdkWindow, x: Pgint, y: Pgint, - mask: PGdkModifierType): PGdkWindow{.cdecl, +proc gdk_window_get_pointer*(window: PGdkWindow, x: Pgint, y: Pgint, + mask: PGdkModifierType): PGdkWindow{.cdecl, dynlib: gdklib, importc: "gdk_window_get_pointer".} -proc gdk_window_get_parent*(window: PGdkWindow): PGdkWindow{.cdecl, +proc gdk_window_get_parent*(window: PGdkWindow): PGdkWindow{.cdecl, dynlib: gdklib, importc: "gdk_window_get_parent".} -proc gdk_window_get_toplevel*(window: PGdkWindow): PGdkWindow{.cdecl, +proc gdk_window_get_toplevel*(window: PGdkWindow): PGdkWindow{.cdecl, dynlib: gdklib, importc: "gdk_window_get_toplevel".} -proc gdk_window_get_children*(window: PGdkWindow): PGList{.cdecl, +proc gdk_window_get_children*(window: PGdkWindow): PGList{.cdecl, dynlib: gdklib, importc: "gdk_window_get_children".} -proc gdk_window_peek_children*(window: PGdkWindow): PGList{.cdecl, +proc gdk_window_peek_children*(window: PGdkWindow): PGList{.cdecl, dynlib: gdklib, importc: "gdk_window_peek_children".} -proc gdk_window_get_events*(window: PGdkWindow): TGdkEventMask{.cdecl, +proc gdk_window_get_events*(window: PGdkWindow): TGdkEventMask{.cdecl, dynlib: gdklib, importc: "gdk_window_get_events".} proc gdk_window_set_events*(window: PGdkWindow, event_mask: TGdkEventMask){. cdecl, dynlib: gdklib, importc: "gdk_window_set_events".} -proc gdk_window_set_icon_list*(window: PGdkWindow, pixbufs: PGList){.cdecl, +proc gdk_window_set_icon_list*(window: PGdkWindow, pixbufs: PGList){.cdecl, dynlib: gdklib, importc: "gdk_window_set_icon_list".} -proc gdk_window_set_icon*(window: PGdkWindow, icon_window: PGdkWindow, - pixmap: PGdkPixmap, mask: PGdkBitmap){.cdecl, +proc gdk_window_set_icon*(window: PGdkWindow, icon_window: PGdkWindow, + pixmap: PGdkPixmap, mask: PGdkBitmap){.cdecl, dynlib: gdklib, importc: "gdk_window_set_icon".} -proc gdk_window_set_icon_name*(window: PGdkWindow, name: cstring){.cdecl, +proc gdk_window_set_icon_name*(window: PGdkWindow, name: cstring){.cdecl, dynlib: gdklib, importc: "gdk_window_set_icon_name".} -proc gdk_window_set_group*(window: PGdkWindow, leader: PGdkWindow){.cdecl, +proc gdk_window_set_group*(window: PGdkWindow, leader: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_set_group".} -proc gdk_window_set_decorations*(window: PGdkWindow, - decorations: TGdkWMDecoration){.cdecl, +proc gdk_window_set_decorations*(window: PGdkWindow, + decorations: TGdkWMDecoration){.cdecl, dynlib: gdklib, importc: "gdk_window_set_decorations".} -proc gdk_window_get_decorations*(window: PGdkWindow, +proc gdk_window_get_decorations*(window: PGdkWindow, decorations: PGdkWMDecoration): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_window_get_decorations".} proc gdk_window_set_functions*(window: PGdkWindow, functions: TGdkWMFunction){. cdecl, dynlib: gdklib, importc: "gdk_window_set_functions".} -proc gdk_window_iconify*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_iconify*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_iconify".} -proc gdk_window_deiconify*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_deiconify*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_deiconify".} -proc gdk_window_stick*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_stick*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_stick".} -proc gdk_window_unstick*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_unstick*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_unstick".} -proc gdk_window_maximize*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_maximize*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_maximize".} -proc gdk_window_unmaximize*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_unmaximize*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_unmaximize".} -proc gdk_window_register_dnd*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_register_dnd*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_register_dnd".} -proc gdk_window_begin_resize_drag*(window: PGdkWindow, edge: TGdkWindowEdge, - button: gint, root_x: gint, root_y: gint, - timestamp: guint32){.cdecl, dynlib: gdklib, +proc gdk_window_begin_resize_drag*(window: PGdkWindow, edge: TGdkWindowEdge, + button: gint, root_x: gint, root_y: gint, + timestamp: guint32){.cdecl, dynlib: gdklib, importc: "gdk_window_begin_resize_drag".} -proc gdk_window_begin_move_drag*(window: PGdkWindow, button: gint, root_x: gint, - root_y: gint, timestamp: guint32){.cdecl, +proc gdk_window_begin_move_drag*(window: PGdkWindow, button: gint, root_x: gint, + root_y: gint, timestamp: guint32){.cdecl, dynlib: gdklib, importc: "gdk_window_begin_move_drag".} -proc gdk_window_invalidate_rect*(window: PGdkWindow, rect: PGdkRectangle, - invalidate_children: gboolean){.cdecl, +proc gdk_window_invalidate_rect*(window: PGdkWindow, rect: PGdkRectangle, + invalidate_children: gboolean){.cdecl, dynlib: gdklib, importc: "gdk_window_invalidate_rect".} -proc gdk_window_invalidate_region*(window: PGdkWindow, region: PGdkRegion, - invalidate_children: gboolean){.cdecl, +proc gdk_window_invalidate_region*(window: PGdkWindow, region: PGdkRegion, + invalidate_children: gboolean){.cdecl, dynlib: gdklib, importc: "gdk_window_invalidate_region".} -proc gdk_window_invalidate_maybe_recurse*(window: PGdkWindow, - region: PGdkRegion, - child_func: gdk_window_invalidate_maybe_recurse_child_func, - user_data: gpointer){.cdecl, dynlib: gdklib, +proc gdk_window_invalidate_maybe_recurse*(window: PGdkWindow, + region: PGdkRegion, + child_func: gdk_window_invalidate_maybe_recurse_child_func, + user_data: gpointer){.cdecl, dynlib: gdklib, importc: "gdk_window_invalidate_maybe_recurse".} -proc gdk_window_get_update_area*(window: PGdkWindow): PGdkRegion{.cdecl, +proc gdk_window_get_update_area*(window: PGdkWindow): PGdkRegion{.cdecl, dynlib: gdklib, importc: "gdk_window_get_update_area".} -proc gdk_window_freeze_updates*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_freeze_updates*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_freeze_updates".} -proc gdk_window_thaw_updates*(window: PGdkWindow){.cdecl, dynlib: gdklib, +proc gdk_window_thaw_updates*(window: PGdkWindow){.cdecl, dynlib: gdklib, importc: "gdk_window_thaw_updates".} proc gdk_window_process_all_updates*(){.cdecl, dynlib: gdklib, importc: "gdk_window_process_all_updates".} proc gdk_window_process_updates*(window: PGdkWindow, update_children: gboolean){. cdecl, dynlib: gdklib, importc: "gdk_window_process_updates".} -proc gdk_window_set_debug_updates*(setting: gboolean){.cdecl, dynlib: gdklib, +proc gdk_window_set_debug_updates*(setting: gboolean){.cdecl, dynlib: gdklib, importc: "gdk_window_set_debug_updates".} -proc gdk_window_constrain_size*(geometry: PGdkGeometry, flags: guint, - width: gint, height: gint, new_width: Pgint, - new_height: Pgint){.cdecl, dynlib: gdklib, +proc gdk_window_constrain_size*(geometry: PGdkGeometry, flags: guint, + width: gint, height: gint, new_width: Pgint, + new_height: Pgint){.cdecl, dynlib: gdklib, importc: "gdk_window_constrain_size".} -proc gdk_window_get_internal_paint_info*(window: PGdkWindow, - e: var PGdkDrawable, x_offset: Pgint, y_offset: Pgint){.cdecl, +proc gdk_window_get_internal_paint_info*(window: PGdkWindow, + e: var PGdkDrawable, x_offset: Pgint, y_offset: Pgint){.cdecl, dynlib: gdklib, importc: "gdk_window_get_internal_paint_info".} proc gdk_set_pointer_hooks*(new_hooks: PGdkPointerHooks): PGdkPointerHooks{. cdecl, dynlib: gdklib, importc: "gdk_set_pointer_hooks".} -proc gdk_get_default_root_window*(): PGdkWindow{.cdecl, dynlib: gdklib, +proc gdk_get_default_root_window*(): PGdkWindow{.cdecl, dynlib: gdklib, importc: "gdk_get_default_root_window".} -proc gdk_parse_args*(argc: Pgint, v: var PPgchar){.cdecl, dynlib: gdklib, +proc gdk_parse_args*(argc: Pgint, v: var PPgchar){.cdecl, dynlib: gdklib, importc: "gdk_parse_args".} -proc gdk_init*(argc: Pgint, v: var PPgchar){.cdecl, dynlib: gdklib, +proc gdk_init*(argc: Pgint, v: var PPgchar){.cdecl, dynlib: gdklib, importc: "gdk_init".} -proc gdk_init_check*(argc: Pgint, v: var PPgchar): gboolean{.cdecl, +proc gdk_init_check*(argc: Pgint, v: var PPgchar): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_init_check".} -when not defined(GDK_DISABLE_DEPRECATED): - proc gdk_exit(error_code: gint){.cdecl, dynlib: gdklib, importc: "gdk_exit".} +when not defined(GDK_DISABLE_DEPRECATED): + proc gdk_exit*(error_code: gint){.cdecl, dynlib: gdklib, importc: "gdk_exit".} proc gdk_set_locale*(): cstring{.cdecl, dynlib: gdklib, importc: "gdk_set_locale".} -proc gdk_get_program_class*(): cstring{.cdecl, dynlib: gdklib, +proc gdk_get_program_class*(): cstring{.cdecl, dynlib: gdklib, importc: "gdk_get_program_class".} -proc gdk_set_program_class*(program_class: cstring){.cdecl, dynlib: gdklib, +proc gdk_set_program_class*(program_class: cstring){.cdecl, dynlib: gdklib, importc: "gdk_set_program_class".} -proc gdk_error_trap_push*(){.cdecl, dynlib: gdklib, +proc gdk_error_trap_push*(){.cdecl, dynlib: gdklib, importc: "gdk_error_trap_push".} -proc gdk_error_trap_pop*(): gint{.cdecl, dynlib: gdklib, +proc gdk_error_trap_pop*(): gint{.cdecl, dynlib: gdklib, importc: "gdk_error_trap_pop".} -when not defined(GDK_DISABLE_DEPRECATED): - proc gdk_set_use_xshm(use_xshm: gboolean){.cdecl, dynlib: gdklib, +when not defined(GDK_DISABLE_DEPRECATED): + proc gdk_set_use_xshm*(use_xshm: gboolean){.cdecl, dynlib: gdklib, importc: "gdk_set_use_xshm".} - proc gdk_get_use_xshm(): gboolean{.cdecl, dynlib: gdklib, + proc gdk_get_use_xshm*(): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_get_use_xshm".} -proc gdk_get_display*(): cstring{.cdecl, dynlib: gdklib, +proc gdk_get_display*(): cstring{.cdecl, dynlib: gdklib, importc: "gdk_get_display".} -proc gdk_get_display_arg_name*(): cstring{.cdecl, dynlib: gdklib, +proc gdk_get_display_arg_name*(): cstring{.cdecl, dynlib: gdklib, importc: "gdk_get_display_arg_name".} -when not defined(GDK_DISABLE_DEPRECATED): - proc gdk_input_add_full(source: gint, condition: TGdkInputCondition, - `function`: TGdkInputFunction, data: gpointer, - destroy: TGdkDestroyNotify): gint{.cdecl, +when not defined(GDK_DISABLE_DEPRECATED): + proc gdk_input_add_full*(source: gint, condition: TGdkInputCondition, + `function`: TGdkInputFunction, data: gpointer, + destroy: TGdkDestroyNotify): gint{.cdecl, dynlib: gdklib, importc: "gdk_input_add_full".} - proc gdk_input_add(source: gint, condition: TGdkInputCondition, + proc gdk_input_add*(source: gint, condition: TGdkInputCondition, `function`: TGdkInputFunction, data: gpointer): gint{. cdecl, dynlib: gdklib, importc: "gdk_input_add".} - proc gdk_input_remove(tag: gint){.cdecl, dynlib: gdklib, + proc gdk_input_remove*(tag: gint){.cdecl, dynlib: gdklib, importc: "gdk_input_remove".} -proc gdk_pointer_grab*(window: PGdkWindow, owner_events: gboolean, - event_mask: TGdkEventMask, confine_to: PGdkWindow, +proc gdk_pointer_grab*(window: PGdkWindow, owner_events: gboolean, + event_mask: TGdkEventMask, confine_to: PGdkWindow, cursor: PGdkCursor, time: guint32): TGdkGrabStatus{. cdecl, dynlib: gdklib, importc: "gdk_pointer_grab".} -proc gdk_keyboard_grab*(window: PGdkWindow, owner_events: gboolean, - time: guint32): TGdkGrabStatus{.cdecl, dynlib: gdklib, +proc gdk_keyboard_grab*(window: PGdkWindow, owner_events: gboolean, + time: guint32): TGdkGrabStatus{.cdecl, dynlib: gdklib, importc: "gdk_keyboard_grab".} -when not defined(GDK_MULTIHEAD_SAFE): - proc gdk_pointer_ungrab(time: guint32){.cdecl, dynlib: gdklib, +when not defined(GDK_MULTIHEAD_SAFE): + proc gdk_pointer_ungrab*(time: guint32){.cdecl, dynlib: gdklib, importc: "gdk_pointer_ungrab".} - proc gdk_keyboard_ungrab(time: guint32){.cdecl, dynlib: gdklib, + proc gdk_keyboard_ungrab*(time: guint32){.cdecl, dynlib: gdklib, importc: "gdk_keyboard_ungrab".} - proc gdk_pointer_is_grabbed(): gboolean{.cdecl, dynlib: gdklib, + proc gdk_pointer_is_grabbed*(): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_pointer_is_grabbed".} - proc gdk_screen_width(): gint{.cdecl, dynlib: gdklib, + proc gdk_screen_width*(): gint{.cdecl, dynlib: gdklib, importc: "gdk_screen_width".} - proc gdk_screen_height(): gint{.cdecl, dynlib: gdklib, + proc gdk_screen_height*(): gint{.cdecl, dynlib: gdklib, importc: "gdk_screen_height".} - proc gdk_screen_width_mm(): gint{.cdecl, dynlib: gdklib, + proc gdk_screen_width_mm*(): gint{.cdecl, dynlib: gdklib, importc: "gdk_screen_width_mm".} - proc gdk_screen_height_mm(): gint{.cdecl, dynlib: gdklib, + proc gdk_screen_height_mm*(): gint{.cdecl, dynlib: gdklib, importc: "gdk_screen_height_mm".} - proc gdk_beep(){.cdecl, dynlib: gdklib, importc: "gdk_beep".} + proc gdk_beep*(){.cdecl, dynlib: gdklib, importc: "gdk_beep".} proc gdk_flush*(){.cdecl, dynlib: gdklib, importc: "gdk_flush".} -when not defined(GDK_MULTIHEAD_SAFE): - proc gdk_set_double_click_time(msec: guint){.cdecl, dynlib: gdklib, +when not defined(GDK_MULTIHEAD_SAFE): + proc gdk_set_double_click_time*(msec: guint){.cdecl, dynlib: gdklib, importc: "gdk_set_double_click_time".} -proc gdk_rectangle_intersect*(src1: PGdkRectangle, src2: PGdkRectangle, - dest: PGdkRectangle): gboolean{.cdecl, +proc gdk_rectangle_intersect*(src1: PGdkRectangle, src2: PGdkRectangle, + dest: PGdkRectangle): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_rectangle_intersect".} -proc gdk_rectangle_union*(src1: PGdkRectangle, src2: PGdkRectangle, - dest: PGdkRectangle){.cdecl, dynlib: gdklib, +proc gdk_rectangle_union*(src1: PGdkRectangle, src2: PGdkRectangle, + dest: PGdkRectangle){.cdecl, dynlib: gdklib, importc: "gdk_rectangle_union".} -proc gdk_rectangle_get_type*(): GType{.cdecl, dynlib: gdklib, +proc gdk_rectangle_get_type*(): GType{.cdecl, dynlib: gdklib, importc: "gdk_rectangle_get_type".} proc GDK_TYPE_RECTANGLE*(): GType -proc gdk_wcstombs*(src: PGdkWChar): cstring{.cdecl, dynlib: gdklib, +proc gdk_wcstombs*(src: PGdkWChar): cstring{.cdecl, dynlib: gdklib, importc: "gdk_wcstombs".} -proc gdk_mbstowcs*(dest: PGdkWChar, src: cstring, dest_max: gint): gint{.cdecl, +proc gdk_mbstowcs*(dest: PGdkWChar, src: cstring, dest_max: gint): gint{.cdecl, dynlib: gdklib, importc: "gdk_mbstowcs".} -when not defined(GDK_MULTIHEAD_SAFE): - proc gdk_event_send_client_message(event: PGdkEvent, xid: guint32): gboolean{. +when not defined(GDK_MULTIHEAD_SAFE): + proc gdk_event_send_client_message*(event: PGdkEvent, xid: guint32): gboolean{. cdecl, dynlib: gdklib, importc: "gdk_event_send_client_message".} - proc gdk_event_send_clientmessage_toall(event: PGdkEvent){.cdecl, + proc gdk_event_send_clientmessage_toall*(event: PGdkEvent){.cdecl, dynlib: gdklib, importc: "gdk_event_send_clientmessage_toall".} -proc gdk_event_send_client_message_for_display*(display: PGdkDisplay, - event: PGdkEvent, xid: guint32): gboolean{.cdecl, dynlib: gdklib, +proc gdk_event_send_client_message_for_display*(display: PGdkDisplay, + event: PGdkEvent, xid: guint32): gboolean{.cdecl, dynlib: gdklib, importc: "gdk_event_send_client_message_for_display".} proc gdk_threads_enter*(){.cdecl, dynlib: gdklib, importc: "gdk_threads_enter".} proc gdk_threads_leave*(){.cdecl, dynlib: gdklib, importc: "gdk_threads_leave".} proc gdk_threads_init*(){.cdecl, dynlib: gdklib, importc: "gdk_threads_init".} -proc GDK_TYPE_RECTANGLE*(): GType = +proc GDK_TYPE_RECTANGLE*(): GType = result = gdk_rectangle_get_type() -proc GDK_TYPE_COLORMAP*(): GType = +proc GDK_TYPE_COLORMAP*(): GType = result = gdk_colormap_get_type() -proc GDK_COLORMAP*(anObject: pointer): PGdkColormap = +proc GDK_COLORMAP*(anObject: pointer): PGdkColormap = result = cast[PGdkColormap](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_COLORMAP())) -proc GDK_COLORMAP_CLASS*(klass: pointer): PGdkColormapClass = +proc GDK_COLORMAP_CLASS*(klass: pointer): PGdkColormapClass = result = cast[PGdkColormapClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_COLORMAP())) -proc GDK_IS_COLORMAP*(anObject: pointer): bool = +proc GDK_IS_COLORMAP*(anObject: pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_COLORMAP()) -proc GDK_IS_COLORMAP_CLASS*(klass: pointer): bool = +proc GDK_IS_COLORMAP_CLASS*(klass: pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_COLORMAP()) -proc GDK_COLORMAP_GET_CLASS*(obj: pointer): PGdkColormapClass = +proc GDK_COLORMAP_GET_CLASS*(obj: pointer): PGdkColormapClass = result = cast[PGdkColormapClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_COLORMAP())) -proc GDK_TYPE_COLOR*(): GType = +proc GDK_TYPE_COLOR*(): GType = result = gdk_color_get_type() -proc gdk_cursor_destroy*(cursor: PGdkCursor) = +proc gdk_cursor_destroy*(cursor: PGdkCursor) = gdk_cursor_unref(cursor) -proc GDK_TYPE_CURSOR*(): GType = +proc GDK_TYPE_CURSOR*(): GType = result = gdk_cursor_get_type() -proc GDK_TYPE_DRAG_CONTEXT*(): GType = +proc GDK_TYPE_DRAG_CONTEXT*(): GType = result = gdk_drag_context_get_type() -proc GDK_DRAG_CONTEXT*(anObject: Pointer): PGdkDragContext = - result = cast[PGdkDragContext](G_TYPE_CHECK_INSTANCE_CAST(anObject, +proc GDK_DRAG_CONTEXT*(anObject: Pointer): PGdkDragContext = + result = cast[PGdkDragContext](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_DRAG_CONTEXT())) -proc GDK_DRAG_CONTEXT_CLASS*(klass: Pointer): PGdkDragContextClass = - result = cast[PGdkDragContextClass](G_TYPE_CHECK_CLASS_CAST(klass, +proc GDK_DRAG_CONTEXT_CLASS*(klass: Pointer): PGdkDragContextClass = + result = cast[PGdkDragContextClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_DRAG_CONTEXT())) -proc GDK_IS_DRAG_CONTEXT*(anObject: Pointer): bool = +proc GDK_IS_DRAG_CONTEXT*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_DRAG_CONTEXT()) -proc GDK_IS_DRAG_CONTEXT_CLASS*(klass: Pointer): bool = +proc GDK_IS_DRAG_CONTEXT_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_DRAG_CONTEXT()) -proc GDK_DRAG_CONTEXT_GET_CLASS*(obj: Pointer): PGdkDragContextClass = - result = cast[PGdkDragContextClass](G_TYPE_INSTANCE_GET_CLASS(obj, +proc GDK_DRAG_CONTEXT_GET_CLASS*(obj: Pointer): PGdkDragContextClass = + result = cast[PGdkDragContextClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_DRAG_CONTEXT())) -proc gdkregion_EXTENTCHECK*(r1, r2: PGdkRegionBox): bool = - result = (int(r1.x2) > r2.x1) and (int(r1.x1) < r2.x2) and - (int(r1.y2) > r2.y1) and (int(r1.y1) < r2.y2) +proc gdkregion_EXTENTCHECK*(r1, r2: PGdkRegionBox): bool = + result = ((r1.x2) > r2.x1) and ((r1.x1) < r2.x2) and + ((r1.y2) > r2.y1) and ((r1.y1) < r2.y2) -proc gdkregion_EXTENTS*(r: PGdkRegionBox, idRect: PGdkRegion) = - if (int(r.x1) < idRect.extents.x1): +proc gdkregion_EXTENTS*(r: PGdkRegionBox, idRect: PGdkRegion) = + if ((r.x1) < idRect.extents.x1): idRect.extents.x1 = r.x1 - if int(r.y1) < idRect.extents.y1: + if (r.y1) < idRect.extents.y1: idRect.extents.y1 = r.y1 - if int(r.x2) > idRect.extents.x2: + if (r.x2) > idRect.extents.x2: idRect.extents.x2 = r.x2 -proc gdkregion_MEMCHECK*(reg: PGdkRegion, ARect, firstrect: var PGdkRegionBox): bool = - nil +proc gdkregion_MEMCHECK*(reg: PGdkRegion, ARect, firstrect: var PGdkRegionBox): bool = + assert(false) # to implement -proc gdkregion_CHECK_PREVIOUS*(Reg: PGdkRegion, R: PGdkRegionBox, - Rx1, Ry1, Rx2, Ry2: gint): bool = - nil +proc gdkregion_CHECK_PREVIOUS*(Reg: PGdkRegion, R: PGdkRegionBox, + Rx1, Ry1, Rx2, Ry2: gint): bool = + assert(false) # to implement -proc gdkregion_ADDRECT*(reg: PGdkRegion, r: PGdkRegionBox, - rx1, ry1, rx2, ry2: gint) = - if ((int(rx1) < rx2) and (int(ry1) < ry2) and - gdkregion_CHECK_PREVIOUS(reg, r, rx1, ry1, rx2, ry2)): +proc gdkregion_ADDRECT*(reg: PGdkRegion, r: PGdkRegionBox, + rx1, ry1, rx2, ry2: gint) = + if (((rx1) < rx2) and ((ry1) < ry2) and + gdkregion_CHECK_PREVIOUS(reg, r, rx1, ry1, rx2, ry2)): r.x1 = rx1 r.y1 = ry1 r.x2 = rx2 r.y2 = ry2 -proc gdkregion_ADDRECTNOX*(reg: PGdkRegion, r: PGdkRegionBox, - rx1, ry1, rx2, ry2: gint) = - if ((int(rx1) < rx2) and (int(ry1) < ry2) and - gdkregion_CHECK_PREVIOUS(reg, r, rx1, ry1, rx2, ry2)): +proc gdkregion_ADDRECTNOX*(reg: PGdkRegion, r: PGdkRegionBox, + rx1, ry1, rx2, ry2: gint) = + if (((rx1) < rx2) and ((ry1) < ry2) and + gdkregion_CHECK_PREVIOUS(reg, r, rx1, ry1, rx2, ry2)): r.x1 = rx1 r.y1 = ry1 r.x2 = rx2 r.y2 = ry2 inc(reg . numRects) -proc gdkregion_EMPTY_REGION*(pReg: PGdkRegion): bool = - result = pReg.numRects == 0 +proc gdkregion_EMPTY_REGION*(pReg: PGdkRegion): bool = + result = pReg.numRects == 0'i32 -proc gdkregion_REGION_NOT_EMPTY*(pReg: PGdkRegion): bool = - result = pReg.numRects != 0 +proc gdkregion_REGION_NOT_EMPTY*(pReg: PGdkRegion): bool = + result = pReg.numRects != 0'i32 -proc gdkregion_INBOX*(r: TGdkRegionBox, x, y: gint): bool = - result = (((int(r.x2) > x) and (int(r.x1) <= x)) and - (int(r.y2) > y)) and (int(r.y1) <= y) +proc gdkregion_INBOX*(r: TGdkRegionBox, x, y: gint): bool = + result = ((((r.x2) > x) and ((r.x1) <= x)) and + ((r.y2) > y)) and ((r.y1) <= y) -proc GDK_TYPE_DRAWABLE*(): GType = +proc GDK_TYPE_DRAWABLE*(): GType = result = gdk_drawable_get_type() -proc GDK_DRAWABLE*(anObject: Pointer): PGdkDrawable = +proc GDK_DRAWABLE*(anObject: Pointer): PGdkDrawable = result = cast[PGdkDrawable](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_DRAWABLE())) -proc GDK_DRAWABLE_CLASS*(klass: Pointer): PGdkDrawableClass = +proc GDK_DRAWABLE_CLASS*(klass: Pointer): PGdkDrawableClass = result = cast[PGdkDrawableClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_DRAWABLE())) -proc GDK_IS_DRAWABLE*(anObject: Pointer): bool = +proc GDK_IS_DRAWABLE*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_DRAWABLE()) -proc GDK_IS_DRAWABLE_CLASS*(klass: Pointer): bool = +proc GDK_IS_DRAWABLE_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_DRAWABLE()) -proc GDK_DRAWABLE_GET_CLASS*(obj: Pointer): PGdkDrawableClass = +proc GDK_DRAWABLE_GET_CLASS*(obj: Pointer): PGdkDrawableClass = result = cast[PGdkDrawableClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_DRAWABLE())) -proc gdk_draw_pixmap*(drawable: PGdkDrawable, gc: PGdkGC, src: PGdkDrawable, - xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, - width: gint, height: gint) = +proc gdk_draw_pixmap*(drawable: PGdkDrawable, gc: PGdkGC, src: PGdkDrawable, + xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, + width: gint, height: gint) = gdk_draw_drawable(drawable, gc, src, xsrc, ysrc, xdest, ydest, width, height) -proc gdk_draw_bitmap*(drawable: PGdkDrawable, gc: PGdkGC, src: PGdkDrawable, - xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, - width: gint, height: gint) = +proc gdk_draw_bitmap*(drawable: PGdkDrawable, gc: PGdkGC, src: PGdkDrawable, + xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, + width: gint, height: gint) = gdk_draw_drawable(drawable, gc, src, xsrc, ysrc, xdest, ydest, width, height) -proc GDK_TYPE_EVENT*(): GType = +proc GDK_TYPE_EVENT*(): GType = result = gdk_event_get_type() -proc GDK_TYPE_FONT*(): GType = +proc GDK_TYPE_FONT*(): GType = result = gdk_font_get_type() -proc GDK_TYPE_GC*(): GType = +proc GDK_TYPE_GC*(): GType = result = gdk_gc_get_type() -proc GDK_GC*(anObject: Pointer): PGdkGC = +proc GDK_GC*(anObject: Pointer): PGdkGC = result = cast[PGdkGC](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_GC())) -proc GDK_GC_CLASS*(klass: Pointer): PGdkGCClass = +proc GDK_GC_CLASS*(klass: Pointer): PGdkGCClass = result = cast[PGdkGCClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_GC())) -proc GDK_IS_GC*(anObject: Pointer): bool = +proc GDK_IS_GC*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_GC()) -proc GDK_IS_GC_CLASS*(klass: Pointer): bool = +proc GDK_IS_GC_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_GC()) -proc GDK_GC_GET_CLASS*(obj: Pointer): PGdkGCClass = +proc GDK_GC_GET_CLASS*(obj: Pointer): PGdkGCClass = result = cast[PGdkGCClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_GC())) -proc gdk_gc_destroy*(gc: PGdkGC) = +proc gdk_gc_destroy*(gc: PGdkGC) = g_object_unref(G_OBJECT(gc)) -proc GDK_TYPE_IMAGE*(): GType = +proc GDK_TYPE_IMAGE*(): GType = result = gdk_image_get_type() -proc GDK_IMAGE*(anObject: Pointer): PGdkImage = +proc GDK_IMAGE*(anObject: Pointer): PGdkImage = result = cast[PGdkImage](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_IMAGE())) -proc GDK_IMAGE_CLASS*(klass: Pointer): PGdkImageClass = +proc GDK_IMAGE_CLASS*(klass: Pointer): PGdkImageClass = result = cast[PGdkImageClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_IMAGE())) -proc GDK_IS_IMAGE*(anObject: Pointer): bool = +proc GDK_IS_IMAGE*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_IMAGE()) -proc GDK_IS_IMAGE_CLASS*(klass: Pointer): bool = +proc GDK_IS_IMAGE_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_IMAGE()) -proc GDK_IMAGE_GET_CLASS*(obj: Pointer): PGdkImageClass = +proc GDK_IMAGE_GET_CLASS*(obj: Pointer): PGdkImageClass = result = cast[PGdkImageClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_IMAGE())) -proc gdk_image_destroy*(image: PGdkImage) = +proc gdk_image_destroy*(image: PGdkImage) = g_object_unref(G_OBJECT(image)) -proc GDK_TYPE_DEVICE*(): GType = +proc GDK_TYPE_DEVICE*(): GType = result = gdk_device_get_type() -proc GDK_DEVICE*(anObject: Pointer): PGdkDevice = +proc GDK_DEVICE*(anObject: Pointer): PGdkDevice = result = cast[PGdkDevice](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_DEVICE())) -proc GDK_DEVICE_CLASS*(klass: Pointer): PGdkDeviceClass = +proc GDK_DEVICE_CLASS*(klass: Pointer): PGdkDeviceClass = result = cast[PGdkDeviceClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_DEVICE())) -proc GDK_IS_DEVICE*(anObject: Pointer): bool = +proc GDK_IS_DEVICE*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_DEVICE()) -proc GDK_IS_DEVICE_CLASS*(klass: Pointer): bool = +proc GDK_IS_DEVICE_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_DEVICE()) -proc GDK_DEVICE_GET_CLASS*(obj: Pointer): PGdkDeviceClass = +proc GDK_DEVICE_GET_CLASS*(obj: Pointer): PGdkDeviceClass = result = cast[PGdkDeviceClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_DEVICE())) -proc GDK_TYPE_KEYMAP*(): GType = +proc GDK_TYPE_KEYMAP*(): GType = result = gdk_keymap_get_type() -proc GDK_KEYMAP*(anObject: Pointer): PGdkKeymap = +proc GDK_KEYMAP*(anObject: Pointer): PGdkKeymap = result = cast[PGdkKeymap](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_KEYMAP())) -proc GDK_KEYMAP_CLASS*(klass: Pointer): PGdkKeymapClass = +proc GDK_KEYMAP_CLASS*(klass: Pointer): PGdkKeymapClass = result = cast[PGdkKeymapClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_KEYMAP())) -proc GDK_IS_KEYMAP*(anObject: Pointer): bool = +proc GDK_IS_KEYMAP*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_KEYMAP()) -proc GDK_IS_KEYMAP_CLASS*(klass: Pointer): bool = +proc GDK_IS_KEYMAP_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_KEYMAP()) -proc GDK_KEYMAP_GET_CLASS*(obj: Pointer): PGdkKeymapClass = +proc GDK_KEYMAP_GET_CLASS*(obj: Pointer): PGdkKeymapClass = result = cast[PGdkKeymapClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_KEYMAP())) -proc GDK_TYPE_PIXMAP*(): GType = +proc GDK_TYPE_PIXMAP*(): GType = result = gdk_pixmap_get_type() -proc GDK_PIXMAP*(anObject: Pointer): PGdkPixmap = +proc GDK_PIXMAP*(anObject: Pointer): PGdkPixmap = result = cast[PGdkPixmap](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_PIXMAP())) -proc GDK_PIXMAP_CLASS*(klass: Pointer): PGdkPixmapObjectClass = +proc GDK_PIXMAP_CLASS*(klass: Pointer): PGdkPixmapObjectClass = result = cast[PGdkPixmapObjectClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_PIXMAP())) -proc GDK_IS_PIXMAP*(anObject: Pointer): bool = +proc GDK_IS_PIXMAP*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_PIXMAP()) -proc GDK_IS_PIXMAP_CLASS*(klass: Pointer): bool = +proc GDK_IS_PIXMAP_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_PIXMAP()) -proc GDK_PIXMAP_GET_CLASS*(obj: Pointer): PGdkPixmapObjectClass = +proc GDK_PIXMAP_GET_CLASS*(obj: Pointer): PGdkPixmapObjectClass = result = cast[PGdkPixmapObjectClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_PIXMAP())) -proc GDK_PIXMAP_OBJECT*(anObject: Pointer): PGdkPixmapObject = +proc GDK_PIXMAP_OBJECT*(anObject: Pointer): PGdkPixmapObject = result = cast[PGdkPixmapObject](GDK_PIXMAP(anObject)) -proc gdk_bitmap_ref*(drawable: PGdkDrawable): PGdkDrawable = +proc gdk_bitmap_ref*(drawable: PGdkDrawable): PGdkDrawable = result = GDK_DRAWABLE(g_object_ref(G_OBJECT(drawable))) -proc gdk_bitmap_unref*(drawable: PGdkDrawable) = +proc gdk_bitmap_unref*(drawable: PGdkDrawable) = g_object_unref(G_OBJECT(drawable)) -proc gdk_pixmap_ref*(drawable: PGdkDrawable): PGdkDrawable = +proc gdk_pixmap_ref*(drawable: PGdkDrawable): PGdkDrawable = result = GDK_DRAWABLE(g_object_ref(G_OBJECT(drawable))) -proc gdk_pixmap_unref*(drawable: PGdkDrawable) = +proc gdk_pixmap_unref*(drawable: PGdkDrawable) = g_object_unref(G_OBJECT(drawable)) -proc gdk_rgb_get_cmap*(): PGdkColormap = +proc gdk_rgb_get_cmap*(): PGdkColormap = result = nil #gdk_rgb_get_colormap() -proc GDK_TYPE_DISPLAY*(): GType = +proc GDK_TYPE_DISPLAY*(): GType = nil #result = nil -proc GDK_DISPLAY_OBJECT*(anObject: pointer): PGdkDisplay = +proc GDK_DISPLAY_OBJECT*(anObject: pointer): PGdkDisplay = result = cast[PGdkDisplay](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_DISPLAY())) -proc GDK_DISPLAY_CLASS*(klass: pointer): PGdkDisplayClass = +proc GDK_DISPLAY_CLASS*(klass: pointer): PGdkDisplayClass = result = cast[PGdkDisplayClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_DISPLAY())) -proc GDK_IS_DISPLAY*(anObject: pointer): bool = +proc GDK_IS_DISPLAY*(anObject: pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_DISPLAY()) -proc GDK_IS_DISPLAY_CLASS*(klass: pointer): bool = +proc GDK_IS_DISPLAY_CLASS*(klass: pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_DISPLAY()) -proc GDK_DISPLAY_GET_CLASS*(obj: pointer): PGdkDisplayClass = +proc GDK_DISPLAY_GET_CLASS*(obj: pointer): PGdkDisplayClass = result = cast[PGdkDisplayClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_DISPLAY())) -proc GDK_TYPE_SCREEN*(): GType = +proc GDK_TYPE_SCREEN*(): GType = nil -proc GDK_SCREEN*(anObject: Pointer): PGdkScreen = +proc GDK_SCREEN*(anObject: Pointer): PGdkScreen = result = cast[PGdkScreen](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_SCREEN())) -proc GDK_SCREEN_CLASS*(klass: Pointer): PGdkScreenClass = +proc GDK_SCREEN_CLASS*(klass: Pointer): PGdkScreenClass = result = cast[PGdkScreenClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_SCREEN())) -proc GDK_IS_SCREEN*(anObject: Pointer): bool = +proc GDK_IS_SCREEN*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_SCREEN()) -proc GDK_IS_SCREEN_CLASS*(klass: Pointer): bool = +proc GDK_IS_SCREEN_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_SCREEN()) -proc GDK_SCREEN_GET_CLASS*(obj: Pointer): PGdkScreenClass = +proc GDK_SCREEN_GET_CLASS*(obj: Pointer): PGdkScreenClass = result = cast[PGdkScreenClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_SCREEN())) -proc GDK_SELECTION_PRIMARY*(): TGdkAtom = +proc GDK_SELECTION_PRIMARY*(): TGdkAtom = result = `GDK_MAKE_ATOM`(1) -proc GDK_SELECTION_SECONDARY*(): TGdkAtom = +proc GDK_SELECTION_SECONDARY*(): TGdkAtom = result = `GDK_MAKE_ATOM`(2) -proc GDK_SELECTION_CLIPBOARD*(): TGdkAtom = +proc GDK_SELECTION_CLIPBOARD*(): TGdkAtom = result = `GDK_MAKE_ATOM`(69) -proc GDK_TARGET_BITMAP*(): TGdkAtom = +proc GDK_TARGET_BITMAP*(): TGdkAtom = result = `GDK_MAKE_ATOM`(5) -proc GDK_TARGET_COLORMAP*(): TGdkAtom = +proc GDK_TARGET_COLORMAP*(): TGdkAtom = result = `GDK_MAKE_ATOM`(7) -proc GDK_TARGET_DRAWABLE*(): TGdkAtom = +proc GDK_TARGET_DRAWABLE*(): TGdkAtom = result = `GDK_MAKE_ATOM`(17) -proc GDK_TARGET_PIXMAP*(): TGdkAtom = +proc GDK_TARGET_PIXMAP*(): TGdkAtom = result = `GDK_MAKE_ATOM`(20) -proc GDK_TARGET_STRING*(): TGdkAtom = +proc GDK_TARGET_STRING*(): TGdkAtom = result = `GDK_MAKE_ATOM`(31) -proc GDK_SELECTION_TYPE_ATOM*(): TGdkAtom = +proc GDK_SELECTION_TYPE_ATOM*(): TGdkAtom = result = `GDK_MAKE_ATOM`(4) -proc GDK_SELECTION_TYPE_BITMAP*(): TGdkAtom = +proc GDK_SELECTION_TYPE_BITMAP*(): TGdkAtom = result = `GDK_MAKE_ATOM`(5) -proc GDK_SELECTION_TYPE_COLORMAP*(): TGdkAtom = +proc GDK_SELECTION_TYPE_COLORMAP*(): TGdkAtom = result = `GDK_MAKE_ATOM`(7) -proc GDK_SELECTION_TYPE_DRAWABLE*(): TGdkAtom = +proc GDK_SELECTION_TYPE_DRAWABLE*(): TGdkAtom = result = `GDK_MAKE_ATOM`(17) -proc GDK_SELECTION_TYPE_INTEGER*(): TGdkAtom = +proc GDK_SELECTION_TYPE_INTEGER*(): TGdkAtom = result = `GDK_MAKE_ATOM`(19) -proc GDK_SELECTION_TYPE_PIXMAP*(): TGdkAtom = +proc GDK_SELECTION_TYPE_PIXMAP*(): TGdkAtom = result = `GDK_MAKE_ATOM`(20) -proc GDK_SELECTION_TYPE_WINDOW*(): TGdkAtom = +proc GDK_SELECTION_TYPE_WINDOW*(): TGdkAtom = result = `GDK_MAKE_ATOM`(33) -proc GDK_SELECTION_TYPE_STRING*(): TGdkAtom = +proc GDK_SELECTION_TYPE_STRING*(): TGdkAtom = result = `GDK_MAKE_ATOM`(31) -proc GDK_ATOM_TO_POINTER*(atom: TGdkAtom): pointer = +proc GDK_ATOM_TO_POINTER*(atom: TGdkAtom): pointer = result = cast[Pointer](atom) -proc GDK_POINTER_TO_ATOM*(p: Pointer): TGdkAtom = +proc GDK_POINTER_TO_ATOM*(p: Pointer): TGdkAtom = result = cast[TGdkAtom](p) -proc `GDK_MAKE_ATOM`*(val: guint): TGdkAtom = +proc `GDK_MAKE_ATOM`*(val: guint): TGdkAtom = result = cast[TGdkAtom](val) -proc GDK_NONE*(): TGdkAtom = +proc GDK_NONE*(): TGdkAtom = result = `GDK_MAKE_ATOM`(0) -proc GDK_TYPE_VISUAL*(): GType = +proc GDK_TYPE_VISUAL*(): GType = result = gdk_visual_get_type() -proc GDK_VISUAL*(anObject: Pointer): PGdkVisual = +proc GDK_VISUAL*(anObject: Pointer): PGdkVisual = result = cast[PGdkVisual](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_VISUAL())) -proc GDK_VISUAL_CLASS*(klass: Pointer): PGdkVisualClass = +proc GDK_VISUAL_CLASS*(klass: Pointer): PGdkVisualClass = result = cast[PGdkVisualClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_VISUAL())) -proc GDK_IS_VISUAL*(anObject: Pointer): bool = +proc GDK_IS_VISUAL*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_VISUAL()) -proc GDK_IS_VISUAL_CLASS*(klass: Pointer): bool = +proc GDK_IS_VISUAL_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_VISUAL()) -proc GDK_VISUAL_GET_CLASS*(obj: Pointer): PGdkVisualClass = +proc GDK_VISUAL_GET_CLASS*(obj: Pointer): PGdkVisualClass = result = cast[PGdkVisualClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_VISUAL())) -proc gdk_visual_ref*(v: PGdkVisual) = +proc gdk_visual_ref*(v: PGdkVisual) = discard g_object_ref(v) -proc gdk_visual_unref*(v: PGdkVisual) = +proc gdk_visual_unref*(v: PGdkVisual) = g_object_unref(v) -proc GDK_TYPE_WINDOW*(): GType = +proc GDK_TYPE_WINDOW*(): GType = result = gdk_window_object_get_type() -proc GDK_WINDOW*(anObject: Pointer): PGdkWindow = +proc GDK_WINDOW*(anObject: Pointer): PGdkWindow = result = cast[PGdkWindow](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_WINDOW())) -proc GDK_WINDOW_CLASS*(klass: Pointer): PGdkWindowObjectClass = +proc GDK_WINDOW_CLASS*(klass: Pointer): PGdkWindowObjectClass = result = cast[PGdkWindowObjectClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_WINDOW())) -proc GDK_IS_WINDOW*(anObject: Pointer): bool = +proc GDK_IS_WINDOW*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_WINDOW()) -proc GDK_IS_WINDOW_CLASS*(klass: Pointer): bool = +proc GDK_IS_WINDOW_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_WINDOW()) -proc GDK_WINDOW_GET_CLASS*(obj: Pointer): PGdkWindowObjectClass = +proc GDK_WINDOW_GET_CLASS*(obj: Pointer): PGdkWindowObjectClass = result = cast[PGdkWindowObjectClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_WINDOW())) -proc GDK_WINDOW_OBJECT*(anObject: Pointer): PGdkWindowObject = +proc GDK_WINDOW_OBJECT*(anObject: Pointer): PGdkWindowObject = result = cast[PGdkWindowObject](GDK_WINDOW(anObject)) -proc GdkWindowObject_guffaw_gravity*(a: var TGdkWindowObject): guint = +proc GdkWindowObject_guffaw_gravity*(a: var TGdkWindowObject): guint = result = (a.flag0 and bm_TGdkWindowObject_guffaw_gravity) shr bp_TGdkWindowObject_guffaw_gravity -proc GdkWindowObject_set_guffaw_gravity*(a: var TGdkWindowObject, - `guffaw_gravity`: guint) = +proc GdkWindowObject_set_guffaw_gravity*(a: var TGdkWindowObject, + `guffaw_gravity`: guint) = a.flag0 = a.flag0 or - ((`guffaw_gravity` shl bp_TGdkWindowObject_guffaw_gravity) and + (int16(`guffaw_gravity` shl bp_TGdkWindowObject_guffaw_gravity) and bm_TGdkWindowObject_guffaw_gravity) -proc GdkWindowObject_input_only*(a: var TGdkWindowObject): guint = +proc GdkWindowObject_input_only*(a: var TGdkWindowObject): guint = result = (a.flag0 and bm_TGdkWindowObject_input_only) shr bp_TGdkWindowObject_input_only -proc GdkWindowObject_set_input_only*(a: var TGdkWindowObject, - `input_only`: guint) = +proc GdkWindowObject_set_input_only*(a: var TGdkWindowObject, + `input_only`: guint) = a.flag0 = a.flag0 or - ((`input_only` shl bp_TGdkWindowObject_input_only) and + (int16(`input_only` shl bp_TGdkWindowObject_input_only) and bm_TGdkWindowObject_input_only) -proc GdkWindowObject_modal_hint*(a: var TGdkWindowObject): guint = +proc GdkWindowObject_modal_hint*(a: var TGdkWindowObject): guint = result = (a.flag0 and bm_TGdkWindowObject_modal_hint) shr bp_TGdkWindowObject_modal_hint -proc GdkWindowObject_set_modal_hint*(a: var TGdkWindowObject, - `modal_hint`: guint) = +proc GdkWindowObject_set_modal_hint*(a: var TGdkWindowObject, + `modal_hint`: guint) = a.flag0 = a.flag0 or - ((`modal_hint` shl bp_TGdkWindowObject_modal_hint) and + (int16(`modal_hint` shl bp_TGdkWindowObject_modal_hint) and bm_TGdkWindowObject_modal_hint) -proc GdkWindowObject_destroyed*(a: var TGdkWindowObject): guint = +proc GdkWindowObject_destroyed*(a: var TGdkWindowObject): guint = result = (a.flag0 and bm_TGdkWindowObject_destroyed) shr bp_TGdkWindowObject_destroyed -proc GdkWindowObject_set_destroyed*(a: var TGdkWindowObject, `destroyed`: guint) = +proc GdkWindowObject_set_destroyed*(a: var TGdkWindowObject, `destroyed`: guint) = a.flag0 = a.flag0 or - ((`destroyed` shl bp_TGdkWindowObject_destroyed) and + (int16(`destroyed` shl bp_TGdkWindowObject_destroyed) and bm_TGdkWindowObject_destroyed) -proc GDK_ROOT_PARENT*(): PGdkWindow = +proc GDK_ROOT_PARENT*(): PGdkWindow = result = gdk_get_default_root_window() -proc gdk_window_get_size*(drawable: PGdkDrawable, width: Pgint, height: Pgint) = +proc gdk_window_get_size*(drawable: PGdkDrawable, width: Pgint, height: Pgint) = gdk_drawable_get_size(drawable, width, height) -proc gdk_window_get_type*(window: PGdkWindow): TGdkWindowType = +proc gdk_window_get_type*(window: PGdkWindow): TGdkWindowType = result = gdk_window_get_window_type(window) -proc gdk_window_get_colormap*(drawable: PGdkDrawable): PGdkColormap = +proc gdk_window_get_colormap*(drawable: PGdkDrawable): PGdkColormap = result = gdk_drawable_get_colormap(drawable) -proc gdk_window_set_colormap*(drawable: PGdkDrawable, colormap: PGdkColormap) = +proc gdk_window_set_colormap*(drawable: PGdkDrawable, colormap: PGdkColormap) = gdk_drawable_set_colormap(drawable, colormap) -proc gdk_window_get_visual*(drawable: PGdkDrawable): PGdkVisual = +proc gdk_window_get_visual*(drawable: PGdkDrawable): PGdkVisual = result = gdk_drawable_get_visual(drawable) -proc gdk_window_ref*(drawable: PGdkDrawable): PGdkDrawable = +proc gdk_window_ref*(drawable: PGdkDrawable): PGdkDrawable = result = GDK_DRAWABLE(g_object_ref(G_OBJECT(drawable))) -proc gdk_window_unref*(drawable: PGdkDrawable) = +proc gdk_window_unref*(drawable: PGdkDrawable) = g_object_unref(G_OBJECT(drawable)) -proc gdk_window_copy_area*(drawable: PGdkDrawable, gc: PGdkGC, x, y: gint, - source_drawable: PGdkDrawable, - source_x, source_y: gint, width, height: gint) = - gdk_draw_pixmap(drawable, gc, source_drawable, source_x, source_y, x, y, +proc gdk_window_copy_area*(drawable: PGdkDrawable, gc: PGdkGC, x, y: gint, + source_drawable: PGdkDrawable, + source_x, source_y: gint, width, height: gint) = + gdk_draw_pixmap(drawable, gc, source_drawable, source_x, source_y, x, y, width, height) diff --git a/lib/base/gtk/gdk2pixbuf.nim b/lib/base/gtk/gdk2pixbuf.nim index b9ab472c2..bcf9690e8 100644 --- a/lib/base/gtk/gdk2pixbuf.nim +++ b/lib/base/gtk/gdk2pixbuf.nim @@ -1,12 +1,11 @@ -import +import glib2 -when defined(win32): - {.define: gdkpixbufwin.} - const +when defined(win32): + const gdkpixbuflib = "libgdk_pixbuf-2.0-0.dll" -elif defined(darwin): - const +elif defined(darwin): + const gdkpixbuflib = "gdk_pixbuf-2.0.0" # linklib gtk-x11-2.0 # linklib gdk-x11-2.0 @@ -15,29 +14,28 @@ elif defined(darwin): # linklib gobject-2.0.0 # linklib gdk_pixbuf-2.0.0 # linklib atk-1.0.0 -else: - const +else: + const gdkpixbuflib = "libgdk_pixbuf-2.0.so" -{.define: HasGTK2_4.} -{.define: HasGTK2_6.} -type + +type PGdkPixbuf* = pointer PGdkPixbufAnimation* = pointer PGdkPixbufAnimationIter* = pointer PGdkPixbufAlphaMode* = ptr TGdkPixbufAlphaMode - TGdkPixbufAlphaMode* = enum + TGdkPixbufAlphaMode* = enum GDK_PIXBUF_ALPHA_BILEVEL, GDK_PIXBUF_ALPHA_FULL PGdkColorspace* = ptr TGdkColorspace - TGdkColorspace* = enum + TGdkColorspace* = enum GDK_COLORSPACE_RGB TGdkPixbufDestroyNotify* = proc (pixels: Pguchar, data: gpointer){.cdecl.} PGdkPixbufError* = ptr TGdkPixbufError - TGdkPixbufError* = enum - GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, - GDK_PIXBUF_ERROR_BAD_OPTION, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, + TGdkPixbufError* = enum + GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, + GDK_PIXBUF_ERROR_BAD_OPTION, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION, GDK_PIXBUF_ERROR_FAILED PGdkInterpType* = ptr TGdkInterpType - TGdkInterpType* = enum + TGdkInterpType* = enum GDK_INTERP_NEAREST, GDK_INTERP_TILES, GDK_INTERP_BILINEAR, GDK_INTERP_HYPER proc GDK_TYPE_PIXBUF*(): GType @@ -50,117 +48,115 @@ proc GDK_TYPE_PIXBUF_ANIMATION_ITER*(): GType proc GDK_PIXBUF_ANIMATION_ITER*(anObject: pointer): PGdkPixbufAnimationIter proc GDK_IS_PIXBUF_ANIMATION_ITER*(anObject: pointer): bool proc GDK_PIXBUF_ERROR*(): TGQuark -proc gdk_pixbuf_error_quark*(): TGQuark{.cdecl, dynlib: gdkpixbuflib, +proc gdk_pixbuf_error_quark*(): TGQuark{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_error_quark".} -proc gdk_pixbuf_get_type*(): GType{.cdecl, dynlib: gdkpixbuflib, +proc gdk_pixbuf_get_type*(): GType{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_type".} -when not defined(GDK_PIXBUF_DISABLE_DEPRECATED): - proc gdk_pixbuf_ref(pixbuf: PGdkPixbuf): PGdkPixbuf{.cdecl, +when not defined(GDK_PIXBUF_DISABLE_DEPRECATED): + proc gdk_pixbuf_ref*(pixbuf: PGdkPixbuf): PGdkPixbuf{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_ref".} - proc gdk_pixbuf_unref(pixbuf: PGdkPixbuf){.cdecl, dynlib: gdkpixbuflib, + proc gdk_pixbuf_unref*(pixbuf: PGdkPixbuf){.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_unref".} -proc gdk_pixbuf_get_colorspace*(pixbuf: PGdkPixbuf): TGdkColorspace{.cdecl, +proc gdk_pixbuf_get_colorspace*(pixbuf: PGdkPixbuf): TGdkColorspace{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_colorspace".} -proc gdk_pixbuf_get_n_channels*(pixbuf: PGdkPixbuf): int32{.cdecl, +proc gdk_pixbuf_get_n_channels*(pixbuf: PGdkPixbuf): int32{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_n_channels".} -proc gdk_pixbuf_get_has_alpha*(pixbuf: PGdkPixbuf): gboolean{.cdecl, +proc gdk_pixbuf_get_has_alpha*(pixbuf: PGdkPixbuf): gboolean{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_has_alpha".} -proc gdk_pixbuf_get_bits_per_sample*(pixbuf: PGdkPixbuf): int32{.cdecl, +proc gdk_pixbuf_get_bits_per_sample*(pixbuf: PGdkPixbuf): int32{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_bits_per_sample".} -proc gdk_pixbuf_get_pixels*(pixbuf: PGdkPixbuf): Pguchar{.cdecl, +proc gdk_pixbuf_get_pixels*(pixbuf: PGdkPixbuf): Pguchar{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_pixels".} -proc gdk_pixbuf_get_width*(pixbuf: PGdkPixbuf): int32{.cdecl, +proc gdk_pixbuf_get_width*(pixbuf: PGdkPixbuf): int32{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_width".} -proc gdk_pixbuf_get_height*(pixbuf: PGdkPixbuf): int32{.cdecl, +proc gdk_pixbuf_get_height*(pixbuf: PGdkPixbuf): int32{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_height".} -proc gdk_pixbuf_get_rowstride*(pixbuf: PGdkPixbuf): int32{.cdecl, +proc gdk_pixbuf_get_rowstride*(pixbuf: PGdkPixbuf): int32{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_rowstride".} -proc gdk_pixbuf_new*(colorspace: TGdkColorspace, has_alpha: gboolean, +proc gdk_pixbuf_new*(colorspace: TGdkColorspace, has_alpha: gboolean, bits_per_sample: int32, width: int32, height: int32): PGdkPixbuf{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new".} -proc gdk_pixbuf_copy*(pixbuf: PGdkPixbuf): PGdkPixbuf{.cdecl, +proc gdk_pixbuf_copy*(pixbuf: PGdkPixbuf): PGdkPixbuf{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_copy".} -proc gdk_pixbuf_new_subpixbuf*(src_pixbuf: PGdkPixbuf, src_x: int32, +proc gdk_pixbuf_new_subpixbuf*(src_pixbuf: PGdkPixbuf, src_x: int32, src_y: int32, width: int32, height: int32): PGdkPixbuf{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_subpixbuf".} proc gdk_pixbuf_new_from_file*(filename: cstring, error: pointer): PGdkPixbuf{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_file".} -proc gdk_pixbuf_new_from_data*(data: Pguchar, colorspace: TGdkColorspace, - has_alpha: gboolean, bits_per_sample: int32, - width: int32, height: int32, rowstride: int32, - destroy_fn: TGdkPixbufDestroyNotify, - destroy_fn_data: gpointer): PGdkPixbuf{.cdecl, +proc gdk_pixbuf_new_from_data*(data: Pguchar, colorspace: TGdkColorspace, + has_alpha: gboolean, bits_per_sample: int32, + width: int32, height: int32, rowstride: int32, + destroy_fn: TGdkPixbufDestroyNotify, + destroy_fn_data: gpointer): PGdkPixbuf{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_data".} -proc gdk_pixbuf_new_from_xpm_data*(data: PPchar): PGdkPixbuf{.cdecl, +proc gdk_pixbuf_new_from_xpm_data*(data: PPchar): PGdkPixbuf{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_xpm_data".} -proc gdk_pixbuf_new_from_inline*(data_length: gint, a: var guint8, +proc gdk_pixbuf_new_from_inline*(data_length: gint, a: var guint8, copy_pixels: gboolean, error: pointer): PGdkPixbuf{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_inline".} -when defined(HasGTK2_4): - proc gdk_pixbuf_new_from_file_at_size(filename: cstring, width, height: gint, - error: pointer): PGdkPixbuf{.cdecl, - dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_file_at_size".} -when defined(HasGTK2_6): - proc gdk_pixbuf_new_from_file_at_scale(filename: cstring, width, height: gint, - preserve_aspect_ratio: gboolean, error: pointer): PGdkPixbuf{.cdecl, - dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_file_at_scale".} -proc gdk_pixbuf_fill*(pixbuf: PGdkPixbuf, pixel: guint32){.cdecl, +proc gdk_pixbuf_new_from_file_at_size*(filename: cstring, width, height: gint, + error: pointer): PGdkPixbuf{.cdecl, + dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_file_at_size".} +proc gdk_pixbuf_new_from_file_at_scale*(filename: cstring, width, height: gint, + preserve_aspect_ratio: gboolean, error: pointer): PGdkPixbuf{.cdecl, + dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_file_at_scale".} +proc gdk_pixbuf_fill*(pixbuf: PGdkPixbuf, pixel: guint32){.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_fill".} -proc gdk_pixbuf_save*(pixbuf: PGdkPixbuf, filename: cstring, `type`: cstring, - error: pointer): gboolean{.cdecl, varargs, +proc gdk_pixbuf_save*(pixbuf: PGdkPixbuf, filename: cstring, `type`: cstring, + error: pointer): gboolean{.cdecl, varargs, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_save".} -proc gdk_pixbuf_savev*(pixbuf: PGdkPixbuf, filename: cstring, `type`: cstring, - option_keys: PPchar, option_values: PPchar, - error: pointer): gboolean{.cdecl, dynlib: gdkpixbuflib, +proc gdk_pixbuf_savev*(pixbuf: PGdkPixbuf, filename: cstring, `type`: cstring, + option_keys: PPchar, option_values: PPchar, + error: pointer): gboolean{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_savev".} -proc gdk_pixbuf_add_alpha*(pixbuf: PGdkPixbuf, substitute_color: gboolean, - r: guchar, g: guchar, b: guchar): PGdkPixbuf{.cdecl, +proc gdk_pixbuf_add_alpha*(pixbuf: PGdkPixbuf, substitute_color: gboolean, + r: guchar, g: guchar, b: guchar): PGdkPixbuf{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_add_alpha".} -proc gdk_pixbuf_copy_area*(src_pixbuf: PGdkPixbuf, src_x: int32, src_y: int32, - width: int32, height: int32, dest_pixbuf: PGdkPixbuf, - dest_x: int32, dest_y: int32){.cdecl, +proc gdk_pixbuf_copy_area*(src_pixbuf: PGdkPixbuf, src_x: int32, src_y: int32, + width: int32, height: int32, dest_pixbuf: PGdkPixbuf, + dest_x: int32, dest_y: int32){.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_copy_area".} -proc gdk_pixbuf_saturate_and_pixelate*(src: PGdkPixbuf, dest: PGdkPixbuf, +proc gdk_pixbuf_saturate_and_pixelate*(src: PGdkPixbuf, dest: PGdkPixbuf, saturation: gfloat, pixelate: gboolean){. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_saturate_and_pixelate".} -proc gdk_pixbuf_scale*(src: PGdkPixbuf, dest: PGdkPixbuf, dest_x: int32, - dest_y: int32, dest_width: int32, dest_height: int32, - offset_x: float64, offset_y: float64, scale_x: float64, - scale_y: float64, interp_type: TGdkInterpType){.cdecl, +proc gdk_pixbuf_scale*(src: PGdkPixbuf, dest: PGdkPixbuf, dest_x: int32, + dest_y: int32, dest_width: int32, dest_height: int32, + offset_x: float64, offset_y: float64, scale_x: float64, + scale_y: float64, interp_type: TGdkInterpType){.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_scale".} -proc gdk_pixbuf_composite*(src: PGdkPixbuf, dest: PGdkPixbuf, dest_x: int32, - dest_y: int32, dest_width: int32, dest_height: int32, - offset_x: float64, offset_y: float64, - scale_x: float64, scale_y: float64, +proc gdk_pixbuf_composite*(src: PGdkPixbuf, dest: PGdkPixbuf, dest_x: int32, + dest_y: int32, dest_width: int32, dest_height: int32, + offset_x: float64, offset_y: float64, + scale_x: float64, scale_y: float64, interp_type: TGdkInterpType, overall_alpha: int32){. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_composite".} -proc gdk_pixbuf_composite_color*(src: PGdkPixbuf, dest: PGdkPixbuf, - dest_x: int32, dest_y: int32, - dest_width: int32, dest_height: int32, - offset_x: float64, offset_y: float64, - scale_x: float64, scale_y: float64, - interp_type: TGdkInterpType, - overall_alpha: int32, check_x: int32, - check_y: int32, check_size: int32, - color1: guint32, color2: guint32){.cdecl, +proc gdk_pixbuf_composite_color*(src: PGdkPixbuf, dest: PGdkPixbuf, + dest_x: int32, dest_y: int32, + dest_width: int32, dest_height: int32, + offset_x: float64, offset_y: float64, + scale_x: float64, scale_y: float64, + interp_type: TGdkInterpType, + overall_alpha: int32, check_x: int32, + check_y: int32, check_size: int32, + color1: guint32, color2: guint32){.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_composite_color".} -proc gdk_pixbuf_scale_simple*(src: PGdkPixbuf, dest_width: int32, +proc gdk_pixbuf_scale_simple*(src: PGdkPixbuf, dest_width: int32, dest_height: int32, interp_type: TGdkInterpType): PGdkPixbuf{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_scale_simple".} -proc gdk_pixbuf_composite_color_simple*(src: PGdkPixbuf, dest_width: int32, - dest_height: int32, - interp_type: TGdkInterpType, - overall_alpha: int32, check_size: int32, +proc gdk_pixbuf_composite_color_simple*(src: PGdkPixbuf, dest_width: int32, + dest_height: int32, + interp_type: TGdkInterpType, + overall_alpha: int32, check_size: int32, color1: guint32, color2: guint32): PGdkPixbuf{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_composite_color_simple".} -proc gdk_pixbuf_animation_get_type*(): GType{.cdecl, dynlib: gdkpixbuflib, +proc gdk_pixbuf_animation_get_type*(): GType{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_get_type".} proc gdk_pixbuf_animation_new_from_file*(filename: cstring, error: pointer): PGdkPixbufAnimation{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_new_from_file".} -when not defined(GDK_PIXBUF_DISABLE_DEPRECATED): - proc gdk_pixbuf_animation_ref(animation: PGdkPixbufAnimation): PGdkPixbufAnimation{. +when not defined(GDK_PIXBUF_DISABLE_DEPRECATED): + proc gdk_pixbuf_animation_ref*(animation: PGdkPixbufAnimation): PGdkPixbufAnimation{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_ref".} - proc gdk_pixbuf_animation_unref(animation: PGdkPixbufAnimation){.cdecl, + proc gdk_pixbuf_animation_unref*(animation: PGdkPixbufAnimation){.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_unref".} proc gdk_pixbuf_animation_get_width*(animation: PGdkPixbufAnimation): int32{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_get_width".} @@ -169,37 +165,37 @@ proc gdk_pixbuf_animation_get_height*(animation: PGdkPixbufAnimation): int32{. proc gdk_pixbuf_animation_is_static_image*(animation: PGdkPixbufAnimation): gboolean{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_is_static_image".} proc gdk_pixbuf_animation_get_static_image*(animation: PGdkPixbufAnimation): PGdkPixbuf{. - cdecl, dynlib: gdkpixbuflib, + cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_get_static_image".} -proc gdk_pixbuf_animation_get_iter*(animation: PGdkPixbufAnimation, +proc gdk_pixbuf_animation_get_iter*(animation: PGdkPixbufAnimation, e: var TGTimeVal): PGdkPixbufAnimationIter{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_get_iter".} -proc gdk_pixbuf_animation_iter_get_type*(): GType{.cdecl, dynlib: gdkpixbuflib, +proc gdk_pixbuf_animation_iter_get_type*(): GType{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_iter_get_type".} proc gdk_pixbuf_animation_iter_get_delay_time*(iter: PGdkPixbufAnimationIter): int32{. - cdecl, dynlib: gdkpixbuflib, + cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_iter_get_delay_time".} proc gdk_pixbuf_animation_iter_get_pixbuf*(iter: PGdkPixbufAnimationIter): PGdkPixbuf{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_iter_get_pixbuf".} proc gdk_pixbuf_animation_iter_on_currently_loading_frame*( - iter: PGdkPixbufAnimationIter): gboolean{.cdecl, dynlib: gdkpixbuflib, + iter: PGdkPixbufAnimationIter): gboolean{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_iter_on_currently_loading_frame".} -proc gdk_pixbuf_animation_iter_advance*(iter: PGdkPixbufAnimationIter, - e: var TGTimeVal): gboolean{.cdecl, +proc gdk_pixbuf_animation_iter_advance*(iter: PGdkPixbufAnimationIter, + e: var TGTimeVal): gboolean{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_iter_advance".} -proc gdk_pixbuf_get_option*(pixbuf: PGdkPixbuf, key: cstring): cstring{.cdecl, +proc gdk_pixbuf_get_option*(pixbuf: PGdkPixbuf, key: cstring): cstring{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_option".} -type +type PGdkPixbufLoader* = ptr TGdkPixbufLoader - TGdkPixbufLoader* {.final.} = object + TGdkPixbufLoader* {.final.} = object parent_instance*: TGObject priv*: gpointer PGdkPixbufLoaderClass* = ptr TGdkPixbufLoaderClass - TGdkPixbufLoaderClass* {.final.} = object + TGdkPixbufLoaderClass* {.final.} = object parent_class*: TGObjectClass area_prepared*: proc (loader: PGdkPixbufLoader){.cdecl.} - area_updated*: proc (loader: PGdkPixbufLoader, x: int32, y: int32, + area_updated*: proc (loader: PGdkPixbufLoader, x: int32, y: int32, width: int32, height: int32){.cdecl.} closed*: proc (loader: PGdkPixbufLoader){.cdecl.} @@ -210,70 +206,70 @@ proc GDK_PIXBUF_LOADER_CLASS*(klass: pointer): PGdkPixbufLoaderClass proc GDK_IS_PIXBUF_LOADER*(obj: pointer): bool proc GDK_IS_PIXBUF_LOADER_CLASS*(klass: pointer): bool proc GDK_PIXBUF_LOADER_GET_CLASS*(obj: pointer): PGdkPixbufLoaderClass -proc gdk_pixbuf_loader_get_type*(): GType{.cdecl, dynlib: gdkpixbuflib, +proc gdk_pixbuf_loader_get_type*(): GType{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_loader_get_type".} -proc gdk_pixbuf_loader_new*(): PGdkPixbufLoader{.cdecl, dynlib: gdkpixbuflib, +proc gdk_pixbuf_loader_new*(): PGdkPixbufLoader{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_loader_new".} proc gdk_pixbuf_loader_new_with_type*(image_type: cstring, error: pointer): PGdkPixbufLoader{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_loader_new_with_type".} -proc gdk_pixbuf_loader_write*(loader: PGdkPixbufLoader, buf: Pguchar, - count: gsize, error: pointer): gboolean{.cdecl, +proc gdk_pixbuf_loader_write*(loader: PGdkPixbufLoader, buf: Pguchar, + count: gsize, error: pointer): gboolean{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_loader_write".} -proc gdk_pixbuf_loader_get_pixbuf*(loader: PGdkPixbufLoader): PGdkPixbuf{.cdecl, +proc gdk_pixbuf_loader_get_pixbuf*(loader: PGdkPixbufLoader): PGdkPixbuf{.cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_loader_get_pixbuf".} proc gdk_pixbuf_loader_get_animation*(loader: PGdkPixbufLoader): PGdkPixbufAnimation{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_loader_get_animation".} proc gdk_pixbuf_loader_close*(loader: PGdkPixbufLoader, error: pointer): gboolean{. cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_loader_close".} -proc GDK_TYPE_PIXBUF_LOADER*(): GType = +proc GDK_TYPE_PIXBUF_LOADER*(): GType = result = gdk_pixbuf_loader_get_type() -proc GDK_PIXBUF_LOADER*(obj: pointer): PGdkPixbufLoader = - result = cast[PGdkPixbufLoader](G_TYPE_CHECK_INSTANCE_CAST(obj, +proc GDK_PIXBUF_LOADER*(obj: pointer): PGdkPixbufLoader = + result = cast[PGdkPixbufLoader](G_TYPE_CHECK_INSTANCE_CAST(obj, GDK_TYPE_PIXBUF_LOADER())) -proc GDK_PIXBUF_LOADER_CLASS*(klass: pointer): PGdkPixbufLoaderClass = - result = cast[PGdkPixbufLoaderClass](G_TYPE_CHECK_CLASS_CAST(klass, +proc GDK_PIXBUF_LOADER_CLASS*(klass: pointer): PGdkPixbufLoaderClass = + result = cast[PGdkPixbufLoaderClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_PIXBUF_LOADER())) -proc GDK_IS_PIXBUF_LOADER*(obj: pointer): bool = +proc GDK_IS_PIXBUF_LOADER*(obj: pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(obj, GDK_TYPE_PIXBUF_LOADER()) -proc GDK_IS_PIXBUF_LOADER_CLASS*(klass: pointer): bool = +proc GDK_IS_PIXBUF_LOADER_CLASS*(klass: pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_PIXBUF_LOADER()) -proc GDK_PIXBUF_LOADER_GET_CLASS*(obj: pointer): PGdkPixbufLoaderClass = - result = cast[PGdkPixbufLoaderClass](G_TYPE_INSTANCE_GET_CLASS(obj, +proc GDK_PIXBUF_LOADER_GET_CLASS*(obj: pointer): PGdkPixbufLoaderClass = + result = cast[PGdkPixbufLoaderClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_PIXBUF_LOADER())) -proc GDK_TYPE_PIXBUF*(): GType = +proc GDK_TYPE_PIXBUF*(): GType = result = gdk_pixbuf_get_type() -proc GDK_PIXBUF*(anObject: pointer): PGdkPixbuf = +proc GDK_PIXBUF*(anObject: pointer): PGdkPixbuf = result = cast[PGdkPixbuf](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_PIXBUF())) -proc GDK_IS_PIXBUF*(anObject: pointer): bool = +proc GDK_IS_PIXBUF*(anObject: pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_PIXBUF()) -proc GDK_TYPE_PIXBUF_ANIMATION*(): GType = +proc GDK_TYPE_PIXBUF_ANIMATION*(): GType = result = gdk_pixbuf_animation_get_type() -proc GDK_PIXBUF_ANIMATION*(anObject: pointer): PGdkPixbufAnimation = - result = cast[PGdkPixbufAnimation](G_TYPE_CHECK_INSTANCE_CAST(anObject, +proc GDK_PIXBUF_ANIMATION*(anObject: pointer): PGdkPixbufAnimation = + result = cast[PGdkPixbufAnimation](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_PIXBUF_ANIMATION())) -proc GDK_IS_PIXBUF_ANIMATION*(anObject: pointer): bool = +proc GDK_IS_PIXBUF_ANIMATION*(anObject: pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_PIXBUF_ANIMATION()) -proc GDK_TYPE_PIXBUF_ANIMATION_ITER*(): GType = +proc GDK_TYPE_PIXBUF_ANIMATION_ITER*(): GType = result = gdk_pixbuf_animation_iter_get_type() -proc GDK_PIXBUF_ANIMATION_ITER*(anObject: pointer): PGdkPixbufAnimationIter = - result = cast[PGdkPixbufAnimationIter](G_TYPE_CHECK_INSTANCE_CAST(anObject, +proc GDK_PIXBUF_ANIMATION_ITER*(anObject: pointer): PGdkPixbufAnimationIter = + result = cast[PGdkPixbufAnimationIter](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_PIXBUF_ANIMATION_ITER())) -proc GDK_IS_PIXBUF_ANIMATION_ITER*(anObject: pointer): bool = +proc GDK_IS_PIXBUF_ANIMATION_ITER*(anObject: pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_PIXBUF_ANIMATION_ITER()) -proc GDK_PIXBUF_ERROR*(): TGQuark = +proc GDK_PIXBUF_ERROR*(): TGQuark = result = gdk_pixbuf_error_quark() diff --git a/lib/base/gtk/glib2.nim b/lib/base/gtk/glib2.nim index c84bc26eb..dfcc586da 100644 --- a/lib/base/gtk/glib2.nim +++ b/lib/base/gtk/glib2.nim @@ -1,16 +1,16 @@ when defined(windows): - {.define: gtkwin.} const gliblib = "libglib-2.0-0.dll" - gthreadlib = "libgthread-2.0-0.dll" gmodulelib = "libgmodule-2.0-0.dll" gobjectlib = "libgobject-2.0-0.dll" else: const gliblib = "libglib-2.0.so" - gthreadlib = "libgthread-2.0.so" gmodulelib = "libgmodule-2.0.so" gobjectlib = "libgobject-2.0.so" + +# gthreadlib = "libgthread-2.0.so" + type PGTypePlugin* = pointer PGParamSpecPool* = pointer @@ -19,29 +19,29 @@ type PPPgchar* = ptr PPgchar PPgchar* = ptr cstring gchar* = char - Pgshort* = ptr gshort gshort* = cshort - Pglong* = ptr glong glong* = clong + gint* = cint + gboolean* = bool + guchar* = char + gushort* = int16 + gulong* = int + guint* = cint + gfloat* = cfloat + gdouble* = cdouble + gpointer* = pointer + Pgshort* = ptr gshort + Pglong* = ptr glong Pgint* = ptr gint PPgint* = ptr Pgint - gint* = cint Pgboolean* = ptr gboolean - gboolean* = bool Pguchar* = ptr guchar PPguchar* = ptr Pguchar - guchar* = char Pgushort* = ptr gushort - gushort* = int16 Pgulong* = ptr gulong - gulong* = int - guint* = cint Pguint* = ptr guint - gfloat* = cfloat Pgfloat* = ptr gfloat - gdouble* = cdouble Pgdouble* = ptr gdouble - gpointer* = pointer pgpointer* = ptr gpointer gconstpointer* = pointer PGCompareFunc* = ptr TGCompareFunc @@ -118,8 +118,8 @@ type g_type*: GType data*: array[0..1, gdouble] - PPGData* = ptr PGData PGData* = pointer + PPGData* = ptr PGData PGSList* = ptr TGSList PPGSList* = ptr PGSList TGSList* {.final.} = object @@ -132,8 +132,8 @@ type next*: PGList prev*: PGList - PGParamFlags* = ptr TGParamFlags TGParamFlags* = int32 + PGParamFlags* = ptr TGParamFlags PGParamSpec* = ptr TGParamSpec PPGParamSpec* = ptr PGParamSpec TGParamSpec* {.final.} = object @@ -194,7 +194,7 @@ const G_TYPE_PARAM* = GType(19 shl G_TYPE_FUNDAMENTAL_SHIFT) G_TYPE_OBJECT* = GType(20 shl G_TYPE_FUNDAMENTAL_SHIFT) -proc G_TYPE_MAKE_FUNDAMENTAL*(x: int32): GType +proc G_TYPE_MAKE_FUNDAMENTAL*(x: int): GType const G_TYPE_RESERVED_GLIB_FIRST* = 21 G_TYPE_RESERVED_GLIB_LAST* = 31 @@ -226,8 +226,8 @@ proc G_TYPE_FROM_INSTANCE*(instance: Pointer): GType proc G_TYPE_FROM_CLASS*(g_class: Pointer): GType proc G_TYPE_FROM_INTERFACE*(g_iface: Pointer): GType type - PGTypeDebugFlags* = ptr TGTypeDebugFlags TGTypeDebugFlags* = int32 + PGTypeDebugFlags* = ptr TGTypeDebugFlags const G_TYPE_DEBUG_NONE* = 0 @@ -296,8 +296,8 @@ const G_TYPE_FLAG_DEEP_DERIVABLE* = 1 shl 3 type - PGTypeFlags* = ptr TGTypeFlags TGTypeFlags* = int32 + PGTypeFlags* = ptr TGTypeFlags const G_TYPE_FLAG_ABSTRACT* = 1 shl 4 @@ -562,8 +562,8 @@ proc g_strdup_value_contents*(value: PGValue): cstring{.cdecl, proc g_value_set_string_take_ownership*(value: PGValue, v_string: cstring){. cdecl, dynlib: gobjectlib, importc: "g_value_set_string_take_ownership".} type - Pgchararray* = ptr Tgchararray Tgchararray* = gchar + Pgchararray* = ptr Tgchararray proc G_TYPE_IS_PARAM*(theType: GType): bool proc G_PARAM_SPEC*(pspec: Pointer): PGParamSpec @@ -692,26 +692,26 @@ proc G_CLOSURE_N_NOTIFIERS*(cl: PGClosure): int32 proc G_CCLOSURE_SWAP_DATA*(cclosure: PGClosure): int32 proc G_CALLBACK*(f: pointer): TGCallback const - bm_TGClosure_ref_count* = 0x00007FFF - bp_TGClosure_ref_count* = 0 - bm_TGClosure_meta_marshal* = 0x00008000 - bp_TGClosure_meta_marshal* = 15 - bm_TGClosure_n_guards* = 0x00010000 - bp_TGClosure_n_guards* = 16 - bm_TGClosure_n_fnotifiers* = 0x00060000 - bp_TGClosure_n_fnotifiers* = 17 - bm_TGClosure_n_inotifiers* = 0x07F80000 - bp_TGClosure_n_inotifiers* = 19 - bm_TGClosure_in_inotify* = 0x08000000 - bp_TGClosure_in_inotify* = 27 - bm_TGClosure_floating* = 0x10000000 - bp_TGClosure_floating* = 28 - bm_TGClosure_derivative_flag* = 0x20000000 - bp_TGClosure_derivative_flag* = 29 - bm_TGClosure_in_marshal* = 0x40000000 - bp_TGClosure_in_marshal* = 30 - bm_TGClosure_is_invalid* = 0x80000000 - bp_TGClosure_is_invalid* = 31 + bm_TGClosure_ref_count* = 0x00007FFF'i32 + bp_TGClosure_ref_count* = 0'i32 + bm_TGClosure_meta_marshal* = 0x00008000'i32 + bp_TGClosure_meta_marshal* = 15'i32 + bm_TGClosure_n_guards* = 0x00010000'i32 + bp_TGClosure_n_guards* = 16'i32 + bm_TGClosure_n_fnotifiers* = 0x00060000'i32 + bp_TGClosure_n_fnotifiers* = 17'i32 + bm_TGClosure_n_inotifiers* = 0x07F80000'i32 + bp_TGClosure_n_inotifiers* = 19'i32 + bm_TGClosure_in_inotify* = 0x08000000'i32 + bp_TGClosure_in_inotify* = 27'i32 + bm_TGClosure_floating* = 0x10000000'i32 + bp_TGClosure_floating* = 28'i32 + bm_TGClosure_derivative_flag* = 0x20000000'i32 + bp_TGClosure_derivative_flag* = 29'i32 + bm_TGClosure_in_marshal* = 0x40000000'i32 + bp_TGClosure_in_marshal* = 30'i32 + bm_TGClosure_is_invalid* = 0x80000000'i32 + bp_TGClosure_is_invalid* = 31'i32 proc ref_count*(a: var TGClosure): guint proc set_ref_count*(a: var TGClosure, ref_count: guint) @@ -2061,16 +2061,16 @@ type TGHookFlagMask* = int const - G_HOOK_FLAG_ACTIVE* = 1 shl 0 - G_HOOK_FLAG_IN_CALL* = 1 shl 1 - G_HOOK_FLAG_MASK* = 0x0000000F + G_HOOK_FLAG_ACTIVE* = 1'i32 shl 0'i32 + G_HOOK_FLAG_IN_CALL* = 1'i32 shl 1'i32 + G_HOOK_FLAG_MASK* = 0x0000000F'i32 const - G_HOOK_FLAG_USER_SHIFT* = 4 - bm_TGHookList_hook_size* = 0x0000FFFF - bp_TGHookList_hook_size* = 0 - bm_TGHookList_is_setup* = 0x00010000 - bp_TGHookList_is_setup* = 16 + G_HOOK_FLAG_USER_SHIFT* = 4'i32 + bm_TGHookList_hook_size* = 0x0000FFFF'i32 + bp_TGHookList_hook_size* = 0'i32 + bm_TGHookList_is_setup* = 0x00010000'i32 + bp_TGHookList_is_setup* = 16'i32 proc TGHookList_hook_size*(a: var TGHookList): guint proc TGHookList_set_hook_size*(a: var TGHookList, `hook_size`: guint) @@ -2502,18 +2502,18 @@ type const - bm_TGIOChannel_use_buffer* = 0x00000001 - bp_TGIOChannel_use_buffer* = 0 - bm_TGIOChannel_do_encode* = 0x00000002 - bp_TGIOChannel_do_encode* = 1 - bm_TGIOChannel_close_on_unref* = 0x00000004 - bp_TGIOChannel_close_on_unref* = 2 - bm_TGIOChannel_is_readable* = 0x00000008 - bp_TGIOChannel_is_readable* = 3 - bm_TGIOChannel_is_writeable* = 0x00000010 - bp_TGIOChannel_is_writeable* = 4 - bm_TGIOChannel_is_seekable* = 0x00000020 - bp_TGIOChannel_is_seekable* = 5 + bm_TGIOChannel_use_buffer* = 0x00000001'i16 + bp_TGIOChannel_use_buffer* = 0'i16 + bm_TGIOChannel_do_encode* = 0x00000002'i16 + bp_TGIOChannel_do_encode* = 1'i16 + bm_TGIOChannel_close_on_unref* = 0x00000004'i16 + bp_TGIOChannel_close_on_unref* = 2'i16 + bm_TGIOChannel_is_readable* = 0x00000008'i16 + bp_TGIOChannel_is_readable* = 3'i16 + bm_TGIOChannel_is_writeable* = 0x00000010'i16 + bp_TGIOChannel_is_writeable* = 4'i16 + bm_TGIOChannel_is_seekable* = 0x00000020'i16 + bp_TGIOChannel_is_seekable* = 5'i16 proc TGIOChannel_use_buffer*(a: var TGIOChannel): guint proc TGIOChannel_set_use_buffer*(a: var TGIOChannel, `use_buffer`: guint) @@ -3046,48 +3046,48 @@ const G_CSET_DIGITS* = "0123456789" const - bm_TGScannerConfig_case_sensitive* = 0x00000001 - bp_TGScannerConfig_case_sensitive* = 0 - bm_TGScannerConfig_skip_comment_multi* = 0x00000002 - bp_TGScannerConfig_skip_comment_multi* = 1 - bm_TGScannerConfig_skip_comment_single* = 0x00000004 - bp_TGScannerConfig_skip_comment_single* = 2 - bm_TGScannerConfig_scan_comment_multi* = 0x00000008 - bp_TGScannerConfig_scan_comment_multi* = 3 - bm_TGScannerConfig_scan_identifier* = 0x00000010 - bp_TGScannerConfig_scan_identifier* = 4 - bm_TGScannerConfig_scan_identifier_1char* = 0x00000020 - bp_TGScannerConfig_scan_identifier_1char* = 5 - bm_TGScannerConfig_scan_identifier_NULL* = 0x00000040 - bp_TGScannerConfig_scan_identifier_NULL* = 6 - bm_TGScannerConfig_scan_symbols* = 0x00000080 - bp_TGScannerConfig_scan_symbols* = 7 - bm_TGScannerConfig_scan_binary* = 0x00000100 - bp_TGScannerConfig_scan_binary* = 8 - bm_TGScannerConfig_scan_octal* = 0x00000200 - bp_TGScannerConfig_scan_octal* = 9 - bm_TGScannerConfig_scan_float* = 0x00000400 - bp_TGScannerConfig_scan_float* = 10 - bm_TGScannerConfig_scan_hex* = 0x00000800 - bp_TGScannerConfig_scan_hex* = 11 - bm_TGScannerConfig_scan_hex_dollar* = 0x00001000 - bp_TGScannerConfig_scan_hex_dollar* = 12 - bm_TGScannerConfig_scan_string_sq* = 0x00002000 - bp_TGScannerConfig_scan_string_sq* = 13 - bm_TGScannerConfig_scan_string_dq* = 0x00004000 - bp_TGScannerConfig_scan_string_dq* = 14 - bm_TGScannerConfig_numbers_2_int* = 0x00008000 - bp_TGScannerConfig_numbers_2_int* = 15 - bm_TGScannerConfig_int_2_float* = 0x00010000 - bp_TGScannerConfig_int_2_float* = 16 - bm_TGScannerConfig_identifier_2_string* = 0x00020000 - bp_TGScannerConfig_identifier_2_string* = 17 - bm_TGScannerConfig_char_2_token* = 0x00040000 - bp_TGScannerConfig_char_2_token* = 18 - bm_TGScannerConfig_symbol_2_token* = 0x00080000 - bp_TGScannerConfig_symbol_2_token* = 19 - bm_TGScannerConfig_scope_0_fallback* = 0x00100000 - bp_TGScannerConfig_scope_0_fallback* = 20 + bm_TGScannerConfig_case_sensitive* = 0x00000001'i32 + bp_TGScannerConfig_case_sensitive* = 0'i32 + bm_TGScannerConfig_skip_comment_multi* = 0x00000002'i32 + bp_TGScannerConfig_skip_comment_multi* = 1'i32 + bm_TGScannerConfig_skip_comment_single* = 0x00000004'i32 + bp_TGScannerConfig_skip_comment_single* = 2'i32 + bm_TGScannerConfig_scan_comment_multi* = 0x00000008'i32 + bp_TGScannerConfig_scan_comment_multi* = 3'i32 + bm_TGScannerConfig_scan_identifier* = 0x00000010'i32 + bp_TGScannerConfig_scan_identifier* = 4'i32 + bm_TGScannerConfig_scan_identifier_1char* = 0x00000020'i32 + bp_TGScannerConfig_scan_identifier_1char* = 5'i32 + bm_TGScannerConfig_scan_identifier_NULL* = 0x00000040'i32 + bp_TGScannerConfig_scan_identifier_NULL* = 6'i32 + bm_TGScannerConfig_scan_symbols* = 0x00000080'i32 + bp_TGScannerConfig_scan_symbols* = 7'i32 + bm_TGScannerConfig_scan_binary* = 0x00000100'i32 + bp_TGScannerConfig_scan_binary* = 8'i32 + bm_TGScannerConfig_scan_octal* = 0x00000200'i32 + bp_TGScannerConfig_scan_octal* = 9'i32 + bm_TGScannerConfig_scan_float* = 0x00000400'i32 + bp_TGScannerConfig_scan_float* = 10'i32 + bm_TGScannerConfig_scan_hex* = 0x00000800'i32 + bp_TGScannerConfig_scan_hex* = 11'i32 + bm_TGScannerConfig_scan_hex_dollar* = 0x00001000'i32 + bp_TGScannerConfig_scan_hex_dollar* = 12'i32 + bm_TGScannerConfig_scan_string_sq* = 0x00002000'i32 + bp_TGScannerConfig_scan_string_sq* = 13'i32 + bm_TGScannerConfig_scan_string_dq* = 0x00004000'i32 + bp_TGScannerConfig_scan_string_dq* = 14'i32 + bm_TGScannerConfig_numbers_2_int* = 0x00008000'i32 + bp_TGScannerConfig_numbers_2_int* = 15'i32 + bm_TGScannerConfig_int_2_float* = 0x00010000'i32 + bp_TGScannerConfig_int_2_float* = 16'i32 + bm_TGScannerConfig_identifier_2_string* = 0x00020000'i32 + bp_TGScannerConfig_identifier_2_string* = 17'i32 + bm_TGScannerConfig_char_2_token* = 0x00040000'i32 + bp_TGScannerConfig_char_2_token* = 18'i32 + bm_TGScannerConfig_symbol_2_token* = 0x00080000'i32 + bp_TGScannerConfig_symbol_2_token* = 19'i32 + bm_TGScannerConfig_scope_0_fallback* = 0x00100000'i32 + bp_TGScannerConfig_scope_0_fallback* = 20'i32 proc TGScannerConfig_case_sensitive*(a: var TGScannerConfig): guint proc TGScannerConfig_set_case_sensitive*(a: var TGScannerConfig, @@ -3439,19 +3439,21 @@ proc g_cclosure_marshal_BOOL__FLAGS*(closure: PGClosure, return_value: PGValue, marshal_data: GPointer){.cdecl, dynlib: gliblib, importc: "g_cclosure_marshal_BOOLEAN__FLAGS".} proc GUINT16_SWAP_LE_BE_CONSTANT*(val: guint16): guint16 = - Result = ((val and 0x000000FF) shl 8) or ((val and 0x0000FF00) shr 8) + Result = ((val and 0x00FF'i16) shl 8'i16) or ((val and 0xFF00'i16) shr 8'i16) proc GUINT32_SWAP_LE_BE_CONSTANT*(val: guint32): guint32 = - Result = ((val and 0x000000FF) shl 24) or ((val and 0x0000FF00) shl 8) or - ((val and 0x00FF0000) shr 8) or ((val and 0xFF000000) shr 24) + Result = ((val and 0x000000FF'i32) shl 24'i32) or ((val and 0x0000FF00'i32) shl 8'i32) or + ((val and 0x00FF0000'i32) shr 8'i32) or ((val and 0xFF000000'i32) shr 24'i32) proc GUINT_TO_POINTER*(i: guint): pointer = Result = cast[Pointer](TAddress(i)) -type - PGArray = pointer when false: + + type + PGArray* = pointer + proc g_array_append_val*(a: PGArray, v: gpointer): PGArray = result = g_array_append_vals(a, addr(v), 1) @@ -3678,17 +3680,17 @@ proc G_HOOK_FLAGS*(hook: PGHook): guint = result = hook.flags proc G_HOOK_ACTIVE*(hook: PGHook): bool = - result = (hook.flags and G_HOOK_FLAG_ACTIVE) != 0 + result = (hook.flags and G_HOOK_FLAG_ACTIVE) != 0'i32 proc G_HOOK_IN_CALL*(hook: PGHook): bool = - result = (hook.flags and G_HOOK_FLAG_IN_CALL) != 0 + result = (hook.flags and G_HOOK_FLAG_IN_CALL) != 0'i32 proc G_HOOK_IS_VALID*(hook: PGHook): bool = result = (hook.hook_id != 0) and G_HOOK_ACTIVE(hook) proc G_HOOK_IS_UNLINKED*(hook: PGHook): bool = result = (hook.next == nil) and (hook.prev == nil) and - (hook.hook_id == 0) and (hook.ref_count == 0) + (hook.hook_id == 0) and (hook.ref_count == 0'i32) proc g_hook_append*(hook_list: PGHookList, hook: PGHook) = g_hook_insert_before(hook_list, nil, hook) @@ -3702,7 +3704,7 @@ proc TGIOChannel_use_buffer*(a: var TGIOChannel): guint = proc TGIOChannel_set_use_buffer*(a: var TGIOChannel, `use_buffer`: guint) = a.flag0 = a.flag0 or - ((`use_buffer` shl bp_TGIOChannel_use_buffer) and + (int16(`use_buffer` shl bp_TGIOChannel_use_buffer) and bm_TGIOChannel_use_buffer) proc TGIOChannel_do_encode*(a: var TGIOChannel): guint = @@ -3711,7 +3713,7 @@ proc TGIOChannel_do_encode*(a: var TGIOChannel): guint = proc TGIOChannel_set_do_encode*(a: var TGIOChannel, `do_encode`: guint) = a.flag0 = a.flag0 or - ((`do_encode` shl bp_TGIOChannel_do_encode) and + (int16(`do_encode` shl bp_TGIOChannel_do_encode) and bm_TGIOChannel_do_encode) proc TGIOChannel_close_on_unref*(a: var TGIOChannel): guint = @@ -3720,7 +3722,7 @@ proc TGIOChannel_close_on_unref*(a: var TGIOChannel): guint = proc TGIOChannel_set_close_on_unref*(a: var TGIOChannel, `close_on_unref`: guint) = a.flag0 = a.flag0 or - ((`close_on_unref` shl bp_TGIOChannel_close_on_unref) and + (int16(`close_on_unref` shl bp_TGIOChannel_close_on_unref) and bm_TGIOChannel_close_on_unref) proc TGIOChannel_is_readable*(a: var TGIOChannel): guint = @@ -3729,7 +3731,7 @@ proc TGIOChannel_is_readable*(a: var TGIOChannel): guint = proc TGIOChannel_set_is_readable*(a: var TGIOChannel, `is_readable`: guint) = a.flag0 = a.flag0 or - ((`is_readable` shl bp_TGIOChannel_is_readable) and + (int16(`is_readable` shl bp_TGIOChannel_is_readable) and bm_TGIOChannel_is_readable) proc TGIOChannel_is_writeable*(a: var TGIOChannel): guint = @@ -3738,7 +3740,7 @@ proc TGIOChannel_is_writeable*(a: var TGIOChannel): guint = proc TGIOChannel_set_is_writeable*(a: var TGIOChannel, `is_writeable`: guint) = a.flag0 = a.flag0 or - ((`is_writeable` shl bp_TGIOChannel_is_writeable) and + (int16(`is_writeable` shl bp_TGIOChannel_is_writeable) and bm_TGIOChannel_is_writeable) proc TGIOChannel_is_seekable*(a: var TGIOChannel): guint = @@ -3747,7 +3749,7 @@ proc TGIOChannel_is_seekable*(a: var TGIOChannel): guint = proc TGIOChannel_set_is_seekable*(a: var TGIOChannel, `is_seekable`: guint) = a.flag0 = a.flag0 or - ((`is_seekable` shl bp_TGIOChannel_is_seekable) and + (int16(`is_seekable` shl bp_TGIOChannel_is_seekable) and bm_TGIOChannel_is_seekable) proc g_utf8_next_char*(p: pguchar): pguchar = @@ -3816,10 +3818,10 @@ proc g_node_first_child*(node: PGNode): PGNode = result = nil proc g_rand_boolean*(rand: PGRand): gboolean = - result = ((g_rand_int(rand)) and (1 shl 15)) != 0 + result = (int(g_rand_int(rand)) and (1 shl 15)) != 0 proc g_random_boolean*(): gboolean = - result = (g_random_int() and (1 shl 15)) != 0 + result = (int(g_random_int()) and (1 shl 15)) != 0 proc TGScannerConfig_case_sensitive*(a: var TGScannerConfig): guint = result = (a.flag0 and bm_TGScannerConfig_case_sensitive) shr @@ -4077,7 +4079,7 @@ when false: proc g_strstrip*(str: cstring): cstring = result = g_strchomp(g_strchug(str)) -proc G_TYPE_MAKE_FUNDAMENTAL*(x: int32): GType = +proc G_TYPE_MAKE_FUNDAMENTAL*(x: int): GType = result = GType(x shl G_TYPE_FUNDAMENTAL_SHIFT) proc G_TYPE_IS_FUNDAMENTAL*(theType: GType): bool = @@ -4202,7 +4204,7 @@ proc G_CLOSURE_NEEDS_MARSHAL*(closure: Pointer): bool = result = cast[PGClosure](closure).marshal == nil proc G_CLOSURE_N_NOTIFIERS*(cl: PGClosure): int32 = - result = ((meta_marshal(cl) + ((n_guards(cl)) shl 1)) + (n_fnotifiers(cl))) + + result = ((meta_marshal(cl) + ((n_guards(cl)) shl 1'i32)) + (n_fnotifiers(cl))) + (n_inotifiers(cl)) proc G_CCLOSURE_SWAP_DATA*(cclosure: PGClosure): int32 = diff --git a/lib/base/gtk/gtk2.nim b/lib/base/gtk/gtk2.nim index b7cf6e64f..81e09f85d 100644 --- a/lib/base/gtk/gtk2.nim +++ b/lib/base/gtk/gtk2.nim @@ -3626,10 +3626,10 @@ const GTK_DOUBLE_BUFFERED* = 1 shl 21 const - bm_TGtkWidgetAuxInfo_x_set* = 0x00000001 - bp_TGtkWidgetAuxInfo_x_set* = 0 - bm_TGtkWidgetAuxInfo_y_set* = 0x00000002 - bp_TGtkWidgetAuxInfo_y_set* = 1 + bm_TGtkWidgetAuxInfo_x_set* = 0x00000001'i16 + bp_TGtkWidgetAuxInfo_x_set* = 0'i16 + bm_TGtkWidgetAuxInfo_y_set* = 0x00000002'i16 + bp_TGtkWidgetAuxInfo_y_set* = 1'i16 proc GTK_TYPE_WIDGET*(): GType proc GTK_WIDGET*(widget: pointer): PGtkWidget @@ -3956,8 +3956,8 @@ const GTK_ACCEL_VISIBLE* = 1 shl 0 GTK_ACCEL_LOCKED* = 1 shl 1 GTK_ACCEL_MASK* = 0x00000007 - bm_TGtkAccelKey_accel_flags* = 0x0000FFFF - bp_TGtkAccelKey_accel_flags* = 0 + bm_TGtkAccelKey_accel_flags* = 0x0000FFFF'i16 + bp_TGtkAccelKey_accel_flags* = 0'i16 proc GTK_TYPE_ACCEL_GROUP*(): GType proc GTK_ACCEL_GROUP*(anObject: pointer): PGtkAccelGroup @@ -4021,16 +4021,16 @@ proc gtk_accel_group_reconnect*(accel_group: PGtkAccelGroup, accel_path_quark: TGQuark){.cdecl, dynlib: gtklib, importc: "_gtk_accel_group_reconnect".} const - bm_TGtkContainer_border_width* = 0x0000FFFF - bp_TGtkContainer_border_width* = 0 - bm_TGtkContainer_need_resize* = 0x00010000 - bp_TGtkContainer_need_resize* = 16 - bm_TGtkContainer_resize_mode* = 0x00060000 - bp_TGtkContainer_resize_mode* = 17 - bm_TGtkContainer_reallocate_redraws* = 0x00080000 - bp_TGtkContainer_reallocate_redraws* = 19 - bm_TGtkContainer_has_focus_chain* = 0x00100000 - bp_TGtkContainer_has_focus_chain* = 20 + bm_TGtkContainer_border_width* = 0x0000FFFF'i32 + bp_TGtkContainer_border_width* = 0'i32 + bm_TGtkContainer_need_resize* = 0x00010000'i32 + bp_TGtkContainer_need_resize* = 16'i32 + bm_TGtkContainer_resize_mode* = 0x00060000'i32 + bp_TGtkContainer_resize_mode* = 17'i32 + bm_TGtkContainer_reallocate_redraws* = 0x00080000'i32 + bp_TGtkContainer_reallocate_redraws* = 19'i32 + bm_TGtkContainer_has_focus_chain* = 0x00100000'i32 + bp_TGtkContainer_has_focus_chain* = 20'i32 proc GTK_TYPE_CONTAINER*(): GType proc GTK_CONTAINER*(obj: pointer): PGtkContainer @@ -4147,42 +4147,42 @@ proc gtk_bin_get_type*(): TGtkType{.cdecl, dynlib: gtklib, proc gtk_bin_get_child*(bin: PGtkBin): PGtkWidget{.cdecl, dynlib: gtklib, importc: "gtk_bin_get_child".} const - bm_TGtkWindow_allow_shrink* = 0x00000001 - bp_TGtkWindow_allow_shrink* = 0 - bm_TGtkWindow_allow_grow* = 0x00000002 - bp_TGtkWindow_allow_grow* = 1 - bm_TGtkWindow_configure_notify_received* = 0x00000004 - bp_TGtkWindow_configure_notify_received* = 2 - bm_TGtkWindow_need_default_position* = 0x00000008 - bp_TGtkWindow_need_default_position* = 3 - bm_TGtkWindow_need_default_size* = 0x00000010 - bp_TGtkWindow_need_default_size* = 4 - bm_TGtkWindow_position* = 0x000000E0 - bp_TGtkWindow_position* = 5 - bm_TGtkWindow_type* = 0x00000F00 - bp_TGtkWindow_type* = 8 - bm_TGtkWindow_has_user_ref_count* = 0x00001000 - bp_TGtkWindow_has_user_ref_count* = 12 - bm_TGtkWindow_has_focus* = 0x00002000 - bp_TGtkWindow_has_focus* = 13 - bm_TGtkWindow_modal* = 0x00004000 - bp_TGtkWindow_modal* = 14 - bm_TGtkWindow_destroy_with_parent* = 0x00008000 - bp_TGtkWindow_destroy_with_parent* = 15 - bm_TGtkWindow_has_frame* = 0x00010000 - bp_TGtkWindow_has_frame* = 16 - bm_TGtkWindow_iconify_initially* = 0x00020000 - bp_TGtkWindow_iconify_initially* = 17 - bm_TGtkWindow_stick_initially* = 0x00040000 - bp_TGtkWindow_stick_initially* = 18 - bm_TGtkWindow_maximize_initially* = 0x00080000 - bp_TGtkWindow_maximize_initially* = 19 - bm_TGtkWindow_decorated* = 0x00100000 - bp_TGtkWindow_decorated* = 20 - bm_TGtkWindow_type_hint* = 0x00E00000 - bp_TGtkWindow_type_hint* = 21 - bm_TGtkWindow_gravity* = 0x1F000000 - bp_TGtkWindow_gravity* = 24 + bm_TGtkWindow_allow_shrink* = 0x00000001'i32 + bp_TGtkWindow_allow_shrink* = 0'i32 + bm_TGtkWindow_allow_grow* = 0x00000002'i32 + bp_TGtkWindow_allow_grow* = 1'i32 + bm_TGtkWindow_configure_notify_received* = 0x00000004'i32 + bp_TGtkWindow_configure_notify_received* = 2'i32 + bm_TGtkWindow_need_default_position* = 0x00000008'i32 + bp_TGtkWindow_need_default_position* = 3'i32 + bm_TGtkWindow_need_default_size* = 0x00000010'i32 + bp_TGtkWindow_need_default_size* = 4'i32 + bm_TGtkWindow_position* = 0x000000E0'i32 + bp_TGtkWindow_position* = 5'i32 + bm_TGtkWindow_type* = 0x00000F00'i32 + bp_TGtkWindow_type* = 8'i32 + bm_TGtkWindow_has_user_ref_count* = 0x00001000'i32 + bp_TGtkWindow_has_user_ref_count* = 12'i32 + bm_TGtkWindow_has_focus* = 0x00002000'i32 + bp_TGtkWindow_has_focus* = 13'i32 + bm_TGtkWindow_modal* = 0x00004000'i32 + bp_TGtkWindow_modal* = 14'i32 + bm_TGtkWindow_destroy_with_parent* = 0x00008000'i32 + bp_TGtkWindow_destroy_with_parent* = 15'i32 + bm_TGtkWindow_has_frame* = 0x00010000'i32 + bp_TGtkWindow_has_frame* = 16'i32 + bm_TGtkWindow_iconify_initially* = 0x00020000'i32 + bp_TGtkWindow_iconify_initially* = 17'i32 + bm_TGtkWindow_stick_initially* = 0x00040000'i32 + bp_TGtkWindow_stick_initially* = 18'i32 + bm_TGtkWindow_maximize_initially* = 0x00080000'i32 + bp_TGtkWindow_maximize_initially* = 19'i32 + bm_TGtkWindow_decorated* = 0x00100000'i32 + bp_TGtkWindow_decorated* = 20'i32 + bm_TGtkWindow_type_hint* = 0x00E00000'i32 + bp_TGtkWindow_type_hint* = 21'i32 + bm_TGtkWindow_gravity* = 0x1F000000'i32 + bp_TGtkWindow_gravity* = 24'i32 proc GTK_TYPE_WINDOW*(): GType proc GTK_WINDOW*(obj: pointer): PGtkWindow @@ -4412,14 +4412,14 @@ proc gtk_window_query_nonaccels*(window: PGtkWindow, accel_key: guint, accel_mods: TGdkModifierType): gboolean{. cdecl, dynlib: gtklib, importc: "_gtk_window_query_nonaccels".} const - bm_TGtkLabel_jtype* = 0x00000003 - bp_TGtkLabel_jtype* = 0 - bm_TGtkLabel_wrap* = 0x00000004 - bp_TGtkLabel_wrap* = 2 - bm_TGtkLabel_use_underline* = 0x00000008 - bp_TGtkLabel_use_underline* = 3 - bm_TGtkLabel_use_markup* = 0x00000010 - bp_TGtkLabel_use_markup* = 4 + bm_TGtkLabel_jtype* = 0x00000003'i16 + bp_TGtkLabel_jtype* = 0'i16 + bm_TGtkLabel_wrap* = 0x00000004'i16 + bp_TGtkLabel_wrap* = 2'i16 + bm_TGtkLabel_use_underline* = 0x00000008'i16 + bp_TGtkLabel_use_underline* = 3'i16 + bm_TGtkLabel_use_markup* = 0x00000010'i16 + bp_TGtkLabel_use_markup* = 4'i16 proc GTK_TYPE_LABEL*(): GType proc GTK_LABEL*(obj: pointer): PGtkLabel @@ -4498,8 +4498,8 @@ proc gtk_label_get_layout*(`label`: PGtkLabel): PPangoLayout{.cdecl, proc gtk_label_get_layout_offsets*(`label`: PGtkLabel, x: Pgint, y: Pgint){. cdecl, dynlib: gtklib, importc: "gtk_label_get_layout_offsets".} const - bm_TGtkAccelLabelClass_latin1_to_char* = 0x00000001 - bp_TGtkAccelLabelClass_latin1_to_char* = 0 + bm_TGtkAccelLabelClass_latin1_to_char* = 0x00000001'i16 + bp_TGtkAccelLabelClass_latin1_to_char* = 0'i16 proc GTK_TYPE_ACCEL_LABEL*(): GType proc GTK_ACCEL_LABEL*(obj: pointer): PGtkAccelLabel @@ -4661,12 +4661,12 @@ proc gtk_arrow_set*(arrow: PGtkArrow, arrow_type: TGtkArrowType, shadow_type: TGtkShadowType){.cdecl, dynlib: gtklib, importc: "gtk_arrow_set".} const - bm_TGtkBindingSet_parsed* = 0x00000001 - bp_TGtkBindingSet_parsed* = 0 - bm_TGtkBindingEntry_destroyed* = 0x00000001 - bp_TGtkBindingEntry_destroyed* = 0 - bm_TGtkBindingEntry_in_emission* = 0x00000002 - bp_TGtkBindingEntry_in_emission* = 1 + bm_TGtkBindingSet_parsed* = 0x00000001'i16 + bp_TGtkBindingSet_parsed* = 0'i16 + bm_TGtkBindingEntry_destroyed* = 0x00000001'i16 + bp_TGtkBindingEntry_destroyed* = 0'i16 + bm_TGtkBindingEntry_in_emission* = 0x00000002'i16 + bp_TGtkBindingEntry_in_emission* = 1'i16 proc gtk_binding_entry_add*(binding_set: PGtkBindingSet, keyval: guint, modifiers: TGdkModifierType) @@ -4709,16 +4709,16 @@ proc gtk_bindings_activate_event*(anObject: PGtkObject, event: PGdkEventKey): gb proc gtk_binding_reset_parsed*(){.cdecl, dynlib: gtklib, importc: "_gtk_binding_reset_parsed".} const - bm_TGtkBox_homogeneous* = 0x00000001 - bp_TGtkBox_homogeneous* = 0 - bm_TGtkBoxChild_expand* = 0x00000001 - bp_TGtkBoxChild_expand* = 0 - bm_TGtkBoxChild_fill* = 0x00000002 - bp_TGtkBoxChild_fill* = 1 - bm_TGtkBoxChild_pack* = 0x00000004 - bp_TGtkBoxChild_pack* = 2 - bm_TGtkBoxChild_is_secondary* = 0x00000008 - bp_TGtkBoxChild_is_secondary* = 3 + bm_TGtkBox_homogeneous* = 0x00000001'i16 + bp_TGtkBox_homogeneous* = 0'i16 + bm_TGtkBoxChild_expand* = 0x00000001'i16 + bp_TGtkBoxChild_expand* = 0'i16 + bm_TGtkBoxChild_fill* = 0x00000002'i16 + bp_TGtkBoxChild_fill* = 1'i16 + bm_TGtkBoxChild_pack* = 0x00000004'i16 + bp_TGtkBoxChild_pack* = 2'i16 + bm_TGtkBoxChild_is_secondary* = 0x00000008'i16 + bp_TGtkBoxChild_is_secondary* = 3'i16 proc GTK_TYPE_BOX*(): GType proc GTK_BOX*(obj: pointer): PGtkBox @@ -4790,22 +4790,22 @@ proc gtk_button_box_child_requisition*(widget: PGtkWidget, height: var int32){.cdecl, dynlib: gtklib, importc: "_gtk_button_box_child_requisition".} const - bm_TGtkButton_constructed* = 0x00000001 - bp_TGtkButton_constructed* = 0 - bm_TGtkButton_in_button* = 0x00000002 - bp_TGtkButton_in_button* = 1 - bm_TGtkButton_button_down* = 0x00000004 - bp_TGtkButton_button_down* = 2 - bm_TGtkButton_relief* = 0x00000018 - bp_TGtkButton_relief* = 3 - bm_TGtkButton_use_underline* = 0x00000020 - bp_TGtkButton_use_underline* = 5 - bm_TGtkButton_use_stock* = 0x00000040 - bp_TGtkButton_use_stock* = 6 - bm_TGtkButton_depressed* = 0x00000080 - bp_TGtkButton_depressed* = 7 - bm_TGtkButton_depress_on_activate* = 0x00000100 - bp_TGtkButton_depress_on_activate* = 8 + bm_TGtkButton_constructed* = 0x00000001'i16 + bp_TGtkButton_constructed* = 0'i16 + bm_TGtkButton_in_button* = 0x00000002'i16 + bp_TGtkButton_in_button* = 1'i16 + bm_TGtkButton_button_down* = 0x00000004'i16 + bp_TGtkButton_button_down* = 2'i16 + bm_TGtkButton_relief* = 0x00000018'i16 + bp_TGtkButton_relief* = 3'i16 + bm_TGtkButton_use_underline* = 0x00000020'i16 + bp_TGtkButton_use_underline* = 5'i16 + bm_TGtkButton_use_stock* = 0x00000040'i16 + bp_TGtkButton_use_stock* = 6'i16 + bm_TGtkButton_depressed* = 0x00000080'i16 + bp_TGtkButton_depressed* = 7'i16 + bm_TGtkButton_depress_on_activate* = 0x00000100'i16 + bp_TGtkButton_depress_on_activate* = 8'i16 proc GTK_TYPE_BUTTON*(): GType proc GTK_BUTTON*(obj: pointer): PGtkButton @@ -4930,16 +4930,16 @@ const GTK_CELL_RENDERER_SORTED* = 1 shl 3 const - bm_TGtkCellRenderer_mode* = 0x00000003 - bp_TGtkCellRenderer_mode* = 0 - bm_TGtkCellRenderer_visible* = 0x00000004 - bp_TGtkCellRenderer_visible* = 2 - bm_TGtkCellRenderer_is_expander* = 0x00000008 - bp_TGtkCellRenderer_is_expander* = 3 - bm_TGtkCellRenderer_is_expanded* = 0x00000010 - bp_TGtkCellRenderer_is_expanded* = 4 - bm_TGtkCellRenderer_cell_background_set* = 0x00000020 - bp_TGtkCellRenderer_cell_background_set* = 5 + bm_TGtkCellRenderer_mode* = 0x00000003'i16 + bp_TGtkCellRenderer_mode* = 0'i16 + bm_TGtkCellRenderer_visible* = 0x00000004'i16 + bp_TGtkCellRenderer_visible* = 2'i16 + bm_TGtkCellRenderer_is_expander* = 0x00000008'i16 + bp_TGtkCellRenderer_is_expander* = 3'i16 + bm_TGtkCellRenderer_is_expanded* = 0x00000010'i16 + bp_TGtkCellRenderer_is_expanded* = 4'i16 + bm_TGtkCellRenderer_cell_background_set* = 0x00000020'i16 + bp_TGtkCellRenderer_cell_background_set* = 5'i16 proc GTK_TYPE_CELL_RENDERER*(): GType proc GTK_CELL_RENDERER*(obj: pointer): PGtkCellRenderer @@ -4990,26 +4990,26 @@ proc gtk_cell_renderer_get_fixed_size*(cell: PGtkCellRenderer, width: Pgint, height: Pgint){.cdecl, dynlib: gtklib, importc: "gtk_cell_renderer_get_fixed_size".} const - bm_TGtkCellRendererText_strikethrough* = 0x00000001 - bp_TGtkCellRendererText_strikethrough* = 0 - bm_TGtkCellRendererText_editable* = 0x00000002 - bp_TGtkCellRendererText_editable* = 1 - bm_TGtkCellRendererText_scale_set* = 0x00000004 - bp_TGtkCellRendererText_scale_set* = 2 - bm_TGtkCellRendererText_foreground_set* = 0x00000008 - bp_TGtkCellRendererText_foreground_set* = 3 - bm_TGtkCellRendererText_background_set* = 0x00000010 - bp_TGtkCellRendererText_background_set* = 4 - bm_TGtkCellRendererText_underline_set* = 0x00000020 - bp_TGtkCellRendererText_underline_set* = 5 - bm_TGtkCellRendererText_rise_set* = 0x00000040 - bp_TGtkCellRendererText_rise_set* = 6 - bm_TGtkCellRendererText_strikethrough_set* = 0x00000080 - bp_TGtkCellRendererText_strikethrough_set* = 7 - bm_TGtkCellRendererText_editable_set* = 0x00000100 - bp_TGtkCellRendererText_editable_set* = 8 - bm_TGtkCellRendererText_calc_fixed_height* = 0x00000200 - bp_TGtkCellRendererText_calc_fixed_height* = 9 + bm_TGtkCellRendererText_strikethrough* = 0x00000001'i16 + bp_TGtkCellRendererText_strikethrough* = 0'i16 + bm_TGtkCellRendererText_editable* = 0x00000002'i16 + bp_TGtkCellRendererText_editable* = 1'i16 + bm_TGtkCellRendererText_scale_set* = 0x00000004'i16 + bp_TGtkCellRendererText_scale_set* = 2'i16 + bm_TGtkCellRendererText_foreground_set* = 0x00000008'i16 + bp_TGtkCellRendererText_foreground_set* = 3'i16 + bm_TGtkCellRendererText_background_set* = 0x00000010'i16 + bp_TGtkCellRendererText_background_set* = 4'i16 + bm_TGtkCellRendererText_underline_set* = 0x00000020'i16 + bp_TGtkCellRendererText_underline_set* = 5'i16 + bm_TGtkCellRendererText_rise_set* = 0x00000040'i16 + bp_TGtkCellRendererText_rise_set* = 6'i16 + bm_TGtkCellRendererText_strikethrough_set* = 0x00000080'i16 + bp_TGtkCellRendererText_strikethrough_set* = 7'i16 + bm_TGtkCellRendererText_editable_set* = 0x00000100'i16 + bp_TGtkCellRendererText_editable_set* = 8'i16 + bm_TGtkCellRendererText_calc_fixed_height* = 0x00000200'i16 + bp_TGtkCellRendererText_calc_fixed_height* = 9'i16 proc GTK_TYPE_CELL_RENDERER_TEXT*(): GType proc GTK_CELL_RENDERER_TEXT*(obj: pointer): PGtkCellRendererText @@ -5047,12 +5047,12 @@ proc gtk_cell_renderer_text_set_fixed_height_from_font*( renderer: PGtkCellRendererText, number_of_rows: gint){.cdecl, dynlib: gtklib, importc: "gtk_cell_renderer_text_set_fixed_height_from_font".} const - bm_TGtkCellRendererToggle_active* = 0x00000001 - bp_TGtkCellRendererToggle_active* = 0 - bm_TGtkCellRendererToggle_activatable* = 0x00000002 - bp_TGtkCellRendererToggle_activatable* = 1 - bm_TGtkCellRendererToggle_radio* = 0x00000004 - bp_TGtkCellRendererToggle_radio* = 2 + bm_TGtkCellRendererToggle_active* = 0x00000001'i16 + bp_TGtkCellRendererToggle_active* = 0'i16 + bm_TGtkCellRendererToggle_activatable* = 0x00000002'i16 + bp_TGtkCellRendererToggle_activatable* = 1'i16 + bm_TGtkCellRendererToggle_radio* = 0x00000004'i16 + bp_TGtkCellRendererToggle_radio* = 2'i16 proc GTK_TYPE_CELL_RENDERER_TOGGLE*(): GType proc GTK_CELL_RENDERER_TOGGLE*(obj: pointer): PGtkCellRendererToggle @@ -5105,18 +5105,18 @@ proc gtk_item_deselect*(item: PGtkItem){.cdecl, dynlib: gtklib, proc gtk_item_toggle*(item: PGtkItem){.cdecl, dynlib: gtklib, importc: "gtk_item_toggle".} const - bm_TGtkMenuItem_show_submenu_indicator* = 0x00000001 - bp_TGtkMenuItem_show_submenu_indicator* = 0 - bm_TGtkMenuItem_submenu_placement* = 0x00000002 - bp_TGtkMenuItem_submenu_placement* = 1 - bm_TGtkMenuItem_submenu_direction* = 0x00000004 - bp_TGtkMenuItem_submenu_direction* = 2 - bm_TGtkMenuItem_right_justify* = 0x00000008 - bp_TGtkMenuItem_right_justify* = 3 - bm_TGtkMenuItem_timer_from_keypress* = 0x00000010 - bp_TGtkMenuItem_timer_from_keypress* = 4 - bm_TGtkMenuItemClass_hide_on_activate* = 0x00000001 - bp_TGtkMenuItemClass_hide_on_activate* = 0 + bm_TGtkMenuItem_show_submenu_indicator* = 0x00000001'i16 + bp_TGtkMenuItem_show_submenu_indicator* = 0'i16 + bm_TGtkMenuItem_submenu_placement* = 0x00000002'i16 + bp_TGtkMenuItem_submenu_placement* = 1'i16 + bm_TGtkMenuItem_submenu_direction* = 0x00000004'i16 + bp_TGtkMenuItem_submenu_direction* = 2'i16 + bm_TGtkMenuItem_right_justify* = 0x00000008'i16 + bp_TGtkMenuItem_right_justify* = 3'i16 + bm_TGtkMenuItem_timer_from_keypress* = 0x00000010'i16 + bp_TGtkMenuItem_timer_from_keypress* = 4'i16 + bm_TGtkMenuItemClass_hide_on_activate* = 0x00000001'i16 + bp_TGtkMenuItemClass_hide_on_activate* = 0'i16 proc GTK_TYPE_MENU_ITEM*(): GType proc GTK_MENU_ITEM*(obj: pointer): PGtkMenuItem @@ -5176,12 +5176,12 @@ proc gtk_menu_item_refresh_accel_path*(menu_item: PGtkMenuItem, proc gtk_menu_item_is_selectable*(menu_item: PGtkWidget): gboolean{.cdecl, dynlib: gtklib, importc: "_gtk_menu_item_is_selectable".} const - bm_TGtkToggleButton_active* = 0x00000001 - bp_TGtkToggleButton_active* = 0 - bm_TGtkToggleButton_draw_indicator* = 0x00000002 - bp_TGtkToggleButton_draw_indicator* = 1 - bm_TGtkToggleButton_inconsistent* = 0x00000004 - bp_TGtkToggleButton_inconsistent* = 2 + bm_TGtkToggleButton_active* = 0x00000001'i16 + bp_TGtkToggleButton_active* = 0'i16 + bm_TGtkToggleButton_draw_indicator* = 0x00000002'i16 + bp_TGtkToggleButton_draw_indicator* = 1'i16 + bm_TGtkToggleButton_inconsistent* = 0x00000004'i16 + bp_TGtkToggleButton_inconsistent* = 2'i16 proc GTK_TYPE_TOGGLE_BUTTON*(): GType proc GTK_TOGGLE_BUTTON*(obj: pointer): PGtkToggleButton @@ -5239,12 +5239,12 @@ proc gtk_check_button_get_props*(check_button: PGtkCheckButton, indicator_spacing: Pgint){.cdecl, dynlib: gtklib, importc: "_gtk_check_button_get_props".} const - bm_TGtkCheckMenuItem_active* = 0x00000001 - bp_TGtkCheckMenuItem_active* = 0 - bm_TGtkCheckMenuItem_always_show_toggle* = 0x00000002 - bp_TGtkCheckMenuItem_always_show_toggle* = 1 - bm_TGtkCheckMenuItem_inconsistent* = 0x00000004 - bp_TGtkCheckMenuItem_inconsistent* = 2 + bm_TGtkCheckMenuItem_active* = 0x00000001'i16 + bp_TGtkCheckMenuItem_active* = 0'i16 + bm_TGtkCheckMenuItem_always_show_toggle* = 0x00000002'i16 + bp_TGtkCheckMenuItem_always_show_toggle* = 1'i16 + bm_TGtkCheckMenuItem_inconsistent* = 0x00000004'i16 + bp_TGtkCheckMenuItem_inconsistent* = 2'i16 proc GTK_TYPE_CHECK_MENU_ITEM*(): GType proc GTK_CHECK_MENU_ITEM*(obj: pointer): PGtkCheckMenuItem @@ -5332,22 +5332,22 @@ const GTK_BUTTON_EXPANDS* = 1 shl 2 const - bm_TGtkCListColumn_visible* = 0x00000001 - bp_TGtkCListColumn_visible* = 0 - bm_TGtkCListColumn_width_set* = 0x00000002 - bp_TGtkCListColumn_width_set* = 1 - bm_TGtkCListColumn_resizeable* = 0x00000004 - bp_TGtkCListColumn_resizeable* = 2 - bm_TGtkCListColumn_auto_resize* = 0x00000008 - bp_TGtkCListColumn_auto_resize* = 3 - bm_TGtkCListColumn_button_passive* = 0x00000010 - bp_TGtkCListColumn_button_passive* = 4 - bm_TGtkCListRow_fg_set* = 0x00000001 - bp_TGtkCListRow_fg_set* = 0 - bm_TGtkCListRow_bg_set* = 0x00000002 - bp_TGtkCListRow_bg_set* = 1 - bm_TGtkCListRow_selectable* = 0x00000004 - bp_TGtkCListRow_selectable* = 2 + bm_TGtkCListColumn_visible* = 0x00000001'i16 + bp_TGtkCListColumn_visible* = 0'i16 + bm_TGtkCListColumn_width_set* = 0x00000002'i16 + bp_TGtkCListColumn_width_set* = 1'i16 + bm_TGtkCListColumn_resizeable* = 0x00000004'i16 + bp_TGtkCListColumn_resizeable* = 2'i16 + bm_TGtkCListColumn_auto_resize* = 0x00000008'i16 + bp_TGtkCListColumn_auto_resize* = 3'i16 + bm_TGtkCListColumn_button_passive* = 0x00000010'i16 + bp_TGtkCListColumn_button_passive* = 4'i16 + bm_TGtkCListRow_fg_set* = 0x00000001'i16 + bp_TGtkCListRow_fg_set* = 0'i16 + bm_TGtkCListRow_bg_set* = 0x00000002'i16 + bp_TGtkCListRow_bg_set* = 1'i16 + bm_TGtkCListRow_selectable* = 0x00000004'i16 + bp_TGtkCListRow_selectable* = 2'i16 proc GTK_TYPE_CLIST*(): GType proc GTK_CLIST*(obj: pointer): PGtkCList @@ -5677,16 +5677,16 @@ proc gtk_hbox_get_type*(): TGtkType{.cdecl, dynlib: gtklib, proc gtk_hbox_new*(homogeneous: gboolean, spacing: gint): PGtkWidget{.cdecl, dynlib: gtklib, importc: "gtk_hbox_new".} const - bm_TGtkCombo_value_in_list* = 0x00000001 - bp_TGtkCombo_value_in_list* = 0 - bm_TGtkCombo_ok_if_empty* = 0x00000002 - bp_TGtkCombo_ok_if_empty* = 1 - bm_TGtkCombo_case_sensitive* = 0x00000004 - bp_TGtkCombo_case_sensitive* = 2 - bm_TGtkCombo_use_arrows* = 0x00000008 - bp_TGtkCombo_use_arrows* = 3 - bm_TGtkCombo_use_arrows_always* = 0x00000010 - bp_TGtkCombo_use_arrows_always* = 4 + bm_TGtkCombo_value_in_list* = 0x00000001'i16 + bp_TGtkCombo_value_in_list* = 0'i16 + bm_TGtkCombo_ok_if_empty* = 0x00000002'i16 + bp_TGtkCombo_ok_if_empty* = 1'i16 + bm_TGtkCombo_case_sensitive* = 0x00000004'i16 + bp_TGtkCombo_case_sensitive* = 2'i16 + bm_TGtkCombo_use_arrows* = 0x00000008'i16 + bp_TGtkCombo_use_arrows* = 3'i16 + bm_TGtkCombo_use_arrows_always* = 0x00000010'i16 + bp_TGtkCombo_use_arrows_always* = 4'i16 proc GTK_TYPE_COMBO*(): GType proc GTK_COMBO*(obj: pointer): PGtkCombo @@ -5725,16 +5725,16 @@ proc gtk_combo_set_popdown_strings*(combo: PGtkCombo, strings: PGList){.cdecl, proc gtk_combo_disable_activate*(combo: PGtkCombo){.cdecl, dynlib: gtklib, importc: "gtk_combo_disable_activate".} const - bm_TGtkCTree_line_style* = 0x00000003 - bp_TGtkCTree_line_style* = 0 - bm_TGtkCTree_expander_style* = 0x0000000C - bp_TGtkCTree_expander_style* = 2 - bm_TGtkCTree_show_stub* = 0x00000010 - bp_TGtkCTree_show_stub* = 4 - bm_TGtkCTreeRow_is_leaf* = 0x00000001 - bp_TGtkCTreeRow_is_leaf* = 0 - bm_TGtkCTreeRow_expanded* = 0x00000002 - bp_TGtkCTreeRow_expanded* = 1 + bm_TGtkCTree_line_style* = 0x00000003'i16 + bp_TGtkCTree_line_style* = 0'i16 + bm_TGtkCTree_expander_style* = 0x0000000C'i16 + bp_TGtkCTree_expander_style* = 2'i16 + bm_TGtkCTree_show_stub* = 0x00000010'i16 + bp_TGtkCTree_show_stub* = 4'i16 + bm_TGtkCTreeRow_is_leaf* = 0x00000001'i16 + bp_TGtkCTreeRow_is_leaf* = 0'i16 + bm_TGtkCTreeRow_expanded* = 0x00000002'i16 + bp_TGtkCTreeRow_expanded* = 1'i16 proc GTK_TYPE_CTREE*(): GType proc GTK_CTREE*(obj: pointer): PGtkCTree @@ -6119,20 +6119,20 @@ proc gtk_im_context_delete_surrounding*(context: PGtkIMContext, offset: gint, n_chars: gint): gboolean{.cdecl, dynlib: gtklib, importc: "gtk_im_context_delete_surrounding".} const - bm_TGtkMenuShell_active* = 0x00000001 - bp_TGtkMenuShell_active* = 0 - bm_TGtkMenuShell_have_grab* = 0x00000002 - bp_TGtkMenuShell_have_grab* = 1 - bm_TGtkMenuShell_have_xgrab* = 0x00000004 - bp_TGtkMenuShell_have_xgrab* = 2 - bm_TGtkMenuShell_ignore_leave* = 0x00000008 - bp_TGtkMenuShell_ignore_leave* = 3 - bm_TGtkMenuShell_menu_flag* = 0x00000010 - bp_TGtkMenuShell_menu_flag* = 4 - bm_TGtkMenuShell_ignore_enter* = 0x00000020 - bp_TGtkMenuShell_ignore_enter* = 5 - bm_TGtkMenuShellClass_submenu_placement* = 0x00000001 - bp_TGtkMenuShellClass_submenu_placement* = 0 + bm_TGtkMenuShell_active* = 0x00000001'i16 + bp_TGtkMenuShell_active* = 0'i16 + bm_TGtkMenuShell_have_grab* = 0x00000002'i16 + bp_TGtkMenuShell_have_grab* = 1'i16 + bm_TGtkMenuShell_have_xgrab* = 0x00000004'i16 + bp_TGtkMenuShell_have_xgrab* = 2'i16 + bm_TGtkMenuShell_ignore_leave* = 0x00000008'i16 + bp_TGtkMenuShell_ignore_leave* = 3'i16 + bm_TGtkMenuShell_menu_flag* = 0x00000010'i16 + bp_TGtkMenuShell_menu_flag* = 4'i16 + bm_TGtkMenuShell_ignore_enter* = 0x00000020'i16 + bp_TGtkMenuShell_ignore_enter* = 5'i16 + bm_TGtkMenuShellClass_submenu_placement* = 0x00000001'i16 + bp_TGtkMenuShellClass_submenu_placement* = 0'i16 proc GTK_TYPE_MENU_SHELL*(): GType proc GTK_MENU_SHELL*(obj: pointer): PGtkMenuShell @@ -6180,22 +6180,22 @@ proc gtk_menu_shell_select_first*(menu_shell: PGtkMenuShell){.cdecl, proc gtk_menu_shell_activate*(menu_shell: PGtkMenuShell){.cdecl, dynlib: gtklib, importc: "_gtk_menu_shell_activate".} const - bm_TGtkMenu_needs_destruction_ref_count* = 0x00000001 - bp_TGtkMenu_needs_destruction_ref_count* = 0 - bm_TGtkMenu_torn_off* = 0x00000002 - bp_TGtkMenu_torn_off* = 1 - bm_TGtkMenu_tearoff_active* = 0x00000004 - bp_TGtkMenu_tearoff_active* = 2 - bm_TGtkMenu_scroll_fast* = 0x00000008 - bp_TGtkMenu_scroll_fast* = 3 - bm_TGtkMenu_upper_arrow_visible* = 0x00000010 - bp_TGtkMenu_upper_arrow_visible* = 4 - bm_TGtkMenu_lower_arrow_visible* = 0x00000020 - bp_TGtkMenu_lower_arrow_visible* = 5 - bm_TGtkMenu_upper_arrow_prelight* = 0x00000040 - bp_TGtkMenu_upper_arrow_prelight* = 6 - bm_TGtkMenu_lower_arrow_prelight* = 0x00000080 - bp_TGtkMenu_lower_arrow_prelight* = 7 + bm_TGtkMenu_needs_destruction_ref_count* = 0x00000001'i16 + bp_TGtkMenu_needs_destruction_ref_count* = 0'i16 + bm_TGtkMenu_torn_off* = 0x00000002'i16 + bp_TGtkMenu_torn_off* = 1'i16 + bm_TGtkMenu_tearoff_active* = 0x00000004'i16 + bp_TGtkMenu_tearoff_active* = 2'i16 + bm_TGtkMenu_scroll_fast* = 0x00000008'i16 + bp_TGtkMenu_scroll_fast* = 3'i16 + bm_TGtkMenu_upper_arrow_visible* = 0x00000010'i16 + bp_TGtkMenu_upper_arrow_visible* = 4'i16 + bm_TGtkMenu_lower_arrow_visible* = 0x00000020'i16 + bp_TGtkMenu_lower_arrow_visible* = 5'i16 + bm_TGtkMenu_upper_arrow_prelight* = 0x00000040'i16 + bp_TGtkMenu_upper_arrow_prelight* = 6'i16 + bm_TGtkMenu_lower_arrow_prelight* = 0x00000080'i16 + bp_TGtkMenu_lower_arrow_prelight* = 7'i16 proc GTK_TYPE_MENU*(): GType proc GTK_MENU*(obj: pointer): PGtkMenu @@ -6261,32 +6261,32 @@ proc gtk_menu_reorder_child*(menu: PGtkMenu, child: PGtkWidget, position: gint){ proc gtk_menu_set_screen*(menu: PGtkMenu, screen: PGdkScreen){.cdecl, dynlib: gtklib, importc: "gtk_menu_set_screen".} const - bm_TGtkEntry_editable* = 0x00000001 - bp_TGtkEntry_editable* = 0 - bm_TGtkEntry_visible* = 0x00000002 - bp_TGtkEntry_visible* = 1 - bm_TGtkEntry_overwrite_mode* = 0x00000004 - bp_TGtkEntry_overwrite_mode* = 2 - bm_TGtkEntry_in_drag* = 0x00000008 - bp_TGtkEntry_in_drag* = 3 - bm_TGtkEntry_cache_includes_preedit* = 0x00000001 - bp_TGtkEntry_cache_includes_preedit* = 0 - bm_TGtkEntry_need_im_reset* = 0x00000002 - bp_TGtkEntry_need_im_reset* = 1 - bm_TGtkEntry_has_frame* = 0x00000004 - bp_TGtkEntry_has_frame* = 2 - bm_TGtkEntry_activates_default* = 0x00000008 - bp_TGtkEntry_activates_default* = 3 - bm_TGtkEntry_cursor_visible* = 0x00000010 - bp_TGtkEntry_cursor_visible* = 4 - bm_TGtkEntry_in_click* = 0x00000020 - bp_TGtkEntry_in_click* = 5 - bm_TGtkEntry_is_cell_renderer* = 0x00000040 - bp_TGtkEntry_is_cell_renderer* = 6 - bm_TGtkEntry_editing_canceled* = 0x00000080 - bp_TGtkEntry_editing_canceled* = 7 - bm_TGtkEntry_mouse_cursor_obscured* = 0x00000100 - bp_TGtkEntry_mouse_cursor_obscured* = 8 + bm_TGtkEntry_editable* = 0x00000001'i16 + bp_TGtkEntry_editable* = 0'i16 + bm_TGtkEntry_visible* = 0x00000002'i16 + bp_TGtkEntry_visible* = 1'i16 + bm_TGtkEntry_overwrite_mode* = 0x00000004'i16 + bp_TGtkEntry_overwrite_mode* = 2'i16 + bm_TGtkEntry_in_drag* = 0x00000008'i16 + bp_TGtkEntry_in_drag* = 3'i16 + bm_TGtkEntry_cache_includes_preedit* = 0x00000001'i16 + bp_TGtkEntry_cache_includes_preedit* = 0'i16 + bm_TGtkEntry_need_im_reset* = 0x00000002'i16 + bp_TGtkEntry_need_im_reset* = 1'i16 + bm_TGtkEntry_has_frame* = 0x00000004'i16 + bp_TGtkEntry_has_frame* = 2'i16 + bm_TGtkEntry_activates_default* = 0x00000008'i16 + bp_TGtkEntry_activates_default* = 3'i16 + bm_TGtkEntry_cursor_visible* = 0x00000010'i16 + bp_TGtkEntry_cursor_visible* = 4'i16 + bm_TGtkEntry_in_click* = 0x00000020'i16 + bp_TGtkEntry_in_click* = 5'i16 + bm_TGtkEntry_is_cell_renderer* = 0x00000040'i16 + bp_TGtkEntry_is_cell_renderer* = 6'i16 + bm_TGtkEntry_editing_canceled* = 0x00000080'i16 + bp_TGtkEntry_editing_canceled* = 7'i16 + bm_TGtkEntry_mouse_cursor_obscured* = 0x00000100'i16 + bp_TGtkEntry_mouse_cursor_obscured* = 8'i16 proc GTK_TYPE_ENTRY*(): GType proc GTK_ENTRY*(obj: pointer): PGtkEntry @@ -6653,18 +6653,18 @@ proc gtk_gc_get*(depth: gint, colormap: PGdkColormap, values: PGdkGCValues, proc gtk_gc_release*(gc: PGdkGC){.cdecl, dynlib: gtklib, importc: "gtk_gc_release".} const - bm_TGtkHandleBox_handle_position* = 0x00000003 - bp_TGtkHandleBox_handle_position* = 0 - bm_TGtkHandleBox_float_window_mapped* = 0x00000004 - bp_TGtkHandleBox_float_window_mapped* = 2 - bm_TGtkHandleBox_child_detached* = 0x00000008 - bp_TGtkHandleBox_child_detached* = 3 - bm_TGtkHandleBox_in_drag* = 0x00000010 - bp_TGtkHandleBox_in_drag* = 4 - bm_TGtkHandleBox_shrink_on_detach* = 0x00000020 - bp_TGtkHandleBox_shrink_on_detach* = 5 - bm_TGtkHandleBox_snap_edge* = 0x000001C0 - bp_TGtkHandleBox_snap_edge* = 6 + bm_TGtkHandleBox_handle_position* = 0x00000003'i16 + bp_TGtkHandleBox_handle_position* = 0'i16 + bm_TGtkHandleBox_float_window_mapped* = 0x00000004'i16 + bp_TGtkHandleBox_float_window_mapped* = 2'i16 + bm_TGtkHandleBox_child_detached* = 0x00000008'i16 + bp_TGtkHandleBox_child_detached* = 3'i16 + bm_TGtkHandleBox_in_drag* = 0x00000010'i16 + bp_TGtkHandleBox_in_drag* = 4'i16 + bm_TGtkHandleBox_shrink_on_detach* = 0x00000020'i16 + bp_TGtkHandleBox_shrink_on_detach* = 5'i16 + bm_TGtkHandleBox_snap_edge* = 0x000001C0'i16 + bp_TGtkHandleBox_snap_edge* = 6'i16 proc GTK_TYPE_HANDLE_BOX*(): GType proc GTK_HANDLE_BOX*(obj: pointer): PGtkHandleBox @@ -6704,24 +6704,24 @@ proc gtk_handle_box_set_snap_edge*(handle_box: PGtkHandleBox, proc gtk_handle_box_get_snap_edge*(handle_box: PGtkHandleBox): TGtkPositionType{. cdecl, dynlib: gtklib, importc: "gtk_handle_box_get_snap_edge".} const - bm_TGtkPaned_position_set* = 0x00000001 - bp_TGtkPaned_position_set* = 0 - bm_TGtkPaned_in_drag* = 0x00000002 - bp_TGtkPaned_in_drag* = 1 - bm_TGtkPaned_child1_shrink* = 0x00000004 - bp_TGtkPaned_child1_shrink* = 2 - bm_TGtkPaned_child1_resize* = 0x00000008 - bp_TGtkPaned_child1_resize* = 3 - bm_TGtkPaned_child2_shrink* = 0x00000010 - bp_TGtkPaned_child2_shrink* = 4 - bm_TGtkPaned_child2_resize* = 0x00000020 - bp_TGtkPaned_child2_resize* = 5 - bm_TGtkPaned_orientation* = 0x00000040 - bp_TGtkPaned_orientation* = 6 - bm_TGtkPaned_in_recursion* = 0x00000080 - bp_TGtkPaned_in_recursion* = 7 - bm_TGtkPaned_handle_prelit* = 0x00000100 - bp_TGtkPaned_handle_prelit* = 8 + bm_TGtkPaned_position_set* = 0x00000001'i16 + bp_TGtkPaned_position_set* = 0'i16 + bm_TGtkPaned_in_drag* = 0x00000002'i16 + bp_TGtkPaned_in_drag* = 1'i16 + bm_TGtkPaned_child1_shrink* = 0x00000004'i16 + bp_TGtkPaned_child1_shrink* = 2'i16 + bm_TGtkPaned_child1_resize* = 0x00000008'i16 + bp_TGtkPaned_child1_resize* = 3'i16 + bm_TGtkPaned_child2_shrink* = 0x00000010'i16 + bp_TGtkPaned_child2_shrink* = 4'i16 + bm_TGtkPaned_child2_resize* = 0x00000020'i16 + bp_TGtkPaned_child2_resize* = 5'i16 + bm_TGtkPaned_orientation* = 0x00000040'i16 + bp_TGtkPaned_orientation* = 6'i16 + bm_TGtkPaned_in_recursion* = 0x00000080'i16 + bp_TGtkPaned_in_recursion* = 7'i16 + bm_TGtkPaned_handle_prelit* = 0x00000100'i16 + bp_TGtkPaned_handle_prelit* = 8'i16 proc GTK_TYPE_PANED*(): GType proc GTK_PANED*(obj: pointer): PGtkPaned @@ -6872,8 +6872,8 @@ const GTK_RC_BG* = 1 shl 1 GTK_RC_TEXT* = 1 shl 2 GTK_RC_BASE* = 1 shl 3 - bm_TGtkRcStyle_engine_specified* = 0x00000001 - bp_TGtkRcStyle_engine_specified* = 0 + bm_TGtkRcStyle_engine_specified* = 0x00000001'i16 + bp_TGtkRcStyle_engine_specified* = 0'i16 proc GTK_TYPE_RC_STYLE*(): GType proc GTK_RC_STYLE_get*(anObject: pointer): PGtkRcStyle @@ -7101,26 +7101,26 @@ proc gtk_draw_insertion_cursor*(widget: PGtkWidget, drawable: PGdkDrawable, draw_arrow: gboolean){.cdecl, dynlib: gtklib, importc: "_gtk_draw_insertion_cursor".} const - bm_TGtkRange_inverted* = 0x00000001 - bp_TGtkRange_inverted* = 0 - bm_TGtkRange_flippable* = 0x00000002 - bp_TGtkRange_flippable* = 1 - bm_TGtkRange_has_stepper_a* = 0x00000004 - bp_TGtkRange_has_stepper_a* = 2 - bm_TGtkRange_has_stepper_b* = 0x00000008 - bp_TGtkRange_has_stepper_b* = 3 - bm_TGtkRange_has_stepper_c* = 0x00000010 - bp_TGtkRange_has_stepper_c* = 4 - bm_TGtkRange_has_stepper_d* = 0x00000020 - bp_TGtkRange_has_stepper_d* = 5 - bm_TGtkRange_need_recalc* = 0x00000040 - bp_TGtkRange_need_recalc* = 6 - bm_TGtkRange_slider_size_fixed* = 0x00000080 - bp_TGtkRange_slider_size_fixed* = 7 - bm_TGtkRange_trough_click_forward* = 0x00000001 - bp_TGtkRange_trough_click_forward* = 0 - bm_TGtkRange_update_pending* = 0x00000002 - bp_TGtkRange_update_pending* = 1 + bm_TGtkRange_inverted* = 0x00000001'i16 + bp_TGtkRange_inverted* = 0'i16 + bm_TGtkRange_flippable* = 0x00000002'i16 + bp_TGtkRange_flippable* = 1'i16 + bm_TGtkRange_has_stepper_a* = 0x00000004'i16 + bp_TGtkRange_has_stepper_a* = 2'i16 + bm_TGtkRange_has_stepper_b* = 0x00000008'i16 + bp_TGtkRange_has_stepper_b* = 3'i16 + bm_TGtkRange_has_stepper_c* = 0x00000010'i16 + bp_TGtkRange_has_stepper_c* = 4'i16 + bm_TGtkRange_has_stepper_d* = 0x00000020'i16 + bp_TGtkRange_has_stepper_d* = 5'i16 + bm_TGtkRange_need_recalc* = 0x00000040'i16 + bp_TGtkRange_need_recalc* = 6'i16 + bm_TGtkRange_slider_size_fixed* = 0x00000080'i16 + bp_TGtkRange_slider_size_fixed* = 7'i16 + bm_TGtkRange_trough_click_forward* = 0x00000001'i16 + bp_TGtkRange_trough_click_forward* = 0'i16 + bm_TGtkRange_update_pending* = 0x00000002'i16 + bp_TGtkRange_update_pending* = 1'i16 proc GTK_TYPE_RANGE*(): GType proc GTK_RANGE*(obj: pointer): PGtkRange @@ -7171,10 +7171,10 @@ proc gtk_range_set_value*(range: PGtkRange, value: gdouble){.cdecl, proc gtk_range_get_value*(range: PGtkRange): gdouble{.cdecl, dynlib: gtklib, importc: "gtk_range_get_value".} const - bm_TGtkScale_draw_value* = 0x00000001 - bp_TGtkScale_draw_value* = 0 - bm_TGtkScale_value_pos* = 0x00000006 - bp_TGtkScale_value_pos* = 1 + bm_TGtkScale_draw_value* = 0x00000001'i16 + bp_TGtkScale_draw_value* = 0'i16 + bm_TGtkScale_value_pos* = 0x00000006'i16 + bp_TGtkScale_value_pos* = 1'i16 proc GTK_TYPE_SCALE*(): GType proc GTK_SCALE*(obj: pointer): PGtkScale @@ -7430,8 +7430,8 @@ proc gtk_image_menu_item_set_image*(image_menu_item: PGtkImageMenuItem, proc gtk_image_menu_item_get_image*(image_menu_item: PGtkImageMenuItem): PGtkWidget{. cdecl, dynlib: gtklib, importc: "gtk_image_menu_item_get_image".} const - bm_TGtkIMContextSimple_in_hex_sequence* = 0x00000001 - bp_TGtkIMContextSimple_in_hex_sequence* = 0 + bm_TGtkIMContextSimple_in_hex_sequence* = 0x00000001'i16 + bp_TGtkIMContextSimple_in_hex_sequence* = 0'i16 proc GTK_TYPE_IM_CONTEXT_SIMPLE*(): GType proc GTK_IM_CONTEXT_SIMPLE*(obj: pointer): PGtkIMContextSimple @@ -7581,12 +7581,12 @@ proc gtk_layout_set_hadjustment*(layout: PGtkLayout, adjustment: PGtkAdjustment) proc gtk_layout_set_vadjustment*(layout: PGtkLayout, adjustment: PGtkAdjustment){. cdecl, dynlib: gtklib, importc: "gtk_layout_set_vadjustment".} const - bm_TGtkList_selection_mode* = 0x00000003 - bp_TGtkList_selection_mode* = 0 - bm_TGtkList_drag_selection* = 0x00000004 - bp_TGtkList_drag_selection* = 2 - bm_TGtkList_add_mode* = 0x00000008 - bp_TGtkList_add_mode* = 3 + bm_TGtkList_selection_mode* = 0x00000003'i16 + bp_TGtkList_selection_mode* = 0'i16 + bm_TGtkList_drag_selection* = 0x00000004'i16 + bp_TGtkList_drag_selection* = 2'i16 + bm_TGtkList_add_mode* = 0x00000008'i16 + bp_TGtkList_add_mode* = 3'i16 proc GTK_TYPE_LIST*(): GType proc GTK_LIST*(obj: pointer): PGtkList @@ -7850,8 +7850,8 @@ proc gtk_tree_model_sort_reset_default_sort_func*( proc gtk_tree_model_sort_clear_cache*(tree_model_sort: PGtkTreeModelSort){. cdecl, dynlib: gtklib, importc: "gtk_tree_model_sort_clear_cache".} const - bm_TGtkListStore_columns_dirty* = 0x00000001 - bp_TGtkListStore_columns_dirty* = 0 + bm_TGtkListStore_columns_dirty* = 0x00000001'i16 + bp_TGtkListStore_columns_dirty* = 0'i16 proc GTK_TYPE_LIST_STORE*(): GType proc GTK_LIST_STORE*(obj: pointer): PGtkListStore @@ -8007,30 +8007,30 @@ proc GTK_MESSAGE_DIALOG_GET_CLASS*(obj: pointer): PGtkMessageDialogClass proc gtk_message_dialog_get_type*(): TGtkType{.cdecl, dynlib: gtklib, importc: "gtk_message_dialog_get_type".} const - bm_TGtkNotebook_show_tabs* = 0x00000001 - bp_TGtkNotebook_show_tabs* = 0 - bm_TGtkNotebook_homogeneous* = 0x00000002 - bp_TGtkNotebook_homogeneous* = 1 - bm_TGtkNotebook_show_border* = 0x00000004 - bp_TGtkNotebook_show_border* = 2 - bm_TGtkNotebook_tab_pos* = 0x00000018 - bp_TGtkNotebook_tab_pos* = 3 - bm_TGtkNotebook_scrollable* = 0x00000020 - bp_TGtkNotebook_scrollable* = 5 - bm_TGtkNotebook_in_child* = 0x000000C0 - bp_TGtkNotebook_in_child* = 6 - bm_TGtkNotebook_click_child* = 0x00000300 - bp_TGtkNotebook_click_child* = 8 - bm_TGtkNotebook_button* = 0x00000C00 - bp_TGtkNotebook_button* = 10 - bm_TGtkNotebook_need_timer* = 0x00001000 - bp_TGtkNotebook_need_timer* = 12 - bm_TGtkNotebook_child_has_focus* = 0x00002000 - bp_TGtkNotebook_child_has_focus* = 13 - bm_TGtkNotebook_have_visible_child* = 0x00004000 - bp_TGtkNotebook_have_visible_child* = 14 - bm_TGtkNotebook_focus_out* = 0x00008000 - bp_TGtkNotebook_focus_out* = 15 + bm_TGtkNotebook_show_tabs* = 0x00000001'i16 + bp_TGtkNotebook_show_tabs* = 0'i16 + bm_TGtkNotebook_homogeneous* = 0x00000002'i16 + bp_TGtkNotebook_homogeneous* = 1'i16 + bm_TGtkNotebook_show_border* = 0x00000004'i16 + bp_TGtkNotebook_show_border* = 2'i16 + bm_TGtkNotebook_tab_pos* = 0x00000018'i16 + bp_TGtkNotebook_tab_pos* = 3'i16 + bm_TGtkNotebook_scrollable* = 0x00000020'i16 + bp_TGtkNotebook_scrollable* = 5'i16 + bm_TGtkNotebook_in_child* = 0x000000C0'i16 + bp_TGtkNotebook_in_child* = 6'i16 + bm_TGtkNotebook_click_child* = 0x00000300'i16 + bp_TGtkNotebook_click_child* = 8'i16 + bm_TGtkNotebook_button* = 0x00000C00'i16 + bp_TGtkNotebook_button* = 10'i16 + bm_TGtkNotebook_need_timer* = 0x00001000'i16 + bp_TGtkNotebook_need_timer* = 12'i16 + bm_TGtkNotebook_child_has_focus* = 0x00002000'i16 + bp_TGtkNotebook_child_has_focus* = 13'i16 + bm_TGtkNotebook_have_visible_child* = 0x00004000'i16 + bp_TGtkNotebook_have_visible_child* = 14'i16 + bm_TGtkNotebook_focus_out* = 0x00008000'i16 + bp_TGtkNotebook_focus_out* = 15'i16 proc GTK_TYPE_NOTEBOOK*(): GType proc GTK_NOTEBOOK*(obj: pointer): PGtkNotebook @@ -8152,12 +8152,12 @@ proc gtk_notebook_reorder_child*(notebook: PGtkNotebook, child: PGtkWidget, position: gint){.cdecl, dynlib: gtklib, importc: "gtk_notebook_reorder_child".} const - bm_TGtkOldEditable_has_selection* = 0x00000001 - bp_TGtkOldEditable_has_selection* = 0 - bm_TGtkOldEditable_editable* = 0x00000002 - bp_TGtkOldEditable_editable* = 1 - bm_TGtkOldEditable_visible* = 0x00000004 - bp_TGtkOldEditable_visible* = 2 + bm_TGtkOldEditable_has_selection* = 0x00000001'i16 + bp_TGtkOldEditable_has_selection* = 0'i16 + bm_TGtkOldEditable_editable* = 0x00000002'i16 + bp_TGtkOldEditable_editable* = 1'i16 + bm_TGtkOldEditable_visible* = 0x00000004'i16 + bp_TGtkOldEditable_visible* = 2'i16 proc GTK_TYPE_OLD_EDITABLE*(): GType proc GTK_OLD_EDITABLE*(obj: pointer): PGtkOldEditable @@ -8199,8 +8199,8 @@ proc gtk_option_menu_get_history*(option_menu: PGtkOptionMenu): gint{.cdecl, proc gtk_option_menu_set_history*(option_menu: PGtkOptionMenu, index: guint){. cdecl, dynlib: gtklib, importc: "gtk_option_menu_set_history".} const - bm_TGtkPixmap_build_insensitive* = 0x00000001 - bp_TGtkPixmap_build_insensitive* = 0 + bm_TGtkPixmap_build_insensitive* = 0x00000001'i16 + bp_TGtkPixmap_build_insensitive* = 0'i16 proc GTK_TYPE_PIXMAP*(): GType proc GTK_PIXMAP*(obj: pointer): PGtkPixmap @@ -8222,8 +8222,8 @@ proc gtk_pixmap_get*(pixmap: PGtkPixmap, val: var PGdkPixmap, proc gtk_pixmap_set_build_insensitive*(pixmap: PGtkPixmap, build: gboolean){. cdecl, dynlib: gtklib, importc: "gtk_pixmap_set_build_insensitive".} const - bm_TGtkPlug_same_app* = 0x00000001 - bp_TGtkPlug_same_app* = 0 + bm_TGtkPlug_same_app* = 0x00000001'i16 + bp_TGtkPlug_same_app* = 0'i16 proc GTK_TYPE_PLUG*(): GType proc GTK_PLUG*(obj: pointer): PGtkPlug @@ -8247,10 +8247,10 @@ proc gtk_plug_add_to_socket*(plug: PGtkPlug, socket: PGtkSocket){.cdecl, proc gtk_plug_remove_from_socket*(plug: PGtkPlug, socket: PGtkSocket){.cdecl, dynlib: gtklib, importc: "_gtk_plug_remove_from_socket".} const - bm_TGtkPreview_type* = 0x00000001 - bp_TGtkPreview_type* = 0 - bm_TGtkPreview_expand* = 0x00000002 - bp_TGtkPreview_expand* = 1 + bm_TGtkPreview_type* = 0x00000001'i16 + bp_TGtkPreview_type* = 0'i16 + bm_TGtkPreview_expand* = 0x00000002'i16 + bp_TGtkPreview_expand* = 1'i16 proc GTK_TYPE_PREVIEW*(): GType proc GTK_PREVIEW*(obj: pointer): PGtkPreview @@ -8293,12 +8293,12 @@ proc gtk_preview_get_info*(): PGtkPreviewInfo{.cdecl, dynlib: gtklib, importc: "gtk_preview_get_info".} proc gtk_preview_reset*(){.cdecl, dynlib: gtklib, importc: "gtk_preview_reset".} const - bm_TGtkProgress_show_text* = 0x00000001 - bp_TGtkProgress_show_text* = 0 - bm_TGtkProgress_activity_mode* = 0x00000002 - bp_TGtkProgress_activity_mode* = 1 - bm_TGtkProgress_use_text_format* = 0x00000004 - bp_TGtkProgress_use_text_format* = 2 + bm_TGtkProgress_show_text* = 0x00000001'i16 + bp_TGtkProgress_show_text* = 0'i16 + bm_TGtkProgress_activity_mode* = 0x00000002'i16 + bp_TGtkProgress_activity_mode* = 1'i16 + bm_TGtkProgress_use_text_format* = 0x00000004'i16 + bp_TGtkProgress_use_text_format* = 2'i16 proc show_text*(a: var TGtkProgress): guint proc set_show_text*(a: var TGtkProgress, `show_text`: guint) @@ -8307,8 +8307,8 @@ proc set_activity_mode*(a: var TGtkProgress, `activity_mode`: guint) proc use_text_format*(a: var TGtkProgress): guint proc set_use_text_format*(a: var TGtkProgress, `use_text_format`: guint) const - bm_TGtkProgressBar_activity_dir* = 0x00000001 - bp_TGtkProgressBar_activity_dir* = 0 + bm_TGtkProgressBar_activity_dir* = 0x00000001'i16 + bp_TGtkProgressBar_activity_dir* = 0'i16 proc GTK_TYPE_PROGRESS_BAR*(): GType proc GTK_PROGRESS_BAR*(obj: pointer): PGtkProgressBar @@ -8385,18 +8385,18 @@ proc gtk_radio_menu_item_set_group*(radio_menu_item: PGtkRadioMenuItem, group: PGSList){.cdecl, dynlib: gtklib, importc: "gtk_radio_menu_item_set_group".} const - bm_TGtkScrolledWindow_hscrollbar_policy* = 0x00000003 - bp_TGtkScrolledWindow_hscrollbar_policy* = 0 - bm_TGtkScrolledWindow_vscrollbar_policy* = 0x0000000C - bp_TGtkScrolledWindow_vscrollbar_policy* = 2 - bm_TGtkScrolledWindow_hscrollbar_visible* = 0x00000010 - bp_TGtkScrolledWindow_hscrollbar_visible* = 4 - bm_TGtkScrolledWindow_vscrollbar_visible* = 0x00000020 - bp_TGtkScrolledWindow_vscrollbar_visible* = 5 - bm_TGtkScrolledWindow_window_placement* = 0x000000C0 - bp_TGtkScrolledWindow_window_placement* = 6 - bm_TGtkScrolledWindow_focus_out* = 0x00000100 - bp_TGtkScrolledWindow_focus_out* = 8 + bm_TGtkScrolledWindow_hscrollbar_policy* = 0x00000003'i16 + bp_TGtkScrolledWindow_hscrollbar_policy* = 0'i16 + bm_TGtkScrolledWindow_vscrollbar_policy* = 0x0000000C'i16 + bp_TGtkScrolledWindow_vscrollbar_policy* = 2'i16 + bm_TGtkScrolledWindow_hscrollbar_visible* = 0x00000010'i16 + bp_TGtkScrolledWindow_hscrollbar_visible* = 4'i16 + bm_TGtkScrolledWindow_vscrollbar_visible* = 0x00000020'i16 + bp_TGtkScrolledWindow_vscrollbar_visible* = 5'i16 + bm_TGtkScrolledWindow_window_placement* = 0x000000C0'i16 + bp_TGtkScrolledWindow_window_placement* = 6'i16 + bm_TGtkScrolledWindow_focus_out* = 0x00000100'i16 + bp_TGtkScrolledWindow_focus_out* = 8'i16 proc GTK_TYPE_SCROLLED_WINDOW*(): GType proc GTK_SCROLLED_WINDOW*(obj: pointer): PGtkScrolledWindow @@ -8528,10 +8528,10 @@ proc gtk_separator_menu_item_get_type*(): GType{.cdecl, dynlib: gtklib, proc gtk_separator_menu_item_new*(): PGtkWidget{.cdecl, dynlib: gtklib, importc: "gtk_separator_menu_item_new".} const - bm_TGtkSizeGroup_have_width* = 0x00000001 - bp_TGtkSizeGroup_have_width* = 0 - bm_TGtkSizeGroup_have_height* = 0x00000002 - bp_TGtkSizeGroup_have_height* = 1 + bm_TGtkSizeGroup_have_width* = 0x00000001'i16 + bp_TGtkSizeGroup_have_width* = 0'i16 + bm_TGtkSizeGroup_have_height* = 0x00000002'i16 + bp_TGtkSizeGroup_have_height* = 1'i16 proc GTK_TYPE_SIZE_GROUP*(): GType proc GTK_SIZE_GROUP*(obj: pointer): PGtkSizeGroup @@ -8562,16 +8562,16 @@ proc gtk_size_group_compute_requisition*(widget: PGtkWidget, proc gtk_size_group_queue_resize*(widget: PGtkWidget){.cdecl, dynlib: gtklib, importc: "_gtk_size_group_queue_resize".} const - bm_TGtkSocket_same_app* = 0x00000001 - bp_TGtkSocket_same_app* = 0 - bm_TGtkSocket_focus_in* = 0x00000002 - bp_TGtkSocket_focus_in* = 1 - bm_TGtkSocket_have_size* = 0x00000004 - bp_TGtkSocket_have_size* = 2 - bm_TGtkSocket_need_map* = 0x00000008 - bp_TGtkSocket_need_map* = 3 - bm_TGtkSocket_is_mapped* = 0x00000010 - bp_TGtkSocket_is_mapped* = 4 + bm_TGtkSocket_same_app* = 0x00000001'i16 + bp_TGtkSocket_same_app* = 0'i16 + bm_TGtkSocket_focus_in* = 0x00000002'i16 + bp_TGtkSocket_focus_in* = 1'i16 + bm_TGtkSocket_have_size* = 0x00000004'i16 + bp_TGtkSocket_have_size* = 2'i16 + bm_TGtkSocket_need_map* = 0x00000008'i16 + bp_TGtkSocket_need_map* = 3'i16 + bm_TGtkSocket_is_mapped* = 0x00000010'i16 + bp_TGtkSocket_is_mapped* = 4'i16 proc GTK_TYPE_SOCKET*(): GType proc GTK_SOCKET*(obj: pointer): PGtkSocket @@ -8599,24 +8599,24 @@ proc gtk_socket_get_id*(socket: PGtkSocket): TGdkNativeWindow{.cdecl, dynlib: gtklib, importc: "gtk_socket_get_id".} const GTK_INPUT_ERROR* = - (1) - bm_TGtkSpinButton_in_child* = 0x00000003 - bp_TGtkSpinButton_in_child* = 0 - bm_TGtkSpinButton_click_child* = 0x0000000C - bp_TGtkSpinButton_click_child* = 2 - bm_TGtkSpinButton_button* = 0x00000030 - bp_TGtkSpinButton_button* = 4 - bm_TGtkSpinButton_need_timer* = 0x00000040 - bp_TGtkSpinButton_need_timer* = 6 - bm_TGtkSpinButton_timer_calls* = 0x00000380 - bp_TGtkSpinButton_timer_calls* = 7 - bm_TGtkSpinButton_digits* = 0x000FFC00 - bp_TGtkSpinButton_digits* = 10 - bm_TGtkSpinButton_numeric* = 0x00100000 - bp_TGtkSpinButton_numeric* = 20 - bm_TGtkSpinButton_wrap* = 0x00200000 - bp_TGtkSpinButton_wrap* = 21 - bm_TGtkSpinButton_snap_to_ticks* = 0x00400000 - bp_TGtkSpinButton_snap_to_ticks* = 22 + bm_TGtkSpinButton_in_child* = 0x00000003'i32 + bp_TGtkSpinButton_in_child* = 0'i32 + bm_TGtkSpinButton_click_child* = 0x0000000C'i32 + bp_TGtkSpinButton_click_child* = 2'i32 + bm_TGtkSpinButton_button* = 0x00000030'i32 + bp_TGtkSpinButton_button* = 4'i32 + bm_TGtkSpinButton_need_timer* = 0x00000040'i32 + bp_TGtkSpinButton_need_timer* = 6'i32 + bm_TGtkSpinButton_timer_calls* = 0x00000380'i32 + bp_TGtkSpinButton_timer_calls* = 7'i32 + bm_TGtkSpinButton_digits* = 0x000FFC00'i32 + bp_TGtkSpinButton_digits* = 10'i32 + bm_TGtkSpinButton_numeric* = 0x00100000'i32 + bp_TGtkSpinButton_numeric* = 20'i32 + bm_TGtkSpinButton_wrap* = 0x00200000'i32 + bp_TGtkSpinButton_wrap* = 21'i32 + bm_TGtkSpinButton_snap_to_ticks* = 0x00400000'i32 + bp_TGtkSpinButton_snap_to_ticks* = 22'i32 proc GTK_TYPE_SPIN_BUTTON*(): GType proc GTK_SPIN_BUTTON*(obj: pointer): PGtkSpinButton @@ -8805,8 +8805,8 @@ proc GTK_IS_STATUSBAR*(obj: pointer): bool proc GTK_IS_STATUSBAR_CLASS*(klass: pointer): bool proc GTK_STATUSBAR_GET_CLASS*(obj: pointer): PGtkStatusbarClass const - bm_TGtkStatusbar_has_resize_grip* = 0x00000001 - bp_TGtkStatusbar_has_resize_grip* = 0 + bm_TGtkStatusbar_has_resize_grip* = 0x00000001'i16 + bp_TGtkStatusbar_has_resize_grip* = 0'i16 proc has_resize_grip*(a: var TGtkStatusbar): guint proc set_has_resize_grip*(a: var TGtkStatusbar, `has_resize_grip`: guint) @@ -8831,30 +8831,30 @@ proc gtk_statusbar_set_has_resize_grip*(statusbar: PGtkStatusbar, proc gtk_statusbar_get_has_resize_grip*(statusbar: PGtkStatusbar): gboolean{. cdecl, dynlib: gtklib, importc: "gtk_statusbar_get_has_resize_grip".} const - bm_TGtkTable_homogeneous* = 0x00000001 - bp_TGtkTable_homogeneous* = 0 - bm_TGtkTableChild_xexpand* = 0x00000001 - bp_TGtkTableChild_xexpand* = 0 - bm_TGtkTableChild_yexpand* = 0x00000002 - bp_TGtkTableChild_yexpand* = 1 - bm_TGtkTableChild_xshrink* = 0x00000004 - bp_TGtkTableChild_xshrink* = 2 - bm_TGtkTableChild_yshrink* = 0x00000008 - bp_TGtkTableChild_yshrink* = 3 - bm_TGtkTableChild_xfill* = 0x00000010 - bp_TGtkTableChild_xfill* = 4 - bm_TGtkTableChild_yfill* = 0x00000020 - bp_TGtkTableChild_yfill* = 5 - bm_TGtkTableRowCol_need_expand* = 0x00000001 - bp_TGtkTableRowCol_need_expand* = 0 - bm_TGtkTableRowCol_need_shrink* = 0x00000002 - bp_TGtkTableRowCol_need_shrink* = 1 - bm_TGtkTableRowCol_expand* = 0x00000004 - bp_TGtkTableRowCol_expand* = 2 - bm_TGtkTableRowCol_shrink* = 0x00000008 - bp_TGtkTableRowCol_shrink* = 3 - bm_TGtkTableRowCol_empty* = 0x00000010 - bp_TGtkTableRowCol_empty* = 4 + bm_TGtkTable_homogeneous* = 0x00000001'i16 + bp_TGtkTable_homogeneous* = 0'i16 + bm_TGtkTableChild_xexpand* = 0x00000001'i16 + bp_TGtkTableChild_xexpand* = 0'i16 + bm_TGtkTableChild_yexpand* = 0x00000002'i16 + bp_TGtkTableChild_yexpand* = 1'i16 + bm_TGtkTableChild_xshrink* = 0x00000004'i16 + bp_TGtkTableChild_xshrink* = 2'i16 + bm_TGtkTableChild_yshrink* = 0x00000008'i16 + bp_TGtkTableChild_yshrink* = 3'i16 + bm_TGtkTableChild_xfill* = 0x00000010'i16 + bp_TGtkTableChild_xfill* = 4'i16 + bm_TGtkTableChild_yfill* = 0x00000020'i16 + bp_TGtkTableChild_yfill* = 5'i16 + bm_TGtkTableRowCol_need_expand* = 0x00000001'i16 + bp_TGtkTableRowCol_need_expand* = 0'i16 + bm_TGtkTableRowCol_need_shrink* = 0x00000002'i16 + bp_TGtkTableRowCol_need_shrink* = 1'i16 + bm_TGtkTableRowCol_expand* = 0x00000004'i16 + bp_TGtkTableRowCol_expand* = 2'i16 + bm_TGtkTableRowCol_shrink* = 0x00000008'i16 + bp_TGtkTableRowCol_shrink* = 3'i16 + bm_TGtkTableRowCol_empty* = 0x00000010'i16 + bp_TGtkTableRowCol_empty* = 4'i16 proc GTK_TYPE_TABLE*(): GType proc GTK_TABLE*(obj: pointer): PGtkTable @@ -8923,8 +8923,8 @@ proc gtk_table_set_homogeneous*(table: PGtkTable, homogeneous: gboolean){.cdecl, proc gtk_table_get_homogeneous*(table: PGtkTable): gboolean{.cdecl, dynlib: gtklib, importc: "gtk_table_get_homogeneous".} const - bm_TGtkTearoffMenuItem_torn_off* = 0x00000001 - bp_TGtkTearoffMenuItem_torn_off* = 0 + bm_TGtkTearoffMenuItem_torn_off* = 0x00000001'i16 + bp_TGtkTearoffMenuItem_torn_off* = 0'i16 proc GTK_TYPE_TEAROFF_MENU_ITEM*(): GType proc GTK_TEAROFF_MENU_ITEM*(obj: pointer): PGtkTearoffMenuItem @@ -8939,12 +8939,12 @@ proc gtk_tearoff_menu_item_get_type*(): TGtkType{.cdecl, dynlib: gtklib, proc gtk_tearoff_menu_item_new*(): PGtkWidget{.cdecl, dynlib: gtklib, importc: "gtk_tearoff_menu_item_new".} const - bm_TGtkText_line_wrap* = 0x00000001 - bp_TGtkText_line_wrap* = 0 - bm_TGtkText_word_wrap* = 0x00000002 - bp_TGtkText_word_wrap* = 1 - bm_TGtkText_use_wchar* = 0x00000004 - bp_TGtkText_use_wchar* = 2 + bm_TGtkText_line_wrap* = 0x00000001'i16 + bp_TGtkText_line_wrap* = 0'i16 + bm_TGtkText_word_wrap* = 0x00000002'i16 + bp_TGtkText_word_wrap* = 1'i16 + bm_TGtkText_use_wchar* = 0x00000004'i16 + bp_TGtkText_use_wchar* = 2'i16 proc GTK_TYPE_TEXT*(): GType proc GTK_TEXT*(obj: pointer): PGtkText @@ -9199,54 +9199,54 @@ proc gtk_text_attributes_ref*(values: PGtkTextAttributes){.cdecl, proc gtk_text_attributes_get_type*(): GType{.cdecl, dynlib: gtklib, importc: "gtk_text_attributes_get_type".} const - bm_TGtkTextTag_bg_color_set* = 0x00000001 - bp_TGtkTextTag_bg_color_set* = 0 - bm_TGtkTextTag_bg_stipple_set* = 0x00000002 - bp_TGtkTextTag_bg_stipple_set* = 1 - bm_TGtkTextTag_fg_color_set* = 0x00000004 - bp_TGtkTextTag_fg_color_set* = 2 - bm_TGtkTextTag_scale_set* = 0x00000008 - bp_TGtkTextTag_scale_set* = 3 - bm_TGtkTextTag_fg_stipple_set* = 0x00000010 - bp_TGtkTextTag_fg_stipple_set* = 4 - bm_TGtkTextTag_justification_set* = 0x00000020 - bp_TGtkTextTag_justification_set* = 5 - bm_TGtkTextTag_left_margin_set* = 0x00000040 - bp_TGtkTextTag_left_margin_set* = 6 - bm_TGtkTextTag_indent_set* = 0x00000080 - bp_TGtkTextTag_indent_set* = 7 - bm_TGtkTextTag_rise_set* = 0x00000100 - bp_TGtkTextTag_rise_set* = 8 - bm_TGtkTextTag_strikethrough_set* = 0x00000200 - bp_TGtkTextTag_strikethrough_set* = 9 - bm_TGtkTextTag_right_margin_set* = 0x00000400 - bp_TGtkTextTag_right_margin_set* = 10 - bm_TGtkTextTag_pixels_above_lines_set* = 0x00000800 - bp_TGtkTextTag_pixels_above_lines_set* = 11 - bm_TGtkTextTag_pixels_below_lines_set* = 0x00001000 - bp_TGtkTextTag_pixels_below_lines_set* = 12 - bm_TGtkTextTag_pixels_inside_wrap_set* = 0x00002000 - bp_TGtkTextTag_pixels_inside_wrap_set* = 13 - bm_TGtkTextTag_tabs_set* = 0x00004000 - bp_TGtkTextTag_tabs_set* = 14 - bm_TGtkTextTag_underline_set* = 0x00008000 - bp_TGtkTextTag_underline_set* = 15 - bm_TGtkTextTag_wrap_mode_set* = 0x00010000 - bp_TGtkTextTag_wrap_mode_set* = 16 - bm_TGtkTextTag_bg_full_height_set* = 0x00020000 - bp_TGtkTextTag_bg_full_height_set* = 17 - bm_TGtkTextTag_invisible_set* = 0x00040000 - bp_TGtkTextTag_invisible_set* = 18 - bm_TGtkTextTag_editable_set* = 0x00080000 - bp_TGtkTextTag_editable_set* = 19 - bm_TGtkTextTag_language_set* = 0x00100000 - bp_TGtkTextTag_language_set* = 20 - bm_TGtkTextTag_pad1* = 0x00200000 - bp_TGtkTextTag_pad1* = 21 - bm_TGtkTextTag_pad2* = 0x00400000 - bp_TGtkTextTag_pad2* = 22 - bm_TGtkTextTag_pad3* = 0x00800000 - bp_TGtkTextTag_pad3* = 23 + bm_TGtkTextTag_bg_color_set* = 0x00000001'i32 + bp_TGtkTextTag_bg_color_set* = 0'i32 + bm_TGtkTextTag_bg_stipple_set* = 0x00000002'i32 + bp_TGtkTextTag_bg_stipple_set* = 1'i32 + bm_TGtkTextTag_fg_color_set* = 0x00000004'i32 + bp_TGtkTextTag_fg_color_set* = 2'i32 + bm_TGtkTextTag_scale_set* = 0x00000008'i32 + bp_TGtkTextTag_scale_set* = 3'i32 + bm_TGtkTextTag_fg_stipple_set* = 0x00000010'i32 + bp_TGtkTextTag_fg_stipple_set* = 4'i32 + bm_TGtkTextTag_justification_set* = 0x00000020'i32 + bp_TGtkTextTag_justification_set* = 5'i32 + bm_TGtkTextTag_left_margin_set* = 0x00000040'i32 + bp_TGtkTextTag_left_margin_set* = 6'i32 + bm_TGtkTextTag_indent_set* = 0x00000080'i32 + bp_TGtkTextTag_indent_set* = 7'i32 + bm_TGtkTextTag_rise_set* = 0x00000100'i32 + bp_TGtkTextTag_rise_set* = 8'i32 + bm_TGtkTextTag_strikethrough_set* = 0x00000200'i32 + bp_TGtkTextTag_strikethrough_set* = 9'i32 + bm_TGtkTextTag_right_margin_set* = 0x00000400'i32 + bp_TGtkTextTag_right_margin_set* = 10'i32 + bm_TGtkTextTag_pixels_above_lines_set* = 0x00000800'i32 + bp_TGtkTextTag_pixels_above_lines_set* = 11'i32 + bm_TGtkTextTag_pixels_below_lines_set* = 0x00001000'i32 + bp_TGtkTextTag_pixels_below_lines_set* = 12'i32 + bm_TGtkTextTag_pixels_inside_wrap_set* = 0x00002000'i32 + bp_TGtkTextTag_pixels_inside_wrap_set* = 13'i32 + bm_TGtkTextTag_tabs_set* = 0x00004000'i32 + bp_TGtkTextTag_tabs_set* = 14'i32 + bm_TGtkTextTag_underline_set* = 0x00008000'i32 + bp_TGtkTextTag_underline_set* = 15'i32 + bm_TGtkTextTag_wrap_mode_set* = 0x00010000'i32 + bp_TGtkTextTag_wrap_mode_set* = 16'i32 + bm_TGtkTextTag_bg_full_height_set* = 0x00020000'i32 + bp_TGtkTextTag_bg_full_height_set* = 17'i32 + bm_TGtkTextTag_invisible_set* = 0x00040000'i32 + bp_TGtkTextTag_invisible_set* = 18'i32 + bm_TGtkTextTag_editable_set* = 0x00080000'i32 + bp_TGtkTextTag_editable_set* = 19'i32 + bm_TGtkTextTag_language_set* = 0x00100000'i32 + bp_TGtkTextTag_language_set* = 20'i32 + bm_TGtkTextTag_pad1* = 0x00200000'i32 + bp_TGtkTextTag_pad1* = 21'i32 + bm_TGtkTextTag_pad2* = 0x00400000'i32 + bp_TGtkTextTag_pad2* = 22'i32 + bm_TGtkTextTag_pad3* = 0x00800000'i32 + bp_TGtkTextTag_pad3* = 23'i32 proc bg_color_set*(a: var TGtkTextTag): guint proc set_bg_color_set*(a: var TGtkTextTag, `bg_color_set`: guint) @@ -9300,24 +9300,24 @@ proc set_pad2*(a: var TGtkTextTag, `pad2`: guint) proc pad3*(a: var TGtkTextTag): guint proc set_pad3*(a: var TGtkTextTag, `pad3`: guint) const - bm_TGtkTextAppearance_underline* = 0x0000000F - bp_TGtkTextAppearance_underline* = 0 - bm_TGtkTextAppearance_strikethrough* = 0x00000010 - bp_TGtkTextAppearance_strikethrough* = 4 - bm_TGtkTextAppearance_draw_bg* = 0x00000020 - bp_TGtkTextAppearance_draw_bg* = 5 - bm_TGtkTextAppearance_inside_selection* = 0x00000040 - bp_TGtkTextAppearance_inside_selection* = 6 - bm_TGtkTextAppearance_is_text* = 0x00000080 - bp_TGtkTextAppearance_is_text* = 7 - bm_TGtkTextAppearance_pad1* = 0x00000100 - bp_TGtkTextAppearance_pad1* = 8 - bm_TGtkTextAppearance_pad2* = 0x00000200 - bp_TGtkTextAppearance_pad2* = 9 - bm_TGtkTextAppearance_pad3* = 0x00000400 - bp_TGtkTextAppearance_pad3* = 10 - bm_TGtkTextAppearance_pad4* = 0x00000800 - bp_TGtkTextAppearance_pad4* = 11 + bm_TGtkTextAppearance_underline* = 0x0000000F'i16 + bp_TGtkTextAppearance_underline* = 0'i16 + bm_TGtkTextAppearance_strikethrough* = 0x00000010'i16 + bp_TGtkTextAppearance_strikethrough* = 4'i16 + bm_TGtkTextAppearance_draw_bg* = 0x00000020'i16 + bp_TGtkTextAppearance_draw_bg* = 5'i16 + bm_TGtkTextAppearance_inside_selection* = 0x00000040'i16 + bp_TGtkTextAppearance_inside_selection* = 6'i16 + bm_TGtkTextAppearance_is_text* = 0x00000080'i16 + bp_TGtkTextAppearance_is_text* = 7'i16 + bm_TGtkTextAppearance_pad1* = 0x00000100'i16 + bp_TGtkTextAppearance_pad1* = 8'i16 + bm_TGtkTextAppearance_pad2* = 0x00000200'i16 + bp_TGtkTextAppearance_pad2* = 9'i16 + bm_TGtkTextAppearance_pad3* = 0x00000400'i16 + bp_TGtkTextAppearance_pad3* = 10'i16 + bm_TGtkTextAppearance_pad4* = 0x00000800'i16 + bp_TGtkTextAppearance_pad4* = 11'i16 proc underline*(a: var TGtkTextAppearance): guint proc set_underline*(a: var TGtkTextAppearance, `underline`: guint) @@ -9338,22 +9338,22 @@ proc set_pad3*(a: var TGtkTextAppearance, `pad3`: guint) proc pad4*(a: var TGtkTextAppearance): guint proc set_pad4*(a: var TGtkTextAppearance, `pad4`: guint) const - bm_TGtkTextAttributes_invisible* = 0x00000001 - bp_TGtkTextAttributes_invisible* = 0 - bm_TGtkTextAttributes_bg_full_height* = 0x00000002 - bp_TGtkTextAttributes_bg_full_height* = 1 - bm_TGtkTextAttributes_editable* = 0x00000004 - bp_TGtkTextAttributes_editable* = 2 - bm_TGtkTextAttributes_realized* = 0x00000008 - bp_TGtkTextAttributes_realized* = 3 - bm_TGtkTextAttributes_pad1* = 0x00000010 - bp_TGtkTextAttributes_pad1* = 4 - bm_TGtkTextAttributes_pad2* = 0x00000020 - bp_TGtkTextAttributes_pad2* = 5 - bm_TGtkTextAttributes_pad3* = 0x00000040 - bp_TGtkTextAttributes_pad3* = 6 - bm_TGtkTextAttributes_pad4* = 0x00000080 - bp_TGtkTextAttributes_pad4* = 7 + bm_TGtkTextAttributes_invisible* = 0x00000001'i16 + bp_TGtkTextAttributes_invisible* = 0'i16 + bm_TGtkTextAttributes_bg_full_height* = 0x00000002'i16 + bp_TGtkTextAttributes_bg_full_height* = 1'i16 + bm_TGtkTextAttributes_editable* = 0x00000004'i16 + bp_TGtkTextAttributes_editable* = 2'i16 + bm_TGtkTextAttributes_realized* = 0x00000008'i16 + bp_TGtkTextAttributes_realized* = 3'i16 + bm_TGtkTextAttributes_pad1* = 0x00000010'i16 + bp_TGtkTextAttributes_pad1* = 4'i16 + bm_TGtkTextAttributes_pad2* = 0x00000020'i16 + bp_TGtkTextAttributes_pad2* = 5'i16 + bm_TGtkTextAttributes_pad3* = 0x00000040'i16 + bp_TGtkTextAttributes_pad3* = 6'i16 + bm_TGtkTextAttributes_pad4* = 0x00000080'i16 + bp_TGtkTextAttributes_pad4* = 7'i16 proc invisible*(a: var TGtkTextAttributes): guint proc set_invisible*(a: var TGtkTextAttributes, `invisible`: guint) @@ -9418,10 +9418,10 @@ proc gtk_text_mark_get_buffer*(mark: PGtkTextMark): PGtkTextBuffer{.cdecl, proc gtk_text_mark_get_left_gravity*(mark: PGtkTextMark): gboolean{.cdecl, dynlib: gtklib, importc: "gtk_text_mark_get_left_gravity".} const - bm_TGtkTextMarkBody_visible* = 0x00000001 - bp_TGtkTextMarkBody_visible* = 0 - bm_TGtkTextMarkBody_not_deleteable* = 0x00000002 - bp_TGtkTextMarkBody_not_deleteable* = 1 + bm_TGtkTextMarkBody_visible* = 0x00000001'i16 + bp_TGtkTextMarkBody_visible* = 0'i16 + bm_TGtkTextMarkBody_not_deleteable* = 0x00000002'i16 + bp_TGtkTextMarkBody_not_deleteable* = 1'i16 proc visible*(a: var TGtkTextMarkBody): guint proc set_visible*(a: var TGtkTextMarkBody, `visible`: guint) @@ -9607,10 +9607,10 @@ proc gtk_text_btree_first_could_contain_tag*(tree: PGtkTextBTree, proc gtk_text_btree_last_could_contain_tag*(tree: PGtkTextBTree, tag: PGtkTextTag): PGtkTextLine{.cdecl, dynlib: gtklib, importc: "_gtk_text_btree_last_could_contain_tag".} const - bm_TGtkTextLineData_width* = 0x00FFFFFF - bp_TGtkTextLineData_width* = 0 - bm_TGtkTextLineData_valid* = 0xFF000000 - bp_TGtkTextLineData_valid* = 24 + bm_TGtkTextLineData_width* = 0x00FFFFFF'i32 + bp_TGtkTextLineData_width* = 0'i32 + bm_TGtkTextLineData_valid* = 0xFF000000'i32 + bp_TGtkTextLineData_valid* = 24'i32 proc width*(a: PGtkTextLineData): gint proc set_width*(a: PGtkTextLineData, NewWidth: gint) @@ -9694,8 +9694,8 @@ proc gtk_text_btree_notify_will_remove_tag*(tree: PGtkTextBTree, tag: PGtkTextTag){.cdecl, dynlib: gtklib, importc: "_gtk_text_btree_notify_will_remove_tag".} const - bm_TGtkTextBuffer_modified* = 0x00000001 - bp_TGtkTextBuffer_modified* = 0 + bm_TGtkTextBuffer_modified* = 0x00000001'i16 + bp_TGtkTextBuffer_modified* = 0'i16 proc GTK_TYPE_TEXT_BUFFER*(): GType proc GTK_TEXT_BUFFER*(obj: pointer): PGtkTextBuffer @@ -9869,20 +9869,20 @@ proc GTK_IS_TEXT_LAYOUT*(obj: pointer): bool proc GTK_IS_TEXT_LAYOUT_CLASS*(klass: pointer): bool proc GTK_TEXT_LAYOUT_GET_CLASS*(obj: pointer): PGtkTextLayoutClass const - bm_TGtkTextLayout_cursor_visible* = 0x00000001 - bp_TGtkTextLayout_cursor_visible* = 0 - bm_TGtkTextLayout_cursor_direction* = 0x00000006 - bp_TGtkTextLayout_cursor_direction* = 1 + bm_TGtkTextLayout_cursor_visible* = 0x00000001'i16 + bp_TGtkTextLayout_cursor_visible* = 0'i16 + bm_TGtkTextLayout_cursor_direction* = 0x00000006'i16 + bp_TGtkTextLayout_cursor_direction* = 1'i16 proc cursor_visible*(a: var TGtkTextLayout): guint proc set_cursor_visible*(a: var TGtkTextLayout, `cursor_visible`: guint) proc cursor_direction*(a: var TGtkTextLayout): gint proc set_cursor_direction*(a: var TGtkTextLayout, `cursor_direction`: gint) const - bm_TGtkTextCursorDisplay_is_strong* = 0x00000001 - bp_TGtkTextCursorDisplay_is_strong* = 0 - bm_TGtkTextCursorDisplay_is_weak* = 0x00000002 - bp_TGtkTextCursorDisplay_is_weak* = 1 + bm_TGtkTextCursorDisplay_is_strong* = 0x00000001'i16 + bp_TGtkTextCursorDisplay_is_strong* = 0'i16 + bm_TGtkTextCursorDisplay_is_weak* = 0x00000002'i16 + bp_TGtkTextCursorDisplay_is_weak* = 1'i16 proc is_strong*(a: var TGtkTextCursorDisplay): guint proc set_is_strong*(a: var TGtkTextCursorDisplay, `is_strong`: guint) @@ -10012,22 +10012,22 @@ proc gtk_text_anchored_child_set_layout*(child: PGtkWidget, proc gtk_text_layout_spew*(layout: PGtkTextLayout){.cdecl, dynlib: gtklib, importc: "gtk_text_layout_spew".} const # GTK_TEXT_VIEW_PRIORITY_VALIDATE* = GDK_PRIORITY_REDRAW + 5 - bm_TGtkTextView_editable* = 0x00000001 - bp_TGtkTextView_editable* = 0 - bm_TGtkTextView_overwrite_mode* = 0x00000002 - bp_TGtkTextView_overwrite_mode* = 1 - bm_TGtkTextView_cursor_visible* = 0x00000004 - bp_TGtkTextView_cursor_visible* = 2 - bm_TGtkTextView_need_im_reset* = 0x00000008 - bp_TGtkTextView_need_im_reset* = 3 - bm_TGtkTextView_just_selected_element* = 0x00000010 - bp_TGtkTextView_just_selected_element* = 4 - bm_TGtkTextView_disable_scroll_on_focus* = 0x00000020 - bp_TGtkTextView_disable_scroll_on_focus* = 5 - bm_TGtkTextView_onscreen_validated* = 0x00000040 - bp_TGtkTextView_onscreen_validated* = 6 - bm_TGtkTextView_mouse_cursor_obscured* = 0x00000080 - bp_TGtkTextView_mouse_cursor_obscured* = 7 + bm_TGtkTextView_editable* = 0x00000001'i16 + bp_TGtkTextView_editable* = 0'i16 + bm_TGtkTextView_overwrite_mode* = 0x00000002'i16 + bp_TGtkTextView_overwrite_mode* = 1'i16 + bm_TGtkTextView_cursor_visible* = 0x00000004'i16 + bp_TGtkTextView_cursor_visible* = 2'i16 + bm_TGtkTextView_need_im_reset* = 0x00000008'i16 + bp_TGtkTextView_need_im_reset* = 3'i16 + bm_TGtkTextView_just_selected_element* = 0x00000010'i16 + bp_TGtkTextView_just_selected_element* = 4'i16 + bm_TGtkTextView_disable_scroll_on_focus* = 0x00000020'i16 + bp_TGtkTextView_disable_scroll_on_focus* = 5'i16 + bm_TGtkTextView_onscreen_validated* = 0x00000040'i16 + bp_TGtkTextView_onscreen_validated* = 6'i16 + bm_TGtkTextView_mouse_cursor_obscured* = 0x00000080'i16 + bp_TGtkTextView_mouse_cursor_obscured* = 7'i16 proc GTK_TYPE_TEXT_VIEW*(): GType proc GTK_TEXT_VIEW*(obj: pointer): PGtkTextView @@ -10193,10 +10193,10 @@ proc gtk_text_view_get_tabs*(text_view: PGtkTextView): PPangoTabArray{.cdecl, proc gtk_text_view_get_default_attributes*(text_view: PGtkTextView): PGtkTextAttributes{. cdecl, dynlib: gtklib, importc: "gtk_text_view_get_default_attributes".} const - bm_TGtkTipsQuery_emit_always* = 0x00000001 - bp_TGtkTipsQuery_emit_always* = 0 - bm_TGtkTipsQuery_in_query* = 0x00000002 - bp_TGtkTipsQuery_in_query* = 1 + bm_TGtkTipsQuery_emit_always* = 0x00000001'i16 + bp_TGtkTipsQuery_emit_always* = 0'i16 + bm_TGtkTipsQuery_in_query* = 0x00000002'i16 + bp_TGtkTipsQuery_in_query* = 1'i16 proc GTK_TYPE_TIPS_QUERY*(): GType proc GTK_TIPS_QUERY*(obj: pointer): PGtkTipsQuery @@ -10222,14 +10222,14 @@ proc gtk_tips_query_set_labels*(tips_query: PGtkTipsQuery, label_inactive: cstring, label_no_tip: cstring){. cdecl, dynlib: gtklib, importc: "gtk_tips_query_set_labels".} const - bm_TGtkTooltips_delay* = 0x3FFFFFFF - bp_TGtkTooltips_delay* = 0 - bm_TGtkTooltips_enabled* = 0x40000000 - bp_TGtkTooltips_enabled* = 30 - bm_TGtkTooltips_have_grab* = 0x80000000 - bp_TGtkTooltips_have_grab* = 31 - bm_TGtkTooltips_use_sticky_delay* = 0x00000001 - bp_TGtkTooltips_use_sticky_delay* = 0 + bm_TGtkTooltips_delay* = 0x3FFFFFFF'i32 + bp_TGtkTooltips_delay* = 0'i32 + bm_TGtkTooltips_enabled* = 0x40000000'i32 + bp_TGtkTooltips_enabled* = 30'i32 + bm_TGtkTooltips_have_grab* = 0x80000000'i32 + bp_TGtkTooltips_have_grab* = 31'i32 + bm_TGtkTooltips_use_sticky_delay* = 0x00000001'i32 + bp_TGtkTooltips_use_sticky_delay* = 0'i32 proc GTK_TYPE_TOOLTIPS*(): GType proc GTK_TOOLTIPS*(obj: pointer): PGtkTooltips @@ -10263,10 +10263,10 @@ proc gtk_tooltips_force_window*(tooltips: PGtkTooltips){.cdecl, dynlib: gtklib, proc gtk_tooltips_toggle_keyboard_mode*(widget: PGtkWidget){.cdecl, dynlib: gtklib, importc: "_gtk_tooltips_toggle_keyboard_mode".} const - bm_TGtkToolbar_style_set* = 0x00000001 - bp_TGtkToolbar_style_set* = 0 - bm_TGtkToolbar_icon_size_set* = 0x00000002 - bp_TGtkToolbar_icon_size_set* = 1 + bm_TGtkToolbar_style_set* = 0x00000001'i16 + bp_TGtkToolbar_style_set* = 0'i16 + bm_TGtkToolbar_icon_size_set* = 0x00000002'i16 + bp_TGtkToolbar_icon_size_set* = 1'i16 proc GTK_TYPE_TOOLBAR*(): GType proc GTK_TOOLBAR*(obj: pointer): PGtkToolbar @@ -10370,12 +10370,12 @@ proc gtk_toolbar_get_icon_size*(toolbar: PGtkToolbar): TGtkIconSize{.cdecl, proc gtk_toolbar_get_tooltips*(toolbar: PGtkToolbar): gboolean{.cdecl, dynlib: gtklib, importc: "gtk_toolbar_get_tooltips".} const - bm_TGtkTree_selection_mode* = 0x00000003 - bp_TGtkTree_selection_mode* = 0 - bm_TGtkTree_view_mode* = 0x00000004 - bp_TGtkTree_view_mode* = 2 - bm_TGtkTree_view_line* = 0x00000008 - bp_TGtkTree_view_line* = 3 + bm_TGtkTree_selection_mode* = 0x00000003'i16 + bp_TGtkTree_selection_mode* = 0'i16 + bm_TGtkTree_view_mode* = 0x00000004'i16 + bp_TGtkTree_view_mode* = 2'i16 + bm_TGtkTree_view_line* = 0x00000008'i16 + bp_TGtkTree_view_line* = 3'i16 proc GTK_TYPE_TREE*(): GType proc GTK_TREE*(obj: pointer): PGtkTree @@ -10452,8 +10452,8 @@ proc gtk_tree_set_row_drag_data*(selection_data: PGtkSelectionData, tree_model: PGtkTreeModel, path: PGtkTreePath): gboolean{. cdecl, dynlib: gtklib, importc: "gtk_tree_set_row_drag_data".} const - bm_TGtkTreeItem_expanded* = 0x00000001 - bp_TGtkTreeItem_expanded* = 0 + bm_TGtkTreeItem_expanded* = 0x00000001'i16 + bp_TGtkTreeItem_expanded* = 0'i16 proc GTK_TYPE_TREE_ITEM*(): GType proc GTK_TREE_ITEM*(obj: pointer): PGtkTreeItem @@ -10535,8 +10535,8 @@ proc gtk_tree_selection_select_range*(selection: PGtkTreeSelection, end_path: PGtkTreePath){.cdecl, dynlib: gtklib, importc: "gtk_tree_selection_select_range".} const - bm_TGtkTreeStore_columns_dirty* = 0x00000001 - bp_TGtkTreeStore_columns_dirty* = 0 + bm_TGtkTreeStore_columns_dirty* = 0x00000001'i16 + bp_TGtkTreeStore_columns_dirty* = 0'i16 proc GTK_TYPE_TREE_STORE*(): GType proc GTK_TREE_STORE*(obj: pointer): PGtkTreeStore @@ -10582,22 +10582,22 @@ proc gtk_tree_store_iter_depth*(tree_store: PGtkTreeStore, iter: PGtkTreeIter): proc gtk_tree_store_clear*(tree_store: PGtkTreeStore){.cdecl, dynlib: gtklib, importc: "gtk_tree_store_clear".} const - bm_TGtkTreeViewColumn_visible* = 0x00000001 - bp_TGtkTreeViewColumn_visible* = 0 - bm_TGtkTreeViewColumn_resizable* = 0x00000002 - bp_TGtkTreeViewColumn_resizable* = 1 - bm_TGtkTreeViewColumn_clickable* = 0x00000004 - bp_TGtkTreeViewColumn_clickable* = 2 - bm_TGtkTreeViewColumn_dirty* = 0x00000008 - bp_TGtkTreeViewColumn_dirty* = 3 - bm_TGtkTreeViewColumn_show_sort_indicator* = 0x00000010 - bp_TGtkTreeViewColumn_show_sort_indicator* = 4 - bm_TGtkTreeViewColumn_maybe_reordered* = 0x00000020 - bp_TGtkTreeViewColumn_maybe_reordered* = 5 - bm_TGtkTreeViewColumn_reorderable* = 0x00000040 - bp_TGtkTreeViewColumn_reorderable* = 6 - bm_TGtkTreeViewColumn_use_resized_width* = 0x00000080 - bp_TGtkTreeViewColumn_use_resized_width* = 7 + bm_TGtkTreeViewColumn_visible* = 0x00000001'i16 + bp_TGtkTreeViewColumn_visible* = 0'i16 + bm_TGtkTreeViewColumn_resizable* = 0x00000002'i16 + bp_TGtkTreeViewColumn_resizable* = 1'i16 + bm_TGtkTreeViewColumn_clickable* = 0x00000004'i16 + bp_TGtkTreeViewColumn_clickable* = 2'i16 + bm_TGtkTreeViewColumn_dirty* = 0x00000008'i16 + bp_TGtkTreeViewColumn_dirty* = 3'i16 + bm_TGtkTreeViewColumn_show_sort_indicator* = 0x00000010'i16 + bp_TGtkTreeViewColumn_show_sort_indicator* = 4'i16 + bm_TGtkTreeViewColumn_maybe_reordered* = 0x00000020'i16 + bp_TGtkTreeViewColumn_maybe_reordered* = 5'i16 + bm_TGtkTreeViewColumn_reorderable* = 0x00000040'i16 + bp_TGtkTreeViewColumn_reorderable* = 6'i16 + bm_TGtkTreeViewColumn_use_resized_width* = 0x00000080'i16 + bp_TGtkTreeViewColumn_use_resized_width* = 7'i16 proc GTK_TYPE_TREE_VIEW_COLUMN*(): GType proc GTK_TREE_VIEW_COLUMN*(obj: pointer): PGtkTreeViewColumn @@ -10760,10 +10760,10 @@ const GTK_RBNODE_COLUMN_INVALID or GTK_RBNODE_DESCENDANTS_INVALID const - bm_TGtkRBNode_flags* = 0x00003FFF - bp_TGtkRBNode_flags* = 0 - bm_TGtkRBNode_parity* = 0x00004000 - bp_TGtkRBNode_parity* = 14 + bm_TGtkRBNode_flags* = 0x00003FFF'i16 + bp_TGtkRBNode_flags* = 0'i16 + bm_TGtkRBNode_parity* = 0x00004000'i16 + bp_TGtkRBNode_parity* = 14'i16 proc flags*(a: PGtkRBNode): guint proc set_flags*(a: PGtkRBNode, `flags`: guint) @@ -10850,24 +10850,24 @@ proc TREE_VIEW_COLUMN_REQUESTED_WIDTH*(column: PGtkTreeViewColumn): int32 proc TREE_VIEW_DRAW_EXPANDERS*(tree_view: PGtkTreeView): bool proc TREE_VIEW_COLUMN_DRAG_DEAD_MULTIPLIER*(tree_view: PGtkTreeView): int32 const - bm_TGtkTreeViewPrivate_scroll_to_use_align* = 0x00000001 - bp_TGtkTreeViewPrivate_scroll_to_use_align* = 0 - bm_TGtkTreeViewPrivate_fixed_height_check* = 0x00000002 - bp_TGtkTreeViewPrivate_fixed_height_check* = 1 - bm_TGtkTreeViewPrivate_reorderable* = 0x00000004 - bp_TGtkTreeViewPrivate_reorderable* = 2 - bm_TGtkTreeViewPrivate_header_has_focus* = 0x00000008 - bp_TGtkTreeViewPrivate_header_has_focus* = 3 - bm_TGtkTreeViewPrivate_drag_column_window_state* = 0x00000070 - bp_TGtkTreeViewPrivate_drag_column_window_state* = 4 - bm_TGtkTreeViewPrivate_has_rules* = 0x00000080 - bp_TGtkTreeViewPrivate_has_rules* = 7 - bm_TGtkTreeViewPrivate_mark_rows_col_dirty* = 0x00000100 - bp_TGtkTreeViewPrivate_mark_rows_col_dirty* = 8 - bm_TGtkTreeViewPrivate_enable_search* = 0x00000200 - bp_TGtkTreeViewPrivate_enable_search* = 9 - bm_TGtkTreeViewPrivate_disable_popdown* = 0x00000400 - bp_TGtkTreeViewPrivate_disable_popdown* = 10 + bm_TGtkTreeViewPrivate_scroll_to_use_align* = 0x00000001'i16 + bp_TGtkTreeViewPrivate_scroll_to_use_align* = 0'i16 + bm_TGtkTreeViewPrivate_fixed_height_check* = 0x00000002'i16 + bp_TGtkTreeViewPrivate_fixed_height_check* = 1'i16 + bm_TGtkTreeViewPrivate_reorderable* = 0x00000004'i16 + bp_TGtkTreeViewPrivate_reorderable* = 2'i16 + bm_TGtkTreeViewPrivate_header_has_focus* = 0x00000008'i16 + bp_TGtkTreeViewPrivate_header_has_focus* = 3'i16 + bm_TGtkTreeViewPrivate_drag_column_window_state* = 0x00000070'i16 + bp_TGtkTreeViewPrivate_drag_column_window_state* = 4'i16 + bm_TGtkTreeViewPrivate_has_rules* = 0x00000080'i16 + bp_TGtkTreeViewPrivate_has_rules* = 7'i16 + bm_TGtkTreeViewPrivate_mark_rows_col_dirty* = 0x00000100'i16 + bp_TGtkTreeViewPrivate_mark_rows_col_dirty* = 8'i16 + bm_TGtkTreeViewPrivate_enable_search* = 0x00000200'i16 + bp_TGtkTreeViewPrivate_enable_search* = 9'i16 + bm_TGtkTreeViewPrivate_disable_popdown* = 0x00000400'i16 + bp_TGtkTreeViewPrivate_disable_popdown* = 10'i16 proc scroll_to_use_align*(a: var TGtkTreeViewPrivate): guint proc set_scroll_to_use_align*(a: var TGtkTreeViewPrivate, @@ -11259,13 +11259,13 @@ proc GTK_OBJECT_FLAGS*(obj: pointer): guint32 = result = (GTK_OBJECT(obj)).flags proc GTK_OBJECT_FLOATING*(obj: pointer): gboolean = - result = ((GTK_OBJECT_FLAGS(obj)) and GTK_FLOATING) != 0 + result = ((GTK_OBJECT_FLAGS(obj)) and cint(GTK_FLOATING)) != 0'i32 proc GTK_OBJECT_SET_FLAGS*(obj: pointer, flag: guint32) = - GTK_OBJECT(obj).flags = GTK_OBJECT(obj).flags or int(flag) + GTK_OBJECT(obj).flags = GTK_OBJECT(obj).flags or flag proc GTK_OBJECT_UNSET_FLAGS*(obj: pointer, flag: guint32) = - GTK_OBJECT(obj) . flags = GTK_OBJECT(obj). flags and not int(flag) + GTK_OBJECT(obj) . flags = GTK_OBJECT(obj). flags and not (flag) proc gtk_object_data_try_key*(`string`: cstring): TGQuark = result = g_quark_try_string(`string`) @@ -11458,61 +11458,61 @@ proc GTK_WIDGET_FLAGS*(wid: pointer): guint32 = result = GTK_OBJECT_FLAGS(wid) proc GTK_WIDGET_TOPLEVEL*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_TOPLEVEL) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_TOPLEVEL)) != 0'i32 proc GTK_WIDGET_NO_WINDOW*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_NO_WINDOW) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_NO_WINDOW)) != 0'i32 proc GTK_WIDGET_REALIZED*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_REALIZED) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_REALIZED)) != 0'i32 proc GTK_WIDGET_MAPPED*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_MAPPED) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_MAPPED)) != 0'i32 proc GTK_WIDGET_VISIBLE*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_VISIBLE) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_VISIBLE)) != 0'i32 proc GTK_WIDGET_DRAWABLE*(wid: pointer): gboolean = result = (GTK_WIDGET_VISIBLE(wid)) and (GTK_WIDGET_MAPPED(wid)) proc GTK_WIDGET_SENSITIVE*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_SENSITIVE) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_SENSITIVE)) != 0'i32 proc GTK_WIDGET_PARENT_SENSITIVE*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_PARENT_SENSITIVE) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_PARENT_SENSITIVE)) != 0'i32 proc GTK_WIDGET_IS_SENSITIVE*(wid: pointer): gboolean = result = (GTK_WIDGET_SENSITIVE(wid)) and (GTK_WIDGET_PARENT_SENSITIVE(wid)) proc GTK_WIDGET_CAN_FOCUS*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_CAN_FOCUS) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_CAN_FOCUS)) != 0'i32 proc GTK_WIDGET_HAS_FOCUS*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_HAS_FOCUS) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_HAS_FOCUS)) != 0'i32 proc GTK_WIDGET_CAN_DEFAULT*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_CAN_DEFAULT) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_CAN_DEFAULT)) != 0'i32 proc GTK_WIDGET_HAS_DEFAULT*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_HAS_DEFAULT) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_HAS_DEFAULT)) != 0'i32 proc GTK_WIDGET_HAS_GRAB*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_HAS_GRAB) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_HAS_GRAB)) != 0'i32 proc GTK_WIDGET_RC_STYLE*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_RC_STYLE) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_RC_STYLE)) != 0'i32 proc GTK_WIDGET_COMPOSITE_CHILD*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_COMPOSITE_CHILD) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_COMPOSITE_CHILD)) != 0'i32 proc GTK_WIDGET_APP_PAINTABLE*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_APP_PAINTABLE) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_APP_PAINTABLE)) != 0'i32 proc GTK_WIDGET_RECEIVES_DEFAULT*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_RECEIVES_DEFAULT) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_RECEIVES_DEFAULT)) != 0'i32 proc GTK_WIDGET_DOUBLE_BUFFERED*(wid: pointer): gboolean = - result = ((GTK_WIDGET_FLAGS(wid)) and GTK_DOUBLE_BUFFERED) != 0 + result = ((GTK_WIDGET_FLAGS(wid)) and cint(GTK_DOUBLE_BUFFERED)) != 0'i32 proc GTK_TYPE_REQUISITION*(): GType = result = gtk_requisition_get_type() @@ -11523,7 +11523,7 @@ proc x_set*(a: var TGtkWidgetAuxInfo): guint = proc set_x_set*(a: var TGtkWidgetAuxInfo, `x_set`: guint) = a.flag0 = a.flag0 or - ((`x_set` shl bp_TGtkWidgetAuxInfo_x_set) and + (int16(`x_set` shl bp_TGtkWidgetAuxInfo_x_set) and bm_TGtkWidgetAuxInfo_x_set) proc y_set*(a: var TGtkWidgetAuxInfo): guint = @@ -11532,7 +11532,7 @@ proc y_set*(a: var TGtkWidgetAuxInfo): guint = proc set_y_set*(a: var TGtkWidgetAuxInfo, `y_set`: guint) = a.flag0 = a.flag0 or - ((`y_set` shl bp_TGtkWidgetAuxInfo_y_set) and + (int16(`y_set` shl bp_TGtkWidgetAuxInfo_y_set) and bm_TGtkWidgetAuxInfo_y_set) proc gtk_widget_set_visual*(widget, visual: pointer) = @@ -11554,11 +11554,11 @@ proc gtk_widget_restore_default_style*(widget: pointer) = gtk_widget_set_style(cast[PGtkWidget](widget), nil) proc GTK_WIDGET_SET_FLAGS*(wid: PGtkWidget, flags: TGtkWidgetFlags): TGtkWidgetFlags = - cast[pGtkObject](wid).flags = cast[pGtkObject](wid).flags or int(flags) + cast[pGtkObject](wid).flags = cast[pGtkObject](wid).flags or (flags) result = cast[pGtkObject](wid).flags proc GTK_WIDGET_UNSET_FLAGS*(wid: PGtkWidget, flags: TGtkWidgetFlags): TGtkWidgetFlags = - cast[pGtkObject](wid).flags = cast[pGtkObject](wid).flags and (not int(flags)) + cast[pGtkObject](wid).flags = cast[pGtkObject](wid).flags and (not (flags)) result = cast[pGtkObject](wid).flags proc GTK_TYPE_MISC*(): GType = @@ -11606,7 +11606,7 @@ proc accel_flags*(a: var TGtkAccelKey): guint = proc set_accel_flags*(a: var TGtkAccelKey, `accel_flags`: guint) = a.flag0 = a.flag0 or - ((`accel_flags` shl bp_TGtkAccelKey_accel_flags) and + (int16(`accel_flags` shl bp_TGtkAccelKey_accel_flags) and bm_TGtkAccelKey_accel_flags) proc gtk_accel_group_ref*(AccelGroup: PGtkAccelGroup) = @@ -11635,7 +11635,7 @@ proc GTK_CONTAINER_GET_CLASS*(obj: pointer): PGtkContainerClass = proc GTK_IS_RESIZE_CONTAINER*(widget: pointer): bool = result = (GTK_IS_CONTAINER(widget)) and - ((resize_mode(cast[PGtkContainer](widget))) != ord(GTK_RESIZE_PARENT)) + ((resize_mode(cast[PGtkContainer](widget))) != cint(GTK_RESIZE_PARENT)) proc border_width*(a: var TGtkContainer): guint = result = (a.GtkContainer_flag0 and bm_TGtkContainer_border_width) shr @@ -11918,13 +11918,13 @@ proc jtype*(a: var TGtkLabel): guint = proc set_jtype*(a: var TGtkLabel, `jtype`: guint) = a.GtkLabelflag0 = a.GtkLabelflag0 or - ((`jtype` shl bp_TGtkLabel_jtype) and bm_TGtkLabel_jtype) + (int16(`jtype` shl bp_TGtkLabel_jtype) and bm_TGtkLabel_jtype) proc wrap*(a: var TGtkLabel): guint = result = (a.GtkLabelflag0 and bm_TGtkLabel_wrap) shr bp_TGtkLabel_wrap proc set_wrap*(a: var TGtkLabel, `wrap`: guint) = - a.GtkLabelflag0 = a.GtkLabelflag0 or ((`wrap` shl bp_TGtkLabel_wrap) and bm_TGtkLabel_wrap) + a.GtkLabelflag0 = a.GtkLabelflag0 or (int16(`wrap` shl bp_TGtkLabel_wrap) and bm_TGtkLabel_wrap) proc use_underline*(a: var TGtkLabel): guint = result = (a.GtkLabelflag0 and bm_TGtkLabel_use_underline) shr @@ -11932,7 +11932,7 @@ proc use_underline*(a: var TGtkLabel): guint = proc set_use_underline*(a: var TGtkLabel, `use_underline`: guint) = a.GtkLabelflag0 = a.GtkLabelflag0 or - ((`use_underline` shl bp_TGtkLabel_use_underline) and + (int16(`use_underline` shl bp_TGtkLabel_use_underline) and bm_TGtkLabel_use_underline) proc use_markup*(a: var TGtkLabel): guint = @@ -11940,7 +11940,7 @@ proc use_markup*(a: var TGtkLabel): guint = proc set_use_markup*(a: var TGtkLabel, `use_markup`: guint) = a.GtkLabelflag0 = a.GtkLabelflag0 or - ((`use_markup` shl bp_TGtkLabel_use_markup) and bm_TGtkLabel_use_markup) + (int16(`use_markup` shl bp_TGtkLabel_use_markup) and bm_TGtkLabel_use_markup) proc GTK_TYPE_ACCEL_LABEL*(): GType = result = gtk_accel_label_get_type() @@ -11966,7 +11966,7 @@ proc latin1_to_char*(a: var TGtkAccelLabelClass): guint = proc set_latin1_to_char*(a: var TGtkAccelLabelClass, `latin1_to_char`: guint) = a.GtkAccelLabelClassflag0 = a.GtkAccelLabelClassflag0 or - ((`latin1_to_char` shl bp_TGtkAccelLabelClass_latin1_to_char) and + (int16(`latin1_to_char` shl bp_TGtkAccelLabelClass_latin1_to_char) and bm_TGtkAccelLabelClass_latin1_to_char) proc gtk_accel_label_accelerator_width*(accel_label: PGtkAccelLabel): guint = @@ -12087,7 +12087,7 @@ proc parsed*(a: var TGtkBindingSet): guint = proc set_parsed*(a: var TGtkBindingSet, `parsed`: guint) = a.flag0 = a.flag0 or - ((`parsed` shl bp_TGtkBindingSet_parsed) and bm_TGtkBindingSet_parsed) + (int16(`parsed` shl bp_TGtkBindingSet_parsed) and bm_TGtkBindingSet_parsed) proc destroyed*(a: var TGtkBindingEntry): guint = result = (a.flag0 and bm_TGtkBindingEntry_destroyed) shr @@ -12095,7 +12095,7 @@ proc destroyed*(a: var TGtkBindingEntry): guint = proc set_destroyed*(a: var TGtkBindingEntry, `destroyed`: guint) = a.flag0 = a.flag0 or - ((`destroyed` shl bp_TGtkBindingEntry_destroyed) and + (int16(`destroyed` shl bp_TGtkBindingEntry_destroyed) and bm_TGtkBindingEntry_destroyed) proc in_emission*(a: var TGtkBindingEntry): guint = @@ -12104,7 +12104,7 @@ proc in_emission*(a: var TGtkBindingEntry): guint = proc set_in_emission*(a: var TGtkBindingEntry, `in_emission`: guint) = a.flag0 = a.flag0 or - ((`in_emission` shl bp_TGtkBindingEntry_in_emission) and + (int16(`in_emission` shl bp_TGtkBindingEntry_in_emission) and bm_TGtkBindingEntry_in_emission) proc gtk_binding_entry_add*(binding_set: PGtkBindingSet, keyval: guint, @@ -12134,28 +12134,28 @@ proc homogeneous*(a: var TGtkBox): guint = proc set_homogeneous*(a: var TGtkBox, `homogeneous`: guint) = a.GtkBoxflag0 = a.GtkBoxflag0 or - ((`homogeneous` shl bp_TGtkBox_homogeneous) and bm_TGtkBox_homogeneous) + (int16(`homogeneous` shl bp_TGtkBox_homogeneous) and bm_TGtkBox_homogeneous) proc expand*(a: var TGtkBoxChild): guint = result = (a.flag0 and bm_TGtkBoxChild_expand) shr bp_TGtkBoxChild_expand proc set_expand*(a: var TGtkBoxChild, `expand`: guint) = a.flag0 = a.flag0 or - ((`expand` shl bp_TGtkBoxChild_expand) and bm_TGtkBoxChild_expand) + (int16(`expand` shl bp_TGtkBoxChild_expand) and bm_TGtkBoxChild_expand) proc fill*(a: var TGtkBoxChild): guint = result = (a.flag0 and bm_TGtkBoxChild_fill) shr bp_TGtkBoxChild_fill proc set_fill*(a: var TGtkBoxChild, `fill`: guint) = a.flag0 = a.flag0 or - ((`fill` shl bp_TGtkBoxChild_fill) and bm_TGtkBoxChild_fill) + (int16(`fill` shl bp_TGtkBoxChild_fill) and bm_TGtkBoxChild_fill) proc pack*(a: var TGtkBoxChild): guint = result = (a.flag0 and bm_TGtkBoxChild_pack) shr bp_TGtkBoxChild_pack proc set_pack*(a: var TGtkBoxChild, `pack`: guint) = a.flag0 = a.flag0 or - ((`pack` shl bp_TGtkBoxChild_pack) and bm_TGtkBoxChild_pack) + (int16(`pack` shl bp_TGtkBoxChild_pack) and bm_TGtkBoxChild_pack) proc is_secondary*(a: var TGtkBoxChild): guint = result = (a.flag0 and bm_TGtkBoxChild_is_secondary) shr @@ -12163,7 +12163,7 @@ proc is_secondary*(a: var TGtkBoxChild): guint = proc set_is_secondary*(a: var TGtkBoxChild, `is_secondary`: guint) = a.flag0 = a.flag0 or - ((`is_secondary` shl bp_TGtkBoxChild_is_secondary) and + (int16(`is_secondary` shl bp_TGtkBoxChild_is_secondary) and bm_TGtkBoxChild_is_secondary) proc GTK_TYPE_BUTTON_BOX*(): GType = @@ -12214,7 +12214,7 @@ proc constructed*(a: var TGtkButton): guint = proc set_constructed*(a: var TGtkButton, `constructed`: guint) = a.GtkButtonflag0 = a.GtkButtonflag0 or - ((`constructed` shl bp_TGtkButton_constructed) and + (int16(`constructed` shl bp_TGtkButton_constructed) and bm_TGtkButton_constructed) proc in_button*(a: var TGtkButton): guint = @@ -12222,7 +12222,7 @@ proc in_button*(a: var TGtkButton): guint = proc set_in_button*(a: var TGtkButton, `in_button`: guint) = a.GtkButtonflag0 = a.GtkButtonflag0 or - ((`in_button` shl bp_TGtkButton_in_button) and bm_TGtkButton_in_button) + (int16(`in_button` shl bp_TGtkButton_in_button) and bm_TGtkButton_in_button) proc button_down*(a: var TGtkButton): guint = result = (a.GtkButtonflag0 and bm_TGtkButton_button_down) shr @@ -12230,7 +12230,7 @@ proc button_down*(a: var TGtkButton): guint = proc set_button_down*(a: var TGtkButton, `button_down`: guint) = a.GtkButtonflag0 = a.GtkButtonflag0 or - ((`button_down` shl bp_TGtkButton_button_down) and + (int16(`button_down` shl bp_TGtkButton_button_down) and bm_TGtkButton_button_down) proc relief*(a: var TGtkButton): guint = @@ -12238,7 +12238,7 @@ proc relief*(a: var TGtkButton): guint = proc set_relief*(a: var TGtkButton, `relief`: guint) = a.GtkButtonflag0 = a.GtkButtonflag0 or - ((`relief` shl bp_TGtkButton_relief) and bm_TGtkButton_relief) + (int16(`relief` shl bp_TGtkButton_relief) and bm_TGtkButton_relief) proc use_underline*(a: var TGtkButton): guint = result = (a.GtkButtonflag0 and bm_TGtkButton_use_underline) shr @@ -12246,7 +12246,7 @@ proc use_underline*(a: var TGtkButton): guint = proc set_use_underline*(a: var TGtkButton, `use_underline`: guint) = a.GtkButtonflag0 = a.GtkButtonflag0 or - ((`use_underline` shl bp_TGtkButton_use_underline) and + (int16(`use_underline` shl bp_TGtkButton_use_underline) and bm_TGtkButton_use_underline) proc use_stock*(a: var TGtkButton): guint = @@ -12254,14 +12254,14 @@ proc use_stock*(a: var TGtkButton): guint = proc set_use_stock*(a: var TGtkButton, `use_stock`: guint) = a.GtkButtonflag0 = a.GtkButtonflag0 or - ((`use_stock` shl bp_TGtkButton_use_stock) and bm_TGtkButton_use_stock) + (int16(`use_stock` shl bp_TGtkButton_use_stock) and bm_TGtkButton_use_stock) proc depressed*(a: var TGtkButton): guint = result = (a.GtkButtonflag0 and bm_TGtkButton_depressed) shr bp_TGtkButton_depressed proc set_depressed*(a: var TGtkButton, `depressed`: guint) = a.GtkButtonflag0 = a.GtkButtonflag0 or - ((`depressed` shl bp_TGtkButton_depressed) and bm_TGtkButton_depressed) + (int16(`depressed` shl bp_TGtkButton_depressed) and bm_TGtkButton_depressed) proc depress_on_activate*(a: var TGtkButton): guint = result = (a.GtkButtonflag0 and bm_TGtkButton_depress_on_activate) shr @@ -12269,7 +12269,7 @@ proc depress_on_activate*(a: var TGtkButton): guint = proc set_depress_on_activate*(a: var TGtkButton, `depress_on_activate`: guint) = a.GtkButtonflag0 = a.GtkButtonflag0 or - ((`depress_on_activate` shl bp_TGtkButton_depress_on_activate) and + (int16(`depress_on_activate` shl bp_TGtkButton_depress_on_activate) and bm_TGtkButton_depress_on_activate) proc GTK_TYPE_CALENDAR*(): GType = @@ -12333,7 +12333,7 @@ proc mode*(a: var TGtkCellRenderer): guint = proc set_mode*(a: var TGtkCellRenderer, `mode`: guint) = a.GtkCellRendererflag0 = a.GtkCellRendererflag0 or - ((`mode` shl bp_TGtkCellRenderer_mode) and bm_TGtkCellRenderer_mode) + (int16(`mode` shl bp_TGtkCellRenderer_mode) and bm_TGtkCellRenderer_mode) proc visible*(a: var TGtkCellRenderer): guint = result = (a.GtkCellRendererflag0 and bm_TGtkCellRenderer_visible) shr @@ -12341,7 +12341,7 @@ proc visible*(a: var TGtkCellRenderer): guint = proc set_visible*(a: var TGtkCellRenderer, `visible`: guint) = a.GtkCellRendererflag0 = a.GtkCellRendererflag0 or - ((`visible` shl bp_TGtkCellRenderer_visible) and + (int16(`visible` shl bp_TGtkCellRenderer_visible) and bm_TGtkCellRenderer_visible) proc is_expander*(a: var TGtkCellRenderer): guint = @@ -12350,7 +12350,7 @@ proc is_expander*(a: var TGtkCellRenderer): guint = proc set_is_expander*(a: var TGtkCellRenderer, `is_expander`: guint) = a.GtkCellRendererflag0 = a.GtkCellRendererflag0 or - ((`is_expander` shl bp_TGtkCellRenderer_is_expander) and + (int16(`is_expander` shl bp_TGtkCellRenderer_is_expander) and bm_TGtkCellRenderer_is_expander) proc is_expanded*(a: var TGtkCellRenderer): guint = @@ -12359,7 +12359,7 @@ proc is_expanded*(a: var TGtkCellRenderer): guint = proc set_is_expanded*(a: var TGtkCellRenderer, `is_expanded`: guint) = a.GtkCellRendererflag0 = a.GtkCellRendererflag0 or - ((`is_expanded` shl bp_TGtkCellRenderer_is_expanded) and + (int16(`is_expanded` shl bp_TGtkCellRenderer_is_expanded) and bm_TGtkCellRenderer_is_expanded) proc cell_background_set*(a: var TGtkCellRenderer): guint = @@ -12369,7 +12369,7 @@ proc cell_background_set*(a: var TGtkCellRenderer): guint = proc set_cell_background_set*(a: var TGtkCellRenderer, `cell_background_set`: guint) = a.GtkCellRendererflag0 = a.GtkCellRendererflag0 or - ((`cell_background_set` shl bp_TGtkCellRenderer_cell_background_set) and + (int16(`cell_background_set` shl bp_TGtkCellRenderer_cell_background_set) and bm_TGtkCellRenderer_cell_background_set) proc GTK_TYPE_CELL_RENDERER_TEXT*(): GType = @@ -12398,7 +12398,7 @@ proc strikethrough*(a: var TGtkCellRendererText): guint = proc set_strikethrough*(a: var TGtkCellRendererText, `strikethrough`: guint) = a.GtkCellRendererTextflag0 = a.GtkCellRendererTextflag0 or - ((`strikethrough` shl bp_TGtkCellRendererText_strikethrough) and + (int16(`strikethrough` shl bp_TGtkCellRendererText_strikethrough) and bm_TGtkCellRendererText_strikethrough) proc editable*(a: var TGtkCellRendererText): guint = @@ -12407,7 +12407,7 @@ proc editable*(a: var TGtkCellRendererText): guint = proc set_editable*(a: var TGtkCellRendererText, `editable`: guint) = a.GtkCellRendererTextflag0 = a.GtkCellRendererTextflag0 or - ((`editable` shl bp_TGtkCellRendererText_editable) and + (int16(`editable` shl bp_TGtkCellRendererText_editable) and bm_TGtkCellRendererText_editable) proc scale_set*(a: var TGtkCellRendererText): guint = @@ -12416,7 +12416,7 @@ proc scale_set*(a: var TGtkCellRendererText): guint = proc set_scale_set*(a: var TGtkCellRendererText, `scale_set`: guint) = a.GtkCellRendererTextflag0 = a.GtkCellRendererTextflag0 or - ((`scale_set` shl bp_TGtkCellRendererText_scale_set) and + (int16(`scale_set` shl bp_TGtkCellRendererText_scale_set) and bm_TGtkCellRendererText_scale_set) proc foreground_set*(a: var TGtkCellRendererText): guint = @@ -12425,7 +12425,7 @@ proc foreground_set*(a: var TGtkCellRendererText): guint = proc set_foreground_set*(a: var TGtkCellRendererText, `foreground_set`: guint) = a.GtkCellRendererTextflag0 = a.GtkCellRendererTextflag0 or - ((`foreground_set` shl bp_TGtkCellRendererText_foreground_set) and + (int16(`foreground_set` shl bp_TGtkCellRendererText_foreground_set) and bm_TGtkCellRendererText_foreground_set) proc background_set*(a: var TGtkCellRendererText): guint = @@ -12434,7 +12434,7 @@ proc background_set*(a: var TGtkCellRendererText): guint = proc set_background_set*(a: var TGtkCellRendererText, `background_set`: guint) = a.GtkCellRendererTextflag0 = a.GtkCellRendererTextflag0 or - ((`background_set` shl bp_TGtkCellRendererText_background_set) and + (int16(`background_set` shl bp_TGtkCellRendererText_background_set) and bm_TGtkCellRendererText_background_set) proc underline_set*(a: var TGtkCellRendererText): guint = @@ -12443,7 +12443,7 @@ proc underline_set*(a: var TGtkCellRendererText): guint = proc set_underline_set*(a: var TGtkCellRendererText, `underline_set`: guint) = a.GtkCellRendererTextflag0 = a.GtkCellRendererTextflag0 or - ((`underline_set` shl bp_TGtkCellRendererText_underline_set) and + (int16(`underline_set` shl bp_TGtkCellRendererText_underline_set) and bm_TGtkCellRendererText_underline_set) proc rise_set*(a: var TGtkCellRendererText): guint = @@ -12452,7 +12452,7 @@ proc rise_set*(a: var TGtkCellRendererText): guint = proc set_rise_set*(a: var TGtkCellRendererText, `rise_set`: guint) = a.GtkCellRendererTextflag0 = a.GtkCellRendererTextflag0 or - ((`rise_set` shl bp_TGtkCellRendererText_rise_set) and + (int16(`rise_set` shl bp_TGtkCellRendererText_rise_set) and bm_TGtkCellRendererText_rise_set) proc strikethrough_set*(a: var TGtkCellRendererText): guint = @@ -12462,7 +12462,7 @@ proc strikethrough_set*(a: var TGtkCellRendererText): guint = proc set_strikethrough_set*(a: var TGtkCellRendererText, `strikethrough_set`: guint) = a.GtkCellRendererTextflag0 = a.GtkCellRendererTextflag0 or - ((`strikethrough_set` shl bp_TGtkCellRendererText_strikethrough_set) and + (int16(`strikethrough_set` shl bp_TGtkCellRendererText_strikethrough_set) and bm_TGtkCellRendererText_strikethrough_set) proc editable_set*(a: var TGtkCellRendererText): guint = @@ -12471,7 +12471,7 @@ proc editable_set*(a: var TGtkCellRendererText): guint = proc set_editable_set*(a: var TGtkCellRendererText, `editable_set`: guint) = a.GtkCellRendererTextflag0 = a.GtkCellRendererTextflag0 or - ((`editable_set` shl bp_TGtkCellRendererText_editable_set) and + (int16(`editable_set` shl bp_TGtkCellRendererText_editable_set) and bm_TGtkCellRendererText_editable_set) proc calc_fixed_height*(a: var TGtkCellRendererText): guint = @@ -12481,7 +12481,7 @@ proc calc_fixed_height*(a: var TGtkCellRendererText): guint = proc set_calc_fixed_height*(a: var TGtkCellRendererText, `calc_fixed_height`: guint) = a.GtkCellRendererTextflag0 = a.GtkCellRendererTextflag0 or - ((`calc_fixed_height` shl bp_TGtkCellRendererText_calc_fixed_height) and + (int16(`calc_fixed_height` shl bp_TGtkCellRendererText_calc_fixed_height) and bm_TGtkCellRendererText_calc_fixed_height) proc GTK_TYPE_CELL_RENDERER_TOGGLE*(): GType = @@ -12511,7 +12511,7 @@ proc active*(a: var TGtkCellRendererToggle): guint = proc set_active*(a: var TGtkCellRendererToggle, `active`: guint) = a.GtkCellRendererToggleflag0 = a.GtkCellRendererToggleflag0 or - ((`active` shl bp_TGtkCellRendererToggle_active) and + (int16(`active` shl bp_TGtkCellRendererToggle_active) and bm_TGtkCellRendererToggle_active) proc activatable*(a: var TGtkCellRendererToggle): guint = @@ -12520,7 +12520,7 @@ proc activatable*(a: var TGtkCellRendererToggle): guint = proc set_activatable*(a: var TGtkCellRendererToggle, `activatable`: guint) = a.GtkCellRendererToggleflag0 = a.GtkCellRendererToggleflag0 or - ((`activatable` shl bp_TGtkCellRendererToggle_activatable) and + (int16(`activatable` shl bp_TGtkCellRendererToggle_activatable) and bm_TGtkCellRendererToggle_activatable) proc radio*(a: var TGtkCellRendererToggle): guint = @@ -12529,7 +12529,7 @@ proc radio*(a: var TGtkCellRendererToggle): guint = proc set_radio*(a: var TGtkCellRendererToggle, `radio`: guint) = a.GtkCellRendererToggleflag0 = a.GtkCellRendererToggleflag0 or - ((`radio` shl bp_TGtkCellRendererToggle_radio) and + (int16(`radio` shl bp_TGtkCellRendererToggle_radio) and bm_TGtkCellRendererToggle_radio) proc GTK_TYPE_CELL_RENDERER_PIXBUF*(): GType = @@ -12596,7 +12596,7 @@ proc show_submenu_indicator*(a: var TGtkMenuItem): guint = proc set_show_submenu_indicator*(a: var TGtkMenuItem, `show_submenu_indicator`: guint) = a.GtkMenuItemflag0 = a.GtkMenuItemflag0 or - ((`show_submenu_indicator` shl bp_TGtkMenuItem_show_submenu_indicator) and + (int16(`show_submenu_indicator` shl bp_TGtkMenuItem_show_submenu_indicator) and bm_TGtkMenuItem_show_submenu_indicator) proc submenu_placement*(a: var TGtkMenuItem): guint = @@ -12605,7 +12605,7 @@ proc submenu_placement*(a: var TGtkMenuItem): guint = proc set_submenu_placement*(a: var TGtkMenuItem, `submenu_placement`: guint) = a.GtkMenuItemflag0 = a.GtkMenuItemflag0 or - ((`submenu_placement` shl bp_TGtkMenuItem_submenu_placement) and + (int16(`submenu_placement` shl bp_TGtkMenuItem_submenu_placement) and bm_TGtkMenuItem_submenu_placement) proc submenu_direction*(a: var TGtkMenuItem): guint = @@ -12614,7 +12614,7 @@ proc submenu_direction*(a: var TGtkMenuItem): guint = proc set_submenu_direction*(a: var TGtkMenuItem, `submenu_direction`: guint) = a.GtkMenuItemflag0 = a.GtkMenuItemflag0 or - ((`submenu_direction` shl bp_TGtkMenuItem_submenu_direction) and + (int16(`submenu_direction` shl bp_TGtkMenuItem_submenu_direction) and bm_TGtkMenuItem_submenu_direction) proc right_justify*(a: var TGtkMenuItem): guint = @@ -12623,7 +12623,7 @@ proc right_justify*(a: var TGtkMenuItem): guint = proc set_right_justify*(a: var TGtkMenuItem, `right_justify`: guint) = a.GtkMenuItemflag0 = a.GtkMenuItemflag0 or - ((`right_justify` shl bp_TGtkMenuItem_right_justify) and + (int16(`right_justify` shl bp_TGtkMenuItem_right_justify) and bm_TGtkMenuItem_right_justify) proc timer_from_keypress*(a: var TGtkMenuItem): guint = @@ -12632,7 +12632,7 @@ proc timer_from_keypress*(a: var TGtkMenuItem): guint = proc set_timer_from_keypress*(a: var TGtkMenuItem, `timer_from_keypress`: guint) = a.GtkMenuItemflag0 = a.GtkMenuItemflag0 or - ((`timer_from_keypress` shl bp_TGtkMenuItem_timer_from_keypress) and + (int16(`timer_from_keypress` shl bp_TGtkMenuItem_timer_from_keypress) and bm_TGtkMenuItem_timer_from_keypress) proc hide_on_activate*(a: var TGtkMenuItemClass): guint = @@ -12641,7 +12641,7 @@ proc hide_on_activate*(a: var TGtkMenuItemClass): guint = proc set_hide_on_activate*(a: var TGtkMenuItemClass, `hide_on_activate`: guint) = a.GtkMenuItemClassflag0 = a.GtkMenuItemClassflag0 or - ((`hide_on_activate` shl bp_TGtkMenuItemClass_hide_on_activate) and + (int16(`hide_on_activate` shl bp_TGtkMenuItemClass_hide_on_activate) and bm_TGtkMenuItemClass_hide_on_activate) proc gtk_menu_item_right_justify*(menu_item: PGtkMenuItem) = @@ -12672,7 +12672,7 @@ proc active*(a: var TGtkToggleButton): guint = proc set_active*(a: var TGtkToggleButton, `active`: guint) = a.GtkToggleButtonflag0 = a.GtkToggleButtonflag0 or - ((`active` shl bp_TGtkToggleButton_active) and + (int16(`active` shl bp_TGtkToggleButton_active) and bm_TGtkToggleButton_active) proc draw_indicator*(a: var TGtkToggleButton): guint = @@ -12681,7 +12681,7 @@ proc draw_indicator*(a: var TGtkToggleButton): guint = proc set_draw_indicator*(a: var TGtkToggleButton, `draw_indicator`: guint) = a.GtkToggleButtonflag0 = a.GtkToggleButtonflag0 or - ((`draw_indicator` shl bp_TGtkToggleButton_draw_indicator) and + (int16(`draw_indicator` shl bp_TGtkToggleButton_draw_indicator) and bm_TGtkToggleButton_draw_indicator) proc inconsistent*(a: var TGtkToggleButton): guint = @@ -12690,7 +12690,7 @@ proc inconsistent*(a: var TGtkToggleButton): guint = proc set_inconsistent*(a: var TGtkToggleButton, `inconsistent`: guint) = a.GtkToggleButtonflag0 = a.GtkToggleButtonflag0 or - ((`inconsistent` shl bp_TGtkToggleButton_inconsistent) and + (int16(`inconsistent` shl bp_TGtkToggleButton_inconsistent) and bm_TGtkToggleButton_inconsistent) proc GTK_TYPE_CHECK_BUTTON*(): GType = @@ -12738,7 +12738,7 @@ proc active*(a: var TGtkCheckMenuItem): guint = proc set_active*(a: var TGtkCheckMenuItem, `active`: guint) = a.GtkCheckMenuItemflag0 = a.GtkCheckMenuItemflag0 or - ((`active` shl bp_TGtkCheckMenuItem_active) and + (int16(`active` shl bp_TGtkCheckMenuItem_active) and bm_TGtkCheckMenuItem_active) proc always_show_toggle*(a: var TGtkCheckMenuItem): guint = @@ -12748,7 +12748,7 @@ proc always_show_toggle*(a: var TGtkCheckMenuItem): guint = proc set_always_show_toggle*(a: var TGtkCheckMenuItem, `always_show_toggle`: guint) = a.GtkCheckMenuItemflag0 = a.GtkCheckMenuItemflag0 or - ((`always_show_toggle` shl bp_TGtkCheckMenuItem_always_show_toggle) and + (int16(`always_show_toggle` shl bp_TGtkCheckMenuItem_always_show_toggle) and bm_TGtkCheckMenuItem_always_show_toggle) proc inconsistent*(a: var TGtkCheckMenuItem): guint = @@ -12757,7 +12757,7 @@ proc inconsistent*(a: var TGtkCheckMenuItem): guint = proc set_inconsistent*(a: var TGtkCheckMenuItem, `inconsistent`: guint) = a.GtkCheckMenuItemflag0 = a.GtkCheckMenuItemflag0 or - ((`inconsistent` shl bp_TGtkCheckMenuItem_inconsistent) and + (int16(`inconsistent` shl bp_TGtkCheckMenuItem_inconsistent) and bm_TGtkCheckMenuItem_inconsistent) proc GTK_TYPE_CLIST*(): GType = @@ -12779,43 +12779,43 @@ proc GTK_CLIST_GET_CLASS*(obj: pointer): PGtkCListClass = result = cast[PGtkCListClass](GTK_CHECK_GET_CLASS(obj, GTK_TYPE_CLIST())) proc GTK_CLIST_FLAGS*(clist: pointer): guint16 = - result = GTK_CLIST(clist).flags + result = toU16(GTK_CLIST(clist).flags) proc GTK_CLIST_SET_FLAG*(clist: PGtkCList, flag: guint16) = - clist . flags = GTK_CLIST(clist) . flags or int(flag) + clist.flags = GTK_CLIST(clist).flags or (flag) proc GTK_CLIST_UNSET_FLAG*(clist: PGtkCList, flag: guint16) = - clist . flags = GTK_CLIST(clist) . flags and not int(flag) + clist.flags = GTK_CLIST(clist).flags and not (flag) proc GTK_CLIST_IN_DRAG_get*(clist: pointer): bool = - result = ((GTK_CLIST_FLAGS(clist)) and GTK_CLIST_IN_DRAG) != 0 + result = ((GTK_CLIST_FLAGS(clist)) and cint(GTK_CLIST_IN_DRAG)) != 0'i32 proc GTK_CLIST_ROW_HEIGHT_SET_get*(clist: pointer): bool = - result = ((GTK_CLIST_FLAGS(clist)) and GTK_CLIST_ROW_HEIGHT_SET) != 0 + result = ((GTK_CLIST_FLAGS(clist)) and cint(GTK_CLIST_ROW_HEIGHT_SET)) != 0'i32 proc GTK_CLIST_SHOW_TITLES_get*(clist: pointer): bool = - result = ((GTK_CLIST_FLAGS(clist)) and GTK_CLIST_SHOW_TITLES) != 0 + result = ((GTK_CLIST_FLAGS(clist)) and cint(GTK_CLIST_SHOW_TITLES)) != 0'i32 proc GTK_CLIST_ADD_MODE_get*(clist: pointer): bool = - result = ((GTK_CLIST_FLAGS(clist)) and GTK_CLIST_ADD_MODE) != 0 + result = ((GTK_CLIST_FLAGS(clist)) and cint(GTK_CLIST_ADD_MODE)) != 0'i32 proc GTK_CLIST_AUTO_SORT_get*(clist: pointer): bool = - result = ((GTK_CLIST_FLAGS(clist)) and GTK_CLIST_AUTO_SORT) != 0 + result = ((GTK_CLIST_FLAGS(clist)) and cint(GTK_CLIST_AUTO_SORT)) != 0'i32 proc GTK_CLIST_AUTO_RESIZE_BLOCKED_get*(clist: pointer): bool = - result = ((GTK_CLIST_FLAGS(clist)) and GTK_CLIST_AUTO_RESIZE_BLOCKED) != 0 + result = ((GTK_CLIST_FLAGS(clist)) and cint(GTK_CLIST_AUTO_RESIZE_BLOCKED)) != 0'i32 proc GTK_CLIST_REORDERABLE_get*(clist: pointer): bool = - result = ((GTK_CLIST_FLAGS(clist)) and GTK_CLIST_REORDERABLE) != 0 + result = ((GTK_CLIST_FLAGS(clist)) and cint(GTK_CLIST_REORDERABLE)) != 0'i32 proc GTK_CLIST_USE_DRAG_ICONS_get*(clist: pointer): bool = - result = ((GTK_CLIST_FLAGS(clist)) and GTK_CLIST_USE_DRAG_ICONS) != 0 + result = ((GTK_CLIST_FLAGS(clist)) and cint(GTK_CLIST_USE_DRAG_ICONS)) != 0'i32 proc GTK_CLIST_DRAW_DRAG_LINE_get*(clist: pointer): bool = - result = ((GTK_CLIST_FLAGS(clist)) and GTK_CLIST_DRAW_DRAG_LINE) != 0 + result = ((GTK_CLIST_FLAGS(clist)) and cint(GTK_CLIST_DRAW_DRAG_LINE)) != 0'i32 proc GTK_CLIST_DRAW_DRAG_RECT_get*(clist: pointer): bool = - result = ((GTK_CLIST_FLAGS(clist)) and GTK_CLIST_DRAW_DRAG_RECT) != 0 + result = ((GTK_CLIST_FLAGS(clist)) and cint(GTK_CLIST_DRAW_DRAG_RECT)) != 0'i32 proc GTK_CLIST_ROW_get*(`glist_`: PGList): PGtkCListRow = result = cast[PGtkCListRow](`glist_` . data) @@ -12839,7 +12839,7 @@ proc visible*(a: var TGtkCListColumn): guint = proc set_visible*(a: var TGtkCListColumn, `visible`: guint) = a.flag0 = a.flag0 or - ((`visible` shl bp_TGtkCListColumn_visible) and + (int16(`visible` shl bp_TGtkCListColumn_visible) and bm_TGtkCListColumn_visible) proc width_set*(a: var TGtkCListColumn): guint = @@ -12848,7 +12848,7 @@ proc width_set*(a: var TGtkCListColumn): guint = proc set_width_set*(a: var TGtkCListColumn, `width_set`: guint) = a.flag0 = a.flag0 or - ((`width_set` shl bp_TGtkCListColumn_width_set) and + (int16(`width_set` shl bp_TGtkCListColumn_width_set) and bm_TGtkCListColumn_width_set) proc resizeable*(a: var TGtkCListColumn): guint = @@ -12857,7 +12857,7 @@ proc resizeable*(a: var TGtkCListColumn): guint = proc set_resizeable*(a: var TGtkCListColumn, `resizeable`: guint) = a.flag0 = a.flag0 or - ((`resizeable` shl bp_TGtkCListColumn_resizeable) and + (int16(`resizeable` shl bp_TGtkCListColumn_resizeable) and bm_TGtkCListColumn_resizeable) proc auto_resize*(a: var TGtkCListColumn): guint = @@ -12866,7 +12866,7 @@ proc auto_resize*(a: var TGtkCListColumn): guint = proc set_auto_resize*(a: var TGtkCListColumn, `auto_resize`: guint) = a.flag0 = a.flag0 or - ((`auto_resize` shl bp_TGtkCListColumn_auto_resize) and + (int16(`auto_resize` shl bp_TGtkCListColumn_auto_resize) and bm_TGtkCListColumn_auto_resize) proc button_passive*(a: var TGtkCListColumn): guint = @@ -12875,7 +12875,7 @@ proc button_passive*(a: var TGtkCListColumn): guint = proc set_button_passive*(a: var TGtkCListColumn, `button_passive`: guint) = a.flag0 = a.flag0 or - ((`button_passive` shl bp_TGtkCListColumn_button_passive) and + (int16(`button_passive` shl bp_TGtkCListColumn_button_passive) and bm_TGtkCListColumn_button_passive) proc fg_set*(a: var TGtkCListRow): guint = @@ -12883,14 +12883,14 @@ proc fg_set*(a: var TGtkCListRow): guint = proc set_fg_set*(a: var TGtkCListRow, `fg_set`: guint) = a.flag0 = a.flag0 or - ((`fg_set` shl bp_TGtkCListRow_fg_set) and bm_TGtkCListRow_fg_set) + (int16(`fg_set` shl bp_TGtkCListRow_fg_set) and bm_TGtkCListRow_fg_set) proc bg_set*(a: var TGtkCListRow): guint = result = (a.flag0 and bm_TGtkCListRow_bg_set) shr bp_TGtkCListRow_bg_set proc set_bg_set*(a: var TGtkCListRow, `bg_set`: guint) = a.flag0 = a.flag0 or - ((`bg_set` shl bp_TGtkCListRow_bg_set) and bm_TGtkCListRow_bg_set) + (int16(`bg_set` shl bp_TGtkCListRow_bg_set) and bm_TGtkCListRow_bg_set) proc selectable*(a: var TGtkCListRow): guint = result = (a.flag0 and bm_TGtkCListRow_selectable) shr @@ -12898,7 +12898,7 @@ proc selectable*(a: var TGtkCListRow): guint = proc set_selectable*(a: var TGtkCListRow, `selectable`: guint) = a.flag0 = a.flag0 or - ((`selectable` shl bp_TGtkCListRow_selectable) and + (int16(`selectable` shl bp_TGtkCListRow_selectable) and bm_TGtkCListRow_selectable) proc GTK_TYPE_DIALOG*(): GType = @@ -13020,7 +13020,7 @@ proc value_in_list*(a: var TGtkCombo): guint = proc set_value_in_list*(a: var TGtkCombo, `value_in_list`: guint) = a.GtkComboflag0 = a.GtkComboflag0 or - ((`value_in_list` shl bp_TGtkCombo_value_in_list) and + (int16(`value_in_list` shl bp_TGtkCombo_value_in_list) and bm_TGtkCombo_value_in_list) proc ok_if_empty*(a: var TGtkCombo): guint = @@ -13029,7 +13029,7 @@ proc ok_if_empty*(a: var TGtkCombo): guint = proc set_ok_if_empty*(a: var TGtkCombo, `ok_if_empty`: guint) = a.GtkComboflag0 = a.GtkComboflag0 or - ((`ok_if_empty` shl bp_TGtkCombo_ok_if_empty) and + (int16(`ok_if_empty` shl bp_TGtkCombo_ok_if_empty) and bm_TGtkCombo_ok_if_empty) proc case_sensitive*(a: var TGtkCombo): guint = @@ -13038,7 +13038,7 @@ proc case_sensitive*(a: var TGtkCombo): guint = proc set_case_sensitive*(a: var TGtkCombo, `case_sensitive`: guint) = a.GtkComboflag0 = a.GtkComboflag0 or - ((`case_sensitive` shl bp_TGtkCombo_case_sensitive) and + (int16(`case_sensitive` shl bp_TGtkCombo_case_sensitive) and bm_TGtkCombo_case_sensitive) proc use_arrows*(a: var TGtkCombo): guint = @@ -13046,7 +13046,7 @@ proc use_arrows*(a: var TGtkCombo): guint = proc set_use_arrows*(a: var TGtkCombo, `use_arrows`: guint) = a.GtkComboflag0 = a.GtkComboflag0 or - ((`use_arrows` shl bp_TGtkCombo_use_arrows) and bm_TGtkCombo_use_arrows) + (int16(`use_arrows` shl bp_TGtkCombo_use_arrows) and bm_TGtkCombo_use_arrows) proc use_arrows_always*(a: var TGtkCombo): guint = result = (a.GtkComboflag0 and bm_TGtkCombo_use_arrows_always) shr @@ -13054,7 +13054,7 @@ proc use_arrows_always*(a: var TGtkCombo): guint = proc set_use_arrows_always*(a: var TGtkCombo, `use_arrows_always`: guint) = a.GtkComboflag0 = a.GtkComboflag0 or - ((`use_arrows_always` shl bp_TGtkCombo_use_arrows_always) and + (int16(`use_arrows_always` shl bp_TGtkCombo_use_arrows_always) and bm_TGtkCombo_use_arrows_always) proc GTK_TYPE_CTREE*(): GType = @@ -13098,7 +13098,7 @@ proc line_style*(a: var TGtkCTree): guint = proc set_line_style*(a: var TGtkCTree, `line_style`: guint) = a.GtkCTreeflag0 = a.GtkCTreeflag0 or - ((`line_style` shl bp_TGtkCTree_line_style) and bm_TGtkCTree_line_style) + (int16(`line_style` shl bp_TGtkCTree_line_style) and bm_TGtkCTree_line_style) proc expander_style*(a: var TGtkCTree): guint = result = (a.GtkCTreeflag0 and bm_TGtkCTree_expander_style) shr @@ -13106,7 +13106,7 @@ proc expander_style*(a: var TGtkCTree): guint = proc set_expander_style*(a: var TGtkCTree, `expander_style`: guint) = a.GtkCTreeflag0 = a.GtkCTreeflag0 or - ((`expander_style` shl bp_TGtkCTree_expander_style) and + (int16(`expander_style` shl bp_TGtkCTree_expander_style) and bm_TGtkCTree_expander_style) proc show_stub*(a: var TGtkCTree): guint = @@ -13114,14 +13114,14 @@ proc show_stub*(a: var TGtkCTree): guint = proc set_show_stub*(a: var TGtkCTree, `show_stub`: guint) = a.GtkCTreeflag0 = a.GtkCTreeflag0 or - ((`show_stub` shl bp_TGtkCTree_show_stub) and bm_TGtkCTree_show_stub) + (int16(`show_stub` shl bp_TGtkCTree_show_stub) and bm_TGtkCTree_show_stub) proc is_leaf*(a: var TGtkCTreeRow): guint = result = (a.GtkCTreeRow_flag0 and bm_TGtkCTreeRow_is_leaf) shr bp_TGtkCTreeRow_is_leaf proc set_is_leaf*(a: var TGtkCTreeRow, `is_leaf`: guint) = a.GtkCTreeRow_flag0 = a.GtkCTreeRow_flag0 or - ((`is_leaf` shl bp_TGtkCTreeRow_is_leaf) and bm_TGtkCTreeRow_is_leaf) + (int16(`is_leaf` shl bp_TGtkCTreeRow_is_leaf) and bm_TGtkCTreeRow_is_leaf) proc expanded*(a: var TGtkCTreeRow): guint = result = (a.GtkCTreeRow_flag0 and bm_TGtkCTreeRow_expanded) shr @@ -13129,7 +13129,7 @@ proc expanded*(a: var TGtkCTreeRow): guint = proc set_expanded*(a: var TGtkCTreeRow, `expanded`: guint) = a.GtkCTreeRow_flag0 = a.GtkCTreeRowflag0 or - ((`expanded` shl bp_TGtkCTreeRow_expanded) and bm_TGtkCTreeRow_expanded) + (int16(`expanded` shl bp_TGtkCTreeRow_expanded) and bm_TGtkCTreeRow_expanded) proc gtk_ctree_set_reorderable*(t: pointer, r: bool) = gtk_clist_set_reorderable(cast[PGtkCList](t), r) @@ -13231,7 +13231,7 @@ proc active*(a: var TGtkMenuShell): guint = proc set_active*(a: var TGtkMenuShell, `active`: guint) = a.GtkMenuShellflag0 = a.GtkMenuShellflag0 or - ((`active` shl bp_TGtkMenuShell_active) and bm_TGtkMenuShell_active) + (int16(`active` shl bp_TGtkMenuShell_active) and bm_TGtkMenuShell_active) proc have_grab*(a: var TGtkMenuShell): guint = result = (a.GtkMenuShellflag0 and bm_TGtkMenuShell_have_grab) shr @@ -13239,7 +13239,7 @@ proc have_grab*(a: var TGtkMenuShell): guint = proc set_have_grab*(a: var TGtkMenuShell, `have_grab`: guint) = a.GtkMenuShellflag0 = a.GtkMenuShellflag0 or - ((`have_grab` shl bp_TGtkMenuShell_have_grab) and + (int16(`have_grab` shl bp_TGtkMenuShell_have_grab) and bm_TGtkMenuShell_have_grab) proc have_xgrab*(a: var TGtkMenuShell): guint = @@ -13248,7 +13248,7 @@ proc have_xgrab*(a: var TGtkMenuShell): guint = proc set_have_xgrab*(a: var TGtkMenuShell, `have_xgrab`: guint) = a.GtkMenuShellflag0 = a.GtkMenuShellflag0 or - ((`have_xgrab` shl bp_TGtkMenuShell_have_xgrab) and + (int16(`have_xgrab` shl bp_TGtkMenuShell_have_xgrab) and bm_TGtkMenuShell_have_xgrab) proc ignore_leave*(a: var TGtkMenuShell): guint = @@ -13257,7 +13257,7 @@ proc ignore_leave*(a: var TGtkMenuShell): guint = proc set_ignore_leave*(a: var TGtkMenuShell, `ignore_leave`: guint) = a.GtkMenuShellflag0 = a.GtkMenuShellflag0 or - ((`ignore_leave` shl bp_TGtkMenuShell_ignore_leave) and + (int16(`ignore_leave` shl bp_TGtkMenuShell_ignore_leave) and bm_TGtkMenuShell_ignore_leave) proc menu_flag*(a: var TGtkMenuShell): guint = @@ -13266,7 +13266,7 @@ proc menu_flag*(a: var TGtkMenuShell): guint = proc set_menu_flag*(a: var TGtkMenuShell, `menu_flag`: guint) = a.GtkMenuShellflag0 = a.GtkMenuShellflag0 or - ((`menu_flag` shl bp_TGtkMenuShell_menu_flag) and + (int16(`menu_flag` shl bp_TGtkMenuShell_menu_flag) and bm_TGtkMenuShell_menu_flag) proc ignore_enter*(a: var TGtkMenuShell): guint = @@ -13275,7 +13275,7 @@ proc ignore_enter*(a: var TGtkMenuShell): guint = proc set_ignore_enter*(a: var TGtkMenuShell, `ignore_enter`: guint) = a.GtkMenuShellflag0 = a.GtkMenuShellflag0 or - ((`ignore_enter` shl bp_TGtkMenuShell_ignore_enter) and + (int16(`ignore_enter` shl bp_TGtkMenuShell_ignore_enter) and bm_TGtkMenuShell_ignore_enter) proc submenu_placement*(a: var TGtkMenuShellClass): guint = @@ -13285,7 +13285,7 @@ proc submenu_placement*(a: var TGtkMenuShellClass): guint = proc set_submenu_placement*(a: var TGtkMenuShellClass, `submenu_placement`: guint) = a.GtkMenuShellClassflag0 = a.GtkMenuShellClassflag0 or - ((`submenu_placement` shl bp_TGtkMenuShellClass_submenu_placement) and + (int16(`submenu_placement` shl bp_TGtkMenuShellClass_submenu_placement) and bm_TGtkMenuShellClass_submenu_placement) proc GTK_TYPE_MENU*(): GType = @@ -13313,7 +13313,7 @@ proc needs_destruction_ref_count*(a: var TGtkMenu): guint = proc set_needs_destruction_ref_count*(a: var TGtkMenu, `needs_destruction_ref_count`: guint) = a.GtkMenuflag0 = a.GtkMenuflag0 or - ((`needs_destruction_ref_count` shl + (int16(`needs_destruction_ref_count` shl bp_TGtkMenu_needs_destruction_ref_count) and bm_TGtkMenu_needs_destruction_ref_count) @@ -13322,7 +13322,7 @@ proc torn_off*(a: var TGtkMenu): guint = proc set_torn_off*(a: var TGtkMenu, `torn_off`: guint) = a.GtkMenuflag0 = a.GtkMenuflag0 or - ((`torn_off` shl bp_TGtkMenu_torn_off) and bm_TGtkMenu_torn_off) + (int16(`torn_off` shl bp_TGtkMenu_torn_off) and bm_TGtkMenu_torn_off) proc tearoff_active*(a: var TGtkMenu): guint = result = (a.GtkMenuflag0 and bm_TGtkMenu_tearoff_active) shr @@ -13330,7 +13330,7 @@ proc tearoff_active*(a: var TGtkMenu): guint = proc set_tearoff_active*(a: var TGtkMenu, `tearoff_active`: guint) = a.GtkMenuflag0 = a.GtkMenuflag0 or - ((`tearoff_active` shl bp_TGtkMenu_tearoff_active) and + (int16(`tearoff_active` shl bp_TGtkMenu_tearoff_active) and bm_TGtkMenu_tearoff_active) proc scroll_fast*(a: var TGtkMenu): guint = @@ -13338,7 +13338,7 @@ proc scroll_fast*(a: var TGtkMenu): guint = proc set_scroll_fast*(a: var TGtkMenu, `scroll_fast`: guint) = a.GtkMenuflag0 = a.GtkMenuflag0 or - ((`scroll_fast` shl bp_TGtkMenu_scroll_fast) and + (int16(`scroll_fast` shl bp_TGtkMenu_scroll_fast) and bm_TGtkMenu_scroll_fast) proc upper_arrow_visible*(a: var TGtkMenu): guint = @@ -13347,7 +13347,7 @@ proc upper_arrow_visible*(a: var TGtkMenu): guint = proc set_upper_arrow_visible*(a: var TGtkMenu, `upper_arrow_visible`: guint) = a.GtkMenuflag0 = a.GtkMenuflag0 or - ((`upper_arrow_visible` shl bp_TGtkMenu_upper_arrow_visible) and + (int16(`upper_arrow_visible` shl bp_TGtkMenu_upper_arrow_visible) and bm_TGtkMenu_upper_arrow_visible) proc lower_arrow_visible*(a: var TGtkMenu): guint = @@ -13356,7 +13356,7 @@ proc lower_arrow_visible*(a: var TGtkMenu): guint = proc set_lower_arrow_visible*(a: var TGtkMenu, `lower_arrow_visible`: guint) = a.GtkMenuflag0 = a.GtkMenuflag0 or - ((`lower_arrow_visible` shl bp_TGtkMenu_lower_arrow_visible) and + (int16(`lower_arrow_visible` shl bp_TGtkMenu_lower_arrow_visible) and bm_TGtkMenu_lower_arrow_visible) proc upper_arrow_prelight*(a: var TGtkMenu): guint = @@ -13365,7 +13365,7 @@ proc upper_arrow_prelight*(a: var TGtkMenu): guint = proc set_upper_arrow_prelight*(a: var TGtkMenu, `upper_arrow_prelight`: guint) = a.GtkMenuflag0 = a.GtkMenuflag0 or - ((`upper_arrow_prelight` shl bp_TGtkMenu_upper_arrow_prelight) and + (int16(`upper_arrow_prelight` shl bp_TGtkMenu_upper_arrow_prelight) and bm_TGtkMenu_upper_arrow_prelight) proc lower_arrow_prelight*(a: var TGtkMenu): guint = @@ -13374,7 +13374,7 @@ proc lower_arrow_prelight*(a: var TGtkMenu): guint = proc set_lower_arrow_prelight*(a: var TGtkMenu, `lower_arrow_prelight`: guint) = a.GtkMenuflag0 = a.GtkMenuflag0 or - ((`lower_arrow_prelight` shl bp_TGtkMenu_lower_arrow_prelight) and + (int16(`lower_arrow_prelight` shl bp_TGtkMenu_lower_arrow_prelight) and bm_TGtkMenu_lower_arrow_prelight) proc gtk_menu_append*(menu, child: PGtkWidget) = @@ -13409,14 +13409,14 @@ proc editable*(a: var TGtkEntry): guint = proc set_editable*(a: var TGtkEntry, `editable`: guint) = a.GtkEntryflag0 = a.GtkEntryflag0 or - ((`editable` shl bp_TGtkEntry_editable) and bm_TGtkEntry_editable) + (int16(`editable` shl bp_TGtkEntry_editable) and bm_TGtkEntry_editable) proc visible*(a: var TGtkEntry): guint = result = (a.GtkEntryflag0 and bm_TGtkEntry_visible) shr bp_TGtkEntry_visible proc set_visible*(a: var TGtkEntry, `visible`: guint) = a.GtkEntryflag0 = a.GtkEntryflag0 or - ((`visible` shl bp_TGtkEntry_visible) and bm_TGtkEntry_visible) + (int16(`visible` shl bp_TGtkEntry_visible) and bm_TGtkEntry_visible) proc overwrite_mode*(a: var TGtkEntry): guint = result = (a.GtkEntryflag0 and bm_TGtkEntry_overwrite_mode) shr @@ -13424,7 +13424,7 @@ proc overwrite_mode*(a: var TGtkEntry): guint = proc set_overwrite_mode*(a: var TGtkEntry, `overwrite_mode`: guint) = a.GtkEntryflag0 = a.GtkEntryflag0 or - ((`overwrite_mode` shl bp_TGtkEntry_overwrite_mode) and + (int16(`overwrite_mode` shl bp_TGtkEntry_overwrite_mode) and bm_TGtkEntry_overwrite_mode) proc in_drag*(a: var TGtkEntry): guint = @@ -13432,7 +13432,7 @@ proc in_drag*(a: var TGtkEntry): guint = proc set_in_drag*(a: var TGtkEntry, `in_drag`: guint) = a.GtkEntryflag0 = a.GtkEntryflag0 or - ((`in_drag` shl bp_TGtkEntry_in_drag) and bm_TGtkEntry_in_drag) + (int16(`in_drag` shl bp_TGtkEntry_in_drag) and bm_TGtkEntry_in_drag) proc cache_includes_preedit*(a: var TGtkEntry): guint = result = (a.flag1 and bm_TGtkEntry_cache_includes_preedit) shr @@ -13441,7 +13441,7 @@ proc cache_includes_preedit*(a: var TGtkEntry): guint = proc set_cache_includes_preedit*(a: var TGtkEntry, `cache_includes_preedit`: guint) = a.flag1 = a.flag1 or - ((`cache_includes_preedit` shl bp_TGtkEntry_cache_includes_preedit) and + (int16(`cache_includes_preedit` shl bp_TGtkEntry_cache_includes_preedit) and bm_TGtkEntry_cache_includes_preedit) proc need_im_reset*(a: var TGtkEntry): guint = @@ -13450,7 +13450,7 @@ proc need_im_reset*(a: var TGtkEntry): guint = proc set_need_im_reset*(a: var TGtkEntry, `need_im_reset`: guint) = a.flag1 = a.flag1 or - ((`need_im_reset` shl bp_TGtkEntry_need_im_reset) and + (int16(`need_im_reset` shl bp_TGtkEntry_need_im_reset) and bm_TGtkEntry_need_im_reset) proc has_frame*(a: var TGtkEntry): guint = @@ -13458,7 +13458,7 @@ proc has_frame*(a: var TGtkEntry): guint = proc set_has_frame*(a: var TGtkEntry, `has_frame`: guint) = a.flag1 = a.flag1 or - ((`has_frame` shl bp_TGtkEntry_has_frame) and bm_TGtkEntry_has_frame) + (int16(`has_frame` shl bp_TGtkEntry_has_frame) and bm_TGtkEntry_has_frame) proc activates_default*(a: var TGtkEntry): guint = result = (a.flag1 and bm_TGtkEntry_activates_default) shr @@ -13466,7 +13466,7 @@ proc activates_default*(a: var TGtkEntry): guint = proc set_activates_default*(a: var TGtkEntry, `activates_default`: guint) = a.flag1 = a.flag1 or - ((`activates_default` shl bp_TGtkEntry_activates_default) and + (int16(`activates_default` shl bp_TGtkEntry_activates_default) and bm_TGtkEntry_activates_default) proc cursor_visible*(a: var TGtkEntry): guint = @@ -13475,7 +13475,7 @@ proc cursor_visible*(a: var TGtkEntry): guint = proc set_cursor_visible*(a: var TGtkEntry, `cursor_visible`: guint) = a.flag1 = a.flag1 or - ((`cursor_visible` shl bp_TGtkEntry_cursor_visible) and + (int16(`cursor_visible` shl bp_TGtkEntry_cursor_visible) and bm_TGtkEntry_cursor_visible) proc in_click*(a: var TGtkEntry): guint = @@ -13483,7 +13483,7 @@ proc in_click*(a: var TGtkEntry): guint = proc set_in_click*(a: var TGtkEntry, `in_click`: guint) = a.flag1 = a.flag1 or - ((`in_click` shl bp_TGtkEntry_in_click) and bm_TGtkEntry_in_click) + (int16(`in_click` shl bp_TGtkEntry_in_click) and bm_TGtkEntry_in_click) proc is_cell_renderer*(a: var TGtkEntry): guint = result = (a.flag1 and bm_TGtkEntry_is_cell_renderer) shr @@ -13491,7 +13491,7 @@ proc is_cell_renderer*(a: var TGtkEntry): guint = proc set_is_cell_renderer*(a: var TGtkEntry, `is_cell_renderer`: guint) = a.flag1 = a.flag1 or - ((`is_cell_renderer` shl bp_TGtkEntry_is_cell_renderer) and + (int16(`is_cell_renderer` shl bp_TGtkEntry_is_cell_renderer) and bm_TGtkEntry_is_cell_renderer) proc editing_canceled*(a: var TGtkEntry): guint = @@ -13500,7 +13500,7 @@ proc editing_canceled*(a: var TGtkEntry): guint = proc set_editing_canceled*(a: var TGtkEntry, `editing_canceled`: guint) = a.flag1 = a.flag1 or - ((`editing_canceled` shl bp_TGtkEntry_editing_canceled) and + (int16(`editing_canceled` shl bp_TGtkEntry_editing_canceled) and bm_TGtkEntry_editing_canceled) proc mouse_cursor_obscured*(a: var TGtkEntry): guint = @@ -13509,7 +13509,7 @@ proc mouse_cursor_obscured*(a: var TGtkEntry): guint = proc set_mouse_cursor_obscured*(a: var TGtkEntry, `mouse_cursor_obscured`: guint) = a.flag1 = a.flag1 or - ((`mouse_cursor_obscured` shl bp_TGtkEntry_mouse_cursor_obscured) and + (int16(`mouse_cursor_obscured` shl bp_TGtkEntry_mouse_cursor_obscured) and bm_TGtkEntry_mouse_cursor_obscured) proc GTK_TYPE_EVENT_BOX*(): GType = @@ -13651,7 +13651,7 @@ proc handle_position*(a: var TGtkHandleBox): guint = proc set_handle_position*(a: var TGtkHandleBox, `handle_position`: guint) = a.GtkHandleBoxflag0 = a.GtkHandleBoxflag0 or - ((`handle_position` shl bp_TGtkHandleBox_handle_position) and + (int16(`handle_position` shl bp_TGtkHandleBox_handle_position) and bm_TGtkHandleBox_handle_position) proc float_window_mapped*(a: var TGtkHandleBox): guint = @@ -13660,7 +13660,7 @@ proc float_window_mapped*(a: var TGtkHandleBox): guint = proc set_float_window_mapped*(a: var TGtkHandleBox, `float_window_mapped`: guint) = a.GtkHandleBoxflag0 = a.GtkHandleBoxflag0 or - ((`float_window_mapped` shl bp_TGtkHandleBox_float_window_mapped) and + (int16(`float_window_mapped` shl bp_TGtkHandleBox_float_window_mapped) and bm_TGtkHandleBox_float_window_mapped) proc child_detached*(a: var TGtkHandleBox): guint = @@ -13669,7 +13669,7 @@ proc child_detached*(a: var TGtkHandleBox): guint = proc set_child_detached*(a: var TGtkHandleBox, `child_detached`: guint) = a.GtkHandleBoxflag0 = a.GtkHandleBoxflag0 or - ((`child_detached` shl bp_TGtkHandleBox_child_detached) and + (int16(`child_detached` shl bp_TGtkHandleBox_child_detached) and bm_TGtkHandleBox_child_detached) proc in_drag*(a: var TGtkHandleBox): guint = @@ -13678,7 +13678,7 @@ proc in_drag*(a: var TGtkHandleBox): guint = proc set_in_drag*(a: var TGtkHandleBox, `in_drag`: guint) = a.GtkHandleBoxflag0 = a.GtkHandleBoxflag0 or - ((`in_drag` shl bp_TGtkHandleBox_in_drag) and bm_TGtkHandleBox_in_drag) + (int16(`in_drag` shl bp_TGtkHandleBox_in_drag) and bm_TGtkHandleBox_in_drag) proc shrink_on_detach*(a: var TGtkHandleBox): guint = result = (a.GtkHandleBoxflag0 and bm_TGtkHandleBox_shrink_on_detach) shr @@ -13686,7 +13686,7 @@ proc shrink_on_detach*(a: var TGtkHandleBox): guint = proc set_shrink_on_detach*(a: var TGtkHandleBox, `shrink_on_detach`: guint) = a.GtkHandleBoxflag0 = a.GtkHandleBoxflag0 or - ((`shrink_on_detach` shl bp_TGtkHandleBox_shrink_on_detach) and + (int16(`shrink_on_detach` shl bp_TGtkHandleBox_shrink_on_detach) and bm_TGtkHandleBox_shrink_on_detach) proc snap_edge*(a: var TGtkHandleBox): gint = @@ -13695,7 +13695,7 @@ proc snap_edge*(a: var TGtkHandleBox): gint = proc set_snap_edge*(a: var TGtkHandleBox, `snap_edge`: gint) = a.GtkHandleBoxflag0 = a.GtkHandleBoxflag0 or - ((`snap_edge` shl bp_TGtkHandleBox_snap_edge) and + (int16(`snap_edge` shl bp_TGtkHandleBox_snap_edge) and bm_TGtkHandleBox_snap_edge) proc GTK_TYPE_PANED*(): GType = @@ -13722,7 +13722,7 @@ proc position_set*(a: var TGtkPaned): guint = proc set_position_set*(a: var TGtkPaned, `position_set`: guint) = a.GtkPanedflag0 = a.GtkPanedflag0 or - ((`position_set` shl bp_TGtkPaned_position_set) and + (int16(`position_set` shl bp_TGtkPaned_position_set) and bm_TGtkPaned_position_set) proc in_drag*(a: var TGtkPaned): guint = @@ -13730,7 +13730,7 @@ proc in_drag*(a: var TGtkPaned): guint = proc set_in_drag*(a: var TGtkPaned, `in_drag`: guint) = a.GtkPanedflag0 = a.GtkPanedflag0 or - ((`in_drag` shl bp_TGtkPaned_in_drag) and bm_TGtkPaned_in_drag) + (int16(`in_drag` shl bp_TGtkPaned_in_drag) and bm_TGtkPaned_in_drag) proc child1_shrink*(a: var TGtkPaned): guint = result = (a.GtkPanedflag0 and bm_TGtkPaned_child1_shrink) shr @@ -13738,7 +13738,7 @@ proc child1_shrink*(a: var TGtkPaned): guint = proc set_child1_shrink*(a: var TGtkPaned, `child1_shrink`: guint) = a.GtkPanedflag0 = a.GtkPanedflag0 or - ((`child1_shrink` shl bp_TGtkPaned_child1_shrink) and + (int16(`child1_shrink` shl bp_TGtkPaned_child1_shrink) and bm_TGtkPaned_child1_shrink) proc child1_resize*(a: var TGtkPaned): guint = @@ -13747,7 +13747,7 @@ proc child1_resize*(a: var TGtkPaned): guint = proc set_child1_resize*(a: var TGtkPaned, `child1_resize`: guint) = a.GtkPanedflag0 = a.GtkPanedflag0 or - ((`child1_resize` shl bp_TGtkPaned_child1_resize) and + (int16(`child1_resize` shl bp_TGtkPaned_child1_resize) and bm_TGtkPaned_child1_resize) proc child2_shrink*(a: var TGtkPaned): guint = @@ -13756,7 +13756,7 @@ proc child2_shrink*(a: var TGtkPaned): guint = proc set_child2_shrink*(a: var TGtkPaned, `child2_shrink`: guint) = a.GtkPanedflag0 = a.GtkPanedflag0 or - ((`child2_shrink` shl bp_TGtkPaned_child2_shrink) and + (int16(`child2_shrink` shl bp_TGtkPaned_child2_shrink) and bm_TGtkPaned_child2_shrink) proc child2_resize*(a: var TGtkPaned): guint = @@ -13765,7 +13765,7 @@ proc child2_resize*(a: var TGtkPaned): guint = proc set_child2_resize*(a: var TGtkPaned, `child2_resize`: guint) = a.GtkPanedflag0 = a.GtkPanedflag0 or - ((`child2_resize` shl bp_TGtkPaned_child2_resize) and + (int16(`child2_resize` shl bp_TGtkPaned_child2_resize) and bm_TGtkPaned_child2_resize) proc orientation*(a: var TGtkPaned): guint = @@ -13774,7 +13774,7 @@ proc orientation*(a: var TGtkPaned): guint = proc set_orientation*(a: var TGtkPaned, `orientation`: guint) = a.GtkPanedflag0 = a.GtkPanedflag0 or - ((`orientation` shl bp_TGtkPaned_orientation) and + (int16(`orientation` shl bp_TGtkPaned_orientation) and bm_TGtkPaned_orientation) proc in_recursion*(a: var TGtkPaned): guint = @@ -13783,7 +13783,7 @@ proc in_recursion*(a: var TGtkPaned): guint = proc set_in_recursion*(a: var TGtkPaned, `in_recursion`: guint) = a.GtkPanedflag0 = a.GtkPanedflag0 or - ((`in_recursion` shl bp_TGtkPaned_in_recursion) and + (int16(`in_recursion` shl bp_TGtkPaned_in_recursion) and bm_TGtkPaned_in_recursion) proc handle_prelit*(a: var TGtkPaned): guint = @@ -13792,14 +13792,14 @@ proc handle_prelit*(a: var TGtkPaned): guint = proc set_handle_prelit*(a: var TGtkPaned, `handle_prelit`: guint) = a.GtkPanedflag0 = a.GtkPanedflag0 or - ((`handle_prelit` shl bp_TGtkPaned_handle_prelit) and + (int16(`handle_prelit` shl bp_TGtkPaned_handle_prelit) and bm_TGtkPaned_handle_prelit) proc gtk_paned_gutter_size*(p: pointer, s: gint) = - if (p != nil) and (s != 0): nil + if (p != nil) and (s != 0'i32): nil proc gtk_paned_set_gutter_size*(p: pointer, s: gint) = - if (p != nil) and (s != 0): nil + if (p != nil) and (s != 0'i32): nil proc GTK_TYPE_HBUTTON_BOX*(): GType = result = gtk_hbutton_box_get_type() @@ -13915,7 +13915,7 @@ proc engine_specified*(a: var TGtkRcStyle): guint = proc set_engine_specified*(a: var TGtkRcStyle, `engine_specified`: guint) = a.GtkRcStyleflag0 = a.GtkRcStyleflag0 or - ((`engine_specified` shl bp_TGtkRcStyle_engine_specified) and + (int16(`engine_specified` shl bp_TGtkRcStyle_engine_specified) and bm_TGtkRcStyle_engine_specified) proc GTK_TYPE_STYLE*(): GType = @@ -13940,7 +13940,7 @@ proc GTK_TYPE_BORDER*(): GType = result = gtk_border_get_type() proc GTK_STYLE_ATTACHED*(style: pointer): bool = - result = ((GTK_STYLE(style)).attach_count) > 0 + result = ((GTK_STYLE(style)).attach_count) > 0'i32 proc gtk_style_apply_default_pixmap*(style: PGtkStyle, window: PGdkWindow, state_type: TGtkStateType, @@ -13972,14 +13972,14 @@ proc inverted*(a: var TGtkRange): guint = proc set_inverted*(a: var TGtkRange, `inverted`: guint) = a.GtkRangeflag0 = a.GtkRangeflag0 or - ((`inverted` shl bp_TGtkRange_inverted) and bm_TGtkRange_inverted) + (int16(`inverted` shl bp_TGtkRange_inverted) and bm_TGtkRange_inverted) proc flippable*(a: var TGtkRange): guint = result = (a.GtkRangeflag0 and bm_TGtkRange_flippable) shr bp_TGtkRange_flippable proc set_flippable*(a: var TGtkRange, `flippable`: guint) = a.GtkRangeflag0 = a.GtkRangeflag0 or - ((`flippable` shl bp_TGtkRange_flippable) and bm_TGtkRange_flippable) + (int16(`flippable` shl bp_TGtkRange_flippable) and bm_TGtkRange_flippable) proc has_stepper_a*(a: var TGtkRange): guint = result = (a.GtkRangeflag0 and bm_TGtkRange_has_stepper_a) shr @@ -13987,7 +13987,7 @@ proc has_stepper_a*(a: var TGtkRange): guint = proc set_has_stepper_a*(a: var TGtkRange, `has_stepper_a`: guint) = a.GtkRangeflag0 = a.GtkRangeflag0 or - ((`has_stepper_a` shl bp_TGtkRange_has_stepper_a) and + (int16(`has_stepper_a` shl bp_TGtkRange_has_stepper_a) and bm_TGtkRange_has_stepper_a) proc has_stepper_b*(a: var TGtkRange): guint = @@ -13996,7 +13996,7 @@ proc has_stepper_b*(a: var TGtkRange): guint = proc set_has_stepper_b*(a: var TGtkRange, `has_stepper_b`: guint) = a.GtkRangeflag0 = a.GtkRangeflag0 or - ((`has_stepper_b` shl bp_TGtkRange_has_stepper_b) and + (int16(`has_stepper_b` shl bp_TGtkRange_has_stepper_b) and bm_TGtkRange_has_stepper_b) proc has_stepper_c*(a: var TGtkRange): guint = @@ -14005,7 +14005,7 @@ proc has_stepper_c*(a: var TGtkRange): guint = proc set_has_stepper_c*(a: var TGtkRange, `has_stepper_c`: guint) = a.GtkRangeflag0 = a.GtkRangeflag0 or - ((`has_stepper_c` shl bp_TGtkRange_has_stepper_c) and + (int16(`has_stepper_c` shl bp_TGtkRange_has_stepper_c) and bm_TGtkRange_has_stepper_c) proc has_stepper_d*(a: var TGtkRange): guint = @@ -14014,7 +14014,7 @@ proc has_stepper_d*(a: var TGtkRange): guint = proc set_has_stepper_d*(a: var TGtkRange, `has_stepper_d`: guint) = a.GtkRangeflag0 = a.GtkRangeflag0 or - ((`has_stepper_d` shl bp_TGtkRange_has_stepper_d) and + (int16(`has_stepper_d` shl bp_TGtkRange_has_stepper_d) and bm_TGtkRange_has_stepper_d) proc need_recalc*(a: var TGtkRange): guint = @@ -14023,7 +14023,7 @@ proc need_recalc*(a: var TGtkRange): guint = proc set_need_recalc*(a: var TGtkRange, `need_recalc`: guint) = a.GtkRangeflag0 = a.GtkRangeflag0 or - ((`need_recalc` shl bp_TGtkRange_need_recalc) and + (int16(`need_recalc` shl bp_TGtkRange_need_recalc) and bm_TGtkRange_need_recalc) proc slider_size_fixed*(a: var TGtkRange): guint = @@ -14032,7 +14032,7 @@ proc slider_size_fixed*(a: var TGtkRange): guint = proc set_slider_size_fixed*(a: var TGtkRange, `slider_size_fixed`: guint) = a.GtkRangeflag0 = a.GtkRangeflag0 or - ((`slider_size_fixed` shl bp_TGtkRange_slider_size_fixed) and + (int16(`slider_size_fixed` shl bp_TGtkRange_slider_size_fixed) and bm_TGtkRange_slider_size_fixed) proc trough_click_forward*(a: var TGtkRange): guint = @@ -14041,7 +14041,7 @@ proc trough_click_forward*(a: var TGtkRange): guint = proc set_trough_click_forward*(a: var TGtkRange, `trough_click_forward`: guint) = a.flag1 = a.flag1 or - ((`trough_click_forward` shl bp_TGtkRange_trough_click_forward) and + (int16(`trough_click_forward` shl bp_TGtkRange_trough_click_forward) and bm_TGtkRange_trough_click_forward) proc update_pending*(a: var TGtkRange): guint = @@ -14050,7 +14050,7 @@ proc update_pending*(a: var TGtkRange): guint = proc set_update_pending*(a: var TGtkRange, `update_pending`: guint) = a.flag1 = a.flag1 or - ((`update_pending` shl bp_TGtkRange_update_pending) and + (int16(`update_pending` shl bp_TGtkRange_update_pending) and bm_TGtkRange_update_pending) proc GTK_TYPE_SCALE*(): GType = @@ -14076,14 +14076,14 @@ proc draw_value*(a: var TGtkScale): guint = proc set_draw_value*(a: var TGtkScale, `draw_value`: guint) = a.GtkScaleflag0 = a.GtkScaleflag0 or - ((`draw_value` shl bp_TGtkScale_draw_value) and bm_TGtkScale_draw_value) + (int16(`draw_value` shl bp_TGtkScale_draw_value) and bm_TGtkScale_draw_value) proc value_pos*(a: var TGtkScale): guint = result = (a.GtkScaleflag0 and bm_TGtkScale_value_pos) shr bp_TGtkScale_value_pos proc set_value_pos*(a: var TGtkScale, `value_pos`: guint) = a.GtkScaleflag0 = a.GtkScaleflag0 or - ((`value_pos` shl bp_TGtkScale_value_pos) and bm_TGtkScale_value_pos) + (int16(`value_pos` shl bp_TGtkScale_value_pos) and bm_TGtkScale_value_pos) proc GTK_TYPE_HSCALE*(): GType = result = gtk_hscale_get_type() @@ -14265,7 +14265,7 @@ proc in_hex_sequence*(a: var TGtkIMContextSimple): guint = proc set_in_hex_sequence*(a: var TGtkIMContextSimple, `in_hex_sequence`: guint) = a.GtkIMContextSimpleflag0 = a.GtkIMContextSimpleflag0 or - ((`in_hex_sequence` shl bp_TGtkIMContextSimple_in_hex_sequence) and + (int16(`in_hex_sequence` shl bp_TGtkIMContextSimple_in_hex_sequence) and bm_TGtkIMContextSimple_in_hex_sequence) proc GTK_TYPE_IM_MULTICONTEXT*(): GType = @@ -14386,7 +14386,7 @@ proc selection_mode*(a: var TGtkList): guint = proc set_selection_mode*(a: var TGtkList, `selection_mode`: guint) = a.GtkListflag0 = a.GtkListflag0 or - ((`selection_mode` shl bp_TGtkList_selection_mode) and + (int16(`selection_mode` shl bp_TGtkList_selection_mode) and bm_TGtkList_selection_mode) proc drag_selection*(a: var TGtkList): guint = @@ -14395,7 +14395,7 @@ proc drag_selection*(a: var TGtkList): guint = proc set_drag_selection*(a: var TGtkList, `drag_selection`: guint) = a.GtkListflag0 = a.GtkListflag0 or - ((`drag_selection` shl bp_TGtkList_drag_selection) and + (int16(`drag_selection` shl bp_TGtkList_drag_selection) and bm_TGtkList_drag_selection) proc add_mode*(a: var TGtkList): guint = @@ -14403,7 +14403,7 @@ proc add_mode*(a: var TGtkList): guint = proc set_add_mode*(a: var TGtkList, `add_mode`: guint) = a.GtkListflag0 = a.GtkListflag0 or - ((`add_mode` shl bp_TGtkList_add_mode) and bm_TGtkList_add_mode) + (int16(`add_mode` shl bp_TGtkList_add_mode) and bm_TGtkList_add_mode) proc gtk_list_item_get_type(): GType {.importc, cdecl, dynlib: gtklib.} @@ -14520,7 +14520,7 @@ proc columns_dirty*(a: var TGtkListStore): guint = proc set_columns_dirty*(a: var TGtkListStore, `columns_dirty`: guint) = a.GtkListStoreflag0 = a.GtkListStoreflag0 or - ((`columns_dirty` shl bp_TGtkListStore_columns_dirty) and + (int16(`columns_dirty` shl bp_TGtkListStore_columns_dirty) and bm_TGtkListStore_columns_dirty) proc GTK_TYPE_MENU_BAR*(): GType = @@ -14594,7 +14594,7 @@ proc show_tabs*(a: var TGtkNotebook): guint = proc set_show_tabs*(a: var TGtkNotebook, `show_tabs`: guint) = a.GtkNotebookflag0 = a.GtkNotebookflag0 or - ((`show_tabs` shl bp_TGtkNotebook_show_tabs) and + (int16(`show_tabs` shl bp_TGtkNotebook_show_tabs) and bm_TGtkNotebook_show_tabs) proc homogeneous*(a: var TGtkNotebook): guint = @@ -14603,7 +14603,7 @@ proc homogeneous*(a: var TGtkNotebook): guint = proc set_homogeneous*(a: var TGtkNotebook, `homogeneous`: guint) = a.GtkNotebookflag0 = a.GtkNotebookflag0 or - ((`homogeneous` shl bp_TGtkNotebook_homogeneous) and + (int16(`homogeneous` shl bp_TGtkNotebook_homogeneous) and bm_TGtkNotebook_homogeneous) proc show_border*(a: var TGtkNotebook): guint = @@ -14612,7 +14612,7 @@ proc show_border*(a: var TGtkNotebook): guint = proc set_show_border*(a: var TGtkNotebook, `show_border`: guint) = a.GtkNotebookflag0 = a.GtkNotebookflag0 or - ((`show_border` shl bp_TGtkNotebook_show_border) and + (int16(`show_border` shl bp_TGtkNotebook_show_border) and bm_TGtkNotebook_show_border) proc tab_pos*(a: var TGtkNotebook): guint = @@ -14620,7 +14620,7 @@ proc tab_pos*(a: var TGtkNotebook): guint = proc set_tab_pos*(a: var TGtkNotebook, `tab_pos`: guint) = a.GtkNotebookflag0 = a.GtkNotebookflag0 or - ((`tab_pos` shl bp_TGtkNotebook_tab_pos) and bm_TGtkNotebook_tab_pos) + (int16(`tab_pos` shl bp_TGtkNotebook_tab_pos) and bm_TGtkNotebook_tab_pos) proc scrollable*(a: var TGtkNotebook): guint = result = (a.GtkNotebookflag0 and bm_TGtkNotebook_scrollable) shr @@ -14628,7 +14628,7 @@ proc scrollable*(a: var TGtkNotebook): guint = proc set_scrollable*(a: var TGtkNotebook, `scrollable`: guint) = a.GtkNotebookflag0 = a.GtkNotebookflag0 or - ((`scrollable` shl bp_TGtkNotebook_scrollable) and + (int16(`scrollable` shl bp_TGtkNotebook_scrollable) and bm_TGtkNotebook_scrollable) proc in_child*(a: var TGtkNotebook): guint = @@ -14637,7 +14637,7 @@ proc in_child*(a: var TGtkNotebook): guint = proc set_in_child*(a: var TGtkNotebook, `in_child`: guint) = a.GtkNotebookflag0 = a.GtkNotebookflag0 or - ((`in_child` shl bp_TGtkNotebook_in_child) and bm_TGtkNotebook_in_child) + (int16(`in_child` shl bp_TGtkNotebook_in_child) and bm_TGtkNotebook_in_child) proc click_child*(a: var TGtkNotebook): guint = result = (a.GtkNotebookflag0 and bm_TGtkNotebook_click_child) shr @@ -14645,7 +14645,7 @@ proc click_child*(a: var TGtkNotebook): guint = proc set_click_child*(a: var TGtkNotebook, `click_child`: guint) = a.GtkNotebookflag0 = a.GtkNotebookflag0 or - ((`click_child` shl bp_TGtkNotebook_click_child) and + (int16(`click_child` shl bp_TGtkNotebook_click_child) and bm_TGtkNotebook_click_child) proc button*(a: var TGtkNotebook): guint = @@ -14653,7 +14653,7 @@ proc button*(a: var TGtkNotebook): guint = proc set_button*(a: var TGtkNotebook, `button`: guint) = a.GtkNotebookflag0 = a.GtkNotebookflag0 or - ((`button` shl bp_TGtkNotebook_button) and bm_TGtkNotebook_button) + (int16(`button` shl bp_TGtkNotebook_button) and bm_TGtkNotebook_button) proc need_timer*(a: var TGtkNotebook): guint = result = (a.GtkNotebookflag0 and bm_TGtkNotebook_need_timer) shr @@ -14661,7 +14661,7 @@ proc need_timer*(a: var TGtkNotebook): guint = proc set_need_timer*(a: var TGtkNotebook, `need_timer`: guint) = a.GtkNotebookflag0 = a.GtkNotebookflag0 or - ((`need_timer` shl bp_TGtkNotebook_need_timer) and + (int16(`need_timer` shl bp_TGtkNotebook_need_timer) and bm_TGtkNotebook_need_timer) proc child_has_focus*(a: var TGtkNotebook): guint = @@ -14670,7 +14670,7 @@ proc child_has_focus*(a: var TGtkNotebook): guint = proc set_child_has_focus*(a: var TGtkNotebook, `child_has_focus`: guint) = a.GtkNotebookflag0 = a.GtkNotebookflag0 or - ((`child_has_focus` shl bp_TGtkNotebook_child_has_focus) and + (int16(`child_has_focus` shl bp_TGtkNotebook_child_has_focus) and bm_TGtkNotebook_child_has_focus) proc have_visible_child*(a: var TGtkNotebook): guint = @@ -14679,7 +14679,7 @@ proc have_visible_child*(a: var TGtkNotebook): guint = proc set_have_visible_child*(a: var TGtkNotebook, `have_visible_child`: guint) = a.GtkNotebookflag0 = a.GtkNotebookflag0 or - ((`have_visible_child` shl bp_TGtkNotebook_have_visible_child) and + (int16(`have_visible_child` shl bp_TGtkNotebook_have_visible_child) and bm_TGtkNotebook_have_visible_child) proc focus_out*(a: var TGtkNotebook): guint = @@ -14688,7 +14688,7 @@ proc focus_out*(a: var TGtkNotebook): guint = proc set_focus_out*(a: var TGtkNotebook, `focus_out`: guint) = a.GtkNotebookflag0 = a.GtkNotebookflag0 or - ((`focus_out` shl bp_TGtkNotebook_focus_out) and + (int16(`focus_out` shl bp_TGtkNotebook_focus_out) and bm_TGtkNotebook_focus_out) proc GTK_TYPE_OLD_EDITABLE*(): GType = @@ -14716,7 +14716,7 @@ proc has_selection*(a: var TGtkOldEditable): guint = proc set_has_selection*(a: var TGtkOldEditable, `has_selection`: guint) = a.GtkOldEditableflag0 = a.GtkOldEditableflag0 or - ((`has_selection` shl bp_TGtkOldEditable_has_selection) and + (int16(`has_selection` shl bp_TGtkOldEditable_has_selection) and bm_TGtkOldEditable_has_selection) proc editable*(a: var TGtkOldEditable): guint = @@ -14725,7 +14725,7 @@ proc editable*(a: var TGtkOldEditable): guint = proc set_editable*(a: var TGtkOldEditable, `editable`: guint) = a.GtkOldEditableflag0 = a.GtkOldEditableflag0 or - ((`editable` shl bp_TGtkOldEditable_editable) and + (int16(`editable` shl bp_TGtkOldEditable_editable) and bm_TGtkOldEditable_editable) proc visible*(a: var TGtkOldEditable): guint = @@ -14734,7 +14734,7 @@ proc visible*(a: var TGtkOldEditable): guint = proc set_visible*(a: var TGtkOldEditable, `visible`: guint) = a.GtkOldEditableflag0 = a.GtkOldEditableflag0 or - ((`visible` shl bp_TGtkOldEditable_visible) and + (int16(`visible` shl bp_TGtkOldEditable_visible) and bm_TGtkOldEditable_visible) proc GTK_TYPE_OPTION_MENU*(): GType = @@ -14779,7 +14779,7 @@ proc build_insensitive*(a: var TGtkPixmap): guint = proc set_build_insensitive*(a: var TGtkPixmap, `build_insensitive`: guint) = a.GtkPixmapflag0 = a.GtkPixmapflag0 or - ((`build_insensitive` shl bp_TGtkPixmap_build_insensitive) and + (int16(`build_insensitive` shl bp_TGtkPixmap_build_insensitive) and bm_TGtkPixmap_build_insensitive) proc GTK_TYPE_PLUG*(): GType = @@ -14805,7 +14805,7 @@ proc same_app*(a: var TGtkPlug): guint = proc set_same_app*(a: var TGtkPlug, `same_app`: guint) = a.GtkPlugflag0 = a.GtkPlugflag0 or - ((`same_app` shl bp_TGtkPlug_same_app) and bm_TGtkPlug_same_app) + (int16(`same_app` shl bp_TGtkPlug_same_app) and bm_TGtkPlug_same_app) proc GTK_TYPE_PREVIEW*(): GType = result = gtk_preview_get_type() @@ -14830,14 +14830,14 @@ proc get_type*(a: var TGtkPreview): guint = proc set_type*(a: var TGtkPreview, `type`: guint) = a.GtkPreviewflag0 = a.GtkPreviewflag0 or - ((`type` shl bp_TGtkPreview_type) and bm_TGtkPreview_type) + (int16(`type` shl bp_TGtkPreview_type) and bm_TGtkPreview_type) proc get_expand*(a: var TGtkPreview): guint = result = (a.GtkPreviewflag0 and bm_TGtkPreview_expand) shr bp_TGtkPreview_expand proc set_expand*(a: var TGtkPreview, `expand`: guint) = a.GtkPreviewflag0 = a.GtkPreviewflag0 or - ((`expand` shl bp_TGtkPreview_expand) and bm_TGtkPreview_expand) + (int16(`expand` shl bp_TGtkPreview_expand) and bm_TGtkPreview_expand) proc gtk_progress_get_type(): GType {.importc, cdecl, dynlib: gtklib.} @@ -14865,7 +14865,7 @@ proc show_text*(a: var TGtkProgress): guint = proc set_show_text*(a: var TGtkProgress, `show_text`: guint) = a.GtkProgressflag0 = a.GtkProgressflag0 or - ((`show_text` shl bp_TGtkProgress_show_text) and + (int16(`show_text` shl bp_TGtkProgress_show_text) and bm_TGtkProgress_show_text) proc activity_mode*(a: var TGtkProgress): guint = @@ -14874,7 +14874,7 @@ proc activity_mode*(a: var TGtkProgress): guint = proc set_activity_mode*(a: var TGtkProgress, `activity_mode`: guint) = a.GtkProgressflag0 = a.GtkProgressflag0 or - ((`activity_mode` shl bp_TGtkProgress_activity_mode) and + (int16(`activity_mode` shl bp_TGtkProgress_activity_mode) and bm_TGtkProgress_activity_mode) proc use_text_format*(a: var TGtkProgress): guint = @@ -14883,7 +14883,7 @@ proc use_text_format*(a: var TGtkProgress): guint = proc set_use_text_format*(a: var TGtkProgress, `use_text_format`: guint) = a.GtkProgressflag0 = a.GtkProgressflag0 or - ((`use_text_format` shl bp_TGtkProgress_use_text_format) and + (int16(`use_text_format` shl bp_TGtkProgress_use_text_format) and bm_TGtkProgress_use_text_format) proc GTK_TYPE_PROGRESS_BAR*(): GType = @@ -14911,7 +14911,7 @@ proc activity_dir*(a: var TGtkProgressBar): guint = proc set_activity_dir*(a: var TGtkProgressBar, `activity_dir`: guint) = a.GtkProgressBarflag0 = a.GtkProgressBarflag0 or - ((`activity_dir` shl bp_TGtkProgressBar_activity_dir) and + (int16(`activity_dir` shl bp_TGtkProgressBar_activity_dir) and bm_TGtkProgressBar_activity_dir) proc GTK_TYPE_RADIO_BUTTON*(): GType = @@ -14980,7 +14980,7 @@ proc hscrollbar_policy*(a: var TGtkScrolledWindow): guint = proc set_hscrollbar_policy*(a: var TGtkScrolledWindow, `hscrollbar_policy`: guint) = a.GtkScrolledWindowflag0 = a.GtkScrolledWindowflag0 or - ((`hscrollbar_policy` shl bp_TGtkScrolledWindow_hscrollbar_policy) and + (int16(`hscrollbar_policy` shl bp_TGtkScrolledWindow_hscrollbar_policy) and bm_TGtkScrolledWindow_hscrollbar_policy) proc vscrollbar_policy*(a: var TGtkScrolledWindow): guint = @@ -14990,7 +14990,7 @@ proc vscrollbar_policy*(a: var TGtkScrolledWindow): guint = proc set_vscrollbar_policy*(a: var TGtkScrolledWindow, `vscrollbar_policy`: guint) = a.GtkScrolledWindowflag0 = a.GtkScrolledWindowflag0 or - ((`vscrollbar_policy` shl bp_TGtkScrolledWindow_vscrollbar_policy) and + (int16(`vscrollbar_policy` shl bp_TGtkScrolledWindow_vscrollbar_policy) and bm_TGtkScrolledWindow_vscrollbar_policy) proc hscrollbar_visible*(a: var TGtkScrolledWindow): guint = @@ -15000,7 +15000,7 @@ proc hscrollbar_visible*(a: var TGtkScrolledWindow): guint = proc set_hscrollbar_visible*(a: var TGtkScrolledWindow, `hscrollbar_visible`: guint) = a.GtkScrolledWindowflag0 = a.GtkScrolledWindowflag0 or - ((`hscrollbar_visible` shl bp_TGtkScrolledWindow_hscrollbar_visible) and + (int16(`hscrollbar_visible` shl bp_TGtkScrolledWindow_hscrollbar_visible) and bm_TGtkScrolledWindow_hscrollbar_visible) proc vscrollbar_visible*(a: var TGtkScrolledWindow): guint = @@ -15010,7 +15010,7 @@ proc vscrollbar_visible*(a: var TGtkScrolledWindow): guint = proc set_vscrollbar_visible*(a: var TGtkScrolledWindow, `vscrollbar_visible`: guint) = a.GtkScrolledWindowflag0 = a.GtkScrolledWindowflag0 or - ((`vscrollbar_visible` shl bp_TGtkScrolledWindow_vscrollbar_visible) and + int16((`vscrollbar_visible` shl bp_TGtkScrolledWindow_vscrollbar_visible) and bm_TGtkScrolledWindow_vscrollbar_visible) proc window_placement*(a: var TGtkScrolledWindow): guint = @@ -15019,7 +15019,7 @@ proc window_placement*(a: var TGtkScrolledWindow): guint = proc set_window_placement*(a: var TGtkScrolledWindow, `window_placement`: guint) = a.GtkScrolledWindowflag0 = a.GtkScrolledWindowflag0 or - ((`window_placement` shl bp_TGtkScrolledWindow_window_placement) and + (int16(`window_placement` shl bp_TGtkScrolledWindow_window_placement) and bm_TGtkScrolledWindow_window_placement) proc focus_out*(a: var TGtkScrolledWindow): guint = @@ -15028,7 +15028,7 @@ proc focus_out*(a: var TGtkScrolledWindow): guint = proc set_focus_out*(a: var TGtkScrolledWindow, `focus_out`: guint) = a.GtkScrolledWindowflag0 = a.GtkScrolledWindowflag0 or - ((`focus_out` shl bp_TGtkScrolledWindow_focus_out) and + (int16(`focus_out` shl bp_TGtkScrolledWindow_focus_out) and bm_TGtkScrolledWindow_focus_out) proc GTK_TYPE_SELECTION_DATA*(): GType = @@ -15062,7 +15062,7 @@ proc gtk_signal_name*(signal_id: guint): cstring = result = g_signal_name(signal_id) proc gtk_signal_emit_stop*(instance: gpointer, signal_id: guint, detail: TGQuark) = - if detail != 0: g_signal_stop_emission(instance, signal_id, 0) + if detail != 0'i32: g_signal_stop_emission(instance, signal_id, 0) proc gtk_signal_connect_full*(anObject: PGtkObject, name: cstring, func_: TGtkSignalFunc, unknown1: pointer, @@ -15138,7 +15138,7 @@ proc gtk_signal_handler_pending_by_func*(anObject: PGtkObject, signal_id: guint, t = cast[TGSignalMatchType](G_SIGNAL_MATCH_ID or G_SIGNAL_MATCH_FUNC or G_SIGNAL_MATCH_DATA) if not may_be_blocked: - t = t or cast[int](G_SIGNAL_MATCH_UNBLOCKED) + t = t or cast[TGSignalMatchType](G_SIGNAL_MATCH_UNBLOCKED) Result = g_signal_handler_find(anObject, t, signal_id, 0, nil, func_, data) != 0 @@ -15166,7 +15166,7 @@ proc have_width*(a: var TGtkSizeGroup): guint = proc set_have_width*(a: var TGtkSizeGroup, `have_width`: guint) = a.GtkSizeGroupflag0 = a.GtkSizeGroupflag0 or - ((`have_width` shl bp_TGtkSizeGroup_have_width) and + (int16(`have_width` shl bp_TGtkSizeGroup_have_width) and bm_TGtkSizeGroup_have_width) proc have_height*(a: var TGtkSizeGroup): guint = @@ -15175,7 +15175,7 @@ proc have_height*(a: var TGtkSizeGroup): guint = proc set_have_height*(a: var TGtkSizeGroup, `have_height`: guint) = a.GtkSizeGroupflag0 = a.GtkSizeGroupflag0 or - ((`have_height` shl bp_TGtkSizeGroup_have_height) and + (int16(`have_height` shl bp_TGtkSizeGroup_have_height) and bm_TGtkSizeGroup_have_height) proc GTK_TYPE_SOCKET*(): GType = @@ -15201,35 +15201,35 @@ proc same_app*(a: var TGtkSocket): guint = proc set_same_app*(a: var TGtkSocket, `same_app`: guint) = a.GtkSocketflag0 = a.GtkSocketflag0 or - ((`same_app` shl bp_TGtkSocket_same_app) and bm_TGtkSocket_same_app) + (int16(`same_app` shl bp_TGtkSocket_same_app) and bm_TGtkSocket_same_app) proc focus_in*(a: var TGtkSocket): guint = result = (a.GtkSocketflag0 and bm_TGtkSocket_focus_in) shr bp_TGtkSocket_focus_in proc set_focus_in*(a: var TGtkSocket, `focus_in`: guint) = a.GtkSocketflag0 = a.GtkSocketflag0 or - ((`focus_in` shl bp_TGtkSocket_focus_in) and bm_TGtkSocket_focus_in) + (int16(`focus_in` shl bp_TGtkSocket_focus_in) and bm_TGtkSocket_focus_in) proc have_size*(a: var TGtkSocket): guint = result = (a.GtkSocketflag0 and bm_TGtkSocket_have_size) shr bp_TGtkSocket_have_size proc set_have_size*(a: var TGtkSocket, `have_size`: guint) = a.GtkSocketflag0 = a.GtkSocketflag0 or - ((`have_size` shl bp_TGtkSocket_have_size) and bm_TGtkSocket_have_size) + (int16(`have_size` shl bp_TGtkSocket_have_size) and bm_TGtkSocket_have_size) proc need_map*(a: var TGtkSocket): guint = result = (a.GtkSocketflag0 and bm_TGtkSocket_need_map) shr bp_TGtkSocket_need_map proc set_need_map*(a: var TGtkSocket, `need_map`: guint) = a.GtkSocketflag0 = a.GtkSocketflag0 or - ((`need_map` shl bp_TGtkSocket_need_map) and bm_TGtkSocket_need_map) + (int16(`need_map` shl bp_TGtkSocket_need_map) and bm_TGtkSocket_need_map) proc is_mapped*(a: var TGtkSocket): guint = result = (a.GtkSocketflag0 and bm_TGtkSocket_is_mapped) shr bp_TGtkSocket_is_mapped proc set_is_mapped*(a: var TGtkSocket, `is_mapped`: guint) = a.GtkSocketflag0 = a.GtkSocketflag0 or - ((`is_mapped` shl bp_TGtkSocket_is_mapped) and bm_TGtkSocket_is_mapped) + (int16(`is_mapped` shl bp_TGtkSocket_is_mapped) and bm_TGtkSocket_is_mapped) proc GTK_TYPE_SPIN_BUTTON*(): GType = result = gtk_spin_button_get_type() @@ -15350,7 +15350,7 @@ proc has_resize_grip*(a: var TGtkStatusbar): guint = proc set_has_resize_grip*(a: var TGtkStatusbar, `has_resize_grip`: guint) = a.GtkStatusbarflag0 = a.GtkStatusbarflag0 or - ((`has_resize_grip` shl bp_TGtkStatusbar_has_resize_grip) and + (int16(`has_resize_grip` shl bp_TGtkStatusbar_has_resize_grip) and bm_TGtkStatusbar_has_resize_grip) proc GTK_TYPE_TABLE*(): GType = @@ -15377,7 +15377,7 @@ proc homogeneous*(a: var TGtkTable): guint = proc set_homogeneous*(a: var TGtkTable, `homogeneous`: guint) = a.GtkTableflag0 = a.GtkTableflag0 or - ((`homogeneous` shl bp_TGtkTable_homogeneous) and + (int16(`homogeneous` shl bp_TGtkTable_homogeneous) and bm_TGtkTable_homogeneous) proc xexpand*(a: var TGtkTableChild): guint = @@ -15386,7 +15386,7 @@ proc xexpand*(a: var TGtkTableChild): guint = proc set_xexpand*(a: var TGtkTableChild, `xexpand`: guint) = a.GtkTableChildflag0 = a.GtkTableChildflag0 or - ((`xexpand` shl bp_TGtkTableChild_xexpand) and + (int16(`xexpand` shl bp_TGtkTableChild_xexpand) and bm_TGtkTableChild_xexpand) proc yexpand*(a: var TGtkTableChild): guint = @@ -15395,7 +15395,7 @@ proc yexpand*(a: var TGtkTableChild): guint = proc set_yexpand*(a: var TGtkTableChild, `yexpand`: guint) = a.GtkTableChildflag0 = a.GtkTableChildflag0 or - ((`yexpand` shl bp_TGtkTableChild_yexpand) and + (int16(`yexpand` shl bp_TGtkTableChild_yexpand) and bm_TGtkTableChild_yexpand) proc xshrink*(a: var TGtkTableChild): guint = @@ -15404,7 +15404,7 @@ proc xshrink*(a: var TGtkTableChild): guint = proc set_xshrink*(a: var TGtkTableChild, `xshrink`: guint) = a.GtkTableChildflag0 = a.GtkTableChildflag0 or - ((`xshrink` shl bp_TGtkTableChild_xshrink) and + (int16(`xshrink` shl bp_TGtkTableChild_xshrink) and bm_TGtkTableChild_xshrink) proc yshrink*(a: var TGtkTableChild): guint = @@ -15413,7 +15413,7 @@ proc yshrink*(a: var TGtkTableChild): guint = proc set_yshrink*(a: var TGtkTableChild, `yshrink`: guint) = a.GtkTableChildflag0 = a.GtkTableChildflag0 or - ((`yshrink` shl bp_TGtkTableChild_yshrink) and + (int16(`yshrink` shl bp_TGtkTableChild_yshrink) and bm_TGtkTableChild_yshrink) proc xfill*(a: var TGtkTableChild): guint = @@ -15421,14 +15421,14 @@ proc xfill*(a: var TGtkTableChild): guint = proc set_xfill*(a: var TGtkTableChild, `xfill`: guint) = a.GtkTableChildflag0 = a.GtkTableChildflag0 or - ((`xfill` shl bp_TGtkTableChild_xfill) and bm_TGtkTableChild_xfill) + (int16(`xfill` shl bp_TGtkTableChild_xfill) and bm_TGtkTableChild_xfill) proc yfill*(a: var TGtkTableChild): guint = result = (a.GtkTableChildflag0 and bm_TGtkTableChild_yfill) shr bp_TGtkTableChild_yfill proc set_yfill*(a: var TGtkTableChild, `yfill`: guint) = a.GtkTableChildflag0 = a.GtkTableChildflag0 or - ((`yfill` shl bp_TGtkTableChild_yfill) and bm_TGtkTableChild_yfill) + (int16(`yfill` shl bp_TGtkTableChild_yfill) and bm_TGtkTableChild_yfill) proc need_expand*(a: var TGtkTableRowCol): guint = result = (a.flag0 and bm_TGtkTableRowCol_need_expand) shr @@ -15436,7 +15436,7 @@ proc need_expand*(a: var TGtkTableRowCol): guint = proc set_need_expand*(a: var TGtkTableRowCol, `need_expand`: guint) = a.flag0 = a.flag0 or - ((`need_expand` shl bp_TGtkTableRowCol_need_expand) and + (int16(`need_expand` shl bp_TGtkTableRowCol_need_expand) and bm_TGtkTableRowCol_need_expand) proc need_shrink*(a: var TGtkTableRowCol): guint = @@ -15445,7 +15445,7 @@ proc need_shrink*(a: var TGtkTableRowCol): guint = proc set_need_shrink*(a: var TGtkTableRowCol, `need_shrink`: guint) = a.flag0 = a.flag0 or - ((`need_shrink` shl bp_TGtkTableRowCol_need_shrink) and + (int16(`need_shrink` shl bp_TGtkTableRowCol_need_shrink) and bm_TGtkTableRowCol_need_shrink) proc expand*(a: var TGtkTableRowCol): guint = @@ -15454,7 +15454,7 @@ proc expand*(a: var TGtkTableRowCol): guint = proc set_expand*(a: var TGtkTableRowCol, `expand`: guint) = a.flag0 = a.flag0 or - ((`expand` shl bp_TGtkTableRowCol_expand) and bm_TGtkTableRowCol_expand) + (int16(`expand` shl bp_TGtkTableRowCol_expand) and bm_TGtkTableRowCol_expand) proc shrink*(a: var TGtkTableRowCol): guint = result = (a.flag0 and bm_TGtkTableRowCol_shrink) shr @@ -15462,7 +15462,7 @@ proc shrink*(a: var TGtkTableRowCol): guint = proc set_shrink*(a: var TGtkTableRowCol, `shrink`: guint) = a.flag0 = a.flag0 or - ((`shrink` shl bp_TGtkTableRowCol_shrink) and bm_TGtkTableRowCol_shrink) + (int16(`shrink` shl bp_TGtkTableRowCol_shrink) and bm_TGtkTableRowCol_shrink) proc empty*(a: var TGtkTableRowCol): guint = result = (a.flag0 and bm_TGtkTableRowCol_empty) shr @@ -15470,7 +15470,7 @@ proc empty*(a: var TGtkTableRowCol): guint = proc set_empty*(a: var TGtkTableRowCol, `empty`: guint) = a.flag0 = a.flag0 or - ((`empty` shl bp_TGtkTableRowCol_empty) and bm_TGtkTableRowCol_empty) + (int16(`empty` shl bp_TGtkTableRowCol_empty) and bm_TGtkTableRowCol_empty) proc GTK_TYPE_TEAROFF_MENU_ITEM*(): GType = result = gtk_tearoff_menu_item_get_type() @@ -15497,7 +15497,7 @@ proc torn_off*(a: var TGtkTearoffMenuItem): guint = proc set_torn_off*(a: var TGtkTearoffMenuItem, `torn_off`: guint) = a.GtkTearoffMenuItemflag0 = a.GtkTearoffMenuItemflag0 or - ((`torn_off` shl bp_TGtkTearoffMenuItem_torn_off) and + (int16(`torn_off` shl bp_TGtkTearoffMenuItem_torn_off) and bm_TGtkTearoffMenuItem_torn_off) proc GTK_TYPE_TEXT*(): GType = @@ -15523,18 +15523,18 @@ proc line_wrap*(a: PGtkText): guint = proc set_line_wrap*(a: PGtkText, `line_wrap`: guint) = a.GtkTextflag0 = a.GtkTextflag0 or - ((`line_wrap` shl bp_TGtkText_line_wrap) and bm_TGtkText_line_wrap) + (int16(`line_wrap` shl bp_TGtkText_line_wrap) and bm_TGtkText_line_wrap) proc word_wrap*(a: PGtkText): guint = result = (a . GtkTextflag0 and bm_TGtkText_word_wrap) shr bp_TGtkText_word_wrap proc set_word_wrap*(a: PGtkText, `word_wrap`: guint) = a.GtkTextflag0 = a.GtkTextflag0 or - ((`word_wrap` shl bp_TGtkText_word_wrap) and bm_TGtkText_word_wrap) + (int16(`word_wrap` shl bp_TGtkText_word_wrap) and bm_TGtkText_word_wrap) proc use_wchar*(a: PGtkText): gboolean = result = ((a.GtkTextflag0 and bm_TGtkText_use_wchar) shr bp_TGtkText_use_wchar) > - 0 + 0'i16 proc set_use_wchar*(a: PGtkText, `use_wchar`: gboolean) = if `use_wchar`: @@ -15787,7 +15787,7 @@ proc underline*(a: var TGtkTextAppearance): guint = proc set_underline*(a: var TGtkTextAppearance, `underline`: guint) = a.flag0 = a.flag0 or - ((`underline` shl bp_TGtkTextAppearance_underline) and + (int16(`underline` shl bp_TGtkTextAppearance_underline) and bm_TGtkTextAppearance_underline) proc strikethrough*(a: var TGtkTextAppearance): guint = @@ -15796,7 +15796,7 @@ proc strikethrough*(a: var TGtkTextAppearance): guint = proc set_strikethrough*(a: var TGtkTextAppearance, `strikethrough`: guint) = a.flag0 = a.flag0 or - ((`strikethrough` shl bp_TGtkTextAppearance_strikethrough) and + (int16(`strikethrough` shl bp_TGtkTextAppearance_strikethrough) and bm_TGtkTextAppearance_strikethrough) proc draw_bg*(a: var TGtkTextAppearance): guint = @@ -15805,7 +15805,7 @@ proc draw_bg*(a: var TGtkTextAppearance): guint = proc set_draw_bg*(a: var TGtkTextAppearance, `draw_bg`: guint) = a.flag0 = a.flag0 or - ((`draw_bg` shl bp_TGtkTextAppearance_draw_bg) and + (int16(`draw_bg` shl bp_TGtkTextAppearance_draw_bg) and bm_TGtkTextAppearance_draw_bg) proc inside_selection*(a: var TGtkTextAppearance): guint = @@ -15814,7 +15814,7 @@ proc inside_selection*(a: var TGtkTextAppearance): guint = proc set_inside_selection*(a: var TGtkTextAppearance, `inside_selection`: guint) = a.flag0 = a.flag0 or - ((`inside_selection` shl bp_TGtkTextAppearance_inside_selection) and + (int16(`inside_selection` shl bp_TGtkTextAppearance_inside_selection) and bm_TGtkTextAppearance_inside_selection) proc is_text*(a: var TGtkTextAppearance): guint = @@ -15823,7 +15823,7 @@ proc is_text*(a: var TGtkTextAppearance): guint = proc set_is_text*(a: var TGtkTextAppearance, `is_text`: guint) = a.flag0 = a.flag0 or - ((`is_text` shl bp_TGtkTextAppearance_is_text) and + (int16(`is_text` shl bp_TGtkTextAppearance_is_text) and bm_TGtkTextAppearance_is_text) proc pad1*(a: var TGtkTextAppearance): guint = @@ -15832,7 +15832,7 @@ proc pad1*(a: var TGtkTextAppearance): guint = proc set_pad1*(a: var TGtkTextAppearance, `pad1`: guint) = a.flag0 = a.flag0 or - ((`pad1` shl bp_TGtkTextAppearance_pad1) and bm_TGtkTextAppearance_pad1) + (int16(`pad1` shl bp_TGtkTextAppearance_pad1) and bm_TGtkTextAppearance_pad1) proc pad2*(a: var TGtkTextAppearance): guint = result = (a.flag0 and bm_TGtkTextAppearance_pad2) shr @@ -15840,7 +15840,7 @@ proc pad2*(a: var TGtkTextAppearance): guint = proc set_pad2*(a: var TGtkTextAppearance, `pad2`: guint) = a.flag0 = a.flag0 or - ((`pad2` shl bp_TGtkTextAppearance_pad2) and bm_TGtkTextAppearance_pad2) + (int16(`pad2` shl bp_TGtkTextAppearance_pad2) and bm_TGtkTextAppearance_pad2) proc pad3*(a: var TGtkTextAppearance): guint = result = (a.flag0 and bm_TGtkTextAppearance_pad3) shr @@ -15848,7 +15848,7 @@ proc pad3*(a: var TGtkTextAppearance): guint = proc set_pad3*(a: var TGtkTextAppearance, `pad3`: guint) = a.flag0 = a.flag0 or - ((`pad3` shl bp_TGtkTextAppearance_pad3) and bm_TGtkTextAppearance_pad3) + (int16(`pad3` shl bp_TGtkTextAppearance_pad3) and bm_TGtkTextAppearance_pad3) proc pad4*(a: var TGtkTextAppearance): guint = result = (a.flag0 and bm_TGtkTextAppearance_pad4) shr @@ -15856,7 +15856,7 @@ proc pad4*(a: var TGtkTextAppearance): guint = proc set_pad4*(a: var TGtkTextAppearance, `pad4`: guint) = a.flag0 = a.flag0 or - ((`pad4` shl bp_TGtkTextAppearance_pad4) and bm_TGtkTextAppearance_pad4) + (int16(`pad4` shl bp_TGtkTextAppearance_pad4) and bm_TGtkTextAppearance_pad4) proc invisible*(a: var TGtkTextAttributes): guint = result = (a.flag0 and bm_TGtkTextAttributes_invisible) shr @@ -15864,7 +15864,7 @@ proc invisible*(a: var TGtkTextAttributes): guint = proc set_invisible*(a: var TGtkTextAttributes, `invisible`: guint) = a.flag0 = a.flag0 or - ((`invisible` shl bp_TGtkTextAttributes_invisible) and + (int16(`invisible` shl bp_TGtkTextAttributes_invisible) and bm_TGtkTextAttributes_invisible) proc bg_full_height*(a: var TGtkTextAttributes): guint = @@ -15873,7 +15873,7 @@ proc bg_full_height*(a: var TGtkTextAttributes): guint = proc set_bg_full_height*(a: var TGtkTextAttributes, `bg_full_height`: guint) = a.flag0 = a.flag0 or - ((`bg_full_height` shl bp_TGtkTextAttributes_bg_full_height) and + (int16(`bg_full_height` shl bp_TGtkTextAttributes_bg_full_height) and bm_TGtkTextAttributes_bg_full_height) proc editable*(a: var TGtkTextAttributes): guint = @@ -15882,7 +15882,7 @@ proc editable*(a: var TGtkTextAttributes): guint = proc set_editable*(a: var TGtkTextAttributes, `editable`: guint) = a.flag0 = a.flag0 or - ((`editable` shl bp_TGtkTextAttributes_editable) and + (int16(`editable` shl bp_TGtkTextAttributes_editable) and bm_TGtkTextAttributes_editable) proc realized*(a: var TGtkTextAttributes): guint = @@ -15891,7 +15891,7 @@ proc realized*(a: var TGtkTextAttributes): guint = proc set_realized*(a: var TGtkTextAttributes, `realized`: guint) = a.flag0 = a.flag0 or - ((`realized` shl bp_TGtkTextAttributes_realized) and + (int16(`realized` shl bp_TGtkTextAttributes_realized) and bm_TGtkTextAttributes_realized) proc pad1*(a: var TGtkTextAttributes): guint = @@ -15900,7 +15900,7 @@ proc pad1*(a: var TGtkTextAttributes): guint = proc set_pad1*(a: var TGtkTextAttributes, `pad1`: guint) = a.flag0 = a.flag0 or - ((`pad1` shl bp_TGtkTextAttributes_pad1) and bm_TGtkTextAttributes_pad1) + (int16(`pad1` shl bp_TGtkTextAttributes_pad1) and bm_TGtkTextAttributes_pad1) proc pad2*(a: var TGtkTextAttributes): guint = result = (a.flag0 and bm_TGtkTextAttributes_pad2) shr @@ -15908,7 +15908,7 @@ proc pad2*(a: var TGtkTextAttributes): guint = proc set_pad2*(a: var TGtkTextAttributes, `pad2`: guint) = a.flag0 = a.flag0 or - ((`pad2` shl bp_TGtkTextAttributes_pad2) and bm_TGtkTextAttributes_pad2) + (int16(`pad2` shl bp_TGtkTextAttributes_pad2) and bm_TGtkTextAttributes_pad2) proc pad3*(a: var TGtkTextAttributes): guint = result = (a.flag0 and bm_TGtkTextAttributes_pad3) shr @@ -15916,7 +15916,7 @@ proc pad3*(a: var TGtkTextAttributes): guint = proc set_pad3*(a: var TGtkTextAttributes, `pad3`: guint) = a.flag0 = a.flag0 or - ((`pad3` shl bp_TGtkTextAttributes_pad3) and bm_TGtkTextAttributes_pad3) + (int16(`pad3` shl bp_TGtkTextAttributes_pad3) and bm_TGtkTextAttributes_pad3) proc pad4*(a: var TGtkTextAttributes): guint = result = (a.flag0 and bm_TGtkTextAttributes_pad4) shr @@ -15924,7 +15924,7 @@ proc pad4*(a: var TGtkTextAttributes): guint = proc set_pad4*(a: var TGtkTextAttributes, `pad4`: guint) = a.flag0 = a.flag0 or - ((`pad4` shl bp_TGtkTextAttributes_pad4) and bm_TGtkTextAttributes_pad4) + (int16(`pad4` shl bp_TGtkTextAttributes_pad4) and bm_TGtkTextAttributes_pad4) proc GTK_TYPE_TEXT_TAG_TABLE*(): GType = result = gtk_text_tag_table_get_type() @@ -15970,7 +15970,7 @@ proc visible*(a: var TGtkTextMarkBody): guint = proc set_visible*(a: var TGtkTextMarkBody, `visible`: guint) = a.flag0 = a.flag0 or - ((`visible` shl bp_TGtkTextMarkBody_visible) and + (int16(`visible` shl bp_TGtkTextMarkBody_visible) and bm_TGtkTextMarkBody_visible) proc not_deleteable*(a: var TGtkTextMarkBody): guint = @@ -15979,7 +15979,7 @@ proc not_deleteable*(a: var TGtkTextMarkBody): guint = proc set_not_deleteable*(a: var TGtkTextMarkBody, `not_deleteable`: guint) = a.flag0 = a.flag0 or - ((`not_deleteable` shl bp_TGtkTextMarkBody_not_deleteable) and + (int16(`not_deleteable` shl bp_TGtkTextMarkBody_not_deleteable) and bm_TGtkTextMarkBody_not_deleteable) proc GTK_TYPE_TEXT_CHILD_ANCHOR*(): GType = @@ -16043,7 +16043,7 @@ proc modified*(a: var TGtkTextBuffer): guint = proc set_modified*(a: var TGtkTextBuffer, `modified`: guint) = a.GtkTextBufferflag0 = a.GtkTextBufferflag0 or - ((`modified` shl bp_TGtkTextBuffer_modified) and + (int16(`modified` shl bp_TGtkTextBuffer_modified) and bm_TGtkTextBuffer_modified) proc GTK_TYPE_TEXT_LAYOUT*(): GType = @@ -16072,7 +16072,7 @@ proc cursor_visible*(a: var TGtkTextLayout): guint = proc set_cursor_visible*(a: var TGtkTextLayout, `cursor_visible`: guint) = a.GtkTextLayoutflag0 = a.GtkTextLayoutflag0 or - ((`cursor_visible` shl bp_TGtkTextLayout_cursor_visible) and + (int16(`cursor_visible` shl bp_TGtkTextLayout_cursor_visible) and bm_TGtkTextLayout_cursor_visible) proc cursor_direction*(a: var TGtkTextLayout): gint = @@ -16081,7 +16081,7 @@ proc cursor_direction*(a: var TGtkTextLayout): gint = proc set_cursor_direction*(a: var TGtkTextLayout, `cursor_direction`: gint) = a.GtkTextLayoutflag0 = a.GtkTextLayoutflag0 or - ((`cursor_direction` shl bp_TGtkTextLayout_cursor_direction) and + (int16(`cursor_direction` shl bp_TGtkTextLayout_cursor_direction) and bm_TGtkTextLayout_cursor_direction) proc is_strong*(a: var TGtkTextCursorDisplay): guint = @@ -16090,7 +16090,7 @@ proc is_strong*(a: var TGtkTextCursorDisplay): guint = proc set_is_strong*(a: var TGtkTextCursorDisplay, `is_strong`: guint) = a.flag0 = a.flag0 or - ((`is_strong` shl bp_TGtkTextCursorDisplay_is_strong) and + (int16(`is_strong` shl bp_TGtkTextCursorDisplay_is_strong) and bm_TGtkTextCursorDisplay_is_strong) proc is_weak*(a: var TGtkTextCursorDisplay): guint = @@ -16099,7 +16099,7 @@ proc is_weak*(a: var TGtkTextCursorDisplay): guint = proc set_is_weak*(a: var TGtkTextCursorDisplay, `is_weak`: guint) = a.flag0 = a.flag0 or - ((`is_weak` shl bp_TGtkTextCursorDisplay_is_weak) and + (int16(`is_weak` shl bp_TGtkTextCursorDisplay_is_weak) and bm_TGtkTextCursorDisplay_is_weak) proc GTK_TYPE_TEXT_VIEW*(): GType = @@ -16126,7 +16126,7 @@ proc editable*(a: var TGtkTextView): guint = proc set_editable*(a: var TGtkTextView, `editable`: guint) = a.GtkTextViewflag0 = a.GtkTextViewflag0 or - ((`editable` shl bp_TGtkTextView_editable) and bm_TGtkTextView_editable) + (int16(`editable` shl bp_TGtkTextView_editable) and bm_TGtkTextView_editable) proc overwrite_mode*(a: var TGtkTextView): guint = result = (a.GtkTextViewflag0 and bm_TGtkTextView_overwrite_mode) shr @@ -16134,7 +16134,7 @@ proc overwrite_mode*(a: var TGtkTextView): guint = proc set_overwrite_mode*(a: var TGtkTextView, `overwrite_mode`: guint) = a.GtkTextViewflag0 = a.GtkTextViewflag0 or - ((`overwrite_mode` shl bp_TGtkTextView_overwrite_mode) and + (int16(`overwrite_mode` shl bp_TGtkTextView_overwrite_mode) and bm_TGtkTextView_overwrite_mode) proc cursor_visible*(a: var TGtkTextView): guint = @@ -16143,7 +16143,7 @@ proc cursor_visible*(a: var TGtkTextView): guint = proc set_cursor_visible*(a: var TGtkTextView, `cursor_visible`: guint) = a.GtkTextViewflag0 = a.GtkTextViewflag0 or - ((`cursor_visible` shl bp_TGtkTextView_cursor_visible) and + (int16(`cursor_visible` shl bp_TGtkTextView_cursor_visible) and bm_TGtkTextView_cursor_visible) proc need_im_reset*(a: var TGtkTextView): guint = @@ -16152,7 +16152,7 @@ proc need_im_reset*(a: var TGtkTextView): guint = proc set_need_im_reset*(a: var TGtkTextView, `need_im_reset`: guint) = a.GtkTextViewflag0 = a.GtkTextViewflag0 or - ((`need_im_reset` shl bp_TGtkTextView_need_im_reset) and + (int16(`need_im_reset` shl bp_TGtkTextView_need_im_reset) and bm_TGtkTextView_need_im_reset) proc just_selected_element*(a: var TGtkTextView): guint = @@ -16162,7 +16162,7 @@ proc just_selected_element*(a: var TGtkTextView): guint = proc set_just_selected_element*(a: var TGtkTextView, `just_selected_element`: guint) = a.GtkTextViewflag0 = a.GtkTextViewflag0 or - ((`just_selected_element` shl bp_TGtkTextView_just_selected_element) and + (int16(`just_selected_element` shl bp_TGtkTextView_just_selected_element) and bm_TGtkTextView_just_selected_element) proc disable_scroll_on_focus*(a: var TGtkTextView): guint = @@ -16172,7 +16172,7 @@ proc disable_scroll_on_focus*(a: var TGtkTextView): guint = proc set_disable_scroll_on_focus*(a: var TGtkTextView, `disable_scroll_on_focus`: guint) = a.GtkTextViewflag0 = a.GtkTextViewflag0 or - ((`disable_scroll_on_focus` shl bp_TGtkTextView_disable_scroll_on_focus) and + (int16(`disable_scroll_on_focus` shl bp_TGtkTextView_disable_scroll_on_focus) and bm_TGtkTextView_disable_scroll_on_focus) proc onscreen_validated*(a: var TGtkTextView): guint = @@ -16181,7 +16181,7 @@ proc onscreen_validated*(a: var TGtkTextView): guint = proc set_onscreen_validated*(a: var TGtkTextView, `onscreen_validated`: guint) = a.GtkTextViewflag0 = a.GtkTextViewflag0 or - ((`onscreen_validated` shl bp_TGtkTextView_onscreen_validated) and + (int16(`onscreen_validated` shl bp_TGtkTextView_onscreen_validated) and bm_TGtkTextView_onscreen_validated) proc mouse_cursor_obscured*(a: var TGtkTextView): guint = @@ -16191,7 +16191,7 @@ proc mouse_cursor_obscured*(a: var TGtkTextView): guint = proc set_mouse_cursor_obscured*(a: var TGtkTextView, `mouse_cursor_obscured`: guint) = a.GtkTextViewflag0 = a.GtkTextViewflag0 or - ((`mouse_cursor_obscured` shl bp_TGtkTextView_mouse_cursor_obscured) and + (int16(`mouse_cursor_obscured` shl bp_TGtkTextView_mouse_cursor_obscured) and bm_TGtkTextView_mouse_cursor_obscured) proc GTK_TYPE_TIPS_QUERY*(): GType = @@ -16218,7 +16218,7 @@ proc emit_always*(a: var TGtkTipsQuery): guint = proc set_emit_always*(a: var TGtkTipsQuery, `emit_always`: guint) = a.GtkTipsQueryflag0 = a.GtkTipsQueryflag0 or - ((`emit_always` shl bp_TGtkTipsQuery_emit_always) and + (int16(`emit_always` shl bp_TGtkTipsQuery_emit_always) and bm_TGtkTipsQuery_emit_always) proc in_query*(a: var TGtkTipsQuery): guint = @@ -16227,7 +16227,7 @@ proc in_query*(a: var TGtkTipsQuery): guint = proc set_in_query*(a: var TGtkTipsQuery, `in_query`: guint) = a.GtkTipsQueryflag0 = a.GtkTipsQueryflag0 or - ((`in_query` shl bp_TGtkTipsQuery_in_query) and + (int16(`in_query` shl bp_TGtkTipsQuery_in_query) and bm_TGtkTipsQuery_in_query) proc GTK_TYPE_TOOLTIPS*(): GType = @@ -16304,7 +16304,7 @@ proc style_set*(a: var TGtkToolbar): guint = proc set_style_set*(a: var TGtkToolbar, `style_set`: guint) = a.GtkToolbarflag0 = a.GtkToolbarflag0 or - ((`style_set` shl bp_TGtkToolbar_style_set) and + (int16(`style_set` shl bp_TGtkToolbar_style_set) and bm_TGtkToolbar_style_set) proc icon_size_set*(a: var TGtkToolbar): guint = @@ -16313,7 +16313,7 @@ proc icon_size_set*(a: var TGtkToolbar): guint = proc set_icon_size_set*(a: var TGtkToolbar, `icon_size_set`: guint) = a.GtkToolbarflag0 = a.GtkToolbarflag0 or - ((`icon_size_set` shl bp_TGtkToolbar_icon_size_set) and + (int16(`icon_size_set` shl bp_TGtkToolbar_icon_size_set) and bm_TGtkToolbar_icon_size_set) proc GTK_TYPE_TREE*(): GType = @@ -16350,7 +16350,7 @@ proc selection_mode*(a: var TGtkTree): guint = proc set_selection_mode*(a: var TGtkTree, `selection_mode`: guint) = a.GtkTreeflag0 = a.GtkTreeflag0 or - ((`selection_mode` shl bp_TGtkTree_selection_mode) and + (int16(`selection_mode` shl bp_TGtkTree_selection_mode) and bm_TGtkTree_selection_mode) proc view_mode*(a: var TGtkTree): guint = @@ -16358,14 +16358,14 @@ proc view_mode*(a: var TGtkTree): guint = proc set_view_mode*(a: var TGtkTree, `view_mode`: guint) = a.GtkTreeflag0 = a.GtkTreeflag0 or - ((`view_mode` shl bp_TGtkTree_view_mode) and bm_TGtkTree_view_mode) + (int16(`view_mode` shl bp_TGtkTree_view_mode) and bm_TGtkTree_view_mode) proc view_line*(a: var TGtkTree): guint = result = (a.GtkTreeflag0 and bm_TGtkTree_view_line) shr bp_TGtkTree_view_line proc set_view_line*(a: var TGtkTree, `view_line`: guint) = a.GtkTreeflag0 = a.GtkTreeflag0 or - ((`view_line` shl bp_TGtkTree_view_line) and bm_TGtkTree_view_line) + (int16(`view_line` shl bp_TGtkTree_view_line) and bm_TGtkTree_view_line) proc GTK_TYPE_TREE_DRAG_SOURCE*(): GType = result = gtk_tree_drag_source_get_type() @@ -16422,7 +16422,7 @@ proc expanded*(a: var TGtkTreeItem): guint = proc set_expanded*(a: var TGtkTreeItem, `expanded`: guint) = a.GtkTreeItemflag0 = a.GtkTreeItemflag0 or - ((`expanded` shl bp_TGtkTreeItem_expanded) and bm_TGtkTreeItem_expanded) + (int16(`expanded` shl bp_TGtkTreeItem_expanded) and bm_TGtkTreeItem_expanded) proc GTK_TYPE_TREE_SELECTION*(): GType = result = gtk_tree_selection_get_type() @@ -16468,7 +16468,7 @@ proc columns_dirty*(a: var TGtkTreeStore): guint = proc set_columns_dirty*(a: var TGtkTreeStore, `columns_dirty`: guint) = a.GtkTreeStoreflag0 = a.GtkTreeStoreflag0 or - ((`columns_dirty` shl bp_TGtkTreeStore_columns_dirty) and + (int16(`columns_dirty` shl bp_TGtkTreeStore_columns_dirty) and bm_TGtkTreeStore_columns_dirty) proc GTK_TYPE_TREE_VIEW_COLUMN*(): GType = @@ -16497,7 +16497,7 @@ proc visible*(a: var TGtkTreeViewColumn): guint = proc set_visible*(a: var TGtkTreeViewColumn, `visible`: guint) = a.GtkTreeViewColumnflag0 = a.GtkTreeViewColumnflag0 or - ((`visible` shl bp_TGtkTreeViewColumn_visible) and + (int16(`visible` shl bp_TGtkTreeViewColumn_visible) and bm_TGtkTreeViewColumn_visible) proc resizable*(a: var TGtkTreeViewColumn): guint = @@ -16506,7 +16506,7 @@ proc resizable*(a: var TGtkTreeViewColumn): guint = proc set_resizable*(a: var TGtkTreeViewColumn, `resizable`: guint) = a.GtkTreeViewColumnflag0 = a.GtkTreeViewColumnflag0 or - ((`resizable` shl bp_TGtkTreeViewColumn_resizable) and + (int16(`resizable` shl bp_TGtkTreeViewColumn_resizable) and bm_TGtkTreeViewColumn_resizable) proc clickable*(a: var TGtkTreeViewColumn): guint = @@ -16515,7 +16515,7 @@ proc clickable*(a: var TGtkTreeViewColumn): guint = proc set_clickable*(a: var TGtkTreeViewColumn, `clickable`: guint) = a.GtkTreeViewColumnflag0 = a.GtkTreeViewColumnflag0 or - ((`clickable` shl bp_TGtkTreeViewColumn_clickable) and + (int16(`clickable` shl bp_TGtkTreeViewColumn_clickable) and bm_TGtkTreeViewColumn_clickable) proc dirty*(a: var TGtkTreeViewColumn): guint = @@ -16524,7 +16524,7 @@ proc dirty*(a: var TGtkTreeViewColumn): guint = proc set_dirty*(a: var TGtkTreeViewColumn, `dirty`: guint) = a.GtkTreeViewColumnflag0 = a.GtkTreeViewColumnflag0 or - ((`dirty` shl bp_TGtkTreeViewColumn_dirty) and + (int16(`dirty` shl bp_TGtkTreeViewColumn_dirty) and bm_TGtkTreeViewColumn_dirty) proc show_sort_indicator*(a: var TGtkTreeViewColumn): guint = @@ -16534,7 +16534,7 @@ proc show_sort_indicator*(a: var TGtkTreeViewColumn): guint = proc set_show_sort_indicator*(a: var TGtkTreeViewColumn, `show_sort_indicator`: guint) = a.GtkTreeViewColumnflag0 = a.GtkTreeViewColumnflag0 or - ((`show_sort_indicator` shl bp_TGtkTreeViewColumn_show_sort_indicator) and + (int16(`show_sort_indicator` shl bp_TGtkTreeViewColumn_show_sort_indicator) and bm_TGtkTreeViewColumn_show_sort_indicator) proc maybe_reordered*(a: var TGtkTreeViewColumn): guint = @@ -16543,7 +16543,7 @@ proc maybe_reordered*(a: var TGtkTreeViewColumn): guint = proc set_maybe_reordered*(a: var TGtkTreeViewColumn, `maybe_reordered`: guint) = a.GtkTreeViewColumnflag0 = a.GtkTreeViewColumnflag0 or - ((`maybe_reordered` shl bp_TGtkTreeViewColumn_maybe_reordered) and + (int16(`maybe_reordered` shl bp_TGtkTreeViewColumn_maybe_reordered) and bm_TGtkTreeViewColumn_maybe_reordered) proc reorderable*(a: var TGtkTreeViewColumn): guint = @@ -16552,7 +16552,7 @@ proc reorderable*(a: var TGtkTreeViewColumn): guint = proc set_reorderable*(a: var TGtkTreeViewColumn, `reorderable`: guint) = a.GtkTreeViewColumnflag0 = a.GtkTreeViewColumnflag0 or - ((`reorderable` shl bp_TGtkTreeViewColumn_reorderable) and + (int16(`reorderable` shl bp_TGtkTreeViewColumn_reorderable) and bm_TGtkTreeViewColumn_reorderable) proc use_resized_width*(a: var TGtkTreeViewColumn): guint = @@ -16562,7 +16562,7 @@ proc use_resized_width*(a: var TGtkTreeViewColumn): guint = proc set_use_resized_width*(a: var TGtkTreeViewColumn, `use_resized_width`: guint) = a.GtkTreeViewColumnflag0 = a.GtkTreeViewColumnflag0 or - ((`use_resized_width` shl bp_TGtkTreeViewColumn_use_resized_width) and + (int16(`use_resized_width` shl bp_TGtkTreeViewColumn_use_resized_width) and bm_TGtkTreeViewColumn_use_resized_width) proc flags*(a: PGtkRBNode): guint = @@ -16570,19 +16570,19 @@ proc flags*(a: PGtkRBNode): guint = proc set_flags*(a: PGtkRBNode, `flags`: guint) = a . flag0 = a . - flag0 or ((`flags` shl bp_TGtkRBNode_flags) and bm_TGtkRBNode_flags) + flag0 or (int16(`flags` shl bp_TGtkRBNode_flags) and bm_TGtkRBNode_flags) proc parity*(a: PGtkRBNode): guint = result = (a . flag0 and bm_TGtkRBNode_parity) shr bp_TGtkRBNode_parity proc set_parity*(a: PGtkRBNode, `parity`: guint) = a . flag0 = a . - flag0 or ((`parity` shl bp_TGtkRBNode_parity) and bm_TGtkRBNode_parity) + flag0 or (int16(`parity` shl bp_TGtkRBNode_parity) and bm_TGtkRBNode_parity) proc GTK_RBNODE_GET_COLOR*(node_: PGtkRBNode): guint = if node_ == nil: Result = GTK_RBNODE_BLACK - elif (flags(node_) and GTK_RBNODE_RED) == GTK_RBNODE_RED: + elif (int(flags(node_)) and GTK_RBNODE_RED) == GTK_RBNODE_RED: Result = GTK_RBNODE_RED else: Result = GTK_RBNODE_BLACK @@ -16590,8 +16590,8 @@ proc GTK_RBNODE_GET_COLOR*(node_: PGtkRBNode): guint = proc GTK_RBNODE_SET_COLOR*(node_: PGtkRBNode, color: guint) = if node_ == nil: return - if ((flags(node_) and int(color)) != color): - set_flags(node_, flags(node_) xor (GTK_RBNODE_RED or GTK_RBNODE_BLACK)) + if ((flags(node_) and (color)) != color): + set_flags(node_, flags(node_) xor cint(GTK_RBNODE_RED or GTK_RBNODE_BLACK)) proc GTK_RBNODE_GET_HEIGHT*(node_: PGtkRBNode): gint = var if_local1: gint @@ -16599,19 +16599,19 @@ proc GTK_RBNODE_GET_HEIGHT*(node_: PGtkRBNode): gint = if_local1 = node_.children.root.offset else: if_local1 = 0 - result = node_.offset - (int(node_.left.offset) + node_.right.offset + if_local1) + result = node_.offset - ((node_.left.offset) + node_.right.offset + if_local1) proc GTK_RBNODE_FLAG_SET*(node_: PGtkRBNode, flag: guint): bool = - result = (node_ != nil) and ((flags(node_) and int(flag)) == flag) + result = (node_ != nil) and ((flags(node_) and (flag)) == flag) proc GTK_RBNODE_SET_FLAG*(node_: PGtkRBNode, flag: guint16) = - set_flags(node_, int(flag) or flags(node_)) + set_flags(node_, (flag) or flags(node_)) proc GTK_RBNODE_UNSET_FLAG*(node_: PGtkRBNode, flag: guint16) = - set_flags(node_, (not int(flag)) and flags(node_)) + set_flags(node_, (not (flag)) and flags(node_)) proc GTK_TREE_VIEW_FLAG_SET*(tree_view: PGtkTreeView, flag: guint): bool = - result = ((tree_view.priv.flags) and int(flag)) == flag + result = ((tree_view.priv.flags) and (flag)) == flag proc TREE_VIEW_HEADER_HEIGHT*(tree_view: PGtkTreeView): int32 = var if_local1: int32 @@ -16623,23 +16623,22 @@ proc TREE_VIEW_HEADER_HEIGHT*(tree_view: PGtkTreeView): int32 = proc TREE_VIEW_COLUMN_REQUESTED_WIDTH*(column: PGtkTreeViewColumn): int32 = var MinWidth, MaxWidth: int - if column . min_width != - 1: - MinWidth = column . min_width + if column.min_width != -1'i32: + MinWidth = column.min_width else: - MinWidth = column . requested_width - if column . max_width != - 1: - MaxWidth = column . max_width + MinWidth = column.requested_width + if column.max_width != - 1'i32: + MaxWidth = column.max_width else: - MaxWidth = column . requested_width - result = CLAMP(column . requested_width, MinWidth, - MaxWidth) + MaxWidth = column.requested_width + result = CLAMP(column.requested_width, MinWidth, MaxWidth) proc TREE_VIEW_DRAW_EXPANDERS*(tree_view: PGtkTreeView): bool = result = (not (GTK_TREE_VIEW_FLAG_SET(tree_view, GTK_TREE_VIEW_IS_LIST))) and (GTK_TREE_VIEW_FLAG_SET(tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS)) proc TREE_VIEW_COLUMN_DRAG_DEAD_MULTIPLIER*(tree_view: PGtkTreeView): int32 = - result = 10 * (TREE_VIEW_HEADER_HEIGHT(tree_view)) + result = 10'i32 * (TREE_VIEW_HEADER_HEIGHT(tree_view)) proc scroll_to_use_align*(a: var TGtkTreeViewPrivate): guint = result = (a.flag0 and bm_TGtkTreeViewPrivate_scroll_to_use_align) shr @@ -16648,7 +16647,7 @@ proc scroll_to_use_align*(a: var TGtkTreeViewPrivate): guint = proc set_scroll_to_use_align*(a: var TGtkTreeViewPrivate, `scroll_to_use_align`: guint) = a.flag0 = a.flag0 or - ((`scroll_to_use_align` shl bp_TGtkTreeViewPrivate_scroll_to_use_align) and + (int16(`scroll_to_use_align` shl bp_TGtkTreeViewPrivate_scroll_to_use_align) and bm_TGtkTreeViewPrivate_scroll_to_use_align) proc fixed_height_check*(a: var TGtkTreeViewPrivate): guint = @@ -16658,7 +16657,7 @@ proc fixed_height_check*(a: var TGtkTreeViewPrivate): guint = proc set_fixed_height_check*(a: var TGtkTreeViewPrivate, `fixed_height_check`: guint) = a.flag0 = a.flag0 or - ((`fixed_height_check` shl bp_TGtkTreeViewPrivate_fixed_height_check) and + (int16(`fixed_height_check` shl bp_TGtkTreeViewPrivate_fixed_height_check) and bm_TGtkTreeViewPrivate_fixed_height_check) proc reorderable*(a: var TGtkTreeViewPrivate): guint = @@ -16667,7 +16666,7 @@ proc reorderable*(a: var TGtkTreeViewPrivate): guint = proc set_reorderable*(a: var TGtkTreeViewPrivate, `reorderable`: guint) = a.flag0 = a.flag0 or - ((`reorderable` shl bp_TGtkTreeViewPrivate_reorderable) and + (int16(`reorderable` shl bp_TGtkTreeViewPrivate_reorderable) and bm_TGtkTreeViewPrivate_reorderable) proc header_has_focus*(a: var TGtkTreeViewPrivate): guint = @@ -16676,7 +16675,7 @@ proc header_has_focus*(a: var TGtkTreeViewPrivate): guint = proc set_header_has_focus*(a: var TGtkTreeViewPrivate, `header_has_focus`: guint) = a.flag0 = a.flag0 or - ((`header_has_focus` shl bp_TGtkTreeViewPrivate_header_has_focus) and + (int16(`header_has_focus` shl bp_TGtkTreeViewPrivate_header_has_focus) and bm_TGtkTreeViewPrivate_header_has_focus) proc drag_column_window_state*(a: var TGtkTreeViewPrivate): guint = @@ -16686,7 +16685,7 @@ proc drag_column_window_state*(a: var TGtkTreeViewPrivate): guint = proc set_drag_column_window_state*(a: var TGtkTreeViewPrivate, `drag_column_window_state`: guint) = a.flag0 = a.flag0 or - ((`drag_column_window_state` shl + (int16(`drag_column_window_state` shl bp_TGtkTreeViewPrivate_drag_column_window_state) and bm_TGtkTreeViewPrivate_drag_column_window_state) @@ -16696,7 +16695,7 @@ proc has_rules*(a: var TGtkTreeViewPrivate): guint = proc set_has_rules*(a: var TGtkTreeViewPrivate, `has_rules`: guint) = a.flag0 = a.flag0 or - ((`has_rules` shl bp_TGtkTreeViewPrivate_has_rules) and + (int16(`has_rules` shl bp_TGtkTreeViewPrivate_has_rules) and bm_TGtkTreeViewPrivate_has_rules) proc mark_rows_col_dirty*(a: var TGtkTreeViewPrivate): guint = @@ -16706,7 +16705,7 @@ proc mark_rows_col_dirty*(a: var TGtkTreeViewPrivate): guint = proc set_mark_rows_col_dirty*(a: var TGtkTreeViewPrivate, `mark_rows_col_dirty`: guint) = a.flag0 = a.flag0 or - ((`mark_rows_col_dirty` shl bp_TGtkTreeViewPrivate_mark_rows_col_dirty) and + (int16(`mark_rows_col_dirty` shl bp_TGtkTreeViewPrivate_mark_rows_col_dirty) and bm_TGtkTreeViewPrivate_mark_rows_col_dirty) proc enable_search*(a: var TGtkTreeViewPrivate): guint = @@ -16715,7 +16714,7 @@ proc enable_search*(a: var TGtkTreeViewPrivate): guint = proc set_enable_search*(a: var TGtkTreeViewPrivate, `enable_search`: guint) = a.flag0 = a.flag0 or - ((`enable_search` shl bp_TGtkTreeViewPrivate_enable_search) and + (int16(`enable_search` shl bp_TGtkTreeViewPrivate_enable_search) and bm_TGtkTreeViewPrivate_enable_search) proc disable_popdown*(a: var TGtkTreeViewPrivate): guint = @@ -16724,14 +16723,14 @@ proc disable_popdown*(a: var TGtkTreeViewPrivate): guint = proc set_disable_popdown*(a: var TGtkTreeViewPrivate, `disable_popdown`: guint) = a.flag0 = a.flag0 or - ((`disable_popdown` shl bp_TGtkTreeViewPrivate_disable_popdown) and + (int16(`disable_popdown` shl bp_TGtkTreeViewPrivate_disable_popdown) and bm_TGtkTreeViewPrivate_disable_popdown) proc GTK_TREE_VIEW_SET_FLAG*(tree_view: PGtkTreeView, flag: guint) = - tree_view . priv . flags = tree_view . priv . flags or int(flag) + tree_view . priv . flags = tree_view . priv . flags or (flag) proc GTK_TREE_VIEW_UNSET_FLAG*(tree_view: PGtkTreeView, flag: guint) = - tree_view . priv . flags = tree_view . priv . flags and not int(flag) + tree_view . priv . flags = tree_view . priv . flags and not (flag) proc GTK_TYPE_TREE_VIEW*(): GType = result = gtk_tree_view_get_type() diff --git a/lib/base/gtk/libglade2.nim b/lib/base/gtk/libglade2.nim index 18e76584b..cc90b0623 100644 --- a/lib/base/gtk/libglade2.nim +++ b/lib/base/gtk/libglade2.nim @@ -1,14 +1,13 @@ -import +import glib2, gtk2 -when defined(win32): - {.define: gtkwin.} - const +when defined(win32): + const LibGladeLib = "libglade-2.0-0.dll" -else: - const +else: + const LibGladeLib = "libglade-2.0.so" -type +type PLongint* = ptr int32 PSmallInt* = ptr int16 PByte* = ptr int8 @@ -17,11 +16,11 @@ type PDouble* = ptr float64 proc glade_init*(){.cdecl, dynlib: LibGladeLib, importc: "glade_init".} -proc glade_require*(TheLibrary: cstring){.cdecl, dynlib: LibGladeLib, +proc glade_require*(TheLibrary: cstring){.cdecl, dynlib: LibGladeLib, importc: "glade_require".} -proc glade_provide*(TheLibrary: cstring){.cdecl, dynlib: LibGladeLib, +proc glade_provide*(TheLibrary: cstring){.cdecl, dynlib: LibGladeLib, importc: "glade_provide".} -type +type PGladeXMLPrivate* = pointer PGladeXML* = ptr TGladeXML TGladeXML* = object of TGObject @@ -31,9 +30,9 @@ type PGladeXMLClass* = ptr TGladeXMLClass TGladeXMLClass* = object of TGObjectClass - TGladeXMLConnectFunc* = proc (handler_name: cstring, anObject: PGObject, - signal_name: cstring, signal_data: cstring, - connect_object: PGObject, after: gboolean, + TGladeXMLConnectFunc* = proc (handler_name: cstring, anObject: PGObject, + signal_name: cstring, signal_data: cstring, + connect_object: PGObject, after: gboolean, user_data: gpointer){.cdecl.} proc GLADE_TYPE_XML*(): GType @@ -42,76 +41,76 @@ proc GLADE_XML_CLASS*(klass: pointer): PGladeXMLClass proc GLADE_IS_XML*(obj: pointer): gboolean proc GLADE_IS_XML_CLASS*(klass: pointer): gboolean proc GLADE_XML_GET_CLASS*(obj: pointer): PGladeXMLClass -proc glade_xml_get_type*(): GType{.cdecl, dynlib: LibGladeLib, +proc glade_xml_get_type*(): GType{.cdecl, dynlib: LibGladeLib, importc: "glade_xml_get_type".} proc glade_xml_new*(fname: cstring, root: cstring, domain: cstring): PGladeXML{. cdecl, dynlib: LibGladeLib, importc: "glade_xml_new".} -proc glade_xml_new_from_buffer*(buffer: cstring, size: int32, root: cstring, - domain: cstring): PGladeXML{.cdecl, +proc glade_xml_new_from_buffer*(buffer: cstring, size: int32, root: cstring, + domain: cstring): PGladeXML{.cdecl, dynlib: LibGladeLib, importc: "glade_xml_new_from_buffer".} -proc glade_xml_construct*(self: PGladeXML, fname: cstring, root: cstring, - domain: cstring): gboolean{.cdecl, +proc glade_xml_construct*(self: PGladeXML, fname: cstring, root: cstring, + domain: cstring): gboolean{.cdecl, dynlib: LibGladeLib, importc: "glade_xml_construct".} -proc glade_xml_signal_connect*(self: PGladeXML, handlername: cstring, - func: TGCallback){.cdecl, dynlib: LibGladeLib, +proc glade_xml_signal_connect*(self: PGladeXML, handlername: cstring, + func: TGCallback){.cdecl, dynlib: LibGladeLib, importc: "glade_xml_signal_connect".} -proc glade_xml_signal_connect_data*(self: PGladeXML, handlername: cstring, +proc glade_xml_signal_connect_data*(self: PGladeXML, handlername: cstring, func: TGCallback, user_data: gpointer){. cdecl, dynlib: LibGladeLib, importc: "glade_xml_signal_connect_data".} -proc glade_xml_signal_autoconnect*(self: PGladeXML){.cdecl, dynlib: LibGladeLib, +proc glade_xml_signal_autoconnect*(self: PGladeXML){.cdecl, dynlib: LibGladeLib, importc: "glade_xml_signal_autoconnect".} -proc glade_xml_signal_connect_full*(self: PGladeXML, handler_name: cstring, - func: TGladeXMLConnectFunc, - user_data: gpointer){.cdecl, +proc glade_xml_signal_connect_full*(self: PGladeXML, handler_name: cstring, + func: TGladeXMLConnectFunc, + user_data: gpointer){.cdecl, dynlib: LibGladeLib, importc: "glade_xml_signal_connect_full".} -proc glade_xml_signal_autoconnect_full*(self: PGladeXML, - func: TGladeXMLConnectFunc, - user_data: gpointer){.cdecl, +proc glade_xml_signal_autoconnect_full*(self: PGladeXML, + func: TGladeXMLConnectFunc, + user_data: gpointer){.cdecl, dynlib: LibGladeLib, importc: "glade_xml_signal_autoconnect_full".} -proc glade_xml_get_widget*(self: PGladeXML, name: cstring): PGtkWidget{.cdecl, +proc glade_xml_get_widget*(self: PGladeXML, name: cstring): PGtkWidget{.cdecl, dynlib: LibGladeLib, importc: "glade_xml_get_widget".} proc glade_xml_get_widget_prefix*(self: PGladeXML, name: cstring): PGList{. cdecl, dynlib: LibGladeLib, importc: "glade_xml_get_widget_prefix".} -proc glade_xml_relative_file*(self: PGladeXML, filename: cstring): cstring{.cdecl, +proc glade_xml_relative_file*(self: PGladeXML, filename: cstring): cstring{.cdecl, dynlib: LibGladeLib, importc: "glade_xml_relative_file".} -proc glade_get_widget_name*(widget: PGtkWidget): cstring{.cdecl, +proc glade_get_widget_name*(widget: PGtkWidget): cstring{.cdecl, dynlib: LibGladeLib, importc: "glade_get_widget_name".} -proc glade_get_widget_tree*(widget: PGtkWidget): PGladeXML{.cdecl, +proc glade_get_widget_tree*(widget: PGtkWidget): PGladeXML{.cdecl, dynlib: LibGladeLib, importc: "glade_get_widget_tree".} -type +type PGladeXMLCustomWidgetHandler* = ptr TGladeXMLCustomWidgetHandler TGladeXMLCustomWidgetHandler* = TGtkWidget -proc glade_set_custom_handler*(handler: TGladeXMLCustomWidgetHandler, - user_data: gpointer){.cdecl, dynlib: LibGladeLib, +proc glade_set_custom_handler*(handler: TGladeXMLCustomWidgetHandler, + user_data: gpointer){.cdecl, dynlib: LibGladeLib, importc: "glade_set_custom_handler".} -proc glade_gnome_init*() = +proc glade_gnome_init*() = glade_init() -proc glade_bonobo_init*() = +proc glade_bonobo_init*() = glade_init() -proc glade_xml_new_with_domain*(fname: cstring, root: cstring, domain: cstring): PGladeXML = +proc glade_xml_new_with_domain*(fname: cstring, root: cstring, domain: cstring): PGladeXML = result = glade_xml_new(fname, root, domain) -proc glade_xml_new_from_memory*(buffer: cstring, size: int32, root: cstring, - domain: cstring): PGladeXML = +proc glade_xml_new_from_memory*(buffer: cstring, size: int32, root: cstring, + domain: cstring): PGladeXML = result = glade_xml_new_from_buffer(buffer, size, root, domain) -proc GLADE_TYPE_XML*(): GType = +proc GLADE_TYPE_XML*(): GType = result = glade_xml_get_type() -proc GLADE_XML*(obj: pointer): PGladeXML = +proc GLADE_XML*(obj: pointer): PGladeXML = result = cast[PGladeXML](G_TYPE_CHECK_INSTANCE_CAST(obj, GLADE_TYPE_XML())) -proc GLADE_XML_CLASS*(klass: pointer): PGladeXMLClass = +proc GLADE_XML_CLASS*(klass: pointer): PGladeXMLClass = result = cast[PGladeXMLClass](G_TYPE_CHECK_CLASS_CAST(klass, GLADE_TYPE_XML())) -proc GLADE_IS_XML*(obj: pointer): gboolean = +proc GLADE_IS_XML*(obj: pointer): gboolean = result = G_TYPE_CHECK_INSTANCE_TYPE(obj, GLADE_TYPE_XML()) -proc GLADE_IS_XML_CLASS*(klass: pointer): gboolean = +proc GLADE_IS_XML_CLASS*(klass: pointer): gboolean = result = G_TYPE_CHECK_CLASS_TYPE(klass, GLADE_TYPE_XML()) -proc GLADE_XML_GET_CLASS*(obj: pointer): PGladeXMLClass = +proc GLADE_XML_GET_CLASS*(obj: pointer): PGladeXMLClass = result = cast[PGladeXMLClass](G_TYPE_INSTANCE_GET_CLASS(obj, GLADE_TYPE_XML())) diff --git a/lib/base/gtk/pango.nim b/lib/base/gtk/pango.nim index 142ab4aa2..363d02cd6 100644 --- a/lib/base/gtk/pango.nim +++ b/lib/base/gtk/pango.nim @@ -1,21 +1,18 @@ -import +import glib2 -{.define: PANGO_ENABLE_ENGINE.} -{.define: PANGO_ENABLE_BACKEND.} -when defined(win32): - {.define: pangowin.} - const +when defined(win32): + const pangolib* = "libpango-1.0-0.dll" -else: - const +else: + const pangolib* = "libpango-1.0.so.0" -type +type PPangoFont* = pointer PPangoFontFamily* = pointer PPangoFontset* = pointer PPangoFontMetrics* = pointer - PPangoFontFace* = pointer + PPangoFontFace* = pointer PPangoFontMap* = pointer PPangoFontsetClass* = pointer PPangoFontFamilyClass* = pointer @@ -50,18 +47,18 @@ type PPangoGlyph* = ptr TPangoGlyph TPangoGlyph* = guint32 PPangoRectangle* = ptr TPangoRectangle - TPangoRectangle* {.final.} = object + TPangoRectangle* {.final.} = object x*: int32 y*: int32 width*: int32 height*: int32 PPangoDirection* = ptr TPangoDirection - TPangoDirection* = enum - PANGO_DIRECTION_LTR, PANGO_DIRECTION_RTL, PANGO_DIRECTION_TTB_LTR, + TPangoDirection* = enum + PANGO_DIRECTION_LTR, PANGO_DIRECTION_RTL, PANGO_DIRECTION_TTB_LTR, PANGO_DIRECTION_TTB_RTL PPangoColor* = ptr TPangoColor - TPangoColor* {.final.} = object + TPangoColor* {.final.} = object red*: guint16 green*: guint16 blue*: guint16 @@ -72,12 +69,12 @@ type TPangoUnderline* = int32 PPangoAttribute* = ptr TPangoAttribute PPangoAttrClass* = ptr TPangoAttrClass - TPangoAttribute* {.final.} = object + TPangoAttribute* {.final.} = object klass*: PPangoAttrClass start_index*: int end_index*: int - TPangoAttrClass* {.final.} = object + TPangoAttrClass* {.final.} = object `type`*: TPangoAttrType copy*: proc (attr: PPangoAttribute): PPangoAttribute{.cdecl.} destroy*: proc (attr: PPangoAttribute){.cdecl.} @@ -85,69 +82,69 @@ type cdecl.} PPangoAttrString* = ptr TPangoAttrString - TPangoAttrString* {.final.} = object + TPangoAttrString* {.final.} = object attr*: TPangoAttribute value*: cstring PPangoAttrLanguage* = ptr TPangoAttrLanguage - TPangoAttrLanguage* {.final.} = object + TPangoAttrLanguage* {.final.} = object attr*: TPangoAttribute value*: PPangoLanguage PPangoAttrInt* = ptr TPangoAttrInt - TPangoAttrInt* {.final.} = object + TPangoAttrInt* {.final.} = object attr*: TPangoAttribute value*: int32 PPangoAttrFloat* = ptr TPangoAttrFloat - TPangoAttrFloat* {.final.} = object + TPangoAttrFloat* {.final.} = object attr*: TPangoAttribute value*: gdouble PPangoAttrColor* = ptr TPangoAttrColor - TPangoAttrColor* {.final.} = object + TPangoAttrColor* {.final.} = object attr*: TPangoAttribute color*: TPangoColor PPangoAttrShape* = ptr TPangoAttrShape - TPangoAttrShape* {.final.} = object + TPangoAttrShape* {.final.} = object attr*: TPangoAttribute ink_rect*: TPangoRectangle logical_rect*: TPangoRectangle PPangoAttrFontDesc* = ptr TPangoAttrFontDesc - TPangoAttrFontDesc* {.final.} = object + TPangoAttrFontDesc* {.final.} = object attr*: TPangoAttribute desc*: PPangoFontDescription PPangoLogAttr* = ptr TPangoLogAttr - TPangoLogAttr* {.final.} = object + TPangoLogAttr* {.final.} = object flag0*: guint16 PPangoCoverageLevel* = ptr TPangoCoverageLevel - TPangoCoverageLevel* = enum - PANGO_COVERAGE_NONE, PANGO_COVERAGE_FALLBACK, PANGO_COVERAGE_APPROXIMATE, + TPangoCoverageLevel* = enum + PANGO_COVERAGE_NONE, PANGO_COVERAGE_FALLBACK, PANGO_COVERAGE_APPROXIMATE, PANGO_COVERAGE_EXACT PPangoBlockInfo* = ptr TPangoBlockInfo - TPangoBlockInfo* {.final.} = object + TPangoBlockInfo* {.final.} = object data*: Pguchar level*: TPangoCoverageLevel PPangoCoverage* = ptr TPangoCoverage - TPangoCoverage* {.final.} = object + TPangoCoverage* {.final.} = object ref_count*: int n_blocks*: int32 data_size*: int32 blocks*: PPangoBlockInfo PPangoEngineRange* = ptr TPangoEngineRange - TPangoEngineRange* {.final.} = object + TPangoEngineRange* {.final.} = object start*: int32 theEnd*: int32 langs*: cstring PPangoEngineInfo* = ptr TPangoEngineInfo - TPangoEngineInfo* {.final.} = object + TPangoEngineInfo* {.final.} = object id*: cstring engine_type*: cstring render_type*: cstring @@ -155,28 +152,28 @@ type n_ranges*: gint PPangoEngine* = ptr TPangoEngine - TPangoEngine* {.final.} = object + TPangoEngine* {.final.} = object id*: cstring `type`*: cstring length*: gint - TPangoEngineLangScriptBreak* = proc (text: cstring, len: int32, - analysis: PPangoAnalysis, + TPangoEngineLangScriptBreak* = proc (text: cstring, len: int32, + analysis: PPangoAnalysis, attrs: PPangoLogAttr, attrs_len: int32){. cdecl.} PPangoEngineLang* = ptr TPangoEngineLang - TPangoEngineLang* {.final.} = object + TPangoEngineLang* {.final.} = object engine*: TPangoEngine script_break*: TPangoEngineLangScriptBreak - TPangoEngineShapeScript* = proc (font: PPangoFont, text: cstring, - length: int32, analysis: PPangoAnalysis, + TPangoEngineShapeScript* = proc (font: PPangoFont, text: cstring, + length: int32, analysis: PPangoAnalysis, glyphs: PPangoGlyphString){.cdecl.} - TPangoEngineShapeGetCoverage* = proc (font: PPangoFont, + TPangoEngineShapeGetCoverage* = proc (font: PPangoFont, language: PPangoLanguage): PPangoCoverage{. cdecl.} PPangoEngineShape* = ptr TPangoEngineShape - TPangoEngineShape* {.final.} = object + TPangoEngineShape* {.final.} = object engine*: TPangoEngine script_shape*: TPangoEngineShapeScript get_coverage*: TPangoEngineShapeGetCoverage @@ -194,28 +191,28 @@ type PPangoGlyphUnit* = ptr TPangoGlyphUnit TPangoGlyphUnit* = gint32 PPangoGlyphGeometry* = ptr TPangoGlyphGeometry - TPangoGlyphGeometry* {.final.} = object + TPangoGlyphGeometry* {.final.} = object width*: TPangoGlyphUnit x_offset*: TPangoGlyphUnit y_offset*: TPangoGlyphUnit PPangoGlyphVisAttr* = ptr TPangoGlyphVisAttr - TPangoGlyphVisAttr* {.final.} = object + TPangoGlyphVisAttr* {.final.} = object flag0*: int16 PPangoGlyphInfo* = ptr TPangoGlyphInfo - TPangoGlyphInfo* {.final.} = object + TPangoGlyphInfo* {.final.} = object glyph*: TPangoGlyph geometry*: TPangoGlyphGeometry attr*: TPangoGlyphVisAttr - TPangoGlyphString* {.final.} = object + TPangoGlyphString* {.final.} = object num_glyphs*: gint glyphs*: PPangoGlyphInfo log_clusters*: Pgint space*: gint - TPangoAnalysis* {.final.} = object + TPangoAnalysis* {.final.} = object shape_engine*: PPangoEngineShape lang_engine*: PPangoEngineLang font*: PPangoFont @@ -223,35 +220,35 @@ type language*: PPangoLanguage extra_attrs*: PGSList - TPangoItem* {.final.} = object + TPangoItem* {.final.} = object offset*: gint length*: gint num_chars*: gint analysis*: TPangoAnalysis PPangoAlignment* = ptr TPangoAlignment - TPangoAlignment* = enum + TPangoAlignment* = enum PANGO_ALIGN_LEFT, PANGO_ALIGN_CENTER, PANGO_ALIGN_RIGHT PPangoWrapMode* = ptr TPangoWrapMode - TPangoWrapMode* = enum + TPangoWrapMode* = enum PANGO_WRAP_WORD, PANGO_WRAP_CHAR PPangoLayoutLine* = ptr TPangoLayoutLine - TPangoLayoutLine* {.final.} = object + TPangoLayoutLine* {.final.} = object layout*: PPangoLayout start_index*: gint length*: gint runs*: PGSList PPangoLayoutRun* = ptr TPangoLayoutRun - TPangoLayoutRun* {.final.} = object + TPangoLayoutRun* {.final.} = object item*: PPangoItem glyphs*: PPangoGlyphString PPangoTabAlign* = ptr TPangoTabAlign - TPangoTabAlign* = enum + TPangoTabAlign* = enum PANGO_TAB_LEFT -const +const PANGO_SCALE* = 1024 proc PANGO_PIXELS*(d: int): int @@ -260,14 +257,14 @@ proc PANGO_DESCENT*(rect: TPangoRectangle): int32 proc PANGO_LBEARING*(rect: TPangoRectangle): int32 proc PANGO_RBEARING*(rect: TPangoRectangle): int32 proc PANGO_TYPE_LANGUAGE*(): GType -proc pango_language_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_language_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_language_get_type".} -proc pango_language_from_string*(language: cstring): PPangoLanguage{.cdecl, +proc pango_language_from_string*(language: cstring): PPangoLanguage{.cdecl, dynlib: pangolib, importc: "pango_language_from_string".} proc pango_language_to_string*(language: PPangoLanguage): cstring proc pango_language_matches*(language: PPangoLanguage, range_list: cstring): gboolean{. cdecl, dynlib: pangolib, importc: "pango_language_matches".} -const +const PANGO_ATTR_INVALID* = 0 PANGO_ATTR_LANGUAGE* = 1 PANGO_ATTR_FAMILY* = 2 @@ -290,40 +287,40 @@ const PANGO_UNDERLINE_LOW* = 3 proc PANGO_TYPE_COLOR*(): GType -proc pango_color_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_color_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_color_get_type".} -proc pango_color_copy*(src: PPangoColor): PPangoColor{.cdecl, dynlib: pangolib, +proc pango_color_copy*(src: PPangoColor): PPangoColor{.cdecl, dynlib: pangolib, importc: "pango_color_copy".} -proc pango_color_free*(color: PPangoColor){.cdecl, dynlib: pangolib, +proc pango_color_free*(color: PPangoColor){.cdecl, dynlib: pangolib, importc: "pango_color_free".} -proc pango_color_parse*(color: PPangoColor, spec: cstring): gboolean{.cdecl, +proc pango_color_parse*(color: PPangoColor, spec: cstring): gboolean{.cdecl, dynlib: pangolib, importc: "pango_color_parse".} proc PANGO_TYPE_ATTR_LIST*(): GType -proc pango_attr_type_register*(name: cstring): TPangoAttrType{.cdecl, +proc pango_attr_type_register*(name: cstring): TPangoAttrType{.cdecl, dynlib: pangolib, importc: "pango_attr_type_register".} -proc pango_attribute_copy*(attr: PPangoAttribute): PPangoAttribute{.cdecl, +proc pango_attribute_copy*(attr: PPangoAttribute): PPangoAttribute{.cdecl, dynlib: pangolib, importc: "pango_attribute_copy".} -proc pango_attribute_destroy*(attr: PPangoAttribute){.cdecl, dynlib: pangolib, +proc pango_attribute_destroy*(attr: PPangoAttribute){.cdecl, dynlib: pangolib, importc: "pango_attribute_destroy".} proc pango_attribute_equal*(attr1: PPangoAttribute, attr2: PPangoAttribute): gboolean{. cdecl, dynlib: pangolib, importc: "pango_attribute_equal".} -proc pango_attr_language_new*(language: PPangoLanguage): PPangoAttribute{.cdecl, +proc pango_attr_language_new*(language: PPangoLanguage): PPangoAttribute{.cdecl, dynlib: pangolib, importc: "pango_attr_language_new".} -proc pango_attr_family_new*(family: cstring): PPangoAttribute{.cdecl, +proc pango_attr_family_new*(family: cstring): PPangoAttribute{.cdecl, dynlib: pangolib, importc: "pango_attr_family_new".} proc pango_attr_foreground_new*(red: guint16, green: guint16, blue: guint16): PPangoAttribute{. cdecl, dynlib: pangolib, importc: "pango_attr_foreground_new".} proc pango_attr_background_new*(red: guint16, green: guint16, blue: guint16): PPangoAttribute{. cdecl, dynlib: pangolib, importc: "pango_attr_background_new".} -proc pango_attr_size_new*(size: int32): PPangoAttribute{.cdecl, +proc pango_attr_size_new*(size: int32): PPangoAttribute{.cdecl, dynlib: pangolib, importc: "pango_attr_size_new".} -proc pango_attr_style_new*(style: TPangoStyle): PPangoAttribute{.cdecl, +proc pango_attr_style_new*(style: TPangoStyle): PPangoAttribute{.cdecl, dynlib: pangolib, importc: "pango_attr_style_new".} -proc pango_attr_weight_new*(weight: TPangoWeight): PPangoAttribute{.cdecl, +proc pango_attr_weight_new*(weight: TPangoWeight): PPangoAttribute{.cdecl, dynlib: pangolib, importc: "pango_attr_weight_new".} -proc pango_attr_variant_new*(variant: TPangoVariant): PPangoAttribute{.cdecl, +proc pango_attr_variant_new*(variant: TPangoVariant): PPangoAttribute{.cdecl, dynlib: pangolib, importc: "pango_attr_variant_new".} -proc pango_attr_stretch_new*(stretch: TPangoStretch): PPangoAttribute{.cdecl, +proc pango_attr_stretch_new*(stretch: TPangoStretch): PPangoAttribute{.cdecl, dynlib: pangolib, importc: "pango_attr_stretch_new".} proc pango_attr_font_desc_new*(desc: PPangoFontDescription): PPangoAttribute{. cdecl, dynlib: pangolib, importc: "pango_attr_font_desc_new".} @@ -331,22 +328,22 @@ proc pango_attr_underline_new*(underline: TPangoUnderline): PPangoAttribute{. cdecl, dynlib: pangolib, importc: "pango_attr_underline_new".} proc pango_attr_strikethrough_new*(strikethrough: gboolean): PPangoAttribute{. cdecl, dynlib: pangolib, importc: "pango_attr_strikethrough_new".} -proc pango_attr_rise_new*(rise: int32): PPangoAttribute{.cdecl, +proc pango_attr_rise_new*(rise: int32): PPangoAttribute{.cdecl, dynlib: pangolib, importc: "pango_attr_rise_new".} -proc pango_attr_shape_new*(ink_rect: PPangoRectangle, +proc pango_attr_shape_new*(ink_rect: PPangoRectangle, logical_rect: PPangoRectangle): PPangoAttribute{. cdecl, dynlib: pangolib, importc: "pango_attr_shape_new".} -proc pango_attr_scale_new*(scale_factor: gdouble): PPangoAttribute{.cdecl, +proc pango_attr_scale_new*(scale_factor: gdouble): PPangoAttribute{.cdecl, dynlib: pangolib, importc: "pango_attr_scale_new".} -proc pango_attr_list_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_attr_list_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_attr_list_get_type".} -proc pango_attr_list_new*(): PPangoAttrList{.cdecl, dynlib: pangolib, +proc pango_attr_list_new*(): PPangoAttrList{.cdecl, dynlib: pangolib, importc: "pango_attr_list_new".} -proc pango_attr_list_ref*(list: PPangoAttrList){.cdecl, dynlib: pangolib, +proc pango_attr_list_ref*(list: PPangoAttrList){.cdecl, dynlib: pangolib, importc: "pango_attr_list_ref".} -proc pango_attr_list_unref*(list: PPangoAttrList){.cdecl, dynlib: pangolib, +proc pango_attr_list_unref*(list: PPangoAttrList){.cdecl, dynlib: pangolib, importc: "pango_attr_list_unref".} -proc pango_attr_list_copy*(list: PPangoAttrList): PPangoAttrList{.cdecl, +proc pango_attr_list_copy*(list: PPangoAttrList): PPangoAttrList{.cdecl, dynlib: pangolib, importc: "pango_attr_list_copy".} proc pango_attr_list_insert*(list: PPangoAttrList, attr: PPangoAttribute){. cdecl, dynlib: pangolib, importc: "pango_attr_list_insert".} @@ -354,53 +351,53 @@ proc pango_attr_list_insert_before*(list: PPangoAttrList, attr: PPangoAttribute) cdecl, dynlib: pangolib, importc: "pango_attr_list_insert_before".} proc pango_attr_list_change*(list: PPangoAttrList, attr: PPangoAttribute){. cdecl, dynlib: pangolib, importc: "pango_attr_list_change".} -proc pango_attr_list_splice*(list: PPangoAttrList, other: PPangoAttrList, - pos: gint, len: gint){.cdecl, dynlib: pangolib, +proc pango_attr_list_splice*(list: PPangoAttrList, other: PPangoAttrList, + pos: gint, len: gint){.cdecl, dynlib: pangolib, importc: "pango_attr_list_splice".} proc pango_attr_list_get_iterator*(list: PPangoAttrList): PPangoAttrIterator{. cdecl, dynlib: pangolib, importc: "pango_attr_list_get_iterator".} -proc pango_attr_iterator_range*(`iterator`: PPangoAttrIterator, start: Pgint, - theEnd: Pgint){.cdecl, dynlib: pangolib, +proc pango_attr_iterator_range*(`iterator`: PPangoAttrIterator, start: Pgint, + theEnd: Pgint){.cdecl, dynlib: pangolib, importc: "pango_attr_iterator_range".} -proc pango_attr_iterator_next*(`iterator`: PPangoAttrIterator): gboolean{.cdecl, +proc pango_attr_iterator_next*(`iterator`: PPangoAttrIterator): gboolean{.cdecl, dynlib: pangolib, importc: "pango_attr_iterator_next".} proc pango_attr_iterator_copy*(`iterator`: PPangoAttrIterator): PPangoAttrIterator{. cdecl, dynlib: pangolib, importc: "pango_attr_iterator_copy".} -proc pango_attr_iterator_destroy*(`iterator`: PPangoAttrIterator){.cdecl, +proc pango_attr_iterator_destroy*(`iterator`: PPangoAttrIterator){.cdecl, dynlib: pangolib, importc: "pango_attr_iterator_destroy".} -proc pango_attr_iterator_get*(`iterator`: PPangoAttrIterator, - `type`: TPangoAttrType): PPangoAttribute{.cdecl, +proc pango_attr_iterator_get*(`iterator`: PPangoAttrIterator, + `type`: TPangoAttrType): PPangoAttribute{.cdecl, dynlib: pangolib, importc: "pango_attr_iterator_get".} -proc pango_attr_iterator_get_font*(`iterator`: PPangoAttrIterator, - desc: PPangoFontDescription, - language: var PPangoLanguage, - extra_attrs: PPGSList){.cdecl, +proc pango_attr_iterator_get_font*(`iterator`: PPangoAttrIterator, + desc: PPangoFontDescription, + language: var PPangoLanguage, + extra_attrs: PPGSList){.cdecl, dynlib: pangolib, importc: "pango_attr_iterator_get_font".} -proc pango_parse_markup*(markup_text: cstring, length: int32, - accel_marker: gunichar, attr_list: var PPangoAttrList, +proc pango_parse_markup*(markup_text: cstring, length: int32, + accel_marker: gunichar, attr_list: var PPangoAttrList, text: PPchar, accel_char: Pgunichar, error: pointer): gboolean{. cdecl, dynlib: pangolib, importc: "pango_parse_markup".} -const - bm_TPangoLogAttr_is_line_break* = 0x00000001 - bp_TPangoLogAttr_is_line_break* = 0 - bm_TPangoLogAttr_is_mandatory_break* = 0x00000002 - bp_TPangoLogAttr_is_mandatory_break* = 1 - bm_TPangoLogAttr_is_char_break* = 0x00000004 - bp_TPangoLogAttr_is_char_break* = 2 - bm_TPangoLogAttr_is_white* = 0x00000008 - bp_TPangoLogAttr_is_white* = 3 - bm_TPangoLogAttr_is_cursor_position* = 0x00000010 - bp_TPangoLogAttr_is_cursor_position* = 4 - bm_TPangoLogAttr_is_word_start* = 0x00000020 - bp_TPangoLogAttr_is_word_start* = 5 - bm_TPangoLogAttr_is_word_end* = 0x00000040 - bp_TPangoLogAttr_is_word_end* = 6 - bm_TPangoLogAttr_is_sentence_boundary* = 0x00000080 - bp_TPangoLogAttr_is_sentence_boundary* = 7 - bm_TPangoLogAttr_is_sentence_start* = 0x00000100 - bp_TPangoLogAttr_is_sentence_start* = 8 - bm_TPangoLogAttr_is_sentence_end* = 0x00000200 - bp_TPangoLogAttr_is_sentence_end* = 9 +const + bm_TPangoLogAttr_is_line_break* = 0x00000001'i16 + bp_TPangoLogAttr_is_line_break* = 0'i16 + bm_TPangoLogAttr_is_mandatory_break* = 0x00000002'i16 + bp_TPangoLogAttr_is_mandatory_break* = 1'i16 + bm_TPangoLogAttr_is_char_break* = 0x00000004'i16 + bp_TPangoLogAttr_is_char_break* = 2'i16 + bm_TPangoLogAttr_is_white* = 0x00000008'i16 + bp_TPangoLogAttr_is_white* = 3'i16 + bm_TPangoLogAttr_is_cursor_position* = 0x00000010'i16 + bp_TPangoLogAttr_is_cursor_position* = 4'i16 + bm_TPangoLogAttr_is_word_start* = 0x00000020'i16 + bp_TPangoLogAttr_is_word_start* = 5'i16 + bm_TPangoLogAttr_is_word_end* = 0x00000040'i16 + bp_TPangoLogAttr_is_word_end* = 6'i16 + bm_TPangoLogAttr_is_sentence_boundary* = 0x00000080'i16 + bp_TPangoLogAttr_is_sentence_boundary* = 7'i16 + bm_TPangoLogAttr_is_sentence_start* = 0x00000100'i16 + bp_TPangoLogAttr_is_sentence_start* = 8'i16 + bm_TPangoLogAttr_is_sentence_end* = 0x00000200'i16 + bp_TPangoLogAttr_is_sentence_end* = 9'i16 proc is_line_break*(a: var TPangoLogAttr): guint proc set_is_line_break*(a: var TPangoLogAttr, `is_line_break`: guint) @@ -417,22 +414,22 @@ proc set_is_word_start*(a: var TPangoLogAttr, `is_word_start`: guint) proc is_word_end*(a: var TPangoLogAttr): guint proc set_is_word_end*(a: var TPangoLogAttr, `is_word_end`: guint) proc is_sentence_boundary*(a: var TPangoLogAttr): guint -proc set_is_sentence_boundary*(a: var TPangoLogAttr, +proc set_is_sentence_boundary*(a: var TPangoLogAttr, `is_sentence_boundary`: guint) proc is_sentence_start*(a: var TPangoLogAttr): guint proc set_is_sentence_start*(a: var TPangoLogAttr, `is_sentence_start`: guint) proc is_sentence_end*(a: var TPangoLogAttr): guint proc set_is_sentence_end*(a: var TPangoLogAttr, `is_sentence_end`: guint) -proc pango_break*(text: cstring, length: int32, analysis: PPangoAnalysis, - attrs: PPangoLogAttr, attrs_len: int32){.cdecl, +proc pango_break*(text: cstring, length: int32, analysis: PPangoAnalysis, + attrs: PPangoLogAttr, attrs_len: int32){.cdecl, dynlib: pangolib, importc: "pango_break".} -proc pango_find_paragraph_boundary*(text: cstring, length: gint, - paragraph_delimiter_index: Pgint, - next_paragraph_start: Pgint){.cdecl, +proc pango_find_paragraph_boundary*(text: cstring, length: gint, + paragraph_delimiter_index: Pgint, + next_paragraph_start: Pgint){.cdecl, dynlib: pangolib, importc: "pango_find_paragraph_boundary".} -proc pango_get_log_attrs*(text: cstring, length: int32, level: int32, - language: PPangoLanguage, log_attrs: PPangoLogAttr, - attrs_len: int32){.cdecl, dynlib: pangolib, +proc pango_get_log_attrs*(text: cstring, length: int32, level: int32, + language: PPangoLanguage, log_attrs: PPangoLogAttr, + attrs_len: int32){.cdecl, dynlib: pangolib, importc: "pango_get_log_attrs".} proc PANGO_TYPE_CONTEXT*(): GType proc PANGO_CONTEXT*(anObject: pointer): PPangoContext @@ -440,71 +437,71 @@ proc PANGO_CONTEXT_CLASS*(klass: pointer): PPangoContextClass proc PANGO_IS_CONTEXT*(anObject: pointer): bool proc PANGO_IS_CONTEXT_CLASS*(klass: pointer): bool proc PANGO_CONTEXT_GET_CLASS*(obj: PPangoContext): PPangoContextClass -proc pango_context_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_context_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_context_get_type".} -proc pango_context_list_families*(context: PPangoContext, - families: openarray[ptr PPangoFontFamily]){.cdecl, +proc pango_context_list_families*(context: PPangoContext, + families: openarray[ptr PPangoFontFamily]){.cdecl, dynlib: pangolib, importc: "pango_context_list_families".} -proc pango_context_load_font*(context: PPangoContext, - desc: PPangoFontDescription): PPangoFont{.cdecl, +proc pango_context_load_font*(context: PPangoContext, + desc: PPangoFontDescription): PPangoFont{.cdecl, dynlib: pangolib, importc: "pango_context_load_font".} -proc pango_context_load_fontset*(context: PPangoContext, - desc: PPangoFontDescription, +proc pango_context_load_fontset*(context: PPangoContext, + desc: PPangoFontDescription, language: PPangoLanguage): PPangoFontset{. cdecl, dynlib: pangolib, importc: "pango_context_load_fontset".} -proc pango_context_get_metrics*(context: PPangoContext, - desc: PPangoFontDescription, +proc pango_context_get_metrics*(context: PPangoContext, + desc: PPangoFontDescription, language: PPangoLanguage): PPangoFontMetrics{. cdecl, dynlib: pangolib, importc: "pango_context_get_metrics".} -proc pango_context_set_font_description*(context: PPangoContext, - desc: PPangoFontDescription){.cdecl, dynlib: pangolib, +proc pango_context_set_font_description*(context: PPangoContext, + desc: PPangoFontDescription){.cdecl, dynlib: pangolib, importc: "pango_context_set_font_description".} proc pango_context_get_font_description*(context: PPangoContext): PPangoFontDescription{. cdecl, dynlib: pangolib, importc: "pango_context_get_font_description".} -proc pango_context_get_language*(context: PPangoContext): PPangoLanguage{.cdecl, +proc pango_context_get_language*(context: PPangoContext): PPangoLanguage{.cdecl, dynlib: pangolib, importc: "pango_context_get_language".} -proc pango_context_set_language*(context: PPangoContext, - language: PPangoLanguage){.cdecl, +proc pango_context_set_language*(context: PPangoContext, + language: PPangoLanguage){.cdecl, dynlib: pangolib, importc: "pango_context_set_language".} -proc pango_context_set_base_dir*(context: PPangoContext, - direction: TPangoDirection){.cdecl, +proc pango_context_set_base_dir*(context: PPangoContext, + direction: TPangoDirection){.cdecl, dynlib: pangolib, importc: "pango_context_set_base_dir".} proc pango_context_get_base_dir*(context: PPangoContext): TPangoDirection{. cdecl, dynlib: pangolib, importc: "pango_context_get_base_dir".} -proc pango_itemize*(context: PPangoContext, text: cstring, start_index: int32, - length: int32, attrs: PPangoAttrList, - cached_iter: PPangoAttrIterator): PGList{.cdecl, +proc pango_itemize*(context: PPangoContext, text: cstring, start_index: int32, + length: int32, attrs: PPangoAttrList, + cached_iter: PPangoAttrIterator): PGList{.cdecl, dynlib: pangolib, importc: "pango_itemize".} -proc pango_coverage_new*(): PPangoCoverage{.cdecl, dynlib: pangolib, +proc pango_coverage_new*(): PPangoCoverage{.cdecl, dynlib: pangolib, importc: "pango_coverage_new".} -proc pango_coverage_ref*(coverage: PPangoCoverage): PPangoCoverage{.cdecl, +proc pango_coverage_ref*(coverage: PPangoCoverage): PPangoCoverage{.cdecl, dynlib: pangolib, importc: "pango_coverage_ref".} -proc pango_coverage_unref*(coverage: PPangoCoverage){.cdecl, dynlib: pangolib, +proc pango_coverage_unref*(coverage: PPangoCoverage){.cdecl, dynlib: pangolib, importc: "pango_coverage_unref".} -proc pango_coverage_copy*(coverage: PPangoCoverage): PPangoCoverage{.cdecl, +proc pango_coverage_copy*(coverage: PPangoCoverage): PPangoCoverage{.cdecl, dynlib: pangolib, importc: "pango_coverage_copy".} proc pango_coverage_get*(coverage: PPangoCoverage, index: int32): TPangoCoverageLevel{. cdecl, dynlib: pangolib, importc: "pango_coverage_get".} -proc pango_coverage_set*(coverage: PPangoCoverage, index: int32, - level: TPangoCoverageLevel){.cdecl, dynlib: pangolib, +proc pango_coverage_set*(coverage: PPangoCoverage, index: int32, + level: TPangoCoverageLevel){.cdecl, dynlib: pangolib, importc: "pango_coverage_set".} proc pango_coverage_max*(coverage: PPangoCoverage, other: PPangoCoverage){. cdecl, dynlib: pangolib, importc: "pango_coverage_max".} -proc pango_coverage_to_bytes*(coverage: PPangoCoverage, bytes: PPguchar, - n_bytes: var int32){.cdecl, dynlib: pangolib, +proc pango_coverage_to_bytes*(coverage: PPangoCoverage, bytes: PPguchar, + n_bytes: var int32){.cdecl, dynlib: pangolib, importc: "pango_coverage_to_bytes".} proc pango_coverage_from_bytes*(bytes: Pguchar, n_bytes: int32): PPangoCoverage{. cdecl, dynlib: pangolib, importc: "pango_coverage_from_bytes".} proc PANGO_TYPE_FONTSET*(): GType proc PANGO_FONTSET*(anObject: pointer): PPangoFontset proc PANGO_IS_FONTSET*(anObject: pointer): bool -proc pango_fontset_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_fontset_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_fontset_get_type".} proc pango_fontset_get_font*(fontset: PPangoFontset, wc: guint): PPangoFont{. cdecl, dynlib: pangolib, importc: "pango_fontset_get_font".} proc pango_fontset_get_metrics*(fontset: PPangoFontset): PPangoFontMetrics{. cdecl, dynlib: pangolib, importc: "pango_fontset_get_metrics".} -const +const PANGO_STYLE_NORMAL* = 0 PANGO_STYLE_OBLIQUE* = 1 PANGO_STYLE_ITALIC* = 2 @@ -540,74 +537,74 @@ const PANGO_SCALE_XX_LARGE* = 1.728 proc PANGO_TYPE_FONT_DESCRIPTION*(): GType -proc pango_font_description_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_font_description_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_font_description_get_type".} -proc pango_font_description_new*(): PPangoFontDescription{.cdecl, +proc pango_font_description_new*(): PPangoFontDescription{.cdecl, dynlib: pangolib, importc: "pango_font_description_new".} proc pango_font_description_copy*(desc: PPangoFontDescription): PPangoFontDescription{. cdecl, dynlib: pangolib, importc: "pango_font_description_copy".} proc pango_font_description_copy_static*(desc: PPangoFontDescription): PPangoFontDescription{. cdecl, dynlib: pangolib, importc: "pango_font_description_copy_static".} -proc pango_font_description_hash*(desc: PPangoFontDescription): guint{.cdecl, +proc pango_font_description_hash*(desc: PPangoFontDescription): guint{.cdecl, dynlib: pangolib, importc: "pango_font_description_hash".} -proc pango_font_description_equal*(desc1: PPangoFontDescription, +proc pango_font_description_equal*(desc1: PPangoFontDescription, desc2: PPangoFontDescription): gboolean{. cdecl, dynlib: pangolib, importc: "pango_font_description_equal".} -proc pango_font_description_free*(desc: PPangoFontDescription){.cdecl, +proc pango_font_description_free*(desc: PPangoFontDescription){.cdecl, dynlib: pangolib, importc: "pango_font_description_free".} -proc pango_font_descriptions_free*(descs: var PPangoFontDescription, - n_descs: int32){.cdecl, dynlib: pangolib, +proc pango_font_descriptions_free*(descs: var PPangoFontDescription, + n_descs: int32){.cdecl, dynlib: pangolib, importc: "pango_font_descriptions_free".} -proc pango_font_description_set_family*(desc: PPangoFontDescription, - family: cstring){.cdecl, +proc pango_font_description_set_family*(desc: PPangoFontDescription, + family: cstring){.cdecl, dynlib: pangolib, importc: "pango_font_description_set_family".} -proc pango_font_description_set_family_static*(desc: PPangoFontDescription, - family: cstring){.cdecl, dynlib: pangolib, +proc pango_font_description_set_family_static*(desc: PPangoFontDescription, + family: cstring){.cdecl, dynlib: pangolib, importc: "pango_font_description_set_family_static".} proc pango_font_description_get_family*(desc: PPangoFontDescription): cstring{. cdecl, dynlib: pangolib, importc: "pango_font_description_get_family".} -proc pango_font_description_set_style*(desc: PPangoFontDescription, - style: TPangoStyle){.cdecl, +proc pango_font_description_set_style*(desc: PPangoFontDescription, + style: TPangoStyle){.cdecl, dynlib: pangolib, importc: "pango_font_description_set_style".} proc pango_font_description_get_style*(desc: PPangoFontDescription): TPangoStyle{. cdecl, dynlib: pangolib, importc: "pango_font_description_get_style".} -proc pango_font_description_set_variant*(desc: PPangoFontDescription, - variant: TPangoVariant){.cdecl, dynlib: pangolib, +proc pango_font_description_set_variant*(desc: PPangoFontDescription, + variant: TPangoVariant){.cdecl, dynlib: pangolib, importc: "pango_font_description_set_variant".} proc pango_font_description_get_variant*(desc: PPangoFontDescription): TPangoVariant{. cdecl, dynlib: pangolib, importc: "pango_font_description_get_variant".} -proc pango_font_description_set_weight*(desc: PPangoFontDescription, - weight: TPangoWeight){.cdecl, +proc pango_font_description_set_weight*(desc: PPangoFontDescription, + weight: TPangoWeight){.cdecl, dynlib: pangolib, importc: "pango_font_description_set_weight".} proc pango_font_description_get_weight*(desc: PPangoFontDescription): TPangoWeight{. cdecl, dynlib: pangolib, importc: "pango_font_description_get_weight".} -proc pango_font_description_set_stretch*(desc: PPangoFontDescription, - stretch: TPangoStretch){.cdecl, dynlib: pangolib, +proc pango_font_description_set_stretch*(desc: PPangoFontDescription, + stretch: TPangoStretch){.cdecl, dynlib: pangolib, importc: "pango_font_description_set_stretch".} proc pango_font_description_get_stretch*(desc: PPangoFontDescription): TPangoStretch{. cdecl, dynlib: pangolib, importc: "pango_font_description_get_stretch".} proc pango_font_description_set_size*(desc: PPangoFontDescription, size: gint){. cdecl, dynlib: pangolib, importc: "pango_font_description_set_size".} -proc pango_font_description_get_size*(desc: PPangoFontDescription): gint{.cdecl, +proc pango_font_description_get_size*(desc: PPangoFontDescription): gint{.cdecl, dynlib: pangolib, importc: "pango_font_description_get_size".} -proc pango_font_description_set_absolute_size*(desc: PPangoFontDescription, - size: float64){.cdecl, dynlib: pangolib, +proc pango_font_description_set_absolute_size*(desc: PPangoFontDescription, + size: float64){.cdecl, dynlib: pangolib, importc: "pango_font_description_set_absolute_size".} -proc pango_font_description_get_size_is_absolute*(desc: PPangoFontDescription, +proc pango_font_description_get_size_is_absolute*(desc: PPangoFontDescription, size: float64): gboolean{.cdecl, dynlib: pangolib, importc: "pango_font_description_get_size_is_absolute".} proc pango_font_description_get_set_fields*(desc: PPangoFontDescription): TPangoFontMask{. cdecl, dynlib: pangolib, importc: "pango_font_description_get_set_fields".} -proc pango_font_description_unset_fields*(desc: PPangoFontDescription, - to_unset: TPangoFontMask){.cdecl, dynlib: pangolib, +proc pango_font_description_unset_fields*(desc: PPangoFontDescription, + to_unset: TPangoFontMask){.cdecl, dynlib: pangolib, importc: "pango_font_description_unset_fields".} -proc pango_font_description_merge*(desc: PPangoFontDescription, - desc_to_merge: PPangoFontDescription, - replace_existing: gboolean){.cdecl, +proc pango_font_description_merge*(desc: PPangoFontDescription, + desc_to_merge: PPangoFontDescription, + replace_existing: gboolean){.cdecl, dynlib: pangolib, importc: "pango_font_description_merge".} -proc pango_font_description_merge_static*(desc: PPangoFontDescription, - desc_to_merge: PPangoFontDescription, replace_existing: gboolean){.cdecl, +proc pango_font_description_merge_static*(desc: PPangoFontDescription, + desc_to_merge: PPangoFontDescription, replace_existing: gboolean){.cdecl, dynlib: pangolib, importc: "pango_font_description_merge_static".} -proc pango_font_description_better_match*(desc: PPangoFontDescription, +proc pango_font_description_better_match*(desc: PPangoFontDescription, old_match: PPangoFontDescription, new_match: PPangoFontDescription): gboolean{. cdecl, dynlib: pangolib, importc: "pango_font_description_better_match".} proc pango_font_description_from_string*(str: cstring): PPangoFontDescription{. @@ -617,125 +614,125 @@ proc pango_font_description_to_string*(desc: PPangoFontDescription): cstring{. proc pango_font_description_to_filename*(desc: PPangoFontDescription): cstring{. cdecl, dynlib: pangolib, importc: "pango_font_description_to_filename".} proc PANGO_TYPE_FONT_METRICS*(): GType -proc pango_font_metrics_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_font_metrics_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_font_metrics_get_type".} proc pango_font_metrics_ref*(metrics: PPangoFontMetrics): PPangoFontMetrics{. cdecl, dynlib: pangolib, importc: "pango_font_metrics_ref".} -proc pango_font_metrics_unref*(metrics: PPangoFontMetrics){.cdecl, +proc pango_font_metrics_unref*(metrics: PPangoFontMetrics){.cdecl, dynlib: pangolib, importc: "pango_font_metrics_unref".} -proc pango_font_metrics_get_ascent*(metrics: PPangoFontMetrics): int32{.cdecl, +proc pango_font_metrics_get_ascent*(metrics: PPangoFontMetrics): int32{.cdecl, dynlib: pangolib, importc: "pango_font_metrics_get_ascent".} -proc pango_font_metrics_get_descent*(metrics: PPangoFontMetrics): int32{.cdecl, +proc pango_font_metrics_get_descent*(metrics: PPangoFontMetrics): int32{.cdecl, dynlib: pangolib, importc: "pango_font_metrics_get_descent".} proc pango_font_metrics_get_approximate_char_width*(metrics: PPangoFontMetrics): int32{. - cdecl, dynlib: pangolib, + cdecl, dynlib: pangolib, importc: "pango_font_metrics_get_approximate_char_width".} proc pango_font_metrics_get_approximate_digit_width*(metrics: PPangoFontMetrics): int32{. - cdecl, dynlib: pangolib, + cdecl, dynlib: pangolib, importc: "pango_font_metrics_get_approximate_digit_width".} proc PANGO_TYPE_FONT_FAMILY*(): GType proc PANGO_FONT_FAMILY*(anObject: Pointer): PPangoFontFamily proc PANGO_IS_FONT_FAMILY*(anObject: Pointer): bool -proc pango_font_family_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_font_family_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_font_family_get_type".} -proc pango_font_family_list_faces*(family: PPangoFontFamily, +proc pango_font_family_list_faces*(family: PPangoFontFamily, faces: var openarray[ptr PPangoFontFace]){. cdecl, dynlib: pangolib, importc: "pango_font_family_list_faces".} -proc pango_font_family_get_name*(family: PPangoFontFamily): cstring{.cdecl, +proc pango_font_family_get_name*(family: PPangoFontFamily): cstring{.cdecl, dynlib: pangolib, importc: "pango_font_family_get_name".} proc PANGO_TYPE_FONT_FACE*(): GType proc PANGO_FONT_FACE*(anObject: pointer): PPangoFontFace proc PANGO_IS_FONT_FACE*(anObject: pointer): bool -proc pango_font_face_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_font_face_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_font_face_get_type".} proc pango_font_face_describe*(face: PPangoFontFace): PPangoFontDescription{. cdecl, dynlib: pangolib, importc: "pango_font_face_describe".} -proc pango_font_face_get_face_name*(face: PPangoFontFace): cstring{.cdecl, +proc pango_font_face_get_face_name*(face: PPangoFontFace): cstring{.cdecl, dynlib: pangolib, importc: "pango_font_face_get_face_name".} proc PANGO_TYPE_FONT*(): GType proc PANGO_FONT*(anObject: pointer): PPangoFont proc PANGO_IS_FONT*(anObject: pointer): bool -proc pango_font_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_font_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_font_get_type".} -proc pango_font_describe*(font: PPangoFont): PPangoFontDescription{.cdecl, +proc pango_font_describe*(font: PPangoFont): PPangoFontDescription{.cdecl, dynlib: pangolib, importc: "pango_font_describe".} proc pango_font_get_coverage*(font: PPangoFont, language: PPangoLanguage): PPangoCoverage{. cdecl, dynlib: pangolib, importc: "pango_font_get_coverage".} -proc pango_font_find_shaper*(font: PPangoFont, language: PPangoLanguage, - ch: guint32): PPangoEngineShape{.cdecl, +proc pango_font_find_shaper*(font: PPangoFont, language: PPangoLanguage, + ch: guint32): PPangoEngineShape{.cdecl, dynlib: pangolib, importc: "pango_font_find_shaper".} proc pango_font_get_metrics*(font: PPangoFont, language: PPangoLanguage): PPangoFontMetrics{. cdecl, dynlib: pangolib, importc: "pango_font_get_metrics".} -proc pango_font_get_glyph_extents*(font: PPangoFont, glyph: TPangoGlyph, - ink_rect: PPangoRectangle, - logical_rect: PPangoRectangle){.cdecl, +proc pango_font_get_glyph_extents*(font: PPangoFont, glyph: TPangoGlyph, + ink_rect: PPangoRectangle, + logical_rect: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_font_get_glyph_extents".} proc PANGO_TYPE_FONT_MAP*(): GType proc PANGO_FONT_MAP*(anObject: pointer): PPangoFontMap proc PANGO_IS_FONT_MAP*(anObject: pointer): bool -proc pango_font_map_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_font_map_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_font_map_get_type".} -proc pango_font_map_load_font*(fontmap: PPangoFontMap, context: PPangoContext, - desc: PPangoFontDescription): PPangoFont{.cdecl, +proc pango_font_map_load_font*(fontmap: PPangoFontMap, context: PPangoContext, + desc: PPangoFontDescription): PPangoFont{.cdecl, dynlib: pangolib, importc: "pango_font_map_load_font".} -proc pango_font_map_load_fontset*(fontmap: PPangoFontMap, - context: PPangoContext, - desc: PPangoFontDescription, +proc pango_font_map_load_fontset*(fontmap: PPangoFontMap, + context: PPangoContext, + desc: PPangoFontDescription, language: PPangoLanguage): PPangoFontset{. cdecl, dynlib: pangolib, importc: "pango_font_map_load_fontset".} -proc pango_font_map_list_families*(fontmap: PPangoFontMap, - families: var openarray[ptr PPangoFontFamily]){.cdecl, +proc pango_font_map_list_families*(fontmap: PPangoFontMap, + families: var openarray[ptr PPangoFontFamily]){.cdecl, dynlib: pangolib, importc: "pango_font_map_list_families".} -const - bm_TPangoGlyphVisAttr_is_cluster_start* = 0x00000001 - bp_TPangoGlyphVisAttr_is_cluster_start* = 0 +const + bm_TPangoGlyphVisAttr_is_cluster_start* = 0x00000001'i16 + bp_TPangoGlyphVisAttr_is_cluster_start* = 0'i16 proc is_cluster_start*(a: var TPangoGlyphVisAttr): guint proc set_is_cluster_start*(a: var TPangoGlyphVisAttr, `is_cluster_start`: guint) proc PANGO_TYPE_GLYPH_STRING*(): GType -proc pango_glyph_string_new*(): PPangoGlyphString{.cdecl, dynlib: pangolib, +proc pango_glyph_string_new*(): PPangoGlyphString{.cdecl, dynlib: pangolib, importc: "pango_glyph_string_new".} proc pango_glyph_string_set_size*(`string`: PPangoGlyphString, new_len: gint){. cdecl, dynlib: pangolib, importc: "pango_glyph_string_set_size".} -proc pango_glyph_string_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_glyph_string_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_glyph_string_get_type".} proc pango_glyph_string_copy*(`string`: PPangoGlyphString): PPangoGlyphString{. cdecl, dynlib: pangolib, importc: "pango_glyph_string_copy".} -proc pango_glyph_string_free*(`string`: PPangoGlyphString){.cdecl, +proc pango_glyph_string_free*(`string`: PPangoGlyphString){.cdecl, dynlib: pangolib, importc: "pango_glyph_string_free".} -proc pango_glyph_string_extents*(glyphs: PPangoGlyphString, font: PPangoFont, - ink_rect: PPangoRectangle, - logical_rect: PPangoRectangle){.cdecl, +proc pango_glyph_string_extents*(glyphs: PPangoGlyphString, font: PPangoFont, + ink_rect: PPangoRectangle, + logical_rect: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_glyph_string_extents".} -proc pango_glyph_string_extents_range*(glyphs: PPangoGlyphString, start: int32, - theEnd: int32, font: PPangoFont, - ink_rect: PPangoRectangle, - logical_rect: PPangoRectangle){.cdecl, +proc pango_glyph_string_extents_range*(glyphs: PPangoGlyphString, start: int32, + theEnd: int32, font: PPangoFont, + ink_rect: PPangoRectangle, + logical_rect: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_glyph_string_extents_range".} -proc pango_glyph_string_get_logical_widths*(glyphs: PPangoGlyphString, - text: cstring, length: int32, embedding_level: int32, - logical_widths: var int32){.cdecl, dynlib: pangolib, +proc pango_glyph_string_get_logical_widths*(glyphs: PPangoGlyphString, + text: cstring, length: int32, embedding_level: int32, + logical_widths: var int32){.cdecl, dynlib: pangolib, importc: "pango_glyph_string_get_logical_widths".} -proc pango_glyph_string_index_to_x*(glyphs: PPangoGlyphString, text: cstring, - length: int32, analysis: PPangoAnalysis, - index: int32, trailing: gboolean, - x_pos: var int32){.cdecl, dynlib: pangolib, +proc pango_glyph_string_index_to_x*(glyphs: PPangoGlyphString, text: cstring, + length: int32, analysis: PPangoAnalysis, + index: int32, trailing: gboolean, + x_pos: var int32){.cdecl, dynlib: pangolib, importc: "pango_glyph_string_index_to_x".} -proc pango_glyph_string_x_to_index*(glyphs: PPangoGlyphString, text: cstring, - length: int32, analysis: PPangoAnalysis, - x_pos: int32, index, - trailing: var int32){.cdecl, +proc pango_glyph_string_x_to_index*(glyphs: PPangoGlyphString, text: cstring, + length: int32, analysis: PPangoAnalysis, + x_pos: int32, index, + trailing: var int32){.cdecl, dynlib: pangolib, importc: "pango_glyph_string_x_to_index".} -proc pango_shape*(text: cstring, length: gint, analysis: PPangoAnalysis, - glyphs: PPangoGlyphString){.cdecl, dynlib: pangolib, +proc pango_shape*(text: cstring, length: gint, analysis: PPangoAnalysis, + glyphs: PPangoGlyphString){.cdecl, dynlib: pangolib, importc: "pango_shape".} -proc pango_reorder_items*(logical_items: PGList): PGList{.cdecl, +proc pango_reorder_items*(logical_items: PGList): PGList{.cdecl, dynlib: pangolib, importc: "pango_reorder_items".} -proc pango_item_new*(): PPangoItem{.cdecl, dynlib: pangolib, +proc pango_item_new*(): PPangoItem{.cdecl, dynlib: pangolib, importc: "pango_item_new".} -proc pango_item_copy*(item: PPangoItem): PPangoItem{.cdecl, dynlib: pangolib, +proc pango_item_copy*(item: PPangoItem): PPangoItem{.cdecl, dynlib: pangolib, importc: "pango_item_copy".} -proc pango_item_free*(item: PPangoItem){.cdecl, dynlib: pangolib, +proc pango_item_free*(item: PPangoItem){.cdecl, dynlib: pangolib, importc: "pango_item_free".} proc pango_item_split*(orig: PPangoItem, split_index: int32, split_offset: int32): PPangoItem{. cdecl, dynlib: pangolib, importc: "pango_item_split".} @@ -745,465 +742,465 @@ proc PANGO_LAYOUT_CLASS*(klass: pointer): PPangoLayoutClass proc PANGO_IS_LAYOUT*(anObject: pointer): bool proc PANGO_IS_LAYOUT_CLASS*(klass: pointer): bool proc PANGO_LAYOUT_GET_CLASS*(obj: PPangoLayout): PPangoLayoutClass -proc pango_layout_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_layout_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_layout_get_type".} -proc pango_layout_new*(context: PPangoContext): PPangoLayout{.cdecl, +proc pango_layout_new*(context: PPangoContext): PPangoLayout{.cdecl, dynlib: pangolib, importc: "pango_layout_new".} -proc pango_layout_copy*(src: PPangoLayout): PPangoLayout{.cdecl, +proc pango_layout_copy*(src: PPangoLayout): PPangoLayout{.cdecl, dynlib: pangolib, importc: "pango_layout_copy".} -proc pango_layout_get_context*(layout: PPangoLayout): PPangoContext{.cdecl, +proc pango_layout_get_context*(layout: PPangoLayout): PPangoContext{.cdecl, dynlib: pangolib, importc: "pango_layout_get_context".} proc pango_layout_set_attributes*(layout: PPangoLayout, attrs: PPangoAttrList){. cdecl, dynlib: pangolib, importc: "pango_layout_set_attributes".} -proc pango_layout_get_attributes*(layout: PPangoLayout): PPangoAttrList{.cdecl, +proc pango_layout_get_attributes*(layout: PPangoLayout): PPangoAttrList{.cdecl, dynlib: pangolib, importc: "pango_layout_get_attributes".} proc pango_layout_set_text*(layout: PPangoLayout, text: cstring, length: int32){. cdecl, dynlib: pangolib, importc: "pango_layout_set_text".} -proc pango_layout_get_text*(layout: PPangoLayout): cstring{.cdecl, +proc pango_layout_get_text*(layout: PPangoLayout): cstring{.cdecl, dynlib: pangolib, importc: "pango_layout_get_text".} -proc pango_layout_set_markup*(layout: PPangoLayout, markup: cstring, - length: int32){.cdecl, dynlib: pangolib, +proc pango_layout_set_markup*(layout: PPangoLayout, markup: cstring, + length: int32){.cdecl, dynlib: pangolib, importc: "pango_layout_set_markup".} -proc pango_layout_set_markup_with_accel*(layout: PPangoLayout, markup: cstring, - length: int32, accel_marker: gunichar, accel_char: Pgunichar){.cdecl, +proc pango_layout_set_markup_with_accel*(layout: PPangoLayout, markup: cstring, + length: int32, accel_marker: gunichar, accel_char: Pgunichar){.cdecl, dynlib: pangolib, importc: "pango_layout_set_markup_with_accel".} -proc pango_layout_set_font_description*(layout: PPangoLayout, - desc: PPangoFontDescription){.cdecl, +proc pango_layout_set_font_description*(layout: PPangoLayout, + desc: PPangoFontDescription){.cdecl, dynlib: pangolib, importc: "pango_layout_set_font_description".} -proc pango_layout_set_width*(layout: PPangoLayout, width: int32){.cdecl, +proc pango_layout_set_width*(layout: PPangoLayout, width: int32){.cdecl, dynlib: pangolib, importc: "pango_layout_set_width".} -proc pango_layout_get_width*(layout: PPangoLayout): int32{.cdecl, +proc pango_layout_get_width*(layout: PPangoLayout): int32{.cdecl, dynlib: pangolib, importc: "pango_layout_get_width".} -proc pango_layout_set_wrap*(layout: PPangoLayout, wrap: TPangoWrapMode){.cdecl, +proc pango_layout_set_wrap*(layout: PPangoLayout, wrap: TPangoWrapMode){.cdecl, dynlib: pangolib, importc: "pango_layout_set_wrap".} -proc pango_layout_get_wrap*(layout: PPangoLayout): TPangoWrapMode{.cdecl, +proc pango_layout_get_wrap*(layout: PPangoLayout): TPangoWrapMode{.cdecl, dynlib: pangolib, importc: "pango_layout_get_wrap".} -proc pango_layout_set_indent*(layout: PPangoLayout, indent: int32){.cdecl, +proc pango_layout_set_indent*(layout: PPangoLayout, indent: int32){.cdecl, dynlib: pangolib, importc: "pango_layout_set_indent".} -proc pango_layout_get_indent*(layout: PPangoLayout): int32{.cdecl, +proc pango_layout_get_indent*(layout: PPangoLayout): int32{.cdecl, dynlib: pangolib, importc: "pango_layout_get_indent".} -proc pango_layout_set_spacing*(layout: PPangoLayout, spacing: int32){.cdecl, +proc pango_layout_set_spacing*(layout: PPangoLayout, spacing: int32){.cdecl, dynlib: pangolib, importc: "pango_layout_set_spacing".} -proc pango_layout_get_spacing*(layout: PPangoLayout): int32{.cdecl, +proc pango_layout_get_spacing*(layout: PPangoLayout): int32{.cdecl, dynlib: pangolib, importc: "pango_layout_get_spacing".} -proc pango_layout_set_justify*(layout: PPangoLayout, justify: gboolean){.cdecl, +proc pango_layout_set_justify*(layout: PPangoLayout, justify: gboolean){.cdecl, dynlib: pangolib, importc: "pango_layout_set_justify".} -proc pango_layout_get_justify*(layout: PPangoLayout): gboolean{.cdecl, +proc pango_layout_get_justify*(layout: PPangoLayout): gboolean{.cdecl, dynlib: pangolib, importc: "pango_layout_get_justify".} -proc pango_layout_set_alignment*(layout: PPangoLayout, - alignment: TPangoAlignment){.cdecl, +proc pango_layout_set_alignment*(layout: PPangoLayout, + alignment: TPangoAlignment){.cdecl, dynlib: pangolib, importc: "pango_layout_set_alignment".} -proc pango_layout_get_alignment*(layout: PPangoLayout): TPangoAlignment{.cdecl, +proc pango_layout_get_alignment*(layout: PPangoLayout): TPangoAlignment{.cdecl, dynlib: pangolib, importc: "pango_layout_get_alignment".} -proc pango_layout_set_tabs*(layout: PPangoLayout, tabs: PPangoTabArray){.cdecl, +proc pango_layout_set_tabs*(layout: PPangoLayout, tabs: PPangoTabArray){.cdecl, dynlib: pangolib, importc: "pango_layout_set_tabs".} -proc pango_layout_get_tabs*(layout: PPangoLayout): PPangoTabArray{.cdecl, +proc pango_layout_get_tabs*(layout: PPangoLayout): PPangoTabArray{.cdecl, dynlib: pangolib, importc: "pango_layout_get_tabs".} -proc pango_layout_set_single_paragraph_mode*(layout: PPangoLayout, - setting: gboolean){.cdecl, dynlib: pangolib, +proc pango_layout_set_single_paragraph_mode*(layout: PPangoLayout, + setting: gboolean){.cdecl, dynlib: pangolib, importc: "pango_layout_set_single_paragraph_mode".} proc pango_layout_get_single_paragraph_mode*(layout: PPangoLayout): gboolean{. cdecl, dynlib: pangolib, importc: "pango_layout_get_single_paragraph_mode".} -proc pango_layout_context_changed*(layout: PPangoLayout){.cdecl, +proc pango_layout_context_changed*(layout: PPangoLayout){.cdecl, dynlib: pangolib, importc: "pango_layout_context_changed".} -proc pango_layout_get_log_attrs*(layout: PPangoLayout, attrs: var PPangoLogAttr, - n_attrs: Pgint){.cdecl, dynlib: pangolib, +proc pango_layout_get_log_attrs*(layout: PPangoLayout, attrs: var PPangoLogAttr, + n_attrs: Pgint){.cdecl, dynlib: pangolib, importc: "pango_layout_get_log_attrs".} -proc pango_layout_index_to_pos*(layout: PPangoLayout, index: int32, - pos: PPangoRectangle){.cdecl, dynlib: pangolib, +proc pango_layout_index_to_pos*(layout: PPangoLayout, index: int32, + pos: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_layout_index_to_pos".} -proc pango_layout_get_cursor_pos*(layout: PPangoLayout, index: int32, - strong_pos: PPangoRectangle, - weak_pos: PPangoRectangle){.cdecl, +proc pango_layout_get_cursor_pos*(layout: PPangoLayout, index: int32, + strong_pos: PPangoRectangle, + weak_pos: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_layout_get_cursor_pos".} -proc pango_layout_move_cursor_visually*(layout: PPangoLayout, strong: gboolean, - old_index: int32, old_trailing: int32, - direction: int32, new_index, - new_trailing: var int32){.cdecl, +proc pango_layout_move_cursor_visually*(layout: PPangoLayout, strong: gboolean, + old_index: int32, old_trailing: int32, + direction: int32, new_index, + new_trailing: var int32){.cdecl, dynlib: pangolib, importc: "pango_layout_move_cursor_visually".} -proc pango_layout_xy_to_index*(layout: PPangoLayout, x: int32, y: int32, +proc pango_layout_xy_to_index*(layout: PPangoLayout, x: int32, y: int32, index, trailing: var int32): gboolean{. cdecl, dynlib: pangolib, importc: "pango_layout_xy_to_index".} -proc pango_layout_get_extents*(layout: PPangoLayout, ink_rect: PPangoRectangle, - logical_rect: PPangoRectangle){.cdecl, +proc pango_layout_get_extents*(layout: PPangoLayout, ink_rect: PPangoRectangle, + logical_rect: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_layout_get_extents".} -proc pango_layout_get_pixel_extents*(layout: PPangoLayout, - ink_rect: PPangoRectangle, - logical_rect: PPangoRectangle){.cdecl, +proc pango_layout_get_pixel_extents*(layout: PPangoLayout, + ink_rect: PPangoRectangle, + logical_rect: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_layout_get_pixel_extents".} -proc pango_layout_get_size*(layout: PPangoLayout, width: var int32, - height: var int32){.cdecl, dynlib: pangolib, +proc pango_layout_get_size*(layout: PPangoLayout, width: var int32, + height: var int32){.cdecl, dynlib: pangolib, importc: "pango_layout_get_size".} -proc pango_layout_get_pixel_size*(layout: PPangoLayout, width: var int32, - height: var int32){.cdecl, dynlib: pangolib, +proc pango_layout_get_pixel_size*(layout: PPangoLayout, width: var int32, + height: var int32){.cdecl, dynlib: pangolib, importc: "pango_layout_get_pixel_size".} -proc pango_layout_get_line_count*(layout: PPangoLayout): int32{.cdecl, +proc pango_layout_get_line_count*(layout: PPangoLayout): int32{.cdecl, dynlib: pangolib, importc: "pango_layout_get_line_count".} proc pango_layout_get_line*(layout: PPangoLayout, line: int32): PPangoLayoutLine{. cdecl, dynlib: pangolib, importc: "pango_layout_get_line".} -proc pango_layout_get_lines*(layout: PPangoLayout): PGSList{.cdecl, +proc pango_layout_get_lines*(layout: PPangoLayout): PGSList{.cdecl, dynlib: pangolib, importc: "pango_layout_get_lines".} -proc pango_layout_line_ref*(line: PPangoLayoutLine){.cdecl, dynlib: pangolib, +proc pango_layout_line_ref*(line: PPangoLayoutLine){.cdecl, dynlib: pangolib, importc: "pango_layout_line_ref".} -proc pango_layout_line_unref*(line: PPangoLayoutLine){.cdecl, dynlib: pangolib, +proc pango_layout_line_unref*(line: PPangoLayoutLine){.cdecl, dynlib: pangolib, importc: "pango_layout_line_unref".} -proc pango_layout_line_x_to_index*(line: PPangoLayoutLine, x_pos: int32, +proc pango_layout_line_x_to_index*(line: PPangoLayoutLine, x_pos: int32, index: var int32, trailing: var int32): gboolean{. cdecl, dynlib: pangolib, importc: "pango_layout_line_x_to_index".} -proc pango_layout_line_index_to_x*(line: PPangoLayoutLine, index: int32, - trailing: gboolean, x_pos: var int32){.cdecl, +proc pango_layout_line_index_to_x*(line: PPangoLayoutLine, index: int32, + trailing: gboolean, x_pos: var int32){.cdecl, dynlib: pangolib, importc: "pango_layout_line_index_to_x".} -proc pango_layout_line_get_extents*(line: PPangoLayoutLine, - ink_rect: PPangoRectangle, - logical_rect: PPangoRectangle){.cdecl, +proc pango_layout_line_get_extents*(line: PPangoLayoutLine, + ink_rect: PPangoRectangle, + logical_rect: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_layout_line_get_extents".} -proc pango_layout_line_get_pixel_extents*(layout_line: PPangoLayoutLine, - ink_rect: PPangoRectangle, logical_rect: PPangoRectangle){.cdecl, +proc pango_layout_line_get_pixel_extents*(layout_line: PPangoLayoutLine, + ink_rect: PPangoRectangle, logical_rect: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_layout_line_get_pixel_extents".} -proc pango_layout_get_iter*(layout: PPangoLayout): PPangoLayoutIter{.cdecl, +proc pango_layout_get_iter*(layout: PPangoLayout): PPangoLayoutIter{.cdecl, dynlib: pangolib, importc: "pango_layout_get_iter".} -proc pango_layout_iter_free*(iter: PPangoLayoutIter){.cdecl, dynlib: pangolib, +proc pango_layout_iter_free*(iter: PPangoLayoutIter){.cdecl, dynlib: pangolib, importc: "pango_layout_iter_free".} -proc pango_layout_iter_get_index*(iter: PPangoLayoutIter): int32{.cdecl, +proc pango_layout_iter_get_index*(iter: PPangoLayoutIter): int32{.cdecl, dynlib: pangolib, importc: "pango_layout_iter_get_index".} -proc pango_layout_iter_get_run*(iter: PPangoLayoutIter): PPangoLayoutRun{.cdecl, +proc pango_layout_iter_get_run*(iter: PPangoLayoutIter): PPangoLayoutRun{.cdecl, dynlib: pangolib, importc: "pango_layout_iter_get_run".} proc pango_layout_iter_get_line*(iter: PPangoLayoutIter): PPangoLayoutLine{. cdecl, dynlib: pangolib, importc: "pango_layout_iter_get_line".} -proc pango_layout_iter_at_last_line*(iter: PPangoLayoutIter): gboolean{.cdecl, +proc pango_layout_iter_at_last_line*(iter: PPangoLayoutIter): gboolean{.cdecl, dynlib: pangolib, importc: "pango_layout_iter_at_last_line".} -proc pango_layout_iter_next_char*(iter: PPangoLayoutIter): gboolean{.cdecl, +proc pango_layout_iter_next_char*(iter: PPangoLayoutIter): gboolean{.cdecl, dynlib: pangolib, importc: "pango_layout_iter_next_char".} -proc pango_layout_iter_next_cluster*(iter: PPangoLayoutIter): gboolean{.cdecl, +proc pango_layout_iter_next_cluster*(iter: PPangoLayoutIter): gboolean{.cdecl, dynlib: pangolib, importc: "pango_layout_iter_next_cluster".} -proc pango_layout_iter_next_run*(iter: PPangoLayoutIter): gboolean{.cdecl, +proc pango_layout_iter_next_run*(iter: PPangoLayoutIter): gboolean{.cdecl, dynlib: pangolib, importc: "pango_layout_iter_next_run".} -proc pango_layout_iter_next_line*(iter: PPangoLayoutIter): gboolean{.cdecl, +proc pango_layout_iter_next_line*(iter: PPangoLayoutIter): gboolean{.cdecl, dynlib: pangolib, importc: "pango_layout_iter_next_line".} -proc pango_layout_iter_get_char_extents*(iter: PPangoLayoutIter, +proc pango_layout_iter_get_char_extents*(iter: PPangoLayoutIter, logical_rect: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_layout_iter_get_char_extents".} -proc pango_layout_iter_get_cluster_extents*(iter: PPangoLayoutIter, - ink_rect: PPangoRectangle, logical_rect: PPangoRectangle){.cdecl, +proc pango_layout_iter_get_cluster_extents*(iter: PPangoLayoutIter, + ink_rect: PPangoRectangle, logical_rect: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_layout_iter_get_cluster_extents".} -proc pango_layout_iter_get_run_extents*(iter: PPangoLayoutIter, - ink_rect: PPangoRectangle, - logical_rect: PPangoRectangle){.cdecl, +proc pango_layout_iter_get_run_extents*(iter: PPangoLayoutIter, + ink_rect: PPangoRectangle, + logical_rect: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_layout_iter_get_run_extents".} -proc pango_layout_iter_get_line_extents*(iter: PPangoLayoutIter, - ink_rect: PPangoRectangle, logical_rect: PPangoRectangle){.cdecl, +proc pango_layout_iter_get_line_extents*(iter: PPangoLayoutIter, + ink_rect: PPangoRectangle, logical_rect: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_layout_iter_get_line_extents".} -proc pango_layout_iter_get_line_yrange*(iter: PPangoLayoutIter, y0: var int32, - y1: var int32){.cdecl, dynlib: pangolib, +proc pango_layout_iter_get_line_yrange*(iter: PPangoLayoutIter, y0: var int32, + y1: var int32){.cdecl, dynlib: pangolib, importc: "pango_layout_iter_get_line_yrange".} -proc pango_layout_iter_get_layout_extents*(iter: PPangoLayoutIter, - ink_rect: PPangoRectangle, logical_rect: PPangoRectangle){.cdecl, +proc pango_layout_iter_get_layout_extents*(iter: PPangoLayoutIter, + ink_rect: PPangoRectangle, logical_rect: PPangoRectangle){.cdecl, dynlib: pangolib, importc: "pango_layout_iter_get_layout_extents".} -proc pango_layout_iter_get_baseline*(iter: PPangoLayoutIter): int32{.cdecl, +proc pango_layout_iter_get_baseline*(iter: PPangoLayoutIter): int32{.cdecl, dynlib: pangolib, importc: "pango_layout_iter_get_baseline".} proc PANGO_TYPE_TAB_ARRAY*(): GType proc pango_tab_array_new*(initial_size: gint, positions_in_pixels: gboolean): PPangoTabArray{. cdecl, dynlib: pangolib, importc: "pango_tab_array_new".} -proc pango_tab_array_get_type*(): GType{.cdecl, dynlib: pangolib, +proc pango_tab_array_get_type*(): GType{.cdecl, dynlib: pangolib, importc: "pango_tab_array_get_type".} -proc pango_tab_array_copy*(src: PPangoTabArray): PPangoTabArray{.cdecl, +proc pango_tab_array_copy*(src: PPangoTabArray): PPangoTabArray{.cdecl, dynlib: pangolib, importc: "pango_tab_array_copy".} -proc pango_tab_array_free*(tab_array: PPangoTabArray){.cdecl, dynlib: pangolib, +proc pango_tab_array_free*(tab_array: PPangoTabArray){.cdecl, dynlib: pangolib, importc: "pango_tab_array_free".} -proc pango_tab_array_get_size*(tab_array: PPangoTabArray): gint{.cdecl, +proc pango_tab_array_get_size*(tab_array: PPangoTabArray): gint{.cdecl, dynlib: pangolib, importc: "pango_tab_array_get_size".} -proc pango_tab_array_resize*(tab_array: PPangoTabArray, new_size: gint){.cdecl, +proc pango_tab_array_resize*(tab_array: PPangoTabArray, new_size: gint){.cdecl, dynlib: pangolib, importc: "pango_tab_array_resize".} -proc pango_tab_array_set_tab*(tab_array: PPangoTabArray, tab_index: gint, - alignment: TPangoTabAlign, location: gint){.cdecl, +proc pango_tab_array_set_tab*(tab_array: PPangoTabArray, tab_index: gint, + alignment: TPangoTabAlign, location: gint){.cdecl, dynlib: pangolib, importc: "pango_tab_array_set_tab".} -proc pango_tab_array_get_tab*(tab_array: PPangoTabArray, tab_index: gint, +proc pango_tab_array_get_tab*(tab_array: PPangoTabArray, tab_index: gint, alignment: PPangoTabAlign, location: Pgint){. cdecl, dynlib: pangolib, importc: "pango_tab_array_get_tab".} proc pango_tab_array_get_positions_in_pixels*(tab_array: PPangoTabArray): gboolean{. cdecl, dynlib: pangolib, importc: "pango_tab_array_get_positions_in_pixels".} -proc PANGO_ASCENT*(rect: TPangoRectangle): int32 = +proc PANGO_ASCENT*(rect: TPangoRectangle): int32 = result = - int(rect.y) -proc PANGO_DESCENT*(rect: TPangoRectangle): int32 = +proc PANGO_DESCENT*(rect: TPangoRectangle): int32 = result = int(rect.y) + int(rect.height) -proc PANGO_LBEARING*(rect: TPangoRectangle): int32 = +proc PANGO_LBEARING*(rect: TPangoRectangle): int32 = result = rect.x -proc PANGO_RBEARING*(rect: TPangoRectangle): int32 = - result = int(rect.x) + (rect.width) +proc PANGO_RBEARING*(rect: TPangoRectangle): int32 = + result = (rect.x) + (rect.width) -proc PANGO_TYPE_LANGUAGE*(): GType = +proc PANGO_TYPE_LANGUAGE*(): GType = result = pango_language_get_type() -proc pango_language_to_string*(language: PPangoLanguage): cstring = +proc pango_language_to_string*(language: PPangoLanguage): cstring = result = cast[cstring](language) -proc PANGO_PIXELS*(d: int): int = - if d >= 0: +proc PANGO_PIXELS*(d: int): int = + if d >= 0: result = (d + (PANGO_SCALE div 2)) div PANGO_SCALE - else: + else: result = (d - (PANGO_SCALE div 2)) div PANGO_SCALE -proc PANGO_TYPE_COLOR*(): GType = +proc PANGO_TYPE_COLOR*(): GType = result = pango_color_get_type() -proc PANGO_TYPE_ATTR_LIST*(): GType = +proc PANGO_TYPE_ATTR_LIST*(): GType = result = pango_attr_list_get_type() -proc is_line_break*(a: var TPangoLogAttr): guint = +proc is_line_break*(a: var TPangoLogAttr): guint = result = (a.flag0 and bm_TPangoLogAttr_is_line_break) shr bp_TPangoLogAttr_is_line_break -proc set_is_line_break*(a: var TPangoLogAttr, `is_line_break`: guint) = +proc set_is_line_break*(a: var TPangoLogAttr, `is_line_break`: guint) = a.flag0 = a.flag0 or - ((`is_line_break` shl bp_TPangoLogAttr_is_line_break) and + (int16(`is_line_break` shl bp_TPangoLogAttr_is_line_break) and bm_TPangoLogAttr_is_line_break) -proc is_mandatory_break*(a: var TPangoLogAttr): guint = +proc is_mandatory_break*(a: var TPangoLogAttr): guint = result = (a.flag0 and bm_TPangoLogAttr_is_mandatory_break) shr bp_TPangoLogAttr_is_mandatory_break -proc set_is_mandatory_break*(a: var TPangoLogAttr, `is_mandatory_break`: guint) = +proc set_is_mandatory_break*(a: var TPangoLogAttr, `is_mandatory_break`: guint) = a.flag0 = a.flag0 or - ((`is_mandatory_break` shl bp_TPangoLogAttr_is_mandatory_break) and + (int16(`is_mandatory_break` shl bp_TPangoLogAttr_is_mandatory_break) and bm_TPangoLogAttr_is_mandatory_break) -proc is_char_break*(a: var TPangoLogAttr): guint = +proc is_char_break*(a: var TPangoLogAttr): guint = result = (a.flag0 and bm_TPangoLogAttr_is_char_break) shr bp_TPangoLogAttr_is_char_break -proc set_is_char_break*(a: var TPangoLogAttr, `is_char_break`: guint) = +proc set_is_char_break*(a: var TPangoLogAttr, `is_char_break`: guint) = a.flag0 = a.flag0 or - ((`is_char_break` shl bp_TPangoLogAttr_is_char_break) and + (int16(`is_char_break` shl bp_TPangoLogAttr_is_char_break) and bm_TPangoLogAttr_is_char_break) -proc is_white*(a: var TPangoLogAttr): guint = +proc is_white*(a: var TPangoLogAttr): guint = result = (a.flag0 and bm_TPangoLogAttr_is_white) shr bp_TPangoLogAttr_is_white -proc set_is_white*(a: var TPangoLogAttr, `is_white`: guint) = +proc set_is_white*(a: var TPangoLogAttr, `is_white`: guint) = a.flag0 = a.flag0 or - ((`is_white` shl bp_TPangoLogAttr_is_white) and + (int16(`is_white` shl bp_TPangoLogAttr_is_white) and bm_TPangoLogAttr_is_white) -proc is_cursor_position*(a: var TPangoLogAttr): guint = +proc is_cursor_position*(a: var TPangoLogAttr): guint = result = (a.flag0 and bm_TPangoLogAttr_is_cursor_position) shr bp_TPangoLogAttr_is_cursor_position -proc set_is_cursor_position*(a: var TPangoLogAttr, `is_cursor_position`: guint) = +proc set_is_cursor_position*(a: var TPangoLogAttr, `is_cursor_position`: guint) = a.flag0 = a.flag0 or - ((`is_cursor_position` shl bp_TPangoLogAttr_is_cursor_position) and + (int16(`is_cursor_position` shl bp_TPangoLogAttr_is_cursor_position) and bm_TPangoLogAttr_is_cursor_position) -proc is_word_start*(a: var TPangoLogAttr): guint = +proc is_word_start*(a: var TPangoLogAttr): guint = result = (a.flag0 and bm_TPangoLogAttr_is_word_start) shr bp_TPangoLogAttr_is_word_start -proc set_is_word_start*(a: var TPangoLogAttr, `is_word_start`: guint) = +proc set_is_word_start*(a: var TPangoLogAttr, `is_word_start`: guint) = a.flag0 = a.flag0 or - ((`is_word_start` shl bp_TPangoLogAttr_is_word_start) and + (int16(`is_word_start` shl bp_TPangoLogAttr_is_word_start) and bm_TPangoLogAttr_is_word_start) -proc is_word_end*(a: var TPangoLogAttr): guint = +proc is_word_end*(a: var TPangoLogAttr): guint = result = (a.flag0 and bm_TPangoLogAttr_is_word_end) shr bp_TPangoLogAttr_is_word_end -proc set_is_word_end*(a: var TPangoLogAttr, `is_word_end`: guint) = +proc set_is_word_end*(a: var TPangoLogAttr, `is_word_end`: guint) = a.flag0 = a.flag0 or - ((`is_word_end` shl bp_TPangoLogAttr_is_word_end) and + (int16(`is_word_end` shl bp_TPangoLogAttr_is_word_end) and bm_TPangoLogAttr_is_word_end) -proc is_sentence_boundary*(a: var TPangoLogAttr): guint = +proc is_sentence_boundary*(a: var TPangoLogAttr): guint = result = (a.flag0 and bm_TPangoLogAttr_is_sentence_boundary) shr bp_TPangoLogAttr_is_sentence_boundary -proc set_is_sentence_boundary*(a: var TPangoLogAttr, - `is_sentence_boundary`: guint) = +proc set_is_sentence_boundary*(a: var TPangoLogAttr, + `is_sentence_boundary`: guint) = a.flag0 = a.flag0 or - ((`is_sentence_boundary` shl bp_TPangoLogAttr_is_sentence_boundary) and + (int16(`is_sentence_boundary` shl bp_TPangoLogAttr_is_sentence_boundary) and bm_TPangoLogAttr_is_sentence_boundary) -proc is_sentence_start*(a: var TPangoLogAttr): guint = +proc is_sentence_start*(a: var TPangoLogAttr): guint = result = (a.flag0 and bm_TPangoLogAttr_is_sentence_start) shr bp_TPangoLogAttr_is_sentence_start -proc set_is_sentence_start*(a: var TPangoLogAttr, `is_sentence_start`: guint) = +proc set_is_sentence_start*(a: var TPangoLogAttr, `is_sentence_start`: guint) = a.flag0 = a.flag0 or - ((`is_sentence_start` shl bp_TPangoLogAttr_is_sentence_start) and + (int16(`is_sentence_start` shl bp_TPangoLogAttr_is_sentence_start) and bm_TPangoLogAttr_is_sentence_start) -proc is_sentence_end*(a: var TPangoLogAttr): guint = +proc is_sentence_end*(a: var TPangoLogAttr): guint = result = (a.flag0 and bm_TPangoLogAttr_is_sentence_end) shr bp_TPangoLogAttr_is_sentence_end -proc set_is_sentence_end*(a: var TPangoLogAttr, `is_sentence_end`: guint) = +proc set_is_sentence_end*(a: var TPangoLogAttr, `is_sentence_end`: guint) = a.flag0 = a.flag0 or - ((`is_sentence_end` shl bp_TPangoLogAttr_is_sentence_end) and + (int16(`is_sentence_end` shl bp_TPangoLogAttr_is_sentence_end) and bm_TPangoLogAttr_is_sentence_end) -proc PANGO_TYPE_CONTEXT*(): GType = +proc PANGO_TYPE_CONTEXT*(): GType = result = pango_context_get_type() -proc PANGO_CONTEXT*(anObject: pointer): PPangoContext = +proc PANGO_CONTEXT*(anObject: pointer): PPangoContext = result = cast[PPangoContext](G_TYPE_CHECK_INSTANCE_CAST(anObject, PANGO_TYPE_CONTEXT())) -proc PANGO_CONTEXT_CLASS*(klass: pointer): PPangoContextClass = +proc PANGO_CONTEXT_CLASS*(klass: pointer): PPangoContextClass = result = cast[PPangoContextClass](G_TYPE_CHECK_CLASS_CAST(klass, PANGO_TYPE_CONTEXT())) -proc PANGO_IS_CONTEXT*(anObject: pointer): bool = +proc PANGO_IS_CONTEXT*(anObject: pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, PANGO_TYPE_CONTEXT()) -proc PANGO_IS_CONTEXT_CLASS*(klass: pointer): bool = +proc PANGO_IS_CONTEXT_CLASS*(klass: pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, PANGO_TYPE_CONTEXT()) -proc PANGO_CONTEXT_GET_CLASS*(obj: PPangoContext): PPangoContextClass = +proc PANGO_CONTEXT_GET_CLASS*(obj: PPangoContext): PPangoContextClass = result = cast[PPangoContextClass](G_TYPE_INSTANCE_GET_CLASS(obj, PANGO_TYPE_CONTEXT())) -proc PANGO_TYPE_FONTSET*(): GType = +proc PANGO_TYPE_FONTSET*(): GType = result = pango_fontset_get_type() -proc PANGO_FONTSET*(anObject: pointer): PPangoFontset = +proc PANGO_FONTSET*(anObject: pointer): PPangoFontset = result = cast[PPangoFontset](G_TYPE_CHECK_INSTANCE_CAST(anObject, PANGO_TYPE_FONTSET())) -proc PANGO_IS_FONTSET*(anObject: pointer): bool = +proc PANGO_IS_FONTSET*(anObject: pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, PANGO_TYPE_FONTSET()) -proc PANGO_FONTSET_CLASS*(klass: pointer): PPangoFontsetClass = +proc PANGO_FONTSET_CLASS*(klass: pointer): PPangoFontsetClass = result = cast[PPangoFontsetClass](G_TYPE_CHECK_CLASS_CAST(klass, PANGO_TYPE_FONTSET())) -proc PANGO_IS_FONTSET_CLASS*(klass: pointer): bool = +proc PANGO_IS_FONTSET_CLASS*(klass: pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, PANGO_TYPE_FONTSET()) -proc PANGO_FONTSET_GET_CLASS*(obj: PPangoFontset): PPangoFontsetClass = +proc PANGO_FONTSET_GET_CLASS*(obj: PPangoFontset): PPangoFontsetClass = result = cast[PPangoFontsetClass](G_TYPE_INSTANCE_GET_CLASS(obj, PANGO_TYPE_FONTSET())) proc pango_fontset_simple_get_type(): GType {.importc, cdecl, dynlib: pangolib.} -proc PANGO_TYPE_FONTSET_SIMPLE*(): GType = +proc PANGO_TYPE_FONTSET_SIMPLE*(): GType = result = pango_fontset_simple_get_type() -proc PANGO_FONTSET_SIMPLE*(anObject: pointer): PPangoFontsetSimple = - result = cast[PPangoFontsetSimple](G_TYPE_CHECK_INSTANCE_CAST(anObject, +proc PANGO_FONTSET_SIMPLE*(anObject: pointer): PPangoFontsetSimple = + result = cast[PPangoFontsetSimple](G_TYPE_CHECK_INSTANCE_CAST(anObject, PANGO_TYPE_FONTSET_SIMPLE())) -proc PANGO_IS_FONTSET_SIMPLE*(anObject: pointer): bool = +proc PANGO_IS_FONTSET_SIMPLE*(anObject: pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, PANGO_TYPE_FONTSET_SIMPLE()) -proc PANGO_TYPE_FONT_DESCRIPTION*(): GType = +proc PANGO_TYPE_FONT_DESCRIPTION*(): GType = result = pango_font_description_get_type() -proc PANGO_TYPE_FONT_METRICS*(): GType = +proc PANGO_TYPE_FONT_METRICS*(): GType = result = pango_font_metrics_get_type() -proc PANGO_TYPE_FONT_FAMILY*(): GType = +proc PANGO_TYPE_FONT_FAMILY*(): GType = result = pango_font_family_get_type() -proc PANGO_FONT_FAMILY*(anObject: pointer): PPangoFontFamily = - result = cast[PPangoFontFamily](G_TYPE_CHECK_INSTANCE_CAST(anObject, +proc PANGO_FONT_FAMILY*(anObject: pointer): PPangoFontFamily = + result = cast[PPangoFontFamily](G_TYPE_CHECK_INSTANCE_CAST(anObject, PANGO_TYPE_FONT_FAMILY())) -proc PANGO_IS_FONT_FAMILY*(anObject: Pointer): bool = +proc PANGO_IS_FONT_FAMILY*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, PANGO_TYPE_FONT_FAMILY()) -proc PANGO_FONT_FAMILY_CLASS*(klass: Pointer): PPangoFontFamilyClass = - result = cast[PPangoFontFamilyClass](G_TYPE_CHECK_CLASS_CAST(klass, +proc PANGO_FONT_FAMILY_CLASS*(klass: Pointer): PPangoFontFamilyClass = + result = cast[PPangoFontFamilyClass](G_TYPE_CHECK_CLASS_CAST(klass, PANGO_TYPE_FONT_FAMILY())) -proc PANGO_IS_FONT_FAMILY_CLASS*(klass: Pointer): bool = +proc PANGO_IS_FONT_FAMILY_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, PANGO_TYPE_FONT_FAMILY()) -proc PANGO_FONT_FAMILY_GET_CLASS*(obj: PPangoFontFamily): PPangoFontFamilyClass = - result = cast[PPangoFontFamilyClass](G_TYPE_INSTANCE_GET_CLASS(obj, +proc PANGO_FONT_FAMILY_GET_CLASS*(obj: PPangoFontFamily): PPangoFontFamilyClass = + result = cast[PPangoFontFamilyClass](G_TYPE_INSTANCE_GET_CLASS(obj, PANGO_TYPE_FONT_FAMILY())) -proc PANGO_TYPE_FONT_FACE*(): GType = +proc PANGO_TYPE_FONT_FACE*(): GType = result = pango_font_face_get_type() -proc PANGO_FONT_FACE*(anObject: Pointer): PPangoFontFace = - result = cast[PPangoFontFace](G_TYPE_CHECK_INSTANCE_CAST(anObject, +proc PANGO_FONT_FACE*(anObject: Pointer): PPangoFontFace = + result = cast[PPangoFontFace](G_TYPE_CHECK_INSTANCE_CAST(anObject, PANGO_TYPE_FONT_FACE())) -proc PANGO_IS_FONT_FACE*(anObject: Pointer): bool = +proc PANGO_IS_FONT_FACE*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, PANGO_TYPE_FONT_FACE()) -proc PANGO_FONT_FACE_CLASS*(klass: Pointer): PPangoFontFaceClass = - result = cast[PPangoFontFaceClass](G_TYPE_CHECK_CLASS_CAST(klass, +proc PANGO_FONT_FACE_CLASS*(klass: Pointer): PPangoFontFaceClass = + result = cast[PPangoFontFaceClass](G_TYPE_CHECK_CLASS_CAST(klass, PANGO_TYPE_FONT_FACE())) -proc PANGO_IS_FONT_FACE_CLASS*(klass: Pointer): bool = +proc PANGO_IS_FONT_FACE_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, PANGO_TYPE_FONT_FACE()) -proc PANGO_FONT_FACE_GET_CLASS*(obj: Pointer): PPangoFontFaceClass = - result = cast[PPangoFontFaceClass](G_TYPE_INSTANCE_GET_CLASS(obj, +proc PANGO_FONT_FACE_GET_CLASS*(obj: Pointer): PPangoFontFaceClass = + result = cast[PPangoFontFaceClass](G_TYPE_INSTANCE_GET_CLASS(obj, PANGO_TYPE_FONT_FACE())) -proc PANGO_TYPE_FONT*(): GType = +proc PANGO_TYPE_FONT*(): GType = result = pango_font_get_type() -proc PANGO_FONT*(anObject: Pointer): PPangoFont = +proc PANGO_FONT*(anObject: Pointer): PPangoFont = result = cast[PPangoFont](G_TYPE_CHECK_INSTANCE_CAST(anObject, PANGO_TYPE_FONT())) -proc PANGO_IS_FONT*(anObject: Pointer): bool = +proc PANGO_IS_FONT*(anObject: Pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, PANGO_TYPE_FONT()) -proc PANGO_FONT_CLASS*(klass: Pointer): PPangoFontClass = +proc PANGO_FONT_CLASS*(klass: Pointer): PPangoFontClass = result = cast[PPangoFontClass](G_TYPE_CHECK_CLASS_CAST(klass, PANGO_TYPE_FONT())) -proc PANGO_IS_FONT_CLASS*(klass: Pointer): bool = +proc PANGO_IS_FONT_CLASS*(klass: Pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, PANGO_TYPE_FONT()) -proc PANGO_FONT_GET_CLASS*(obj: PPangoFont): PPangoFontClass = +proc PANGO_FONT_GET_CLASS*(obj: PPangoFont): PPangoFontClass = result = cast[PPangoFontClass](G_TYPE_INSTANCE_GET_CLASS(obj, PANGO_TYPE_FONT())) -proc PANGO_TYPE_FONT_MAP*(): GType = +proc PANGO_TYPE_FONT_MAP*(): GType = result = pango_font_map_get_type() -proc PANGO_FONT_MAP*(anObject: pointer): PPangoFontmap = - result = cast[PPangoFontmap](G_TYPE_CHECK_INSTANCE_CAST(anObject, +proc PANGO_FONT_MAP*(anObject: pointer): PPangoFontmap = + result = cast[PPangoFontmap](G_TYPE_CHECK_INSTANCE_CAST(anObject, PANGO_TYPE_FONT_MAP())) -proc PANGO_IS_FONT_MAP*(anObject: pointer): bool = +proc PANGO_IS_FONT_MAP*(anObject: pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, PANGO_TYPE_FONT_MAP()) -proc PANGO_FONT_MAP_CLASS*(klass: pointer): PPangoFontMapClass = +proc PANGO_FONT_MAP_CLASS*(klass: pointer): PPangoFontMapClass = result = cast[PPangoFontMapClass](G_TYPE_CHECK_CLASS_CAST(klass, PANGO_TYPE_FONT_MAP())) -proc PANGO_IS_FONT_MAP_CLASS*(klass: pointer): bool = +proc PANGO_IS_FONT_MAP_CLASS*(klass: pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, PANGO_TYPE_FONT_MAP()) -proc PANGO_FONT_MAP_GET_CLASS*(obj: PPangoFontMap): PPangoFontMapClass = +proc PANGO_FONT_MAP_GET_CLASS*(obj: PPangoFontMap): PPangoFontMapClass = result = cast[PPangoFontMapClass](G_TYPE_INSTANCE_GET_CLASS(obj, PANGO_TYPE_FONT_MAP())) -proc is_cluster_start*(a: var TPangoGlyphVisAttr): guint = +proc is_cluster_start*(a: var TPangoGlyphVisAttr): guint = result = (a.flag0 and bm_TPangoGlyphVisAttr_is_cluster_start) shr bp_TPangoGlyphVisAttr_is_cluster_start -proc set_is_cluster_start*(a: var TPangoGlyphVisAttr, `is_cluster_start`: guint) = +proc set_is_cluster_start*(a: var TPangoGlyphVisAttr, `is_cluster_start`: guint) = a.flag0 = a.flag0 or - ((`is_cluster_start` shl bp_TPangoGlyphVisAttr_is_cluster_start) and + (int16(`is_cluster_start` shl bp_TPangoGlyphVisAttr_is_cluster_start) and bm_TPangoGlyphVisAttr_is_cluster_start) -proc PANGO_TYPE_GLYPH_STRING*(): GType = +proc PANGO_TYPE_GLYPH_STRING*(): GType = result = pango_glyph_string_get_type() -proc PANGO_TYPE_LAYOUT*(): GType = +proc PANGO_TYPE_LAYOUT*(): GType = result = pango_layout_get_type() -proc PANGO_LAYOUT*(anObject: pointer): PPangoLayout = +proc PANGO_LAYOUT*(anObject: pointer): PPangoLayout = result = cast[PPangoLayout](G_TYPE_CHECK_INSTANCE_CAST(anObject, PANGO_TYPE_LAYOUT())) -proc PANGO_LAYOUT_CLASS*(klass: pointer): PPangoLayoutClass = +proc PANGO_LAYOUT_CLASS*(klass: pointer): PPangoLayoutClass = result = cast[PPangoLayoutClass](G_TYPE_CHECK_CLASS_CAST(klass, PANGO_TYPE_LAYOUT())) -proc PANGO_IS_LAYOUT*(anObject: pointer): bool = +proc PANGO_IS_LAYOUT*(anObject: pointer): bool = result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, PANGO_TYPE_LAYOUT()) -proc PANGO_IS_LAYOUT_CLASS*(klass: pointer): bool = +proc PANGO_IS_LAYOUT_CLASS*(klass: pointer): bool = result = G_TYPE_CHECK_CLASS_TYPE(klass, PANGO_TYPE_LAYOUT()) -proc PANGO_LAYOUT_GET_CLASS*(obj: PPangoLayout): PPangoLayoutClass = +proc PANGO_LAYOUT_GET_CLASS*(obj: PPangoLayout): PPangoLayoutClass = result = cast[PPangoLayoutClass](G_TYPE_INSTANCE_GET_CLASS(obj, PANGO_TYPE_LAYOUT())) -proc PANGO_TYPE_TAB_ARRAY*(): GType = +proc PANGO_TYPE_TAB_ARRAY*(): GType = result = pango_tab_array_get_type() diff --git a/lib/base/gtk/pangoutils.nim b/lib/base/gtk/pangoutils.nim index 2c328b59a..6033cca7d 100644 --- a/lib/base/gtk/pangoutils.nim +++ b/lib/base/gtk/pangoutils.nim @@ -1,29 +1,28 @@ -import +import glib2, pango -type +type pint32* = ptr int32 -proc pango_split_file_list*(str: cstring): PPchar{.cdecl, dynlib: pangolib, +proc pango_split_file_list*(str: cstring): PPchar{.cdecl, dynlib: pangolib, importc: "pango_split_file_list".} -proc pango_trim_string*(str: cstring): cstring{.cdecl, dynlib: pangolib, +proc pango_trim_string*(str: cstring): cstring{.cdecl, dynlib: pangolib, importc: "pango_trim_string".} -proc pango_read_line*(stream: TFile, str: PGString): gint{.cdecl, +proc pango_read_line*(stream: TFile, str: PGString): gint{.cdecl, dynlib: pangolib, importc: "pango_read_line".} -proc pango_skip_space*(pos: PPchar): gboolean{.cdecl, dynlib: pangolib, +proc pango_skip_space*(pos: PPchar): gboolean{.cdecl, dynlib: pangolib, importc: "pango_skip_space".} -proc pango_scan_word*(pos: PPchar, OutStr: PGString): gboolean{.cdecl, +proc pango_scan_word*(pos: PPchar, OutStr: PGString): gboolean{.cdecl, dynlib: pangolib, importc: "pango_scan_word".} -proc pango_scan_string*(pos: PPchar, OutStr: PGString): gboolean{.cdecl, +proc pango_scan_string*(pos: PPchar, OutStr: PGString): gboolean{.cdecl, dynlib: pangolib, importc: "pango_scan_string".} -proc pango_scan_int*(pos: PPchar, OutInt: pint32): gboolean{.cdecl, +proc pango_scan_int*(pos: PPchar, OutInt: pint32): gboolean{.cdecl, dynlib: pangolib, importc: "pango_scan_int".} -when defined(PANGO_ENABLE_BACKEND): - proc pango_config_key_get(key: cstring): cstring{.cdecl, dynlib: pangolib, - importc: "pango_config_key_get".} - proc pango_lookup_aliases(fontname: cstring, families: PPPchar, - n_families: pint32){.cdecl, dynlib: pangolib, - importc: "pango_lookup_aliases".} +proc pango_config_key_get(key: cstring): cstring{.cdecl, dynlib: pangolib, + importc: "pango_config_key_get".} +proc pango_lookup_aliases(fontname: cstring, families: PPPchar, + n_families: pint32){.cdecl, dynlib: pangolib, + importc: "pango_lookup_aliases".} proc pango_parse_style*(str: cstring, style: PPangoStyle, warn: gboolean): gboolean{. cdecl, dynlib: pangolib, importc: "pango_parse_style".} proc pango_parse_variant*(str: cstring, variant: PPangoVariant, warn: gboolean): gboolean{. @@ -32,15 +31,14 @@ proc pango_parse_weight*(str: cstring, weight: PPangoWeight, warn: gboolean): gb cdecl, dynlib: pangolib, importc: "pango_parse_weight".} proc pango_parse_stretch*(str: cstring, stretch: PPangoStretch, warn: gboolean): gboolean{. cdecl, dynlib: pangolib, importc: "pango_parse_stretch".} -when defined(PANGO_ENABLE_BACKEND): - proc pango_get_sysconf_subdirectory(): cstring{.cdecl, dynlib: pangolib, - importc: "pango_get_sysconf_subdirectory".} - proc pango_get_lib_subdirectory(): cstring{.cdecl, dynlib: pangolib, - importc: "pango_get_lib_subdirectory".} -proc pango_log2vis_get_embedding_levels*(str: Pgunichar, len: int32, - pbase_dir: PPangoDirection, embedding_level_list: Pguint8): gboolean{.cdecl, +proc pango_get_sysconf_subdirectory(): cstring{.cdecl, dynlib: pangolib, + importc: "pango_get_sysconf_subdirectory".} +proc pango_get_lib_subdirectory(): cstring{.cdecl, dynlib: pangolib, + importc: "pango_get_lib_subdirectory".} +proc pango_log2vis_get_embedding_levels*(str: Pgunichar, len: int32, + pbase_dir: PPangoDirection, embedding_level_list: Pguint8): gboolean{.cdecl, dynlib: pangolib, importc: "pango_log2vis_get_embedding_levels".} proc pango_get_mirror_char*(ch: gunichar, mirrored_ch: Pgunichar): gboolean{. cdecl, dynlib: pangolib, importc: "pango_get_mirror_char".} proc pango_language_get_sample_string*(language: PPangoLanguage): cstring{. - cdecl, dynlib: pangolib, importc: "pango_language_get_sample_string".} \ No newline at end of file + cdecl, dynlib: pangolib, importc: "pango_language_get_sample_string".} diff --git a/lib/base/lex.nim b/lib/base/lex.nim deleted file mode 100644 index 34f0c32a8..000000000 --- a/lib/base/lex.nim +++ /dev/null @@ -1,73 +0,0 @@ -# Lexer generator for Nimrod -# (c) 2008 Andreas Rumpf - -# Stress testing for the macro feature - -# the syntax that should be supported is: - -# template numpostfix = -# '\'' & 'F'|'f'|'i'|'I' & "32"|"64"|"8"|"16" -# template edigits = -# 'e'|'E' & +digits -# tokens( -# tkIdent: +UniIdentStart & *UniIdentRest, -# tkHexNumber: '0' & ('x'|'X') & +hexDigits & ?( numpostfix ), -# tkOctNumber: '0' & ('c'|'C') & +octDigits & ?( numpostfix ), -# tkBinNumber: '0' & ('b'|'B') & +binDigits & ?( numpostfix ), -# tkIntNumber: +digits & ?( numpostfix ), -# tkFloatNumber: +digits & ('.' & +digits & ?(edigits) | edigits) & ?(numpostfix), -# -# ) -# actions( -# tkIdent: lookup -# ) -# - -# -# match inputstream -# of +('A'..'Z' | '_' | 'a'..'z') *('A'..'Z' | '_' | 'a'..'z' | '0'..'9') : -# -# x = inputstream[pos..length] -# of '0' 'x' +('0'..'9' | 'a'..'f' | '_' | 'A'..'F') : -# y = ... - -const - AsciiLetter = {'A'..'Z', 'a'..'z'} - uniLetter = AsciiLetter + {'\128'..'\255'} - digits = {'0'..'9'} - hexDigits = {'0'..'9', 'a'..'f', 'A'..'F'} - octDigits = {'0'..'7'} - binDigits = {'0'..'1'} - AsciiIdentStart = AsciiLetter + {'_'} - AsciiIdentRest = AsciiIdentStart + Digits - UniIdentStart = UniLetter + {'_'} - UniIdentRest = UniIdentStart + Digits - -# --> if match(s, +AsciiIdentStart & *AsciiIdentRest): - -# Regular expressions in Nimrod itself! -# ------------------------------------- -# -# 'a' -- matches the character a -# 'a'..'z' -- range operator '-' -# 'A' | 'B' -- alternative operator | -# * 'a' -- prefix * is needed -# + 'a' -- prefix + is needed -# ? 'a' -- prefix ? is needed -# *? prefix is needed -# +? prefix is needed -# letter -- character classes with real names! -# letters -# white -# whites -# any -- any character -# () -- are Nimrod syntax -# ! 'a'-'z' -# -# -- concatentation via proc call: -# -# re('A' 'Z' *word ) - -macro re(n: expr): expr = - - result = newCall("magic_re", x) diff --git a/lib/base/nregex.nim b/lib/base/nregex.nim deleted file mode 100644 index 77afb8421..000000000 --- a/lib/base/nregex.nim +++ /dev/null @@ -1,124 +0,0 @@ -# new implementation of regular expressions - -type - TRegexKind = enum - regNone, - regChar, - regSet, - regConc, - regAlt, - regStar, - regPlus, - regMN, - regNewline - - TRegex = object of TObject - case kind: TRegexKind - of regChar: c: char - of regSet: s: ref set[char] - else: a, b: PRegEx - - PRegEx* = ref TRegEx - - TRegExFlag* = enum ## Flags concerning the semantics of regular expressions - reCaseInsensitive, ## case insensitive match - reStyleInsensitive ## style insensitive match - - - TRegExFlags* = set[TRegExFlag] - ## Flags concerning the semantics of regular expressions - -proc raiseRegex(msg: string) {.noreturn.} = - var e: ref Exception - new(e) - e.msg = msg - raise e - -proc compileAux(i: int, s: string, r: PRegEx): int - -proc compileBackslash(i: int, s: string, r: PRegEx): int = - var i = i - inc(i) - case s[i] - of 'A'..'Z': - of 'a'..'z': - of '0': - of '1'..'9': - - else: - r.kind = regChar - r.c = s[i] - inc(i) - result = i - -proc compileAtom(i: int, s: string, r: PRegEx): int = - var i = i - case s[i] - of '[': - inc(i) - var inverse = s[i] == '^' - if inverse: inc(i) - r.kind = regSet - new(r.s) - while true: - case s[i] - of '\\': i = compileBackslash(i, s, r) - of ']': - inc(i) - break - of '\0': - raiseRegex("']' expected") - elif s[i+1] == '-': - var x = s[i] - inc(i, 2) - var y = s[i] - inc(i) - r.s = r.s + {x..y} - else: - incl(r.s, s[i]) - inc(i) - if inverse: - r.s = {'\0'..'\255'} - r.s - of '\\': - inc(i) - i = compileBackslash(i, s, r) - of '.': - r.kind = regAny - inc(i) - of '(': - inc(i) - i = compileAux(i, s, r) - if s[i] = ')': inc(i) - else: raiseRegex("')' expected") - of '\0': nil # do nothing - else: - r.kind = regChar - r.c = s[i] - inc(i) - result = i - -proc compilePostfix(i: int, s: string, r: PRegEx): int = - var i = compileAtom(i, s, r) - var a: PRegEx - case s[i] - of '*': - of '+': - of '?': - else: nil - -proc compileAux(i: int, s: string, r: PRegEx): int = - var i = i - i = compileAtom(i, s, r) - - while s[i] != '\0': - - result = i - -proc compile*(regex: string, flags: TRegExFlags = {}): PRegEx = - ## Compiles the string `regex` that represents a regular expression into - ## an internal data structure that can be used for matching. - new(result) - var i = compileAux(0, regex, result) - if i < len(regex)-1: - # not all characters used for the regular expression? - raiseRegEx("invalid regular expression") diff --git a/lib/base/pcre.nim b/lib/base/pcre.nim index 1023f86f3..ebebd8bd7 100644 --- a/lib/base/pcre.nim +++ b/lib/base/pcre.nim @@ -1,296 +1,291 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2006 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -# This file was created by a complicated procedure which saved me a considerable -# amount of time: the pcre.h header was converted to modpcre.h by hand, so that -# h2pas could handle it. Then I used pas2mor to generate a Morpork binding. -# Unfortunately, I had to fix some things later on; thus don't do all this -# again! My manual changes will be lost! - -# Converted by Pas2mor v1.37 -# -# Automatically converted by H2Pas 0.99.16 from modpcre.h -# The following command line parameters were used: -# -D -c -l pcre.lib -T modpcre.h - -{.compile: "pcre_all.c" .} - -type - Pbyte = ptr byte - Pchar = CString - PPchar = ptr PChar - Pint = ptr cint - Ppcre* = ptr TPcre - Ppcre_callout_block = ptr tpcre_callout_block - Ppcre_extra = ptr Tpcre_extra - -#************************************************ -#* Perl-Compatible Regular Expressions * -#************************************************ -# -# Modified by Andreas Rumpf for h2pas. - -# In its original form, this is the .in file that is transformed by -# "configure" into pcre.h. -# -# Copyright (c) 1997-2005 University of Cambridge -# -# ----------------------------------------------------------------------------- -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the name of the University of Cambridge nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# ----------------------------------------------------------------------------- - -# The file pcre.h is build by "configure". Do not edit it; instead -# make changes to pcre.in. - -const - PCRE_MAJOR* = 6 - PCRE_MINOR* = 3 - PCRE_DATE* = "2005/11/29" - # Options - PCRE_CASELESS* = 0x00000001 - PCRE_MULTILINE* = 0x00000002 - PCRE_DOTALL* = 0x00000004 - PCRE_EXTENDED* = 0x00000008 - PCRE_ANCHORED* = 0x00000010 - PCRE_DOLLAR_ENDONLY* = 0x00000020 - PCRE_EXTRA* = 0x00000040 - PCRE_NOTBOL* = 0x00000080 - PCRE_NOTEOL* = 0x00000100 - PCRE_UNGREEDY* = 0x00000200 - PCRE_NOTEMPTY* = 0x00000400 - PCRE_UTF8* = 0x00000800 - PCRE_NO_AUTO_CAPTURE* = 0x00001000 - PCRE_NO_UTF8_CHECK* = 0x00002000 - PCRE_AUTO_CALLOUT* = 0x00004000 - PCRE_PARTIAL* = 0x00008000 - PCRE_DFA_SHORTEST* = 0x00010000 - PCRE_DFA_RESTART* = 0x00020000 - PCRE_FIRSTLINE* = 0x00040000 - # Exec-time and get/set-time error codes - PCRE_ERROR_NOMATCH* = -(1) - PCRE_ERROR_NULL* = -(2) - PCRE_ERROR_BADOPTION* = -(3) - PCRE_ERROR_BADMAGIC* = -(4) - PCRE_ERROR_UNKNOWN_NODE* = -(5) - PCRE_ERROR_NOMEMORY* = -(6) - PCRE_ERROR_NOSUBSTRING* = -(7) - PCRE_ERROR_MATCHLIMIT* = -(8) - # Never used by PCRE itself - PCRE_ERROR_CALLOUT* = -(9) - PCRE_ERROR_BADUTF8* = -(10) - PCRE_ERROR_BADUTF8_OFFSET* = -(11) - PCRE_ERROR_PARTIAL* = -(12) - PCRE_ERROR_BADPARTIAL* = -(13) - PCRE_ERROR_INTERNAL* = -(14) - PCRE_ERROR_BADCOUNT* = -(15) - PCRE_ERROR_DFA_UITEM* = -(16) - PCRE_ERROR_DFA_UCOND* = -(17) - PCRE_ERROR_DFA_UMLIMIT* = -(18) - PCRE_ERROR_DFA_WSSIZE* = -(19) - PCRE_ERROR_DFA_RECURSE* = -(20) - # Request types for pcre_fullinfo() - PCRE_INFO_OPTIONS* = 0 - PCRE_INFO_SIZE* = 1 - PCRE_INFO_CAPTURECOUNT* = 2 - PCRE_INFO_BACKREFMAX* = 3 - PCRE_INFO_FIRSTBYTE* = 4 - # For backwards compatibility - PCRE_INFO_FIRSTCHAR* = 4 - PCRE_INFO_FIRSTTABLE* = 5 - PCRE_INFO_LASTLITERAL* = 6 - PCRE_INFO_NAMEENTRYSIZE* = 7 - PCRE_INFO_NAMECOUNT* = 8 - PCRE_INFO_NAMETABLE* = 9 - PCRE_INFO_STUDYSIZE* = 10 - PCRE_INFO_DEFAULT_TABLES* = 11 - # Request types for pcre_config() - PCRE_CONFIG_UTF8* = 0 - PCRE_CONFIG_NEWLINE* = 1 - PCRE_CONFIG_LINK_SIZE* = 2 - PCRE_CONFIG_POSIX_MALLOC_THRESHOLD* = 3 - PCRE_CONFIG_MATCH_LIMIT* = 4 - PCRE_CONFIG_STACKRECURSE* = 5 - PCRE_CONFIG_UNICODE_PROPERTIES* = 6 - # Bit flags for the pcre_extra structure - PCRE_EXTRA_STUDY_DATA* = 0x0001 - PCRE_EXTRA_MATCH_LIMIT* = 0x0002 - PCRE_EXTRA_CALLOUT_DATA* = 0x0004 - PCRE_EXTRA_TABLES* = 0x0008 - # Types - -type - TPcre = record - #undefined structure - - - # The structure for passing additional data to pcre_exec(). This is defined - # in such as way as to be extensible. Always add new fields at the end, - # in order to remain compatible. - # Bits for which fields are set - # Opaque data from pcre_study() - # Maximum number of calls to match() - # Data passed back in callouts - # Const before type ignored - # Pointer to character tables - Tpcre_extra* {.final.} = object - flags: cuint - study_data: pointer - match_limit: cuint - callout_data: pointer - tables: ptr byte - - # The structure for passing out data via the pcre_callout_function. We use a - # structure so that new fields can be added on the end in future versions, - # without changing the API of the function, thereby allowing old clients to - # work without modification. - # Identifies version of block - # ------------------------ Version 0 ------------------------------- - # Number compiled into pattern - # The offset vector - # Const before type ignored - # The subject being matched - # The length of the subject - # Offset to start of this match attempt - # Where we currently are in the subject - # Max current capture - # Most recently closed capture - # Data passed in with the call - # ------------------- Added for Version 1 -------------------------- - # Offset to next item in the pattern - # Length of next item in the pattern - # ------------------------------------------------------------------ - TPcre_callout_block* {.final.} = object - version: cint - callout_number: cint - offset_vector: ptr cint - subject: ptr char - subject_length: cint - start_match: cint - current_position: cint - capture_top: cint - capture_last: cint - callout_data: pointer - pattern_position: cint - next_item_length: cint - -# Exported PCRE functions - -proc pcre_compile*(para1: Pchar, para2: cint, para3: ptr Pchar, - para4: Pint, para5: Pbyte): Ppcre {. - importc: "pcre_compile", noconv.} - -proc pcre_compile2*(para1: Pchar, para2: cint, para3: Pint, para4: PPchar, - para5: Pint, para6: Pbyte): Ppcre {. - importc: "pcre_compile2", noconv.} - -proc pcre_config*(para1: cint, para2: pointer): cint {. - importc: "pcre_config", noconv.} - -proc pcre_copy_named_substring*(para1: Ppcre, para2: Pchar, para3: Pint, - para4: cint, para5: Pchar, para6: Pchar, - para7: cint): cint {. - importc: "pcre_copy_named_substring", noconv.} - -proc pcre_copy_substring*(para1: Pchar, para2: Pint, para3: cint, para4: cint, - para5: Pchar, para6: cint): cint {. - importc: "pcre_copy_substring", noconv.} - -proc pcre_dfa_exec*(para1: Ppcre, para2: Ppcre_extra, para3: Pchar, - para4: cint, para5: cint, para6: cint, para7: Pint, - para8: cint, para9: Pint, para10: cint): cint {. - importc: "pcre_dfa_exec", noconv.} - -proc pcre_exec*(para1: Ppcre, para2: Ppcre_extra, para3: Pchar, - para4: cint, para5: cint, para6: cint, para7: Pint, - para8: cint): cint {.importc: "pcre_exec", noconv.} - -proc pcre_free_substring*(para1: Pchar) {. - importc: "pcre_free_substring", noconv.} - -proc pcre_free_substring_list*(para1: PPchar) {. - importc: "pcre_free_substring_list", noconv.} - -proc pcre_fullinfo*(para1: Ppcre, para2: Ppcre_extra, para3: cint, - para4: pointer): cint {.importc: "pcre_fullinfo", noconv.} - -proc pcre_get_named_substring*(para1: Ppcre, para2: Pchar, para3: Pint, - para4: cint, para5: Pchar, para6: PPchar): cint {. - importc: "pcre_get_named_substring", noconv.} - -proc pcre_get_stringnumber*(para1: Ppcre, para2: Pchar): cint {. - importc: "pcre_get_stringnumber", noconv.} - -proc pcre_get_substring*(para1: Pchar, para2: Pint, para3: cint, - para4: cint, para5: PPchar): cint {. - importc: "pcre_get_substring", noconv.} - -proc pcre_get_substring_list*(para1: Pchar, para2: Pint, para3: cint, - para4: ptr PPchar): cint {. - importc: "pcre_get_substring_list", noconv.} - -proc pcre_info*(para1: Ppcre, para2: Pint, para3: Pint): cint {. - importc: "pcre_info", noconv.} - -proc pcre_maketables*: ptr byte {. - importc: "pcre_maketables", noconv.} - -proc pcre_refcount*(para1: Ppcre, para2: cint): cint {. - importc: "pcre_refcount", noconv.} - -proc pcre_study*(para1: Ppcre, para2: cint, - para3: ptr CString): Ppcre_extra {.importc, noconv.} - -proc pcre_version*: CString {.importc: "pcre_version", noconv.} - -# Indirection for store get and free functions. These can be set to -# alternative malloc/free functions if required. Special ones are used in the -# non-recursive case for "frames". There is also an optional callout function -# that is triggered by the (?) regex item. -# - -# we use Nimrod's memory manager (but not GC!) for these functions: -var - pcre_malloc {.importc: "pcre_malloc".}: proc (para1: int): pointer {.noconv.} - pcre_free {.importc: "pcre_free".}: proc (para1: pointer) {.noconv.} - pcre_stack_malloc {.importc: "pcre_stack_malloc".}: - proc (para1: int): pointer {.noconv.} - pcre_stack_free {.importc: "pcre_stack_free".}: - proc (para1: pointer) {.noconv.} - pcre_callout {.importc: "pcre_callout".}: - proc (para1: Ppcre_callout_block): cint {.noconv.} - -pcre_malloc = system.alloc -pcre_free = system.dealloc -pcre_stack_malloc = system.alloc -pcre_stack_free = system.dealloc -pcre_callout = nil +# +# +# Nimrod's Runtime Library +# (c) Copyright 2006 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +# This file was created by a complicated procedure which saved me a considerable +# amount of time: the pcre.h header was converted to modpcre.h by hand, so that +# h2pas could handle it. Then I used pas2mor to generate a Nimrod binding. +# Unfortunately, I had to fix some things later on; thus don't do all this +# again! My manual changes will be lost! + +# Converted by Pas2mor v1.37 +# +# Automatically converted by H2Pas 0.99.16 from modpcre.h +# The following command line parameters were used: +# -D -c -l pcre.lib -T modpcre.h + +{.compile: "pcre_all.c" .} + +type + Pbyte = ptr byte + PPchar = ptr cstring + Pint = ptr cint + Ppcre* = ptr TPcre + Ppcre_callout_block* = ptr tpcre_callout_block + Ppcre_extra* = ptr Tpcre_extra + TPcre {.final, pure.} = object + + # The structure for passing additional data to pcre_exec(). This is defined + # in such as way as to be extensible. + # Bits for which fields are set + # Opaque data from pcre_study() + # Maximum number of calls to match() + # Data passed back in callouts + # Const before type ignored + # Pointer to character tables + Tpcre_extra* {.final, pure.} = object + flags: cint + study_data: pointer + match_limit: cint + callout_data: pointer + tables: ptr byte + + # The structure for passing out data via the pcre_callout_function. We use a + # structure so that new fields can be added on the end in future versions, + # without changing the API of the function, thereby allowing old clients to + # work without modification. + # Identifies version of block + # ------------------------ Version 0 ------------------------------- + # Number compiled into pattern + # The offset vector + # Const before type ignored + # The subject being matched + # The length of the subject + # Offset to start of this match attempt + # Where we currently are in the subject + # Max current capture + # Most recently closed capture + # Data passed in with the call + # ------------------- Added for Version 1 -------------------------- + # Offset to next item in the pattern + # Length of next item in the pattern + # ------------------------------------------------------------------ + TPcre_callout_block* {.final, pure.} = object + version: cint + callout_number: cint + offset_vector: ptr cint + subject: ptr char + subject_length: cint + start_match: cint + current_position: cint + capture_top: cint + capture_last: cint + callout_data: pointer + pattern_position: cint + next_item_length: cint + + +#************************************************ +#* Perl-Compatible Regular Expressions * +#************************************************ +# +# Modified by Andreas Rumpf for h2pas. + +# In its original form, this is the .in file that is transformed by +# "configure" into pcre.h. +# +# Copyright (c) 1997-2005 University of Cambridge +# +# ----------------------------------------------------------------------------- +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of the University of Cambridge nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# ----------------------------------------------------------------------------- + +# The file pcre.h is build by "configure". Do not edit it; instead +# make changes to pcre.in. + +const + PCRE_MAJOR* = 6 + PCRE_MINOR* = 3 + PCRE_DATE* = "2005/11/29" + # Options + PCRE_CASELESS* = 0x00000001 + PCRE_MULTILINE* = 0x00000002 + PCRE_DOTALL* = 0x00000004 + PCRE_EXTENDED* = 0x00000008 + PCRE_ANCHORED* = 0x00000010 + PCRE_DOLLAR_ENDONLY* = 0x00000020 + PCRE_EXTRA* = 0x00000040 + PCRE_NOTBOL* = 0x00000080 + PCRE_NOTEOL* = 0x00000100 + PCRE_UNGREEDY* = 0x00000200 + PCRE_NOTEMPTY* = 0x00000400 + PCRE_UTF8* = 0x00000800 + PCRE_NO_AUTO_CAPTURE* = 0x00001000 + PCRE_NO_UTF8_CHECK* = 0x00002000 + PCRE_AUTO_CALLOUT* = 0x00004000 + PCRE_PARTIAL* = 0x00008000 + PCRE_DFA_SHORTEST* = 0x00010000 + PCRE_DFA_RESTART* = 0x00020000 + PCRE_FIRSTLINE* = 0x00040000 + # Exec-time and get/set-time error codes + PCRE_ERROR_NOMATCH* = -(1) + PCRE_ERROR_NULL* = -(2) + PCRE_ERROR_BADOPTION* = -(3) + PCRE_ERROR_BADMAGIC* = -(4) + PCRE_ERROR_UNKNOWN_NODE* = -(5) + PCRE_ERROR_NOMEMORY* = -(6) + PCRE_ERROR_NOSUBSTRING* = -(7) + PCRE_ERROR_MATCHLIMIT* = -(8) + # Never used by PCRE itself + PCRE_ERROR_CALLOUT* = -(9) + PCRE_ERROR_BADUTF8* = -(10) + PCRE_ERROR_BADUTF8_OFFSET* = -(11) + PCRE_ERROR_PARTIAL* = -(12) + PCRE_ERROR_BADPARTIAL* = -(13) + PCRE_ERROR_INTERNAL* = -(14) + PCRE_ERROR_BADCOUNT* = -(15) + PCRE_ERROR_DFA_UITEM* = -(16) + PCRE_ERROR_DFA_UCOND* = -(17) + PCRE_ERROR_DFA_UMLIMIT* = -(18) + PCRE_ERROR_DFA_WSSIZE* = -(19) + PCRE_ERROR_DFA_RECURSE* = -(20) + # Request types for pcre_fullinfo() + PCRE_INFO_OPTIONS* = 0 + PCRE_INFO_SIZE* = 1 + PCRE_INFO_CAPTURECOUNT* = 2 + PCRE_INFO_BACKREFMAX* = 3 + PCRE_INFO_FIRSTBYTE* = 4 + # For backwards compatibility + PCRE_INFO_FIRSTCHAR* = 4 + PCRE_INFO_FIRSTTABLE* = 5 + PCRE_INFO_LASTLITERAL* = 6 + PCRE_INFO_NAMEENTRYSIZE* = 7 + PCRE_INFO_NAMECOUNT* = 8 + PCRE_INFO_NAMETABLE* = 9 + PCRE_INFO_STUDYSIZE* = 10 + PCRE_INFO_DEFAULT_TABLES* = 11 + # Request types for pcre_config() + PCRE_CONFIG_UTF8* = 0 + PCRE_CONFIG_NEWLINE* = 1 + PCRE_CONFIG_LINK_SIZE* = 2 + PCRE_CONFIG_POSIX_MALLOC_THRESHOLD* = 3 + PCRE_CONFIG_MATCH_LIMIT* = 4 + PCRE_CONFIG_STACKRECURSE* = 5 + PCRE_CONFIG_UNICODE_PROPERTIES* = 6 + # Bit flags for the pcre_extra structure + PCRE_EXTRA_STUDY_DATA* = 0x0001 + PCRE_EXTRA_MATCH_LIMIT* = 0x0002 + PCRE_EXTRA_CALLOUT_DATA* = 0x0004 + PCRE_EXTRA_TABLES* = 0x0008 + +# Exported PCRE functions + +proc pcre_compile*(para1: cstring, para2: cint, para3: ptr cstring, + para4: ptr int, para5: Pbyte): Ppcre {. + importc: "pcre_compile", noconv.} + +proc pcre_compile2*(para1: cstring, para2: cint, para3: Pint, para4: PPchar, + para5: ptr int, para6: Pbyte): Ppcre {. + importc: "pcre_compile2", noconv.} + +proc pcre_config*(para1: cint, para2: pointer): cint {. + importc: "pcre_config", noconv.} + +proc pcre_copy_named_substring*(para1: Ppcre, para2: cstring, para3: Pint, + para4: cint, para5: cstring, para6: cstring, + para7: cint): cint {. + importc: "pcre_copy_named_substring", noconv.} + +proc pcre_copy_substring*(para1: cstring, para2: Pint, para3: cint, para4: cint, + para5: cstring, para6: cint): cint {. + importc: "pcre_copy_substring", noconv.} + +proc pcre_dfa_exec*(para1: Ppcre, para2: Ppcre_extra, para3: cstring, + para4: cint, para5: cint, para6: cint, para7: Pint, + para8: cint, para9: Pint, para10: cint): cint {. + importc: "pcre_dfa_exec", noconv.} + +proc pcre_exec*(para1: Ppcre, para2: Ppcre_extra, para3: cstring, + para4: cint, para5: cint, para6: cint, para7: Pint, + para8: cint): cint {.importc: "pcre_exec", noconv.} + +proc pcre_free_substring*(para1: cstring) {. + importc: "pcre_free_substring", noconv.} + +proc pcre_free_substring_list*(para1: PPchar) {. + importc: "pcre_free_substring_list", noconv.} + +proc pcre_fullinfo*(para1: Ppcre, para2: Ppcre_extra, para3: cint, + para4: pointer): cint {.importc: "pcre_fullinfo", noconv.} + +proc pcre_get_named_substring*(para1: Ppcre, para2: cstring, para3: Pint, + para4: cint, para5: cstring, para6: PPchar): cint {. + importc: "pcre_get_named_substring", noconv.} + +proc pcre_get_stringnumber*(para1: Ppcre, para2: cstring): cint {. + importc: "pcre_get_stringnumber", noconv.} + +proc pcre_get_substring*(para1: cstring, para2: Pint, para3: cint, + para4: cint, para5: PPchar): cint {. + importc: "pcre_get_substring", noconv.} + +proc pcre_get_substring_list*(para1: cstring, para2: Pint, para3: cint, + para4: ptr PPchar): cint {. + importc: "pcre_get_substring_list", noconv.} + +proc pcre_info*(para1: Ppcre, para2: Pint, para3: Pint): cint {. + importc: "pcre_info", noconv.} + +proc pcre_maketables*: ptr byte {. + importc: "pcre_maketables", noconv.} + +proc pcre_refcount*(para1: Ppcre, para2: cint): cint {. + importc: "pcre_refcount", noconv.} + +proc pcre_study*(para1: Ppcre, para2: cint, + para3: ptr CString): Ppcre_extra {.importc, noconv.} + +proc pcre_version*: CString {.importc: "pcre_version", noconv.} + +# Indirection for store get and free functions. These can be set to +# alternative malloc/free functions if required. Special ones are used in the +# non-recursive case for "frames". There is also an optional callout function +# that is triggered by the (?) regex item. +# + +# we use Nimrod's memory manager (but not GC!) for these functions: +type + TMalloc = proc (para1: int): pointer {.noconv.} + TFree = proc (para1: pointer) {.noconv.} +var + pcre_malloc {.importc: "pcre_malloc".}: TMalloc + pcre_free {.importc: "pcre_free".}: TFree + pcre_stack_malloc {.importc: "pcre_stack_malloc".}: TMalloc + pcre_stack_free {.importc: "pcre_stack_free".}: TFree + pcre_callout {.importc: "pcre_callout".}: + proc (para1: Ppcre_callout_block): cint {.noconv.} + +pcre_malloc = cast[TMalloc](system.alloc) +pcre_free = cast[TFree](system.dealloc) +pcre_stack_malloc = cast[TMalloc](system.alloc) +pcre_stack_free = cast[TFree](system.dealloc) +pcre_callout = nil diff --git a/lib/base/regexprs.nim b/lib/base/regexprs.nim index b9272ca47..9979035b8 100644 --- a/lib/base/regexprs.nim +++ b/lib/base/regexprs.nim @@ -1,114 +1,115 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2006 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## Regular expression support for Nimrod. -## Currently this module is implemented by providing a wrapper around the -## `PRCE (Perl-Compatible Regular Expressions) <http://www.pcre.org>`_ -## C library. This means that your application will depend on the PRCE -## library's licence when using this module, which should not be a problem -## though. -## PRCE's licence follows: -## -## .. include:: ../doc/regexprs.txt -## - -# This is not just a convenient wrapper for the pcre library; the -# API will stay the same if the implementation should change. - -import - pcre, strutils - -type - EInvalidRegEx* = object of EInvalidValue - ## is raised if the pattern is no valid regular expression. - -const - MaxSubpatterns* = 10 - ## defines the maximum number of subpatterns that can be captured. - ## More subpatterns cannot be captured! - -proc match*(s, pattern: string, substrs: var openarray[string], - start: int = 0): bool - ## returns ``true`` if ``s`` matches the ``pattern[start..]`` and - ## the captured substrings in the array ``substrs``. If it does not - ## match, nothing is written into ``substrs`` and ``false`` is - ## returned. - -proc match*(s, pattern: string, start: int = 0): bool - ## returns ``true`` if ``s`` matches the ``pattern`` beginning from ``start``. - -proc matchLen*(s, pattern: string, substrs: var openarray[string], - start: int = 0): int - ## the same as ``match``, but it returns the length of the match, - ## if there is no match, -1 is returned. Note that a match length - ## of zero can happen. - -proc find*(s, pattern: string, substrs: var openarray[string], - start: int = 0): bool - ## returns ``true`` if ``pattern`` occurs in ``s`` and the captured - ## substrings in the array ``substrs``. If it does not match, nothing - ## is written into ``substrs``. -proc find*(s, pattern: string, start: int = 0): bool - ## returns ``true`` if ``pattern`` occurs in ``s``. - - -proc rawCompile(pattern: string, flags: cint): PPcre = - var - msg: CString - offset: cint - com = pcreCompile(pattern, flags, addr(msg), addr(offset), nil) - if com == nil: - var e: ref EInvalidRegEx - new(e) - e.msg = $msg & "\n" & pattern & "\n" & repeatChar(offset) & "^\n" - raise e - return com - -proc matchOrFind(s: string, pattern: PPcre, substrs: var openarray[string], - start: cint): cint = - var - rawMatches: array [0..maxSubpatterns * 3 - 1, cint] - res = int(pcreExec(pattern, nil, s, length(s), start, 0, - cast[pint](addr(rawMatches)), maxSubpatterns * 3)) - dealloc(pattern) - if res < 0: return res - for i in 0..res-1: - var - a = rawMatches[i * 3] - b = rawMatches[i * 3 + 1] - if a >= 0: substrs[i] = copy(s, a, b) - else: substrs[i] = "" - return res - -proc matchOrFind(s: string, pattern: PPcre, start: cint): cint = - var - rawMatches: array [0..maxSubpatterns * 3 - 1, cint] - res = pcreExec(pattern, nil, s, length(s), start, 0, - cast[pint](addr(rawMatches)), maxSubpatterns * 3) - dealloc(pattern) - return res - -proc match(s, pattern: string, substrs: var openarray[string], - start: int = 0): bool = - return matchOrFind(s, rawCompile(pattern, PCRE_ANCHORED), - substrs, start) >= 0 - -proc matchLen(s, pattern: string, substrs: var openarray[string], - start: int = 0): int = - return matchOrFind(s, rawCompile(pattern, PCRE_ANCHORED), substrs, start) - -proc find(s, pattern: string, substrs: var openarray[string], - start: int = 0): bool = - return matchOrFind(s, rawCompile(pattern, 0), substrs, start) >= 0 - -proc match(s, pattern: string, start: int = 0): bool = - return matchOrFind(s, rawCompile(pattern, PCRE_ANCHORED), start) >= 0 - -proc find(s, pattern: string, start: int = 0): bool = - return matchOrFind(s, rawCompile(pattern, 0), start) >= 0 +# +# +# Nimrod's Runtime Library +# (c) Copyright 2006 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## Regular expression support for Nimrod. +## Currently this module is implemented by providing a wrapper around the +## `PRCE (Perl-Compatible Regular Expressions) <http://www.pcre.org>`_ +## C library. This means that your application will depend on the PRCE +## library's licence when using this module, which should not be a problem +## though. +## PRCE's licence follows: +## +## .. include:: ../doc/regexprs.txt +## + +# This is not just a convenient wrapper for the pcre library; the +# API will stay the same if the implementation should change. + +import + pcre, strutils + +type + EInvalidRegEx* = object of EInvalidValue + ## is raised if the pattern is no valid regular expression. + +const + MaxSubpatterns* = 10 + ## defines the maximum number of subpatterns that can be captured. + ## More subpatterns cannot be captured! + +proc match*(s, pattern: string, matches: var openarray[string], + start: int = 0): bool + ## returns ``true`` if ``s`` matches the ``pattern[start..]`` and + ## the captured substrings in the array ``matches``. If it does not + ## match, nothing is written into ``matches`` and ``false`` is + ## returned. + +proc match*(s, pattern: string, start: int = 0): bool + ## returns ``true`` if ``s`` matches the ``pattern`` beginning from ``start``. + +proc matchLen*(s, pattern: string, matches: var openarray[string], + start: int = 0): int + ## the same as ``match``, but it returns the length of the match, + ## if there is no match, -1 is returned. Note that a match length + ## of zero can happen. + +proc find*(s, pattern: string, matches: var openarray[string], + start: int = 0): bool + ## returns ``true`` if ``pattern`` occurs in ``s`` and the captured + ## substrings in the array ``matches``. If it does not match, nothing + ## is written into ``matches``. +proc find*(s, pattern: string, start: int = 0): bool + ## returns ``true`` if ``pattern`` occurs in ``s``. + + +proc rawCompile(pattern: string, flags: cint): PPcre = + var + msg: CString + offset: int + com = pcreCompile(pattern, flags, addr(msg), addr(offset), nil) + if com == nil: + var e: ref EInvalidRegEx + new(e) + e.msg = $msg & "\n" & pattern & "\n" & repeatChar(offset) & "^\n" + raise e + return com + +proc matchOrFind(s: string, pattern: PPcre, matches: var openarray[string], + start: cint): cint = + var + rawMatches: array [0..maxSubpatterns * 3 - 1, cint] + res = int(pcreExec(pattern, nil, s, len(s), start, 0, + cast[ptr cint](addr(rawMatches)), maxSubpatterns * 3)) + dealloc(pattern) + if res < 0: return res + for i in 0..res-1: + var + a = rawMatches[i * 2] + b = rawMatches[i * 2 + 1] + if a >= 0'i32: matches[i] = copy(s, a, int(b)-1) + else: matches[i] = "" + return res + +proc matchOrFind(s: string, pattern: PPcre, start: cint): cint = + var + rawMatches: array [0..maxSubpatterns * 3 - 1, cint] + res = pcreExec(pattern, nil, s, len(s), start, 0, + cast[ptr cint](addr(rawMatches)), maxSubpatterns * 3) + dealloc(pattern) + return res + +proc match(s, pattern: string, matches: var openarray[string], + start: int = 0): bool = + return matchOrFind(s, rawCompile(pattern, PCRE_ANCHORED), + matches, start) >= 0'i32 + +proc matchLen(s, pattern: string, matches: var openarray[string], + start: int = 0): int = + return matchOrFind(s, rawCompile(pattern, PCRE_ANCHORED), matches, start) + +proc find(s, pattern: string, matches: var openarray[string], + start: int = 0): bool = + return matchOrFind(s, rawCompile(pattern, PCRE_MULTILINE), + matches, start) >= 0'i32 + +proc match(s, pattern: string, start: int = 0): bool = + return matchOrFind(s, rawCompile(pattern, PCRE_ANCHORED), start) >= 0'i32 + +proc find(s, pattern: string, start: int = 0): bool = + return matchOrFind(s, rawCompile(pattern, PCRE_MULTILINE), start) >= 0'i32 diff --git a/lib/cntbits.nim b/lib/cntbits.nim index 0218bf4f2..a975f38ae 100644 --- a/lib/cntbits.nim +++ b/lib/cntbits.nim @@ -1,20 +1,20 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2006 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - - -proc population16(a: int): int {.inline.} = - var x = a - x = ((x and 0xAAAA) shr 1) + (x and 0x5555) - x = ((x and 0xCCCC) shr 2) + (x and 0x3333) - x = ((x and 0xF0F0) shr 4) + (x and 0x0F0F) - x = ((x and 0xFF00) shr 8) + (x and 0x00FF) - return x - -proc countBits(n: int32): int = - result = population16(n and 0xffff) + population16(n shr 16) +# +# +# Nimrod's Runtime Library +# (c) Copyright 2006 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + + +proc population16(a: int): int {.inline.} = + var x = a + x = ((x and 0xAAAA) shr 1) + (x and 0x5555) + x = ((x and 0xCCCC) shr 2) + (x and 0x3333) + x = ((x and 0xF0F0) shr 4) + (x and 0x0F0F) + x = ((x and 0xFF00) shr 8) + (x and 0x00FF) + return x + +proc countBits(n: int32): int = + result = population16(n and 0xffff'i32) + population16(n shr 16'i32) diff --git a/lib/complex.nim b/lib/complex.nim index 6f0f568a3..f50ff4bd0 100644 --- a/lib/complex.nim +++ b/lib/complex.nim @@ -1,106 +1,106 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2006 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - - - -## This module implements complex numbers. - -{.push checks:off, line_dir:off, stack_trace:off, debugger:off.} -# the user does not want to trace a part -# of the standard library! - -import - math - -type - TComplex* = tuple[re, im: float] - ## a complex number, consisting of a real and an imaginary part - -proc `==` *(x, y: TComplex): bool = - ## Compare two complex numbers `x` and `y` for equality. - result = x.re == y.re and x.im == y.im - -proc `+` *(x, y: TComplex): TComplex = - ## Add two complex numbers. - result.re = x.re + y.re - result.im = x.im + y.im - -proc `-` *(x, y: TComplex): TComplex = - ## Subtract two complex numbers. - result.re = x.re - y.re - result.im = x.im - y.im - -proc `-` *(z: TComplex): TComplex = - ## Unary minus for complex numbers. - result.re = -z.re - result.im = -z.im - -proc `/` *(x, y: TComplex): TComplex = - ## Divide `x` by `y`. - var - r, den: float - if abs(y.re) < abs(y.im): - r = y.re / y.im - den = y.im + r * y.re - result.re = (x.re * r + x.im) / den - result.im = (x.im * r - x.re) / den - else: - r = y.im / y.re - den = y.re + r * y.im - result.re = (x.re + r * x.im) / den - result.im = (x.im - r * x.re) / den - -proc `*` *(x, y: TComplex): TComplex = - ## Multiply `x` with `y`. - result.re = x.re * y.re - x.im * y.im - result.im = x.im * y.re + x.re * y.im - -proc abs*(z: TComplex): float = - ## Return the distance from (0,0) to `z`. - - # optimized by checking special cases (sqrt is expensive) - var x, y, temp: float - - x = abs(z.re) - y = abs(z.im) - if x == 0.0: - result = y - elif y == 0.0: - result = x - elif x > y: - temp = y / x - result = x * sqrt(1.0 + temp * temp) - else: - temp = x / y - result = y * sqrt(1.0 + temp * temp) - -proc sqrt*(z: TComplex): TComplex = - ## Square root for a complex number `z`. - var x, y, w, r: float - - if z.re == 0.0 and z.im == 0.0: - result = z - else: - x = abs(z.re) - y = abs(z.im) - if x >= y: - r = y / x - w = sqrt(x) * sqrt(0.5 * (1.0 + sqrt(1.0 + r * r))) - else: - r = x / y - w = sqrt(y) * sqrt(0.5 * (r + sqrt(1.0 + r * r))) - if z.re >= 0.0: - result.re = w - result.im = z.im / (w * 2) - else: - if z.im >= 0.0: result.im = w - else: result.im = -w - result.re = z.im / (c.im + c.im) - -{.pop.} +# +# +# Nimrod's Runtime Library +# (c) Copyright 2006 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + + + +## This module implements complex numbers. + +{.push checks:off, line_dir:off, stack_trace:off, debugger:off.} +# the user does not want to trace a part +# of the standard library! + +import + math + +type + TComplex* = tuple[re, im: float] + ## a complex number, consisting of a real and an imaginary part + +proc `==` *(x, y: TComplex): bool = + ## Compare two complex numbers `x` and `y` for equality. + result = x.re == y.re and x.im == y.im + +proc `+` *(x, y: TComplex): TComplex = + ## Add two complex numbers. + result.re = x.re + y.re + result.im = x.im + y.im + +proc `-` *(x, y: TComplex): TComplex = + ## Subtract two complex numbers. + result.re = x.re - y.re + result.im = x.im - y.im + +proc `-` *(z: TComplex): TComplex = + ## Unary minus for complex numbers. + result.re = -z.re + result.im = -z.im + +proc `/` *(x, y: TComplex): TComplex = + ## Divide `x` by `y`. + var + r, den: float + if abs(y.re) < abs(y.im): + r = y.re / y.im + den = y.im + r * y.re + result.re = (x.re * r + x.im) / den + result.im = (x.im * r - x.re) / den + else: + r = y.im / y.re + den = y.re + r * y.im + result.re = (x.re + r * x.im) / den + result.im = (x.im - r * x.re) / den + +proc `*` *(x, y: TComplex): TComplex = + ## Multiply `x` with `y`. + result.re = x.re * y.re - x.im * y.im + result.im = x.im * y.re + x.re * y.im + +proc abs*(z: TComplex): float = + ## Return the distance from (0,0) to `z`. + + # optimized by checking special cases (sqrt is expensive) + var x, y, temp: float + + x = abs(z.re) + y = abs(z.im) + if x == 0.0: + result = y + elif y == 0.0: + result = x + elif x > y: + temp = y / x + result = x * sqrt(1.0 + temp * temp) + else: + temp = x / y + result = y * sqrt(1.0 + temp * temp) + +proc sqrt*(z: TComplex): TComplex = + ## Square root for a complex number `z`. + var x, y, w, r: float + + if z.re == 0.0 and z.im == 0.0: + result = z + else: + x = abs(z.re) + y = abs(z.im) + if x >= y: + r = y / x + w = sqrt(x) * sqrt(0.5 * (1.0 + sqrt(1.0 + r * r))) + else: + r = x / y + w = sqrt(y) * sqrt(0.5 * (r + sqrt(1.0 + r * r))) + if z.re >= 0.0: + result.re = w + result.im = z.im / (w * 2) + else: + if z.im >= 0.0: result.im = w + else: result.im = -w + result.re = z.im / (c.im + c.im) + +{.pop.} diff --git a/lib/contnrs.nim b/lib/contnrs.nim index c4db5a316..fa993e104 100644 --- a/lib/contnrs.nim +++ b/lib/contnrs.nim @@ -1,5 +1,4 @@ # Container library for Nimrod -# Implemented with macros, because generics sucks in many ways # Data structures for now: # TTable, TSet, TList diff --git a/lib/debugger.nim b/lib/debugger.nim index 03cbb6c0b..f5d526d70 100644 --- a/lib/debugger.nim +++ b/lib/debugger.nim @@ -1,500 +1,500 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2008 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -# This file implements the embedded debugger that can be linked -# with the application. We should not use dynamic memory here as that -# would interfere with the GC and trigger ON/OFF errors if the -# user program corrupts memory. Unfortunately, for dispaying -# variables we use the system.repr() proc which uses Nimrod -# strings and thus allocates memory from the heap. Pity, but -# I do not want to implement repr() twice. We also cannot deactivate -# the GC here as that might run out of memory too quickly... - -type - TDbgState = enum - dbOff, # debugger is turned off - dbStepInto, # debugger is in tracing mode - dbStepOver, - dbSkipCurrent, - dbQuiting, # debugger wants to quit - dbBreakpoints # debugger is only interested in breakpoints - - TDbgBreakpoint {.final.} = object - low, high: int # range from low to high; if disabled - # both low and high are set to their negative values - # this makes the check faster and safes memory - filename: string - name: string # name of breakpoint - - TVarSlot {.compilerproc, final.} = object # variable slots used for debugger: - address: pointer - typ: PNimType - name: cstring # for globals this is "module.name" - - PExtendedFrame = ptr TExtendedFrame - TExtendedFrame {.final.} = object # If the debugger is enabled the compiler - # provides an extended frame. Of course - # only slots that are - # needed are allocated and not 10_000, - # except for the global data description. - f: TFrame - slots: array[0..10_000, TVarSlot] - -var - dbgInSignal: bool # wether the debugger is in the signal handler - dbgIn: TFile # debugger input stream - dbgUser: string = "s" # buffer for user input; first command is ``step_into`` - # needs to be global cause we store the last command - # in it - dbgState: TDbgState = dbStepInto # state of debugger - dbgBP: array[0..127, TDbgBreakpoint] # breakpoints - dbgBPlen: int = 0 - - dbgSkipToFrame: PFrame # frame to be skipped to - - dbgGlobalData: TExtendedFrame # this reserves much space, but - # for now it is the most practical way - - maxDisplayRecDepth: int = 5 # do not display too much data! - -proc findBreakpoint(name: string): int = - # returns -1 if not found - for i in countdown(dbgBPlen-1, 0): - if name == dbgBP[i].name: return i - return -1 - -proc ListBreakPoints() = - write(stdout, "*** endb| Breakpoints:\n") - for i in 0 .. dbgBPlen-1: - write(stdout, dbgBP[i].name & ": " & $abs(dbgBP[i].low) & ".." & - $abs(dbgBP[i].high) & dbgBP[i].filename) - if dbgBP[i].low < 0: - write(stdout, " [disabled]\n") - else: - write(stdout, "\n") - write(stdout, "***\n") - -proc openAppend(filename: string): TFile = - if openFile(result, filename, fmAppend): - write(result, "----------------------------------------\n") - -proc dbgRepr(p: pointer, typ: PNimType): string = - var - cl: TReprClosure - initReprClosure(cl) - cl.recDepth = maxDisplayRecDepth - # locks for the GC turned out to be a bad idea... - # inc(recGcLock) - result = "" - reprAux(result, p, typ, cl) - # dec(recGcLock) - deinitReprClosure(cl) - -proc writeVariable(stream: TFile, slot: TVarSlot) = - write(stream, slot.name) - write(stream, " = ") - writeln(stream, dbgRepr(slot.address, slot.typ)) - -proc ListFrame(stream: TFile, f: PExtendedFrame) = - write(stream, "*** endb| Frame (" & $f.f.len & " slots):\n") - for i in 0 .. f.f.len-1: - writeVariable(stream, f.slots[i]) - write(stream, "***\n") - -proc ListVariables(stream: TFile, f: PExtendedFrame) = - write(stream, "*** endb| Frame (" & $f.f.len & " slots):\n") - for i in 0 .. f.f.len-1: - writeln(stream, f.slots[i].name) - write(stream, "***\n") - -proc debugOut(msg: cstring) = - # the *** *** markers are for easy recognition of debugger - # output for external frontends. - write(stdout, "*** endb| ") - write(stdout, msg) - write(stdout, "***\n") - -proc dbgFatal(msg: cstring) = - debugOut(msg) - dbgAborting = True # the debugger wants to abort - quit(1) - -proc findVariable(frame: PExtendedFrame, varname: cstring): int = - for i in 0 .. frame.f.len - 1: - if c_strcmp(frame.slots[i].name, varname) == 0: return i - return -1 - -proc dbgShowCurrentProc(dbgFramePointer: PFrame) = - if dbgFramePointer != nil: - write(stdout, "*** endb| now in proc: ") - write(stdout, dbgFramePointer.procname) - write(stdout, " ***\n") - else: - write(stdout, "*** endb| (procedure name not available) ***\n") - -proc dbgShowExecutionPoint() = - write(stdout, "*** endb| " & $framePtr.filename & "(" & $framePtr.line & - ") " & $framePtr.procname & " ***\n") - -when defined(windows) or defined(dos) or defined(os2): - {.define: FileSystemCaseInsensitive.} - -proc fileMatches(c, bp: cstring): bool = - # bp = breakpoint filename - # c = current filename - # we consider it a match if bp is a suffix of c - # and the character for the suffix does not exist or - # is one of: \ / : - # depending on the OS case does not matter! - var blen: int = c_strlen(bp) - var clen: int = c_strlen(c) - if blen > clen: return false - # check for \ / : - if clen-blen-1 >= 0 and c[clen-blen-1] notin {'\\', '/', ':'}: - return false - var i = 0 - while i < blen: - var x, y: char - x = bp[i] - y = c[i+clen-blen] - when defined(FileSystemCaseInsensitive): - if x >= 'A' and x <= 'Z': x = chr(ord(x) - ord('A') + ord('a')) - if y >= 'A' and y <= 'Z': y = chr(ord(y) - ord('A') + ord('a')) - if x != y: return false - inc(i) - return true - -proc dbgBreakpointReached(line: int): int = - for i in 0..dbgBPlen-1: - if line >= dbgBP[i].low and line <= dbgBP[i].high and - fileMatches(framePtr.filename, dbgBP[i].filename): return i - return -1 - -proc scanAndAppendWord(src: string, a: var string, start: int): int = - result = start - # skip whitespace: - while src[result] in {'\t', ' '}: inc(result) - while True: - case src[result] - of 'a'..'z', '0'..'9': add(a, src[result]) - of '_': nil # just skip it - of 'A'..'Z': add(a, chr(ord(src[result]) - ord('A') + ord('a'))) - else: break - inc(result) - -proc scanWord(src: string, a: var string, start: int): int = - a = "" - result = scanAndAppendWord(src, a, start) - -proc scanFilename(src: string, a: var string, start: int): int = - result = start - a = "" - # skip whitespace: - while src[result] in {'\t', ' '}: inc(result) - while src[result] notin {'\t', ' ', '\0'}: - add(a, src[result]) - inc(result) - -proc scanNumber(src: string, a: var int, start: int): int = - result = start - a = 0 - while src[result] in {'\t', ' '}: inc(result) - while true: - case src[result] - of '0'..'9': a = a * 10 + ord(src[result]) - ord('0') - of '_': nil # skip underscores (nice for long line numbers) - else: break - inc(result) - -proc dbgHelp() = - debugOut(""" -list of commands (see the manual for further help): - GENERAL -h, help display this help message -q, quit quit the debugger and the program -<ENTER> repeat the previous debugger command - EXECUTING -s, step single step, stepping into routine calls -n, next single step, without stepping into routine calls -f, skipcurrent continue execution until the current routine finishes -c, continue continue execution until the next breakpoint -i, ignore continue execution, ignore all breakpoints - BREAKPOINTS -b, break <name> [fromline [toline]] [file] - set a new breakpoint named 'name' for line and file - if line or file are omitted the current one is used -breakpoints display the entire breakpoint list -disable <name> disable a breakpoint -enable <name> enable a breakpoint - DATA DISPLAY -e, eval <expr> evaluate the expression <expr> -o, out <file> <expr> evaluate <expr> and write it to <file> -w, where display the current execution point -stackframe [file] display current stack frame [and write it to file] -u, up go up in the call stack -d, down go down in the call stack -bt, backtrace display the entire call stack -l, locals display available local variables -g, globals display available global variables -maxdisplay <integer> set the display's recursion maximum -""") - -proc InvalidCommand() = - debugOut("[Warning] invalid command ignored (type 'h' for help) ") - -proc hasExt(s: string): bool = - # returns true if s has a filename extension - for i in countdown(len(s)-1, 0): - if s[i] == '.': return true - return false - -proc setBreakPoint(s: string, start: int) = - var dbgTemp: string - var i = scanWord(s, dbgTemp, start) - if i <= start: - InvalidCommand() - return - if dbgBPlen >= high(dbgBP): - debugOut("[Warning] no breakpoint could be set; out of breakpoint space ") - return - var x = dbgBPlen - inc(dbgBPlen) - dbgBP[x].name = dbgTemp - i = scanNumber(s, dbgBP[x].low, i) - if dbgBP[x].low == 0: - # set to current line: - dbgBP[x].low = framePtr.line - i = scanNumber(s, dbgBP[x].high, i) - if dbgBP[x].high == 0: # set to low: - dbgBP[x].high = dbgBP[x].low - i = scanFilename(s, dbgTemp, i) - if not (dbgTemp.len == 0): - if not hasExt(dbgTemp): add(dbgTemp, ".nim") - dbgBP[x].filename = dbgTemp - else: # use current filename - dbgBP[x].filename = $framePtr.filename - # skip whitespace: - while s[i] in {' ', '\t'}: inc(i) - if s[i] != '\0': - dec(dbgBPLen) # remove buggy breakpoint - InvalidCommand() - -proc BreakpointSetEnabled(s: string, start, enabled: int) = - var dbgTemp: string - var i = scanWord(s, dbgTemp, start) - if i <= start: - InvalidCommand() - return - var x = findBreakpoint(dbgTemp) - if x < 0: debugOut("[Warning] breakpoint does not exist ") - elif enabled * dbgBP[x].low < 0: # signs are different? - dbgBP[x].low = -dbgBP[x].low - dbgBP[x].high = -dbgBP[x].high - -proc dbgEvaluate(stream: TFile, s: string, start: int, - currFrame: PExtendedFrame) = - var dbgTemp: string - var i = scanWord(s, dbgTemp, start) - while s[i] in {' ', '\t'}: inc(i) - var f = currFrame - if s[i] == '.': - inc(i) # skip '.' - add(dbgTemp, '.') - i = scanAndAppendWord(s, dbgTemp, i) - # search for global var: - f = addr(dbgGlobalData) - if s[i] != '\0': - debugOut("[Warning] could not parse expr ") - return - var j = findVariable(f, dbgTemp) - if j < 0: - debugOut("[Warning] could not find variable ") - return - writeVariable(stream, f.slots[j]) - -proc dbgOut(s: string, start: int, currFrame: PExtendedFrame) = - var dbgTemp: string - var i = scanFilename(s, dbgTemp, start) - if dbgTemp.len == 0: - InvalidCommand() - return - var stream = openAppend(dbgTemp) - if stream == nil: - debugOut("[Warning] could not open or create file ") - return - dbgEvaluate(stream, s, i, currFrame) - closeFile(stream) - -proc dbgStackFrame(s: string, start: int, currFrame: PExtendedFrame) = - var dbgTemp: string - var i = scanFilename(s, dbgTemp, start) - if dbgTemp.len == 0: - # just write it to stdout: - ListFrame(stdout, currFrame) - else: - var stream = openAppend(dbgTemp) - if stream == nil: - debugOut("[Warning] could not open or create file ") - return - ListFrame(stream, currFrame) - closeFile(stream) - -proc CommandPrompt() = - # if we return from this routine, user code executes again - var - again: bool = True - dbgFramePtr = framePtr # for going down and up the stack - dbgDown: int = 0 # how often we did go down - - while again: - write(stdout, "*** endb| >>") - var tmp = readLine(stdin) - if tmp.len > 0: dbgUser = tmp - # now look what we have to do: - var dbgTemp: string - var i = scanWord(dbgUser, dbgTemp, 0) - case dbgTemp - of "": InvalidCommand() - of "s", "step": - dbgState = dbStepInto - again = false - of "n", "next": - dbgState = dbStepOver - dbgSkipToFrame = framePtr - again = false - of "f", "skipcurrent": - dbgState = dbSkipCurrent - dbgSkipToFrame = framePtr.prev - again = false - of "c", "continue": - dbgState = dbBreakpoints - again = false - of "i", "ignore": - dbgState = dbOff - again = false - of "h", "help": - dbgHelp() - of "q", "quit": - dbgState = dbQuiting - dbgAborting = True - again = false - quit(1) # BUGFIX: quit with error code > 0 - of "e", "eval": - dbgEvaluate(stdout, dbgUser, i, cast[PExtendedFrame](dbgFramePtr)) - of "o", "out": - dbgOut(dbgUser, i, cast[PExtendedFrame](dbgFramePtr)) - of "stackframe": - dbgStackFrame(dbgUser, i, cast[PExtendedFrame](dbgFramePtr)) - of "w", "where": - dbgShowExecutionPoint() - of "l", "locals": - ListVariables(stdout, cast[PExtendedFrame](dbgFramePtr)) - of "g", "globals": - ListVariables(stdout, addr(dbgGlobalData)) - of "u", "up": - if dbgDown <= 0: - debugOut("[Warning] cannot go up any further ") - else: - dbgFramePtr = framePtr - for j in 0 .. dbgDown-2: # BUGFIX - dbgFramePtr = dbgFramePtr.prev - dec(dbgDown) - dbgShowCurrentProc(dbgFramePtr) - of "d", "down": - if dbgFramePtr != nil: - inc(dbgDown) - dbgFramePtr = dbgFramePtr.prev - dbgShowCurrentProc(dbgFramePtr) - else: - debugOut("[Warning] cannot go down any further ") - of "bt", "backtrace": - WriteStackTrace() - of "b", "break": - setBreakPoint(dbgUser, i) - of "breakpoints": - ListBreakPoints() - of "disable": - BreakpointSetEnabled(dbgUser, i, -1) - of "enable": - BreakpointSetEnabled(dbgUser, i, +1) - of "maxdisplay": - var parsed: int - i = scanNumber(dbgUser, parsed, i) - if dbgUser[i-1] in {'0'..'9'}: - if parsed == 0: maxDisplayRecDepth = -1 - else: maxDisplayRecDepth = parsed - else: - InvalidCommand() - else: - InvalidCommand() - -proc endbStep() = - # we get into here if an unhandled exception has been raised - # XXX: do not allow the user to run the program any further? - # XXX: BUG: the frame is lost here! - dbgShowExecutionPoint() - CommandPrompt() - -proc checkForBreakpoint() = - var i = dbgBreakpointReached(framePtr.line) - if i >= 0: - write(stdout, "*** endb| reached ") - write(stdout, dbgBP[i].name) - write(stdout, " in ") - write(stdout, framePtr.filename) - write(stdout, "(") - write(stdout, framePtr.line) - write(stdout, ") ") - write(stdout, framePtr.procname) - write(stdout, " ***\n") - CommandPrompt() - -# interface to the user program: - -proc dbgRegisterBreakpoint(line: int, - filename, name: cstring) {.compilerproc.} = - var x = dbgBPlen - inc(dbgBPlen) - dbgBP[x].name = $name - dbgBP[x].filename = $filename - dbgBP[x].low = line - dbgBP[x].high = line - -proc dbgRegisterGlobal(name: cstring, address: pointer, - typ: PNimType) {.compilerproc.} = - var i = dbgGlobalData.f.len - if i >= high(dbgGlobalData.slots): - debugOut("[Warning] cannot register global ") - return - dbgGlobalData.slots[i].name = name - dbgGlobalData.slots[i].typ = typ - dbgGlobalData.slots[i].address = address - inc(dbgGlobalData.f.len) - -proc endb(line: int) {.compilerproc.} = - # This proc is called before any Nimrod code line! - # Thus, it must have as few parameters as possible to keep the - # code size small! - # check if we are at an enabled breakpoint or "in the mood" - framePtr.line = line # this is done here for smaller code size! - if dbgLineHook != nil: dbgLineHook() - case dbgState - of dbStepInto: - # we really want the command prompt here: - dbgShowExecutionPoint() - CommandPrompt() - of dbSkipCurrent, dbStepOver: # skip current routine - if framePtr == dbgSkipToFrame: - dbgShowExecutionPoint() - CommandPrompt() - else: # breakpoints are wanted though (I guess) - checkForBreakpoint() - of dbBreakpoints: # debugger is only interested in breakpoints - checkForBreakpoint() - else: nil +# +# +# Nimrod's Runtime Library +# (c) Copyright 2008 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +# This file implements the embedded debugger that can be linked +# with the application. We should not use dynamic memory here as that +# would interfere with the GC and trigger ON/OFF errors if the +# user program corrupts memory. Unfortunately, for dispaying +# variables we use the system.repr() proc which uses Nimrod +# strings and thus allocates memory from the heap. Pity, but +# I do not want to implement repr() twice. We also cannot deactivate +# the GC here as that might run out of memory too quickly... + +type + TDbgState = enum + dbOff, # debugger is turned off + dbStepInto, # debugger is in tracing mode + dbStepOver, + dbSkipCurrent, + dbQuiting, # debugger wants to quit + dbBreakpoints # debugger is only interested in breakpoints + + TDbgBreakpoint {.final.} = object + low, high: int # range from low to high; if disabled + # both low and high are set to their negative values + # this makes the check faster and safes memory + filename: string + name: string # name of breakpoint + + TVarSlot {.compilerproc, final.} = object # variable slots used for debugger: + address: pointer + typ: PNimType + name: cstring # for globals this is "module.name" + + PExtendedFrame = ptr TExtendedFrame + TExtendedFrame {.final.} = object # If the debugger is enabled the compiler + # provides an extended frame. Of course + # only slots that are + # needed are allocated and not 10_000, + # except for the global data description. + f: TFrame + slots: array[0..10_000, TVarSlot] + +var + dbgInSignal: bool # wether the debugger is in the signal handler + dbgIn: TFile # debugger input stream + dbgUser: string = "s" # buffer for user input; first command is ``step_into`` + # needs to be global cause we store the last command + # in it + dbgState: TDbgState = dbStepInto # state of debugger + dbgBP: array[0..127, TDbgBreakpoint] # breakpoints + dbgBPlen: int = 0 + + dbgSkipToFrame: PFrame # frame to be skipped to + + dbgGlobalData: TExtendedFrame # this reserves much space, but + # for now it is the most practical way + + maxDisplayRecDepth: int = 5 # do not display too much data! + +proc findBreakpoint(name: string): int = + # returns -1 if not found + for i in countdown(dbgBPlen-1, 0): + if name == dbgBP[i].name: return i + return -1 + +proc ListBreakPoints() = + write(stdout, "*** endb| Breakpoints:\n") + for i in 0 .. dbgBPlen-1: + write(stdout, dbgBP[i].name & ": " & $abs(dbgBP[i].low) & ".." & + $abs(dbgBP[i].high) & dbgBP[i].filename) + if dbgBP[i].low < 0: + write(stdout, " [disabled]\n") + else: + write(stdout, "\n") + write(stdout, "***\n") + +proc openAppend(filename: string): TFile = + if openFile(result, filename, fmAppend): + write(result, "----------------------------------------\n") + +proc dbgRepr(p: pointer, typ: PNimType): string = + var + cl: TReprClosure + initReprClosure(cl) + cl.recDepth = maxDisplayRecDepth + # locks for the GC turned out to be a bad idea... + # inc(recGcLock) + result = "" + reprAux(result, p, typ, cl) + # dec(recGcLock) + deinitReprClosure(cl) + +proc writeVariable(stream: TFile, slot: TVarSlot) = + write(stream, slot.name) + write(stream, " = ") + writeln(stream, dbgRepr(slot.address, slot.typ)) + +proc ListFrame(stream: TFile, f: PExtendedFrame) = + write(stream, "*** endb| Frame (" & $f.f.len & " slots):\n") + for i in 0 .. f.f.len-1: + writeVariable(stream, f.slots[i]) + write(stream, "***\n") + +proc ListVariables(stream: TFile, f: PExtendedFrame) = + write(stream, "*** endb| Frame (" & $f.f.len & " slots):\n") + for i in 0 .. f.f.len-1: + writeln(stream, f.slots[i].name) + write(stream, "***\n") + +proc debugOut(msg: cstring) = + # the *** *** markers are for easy recognition of debugger + # output for external frontends. + write(stdout, "*** endb| ") + write(stdout, msg) + write(stdout, "***\n") + +proc dbgFatal(msg: cstring) = + debugOut(msg) + dbgAborting = True # the debugger wants to abort + quit(1) + +proc findVariable(frame: PExtendedFrame, varname: cstring): int = + for i in 0 .. frame.f.len - 1: + if c_strcmp(frame.slots[i].name, varname) == 0: return i + return -1 + +proc dbgShowCurrentProc(dbgFramePointer: PFrame) = + if dbgFramePointer != nil: + write(stdout, "*** endb| now in proc: ") + write(stdout, dbgFramePointer.procname) + write(stdout, " ***\n") + else: + write(stdout, "*** endb| (procedure name not available) ***\n") + +proc dbgShowExecutionPoint() = + write(stdout, "*** endb| " & $framePtr.filename & "(" & $framePtr.line & + ") " & $framePtr.procname & " ***\n") + +when defined(windows) or defined(dos) or defined(os2): + {.define: FileSystemCaseInsensitive.} + +proc fileMatches(c, bp: cstring): bool = + # bp = breakpoint filename + # c = current filename + # we consider it a match if bp is a suffix of c + # and the character for the suffix does not exist or + # is one of: \ / : + # depending on the OS case does not matter! + var blen: int = c_strlen(bp) + var clen: int = c_strlen(c) + if blen > clen: return false + # check for \ / : + if clen-blen-1 >= 0 and c[clen-blen-1] notin {'\\', '/', ':'}: + return false + var i = 0 + while i < blen: + var x, y: char + x = bp[i] + y = c[i+clen-blen] + when defined(FileSystemCaseInsensitive): + if x >= 'A' and x <= 'Z': x = chr(ord(x) - ord('A') + ord('a')) + if y >= 'A' and y <= 'Z': y = chr(ord(y) - ord('A') + ord('a')) + if x != y: return false + inc(i) + return true + +proc dbgBreakpointReached(line: int): int = + for i in 0..dbgBPlen-1: + if line >= dbgBP[i].low and line <= dbgBP[i].high and + fileMatches(framePtr.filename, dbgBP[i].filename): return i + return -1 + +proc scanAndAppendWord(src: string, a: var string, start: int): int = + result = start + # skip whitespace: + while src[result] in {'\t', ' '}: inc(result) + while True: + case src[result] + of 'a'..'z', '0'..'9': add(a, src[result]) + of '_': nil # just skip it + of 'A'..'Z': add(a, chr(ord(src[result]) - ord('A') + ord('a'))) + else: break + inc(result) + +proc scanWord(src: string, a: var string, start: int): int = + a = "" + result = scanAndAppendWord(src, a, start) + +proc scanFilename(src: string, a: var string, start: int): int = + result = start + a = "" + # skip whitespace: + while src[result] in {'\t', ' '}: inc(result) + while src[result] notin {'\t', ' ', '\0'}: + add(a, src[result]) + inc(result) + +proc scanNumber(src: string, a: var int, start: int): int = + result = start + a = 0 + while src[result] in {'\t', ' '}: inc(result) + while true: + case src[result] + of '0'..'9': a = a * 10 + ord(src[result]) - ord('0') + of '_': nil # skip underscores (nice for long line numbers) + else: break + inc(result) + +proc dbgHelp() = + debugOut(""" +list of commands (see the manual for further help): + GENERAL +h, help display this help message +q, quit quit the debugger and the program +<ENTER> repeat the previous debugger command + EXECUTING +s, step single step, stepping into routine calls +n, next single step, without stepping into routine calls +f, skipcurrent continue execution until the current routine finishes +c, continue continue execution until the next breakpoint +i, ignore continue execution, ignore all breakpoints + BREAKPOINTS +b, break <name> [fromline [toline]] [file] + set a new breakpoint named 'name' for line and file + if line or file are omitted the current one is used +breakpoints display the entire breakpoint list +disable <name> disable a breakpoint +enable <name> enable a breakpoint + DATA DISPLAY +e, eval <expr> evaluate the expression <expr> +o, out <file> <expr> evaluate <expr> and write it to <file> +w, where display the current execution point +stackframe [file] display current stack frame [and write it to file] +u, up go up in the call stack +d, down go down in the call stack +bt, backtrace display the entire call stack +l, locals display available local variables +g, globals display available global variables +maxdisplay <integer> set the display's recursion maximum +""") + +proc InvalidCommand() = + debugOut("[Warning] invalid command ignored (type 'h' for help) ") + +proc hasExt(s: string): bool = + # returns true if s has a filename extension + for i in countdown(len(s)-1, 0): + if s[i] == '.': return true + return false + +proc setBreakPoint(s: string, start: int) = + var dbgTemp: string + var i = scanWord(s, dbgTemp, start) + if i <= start: + InvalidCommand() + return + if dbgBPlen >= high(dbgBP): + debugOut("[Warning] no breakpoint could be set; out of breakpoint space ") + return + var x = dbgBPlen + inc(dbgBPlen) + dbgBP[x].name = dbgTemp + i = scanNumber(s, dbgBP[x].low, i) + if dbgBP[x].low == 0: + # set to current line: + dbgBP[x].low = framePtr.line + i = scanNumber(s, dbgBP[x].high, i) + if dbgBP[x].high == 0: # set to low: + dbgBP[x].high = dbgBP[x].low + i = scanFilename(s, dbgTemp, i) + if not (dbgTemp.len == 0): + if not hasExt(dbgTemp): add(dbgTemp, ".nim") + dbgBP[x].filename = dbgTemp + else: # use current filename + dbgBP[x].filename = $framePtr.filename + # skip whitespace: + while s[i] in {' ', '\t'}: inc(i) + if s[i] != '\0': + dec(dbgBPLen) # remove buggy breakpoint + InvalidCommand() + +proc BreakpointSetEnabled(s: string, start, enabled: int) = + var dbgTemp: string + var i = scanWord(s, dbgTemp, start) + if i <= start: + InvalidCommand() + return + var x = findBreakpoint(dbgTemp) + if x < 0: debugOut("[Warning] breakpoint does not exist ") + elif enabled * dbgBP[x].low < 0: # signs are different? + dbgBP[x].low = -dbgBP[x].low + dbgBP[x].high = -dbgBP[x].high + +proc dbgEvaluate(stream: TFile, s: string, start: int, + currFrame: PExtendedFrame) = + var dbgTemp: string + var i = scanWord(s, dbgTemp, start) + while s[i] in {' ', '\t'}: inc(i) + var f = currFrame + if s[i] == '.': + inc(i) # skip '.' + add(dbgTemp, '.') + i = scanAndAppendWord(s, dbgTemp, i) + # search for global var: + f = addr(dbgGlobalData) + if s[i] != '\0': + debugOut("[Warning] could not parse expr ") + return + var j = findVariable(f, dbgTemp) + if j < 0: + debugOut("[Warning] could not find variable ") + return + writeVariable(stream, f.slots[j]) + +proc dbgOut(s: string, start: int, currFrame: PExtendedFrame) = + var dbgTemp: string + var i = scanFilename(s, dbgTemp, start) + if dbgTemp.len == 0: + InvalidCommand() + return + var stream = openAppend(dbgTemp) + if stream == nil: + debugOut("[Warning] could not open or create file ") + return + dbgEvaluate(stream, s, i, currFrame) + closeFile(stream) + +proc dbgStackFrame(s: string, start: int, currFrame: PExtendedFrame) = + var dbgTemp: string + var i = scanFilename(s, dbgTemp, start) + if dbgTemp.len == 0: + # just write it to stdout: + ListFrame(stdout, currFrame) + else: + var stream = openAppend(dbgTemp) + if stream == nil: + debugOut("[Warning] could not open or create file ") + return + ListFrame(stream, currFrame) + closeFile(stream) + +proc CommandPrompt() = + # if we return from this routine, user code executes again + var + again: bool = True + dbgFramePtr = framePtr # for going down and up the stack + dbgDown: int = 0 # how often we did go down + + while again: + write(stdout, "*** endb| >>") + var tmp = readLine(stdin) + if tmp.len > 0: dbgUser = tmp + # now look what we have to do: + var dbgTemp: string + var i = scanWord(dbgUser, dbgTemp, 0) + case dbgTemp + of "": InvalidCommand() + of "s", "step": + dbgState = dbStepInto + again = false + of "n", "next": + dbgState = dbStepOver + dbgSkipToFrame = framePtr + again = false + of "f", "skipcurrent": + dbgState = dbSkipCurrent + dbgSkipToFrame = framePtr.prev + again = false + of "c", "continue": + dbgState = dbBreakpoints + again = false + of "i", "ignore": + dbgState = dbOff + again = false + of "h", "help": + dbgHelp() + of "q", "quit": + dbgState = dbQuiting + dbgAborting = True + again = false + quit(1) # BUGFIX: quit with error code > 0 + of "e", "eval": + dbgEvaluate(stdout, dbgUser, i, cast[PExtendedFrame](dbgFramePtr)) + of "o", "out": + dbgOut(dbgUser, i, cast[PExtendedFrame](dbgFramePtr)) + of "stackframe": + dbgStackFrame(dbgUser, i, cast[PExtendedFrame](dbgFramePtr)) + of "w", "where": + dbgShowExecutionPoint() + of "l", "locals": + ListVariables(stdout, cast[PExtendedFrame](dbgFramePtr)) + of "g", "globals": + ListVariables(stdout, addr(dbgGlobalData)) + of "u", "up": + if dbgDown <= 0: + debugOut("[Warning] cannot go up any further ") + else: + dbgFramePtr = framePtr + for j in 0 .. dbgDown-2: # BUGFIX + dbgFramePtr = dbgFramePtr.prev + dec(dbgDown) + dbgShowCurrentProc(dbgFramePtr) + of "d", "down": + if dbgFramePtr != nil: + inc(dbgDown) + dbgFramePtr = dbgFramePtr.prev + dbgShowCurrentProc(dbgFramePtr) + else: + debugOut("[Warning] cannot go down any further ") + of "bt", "backtrace": + WriteStackTrace() + of "b", "break": + setBreakPoint(dbgUser, i) + of "breakpoints": + ListBreakPoints() + of "disable": + BreakpointSetEnabled(dbgUser, i, -1) + of "enable": + BreakpointSetEnabled(dbgUser, i, +1) + of "maxdisplay": + var parsed: int + i = scanNumber(dbgUser, parsed, i) + if dbgUser[i-1] in {'0'..'9'}: + if parsed == 0: maxDisplayRecDepth = -1 + else: maxDisplayRecDepth = parsed + else: + InvalidCommand() + else: + InvalidCommand() + +proc endbStep() = + # we get into here if an unhandled exception has been raised + # XXX: do not allow the user to run the program any further? + # XXX: BUG: the frame is lost here! + dbgShowExecutionPoint() + CommandPrompt() + +proc checkForBreakpoint() = + var i = dbgBreakpointReached(framePtr.line) + if i >= 0: + write(stdout, "*** endb| reached ") + write(stdout, dbgBP[i].name) + write(stdout, " in ") + write(stdout, framePtr.filename) + write(stdout, "(") + write(stdout, framePtr.line) + write(stdout, ") ") + write(stdout, framePtr.procname) + write(stdout, " ***\n") + CommandPrompt() + +# interface to the user program: + +proc dbgRegisterBreakpoint(line: int, + filename, name: cstring) {.compilerproc.} = + var x = dbgBPlen + inc(dbgBPlen) + dbgBP[x].name = $name + dbgBP[x].filename = $filename + dbgBP[x].low = line + dbgBP[x].high = line + +proc dbgRegisterGlobal(name: cstring, address: pointer, + typ: PNimType) {.compilerproc.} = + var i = dbgGlobalData.f.len + if i >= high(dbgGlobalData.slots): + debugOut("[Warning] cannot register global ") + return + dbgGlobalData.slots[i].name = name + dbgGlobalData.slots[i].typ = typ + dbgGlobalData.slots[i].address = address + inc(dbgGlobalData.f.len) + +proc endb(line: int) {.compilerproc.} = + # This proc is called before any Nimrod code line! + # Thus, it must have as few parameters as possible to keep the + # code size small! + # check if we are at an enabled breakpoint or "in the mood" + framePtr.line = line # this is done here for smaller code size! + if dbgLineHook != nil: dbgLineHook() + case dbgState + of dbStepInto: + # we really want the command prompt here: + dbgShowExecutionPoint() + CommandPrompt() + of dbSkipCurrent, dbStepOver: # skip current routine + if framePtr == dbgSkipToFrame: + dbgShowExecutionPoint() + CommandPrompt() + else: # breakpoints are wanted though (I guess) + checkForBreakpoint() + of dbBreakpoints: # debugger is only interested in breakpoints + checkForBreakpoint() + else: nil diff --git a/lib/dlmalloc.c b/lib/dlmalloc.c index c907da830..2a8b299a1 100644 --- a/lib/dlmalloc.c +++ b/lib/dlmalloc.c @@ -1,12 +1,15 @@ + #define USE_DL_PREFIX +#define ASSEMBLY_VERSION +/* #define FOOTERS 1 #define DEBUG 1 -/* + #define ABORT_ON_ASSERT_FAILURE 0 */ -#define ABORT do { printf("abort was called\n"); abort(); } while (0) +#define ABORT do { /*printf("abort was called\n");*/ abort(); } while (0) /* This is a version (aka dlmalloc) of malloc/free/realloc written by @@ -2210,7 +2213,7 @@ static size_t traverse_and_check(mstate m); #define treebin_at(M,i) (&((M)->treebins[i])) /* assign tree index for size S to variable I */ -#if defined(__GNUC__) && defined(i386) +#if defined(__GNUC__) && defined(i386) && defined(ASSEMBLY_VERSION) #define compute_tree_index(S, I)\ {\ size_t X = S >> TREEBIN_SHIFT;\ @@ -2275,7 +2278,7 @@ static size_t traverse_and_check(mstate m); /* index corresponding to given bit */ -#if defined(__GNUC__) && defined(i386) +#if defined(__GNUC__) && defined(i386) && defined(ASSEMBLY_VERSION) #define compute_bit2idx(X, I)\ {\ unsigned int J;\ diff --git a/lib/dyncalls.nim b/lib/dyncalls.nim index 78c3fa115..7d7ade26c 100644 --- a/lib/dyncalls.nim +++ b/lib/dyncalls.nim @@ -7,25 +7,14 @@ # distribution, for details about the copyright. # - -# # This file implements the ability to call native procs from libraries. # It is not possible to do this in a platform independant way, unfortunately. # However, the interface has been designed to take platform differences into # account and been ported to all major platforms. -# -# interface type EInvalidLibrary = object of EOS -when defined(windows) or defined(dos): - {.define: USE_DLL.} -elif defined(posix): - {.define: USE_DLOPEN.} -elif defined(mac): - {.define: USE_DYLD.} - type TLibHandle = pointer # private type TProcAddr = pointer # libary loading and loading of procs: @@ -37,15 +26,13 @@ proc nimLoadLibrary(path: string): TLibHandle {.compilerproc.} proc nimUnloadLibrary(lib: TLibHandle) {.compilerproc.} proc nimGetProcAddr(lib: TLibHandle, name: cstring): TProcAddr {.compilerproc.} -#implementation - # this code was inspired from Lua's source code: # Lua - An Extensible Extension Language # Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil # http://www.lua.org # mailto:info@lua.org -when defined(USE_DLOPEN): +when defined(posix): # # ========================================================================= # This is an implementation based on the dlfcn interface. @@ -76,7 +63,7 @@ when defined(USE_DLOPEN): proc nimGetProcAddr(lib: TLibHandle, name: cstring): TProcAddr = result = dlsym(lib, name) -elif defined(USE_DLL): +elif defined(windows) or defined(dos): # # ======================================================================= # Native Windows Implementation @@ -96,13 +83,13 @@ elif defined(USE_DLL): proc nimLoadLibrary(path: string): TLibHandle = result = cast[TLibHandle](winLoadLibrary(path)) - if result == nil: + if result == nil: raise newException(EInvalidLibrary, "could not load: " & path) proc nimGetProcAddr(lib: TLibHandle, name: cstring): TProcAddr = result = GetProcAddress(cast[THINSTANCE](lib), name) -elif defined(USE_DYLD): +elif defined(mac): # # ======================================================================= # Native Mac OS X / Darwin Implementation diff --git a/lib/ecmasys.nim b/lib/ecmasys.nim index 10a6247d4..2bbbd5f79 100644 --- a/lib/ecmasys.nim +++ b/lib/ecmasys.nim @@ -15,6 +15,7 @@ proc GC_fullCollect() = nil proc GC_setStrategy(strategy: TGC_Strategy) = nil proc GC_enableMarkAndSweep() = nil proc GC_disableMarkAndSweep() = nil +proc GC_getStatistics(): string = return "" proc getOccupiedMem(): int = return -1 proc getFreeMem(): int = return -1 diff --git a/lib/excpt.nim b/lib/excpt.nim index 8adb3d5a9..9c87fab55 100644 --- a/lib/excpt.nim +++ b/lib/excpt.nim @@ -171,8 +171,7 @@ var proc signalHandler(sig: cint) {.exportc: "signalHandler", noconv.} = # print stack trace and quit - var - s = int(sig) + var s = sig GC_disable() setLen(buf, 0) rawWriteStackTrace(buf) @@ -199,7 +198,8 @@ proc registerSignalHandler() = c_signal(SIGILL, signalHandler) c_signal(SIGBUS, signalHandler) -registerSignalHandler() # call it in initialization section +when not defined(noSignalHandler): + registerSignalHandler() # call it in initialization section # for easier debugging of the GC, this memory is only allocated after the # signal handlers have been registered new(gAssertionFailed) @@ -256,3 +256,12 @@ proc chckObj(obj, subclass: PNimType) {.compilerproc.} = proc chckObjAsgn(a, b: PNimType) {.compilerproc, inline.} = if a != b: raise newException(EInvalidObjectAssignment, "invalid object assignment") + +proc isObj(obj, subclass: PNimType): bool {.compilerproc.} = + # checks if obj is of type subclass: + var x = obj + if x == subclass: return true # optimized fast path + while x != subclass: + if x == nil: return false + x = x.base + return true diff --git a/lib/gc.nim b/lib/gc.nim index 72a287064..680256a93 100644 --- a/lib/gc.nim +++ b/lib/gc.nim @@ -9,20 +9,71 @@ # Garbage Collector +# Current Features: +# * incremental +# * non-recursive +# * generational +# * excellent performance + +# Future Improvements: +# * Both dlmalloc and TLSF lack zero-overhead object allocation. Thus, for +# small objects we will should use our own allocator. +# * Support for multi-threading. However, locks for the reference counting +# might turn out to be too slow. + +# --------------------------------------------------------------------------- +# Interface to TLSF: +const + useTLSF = false # benchmarking showed that *dlmalloc* is faster than *TLSF* + +when useTLSF: + {.compile: "tlsf.c".} + + proc tlsfUsed: int {.importc: "TLSF_GET_USED_SIZE", noconv.} + proc tlsfMax: int {.importc: "TLSF_GET_MAX_SIZE", noconv.} + + proc tlsf_malloc(size: int): pointer {.importc, noconv.} + proc tlsf_free(p: pointer) {.importc, noconv.} + proc tlsf_realloc(p: pointer, size: int): pointer {.importc, noconv.} +else: + # use DL malloc + {.compile: "dlmalloc.c".} + proc tlsfUsed: int {.importc: "dlmalloc_footprint", noconv.} + proc tlsfMax: int {.importc: "dlmalloc_max_footprint", noconv.} + + proc tlsf_malloc(size: int): pointer {.importc: "dlmalloc", noconv.} + proc tlsf_free(p: pointer) {.importc: "dlfree", noconv.} + proc tlsf_realloc(p: pointer, size: int): pointer {. + importc: "dlrealloc", noconv.} -# For a description of the algorithms used here see: -# intern.html +# --------------------------------------------------------------------------- -{.define: debugGC.} # we wish to debug the GC... +proc getOccupiedMem(): int = return tlsfUsed() +proc getFreeMem(): int = return tlsfMax() - tlsfUsed() +proc getTotalMem(): int = return tlsfMax() -#when defined(debugGC): -# {.define: logGC.} # define if the GC should log some of its activities +# --------------------------------------------------------------------------- -{.define: cycleGC.} +# After several attempts, we now use a novel approach for cycle detection: +# increments/decrements of the reference counters are enqued into a buffer +# and not immediately performed. The reason is that increments may introduce +# new garbage cycles. The cycle detector only scans the changed subgraph. This +# provides superior performance. Of course only cells that may be part of +# a cycle are considered. However, reallocation does not work with this scheme! +# Because the queue may contain references to the old cell. +# The queue is thread-local storage, so that no synchronization is needed for +# reference counting. + +# With this scheme, the entire heap is never searched and there is no need for +# the AT. const + debugGC = false # we wish to debug the GC... + logGC = false traceGC = false # extensive debugging reallyDealloc = true # for debugging purposes this can be set to false + cycleGC = true # (de)activate the cycle GC + stressGC = debugGC # Guess the page size of the system; if it is the # wrong value, performance may be worse (this is not @@ -32,103 +83,107 @@ const PageSize = 1 shl PageShift # on 32 bit systems 4096 CycleIncrease = 2 # is a multiplicative increase - InitialCycleThreshold = 8*1024*1024 # X MB because cycle checking is slow - ZctThreshold = 512 # we collect garbage if the ZCT's size + InitialCycleThreshold = 4*1024*1024 # X MB because cycle checking is slow + ZctThreshold = 256 # we collect garbage if the ZCT's size # reaches this threshold - # this needs benchmarking... - -when defined(debugGC): - const stressGC = False -else: - const stressGC = False + # this seems to be a good value -# things the System module thinks should be available: -when defined(useDL) or defined(nativeDL): - type - TMallocInfo {.importc: "struct mallinfo", nodecl, final.} = object - arena: cint # non-mmapped space allocated from system - ordblks: cint # number of free chunks - smblks: cint # number of fastbin blocks - hblks: cint # number of mmapped regions - hblkhd: cint # space in mmapped regions - usmblks: cint # maximum total allocated space - fsmblks: cint # space available in freed fastbin blocks - uordblks: cint # total allocated space - fordblks: cint # total free space - keepcost: cint # top-most, releasable (via malloc_trim) space - -when defined(useDL): - proc mallinfo: TMallocInfo {.importc: "dlmallinfo", nodecl.} -elif defined(nativeDL): - proc mallinfo: TMallocInfo {.importc: "mallinfo", nodecl.} - -when defined(useDL) or defined(nativeDL): - proc getOccupiedMem(): int = return mallinfo().uordblks - proc getFreeMem(): int = return mallinfo().fordblks - proc getTotalMem(): int = - var m = mallinfo() - return int(m.hblkhd) + int(m.arena) -else: # not available: - proc getOccupiedMem(): int = return -1 - proc getFreeMem(): int = return -1 - proc getTotalMem(): int = return -1 +const + MemAlignment = sizeof(pointer)*2 # minimal memory block that can be allocated + BitsPerUnit = sizeof(int)*8 + # a "unit" is a word, i.e. 4 bytes + # on a 32 bit system; I do not use the term "word" because under 32-bit + # Windows it is sometimes only 16 bits -var - cycleThreshold: int = InitialCycleThreshold + BitsPerPage = PageSize div MemAlignment + UnitsPerPage = BitsPerPage div BitsPerUnit + # how many units do we need to describe a page: + # on 32 bit systems this is only 16 (!) - memUsed: int = 0 # we have to keep track how much we have allocated + rcIncrement = 0b1000 # so that lowest 3 bits are not touched + # NOTE: Most colors are currently unused + rcBlack = 0b000 # cell is colored black; in use or free + rcGray = 0b001 # possible member of a cycle + rcWhite = 0b010 # member of a garbage cycle + rcPurple = 0b011 # possible root of a cycle + rcZct = 0b100 # in ZCT + rcRed = 0b101 # Candidate cycle undergoing sigma-computation + rcOrange = 0b110 # Candidate cycle awaiting epoch boundary + rcShift = 3 # shift by rcShift to get the reference counter + colorMask = 0b111 +type + TWalkOp = enum + waZctDecRef, waPush, waCycleDecRef - recGcLock: int = 0 - # we use a lock to prevend the garbage collector to - # be triggered in a finalizer; the collector should not call - # itself this way! Thus every object allocated by a finalizer - # will not trigger a garbage collection. This is wasteful but safe. - # This is a lock against recursive garbage collection, not a lock for - # threads! - -when defined(useDL) and not defined(nativeDL): - {.compile: "dlmalloc.c".} + TCell {.pure.} = object + refcount: int # the refcount and some flags + typ: PNimType + when debugGC: + filename: cstring + line: int -type + PCell = ptr TCell TFinalizer {.compilerproc.} = proc (self: pointer) # A ref type can have a finalizer that is called before the object's # storage is freed. PPointer = ptr pointer + TByteArray = array[0..1000_0000, byte] + PByte = ptr TByteArray + PString = ptr string -proc asgnRef(dest: ppointer, src: pointer) {.compilerproc.} -proc unsureAsgnRef(dest: ppointer, src: pointer) {.compilerproc.} - # unsureAsgnRef updates the reference counters only if dest is not on the - # stack. It is used by the code generator if it cannot decide wether a - # reference is in the stack or not (this can happen for out/var parameters). -proc growObj(old: pointer, newsize: int): pointer {.compilerproc.} -proc newObj(typ: PNimType, size: int): pointer {.compilerproc.} -proc newSeq(typ: PNimType, len: int): pointer {.compilerproc.} - -# implementation: - -when defined(useDL): - proc nimSize(p: pointer): int {. - importc: "dlmalloc_usable_size", header: "dlmalloc.h".} -elif defined(nativeDL): - proc nimSize(p: pointer): int {. - importc: "malloc_usable_size", header: "<malloc.h>".} + PPageDesc = ptr TPageDesc + TBitIndex = range[0..UnitsPerPage-1] + TPageDesc {.final, pure.} = object + next: PPageDesc # all nodes are connected with this pointer + key: TAddress # start address at bit 0 + bits: array[TBitIndex, int] # a bit vector -type - TWalkOp = enum - waNone, waRelease, waZctDecRef, waCycleDecRef, waCycleIncRef, waDebugIncRef + PPageDescArray = ptr array[0..1000_000, PPageDesc] + TCellSet {.final, pure.} = object + counter, max: int + head: PPageDesc + data: PPageDescArray - TCollectorData = int - TCell {.final.} = object - refcount: TCollectorData # the refcount and bit flags - typ: PNimType - when stressGC: - stackcount: int # stack counter for debugging - drefc: int # real reference counter for debugging + PCellArray = ptr array[0..100_000_000, PCell] + TCellSeq {.final, pure.} = object + len, cap: int + d: PCellArray - PCell = ptr TCell + TGcHeap {.final, pure.} = object # this contains the zero count and + # non-zero count table + mask: TAddress # mask for fast pointer detection + zct: TCellSeq # the zero count table + stackCells: TCellSet # cells and addresses that look like a cell but + # aren't of the hardware stack + + stackScans: int # number of performed stack scans (for statistics) + cycleCollections: int # number of performed full collections + maxThreshold: int # max threshold that has been set + maxStackSize: int # max stack size + maxStackPages: int # max number of pages in stack + cycleTableSize: int # max entries in cycle table + cycleRoots: TCellSet + tempStack: TCellSeq # temporary stack for recursion elimination var gOutOfMem: ref EOutOfMemory + stackBottom: pointer + gch: TGcHeap + cycleThreshold: int = InitialCycleThreshold + recGcLock: int = 0 + # we use a lock to prevend the garbage collector to be triggered in a + # finalizer; the collector should not call itself this way! Thus every + # object allocated by a finalizer will not trigger a garbage collection. + # This is wasteful but safe. This is a lock against recursive garbage + # collection, not a lock for threads! + +proc unsureAsgnRef(dest: ppointer, src: pointer) {.compilerproc.} + # unsureAsgnRef updates the reference counters only if dest is not on the + # stack. It is used by the code generator if it cannot decide wether a + # reference is in the stack or not (this can happen for out/var parameters). +#proc growObj(old: pointer, newsize: int): pointer {.compilerproc.} +proc newObj(typ: PNimType, size: int): pointer {.compilerproc.} +proc newSeq(typ: PNimType, len: int): pointer {.compilerproc.} proc raiseOutOfMem() {.noreturn.} = if gOutOfMem == nil: @@ -145,17 +200,22 @@ proc usrToCell(usr: pointer): PCell {.inline.} = # convert pointer to userdata to object (=pointer to refcount) result = cast[PCell](cast[TAddress](usr)-%TAddress(sizeof(TCell))) +proc canbeCycleRoot(c: PCell): bool {.inline.} = + result = ntfAcyclic notin c.typ.flags + proc extGetCellType(c: pointer): PNimType {.compilerproc.} = # used for code generation concerning debugging result = usrToCell(c).typ proc internRefcount(p: pointer): int {.exportc: "getRefcount".} = result = int(usrToCell(p).refcount) - if result < 0: result = 0 + if result > 0: result = result shr rcShift + else: result = 0 proc gcAlloc(size: int): pointer = - result = alloc0(size) + result = tlsf_malloc(size) if result == nil: raiseOutOfMem() + zeroMem(result, size) proc GC_disable() = inc(recGcLock) proc GC_enable() = @@ -181,95 +241,29 @@ proc nextTry(h, maxHash: int): int {.inline.} = # generates each int in range(maxHash) exactly once (see any text on # random-number generation for proof). -# ------------------ Any table (AT) ------------- - -# these values are for DL-malloc known for sure (and other allocators -# can only be worse): -when defined(useDL) or not defined(bcc): - const MemAlignment = 8 # minimal memory block that can be allocated -else: - const MemAlignment = 4 # Borland's memory manager is terrible! - -const - BitsPerUnit = sizeof(int)*8 - # a "unit" is a word, i.e. 4 bytes - # on a 32 bit system; I do not use the term "word" because under 32-bit - # Windows it is sometimes only 16 bits - - BitsPerPage = PageSize div MemAlignment - UnitsPerPage = BitsPerPage div BitsPerUnit - # how many units do we need to describe a page: - # on 32 bit systems this is only 16 (!) - # this that has to equals zero, otherwise we have to round up UnitsPerPage: when BitsPerPage mod BitsPerUnit != 0: {.error: "(BitsPerPage mod BitsPerUnit) should be zero!".} -# ------------------- cell set handling ------------------------------ -# A cellset consists of a hash table of page descriptors. A page -# descriptor has a bit for every Memalignment'th byte in the page. -# However, only bits corresponding to addresses that start memory blocks -# are set. -# Page descriptors are also linked to a list; the list -# is used for easy traversing of all page descriptors; this allows a -# fast iterator. -# We use a specialized hashing scheme; the formula is : -# hash = Page bitand max -# We use linear probing with the formular: (5*h)+1 -# Thus we likely get no collisions at all if the pages are given us -# sequentially by the operating system! -type - PPageDesc = ptr TPageDesc - - TBitIndex = range[0..UnitsPerPage-1] - - TPageDesc {.final.} = object - next: PPageDesc # all nodes are connected with this pointer - key: TAddress # start address at bit 0 - bits: array[TBitIndex, int] # a bit vector - - PPageDescArray = ptr array[0..1000_000, PPageDesc] - TCellSet {.final.} = object - counter, max: int - head: PPageDesc - data: PPageDescArray - - PCellArray = ptr array[0..100_000_000, PCell] - TCellSeq {.final.} = object - len, cap: int - d: PCellArray - - TSlowSet {.final.} = object # used for debugging purposes only - L: int # current length - cap: int # capacity - d: PCellArray - - TGcHeap {.final.} = object # this contains the zero count and - # non-zero count table - mask: TAddress # mask for fast pointer detection - zct: TCellSeq # the zero count table - at: TCellSet # a table that contains all references - newAT: TCellSet - stackCells: TCellSeq # cells that need to be decremented because they - # are in the hardware stack; a cell may occur - # several times in this data structure +# ------------------- cell set handling --------------------------------------- -var - stackBottom: pointer - gch: TGcHeap +proc inOperator(s: TCellSeq, c: PCell): bool {.inline.} = + for i in 0 .. s.len-1: + if s.d[i] == c: return True + return False proc add(s: var TCellSeq, c: PCell) {.inline.} = if s.len >= s.cap: s.cap = s.cap * 3 div 2 - s.d = cast[PCellArray](realloc(s.d, s.cap * sizeof(PCell))) + s.d = cast[PCellArray](tlsf_realloc(s.d, s.cap * sizeof(PCell))) if s.d == nil: raiseOutOfMem() s.d[s.len] = c inc(s.len) -proc inOperator(s: TCellSeq, c: PCell): bool {.inline.} = - for i in 0 .. s.len-1: - if s.d[i] == c: return True - return False +proc addZCT(s: var TCellSeq, c: PCell) = + if (c.refcount and colorMask) != rcZct: + c.refcount = c.refcount and not colorMask or rcZct + add(s, c) proc init(s: var TCellSeq, cap: int = 1024) = s.len = 0 @@ -289,13 +283,13 @@ proc CellSetDeinit(s: var TCellSet) = var it = s.head while it != nil: var n = it.next - dealloc(it) + tlsf_free(it) it = n s.head = nil # play it safe here - dealloc(s.data) + tlsf_free(s.data) s.data = nil s.counter = 0 - + proc CellSetGet(t: TCellSet, key: TAddress): PPageDesc = var h = cast[int](key) and t.max while t.data[h] != nil: @@ -313,15 +307,13 @@ proc CellSetRawInsert(t: TCellSet, data: PPageDescArray, data[h] = desc proc CellSetEnlarge(t: var TCellSet) = - var - n: PPageDescArray - oldMax = t.max + var oldMax = t.max t.max = ((t.max+1)*2)-1 - n = cast[PPageDescArray](gcAlloc((t.max + 1) * sizeof(PPageDesc))) + var n = cast[PPageDescArray](gcAlloc((t.max + 1) * sizeof(PPageDesc))) for i in 0 .. oldmax: if t.data[i] != nil: CellSetRawInsert(t, n, t.data[i]) - dealloc(t.data) + tlsf_free(t.data) t.data = n proc CellSetPut(t: var TCellSet, key: TAddress): PPageDesc = @@ -345,14 +337,11 @@ proc CellSetPut(t: var TCellSet, key: TAddress): PPageDesc = t.head = result t.data[h] = result -# ---------- slightly higher level procs ---------------------------------- +# ---------- slightly higher level procs -------------------------------------- proc in_Operator(s: TCellSet, cell: PCell): bool = - var - u: TAddress - t: PPageDesc - u = cast[TAddress](cell) - t = CellSetGet(s, u shr PageShift) + var u = cast[TAddress](cell) + var t = CellSetGet(s, u shr PageShift) if t != nil: u = (u %% PageSize) /% MemAlignment result = (t.bits[u /% BitsPerUnit] and (1 shl (u %% BitsPerUnit))) != 0 @@ -360,21 +349,15 @@ proc in_Operator(s: TCellSet, cell: PCell): bool = result = false proc incl(s: var TCellSet, cell: PCell) = - var - u: TAddress - t: PPageDesc - u = cast[TAddress](cell) - t = CellSetPut(s, u shr PageShift) + var u = cast[TAddress](cell) + var t = CellSetPut(s, u shr PageShift) u = (u %% PageSize) /% MemAlignment t.bits[u /% BitsPerUnit] = t.bits[u /% BitsPerUnit] or (1 shl (u %% BitsPerUnit)) proc excl(s: var TCellSet, cell: PCell) = - var - u: TAddress - t: PPageDesc - u = cast[TAddress](cell) - t = CellSetGet(s, u shr PageShift) + var u = cast[TAddress](cell) + var t = CellSetGet(s, u shr PageShift) if t != nil: u = (u %% PageSize) /% MemAlignment t.bits[u /% BitsPerUnit] = (t.bits[u /% BitsPerUnit] and @@ -400,97 +383,43 @@ iterator elements(t: TCellSet): PCell {.inline.} = # --------------- end of Cellset routines ------------------------------------- -proc testPageDescs() = - var root: TCellSet - CellSetInit(root) - #var u = 10_000 - #while u <= 20_000: - # incl(root, cast[PCell](u)) - # inc(u, 8) - - incl(root, cast[PCell](0x81cdfb8)) - for cell in elements(root): - c_fprintf(c_stdout, "%p\n", cast[int](cell)) - -#testPageDescs() - -when defined(debugGC): +when logGC or traceGC: proc writeCell(msg: CString, c: PCell) = - if c.typ != nil: - if c.typ.kind == tyString: - c_fprintf(c_stdout, "%s\n", cast[TAddress](cellToUsr(c)) + sizeof(int)*2) - c_fprintf(c_stdout, "%s: %p %d\n", msg, c, c.typ.kind) - else: c_fprintf(c_stdout, "%s: %p (nil type)\n", msg, c) - proc writePtr(msg: CString, p: Pointer) = - c_fprintf(c_stdout, "%s: %p\n", msg, p) - + var kind = -1 + if c.typ != nil: kind = ord(c.typ.kind) + when debugGC: + c_fprintf(c_stdout, "[GC] %s: %p %d rc=%ld from %s(%ld)\n", + msg, c, kind, c.refcount shr rcShift, c.filename, c.line) + else: + c_fprintf(c_stdout, "[GC] %s: %p %d rc=%ld\n", + msg, c, kind, c.refcount shr rcShift) when traceGC: # traceGC is a special switch to enable extensive debugging type TCellState = enum csAllocated, csZctFreed, csCycFreed - - proc cellSetInit(s: var TSlowSet) = - s.L = 0 - s.cap = 4096 - s.d = cast[PCellArray](gcAlloc(s.cap * sizeof(PCell))) - - proc cellSetDeinit(s: var TSlowSet) = - s.L = 0 - s.cap = 0 - dealloc(s.d) - - proc incl(s: var TSlowSet, c: PCell) = - if s.L >= s.cap: - s.cap = s.cap * 3 div 2 - s.d = cast[PCellArray](realloc(s.d, s.cap * sizeof(PCell))) - if s.d == nil: raiseOutOfMem() - s.d[s.L] = c - inc(s.L) - - proc excl(s: var TSlowSet, c: PCell) = - var i = 0 - while i < s.L: - if s.d[i] == c: - s.d[i] = s.d[s.L-1] - dec(s.L) - break - inc(i) - - proc inOperator(s: TSlowSet, c: PCell): bool = - var i = 0 - while i < s.L: - if s.d[i] == c: return true - inc(i) - - iterator elements(s: TSlowSet): PCell = - var i = 0 - while i < s.L: - yield s.d[i] - inc(i) - var - states: array[TCellState, TSlowSet] # TCellSet] + states: array[TCellState, TCellSet] proc traceCell(c: PCell, state: TCellState) = case state of csAllocated: if c in states[csAllocated]: - writeCell("attempt to alloc a already allocated cell", c) + writeCell("attempt to alloc an already allocated cell", c) assert(false) excl(states[csCycFreed], c) excl(states[csZctFreed], c) of csZctFreed: - if c notin states[csAllocated]: - writeCell("attempt to free a not allocated cell", c) - assert(false) if c in states[csZctFreed]: writeCell("attempt to free zct cell twice", c) assert(false) if c in states[csCycFreed]: writeCell("attempt to free with zct, but already freed with cyc", c) assert(false) + if c notin states[csAllocated]: + writeCell("attempt to free not an allocated cell", c) + assert(false) excl(states[csAllocated], c) of csCycFreed: if c notin states[csAllocated]: @@ -505,17 +434,30 @@ when traceGC: excl(states[csAllocated], c) incl(states[state], c) + proc writeLeakage() = + var z = 0 + var y = 0 + var e = 0 + for c in elements(states[csAllocated]): + inc(e) + if c in states[csZctFreed]: inc(z) + elif c in states[csCycFreed]: inc(z) + else: writeCell("leak", c) + cfprintf(cstdout, "Allocations: %ld; ZCT freed: %ld; CYC freed: %ld\n", + e, z, y) + template gcTrace(cell, state: expr): stmt = when traceGC: traceCell(cell, state) -# ------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # forward declarations: -proc collectCT(gch: var TGcHeap) -proc IsOnStack(p: pointer): bool +proc updateZCT() +proc collectCT(gch: var TGcHeap, zctUpdated: bool) +proc IsOnStack(p: pointer): bool {.noinline.} proc forAllChildren(cell: PCell, op: TWalkOp) -proc collectCycles(gch: var TGcHeap) - +proc doOperation(p: pointer, op: TWalkOp) +proc forAllChildrenAux(dest: Pointer, mt: PNimType, op: TWalkOp) proc reprAny(p: pointer, typ: PNimType): string {.compilerproc.} # we need the prototype here for debugging purposes @@ -530,157 +472,86 @@ proc prepareDealloc(cell: PCell) = (cast[TFinalizer](cell.typ.finalizer))(cellToUsr(cell)) dec(recGcLock) - when defined(nimSize): - memUsed = memUsed - nimSize(cell) - else: - memUsed = memUsed - cell.typ.size - -proc checkZCT(): bool = - if recGcLock >= 1: return true # prevent endless recursion - inc(recGcLock) - result = true - for i in 0..gch.zct.len-1: - var c = gch.zct.d[i] - if c.refcount > 0: # should be in the ZCT! - writeCell("wrong ZCT entry", c) - result = false - elif gch.zct.d[-c.refcount] != c: - writeCell("wrong ZCT position", c) - result = false - dec(recGcLock) - -proc GC_invariant(): bool = - if recGcLock >= 1: return true # prevent endless recursion - inc(recGcLock) - result = True - block checks: - if not checkZCT(): - result = false - break checks - # set counters back to zero: - for c in elements(gch.AT): - var t = c.typ - if t == nil or t.kind notin {tySequence, tyString, tyRef}: - writeCell("corrupt cell?", c) - result = false - break checks - when stressGC: c.drefc = 0 - for c in elements(gch.AT): - forAllChildren(c, waDebugIncRef) - when stressGC: - for c in elements(gch.AT): - var rc = c.refcount - if rc < 0: rc = 0 - if c.drefc > rc + c.stackcount: - result = false # failed - c_fprintf(c_stdout, - "broken cell: %p, refc: %ld, stack: %ld, real: %ld\n", - c, c.refcount, c.stackcount, c.drefc) - break checks - dec(recGcLock) - -when stressGC: - proc GCdebugHook() = - if not GC_invariant(): - assert(false) - - dbgLineHook = GCdebugHook - proc setStackBottom(theStackBottom: pointer) {.compilerproc.} = stackBottom = theStackBottom proc initGC() = when traceGC: for i in low(TCellState)..high(TCellState): CellSetInit(states[i]) + gch.stackScans = 0 + gch.cycleCollections = 0 + gch.maxThreshold = 0 + gch.maxStackSize = 0 + gch.maxStackPages = 0 + gch.cycleTableSize = 0 # init the rt init(gch.zct) - CellSetInit(gch.at) - init(gch.stackCells) + init(gch.tempStack) + CellSetInit(gch.cycleRoots) + CellSetInit(gch.stackCells) gch.mask = 0 new(gOutOfMem) # reserve space for the EOutOfMemory exception here! - assert(GC_invariant()) - -proc decRef(cell: PCell) {.inline.} = - assert(cell.refcount > 0) # this should be the case! - when stressGC: assert(cell in gch.AT) - dec(cell.refcount) - if cell.refcount == 0: - cell.refcount = -gch.zct.len - when stressGC: assert(cell notin gch.zct) - add(gch.zct, cell) - when stressGC: assert(checkZCT()) - -proc incRef(cell: PCell) {.inline.} = - var rc = cell.refcount - if rc <= 0: - # remove from zero count table: - when stressGC: assert(gch.zct.len > -rc) - when stressGC: assert(gch.zct.d[-rc] == cell) - gch.zct.d[-rc] = gch.zct.d[gch.zct.len-1] - gch.zct.d[-rc].refcount = rc - dec(gch.zct.len) - cell.refcount = 1 - when stressGC: assert(checkZCT()) - else: - inc(cell.refcount) - when stressGC: assert(checkZCT()) -proc asgnRef(dest: ppointer, src: pointer) = +proc PossibleRoot(gch: var TGcHeap, c: PCell) {.inline.} = + if canbeCycleRoot(c): incl(gch.cycleRoots, c) + +proc decRef(c: PCell) {.inline.} = + when stressGC: + if c.refcount <% rcIncrement: + writeCell("broken cell", c) + assert(c.refcount >% rcIncrement) + c.refcount = c.refcount -% rcIncrement + if c.refcount <% rcIncrement: + addZCT(gch.zct, c) + elif canBeCycleRoot(c): + possibleRoot(gch, c) + +proc incRef(c: PCell) {.inline.} = + c.refcount = c.refcount +% rcIncrement + if canBeCycleRoot(c): + # OPT: the code generator should special case this + possibleRoot(gch, c) + +proc nimGCref(p: pointer) {.compilerproc, inline.} = incRef(usrToCell(p)) +proc nimGCunref(p: pointer) {.compilerproc, inline.} = decRef(usrToCell(p)) + +proc asgnRef(dest: ppointer, src: pointer) {.compilerproc, inline.} = # the code generator calls this proc! assert(not isOnStack(dest)) # BUGFIX: first incRef then decRef! if src != nil: incRef(usrToCell(src)) if dest^ != nil: decRef(usrToCell(dest^)) dest^ = src - when stressGC: assert(GC_invariant()) + +proc asgnRefNoCycle(dest: ppointer, src: pointer) {.compilerproc, inline.} = + # the code generator calls this proc if it is known at compile time that no + # cycle is possible. + if src != nil: + var c = usrToCell(src) + c.refcount = c.refcount +% rcIncrement + if dest^ != nil: + var c = usrToCell(dest^) + c.refcount = c.refcount -% rcIncrement + if c.refcount <% rcIncrement: + addZCT(gch.zct, c) + dest^ = src proc unsureAsgnRef(dest: ppointer, src: pointer) = if not IsOnStack(dest): if src != nil: incRef(usrToCell(src)) if dest^ != nil: decRef(usrToCell(dest^)) dest^ = src - when stressGC: assert(GC_invariant()) - -proc restore(cell: PCell) = - if cell notin gch.newAT: - incl(gch.newAT, Cell) - forAllChildren(cell, waCycleIncRef) - -proc doOperation(p: pointer, op: TWalkOp) = - if p == nil: return - var cell: PCell = usrToCell(p) - assert(cell != nil) - case op # faster than function pointers because of easy prediction - of waNone: assert(false) - of waRelease: decRef(cell) # DEAD CODE! - of waZctDecRef: - decRef(cell) - of waCycleDecRef: - assert(cell.refcount > 0) - dec(cell.refcount) - of waCycleIncRef: - inc(cell.refcount) # restore proper reference counts! - restore(cell) - of waDebugIncRef: - when stressGC: inc(cell.drefc) - -type - TByteArray = array[0..1000_0000, byte] - PByte = ptr TByteArray - PString = ptr string - -proc forAllChildrenAux(dest: Pointer, mt: PNimType, op: TWalkOp) proc getDiscriminant(aa: Pointer, n: ptr TNimNode): int = assert(n.kind == nkCase) - var d: int32 + var d: int var a = cast[TAddress](aa) case n.typ.size - of 1: d = toU32(cast[ptr int8](a +% n.offset)^) - of 2: d = toU32(cast[ptr int16](a +% n.offset)^) - of 4: d = toU32(cast[ptr int32](a +% n.offset)^) + of 1: d = ze(cast[ptr int8](a +% n.offset)^) + of 2: d = ze(cast[ptr int16](a +% n.offset)^) + of 4: d = int(cast[ptr int32](a +% n.offset)^) else: assert(false) - return int(d) + return d proc selectBranch(aa: Pointer, n: ptr TNimNode): ptr TNimNode = var discr = getDiscriminant(aa, n) @@ -692,8 +563,7 @@ proc selectBranch(aa: Pointer, n: ptr TNimNode): ptr TNimNode = result = n.sons[n.len] proc forAllSlotsAux(dest: pointer, n: ptr TNimNode, op: TWalkOp) = - var - d = cast[TAddress](dest) + var d = cast[TAddress](dest) case n.kind of nkNone: assert(false) of nkSlot: forAllChildrenAux(cast[pointer](d +% n.offset), n.typ, op) @@ -704,35 +574,21 @@ proc forAllSlotsAux(dest: pointer, n: ptr TNimNode, op: TWalkOp) = if m != nil: forAllSlotsAux(dest, m, op) proc forAllChildrenAux(dest: Pointer, mt: PNimType, op: TWalkOp) = - const - handledTypes = {tyArray, tyArrayConstr, tyOpenArray, tyRef, - tyString, tySequence, tyObject, tyPureObject, tyTuple} - var - d = cast[TAddress](dest) + var d = cast[TAddress](dest) if dest == nil: return # nothing to do - case mt.Kind - of tyArray, tyArrayConstr, tyOpenArray: - if mt.base.kind in handledTypes: + if ntfNoRefs notin mt.flags: + case mt.Kind + of tyArray, tyArrayConstr, tyOpenArray: for i in 0..(mt.size div mt.base.size)-1: forAllChildrenAux(cast[pointer](d +% i *% mt.base.size), mt.base, op) - of tyRef, tyString, tySequence: # leaf: - doOperation(cast[ppointer](d)^, op) - of tyObject, tyTuple, tyPureObject: - forAllSlotsAux(dest, mt.node, op) - else: nil + of tyRef, tyString, tySequence: # leaf: + doOperation(cast[ppointer](d)^, op) + of tyObject, tyTuple, tyPureObject: + forAllSlotsAux(dest, mt.node, op) + else: nil proc forAllChildren(cell: PCell, op: TWalkOp) = assert(cell != nil) - when defined(debugGC): - if cell.typ == nil: - writeCell("cell has no type descriptor", cell) - when traceGC: - if cell notin states[csAllocated]: - writeCell("cell has never been allocated!", cell) - if cell in states[csCycFreed]: - writeCell("cell has been freed by Cyc", cell) - if cell in states[csZctFreed]: - writeCell("cell has been freed by Zct", cell) assert(cell.typ != nil) case cell.typ.Kind of tyRef: # common case @@ -740,46 +596,41 @@ proc forAllChildren(cell: PCell, op: TWalkOp) = of tySequence: var d = cast[TAddress](cellToUsr(cell)) var s = cast[PGenericSeq](d) - if s != nil: # BUGFIX + if s != nil: for i in 0..s.len-1: forAllChildrenAux(cast[pointer](d +% i *% cell.typ.base.size +% GenericSeqSize), cell.typ.base, op) of tyString: nil else: assert(false) -proc checkCollection() {.inline.} = +proc checkCollection(zctUpdated: bool) {.inline.} = # checks if a collection should be done if recGcLock == 0: - collectCT(gch) + collectCT(gch, zctUpdated) proc newObj(typ: PNimType, size: int): pointer = # generates a new object and sets its reference counter to 0 - var - res: PCell - when stressGC: assert(checkZCT()) assert(typ.kind in {tyRef, tyString, tySequence}) + var zctUpdated = false + if gch.zct.len >= ZctThreshold: + updateZCT() + zctUpdated = true # check if we have to collect: - checkCollection() - res = cast[PCell](Alloc0(size + sizeof(TCell))) + checkCollection(zctUpdated) + var res = cast[PCell](gcAlloc(size + sizeof(TCell))) when stressGC: assert((cast[TAddress](res) and (MemAlignment-1)) == 0) - if res == nil: raiseOutOfMem() - when defined(nimSize): - memUsed = memUsed + nimSize(res) - else: - memUsed = memUsed + size - # now it is buffered in the ZCT res.typ = typ - res.refcount = -gch.zct.len - add(gch.zct, res) # its refcount is zero, so add it to the ZCT - incl(gch.at, res) # add it to the any table too + when debugGC: + if framePtr != nil and framePtr.prev != nil: + res.filename = framePtr.prev.filename + res.line = framePtr.prev.line + res.refcount = rcZct # refcount is zero, but mark it to be in the ZCT + add(gch.zct, res) # its refcount is zero, so add it to the ZCT gch.mask = gch.mask or cast[TAddress](res) - when defined(debugGC): - when defined(logGC): writeCell("new cell", res) + when logGC: writeCell("new cell", res) gcTrace(res, csAllocated) result = cellToUsr(res) - assert(res.typ == typ) - when stressGC: assert(checkZCT()) proc newSeq(typ: PNimType, len: int): pointer = # XXX: overflow checks! @@ -788,96 +639,138 @@ proc newSeq(typ: PNimType, len: int): pointer = cast[PGenericSeq](result).space = len proc growObj(old: pointer, newsize: int): pointer = - var - res, ol: PCell - when stressGC: assert(checkZCT()) - checkCollection() - ol = usrToCell(old) + checkCollection(false) + var ol = usrToCell(old) + assert(ol.typ != nil) assert(ol.typ.kind in {tyString, tySequence}) - when defined(nimSize): - memUsed = memUsed - nimSize(ol) - else: - memUsed = memUsed - ol.size # this is not exact - # pity that we don't know the old size - res = cast[PCell](realloc(ol, newsize + sizeof(TCell))) - #res = cast[PCell](gcAlloc(newsize + sizeof(TCell))) - #copyMem(res, ol, nimSize(ol)) + var res = cast[PCell](gcAlloc(newsize + sizeof(TCell))) + var elemSize = 1 + if ol.typ.kind != tyString: + elemSize = ol.typ.base.size + copyMem(res, ol, cast[PGenericSeq](old).len*elemSize + + GenericSeqSize + sizeof(TCell)) + assert((cast[TAddress](res) and (MemAlignment-1)) == 0) - when defined(nimSize): - memUsed = memUsed + nimSize(res) + assert(res.refcount shr rcShift <=% 1) + #if res.refcount <% rcIncrement: + # add(gch.zct, res) + #else: # XXX: what to do here? + # decRef(ol) + if (ol.refcount and colorMask) == rcZct: + var j = gch.zct.len-1 + var d = gch.zct.d + while j >= 0: + if d[j] == ol: + d[j] = res + break + dec(j) + if canBeCycleRoot(ol): excl(gch.cycleRoots, ol) + gch.mask = gch.mask or cast[TAddress](res) + when logGC: + writeCell("growObj old cell", ol) + writeCell("growObj new cell", res) + gcTrace(ol, csZctFreed) + gcTrace(res, csAllocated) + when reallyDealloc: tlsf_free(ol) else: - memUsed = memUsed + newsize - - if res != ol: - if res == nil: raiseOutOfMem() - if res.refcount <= 0: - assert(gch.zct.d[-res.refcount] == ol) - gch.zct.d[-res.refcount] = res - excl(gch.at, ol) - incl(gch.at, res) - gch.mask = gch.mask or cast[TAddress](res) - when defined(logGC): - writeCell("growObj old cell", ol) - writeCell("growObj new cell", res) - gcTrace(ol, csZctFreed) - gcTrace(res, csAllocated) + assert(ol.typ != nil) + zeroMem(ol, sizeof(TCell)) result = cellToUsr(res) - when stressGC: assert(checkZCT()) -proc collectCycles(gch: var TGcHeap) = - when defined(logGC): - c_fprintf(c_stdout, "collecting cycles!\n") +# ---------------- cycle collector ------------------------------------------- + +# When collecting cycles, we have to consider the following: +# * there may still be references in the stack +# * some cells may still be in the ZCT, because they are referenced from +# the stack (!), so their refcounts are zero +# the ZCT is a subset of stackCells here, so we only need to care +# for stackcells + +proc doOperation(p: pointer, op: TWalkOp) = + if p == nil: return + var c: PCell = usrToCell(p) + assert(c != nil) + case op # faster than function pointers because of easy prediction + of waZctDecRef: + assert(c.refcount >=% rcIncrement) + c.refcount = c.refcount -% rcIncrement + when logGC: writeCell("decref (from doOperation)", c) + if c.refcount <% rcIncrement: addZCT(gch.zct, c) + of waPush: + add(gch.tempStack, c) + of waCycleDecRef: + assert(c.refcount >=% rcIncrement) + c.refcount = c.refcount -% rcIncrement - # step 1: pretend that any node is dead - for c in elements(gch.at): +# we now use a much simpler and non-recursive algorithm for cycle removal +proc collectCycles(gch: var TGcHeap) = + var tabSize = 0 + for c in elements(gch.cycleRoots): + inc(tabSize) + assert(c.typ != nil) forallChildren(c, waCycleDecRef) - CellSetInit(gch.newAt) - # step 2: restore life cells - for c in elements(gch.at): - if c.refcount > 0: restore(c) - # step 3: free dead cells: - for cell in elements(gch.at): - if cell.refcount == 0: - # We free an object that is part of a cycle here. Its children - # may have been freed already. Thus the finalizer could access - # garbage. To handle this case properly we need two passes for - # freeing here which is too expensive. We just don't call the - # finalizer for now. YYY: Any better ideas? - prepareDealloc(cell) - gcTrace(cell, csCycFreed) - when defined(logGC): - writeCell("cycle collector dealloc cell", cell) - when reallyDealloc: dealloc(cell) - CellSetDeinit(gch.at) - gch.at = gch.newAt - -proc gcMark(gch: var TGcHeap, p: pointer) = + gch.cycleTableSize = max(gch.cycleTableSize, tabSize) + + # restore reference counts (a depth-first traversal is needed): + var marker, newRoots: TCellSet + CellSetInit(marker) + CellSetInit(newRoots) + for c in elements(gch.cycleRoots): + var needsRestore = false + if c in gch.stackCells: + needsRestore = true + incl(newRoots, c) + # we need to scan this later again; maybe stack changes + # NOTE: adding to ZCT here does NOT work + elif c.refcount >=% rcIncrement: + needsRestore = true + if needsRestore: + if c notin marker: + incl(marker, c) + gch.tempStack.len = 0 + forAllChildren(c, waPush) + while gch.tempStack.len > 0: + dec(gch.tempStack.len) + var d = gch.tempStack.d[gch.tempStack.len] + d.refcount = d.refcount +% rcIncrement + if d notin marker and d in gch.cycleRoots: + incl(marker, d) + forAllChildren(d, waPush) + # remove cycles: + for c in elements(gch.cycleRoots): + if c.refcount <% rcIncrement and c notin gch.stackCells: + gch.tempStack.len = 0 + forAllChildren(c, waPush) + while gch.tempStack.len > 0: + dec(gch.tempStack.len) + var d = gch.tempStack.d[gch.tempStack.len] + if d.refcount <% rcIncrement: + if d notin gch.cycleRoots: # d is leaf of c and not part of cycle + addZCT(gch.zct, d) + when logGC: writeCell("add to ZCT (from cycle collector)", d) + prepareDealloc(c) + gcTrace(c, csCycFreed) + when logGC: writeCell("cycle collector dealloc cell", c) + when reallyDealloc: tlsf_free(c) + else: + assert(c.typ != nil) + zeroMem(c, sizeof(TCell)) + CellSetDeinit(gch.cycleRoots) + gch.cycleRoots = newRoots + +proc gcMark(p: pointer) {.fastcall.} = # the addresses are not as objects on the stack, so turn them to objects: var cell = usrToCell(p) var c = cast[TAddress](cell) - if ((c and gch.mask) == c) and cell in gch.at: - # is the page that p "points to" in the AT? (All allocated pages are - # always in the AT) - incRef(cell) - when stressGC: inc(cell.stackcount) - add(gch.stackCells, cell) - -proc unmarkStackAndRegisters(gch: var TGcHeap) = - when stressGC: assert(checkZCT()) - for i in 0 .. gch.stackCells.len-1: - var cell = gch.stackCells.d[i] - assert(cell.refcount > 0) - when stressGC: - assert(cell.stackcount > 0) - dec(cell.stackcount) - decRef(cell) - gch.stackCells.len = 0 # reset to zero - when stressGC: assert(checkZCT()) + if ((c and gch.mask) == c) and c >% 1024: + # fast check: does it look like a cell? + when logGC: cfprintf(cstdout, "in stackcells %p\n", cell) + incl(gch.stackCells, cell) # yes: mark it # ----------------- stack management -------------------------------------- # inspired from Smart Eiffel (c) -proc stackSize(): int = +proc stackSize(): int {.noinline.} = var stackTop: array[0..1, pointer] result = abs(cast[int](addr(stackTop[0])) - cast[int](stackBottom)) @@ -888,26 +781,24 @@ when defined(sparc): # For SPARC architecture. stackTop: array[0..1, pointer] result = p >= addr(stackTop[0]) and p <= stackBottom - proc markStackAndRegisters(gch: var TGcHeap) = + proc markStackAndRegisters(gch: var TGcHeap) {.noinline, cdecl.} = when defined(sparcv9): - asm " flushw" + asm """"flushw \n" """ else: - asm " ta 0x3 ! ST_FLUSH_WINDOWS" + asm """"ta 0x3 ! ST_FLUSH_WINDOWS\n" """ var max = stackBottom sp: PPointer stackTop: array[0..1, pointer] - stackTop[0] = nil - stackTop[1] = nil sp = addr(stackTop[0]) # Addresses decrease as the stack grows. while sp <= max: - gcMark(gch, sp^) + gcMark(sp^) sp = cast[ppointer](cast[TAddress](sp) +% sizeof(pointer)) elif defined(ELATE): - {.error: "stack marking code has to be written for this architecture".} + {.error: "stack marking code is to be written for this architecture".} elif defined(hppa) or defined(hp9000) or defined(hp9000s300) or defined(hp9000s700) or defined(hp9000s800) or defined(hp9000s820): @@ -921,24 +812,71 @@ elif defined(hppa) or defined(hp9000) or defined(hp9000s300) or result = p <= addr(stackTop[0]) and p >= stackBottom var - jmpbufSize {.importc: "sizeof(jmp_buf)".}: int + jmpbufSize {.importc: "sizeof(jmp_buf)", nodecl.}: int # a little hack to get the size of a TJmpBuf in the generated C code # in a platform independant way - proc markStackAndRegisters(gch: var TGcHeap) = + proc markStackAndRegisters(gch: var TGcHeap) {.noinline, cdecl.} = var max = stackBottom registers: C_JmpBuf # The jmp_buf buffer is in the C stack. sp: PPointer # Used to traverse the stack and registers assuming # that `setjmp' will save registers in the C stack. - c_setjmp(registers) # To fill the C stack with registers. - sp = cast[ppointer](cast[TAddress](addr(registers)) +% - jmpbufSize -% sizeof(pointer)) - # sp will traverse the JMP_BUF as well (jmp_buf size is added, - # otherwise sp would be below the registers structure). - while sp >= max: - gcMark(gch, sp^) - sp = cast[ppointer](cast[TAddress](sp) -% sizeof(pointer)) + if c_setjmp(registers) == 0: # To fill the C stack with registers. + sp = cast[ppointer](cast[TAddress](addr(registers)) +% + jmpbufSize -% sizeof(pointer)) + # sp will traverse the JMP_BUF as well (jmp_buf size is added, + # otherwise sp would be below the registers structure). + while sp >= max: + gcMark(sp^) + sp = cast[ppointer](cast[TAddress](sp) -% sizeof(pointer)) + +elif defined(I386) and asmVersion: + # addresses decrease as the stack grows: + proc isOnStack(p: pointer): bool = + var + stackTop: array [0..1, pointer] + result = p >= addr(stackTop[0]) and p <= stackBottom + + proc markStackAndRegisters(gch: var TGcHeap) {.noinline, cdecl.} = + # This code should be safe even for aggressive optimizers. The try + # statement safes all registers into the safepoint, which we + # scan additionally to the stack. + type + TPtrArray = array[0..0xffffff, pointer] + try: + var pa = cast[ptr TPtrArray](excHandler) + for i in 0 .. sizeof(TSafePoint) - 1: + gcMark(pa[i]) + finally: + # iterate over the stack: + var max = cast[TAddress](stackBottom) + var stackTop{.volatile.}: array [0..15, pointer] + var sp {.volatile.} = cast[TAddress](addr(stackTop[0])) + while sp <= max: + gcMark(cast[ppointer](sp)^) + sp = sp +% sizeof(pointer) + when false: + var counter = 0 + #mov ebx, OFFSET `stackBottom` + #mov ebx, [ebx] + asm """ + pusha + mov edi, esp + call `getStackBottom` + mov ebx, eax + L1: + cmp edi, ebx + ja L2 + mov eax, [edi] + call `gcMark` + add edi, 4 + inc [`counter`] + jmp L1 + L2: + popa + """ + cfprintf(cstdout, "stack %ld\n", counter) else: # --------------------------------------------------------------------------- @@ -949,67 +887,135 @@ else: stackTop: array [0..1, pointer] result = p >= addr(stackTop[0]) and p <= stackBottom - proc markStackAndRegisters(gch: var TGcHeap) = - var - max = stackBottom - registers: C_JmpBuf # The jmp_buf buffer is in the C stack. - sp: PPointer # Used to traverse the stack and registers assuming - # that `setjmp' will save registers in the C stack. - c_setjmp(registers) # To fill the C stack with registers. - sp = cast[ppointer](addr(registers)) - while sp <= max: - gcMark(gch, sp^) - sp = cast[ppointer](cast[TAddress](sp) +% sizeof(pointer)) + var + gRegisters: C_JmpBuf + jmpbufSize {.importc: "sizeof(jmp_buf)", nodecl.}: int + # a little hack to get the size of a TJmpBuf in the generated C code + # in a platform independant way + + proc markStackAndRegisters(gch: var TGcHeap) {.noinline, cdecl.} = + when true: + # new version: several C compilers are too smart here + var + max = cast[TAddress](stackBottom) + stackTop: array [0..15, pointer] + if c_setjmp(gregisters) == 0'i32: # To fill the C stack with registers. + # iterate over the registers: + var sp = cast[TAddress](addr(gregisters)) + while sp < cast[TAddress](addr(gregisters))+%jmpbufSize: + gcMark(cast[ppointer](sp)^) + sp = sp +% sizeof(pointer) + # iterate over the stack: + sp = cast[TAddress](addr(stackTop[0])) + while sp <= max: + gcMark(cast[ppointer](sp)^) + sp = sp +% sizeof(pointer) + else: + c_longjmp(gregisters, 42) + # this can never happen, but should trick any compiler that is + # not as smart as a human + else: + var + max = stackBottom + registers: C_JmpBuf # The jmp_buf buffer is in the C stack. + sp: PPointer # Used to traverse the stack and registers assuming + # that `setjmp' will save registers in the C stack. + if c_setjmp(registers) == 0'i32: # To fill the C stack with registers. + sp = cast[ppointer](addr(registers)) + while sp <= max: + gcMark(sp^) + sp = cast[ppointer](cast[TAddress](sp) +% sizeof(pointer)) # ---------------------------------------------------------------------------- # end of non-portable code # ---------------------------------------------------------------------------- +proc updateZCT() = + # We have to make an additional pass over the ZCT unfortunately, because + # the ZCT may be out of date, which means it contains cells with a + # refcount > 0. The reason is that ``incRef`` does not bother to remove + # the cell from the ZCT as this might be too slow. + var j = 0 + var L = gch.zct.len # because globals make it hard for the optimizer + var d = gch.zct.d + while j < L: + var c = d[j] + if c.refcount >=% rcIncrement: + when logGC: writeCell("remove from ZCT", c) + # remove from ZCT: + dec(L) + d[j] = d[L] + c.refcount = c.refcount and not colorMask + # we have a new cell at position i, so don't increment i + else: + inc(j) + gch.zct.len = L + proc CollectZCT(gch: var TGcHeap) = - while gch.zct.len > 0: - var c = gch.zct.d[0] - assert(c.refcount <= 0) - # remove from ZCT: - gch.zct.d[0] = gch.zct.d[gch.zct.len-1] - gch.zct.d[0].refcount = 0 - dec(gch.zct.len) - # We are about to free the object, call the finalizer BEFORE its - # children are deleted as well, because otherwise the finalizer may - # access invalid memory. This is done by prepareDealloc(): - gcTrace(c, csZctFreed) - prepareDealloc(c) - forAllChildren(c, waZctDecRef) - excl(gch.at, c) - when defined(logGC): - writeCell("zct dealloc cell", c) - #when defined(debugGC) and defined(nimSize): zeroMem(c, nimSize(c)) - when reallyDealloc: dealloc(c) - -proc collectCT(gch: var TGcHeap) = - when defined(logGC): - c_fprintf(c_stdout, "collecting zero count table; stack size: %ld\n", - stackSize()) - when stressGC: assert(checkZCT()) - if gch.zct.len >= ZctThreshold or memUsed >= cycleThreshold or stressGC: + var i = 0 + while i < gch.zct.len: + var c = gch.zct.d[i] + assert(c.refcount <% rcIncrement) + assert((c.refcount and colorMask) == rcZct) + if canBeCycleRoot(c): excl(gch.cycleRoots, c) + if c notin gch.stackCells: + # remove from ZCT: + c.refcount = c.refcount and not colorMask + gch.zct.d[i] = gch.zct.d[gch.zct.len-1] + # we have a new cell at position i, so don't increment i + dec(gch.zct.len) + when logGC: writeCell("zct dealloc cell", c) + gcTrace(c, csZctFreed) + # We are about to free the object, call the finalizer BEFORE its + # children are deleted as well, because otherwise the finalizer may + # access invalid memory. This is done by prepareDealloc(): + prepareDealloc(c) + forAllChildren(c, waZctDecRef) + when reallyDealloc: tlsf_free(c) + else: + assert(c.typ != nil) + zeroMem(c, sizeof(TCell)) + else: + inc(i) + when stressGC: + for j in 0..gch.zct.len-1: assert(gch.zct.d[j] in gch.stackCells) + +proc collectCT(gch: var TGcHeap, zctUpdated: bool) = + if gch.zct.len >= ZctThreshold or (cycleGC and + getOccupiedMem() >= cycleThreshold) or stressGC: + if not zctUpdated: updateZCT() + gch.maxStackSize = max(gch.maxStackSize, stackSize()) + CellSetInit(gch.stackCells) markStackAndRegisters(gch) - when stressGC: assert(GC_invariant()) + gch.maxStackPages = max(gch.maxStackPages, gch.stackCells.counter) + inc(gch.stackScans) collectZCT(gch) - when stressGC: assert(GC_invariant()) - assert(gch.zct.len == 0) - when defined(cycleGC): - if memUsed >= cycleThreshold or stressGC: - when defined(logGC): - c_fprintf(c_stdout, "collecting cycles; memory used: %ld\n", memUsed) + when cycleGC: + if getOccupiedMem() >= cycleThreshold or stressGC: collectCycles(gch) - cycleThreshold = max(InitialCycleThreshold, memUsed * cycleIncrease) - when defined(logGC): - c_fprintf(c_stdout, "now used: %ld; threshold: %ld\n", - memUsed, cycleThreshold) - unmarkStackAndRegisters(gch) - when stressGC: assert(GC_invariant()) + collectZCT(gch) + inc(gch.cycleCollections) + cycleThreshold = max(InitialCycleThreshold, getOccupiedMem() * + cycleIncrease) + gch.maxThreshold = max(gch.maxThreshold, cycleThreshold) + CellSetDeinit(gch.stackCells) proc GC_fullCollect() = var oldThreshold = cycleThreshold cycleThreshold = 0 # forces cycle collection - collectCT(gch) + collectCT(gch, false) cycleThreshold = oldThreshold + +proc GC_getStatistics(): string = + GC_disable() + result = "[GC] total memory: " & $(getTotalMem()) & "\n" & + "[GC] occupied memory: " & $(getOccupiedMem()) & "\n" & + "[GC] stack scans: " & $gch.stackScans & "\n" & + "[GC] stack pages: " & $gch.maxStackPages & "\n" & + "[GC] cycle collections: " & $gch.cycleCollections & "\n" & + "[GC] max threshold: " & $gch.maxThreshold & "\n" & + "[GC] zct capacity: " & $gch.zct.cap & "\n" & + "[GC] max cycle table size: " & $gch.cycleTableSize & "\n" & + "[GC] max stack size: " & $gch.maxStackSize + when traceGC: writeLeakage() + GC_enable() diff --git a/lib/generics.nim b/lib/generics.nim index 10e55f5bd..1ed7651e1 100644 --- a/lib/generics.nim +++ b/lib/generics.nim @@ -104,8 +104,7 @@ const growthFactor = 2 # must be power of two proc init*[TKey, TValue](t: var TTable[TKey, TValue], capacity: natural = 32) = - t.d = [] # XXX - setLen(t.d, capacity) + newSeq(t.d, capacity) proc len*[TKey, TValue](t: TTable[TKey, TValue]): natural = return t.counter @@ -136,8 +135,8 @@ proc TableRawInsert[TKey, TValue](data: var seq[TPair[TKey, TValue]], data[h].val = val proc TableEnlarge[TKey, TValue](t: var TTable[TKey, TValue]) = - var n: seq[TPair[TKey,TValue]] = [] - setLen(n, len(t.d) * growthFactor) # XXX + var n: seq[TPair[TKey,TValue]] + newSeq(n, len(t.d) * growthFactor) for i in 0..high(t.d): if not isNil(t.d[i].key): TableRawInsert(n, t.d[i].key, t.d[i].val) diff --git a/lib/hashes.nim b/lib/hashes.nim index ed7871008..1593119bd 100644 --- a/lib/hashes.nim +++ b/lib/hashes.nim @@ -1,97 +1,97 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2008 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## This module implements efficient computations of hash values for diverse -## Nimrod types. - -import - strutils - -type - THash* = int ## a hash value; hash tables using these values should - ## always have a size of a power of two and can use the ``and`` - ## operator instead of ``mod`` for truncation of the hash value. - -proc concHash(h: THash, val: int): THash {.inline.} = - result = h +% val - result = result +% result shl 10 - result = result xor (result shr 6) - -proc finishHash(h: THash): THash {.inline.} = - result = h +% h shl 3 - result = result xor (result shr 11) - result = result +% result shl 15 - -proc hashData*(Data: Pointer, Size: int): THash = - ## hashes an array of bytes of size `size` - var - h: THash - p: cstring - i, s: int - h = 0 - p = cast[cstring](Data) - i = 0 - s = size - while s > 0: - h = concHash(h, ord(p[i])) - Inc(i) - Dec(s) - result = finishHash(h) - -proc hash*(x: Pointer): THash {.inline.} = - ## efficient hashing of pointers - result = (cast[THash](x)) shr 3 # skip the alignment - -proc hash*(x: int): THash {.inline.} = - ## efficient hashing of integers - result = x - -proc hash*(x: int64): THash {.inline.} = - ## efficient hashing of integers - result = toU32(x) - -proc hash*(x: char): THash {.inline.} = - ## efficient hashing of characters - result = ord(x) - -proc hash*(x: string): THash = - ## efficient hashing of strings - var h: THash - h = 0 - for i in 0..x.len-1: - h = concHash(h, ord(x[i])) - result = finishHash(h) - -proc hashIgnoreStyle*(x: string): THash = - ## efficient hashing of strings; style is ignored - var - h: THash - c: Char - h = 0 - for i in 0..x.len-1: - c = x[i] - if c == '_': - continue # skip _ - if c in {'A'..'Z'}: - c = chr(ord(c) + (ord('a') - ord('A'))) # toLower() - h = concHash(h, ord(c)) - result = finishHash(h) - -proc hashIgnoreCase*(x: string): THash = - ## efficient hashing of strings; case is ignored - var - h: THash - c: Char - h = 0 - for i in 0..x.len-1: - c = x[i] - if c in {'A'..'Z'}: - c = chr(ord(c) + (ord('a') - ord('A'))) # toLower() - h = concHash(h, ord(c)) - result = finishHash(h) +# +# +# Nimrod's Runtime Library +# (c) Copyright 2008 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## This module implements efficient computations of hash values for diverse +## Nimrod types. + +import + strutils + +type + THash* = int ## a hash value; hash tables using these values should + ## always have a size of a power of two and can use the ``and`` + ## operator instead of ``mod`` for truncation of the hash value. + +proc concHash(h: THash, val: int): THash {.inline.} = + result = h +% val + result = result +% result shl 10 + result = result xor (result shr 6) + +proc finishHash(h: THash): THash {.inline.} = + result = h +% h shl 3 + result = result xor (result shr 11) + result = result +% result shl 15 + +proc hashData*(Data: Pointer, Size: int): THash = + ## hashes an array of bytes of size `size` + var + h: THash + p: cstring + i, s: int + h = 0 + p = cast[cstring](Data) + i = 0 + s = size + while s > 0: + h = concHash(h, ord(p[i])) + Inc(i) + Dec(s) + result = finishHash(h) + +proc hash*(x: Pointer): THash {.inline.} = + ## efficient hashing of pointers + result = (cast[THash](x)) shr 3 # skip the alignment + +proc hash*(x: int): THash {.inline.} = + ## efficient hashing of integers + result = x + +proc hash*(x: int64): THash {.inline.} = + ## efficient hashing of integers + result = toU32(x) + +proc hash*(x: char): THash {.inline.} = + ## efficient hashing of characters + result = ord(x) + +proc hash*(x: string): THash = + ## efficient hashing of strings + var h: THash + h = 0 + for i in 0..x.len-1: + h = concHash(h, ord(x[i])) + result = finishHash(h) + +proc hashIgnoreStyle*(x: string): THash = + ## efficient hashing of strings; style is ignored + var + h: THash + c: Char + h = 0 + for i in 0..x.len-1: + c = x[i] + if c == '_': + continue # skip _ + if c in {'A'..'Z'}: + c = chr(ord(c) + (ord('a') - ord('A'))) # toLower() + h = concHash(h, ord(c)) + result = finishHash(h) + +proc hashIgnoreCase*(x: string): THash = + ## efficient hashing of strings; case is ignored + var + h: THash + c: Char + h = 0 + for i in 0..x.len-1: + c = x[i] + if c in {'A'..'Z'}: + c = chr(ord(c) + (ord('a') - ord('A'))) # toLower() + h = concHash(h, ord(c)) + result = finishHash(h) diff --git a/lib/hti.nim b/lib/hti.nim index 563414b26..7639cf6a3 100644 --- a/lib/hti.nim +++ b/lib/hti.nim @@ -13,7 +13,7 @@ type # This should be he same as ast.TTypeKind tyNone, # 0 tyBool, # 1 tyChar, # 2 - tyEmptySet, # 3 + tyEmpty, # 3 tyArrayConstr, # 4 tyNil, # 5 tyGeneric, # 6 @@ -49,9 +49,13 @@ type # This should be he same as ast.TTypeKind len: int sons: ptr array [0..0x7fff, ptr TNimNode] + TNimTypeFlag = enum + ntfNoRefs = 0, # type contains no tyRef, tySequence, tyString + ntfAcyclic = 1 # type cannot form a cycle TNimType {.compilerproc, final.} = object size: int kind: TNimKind + flags: set[TNimTypeFlag] base: ptr TNimType node: ptr TNimNode # valid for tyRecord, tyObject, tyTuple, tyEnum finalizer: pointer # the finalizer for the type diff --git a/lib/int64s.nim b/lib/int64s.nim index 430514ce3..7a3dbad77 100644 --- a/lib/int64s.nim +++ b/lib/int64s.nim @@ -1,71 +1,71 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2006 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -# 64 bit integers for platforms that don't have those - -type - IInt64 = tuple[lo, hi: int32] - -proc cmpI64(x, y: IInt64): int32 {.compilerproc.} = - result = x.hi -% y.hi - if result == 0: result = x.lo -% y.lo - -proc addI64(x, y: IInt64): IInt64 {.compilerproc.} = - result = x - result.lo = result.lo +% y.lo - result.hi = result.hi +% y.hi - if y.lo > 0 and result.lo < y.lo: - inc(result.hi) - elif y.lo < 0 and result.lo > y.lo: - dec(result.hi) - -proc subI64(x, y: IInt64): IInt64 {.compilerproc.} = - result = x - result.lo = result.lo -% y.lo - result.hi = result.hi -% y.hi - if y.lo > 0 and result.lo < y.lo: - inc(result.hi) - elif y.lo < 0 and result.lo > y.lo: - dec(result.hi) - -proc mulI64(x, y: IInt64): IInt64 {.compilerproc.} = - result.lo = x.lo *% y.lo - result.hi = y.hi *% y.hi - if y.lo > 0 and result.lo < y.lo: - inc(result.hi) - elif y.lo < 0 and result.lo > y.lo: - dec(result.hi) - -proc divI64(x, y: IInt64): IInt64 {.compilerproc.} = - # XXX: to implement - -proc modI64(x, y: IInt64): IInt64 {.compilerproc.} = - # XXX: to implement - -proc bitandI64(x, y: IInt64): IInt64 {.compilerproc.} = - result.hi = x.hi and y.hi - result.lo = x.lo and y.lo - -proc bitorI64(x, y: IInt64): IInt64 {.compilerproc.} = - result.hi = x.hi or y.hi - result.lo = x.lo or y.lo - -proc bitxorI64(x, y: IInt64): IInt64 {.compilerproc.} = - result.hi = x.hi xor y.hi - result.lo = x.lo xor y.lo - -proc bitnotI64(x: IInt64): IInt64 {.compilerproc.} = - result.lo = not x.lo - result.hi = not x.hi - -proc shlI64(x, y: IInt64): IInt64 {.compilerproc.} = - # XXX: to implement - -proc shrI64(x, y: IInt64): IInt64 {.compilerproc.} = - # XXX: to implement +# +# +# Nimrod's Runtime Library +# (c) Copyright 2006 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +# 64 bit integers for platforms that don't have those + +type + IInt64 = tuple[lo, hi: int32] + +proc cmpI64(x, y: IInt64): int32 {.compilerproc.} = + result = x.hi -% y.hi + if result == 0: result = x.lo -% y.lo + +proc addI64(x, y: IInt64): IInt64 {.compilerproc.} = + result = x + result.lo = result.lo +% y.lo + result.hi = result.hi +% y.hi + if y.lo > 0 and result.lo < y.lo: + inc(result.hi) + elif y.lo < 0 and result.lo > y.lo: + dec(result.hi) + +proc subI64(x, y: IInt64): IInt64 {.compilerproc.} = + result = x + result.lo = result.lo -% y.lo + result.hi = result.hi -% y.hi + if y.lo > 0 and result.lo < y.lo: + inc(result.hi) + elif y.lo < 0 and result.lo > y.lo: + dec(result.hi) + +proc mulI64(x, y: IInt64): IInt64 {.compilerproc.} = + result.lo = x.lo *% y.lo + result.hi = y.hi *% y.hi + if y.lo > 0 and result.lo < y.lo: + inc(result.hi) + elif y.lo < 0 and result.lo > y.lo: + dec(result.hi) + +proc divI64(x, y: IInt64): IInt64 {.compilerproc.} = + # XXX: to implement + +proc modI64(x, y: IInt64): IInt64 {.compilerproc.} = + # XXX: to implement + +proc bitandI64(x, y: IInt64): IInt64 {.compilerproc.} = + result.hi = x.hi and y.hi + result.lo = x.lo and y.lo + +proc bitorI64(x, y: IInt64): IInt64 {.compilerproc.} = + result.hi = x.hi or y.hi + result.lo = x.lo or y.lo + +proc bitxorI64(x, y: IInt64): IInt64 {.compilerproc.} = + result.hi = x.hi xor y.hi + result.lo = x.lo xor y.lo + +proc bitnotI64(x: IInt64): IInt64 {.compilerproc.} = + result.lo = not x.lo + result.hi = not x.hi + +proc shlI64(x, y: IInt64): IInt64 {.compilerproc.} = + # XXX: to implement + +proc shrI64(x, y: IInt64): IInt64 {.compilerproc.} = + # XXX: to implement diff --git a/lib/lexbase.nim b/lib/lexbase.nim index d2522359f..ea9a61821 100644 --- a/lib/lexbase.nim +++ b/lib/lexbase.nim @@ -1,186 +1,167 @@ -# -# -# The Nimrod Compiler -# (c) Copyright 2008 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## This module implements a base object of a lexer with efficient buffer -## handling. In fact I believe that this is the most efficient method of -## buffer handling that exists! Only at line endings checks are necessary -## if the buffer needs refilling. - -import - strutils - -const - EndOfFile* = '\0' ## end of file marker - # A little picture makes everything clear :-) - # buf: - # "Example Text\n ha!" bufLen = 17 - # ^pos = 0 ^ sentinel = 12 - # - NewLines* = {'\c', '\L'} - -type - TBaseLexer* = object of TObject ## the base lexer. Inherit your lexer from - ## this object. - bufpos*: int ## the current position within the buffer - buf*: cstring ## the buffer itself - bufLen*: int ## length of buffer in characters - f*: tfile ## the file that is read - LineNumber*: int ## the current line number - sentinel: int - lineStart: int # index of last line start in buffer - fileOpened: bool - -proc initBaseLexer*(L: var TBaseLexer, filename: string, bufLen: int = 8192): bool - ## inits the TBaseLexer object with a file to scan - -proc initBaseLexerFromBuffer*(L: var TBaseLexer, buffer: string) - ## inits the TBaseLexer with a buffer to scan - -proc deinitBaseLexer*(L: var TBaseLexer) - ## deinitializes the base lexer. This needs to be called to close the file. - -proc getCurrentLine*(L: TBaseLexer, marker: bool = true): string - ## retrieves the current line. - -proc getColNumber*(L: TBaseLexer, pos: int): int - ## retrieves the current column. - -proc HandleCR*(L: var TBaseLexer, pos: int): int - ## Call this if you scanned over '\c' in the buffer; it returns the the - ## position to continue the scanning from. `pos` must be the position - ## of the '\c'. -proc HandleLF*(L: var TBaseLexer, pos: int): int - ## Call this if you scanned over '\L' in the buffer; it returns the the - ## position to continue the scanning from. `pos` must be the position - ## of the '\L'. - -# implementation - -const - chrSize = sizeof(char) - -proc deinitBaseLexer(L: var TBaseLexer) = - dealloc(L.buf) - if L.fileOpened: closeFile(L.f) - -proc FillBuffer(L: var TBaseLexer) = - var - charsRead, toCopy, s: int # all are in characters, - # not bytes (in case this - # is not the same) - oldBufLen: int - # we know here that pos == L.sentinel, but not if this proc - # is called the first time by initBaseLexer() - assert(L.sentinel < L.bufLen) - toCopy = L.BufLen - L.sentinel - 1 - assert(toCopy >= 0) - if toCopy > 0: - MoveMem(L.buf, addr(L.buf[L.sentinel + 1]), toCopy * chrSize) # "moveMem" handles overlapping regions - charsRead = ReadBuffer(L.f, addr(L.buf[toCopy]), (L.sentinel + 1) * chrSize) div - chrSize - s = toCopy + charsRead - if charsRead < L.sentinel + 1: - L.buf[s] = EndOfFile # set end marker - L.sentinel = s - else: - # compute sentinel: - dec(s) # BUGFIX (valgrind) - while true: - assert(s < L.bufLen) - while (s >= 0) and not (L.buf[s] in NewLines): Dec(s) - if s >= 0: - # we found an appropriate character for a sentinel: - L.sentinel = s - break - else: - # rather than to give up here because the line is too long, - # double the buffer's size and try again: - oldBufLen = L.BufLen - L.bufLen = L.BufLen * 2 - L.buf = cast[cstring](realloc(L.buf, L.bufLen * chrSize)) - assert(L.bufLen - oldBuflen == oldBufLen) - charsRead = ReadBuffer(L.f, addr(L.buf[oldBufLen]), oldBufLen * chrSize) div - chrSize - if charsRead < oldBufLen: - L.buf[oldBufLen + charsRead] = EndOfFile - L.sentinel = oldBufLen + charsRead - break - s = L.bufLen - 1 - -proc fillBaseLexer(L: var TBaseLexer, pos: int): int = - assert(pos <= L.sentinel) - if pos < L.sentinel: - result = pos + 1 # nothing to do - else: - fillBuffer(L) - L.bufpos = 0 # XXX: is this really correct? - result = 0 - L.lineStart = result - -proc HandleCR(L: var TBaseLexer, pos: int): int = - assert(L.buf[pos] == '\c') - inc(L.linenumber) - result = fillBaseLexer(L, pos) - if L.buf[result] == '\L': - result = fillBaseLexer(L, result) - -proc HandleLF(L: var TBaseLexer, pos: int): int = - assert(L.buf[pos] == '\L') - inc(L.linenumber) - result = fillBaseLexer(L, pos) #L.lastNL := result-1; // BUGFIX: was: result; - -proc skip_UTF_8_BOM(L: var TBaseLexer) = - if (L.buf[0] == '\xEF') and (L.buf[1] == '\xBB') and (L.buf[2] == '\xBF'): - inc(L.bufpos, 3) - inc(L.lineStart, 3) - -proc initBaseLexer(L: var TBaseLexer, filename: string, bufLen: int = 8192): bool = - assert(bufLen > 0) - L.bufpos = 0 - L.bufLen = bufLen - L.buf = cast[cstring](alloc(bufLen * chrSize)) - L.sentinel = bufLen - 1 - L.lineStart = 0 - L.linenumber = 1 # lines start at 1 - L.fileOpened = openFile(L.f, filename) - result = L.fileOpened - if result: - fillBuffer(L) - skip_UTF_8_BOM(L) - -proc initBaseLexerFromBuffer(L: var TBaseLexer, buffer: string) = - L.bufpos = 0 - L.bufLen = len(buffer) + 1 - L.buf = cast[cstring](alloc(L.bufLen * chrSize)) - L.sentinel = L.bufLen - 1 - L.lineStart = 0 - L.linenumber = 1 # lines start at 1 - L.fileOpened = false - if L.bufLen > 0: - copyMem(L.buf, cast[pointer](buffer), L.bufLen) - L.buf[L.bufLen - 1] = EndOfFile - else: - L.buf[0] = EndOfFile - skip_UTF_8_BOM(L) - -proc getColNumber(L: TBaseLexer, pos: int): int = - result = pos - L.lineStart - assert(result >= 0) - -proc getCurrentLine(L: TBaseLexer, marker: bool = true): string = - var i: int - result = "" - i = L.lineStart - while not (L.buf[i] in {'\c', '\L', EndOfFile}): - add(result, L.buf[i]) - inc(i) - add(result, "\n") - if marker: - add(result, RepeatChar(getColNumber(L, L.bufpos)) & "^\n") - +# +# +# The Nimrod Compiler +# (c) Copyright 2008 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## This module implements a base object of a lexer with efficient buffer +## handling. Only at line endings checks are necessary if the buffer +## needs refilling. + +import + strutils, streams + +const + EndOfFile* = '\0' ## end of file marker + NewLines* = {'\c', '\L'} + +# Buffer handling: +# buf: +# "Example Text\n ha!" bufLen = 17 +# ^pos = 0 ^ sentinel = 12 +# + +type + TBaseLexer* = object of TObject ## the base lexer. Inherit your lexer from + ## this object. + bufpos*: int ## the current position within the buffer + buf*: cstring ## the buffer itself + bufLen*: int ## length of buffer in characters + input: PStream ## the input stream + LineNumber*: int ## the current line number + sentinel: int + lineStart: int # index of last line start in buffer + fileOpened: bool + +proc open*(L: var TBaseLexer, input: PStream, bufLen: int = 8192) + ## inits the TBaseLexer with a stream to read from + +proc close*(L: var TBaseLexer) + ## closes the base lexer. This closes `L`'s associated stream too. + +proc getCurrentLine*(L: TBaseLexer, marker: bool = true): string + ## retrieves the current line. + +proc getColNumber*(L: TBaseLexer, pos: int): int + ## retrieves the current column. + +proc HandleCR*(L: var TBaseLexer, pos: int): int + ## Call this if you scanned over '\c' in the buffer; it returns the the + ## position to continue the scanning from. `pos` must be the position + ## of the '\c'. +proc HandleLF*(L: var TBaseLexer, pos: int): int + ## Call this if you scanned over '\L' in the buffer; it returns the the + ## position to continue the scanning from. `pos` must be the position + ## of the '\L'. + +# implementation + +const + chrSize = sizeof(char) + +proc close(L: var TBaseLexer) = + dealloc(L.buf) + L.input.close(L.input) + +proc FillBuffer(L: var TBaseLexer) = + var + charsRead, toCopy, s: int # all are in characters, + # not bytes (in case this + # is not the same) + oldBufLen: int + # we know here that pos == L.sentinel, but not if this proc + # is called the first time by initBaseLexer() + assert(L.sentinel < L.bufLen) + toCopy = L.BufLen - L.sentinel - 1 + assert(toCopy >= 0) + if toCopy > 0: + MoveMem(L.buf, addr(L.buf[L.sentinel + 1]), toCopy * chrSize) # "moveMem" handles overlapping regions + charsRead = L.input.readData(L.input, addr(L.buf[toCopy]), + (L.sentinel + 1) * chrSize) div chrSize + s = toCopy + charsRead + if charsRead < L.sentinel + 1: + L.buf[s] = EndOfFile # set end marker + L.sentinel = s + else: + # compute sentinel: + dec(s) # BUGFIX (valgrind) + while true: + assert(s < L.bufLen) + while (s >= 0) and not (L.buf[s] in NewLines): Dec(s) + if s >= 0: + # we found an appropriate character for a sentinel: + L.sentinel = s + break + else: + # rather than to give up here because the line is too long, + # double the buffer's size and try again: + oldBufLen = L.BufLen + L.bufLen = L.BufLen * 2 + L.buf = cast[cstring](realloc(L.buf, L.bufLen * chrSize)) + assert(L.bufLen - oldBuflen == oldBufLen) + charsRead = L.input.ReadData(L.input, addr(L.buf[oldBufLen]), + oldBufLen * chrSize) div chrSize + if charsRead < oldBufLen: + L.buf[oldBufLen + charsRead] = EndOfFile + L.sentinel = oldBufLen + charsRead + break + s = L.bufLen - 1 + +proc fillBaseLexer(L: var TBaseLexer, pos: int): int = + assert(pos <= L.sentinel) + if pos < L.sentinel: + result = pos + 1 # nothing to do + else: + fillBuffer(L) + L.bufpos = 0 # XXX: is this really correct? + result = 0 + L.lineStart = result + +proc HandleCR(L: var TBaseLexer, pos: int): int = + assert(L.buf[pos] == '\c') + inc(L.linenumber) + result = fillBaseLexer(L, pos) + if L.buf[result] == '\L': + result = fillBaseLexer(L, result) + +proc HandleLF(L: var TBaseLexer, pos: int): int = + assert(L.buf[pos] == '\L') + inc(L.linenumber) + result = fillBaseLexer(L, pos) #L.lastNL := result-1; // BUGFIX: was: result; + +proc skip_UTF_8_BOM(L: var TBaseLexer) = + if (L.buf[0] == '\xEF') and (L.buf[1] == '\xBB') and (L.buf[2] == '\xBF'): + inc(L.bufpos, 3) + inc(L.lineStart, 3) + +proc open(L: var TBaseLexer, input: PStream, bufLen: int = 8192) = + assert(bufLen > 0) + assert(input != nil) + L.input = input + L.bufpos = 0 + L.bufLen = bufLen + L.buf = cast[cstring](alloc(bufLen * chrSize)) + L.sentinel = bufLen - 1 + L.lineStart = 0 + L.linenumber = 1 # lines start at 1 + fillBuffer(L) + skip_UTF_8_BOM(L) + +proc getColNumber(L: TBaseLexer, pos: int): int = + result = pos - L.lineStart + assert(result >= 0) + +proc getCurrentLine(L: TBaseLexer, marker: bool = true): string = + var i: int + result = "" + i = L.lineStart + while not (L.buf[i] in {'\c', '\L', EndOfFile}): + add(result, L.buf[i]) + inc(i) + add(result, "\n") + if marker: + add(result, RepeatChar(getColNumber(L, L.bufpos)) & "^\n") + diff --git a/lib/macros.nim b/lib/macros.nim index af5e0d17d..809531c4c 100644 --- a/lib/macros.nim +++ b/lib/macros.nim @@ -1,176 +1,175 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2008 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - - -## This module contains the interface to the compiler's abstract syntax tree. -## Abstract syntax trees should be modified in macros. - -#[[[cog -#def toEnum(name, elems, prefix): -# body = "" -# counter = 0 -# for e in elems: -# if counter % 4 == 0: p = "\n " -# else: p = "" -# body += p + prefix + e[2:] + ', ' -# counter += 1 -# -# return " TNimrod%s* = enum%s\n TNim%ss* = set[TNimrod%s]\n" \ -# % (name, body.rstrip(", "), name, name) -# -#enums = eval(file("data/ast.yml").read()) -#cog.out("type\n") -#i = 0 -#for key, val in enums.iteritems(): -# if key.endswith("Flag"): continue -# cog.out(toEnum(key, val, ["nnk", "nty", "nsk"][i])) -# i += 1 -#]]] -type - TNimrodNodeKind* = enum - nnkNone, nnkEmpty, nnkIdent, nnkSym, - nnkType, nnkCharLit, nnkIntLit, nnkInt8Lit, - nnkInt16Lit, nnkInt32Lit, nnkInt64Lit, nnkFloatLit, - nnkFloat32Lit, nnkFloat64Lit, nnkStrLit, nnkRStrLit, - nnkTripleStrLit, nnkMetaNode, nnkNilLit, nnkDotCall, - nnkCommand, nnkCall, nnkGenericCall, nnkExplicitTypeListCall, - nnkExprEqExpr, nnkExprColonExpr, nnkIdentDefs, nnkInfix, - nnkPrefix, nnkPostfix, nnkPar, nnkCurly, - nnkBracket, nnkBracketExpr, nnkPragmaExpr, nnkRange, - nnkDotExpr, nnkCheckedFieldExpr, nnkDerefExpr, nnkIfExpr, - nnkElifExpr, nnkElseExpr, nnkLambda, nnkAccQuoted, - nnkHeaderQuoted, nnkTableConstr, nnkQualified, nnkHiddenStdConv, - nnkHiddenSubConv, nnkHiddenCallConv, nnkConv, nnkCast, - nnkAddr, nnkHiddenAddr, nnkHiddenDeref, nnkObjDownConv, - nnkObjUpConv, nnkChckRangeF, nnkChckRange64, nnkChckRange, - nnkStringToCString, nnkCStringToString, nnkPassAsOpenArray, nnkAsgn, - nnkDefaultTypeParam, nnkGenericParams, nnkFormalParams, nnkOfInherit, - nnkModule, nnkProcDef, nnkConverterDef, nnkMacroDef, - nnkTemplateDef, nnkIteratorDef, nnkOfBranch, nnkElifBranch, - nnkExceptBranch, nnkElse, nnkMacroStmt, nnkAsmStmt, - nnkPragma, nnkIfStmt, nnkWhenStmt, nnkForStmt, - nnkWhileStmt, nnkCaseStmt, nnkVarSection, nnkConstSection, - nnkConstDef, nnkTypeSection, nnkTypeDef, nnkYieldStmt, - nnkTryStmt, nnkFinally, nnkRaiseStmt, nnkReturnStmt, - nnkBreakStmt, nnkContinueStmt, nnkBlockStmt, nnkDiscardStmt, - nnkStmtList, nnkImportStmt, nnkFromStmt, nnkImportAs, - nnkIncludeStmt, nnkAccessStmt, nnkCommentStmt, nnkStmtListExpr, - nnkBlockExpr, nnkVm, nnkTypeOfExpr, nnkObjectTy, - nnkTupleTy, nnkRecList, nnkRecCase, nnkRecWhen, - nnkRefTy, nnkPtrTy, nnkVarTy, nnkProcTy, - nnkEnumTy, nnkEnumFieldDef, nnkReturnToken - TNimNodeKinds* = set[TNimrodNodeKind] - TNimrodTypeKind* = enum - ntyNone, ntyBool, ntyChar, ntyEmptySet, - ntyArrayConstr, ntyNil, ntyGeneric, ntyGenericInst, - ntyGenericParam, ntyEnum, ntyAnyEnum, ntyArray, - ntyObject, ntyTuple, ntySet, ntyRange, - ntyPtr, ntyRef, ntyVar, ntySequence, - ntyProc, ntyPointer, ntyOpenArray, ntyString, - ntyCString, ntyForward, ntyInt, ntyInt8, - ntyInt16, ntyInt32, ntyInt64, ntyFloat, - ntyFloat32, ntyFloat64, ntyFloat128 - TNimTypeKinds* = set[TNimrodTypeKind] - TNimrodSymKind* = enum - nskUnknownSym, nskConditional, nskDynLib, nskParam, - nskTypeParam, nskTemp, nskType, nskConst, - nskVar, nskProc, nskIterator, nskConverter, - nskMacro, nskTemplate, nskField, nskEnumField, - nskForVar, nskModule, nskLabel - TNimSymKinds* = set[TNimrodSymKind] -#[[[end]]] - -type - TNimrodNode {.final.} = object # hidden - TNimrodSymbol {.final.} = object # hidden - TNimrodType {.final.} = object # hidden - PNimrodType* {.compilerproc.} = ref TNimrodType - PNimrodSymbol* {.compilerproc.} = ref TNimrodSymbol - PNimrodNode* {.compilerproc.} = ref TNimrodNode - expr* = PNimrodNode - stmt* = PNimrodNode - -# Nodes should be reference counted to make the `copy` operation very fast! -# However, this is difficult to achieve: modify(n[0][1]) should propagate to -# its father. How to do this without back references? - -proc `[]`* (n: PNimrodNode, i: int): PNimrodNode {.magic: "NChild".} -proc `[]=`* (n: PNimrodNode, i: int, child: PNimrodNode) {.magic: "NSetChild".} - ## provide access to `n`'s children - -type - TNimrodIdent = object of TObject - -converter StrToIdent*(s: string): TNimrodIdent {.magic: "StrToIdent".} -proc `$`*(i: TNimrodIdent): string {.magic: "IdentToStr".} -proc `==`* (a, b: TNimrodIdent): bool {.magic: "EqIdent".} - -proc len*(n: PNimrodNode): int {.magic: "NLen".} - -## returns the number of children that a node has -proc add*(father, child: PNimrodNode) {.magic: "NAdd".} -proc add*(father: PNimrodNode, child: openArray[PNimrodNode]) {.magic: "NAddMultiple".} -proc del*(father: PNimrodNode, idx = 0, n = 1) {.magic: "NDel".} -proc kind*(n: PNimrodNode): TNimrodNodeKind {.magic: "NKind".} - -proc intVal*(n: PNimrodNode): biggestInt {.magic: "NIntVal".} -proc floatVal*(n: PNimrodNode): biggestFloat {.magic: "NFloatVal".} -proc symbol*(n: PNimrodNode): PNimrodSymbol {.magic: "NSymbol".} -proc ident*(n: PNimrodNode): TNimrodIdent {.magic: "NIdent".} -proc typ*(n: PNimrodNode): PNimrodType {.magic: "NGetType".} -proc strVal*(n: PNimrodNode): string {.magic: "NStrVal".} - -proc `intVal=`*(n: PNimrodNode, val: biggestInt) {.magic: "NSetIntVal".} -proc `floatVal=`*(n: PNimrodNode, val: biggestFloat) {.magic: "NSetFloatVal".} -proc `symbol=`*(n: PNimrodNode, val: PNimrodSymbol) {.magic: "NSetSymbol".} -proc `ident=`*(n: PNimrodNode, val: TNimrodIdent) {.magic: "NSetIdent".} -proc `typ=`*(n: PNimrodNode, typ: PNimrodType) {.magic: "NSetType".} -proc `strVal=`*(n: PNimrodNode, val: string) {.magic: "NSetStrVal".} - -proc newNimNode*(kind: TNimrodNodeKind, - n: PNimrodNode=nil): PNimrodNode {.magic: "NNewNimNode".} -proc copyNimNode*(n: PNimrodNode): PNimrodNode {.magic: "NCopyNimNode".} -proc copyNimTree*(n: PNimrodNode): PNimrodNode {.magic: "NCopyNimTree".} - -proc error*(msg: string) {.magic: "NError".} -proc warning*(msg: string) {.magic: "NWarning".} -proc hint*(msg: string) {.magic: "NHint".} - -proc newStrLitNode*(s: string): PNimrodNode {.nodecl.} = - result = newNimNode(nnkStrLit) - result.strVal = s - -proc newIntLitNode*(i: biggestInt): PNimrodNode {.nodecl.} = - result = newNimNode(nnkIntLit) - result.intVal = i - -proc newIntLitNode*(f: biggestFloat): PNimrodNode {.nodecl.} = - result = newNimNode(nnkFloatLit) - result.floatVal = f - -proc newIdentNode*(i: TNimrodIdent): PNimrodNode {.nodecl.} = - result = newNimNode(nnkIdent) - result.ident = i - -proc toStrLit*(n: PNimrodNode): PNimrodNode {.nodecl.} = - return newStrLitNode(repr(n)) - -proc expectKind*(n: PNimrodNode, k: TNimrodNodeKind) {.nodecl.} = - if n.kind != k: error("macro expects a node of kind: " & repr(k)) - -proc expectMinLen*(n: PNimrodNode, min: int) {.nodecl.} = - if n.len < min: error("macro expects a node with " & $min & " children") - -proc newCall*(theProc: TNimrodIdent, - args: openArray[PNimrodNode]): PNimrodNode {.nodecl.} = - ## produces a new call node. `theProc` is the proc that is called with - ## the arguments ``args[0..]``. - result = newNimNode(nnkCall) - result.add(newIdentNode(theProc)) - result.add(args) +# +# +# Nimrod's Runtime Library +# (c) Copyright 2008 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + + +## This module contains the interface to the compiler's abstract syntax tree. +## Abstract syntax trees should be modified in macros. + +#[[[cog +#def toEnum(name, elems): +# body = "" +# counter = 0 +# for e in elems: +# if counter % 4 == 0: p = "\n " +# else: p = "" +# body = body + p + 'n' + e + ', ' +# counter = counter + 1 +# +# return (" TNimrod%s* = enum%s\n TNim%ss* = set[TNimrod%s]\n" % +# (name, body[:-2], name, name)) +# +#enums = eval(open("data/ast.yml").read()) +#cog.out("type\n") +#for key, val in enums.items(): +# if key[-4:] == "Flag": continue +# cog.out(toEnum(key, val)) +#]]] +type + TNimrodTypeKind* = enum + ntyNone, ntyBool, ntyChar, ntyEmpty, + ntyArrayConstr, ntyNil, ntyGeneric, ntyGenericInst, + ntyGenericParam, ntyEnum, ntyAnyEnum, ntyArray, + ntyObject, ntyTuple, ntySet, ntyRange, + ntyPtr, ntyRef, ntyVar, ntySequence, + ntyProc, ntyPointer, ntyOpenArray, ntyString, + ntyCString, ntyForward, ntyInt, ntyInt8, + ntyInt16, ntyInt32, ntyInt64, ntyFloat, + ntyFloat32, ntyFloat64, ntyFloat128 + TNimTypeKinds* = set[TNimrodTypeKind] + TNimrodSymKind* = enum + nskUnknownSym, nskConditional, nskDynLib, nskParam, + nskTypeParam, nskTemp, nskType, nskConst, + nskVar, nskProc, nskIterator, nskConverter, + nskMacro, nskTemplate, nskField, nskEnumField, + nskForVar, nskModule, nskLabel, nskStub + TNimSymKinds* = set[TNimrodSymKind] + TNimrodNodeKind* = enum + nnkNone, nnkEmpty, nnkIdent, nnkSym, + nnkType, nnkCharLit, nnkIntLit, nnkInt8Lit, + nnkInt16Lit, nnkInt32Lit, nnkInt64Lit, nnkFloatLit, + nnkFloat32Lit, nnkFloat64Lit, nnkStrLit, nnkRStrLit, + nnkTripleStrLit, nnkMetaNode, nnkNilLit, nnkDotCall, + nnkCommand, nnkCall, nnkGenericCall, nnkExplicitTypeListCall, + nnkExprEqExpr, nnkExprColonExpr, nnkIdentDefs, nnkInfix, + nnkPrefix, nnkPostfix, nnkPar, nnkCurly, + nnkBracket, nnkBracketExpr, nnkPragmaExpr, nnkRange, + nnkDotExpr, nnkCheckedFieldExpr, nnkDerefExpr, nnkIfExpr, + nnkElifExpr, nnkElseExpr, nnkLambda, nnkAccQuoted, + nnkHeaderQuoted, nnkTableConstr, nnkQualified, nnkHiddenStdConv, + nnkHiddenSubConv, nnkHiddenCallConv, nnkConv, nnkCast, + nnkAddr, nnkHiddenAddr, nnkHiddenDeref, nnkObjDownConv, + nnkObjUpConv, nnkChckRangeF, nnkChckRange64, nnkChckRange, + nnkStringToCString, nnkCStringToString, nnkPassAsOpenArray, nnkAsgn, + nnkDefaultTypeParam, nnkGenericParams, nnkFormalParams, nnkOfInherit, + nnkModule, nnkProcDef, nnkConverterDef, nnkMacroDef, + nnkTemplateDef, nnkIteratorDef, nnkOfBranch, nnkElifBranch, + nnkExceptBranch, nnkElse, nnkMacroStmt, nnkAsmStmt, + nnkPragma, nnkIfStmt, nnkWhenStmt, nnkForStmt, + nnkWhileStmt, nnkCaseStmt, nnkVarSection, nnkConstSection, + nnkConstDef, nnkTypeSection, nnkTypeDef, nnkYieldStmt, + nnkTryStmt, nnkFinally, nnkRaiseStmt, nnkReturnStmt, + nnkBreakStmt, nnkContinueStmt, nnkBlockStmt, nnkDiscardStmt, + nnkStmtList, nnkImportStmt, nnkFromStmt, nnkImportAs, + nnkIncludeStmt, nnkAccessStmt, nnkCommentStmt, nnkStmtListExpr, + nnkBlockExpr, nnkStmtListType, nnkBlockType, nnkVm, + nnkTypeOfExpr, nnkObjectTy, nnkTupleTy, nnkRecList, + nnkRecCase, nnkRecWhen, nnkRefTy, nnkPtrTy, + nnkVarTy, nnkProcTy, nnkEnumTy, nnkEnumFieldDef, + nnkReturnToken + TNimNodeKinds* = set[TNimrodNodeKind] +#[[[end]]] + +type + TNimrodNode {.final.} = object # hidden + TNimrodSymbol {.final.} = object # hidden + TNimrodType {.final.} = object # hidden + PNimrodType* {.compilerproc.} = ref TNimrodType + PNimrodSymbol* {.compilerproc.} = ref TNimrodSymbol + PNimrodNode* {.compilerproc.} = ref TNimrodNode + expr* = PNimrodNode + stmt* = PNimrodNode + +# Nodes should be reference counted to make the `copy` operation very fast! +# However, this is difficult to achieve: modify(n[0][1]) should propagate to +# its father. How to do this without back references? + +proc `[]`* (n: PNimrodNode, i: int): PNimrodNode {.magic: "NChild".} +proc `[]=`* (n: PNimrodNode, i: int, child: PNimrodNode) {.magic: "NSetChild".} + ## provide access to `n`'s children + +type + TNimrodIdent = object of TObject + +converter StrToIdent*(s: string): TNimrodIdent {.magic: "StrToIdent".} +proc `$`*(i: TNimrodIdent): string {.magic: "IdentToStr".} +proc `==`* (a, b: TNimrodIdent): bool {.magic: "EqIdent".} + +proc len*(n: PNimrodNode): int {.magic: "NLen".} + +## returns the number of children that a node has +proc add*(father, child: PNimrodNode) {.magic: "NAdd".} +proc add*(father: PNimrodNode, child: openArray[PNimrodNode]) {.magic: "NAddMultiple".} +proc del*(father: PNimrodNode, idx = 0, n = 1) {.magic: "NDel".} +proc kind*(n: PNimrodNode): TNimrodNodeKind {.magic: "NKind".} + +proc intVal*(n: PNimrodNode): biggestInt {.magic: "NIntVal".} +proc floatVal*(n: PNimrodNode): biggestFloat {.magic: "NFloatVal".} +proc symbol*(n: PNimrodNode): PNimrodSymbol {.magic: "NSymbol".} +proc ident*(n: PNimrodNode): TNimrodIdent {.magic: "NIdent".} +proc typ*(n: PNimrodNode): PNimrodType {.magic: "NGetType".} +proc strVal*(n: PNimrodNode): string {.magic: "NStrVal".} + +proc `intVal=`*(n: PNimrodNode, val: biggestInt) {.magic: "NSetIntVal".} +proc `floatVal=`*(n: PNimrodNode, val: biggestFloat) {.magic: "NSetFloatVal".} +proc `symbol=`*(n: PNimrodNode, val: PNimrodSymbol) {.magic: "NSetSymbol".} +proc `ident=`*(n: PNimrodNode, val: TNimrodIdent) {.magic: "NSetIdent".} +proc `typ=`*(n: PNimrodNode, typ: PNimrodType) {.magic: "NSetType".} +proc `strVal=`*(n: PNimrodNode, val: string) {.magic: "NSetStrVal".} + +proc newNimNode*(kind: TNimrodNodeKind, + n: PNimrodNode=nil): PNimrodNode {.magic: "NNewNimNode".} +proc copyNimNode*(n: PNimrodNode): PNimrodNode {.magic: "NCopyNimNode".} +proc copyNimTree*(n: PNimrodNode): PNimrodNode {.magic: "NCopyNimTree".} + +proc error*(msg: string) {.magic: "NError".} +proc warning*(msg: string) {.magic: "NWarning".} +proc hint*(msg: string) {.magic: "NHint".} + +proc newStrLitNode*(s: string): PNimrodNode {.compileTime.} = + result = newNimNode(nnkStrLit) + result.strVal = s + +proc newIntLitNode*(i: biggestInt): PNimrodNode {.compileTime.} = + result = newNimNode(nnkIntLit) + result.intVal = i + +proc newIntLitNode*(f: biggestFloat): PNimrodNode {.compileTime.} = + result = newNimNode(nnkFloatLit) + result.floatVal = f + +proc newIdentNode*(i: TNimrodIdent): PNimrodNode {.compileTime.} = + result = newNimNode(nnkIdent) + result.ident = i + +proc toStrLit*(n: PNimrodNode): PNimrodNode {.compileTime.} = + return newStrLitNode(repr(n)) + +proc expectKind*(n: PNimrodNode, k: TNimrodNodeKind) {.compileTime.} = + if n.kind != k: error("macro expects a node of kind: " & repr(k)) + +proc expectMinLen*(n: PNimrodNode, min: int) {.compileTime.} = + if n.len < min: error("macro expects a node with " & $min & " children") + +proc newCall*(theProc: TNimrodIdent, + args: openArray[PNimrodNode]): PNimrodNode {.compileTime.} = + ## produces a new call node. `theProc` is the proc that is called with + ## the arguments ``args[0..]``. + result = newNimNode(nnkCall) + result.add(newIdentNode(theProc)) + result.add(args) diff --git a/lib/math.nim b/lib/math.nim index aff5815ce..57c1c7e3d 100644 --- a/lib/math.nim +++ b/lib/math.nim @@ -18,6 +18,10 @@ when defined(Posix): {.passl: "-lm".} +const + PI* = 3.1415926535897932384626433 ## the circle constant PI (Ludolph's number) + E* = 2.71828182845904523536028747 ## Euler's number + type TFloatClass* = enum ## describes the class a floating point value belongs to. ## This is the type that is returned by `classify`. @@ -35,7 +39,7 @@ proc classify*(x: float): TFloatClass = # ECMAScript and most C compilers have no classify: if x == 0.0: - if 1.0/x == 1.0/0.0: + if 1.0/x == Inf: return fcZero else: return fcNegZero @@ -129,7 +133,7 @@ when not defined(ECMAScript): proc rand(): cint {.importc: "rand", nodecl.} proc randomize() = srand(gettime(nil)) - proc random(max: int): int = return rand() mod max + proc random(max: int): int = return int(rand()) mod max else: proc mathrandom(): float {.importc: "Math.random", nodecl.} diff --git a/lib/memman.nim b/lib/memman.nim index 81919389b..e8ebcd61c 100644 --- a/lib/memman.nim +++ b/lib/memman.nim @@ -164,7 +164,7 @@ else: # the fact that the OS is likely to give us pages with contingous numbers. # A page contains either small fixed size objects of the same size or # variable length objects. An object's size is always aligned at 16 byte -# boundry. Huge objects are dealt with the TLSF algorithm. +# boundary. Huge objects are dealt with the TLSF algorithm. # The design supports iterating over any object in a fast way. # A bitset contains any page that starts an allocated page. The page may be @@ -230,6 +230,7 @@ type zct: TCellArray stackCells: TCellArray smallBlocks: array [PageSize div MemAlign, ptr TPageDesc] + freeLists: array [PageSize div MemAlign, ptr TFreeList] pages: TPageManager usedPages: TPageList freePages: TPageList @@ -237,6 +238,11 @@ type # small blocks: proc allocSmall(var h: TGcHeap, size: int): pointer = var s = align(size) + var f = h.freeLists[s] + if f != nil: + f.prev = f.next # remove from list + f.next.prev = f.prev + return f var p = h.smallBlocks[s] if p == nil or p.free == nil: p = newSmallBlock(s, p) diff --git a/lib/nimbase.h b/lib/nimbase.h index 8d7c287e0..f7e41f2b1 100644 --- a/lib/nimbase.h +++ b/lib/nimbase.h @@ -10,6 +10,8 @@ #ifndef NIMBASE_H #define NIMBASE_H +#include <math.h> + /* calling convention mess ----------------------------------------------- */ #if defined(__GNUC__) || defined(__LCC__) || defined(__POCC__) \ || defined(__TINYC__) @@ -37,12 +39,16 @@ #if defined(__POCC__) # define NIM_CONST /* PCC is really picky with const modifiers */ +# undef _MSC_VER /* Yeah, right PCC defines _MSC_VER even if it is + not that compatible. Well done. */ #elif defined(__cplusplus) # define NIM_CONST /* C++ is picky with const modifiers */ #else # define NIM_CONST const #endif +#define NIM_THREADVAR __thread + /* --------------- how int64 constants should be declared: ----------- */ #if defined(__GNUC__) || defined(__LCC__) || \ defined(__POCC__) || defined(__DMC__) @@ -51,6 +57,14 @@ # define IL64(x) x #endif +/* ---------------- casting without correct aliasing rules ----------- */ + +#if defined(__GNUCC__) +# define NIM_CAST(type, ptr) (((union{type __x__;}*)(ptr))->__x__) +#else +# define NIM_CAST(type, ptr) ((type)(ptr)) +#endif + /* ------------------------------------------------------------------- */ #if defined(WIN32) || defined(_WIN32) /* only Windows has this mess... */ @@ -94,6 +108,16 @@ #define N_CLOSURE_PTR(rettype, name) rettype (*name) +#if defined(__GNUC__) || defined(__ICC__) +# define N_NOINLINE(rettype, name) rettype __attribute__((noinline)) name +#elif defined(_MSC_VER) +# define N_NOINLINE(rettype, name) __declspec(noinline) rettype name +#else +# define N_NOINLINE(rettype, name) rettype name +#endif + +#define N_NOINLINE_PTR(rettype, name) rettype (*name) + #if defined(__BORLANDC__) || defined(__WATCOMC__) || \ defined(__POCC__) || defined(_MSC_VER) /* these compilers have a fastcall so use it: */ @@ -164,13 +188,10 @@ # define _ISOC99_SOURCE 1 # define __USE_ISOC9X 1 # define __USE_ISOC99 1 -# include <math.h> #elif (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) \ && !defined(__BORLANDC__) && !defined(__POCC__) -# include <math.h> - /* Win32 doesn't seem to have these functions. ** Therefore implement inline versions of these functions here. */ @@ -194,8 +215,6 @@ static N_INLINE(long int, lrintf)(float flt) { #else -# include <math.h> - # ifndef lrint # define lrint(dbl) ((long int)(dbl)) # endif @@ -214,11 +233,6 @@ static N_INLINE(long int, lrintf)(float flt) { #include <signal.h> #include <setjmp.h> -#ifndef NAN -static unsigned long nimNaN[2]={0xffffffff, 0x7fffffff}; -# define NAN (*(double*) nimNaN) -#endif - /* #ifndef INF static unsigned long nimInf[2]={0xffffffff, 0x7fffffff}; @@ -241,8 +255,7 @@ __TINYC__ # define HAVE_STDINT_H #endif -#if defined(__LCC__) || defined(__GNUC__) || defined(__DMC__) \ - || defined(__POCC__) +#if defined(__LCC__) || defined(__DMC__) || defined(__POCC__) # define HAVE_STDINT_H #endif @@ -328,14 +341,16 @@ static N_INLINE(NI32, float32ToInt32)(float val) { return float64ToInt32((double)val); } +#define float64ToInt64(x) ((NI64) (x)) + #define zeroMem(a, size) memset(a, 0, size) #define equalMem(a, b, size) (memcmp(a, b, size) == 0) #define STRING_LITERAL(name, str, length) \ static const struct { \ - NI len, space; \ + TGenericSeq Sup; \ NIM_CHAR data[length + 1]; \ - } name = {length, length, str} + } name = {{length, length}, str} typedef struct TStringDesc* string; @@ -343,7 +358,7 @@ typedef struct TStringDesc* string; #if defined(__GNUC__) # define SEQ_DECL_SIZE /* empty is correct! */ #else -# define SEQ_DECL_SIZE 1000000 +# define SEQ_DECL_SIZE 1000000 #endif #define ALLOC_0(size) calloc(1, size) @@ -352,6 +367,13 @@ typedef struct TStringDesc* string; #define GenericSeqSize sizeof(TGenericSeq) #define paramCount() cmdCount +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__i386__) +# ifndef NAN +static unsigned long nimNaN[2]={0xffffffff, 0x7fffffff}; +# define NAN (*(double*) nimNaN) +# endif +#endif + #ifndef NAN # define NAN (0.0 / 0.0) #endif @@ -399,6 +421,7 @@ struct NimException { }; #endif +#if 0 typedef struct TStringDesc { NI len; NI space; @@ -410,5 +433,6 @@ typedef struct { } TGenericSeq; typedef TGenericSeq* PGenericSeq; +#endif #endif diff --git a/lib/os.nim b/lib/os.nim index f07045143..8ec781000 100644 --- a/lib/os.nim +++ b/lib/os.nim @@ -7,14 +7,12 @@ # distribution, for details about the copyright. # -## Basic operating system facilities like retrieving environment variables, -## reading command line arguments, working with directories, running shell -## commands, etc. This module is -- like any other basic library -- -## platform independant. However, the ECMAScript target is not supported, -## as there is no way to perform these operations in ECMAScript portably -## or at all. +## This module contains basic operating system facilities like +## retrieving environment variables, reading command line arguments, +## working with directories, running shell commands, etc. +## This module is -- like any other basic library -- platform independant. -{.push debugger:off.} +{.push debugger: off.} import strutils, times @@ -28,8 +26,9 @@ template newException(exceptn, message: expr): expr = e.msg = message e -when defined(windows) or defined(OS2) or defined(DOS): - {.define: doslike.} # DOS-like filesystem +const + doslike = defined(windows) or defined(OS2) or defined(DOS) + # DOS-like filesystem when defined(Nimdoc): # only for proper documentation: const @@ -69,6 +68,14 @@ when defined(Nimdoc): # only for proper documentation: ## True if the file system is case sensitive, false otherwise. Used by ## `cmpPaths` to compare filenames properly. + ExeExt* = "" + ## The file extension of native executables. For example: + ## "" on UNIX, "exe" on Windows. + + ScriptExt* = "" + ## The file extension of a script file. For example: "" on UNIX, + ## "bat" on Windows. + elif defined(macos): const curdir* = ':' @@ -77,6 +84,8 @@ elif defined(macos): altsep* = dirsep pathsep* = ',' FileSystemCaseSensitive* = false + ExeExt* = "" + ScriptExt* = "" # MacOS paths # =========== @@ -96,7 +105,7 @@ elif defined(macos): # waterproof. In case of equal names the first volume found will do. # Two colons "::" are the relative path to the parent. Three is to the # grandparent etc. -elif defined(doslike): +elif doslike: const curdir* = '.' pardir* = ".." @@ -104,6 +113,8 @@ elif defined(doslike): altsep* = '/' pathSep* = ';' # seperator between paths FileSystemCaseSensitive* = false + ExeExt* = "exe" + ScriptExt* = "bat" elif defined(PalmOS) or defined(MorphOS): const dirsep* = '/' @@ -111,6 +122,8 @@ elif defined(PalmOS) or defined(MorphOS): PathSep* = ';' pardir* = ".." FileSystemCaseSensitive* = false + ExeExt* = "" + ScriptExt* = "" elif defined(RISCOS): const dirsep* = '.' @@ -118,6 +131,8 @@ elif defined(RISCOS): pardir* = ".." # is this correct? pathSep* = ',' FileSystemCaseSensitive* = true + ExeExt* = "" + ScriptExt* = "" else: # UNIX-like operating system const curdir* = '.' @@ -126,6 +141,8 @@ else: # UNIX-like operating system altsep* = dirsep pathSep* = ':' FileSystemCaseSensitive* = true + ExeExt* = "" + ScriptExt* = "" const ExtSep* = '.' @@ -133,26 +150,26 @@ const ## for example, the '.' in ``os.nim``. proc getApplicationDir*(): string {.noSideEffect.} - ## Gets the directory of the application's executable. + ## Returns the directory of the application's executable. proc getApplicationFilename*(): string {.noSideEffect.} - ## Gets the filename of the application's executable. + ## Returns the filename of the application's executable. proc getCurrentDir*(): string {.noSideEffect.} - ## Gets the current working directory. + ## Returns the current working directory. proc setCurrentDir*(newDir: string) {.inline.} ## Sets the current working directory; `EOS` is raised if ## `newDir` cannot been set. proc getHomeDir*(): string {.noSideEffect.} - ## Gets the home directory of the current user. + ## Returns the home directory of the current user. proc getConfigDir*(): string {.noSideEffect.} - ## Gets the config directory of the current user for applications. + ## Returns the config directory of the current user for applications. proc expandFilename*(filename: string): string - ## Returns the full path of `filename`, "" on error. + ## Returns the full path of `filename`, raises EOS in case of an error. proc ExistsFile*(filename: string): bool ## Returns true if the file exists, false otherwise. @@ -216,13 +233,26 @@ proc SplitFilename*(filename: string, name, extension: var string) {. ## It the file has no extension, extention is the empty string. proc extractDir*(path: string): string {.noSideEffect.} - ## Extracts the directory of a given path. This is the `head` - ## result of `splitPath`. + ## Extracts the directory of a given path. This is almost the + ## same as the `head` result of `splitPath`, except that + ## ``extractDir("/usr/lib/") == "/usr/lib/"``. proc extractFilename*(path: string): string {.noSideEffect.} - ## Extracts the filename of a given `path`. This the the `tail` - ## result of `splitPath`. - # XXX: this is not true: /usr/lib/ --> filename should be empty! + ## Extracts the filename of a given `path`. This is almost the + ## same as the `tail` result of `splitPath`, except that + ## ``extractFilename("/usr/lib/") == ""``. + +proc extractFileExt*(filename: string): string {.noSideEffect.} = + ## Extracts the file extension of a given `filename`. This is the + ## same as the `extension` result of `splitFilename`. + var dummy: string + splitFilename(filename, dummy, result) + +proc extractFileTrunk*(filename: string): string {.noSideEffect.} = + ## Extracts the file name of a given `filename`. This removes any + ## directory information and the file extension. + var dummy: string + splitFilename(extractFilename(filename), result, dummy) proc cmpPaths*(pathA, pathB: string): int {.noSideEffect.} ## Compares two paths. @@ -251,28 +281,23 @@ proc ChangeFileExt*(filename, ext: string): string {.noSideEffect.} ## filesystems may use a different character. (Although I know ## of none such beast.) -# procs dealing with processes: -proc executeProcess*(command: string): int - ## Executes a process. - ## - ## Command has the form 'program args' where args are the command - ## line arguments given to program. The proc returns the error code - ## of the process when it has finished. The proc does not return - ## until the process has finished. - proc executeShellCommand*(command: string): int ## Executes a shell command. ## - ## The syntax of the command is unspecified and depends on the used - ## shell. The proc returns the error code of the shell when it has finished. + ## Command has the form 'program args' where args are the command + ## line arguments given to program. The proc returns the error code + ## of the shell when it has finished. The proc does not return until + ## the process has finished. To execute a program without having a + ## shell involved, use the `executeProcess` proc of the `osproc` + ## module. # procs operating on a high level for files: proc copyFile*(dest, source: string) - ## Copies a file from `dest` to `source`. If this fails, + ## Copies a file from `source` to `dest`. If this fails, ## `EOS` is raised. proc moveFile*(dest, source: string) - ## Moves a file from `dest` to `source`. If this fails, `EOS` is raised. + ## Moves a file from `source` to `dest`. If this fails, `EOS` is raised. proc removeFile*(file: string) ## Removes the `file`. If this fails, `EOS` is raised. @@ -294,10 +319,10 @@ proc existsDir*(dir: string): bool ## is returned. proc getLastModificationTime*(file: string): TTime - ## Gets the time of the `file`'s last modification. + ## Returns the time of the `file`'s last modification. proc fileNewer*(a, b: string): bool - ## returns true if the file `a` is newer than file `b`, i.e. if `a`'s + ## Returns true if the file `a` is newer than file `b`, i.e. if `a`'s ## modification time is later than `b`'s. # procs dealing with environment variables: @@ -306,7 +331,7 @@ proc putEnv*(key, val: string) ## If an error occurs, `EInvalidEnvVar` is raised. proc getEnv*(key: string): string - ## Gets the value of the environment variable named `key`. + ## Returns the value of the environment variable named `key`. ## ## If the variable does not exist, "" is returned. To distinguish ## whether a variable exists or it's value is just "", call @@ -328,6 +353,43 @@ proc paramStr*(i: int): string ## `i` should be in the range `1..paramCount()`, else ## the `EOutOfIndex` exception is raised. +when defined(windows): + proc GetLastError(): int32 {.importc, stdcall, dynlib: "kernel32".} + proc FormatMessageA(dwFlags: int32, lpSource: pointer, + dwMessageId, dwLanguageId: int32, + lpBuffer: pointer, nSize: int32, + Arguments: pointer): int32 {. + importc, stdcall, dynlib: "kernel32".} + proc LocalFree(p: pointer) {.importc, stdcall, dynlib: "kernel32".} + +var errno {.importc, header: "<errno.h>".}: cint ## error variable +proc strerror(errnum: cint): cstring {.importc, header: "<string.h>".} + +proc OSError*(msg: string = "") {.noinline.} = + ## raises an EOS exception with the given message ``msg``. + ## If ``msg == ""``, the operating system's error flag + ## (``errno``) is converted to a readable error message. On Windows + ## ``GetLastError`` is checked before ``errno``. + ## If no error flag is set, the message ``unknown OS error`` is used. + if len(msg) == 0: + when defined(Windows): + var err = GetLastError() + if err != 0'i32: + # sigh, why is this is so difficult? + var msgbuf: cstring + if FormatMessageA(0x00000100 or 0x00001000 or 0x00000200, + nil, err, 0, addr(msgbuf), 0, nil) != 0'i32: + var m = $msgbuf + if msgbuf != nil: + LocalFree(msgbuf) + raise newException(EOS, m) + if errno != 0'i32: + raise newException(EOS, $strerror(errno)) + else: + raise newException(EOS, "unknown OS error") + else: + raise newException(EOS, msg) + # implementation proc UnixToNativePath(path: string): string = @@ -337,7 +399,7 @@ proc UnixToNativePath(path: string): string = var start: int if path[0] == '/': # an absolute path - when defined(doslike): + when doslike: result = r"C:\" elif defined(macos): result = "" # must not start with ':' @@ -368,7 +430,7 @@ proc UnixToNativePath(path: string): string = add result, dirSep inc(i) else: - add result, $path[i] + add result, path[i] inc(i) # interface to C library: @@ -377,7 +439,8 @@ const cunder = if defined(pcc): "_" else: "" type - TStat {.importc: "struct " & cunder & "stat", final.} = object + TStat {.importc: "struct " & cunder & "stat", + header: "<sys/stat.h>", pure.} = object st_dev: int16 st_ino: int16 st_mode: int16 @@ -390,60 +453,56 @@ type st_mtime: TTime st_ctime: TTime -var - errno {.importc: "errno", header: "<errno.h>".}: cint - EEXIST {.importc: "EEXIST", header: "<errno.h>".}: cint when defined(unix): - const dirHeader = "<sys/stat.h>" -elif defined(windows): - const dirHeader = "<direct.h>" -else: - {.error: "os library not ported to your OS. Please help!".} - - -proc chdir(path: CString): cint {. - importc: cunder & "chdir", header: dirHeader.} + var + EEXIST {.importc: "EEXIST", header: "<errno.h>".}: cint -when defined(unix): proc mkdir(dir: CString, theAccess: cint): cint {. - importc: "mkdir", header: dirHeader.} + importc: "mkdir", header: "<sys/stat.h>".} proc realpath(name, resolved: CString): CString {. importc: "realpath", header: "<stdlib.h>".} proc getcwd(buf: CString, buflen: cint): CString {. importc: "getcwd", header: "<unistd.h>".} -elif defined(windows): - proc mkdir(dir: CString): cint {. - importc: "mkdir", header: dirHeader.} - proc fullpath(buffer, file: CString, size: int): CString {. - importc: "_fullpath", header: "<stdlib.h>".} - proc getcwd(buf: CString, buflen: cint): CString {. - importc: cunder & "getcwd", header: "<direct.h>".} + proc chdir(path: CString): cint {. + importc: "chdir", header: "<unistd.h>".} + proc rmdir(dir: CString): cint {. + importc: "rmdir", header: "<unistd.h>".} - proc CreateDirectory(pathName: cstring, security: Pointer): cint {. - importc: "CreateDirectory", header: "<windows.h>".} - proc GetLastError(): cint {.importc, header: "<windows.h>".} + # is in <stdlib.h>: + proc cputenv(env: CString): cint {.importc: "putenv", noDecl.} + +elif defined(windows): + proc GetCurrentDirectoryA(nBufferLength: int32, lpBuffer: cstring): int32 {. + importc, dynlib: "kernel32", stdcall.} + proc SetCurrentDirectoryA(lpPathName: cstring): int32 {. + importc, dynlib: "kernel32", stdcall.} + proc CreateDirectoryA(pathName: cstring, security: Pointer): int32 {. + importc: "CreateDirectoryA", dynlib: "kernel32", stdcall.} + proc RemoveDirectoryA(lpPathName: cstring): int32 {. + importc, dynlib: "kernel32", stdcall.} + proc SetEnvironmentVariableA(lpName, lpValue: cstring): int32 {. + stdcall, dynlib: "kernel32", importc.} else: {.error: "os library not ported to your OS. Please help!".} -proc rmdir(dir: CString): cint {. - importc: cunder & "rmdir", header: "<time.h>".} - # rmdir is of course in ``dirHeader``, but we check here to include - # time.h which is needed for stat(). stat() needs time.h and - # sys/stat.h; we workaround a C library issue here. -proc free(c: cstring) {.importc: "free", nodecl.} - # some C procs return a buffer that has to be freed with free(), - # so we define it here -proc strlen(str: CString): int {.importc: "strlen", nodecl.} +when defined(unix): + proc free(c: cstring) {.importc: "free", nodecl.} + # some C procs return a buffer that has to be freed with free(), + # so we define it here + proc strlen(str: CString): int {.importc: "strlen", nodecl.} proc stat(f: CString, res: var TStat): cint {. - importc: cunder & "stat", header: "<sys/stat.h>".} + importc: cunder & "stat", header: "<time.h>".} + # stat is of course in ``<sys/stat.h>``, but I include + # time.h which is needed for stat() too. stat() needs both time.h and + # sys/stat.h. when defined(windows): - proc getModuleFilename(handle: int32, buf: CString, size: int32): int32 {. - importc: "GetModuleFileName", header: "<windows.h>".} + proc GetModuleFileNameA(handle: int32, buf: CString, size: int32): int32 {. + importc, dynlib: "kernel32", stdcall.} proc getLastModificationTime(file: string): TTime = var @@ -452,11 +511,12 @@ proc getLastModificationTime(file: string): TTime = return res.st_mtime proc setCurrentDir(newDir: string) = - if chdir(newDir) != 0: - raise newException(EOS, "cannot change the working directory to '$1'" % - newDir) + when defined(Windows): + if SetCurrentDirectoryA(newDir) == 0'i32: OSError() + else: + if chdir(newDir) != 0'i32: OSError() -when defined(linux) or defined(solaris) or defined(bsd): +when defined(linux) or defined(solaris) or defined(bsd) or defined(aix): proc readlink(link, buf: cstring, size: int): int {. header: "<unistd.h>", cdecl.} @@ -487,14 +547,14 @@ proc getApplicationFilename(): string = # /proc/<pid>/file when defined(windows): result = newString(256) - var len = getModuleFileName(0, result, 256) + var len = getModuleFileNameA(0, result, 256) setlen(result, int(len)) - elif defined(linux): + elif defined(linux) or defined(aix): result = getApplAux("/proc/self/exe") elif defined(solaris): result = getApplAux("/proc/" & $getpid() & "/path/a.out") elif defined(bsd): - result = getApplAux("/proc/" & $getpid() & "file") + result = getApplAux("/proc/" & $getpid() & "/file") elif defined(macosx): var size: int32 getExecPath1(nil, size) @@ -513,20 +573,22 @@ proc getApplicationFilename(): string = var x = joinPath(p, result) if ExistsFile(x): return x -{.push warnings: off.} proc getApplicationDir(): string = var tail: string splitPath(getApplicationFilename(), result, tail) -{.pop.} proc getCurrentDir(): string = - const - bufsize = 512 # should be enough + const bufsize = 512 # should be enough result = newString(bufsize) - if getcwd(result, bufsize) != nil: - setlen(result, strlen(result)) + when defined(windows): + var L = GetCurrentDirectoryA(bufsize, result) + if L == 0'i32: OSError() + setLen(result, L) else: - raise newException(EOS, "getcwd failed") + if getcwd(result, bufsize) != nil: + setlen(result, strlen(result)) + else: + OSError() proc JoinPath(head, tail: string): string = if len(head) == 0: @@ -617,46 +679,65 @@ proc AppendFileExt(filename, ext: string): string = proc csystem(cmd: CString): cint {.importc: "system", noDecl.} # is in <stdlib.h>! -when defined(wcc): - # everywhere it is in <stdlib.h>, except for Watcom C ... - proc cputenv(env: CString): cint {.importc: "putenv", header: "<process.h>".} - -else: # is in <stdlib.h> - proc cputenv(env: CString): cint {.importc: cunder & "putenv", noDecl.} - proc cgetenv(env: CString): CString {.importc: "getenv", noDecl.} -#long _findfirst(char *, struct _finddata_t *); -#int _findnext(long, struct _finddata_t *); -#int _findclose(long); when defined(windows): + const + FILE_ATTRIBUTE_DIRECTORY = 16 + MAX_PATH = 260 type - TFindData {.importc: "struct _finddata_t", final.} = object - attrib {.importc: "attrib".}: cint - time_create {.importc: "time_create".}: cint - time_access {.importc: "time_access".}: cint - time_write {.importc: "time_write".}: cint - size {.importc: "size".}: cint - name {.importc: "name".}: array[0..259, char] - - proc findfirst(pathname: CString, f: ptr TFindData): cint {. - importc: "_findfirst", header: "<io.h>".} - proc findnext(handle: cint, f: ptr TFindData): cint {. - importc: "_findnext", header: "<io.h>".} - proc findclose(handle: cint) {.importc: "_findclose", header: "<io.h>".} + HANDLE = int + FILETIME {.pure.} = object + dwLowDateTime: int32 + dwHighDateTime: int32 + TWIN32_FIND_DATA {.pure.} = object + dwFileAttributes: int32 + ftCreationTime: FILETIME + ftLastAccessTime: FILETIME + ftLastWriteTime: FILETIME + nFileSizeHigh: int32 + nFileSizeLow: int32 + dwReserved0: int32 + dwReserved1: int32 + cFileName: array[0..(MAX_PATH) - 1, char] + cAlternateFileName: array[0..13, char] + proc FindFirstFileA(lpFileName: cstring, + lpFindFileData: var TWIN32_FIND_DATA): HANDLE {. + stdcall, dynlib: "kernel32", importc: "FindFirstFileA".} + proc FindNextFileA(hFindFile: HANDLE, + lpFindFileData: var TWIN32_FIND_DATA): int32 {. + stdcall, dynlib: "kernel32", importc: "FindNextFileA".} + proc FindClose(hFindFile: HANDLE) {.stdcall, dynlib: "kernel32", + importc: "FindClose".} + + proc GetFullPathNameA(lpFileName: cstring, nBufferLength: int32, + lpBuffer: cstring, lpFilePart: var cstring): int32 {. + stdcall, dynlib: "kernel32", importc.} + proc GetFileAttributesA(lpFileName: cstring): int32 {. + stdcall, dynlib: "kernel32", importc.} + else: type - TFindData {.importc: "glob_t", final.} = object + TDIR {.importc: "DIR", header: "<dirent.h>", pure.} = object + TDirent {.importc: "struct dirent", header: "<dirent.h>", pure.} = object + d_name: array [0..255, char] + + proc opendir(dir: cstring): ptr TDIR {.importc, header: "<dirent.h>".} + proc closedir(dir: ptr TDIR) {.importc, header: "<dirent.h>".} + proc readdir(dir: ptr TDIR): ptr TDirent {.importc, header: "<dirent.h>".} + + type + TGlob {.importc: "glob_t", header: "<glob.h>", final, pure.} = object gl_pathc: int # count of paths matched by pattern - gl_pathv: ptr array[0..1000_000, CString] # list of matched path names + gl_pathv: cstringArray # list of matched path names gl_offs: int # slots to reserve at beginning of gl_pathv - PFindData = ptr TFindData + PGlob = ptr TGlob proc glob(pattern: cstring, flags: cint, errfunc: pointer, - pglob: PFindData): cint {. + pglob: PGlob): cint {. importc: "glob", header: "<glob.h>".} - proc globfree(pglob: PFindData) {. + proc globfree(pglob: PGlob) {. importc: "globfree", header: "<glob.h>".} proc sameFile*(path1, path2: string): bool = @@ -665,132 +746,149 @@ proc sameFile*(path1, path2: string): bool = ## Raises an exception if an os.stat() call on either pathname fails. when defined(Windows): var - a, b: TFindData - var resA = findfirst(path1, addr(a)) - var resB = findfirst(path2, addr(b)) + a, b: TWin32FindData + var resA = findfirstFileA(path1, a) + var resB = findfirstFileA(path2, b) if resA != -1 and resB != -1: - result = $a.name == $b.name + result = $a.cFileName == $b.cFileName else: - # work around some ``findfirst`` bugs + # work around some ``findfirstFileA`` bugs result = cmpPaths(path1, path2) == 0 if resA != -1: findclose(resA) if resB != -1: findclose(resB) else: var a, b: TStat - if stat(path1, a) < 0 or stat(path2, b) < 0: + if stat(path1, a) < 0'i32 or stat(path2, b) < 0'i32: result = cmpPaths(path1, path2) == 0 # be consistent with Windows else: - result = int(a.st_dev) == b.st_dev and int(a.st_ino) == b.st_ino + result = a.st_dev == b.st_dev and a.st_ino == b.st_ino +proc sameFileContent*(path1, path2: string): bool = + ## Returns True if both pathname arguments refer to files with identical + ## content. Content is compared byte for byte. + const + bufSize = 8192 # 8K buffer + var + a, b: TFile + if not openFile(a, path1): return false + if not openFile(b, path2): + closeFile(a) + return false + var bufA = alloc(bufsize) + var bufB = alloc(bufsize) + while True: + var readA = readBuffer(a, bufA, bufsize) + var readB = readBuffer(b, bufB, bufsize) + if readA != readB: + result = false + break + if readA == 0: + result = true + break + result = equalMem(bufA, bufB, readA) + if not result: break + if readA != bufSize: break # end of file + dealloc(bufA) + dealloc(bufB) + closeFile(a) + closeFile(b) + +# Ansi C has these: proc cremove(filename: CString): cint {.importc: "remove", noDecl.} proc crename(oldname, newname: CString): cint {.importc: "rename", noDecl.} when defined(Windows): - proc cCopyFile(lpExistingFileName, lpNewFileName: CString, + proc CopyFileA(lpExistingFileName, lpNewFileName: CString, bFailIfExists: cint): cint {. - importc: "CopyFile", header: "<windows.h>".} - # cMoveFile(lpExistingFileName, lpNewFileName: CString): int - # {.importc: "MoveFile", noDecl, header: "<winbase.h>".} - # cRemoveFile(filename: CString, cmo: int) - # {.importc: "DeleteFile", noDecl, header: "<winbase.h>".} + importc, stdcall, dynlib: "kernel32".} + proc copyFile(dest, source: string) = + if CopyFileA(source, dest, 0'i32) == 0'i32: OSError() + else: - # generic version of cCopyFile which works for any platform: - proc cCopyFile(lpExistingFileName, lpNewFileName: CString, - bFailIfExists: cint): cint = + # generic version of copyFile which works for any platform: + proc copyFile(dest, source: string) = const bufSize = 8192 # 8K buffer var - dest, src: TFile - if not openFile(src, $lpExistingFilename): return -1 - if not openFile(dest, $lpNewFilename, fmWrite): - closeFile(src) - return -1 + d, s: TFile + if not openFile(s, source): OSError() + if not openFile(d, dest, fmWrite): + closeFile(s) + OSError() var buf: Pointer = alloc(bufsize) bytesread, byteswritten: int while True: - bytesread = readBuffer(src, buf, bufsize) - byteswritten = writeBuffer(dest, buf, bytesread) + bytesread = readBuffer(s, buf, bufsize) + byteswritten = writeBuffer(d, buf, bytesread) if bytesread != bufSize: break - if byteswritten == bytesread: result = 0 - else: result = -1 + if bytesread != bytesWritten: OSError() dealloc(buf) - closeFile(src) - closeFile(dest) - + closeFile(s) + closeFile(d) proc moveFile(dest, source: string) = - if crename(source, dest) != 0: - raise newException(EOS, "cannot move file from '$1' to '$2'" % - [source, dest]) - -proc copyFile(dest, source: string) = - if cCopyFile(source, dest, 0) != 0: - raise newException(EOS, "cannot copy file from '$1' to '$2'" % - [source, dest]) + if crename(source, dest) != 0'i32: OSError() proc removeFile(file: string) = - if cremove(file) != 0: - raise newException(EOS, "cannot remove file '$1'" % file) + if cremove(file) != 0'i32: OSError() proc removeDir(dir: string) = - if rmdir(dir) != 0: - raise newException(EOS, "cannot remove directory '$1'" % dir) + when defined(windows): + if RemoveDirectoryA(dir) == 0'i32: OSError() + else: + if rmdir(dir) != 0'i32: OSError() -proc createDir(dir: string) = +proc rawCreateDir(dir: string) = when defined(unix): - if mkdir(dir, 0o711) != 0 and int(errno) != EEXIST: - raise newException(EOS, "cannot create directory '$1'" % dir) + if mkdir(dir, 0o711) != 0'i32 and errno != EEXIST: + OSError() else: - if CreateDirectory(dir, nil) == 0 and GetLastError() != 183: - raise newException(EOS, "cannot create directory '$1'" % dir) - -proc existsDir(dir: string): bool = - var safe = getCurrentDir() - # just try to set the current dir to dir; if it works, it must exist: - result = chdir(dir) == 0 - if result: - setCurrentDir(safe) # set back to the old working directory + if CreateDirectoryA(dir, nil) == 0'i32 and GetLastError() != 183'i32: + OSError() -proc executeProcess(command: string): int = - return csystem(command) # XXX: do this without shell +proc createDir(dir: string) = + for i in 0.. dir.len-1: + if dir[i] in {dirsep, altsep}: rawCreateDir(copy(dir, 0, i-1)) + rawCreateDir(dir) proc executeShellCommand(command: string): int = return csystem(command) var envComputed: bool = false - environment {.noStatic.}: seq[string] = [] + environment: seq[string] = @[] when defined(windows): # because we support Windows GUI applications, things get really # messy here... - proc GetEnvironmentStrings(): Pointer {. - importc: "GetEnvironmentStrings", header: "<windows.h>".} - proc FreeEnvironmentStrings(env: Pointer) {. - importc: "FreeEnvironmentStrings", header: "<windows.h>".} + proc GetEnvironmentStringsA*(): cstring {. + stdcall, dynlib: "kernel32", importc.} + proc FreeEnvironmentStringsA*(para1: cstring): int32 {. + stdcall, dynlib: "kernel32", importc.} + proc strEnd(cstr: CString, c = 0): CString {.importc: "strchr", nodecl.} - proc getEnvVarsC() {.noStatic.} = + proc getEnvVarsC() = if not envComputed: var - env = cast[CString](getEnvironmentStrings()) + env = getEnvironmentStringsA() e = env if e == nil: return # an error occured while True: var eend = strEnd(e) - add environment, $e + add(environment, $e) e = cast[CString](cast[TAddress](eend)+1) if eend[1] == '\0': break envComputed = true - FreeEnvironmentStrings(env) + discard FreeEnvironmentStringsA(env) else: var gEnv {.importc: "gEnv".}: ptr array [0..10_000, CString] - proc getEnvVarsC() {.noStatic.} = + proc getEnvVarsC() = # retrieves the variables of char** env of C's main proc if not envComputed: var @@ -840,8 +938,12 @@ proc putEnv(key, val: string) = else: add environment, (key & '=' & val) indx = high(environment) - if cputenv(environment[indx]) != 0: - raise newException(EOS, "attempt to set an invalid environment variable") + when defined(unix): + if cputenv(environment[indx]) != 0'i32: + OSError() + else: + if SetEnvironmentVariableA(key, val) == 0'i32: + OSError() iterator walkFiles*(pattern: string): string = ## Iterate over all the files that match the `pattern`. @@ -850,34 +952,108 @@ iterator walkFiles*(pattern: string): string = ## notation is supported. when defined(windows): var - f: TFindData + f: TWin32FindData res: int - res = findfirst(pattern, addr(f)) + res = findfirstFileA(pattern, f) if res != -1: while true: - yield $f.name - if int(findnext(res, addr(f))) == -1: break + if f.cFileName[0] != '.': + yield extractDir(pattern) / extractFilename($f.cFileName) + if findnextFileA(res, f) == 0'i32: break findclose(res) else: # here we use glob var - f: TFindData + f: TGlob res: int f.gl_offs = 0 f.gl_pathc = 0 f.gl_pathv = nil res = glob(pattern, 0, nil, addr(f)) - if res != 0: raise newException(EOS, "walkFiles() failed") - for i in 0.. f.gl_pathc - 1: - assert(f.gl_pathv[i] != nil) - yield $f.gl_pathv[i] + if res == 0: + for i in 0.. f.gl_pathc - 1: + assert(f.gl_pathv[i] != nil) + yield $f.gl_pathv[i] globfree(addr(f)) -{.push warnings:off.} +type + TPathComponent* = enum ## Enumeration specifying a path component. + pcFile, ## path refers to a file + pcLinkToFile, ## path refers to a symbolic link to a file + pcDirectory, ## path refers to a directory + pcLinkToDirectory ## path refers to a symbolic link to a directory + +when defined(posix): + proc S_ISDIR(m: int16): bool {.importc, header: "<sys/stat.h>".} + proc S_ISLNK(m: int16): bool {.importc, header: "<sys/stat.h>".} + proc S_ISREG(m: int16): bool {.importc, header: "<sys/stat.h>".} + +iterator walkDir*(dir: string): tuple[kind: TPathComponent, path: string] = + ## walks over the directory `dir` and yields for each directory or file in + ## `dir`. The component type and full path for each item is returned. + ## Walking is not recursive. + ## Example: Assuming this directory structure:: + ## dirA / dirB / fileB1.txt + ## / dirC + ## / fileA1.txt + ## / fileA2.txt + ## + ## and this code: + ## + ## .. code-block:: Nimrod + ## for kind, path in walkDir("dirA"): + ## echo(path) + ## + ## produces this output (though not necessarily in this order!):: + ## dirA/dirB + ## dirA/dirC + ## dirA/fileA1.txt + ## dirA/fileA2.txt + when defined(windows): + var f: TWIN32_Find_Data + var h = findfirstFileA(dir / "*", f) + if h != -1: + while true: + var k = pcFile + if f.cFilename[0] != '.': + if (int(f.dwFileAttributes) and FILE_ATTRIBUTE_DIRECTORY) != 0: + k = pcDirectory + yield (k, dir / extractFilename($f.cFilename)) + if findnextFileA(h, f) == 0'i32: break + findclose(h) + else: + var d = openDir(dir) + if d != nil: + while true: + var x = readDir(d) + if x == nil: break + var y = $x.d_name + if y != "." and y != "..": + var s: TStat + y = dir / y + if stat(y, s) < 0'i32: break + var k = pcFile + if S_ISDIR(s.st_mode): k = pcDirectory + if S_ISLNK(s.st_mode): k = succ(k) + yield (k, y) + closeDir(d) + proc ExistsFile(filename: string): bool = - var - res: TStat - return stat(filename, res) >= 0 -{.pop.} + when defined(windows): + var a = GetFileAttributesA(filename) + if a != -1: + result = (a and FILE_ATTRIBUTE_DIRECTORY) == 0 + else: + var res: TStat + return stat(filename, res) >= 0'i32 and S_ISREG(res.st_mode) + +proc existsDir(dir: string): bool = + when defined(windows): + var a = GetFileAttributesA(dir) + if a != -1: + result = (a and FILE_ATTRIBUTE_DIRECTORY) != 0 + else: + var res: TStat + return stat(dir, res) >= 0'i32 and S_ISDIR(res.st_mode) proc cmpPaths(pathA, pathB: string): int = if FileSystemCaseSensitive: @@ -886,29 +1062,56 @@ proc cmpPaths(pathA, pathB: string): int = result = cmpIgnoreCase(pathA, pathB) proc extractDir(path: string): string = - var - tail: string - splitPath(path, result, tail) + if path[path.len-1] in {dirSep, altSep}: + result = path + else: + var tail: string + splitPath(path, result, tail) proc extractFilename(path: string): string = - var - head: string - splitPath(path, head, result) + if path[path.len-1] in {dirSep, altSep}: + result = "" + else: + var head: string + splitPath(path, head, result) proc expandFilename(filename: string): string = # returns the full path of 'filename'; "" on error - var - res: CString - when defined(unix): - res = realpath(filename, nil) - else: - res = fullpath(nil, filename, 0) - if res == nil: - result = "" # an error occured + when defined(windows): + var unused: cstring + result = newString(3072) + var L = GetFullPathNameA(filename, 3072'i32, result, unused) + if L <= 0'i32 or L >= 3072'i32: OSError() + setLen(result, L) else: + var res = realpath(filename, nil) + if res == nil: OSError() result = $res free(res) +proc parseCmdLine*(c: string): seq[string] = + ## Splits a command line into several components; components are separated by + ## whitespace or are quoted with the ``"`` or ``'`` characters. This proc is + ## only occassionally useful, better use the `parseopt` module. + result = @[] + var i = 0 + while c[i] != '\0': + var a = "" + while c[i] >= '\1' and c[i] <= ' ': inc(i) # skip whitespace + case c[i] + of '\'', '\"': + var delim = c[i] + inc(i) # skip ' or " + while c[i] != '\0' and c[i] != delim: + add a, c[i] + inc(i) + if c[i] != '\0': inc(i) + else: + while c[i] > ' ': + add(a, c[i]) + inc(i) + add(result, a) + when defined(windows): proc GetHomeDir(): string = return getEnv("USERPROFILE") & "\\" proc GetConfigDir(): string = return getEnv("APPDATA") & "\\" @@ -918,51 +1121,22 @@ when defined(windows): # command line arguments. The way to get them differs. Thus we parse them # ourselves. This has the additional benefit that the program's behaviour # is always the same -- independent of the used C compiler. - proc GetCommandLine(): CString {. - importc: "GetCommandLine", header: "<windows.h>".} + proc GetCommandLineA(): CString {.importc, stdcall, dynlib: "kernel32".} var - ownArgc: int = -1 - ownArgv: seq[string] = [] - - proc parseCmdLine() = - if ownArgc != -1: return # already processed - var - i = 0 - j = 0 - c = getCommandLine() - ownArgc = 0 - while c[i] != '\0': - var a = "" - while c[i] >= '\1' and c[i] <= ' ': inc(i) # skip whitespace - case c[i] - of '\'', '\"': - var delim = c[i] - inc(i) # skip ' or " - while c[i] != '\0' and c[i] != delim: - add a, c[i] - inc(i) - if c[i] != '\0': inc(i) - else: - while c[i] > ' ': - add a, c[i] - inc(i) - add ownArgv, a - inc(ownArgc) + ownArgv: seq[string] proc paramStr(i: int): string = - parseCmdLine() - if i < ownArgc and i >= 0: - return ownArgv[i] - raise newException(EInvalidIndex, "invalid index") + if isNil(ownArgv): ownArgv = parseCmdLine($getCommandLineA()) + return ownArgv[i] proc paramCount(): int = - parseCmdLine() - result = ownArgc-1 + if isNil(ownArgv): ownArgv = parseCmdLine($getCommandLineA()) + result = ownArgv.len-1 else: proc GetHomeDir(): string = return getEnv("HOME") & "/" - proc GetConfigDir(): string = return getEnv("HOME") & "/" + proc GetConfigDir(): string = return getEnv("HOME") & "/.config/" var cmdCount {.importc: "cmdCount".}: int diff --git a/lib/parsecfg.nim b/lib/parsecfg.nim index 96305349e..a148f3e3a 100644 --- a/lib/parsecfg.nim +++ b/lib/parsecfg.nim @@ -25,7 +25,7 @@ import - hashes, strutils, lexbase + hashes, strutils, lexbase, streams type TCfgEventKind* = enum ## enumation of all events that may occur when parsing @@ -37,7 +37,7 @@ type TCfgEvent* = object of TObject ## describes a parsing event case kind*: TCfgEventKind ## the kind of the event - of cfgEof: dummy: string + of cfgEof: nil of cfgSectionStart: section*: string ## `section` contains the name of the ## parsed section start (syntax: ``[section]``) @@ -59,21 +59,18 @@ type literal: string # the parsed (string) literal TParserState = enum - startState, commaState + startState # , commaState # not yet used TCfgParser* = object of TBaseLexer ## the parser object. tok: TToken state: TParserState filename: string -proc Open*(c: var TCfgParser, filename: string): bool - ## initializes the parser, open the file for reading and returns true if - ## successful (the file has been found). - -proc OpenFromBuffer*(c: var TCfgParser, buf: string) - ## initializes the parser with a buffer. This cannot fail. +proc open*(c: var TCfgParser, input: PStream, filename: string) + ## initializes the parser with an input stream. `Filename` is only used + ## for nice error messages. proc close*(c: var TCfgParser) - ## closes the parser `c`. + ## closes the parser `c` and its associated input stream. proc next*(c: var TCfgParser): TCfgEvent ## retrieves the first/next event. This controls the parser. @@ -87,6 +84,10 @@ proc getLine*(c: TCfgParser): int proc getFilename*(c: TCfgParser): string ## get the filename of the file that the parser processes. +proc errorStr*(c: TCfgParser, msg: string): string + ## returns a properly formated error message containing current line and + ## column information. + # implementation @@ -94,24 +95,16 @@ const SymChars: TCharSet = {'a'..'z', 'A'..'Z', '0'..'9', '_', '\x80'..'\xFF'} proc rawGetTok(c: var TCfgParser, tok: var TToken) -proc open(c: var TCfgParser, filename: string): bool = - result = initBaseLexer(c, filename) +proc open(c: var TCfgParser, input: PStream, filename: string) = + lexbase.open(c, input) c.filename = filename c.state = startState c.tok.kind = tkInvalid c.tok.literal = "" - if result: rawGetTok(c, c.tok) - -proc openFromBuffer(c: var TCfgParser, buf: string) = - initBaseLexerFromBuffer(c, buf) - c.filename = "buffer" - c.state = startState - c.tok.kind = tkInvalid - c.tok.literal = "" rawGetTok(c, c.tok) - + proc close(c: var TCfgParser) = - deinitBaseLexer(c) + lexbase.close(c) proc getColumn(c: TCfgParser): int = result = getColNumber(c, c.bufPos) @@ -285,6 +278,7 @@ proc rawGetTok(c: var TCfgParser, tok: var TToken) = of '=': tok.kind = tkEquals inc(c.bufpos) + tok.literal = "=" of '-': inc(c.bufPos) if c.buf[c.bufPos] == '-': inc(c.bufPos) @@ -312,6 +306,7 @@ proc rawGetTok(c: var TCfgParser, tok: var TToken) = getString(c, tok, false) of lexbase.EndOfFile: tok.kind = tkEof + tok.literal = "[EOF]" else: getSymbol(c, tok) proc errorStr(c: TCfgParser, msg: string): string = diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim index 35fe0a0df..38677420d 100644 --- a/lib/posix/posix.nim +++ b/lib/posix/posix.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2006 Andreas Rumpf +# (c) Copyright 2008 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -20,13 +20,17 @@ ## ALL types are named the same as in the POSIX standard except that they start ## with 'T' or 'P' (if they are pointers) and without the '_t' prefix to be ## consistent with Nimrod conventions. If an identifier is a Nimrod keyword -## the `identifier` notation is used. +## the \`identifier\` notation is used. ## ## This library relies on the header files of your C compiler. Thus the ## resulting C code will just include <XYZ.h> and *not* define the ## symbols declared here. const + hasSpawnH = defined(linux) + hasAioH = defined(linux) + +const C_IRUSR* = 0c000400 ## Read by owner. C_IWUSR* = 0c000200 ## Write by owner. C_IXUSR* = 0c000100 ## Execute by owner. @@ -55,28 +59,19 @@ const MM_NULLACT* = nil MM_NULLTAG* = nil - STDERR_FILENO = 2 ## File number of stderr; - STDIN_FILENO = 0 ## File number of stdin; - STDOUT_FILENO = 1 ## File number of stdout; + STDERR_FILENO* = 2 ## File number of stderr; + STDIN_FILENO* = 0 ## File number of stdin; + STDOUT_FILENO* = 1 ## File number of stdout; type - Taiocb* {.importc: "struct aiocb", header: "<aio.h>", final.} = object - aio_fildes*: cint ## File descriptor. - aio_offset*: TOff ## File offset. - aio_buf*: pointer ## Location of buffer. - aio_nbytes*: int ## Length of transfer. - aio_reqprio*: cint ## Request priority offset. - aio_sigevent*: TSigEvent ## Signal number and value. - aio_lio_opcode: cint ## Operation to be performed. - - TDIR* {.importc: "DIR", header: "<dirent.h>", final.} = object + TDIR* {.importc: "DIR", header: "<dirent.h>", final, pure.} = object ## A type representing a directory stream. - Tdirent* {.importc: "struct dirent", header: "<dirent.h>", final.} = object + Tdirent* {.importc: "struct dirent", header: "<dirent.h>", final, pure.} = object d_ino*: TIno ## File serial number. d_name*: array [0..255, char] ## Name of entry. - Tflock* {.importc: "flock", header: "<fcntl>", final.} = object + Tflock* {.importc: "flock", header: "<fcntl.h>", final, pure.} = object l_type*: cshort ## Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. l_whence*: cshort ## Flag for starting offset. l_start*: Toff ## Relative offset in bytes. @@ -84,12 +79,12 @@ type l_pid*: TPid ## Process ID of the process holding the lock; ## returned with F_GETLK. - Tfenv* {.importc: "fenv_t", header: "<fenv.h>", final.} = + Tfenv* {.importc: "fenv_t", header: "<fenv.h>", final, pure.} = object ## Represents the entire floating-point environment. The ## floating-point environment refers collectively to any ## floating-point status flags and control modes supported ## by the implementation. - Tfexcept* {.importc: "fexcept_t", header: "<fenv.h>", final.} = + Tfexcept* {.importc: "fexcept_t", header: "<fenv.h>", final, pure.} = object ## Represents the floating-point status flags collectively, ## including any status the implementation associates with the ## flags. A floating-point status flag is a system variable @@ -100,25 +95,25 @@ type ## whose value may be set by the user to affect the subsequent ## behavior of floating-point arithmetic. - TFTW* {.importc: "struct FTW", header: "<ftw.h>", final.} = object + TFTW* {.importc: "struct FTW", header: "<ftw.h>", final, pure.} = object base*: cint level*: cint - TGlob* {.importc: "glob_t", header: "<glob.h>", final.} = object + TGlob* {.importc: "glob_t", header: "<glob.h>", final, pure.} = object gl_pathc*: int ## Count of paths matched by pattern. gl_pathv*: ptr cstring ## Pointer to a list of matched pathnames. gl_offs*: int ## Slots to reserve at the beginning of gl_pathv. - TGroup* {.importc: "struct group", header: "<grp.h>", final.} = object + TGroup* {.importc: "struct group", header: "<grp.h>", final, pure.} = object gr_name*: cstring ## The name of the group. gr_gid*: TGid ## Numerical group ID. gr_mem*: cstringArray ## Pointer to a null-terminated array of character ## pointers to member names. - Ticonv* {.importc: "iconv_t", header: "<iconv.h>", final.} = + Ticonv* {.importc: "iconv_t", header: "<iconv.h>", final, pure.} = object ## Identifies the conversion from one codeset to another. - Tlconv* {.importc: "struct lconv", header: "<locale.h>", final.} = object + Tlconv* {.importc: "struct lconv", header: "<locale.h>", final, pure.} = object currency_symbol*: cstring decimal_point*: cstring frac_digits*: char @@ -144,14 +139,14 @@ type p_sign_posn*: char thousands_sep*: cstring - TMqd* {.importc: "mqd_t", header: "<mqueue.h>", final.} = object - TMqAttr* {.importc: "struct mq_attr", header: "<mqueue.h>", final.} = object + TMqd* {.importc: "mqd_t", header: "<mqueue.h>", final, pure.} = object + TMqAttr* {.importc: "struct mq_attr", header: "<mqueue.h>", final, pure.} = object mq_flags*: int ## Message queue flags. mq_maxmsg*: int ## Maximum number of messages. mq_msgsize*: int ## Maximum message size. mq_curmsgs*: int ## Number of messages currently queued. - TPasswd* {.importc: "struct passwd", header: "<pwd.h>", final.} = object + TPasswd* {.importc: "struct passwd", header: "<pwd.h>", final, pure.} = object pw_name*: cstring ## User's login name. pw_uid*: TUid ## Numerical user ID. pw_gid*: TGid ## Numerical group ID. @@ -198,7 +193,7 @@ type Tuid* {.importc: "uid_t", header: "<sys/types.h>".} = int Tuseconds* {.importc: "useconds_t", header: "<sys/types.h>".} = int - Tutsname* {.importc: "struct utsname", header: "<sys/utsname.h>", final.} = object + Tutsname* {.importc: "struct utsname", header: "<sys/utsname.h>", final, pure.} = object sysname*, ## Name of this implementation of the operating system. nodename*, ## Name of this node within the communications ## network to which this node is attached, if any. @@ -207,15 +202,15 @@ type machine*: array [0..255, char] ## Name of the hardware type on which the ## system is running. - TSem* {.importc: "sem_t", header: "<semaphore.h>", final.} = object - Tipc_perm* {.importc: "struct ipc_perm", header: "<sys/ipc.h>", final.} = object + TSem* {.importc: "sem_t", header: "<semaphore.h>", final, pure.} = object + Tipc_perm* {.importc: "struct ipc_perm", header: "<sys/ipc.h>", final, pure.} = object uid*: tuid ## Owner's user ID. gid*: tgid ## Owner's group ID. cuid*: Tuid ## Creator's user ID. cgid*: Tgid ## Creator's group ID. mode*: TMode ## Read/write permission. - TStat* {.importc: "struct stat", header: "<sys/stat.h>", final.} = object + TStat* {.importc: "struct stat", header: "<sys/stat.h>", final, pure.} = object st_dev*: TDev ## Device ID of device containing file. st_ino*: TIno ## File serial number. st_mode*: TMode ## Mode of file (see below). @@ -239,7 +234,7 @@ type st_blocks*: Tblkcnt ## Number of blocks allocated for this object. - TStatvfs* {.importc: "struct statvfs", header: "<sys/statvfs.h>", final.} = object + TStatvfs* {.importc: "struct statvfs", header: "<sys/statvfs.h>", final, pure.} = object f_bsize*: int ## File system block size. f_frsize*: int ## Fundamental file system block size. f_blocks*: Tfsblkcnt ## Total number of blocks on file system in units of f_frsize. @@ -255,10 +250,10 @@ type f_namemax*: int ## Maximum filename length. Tposix_typed_mem_info* {.importc: "struct posix_typed_mem_info", - header: "<sys/mman.h>", final.} = object + header: "<sys/mman.h>", final, pure.} = object posix_tmi_length*: int - Ttm* {.importc: "struct tm", header: "<time.h>", final.} = object + Ttm* {.importc: "struct tm", header: "<time.h>", final, pure.} = object tm_sec*: cint ## Seconds [0,60]. tm_min*: cint ## Minutes [0,59]. tm_hour*: cint ## Hour [0,23]. @@ -268,10 +263,10 @@ type tm_wday*: cint ## Day of week [0,6] (Sunday =0). tm_yday*: cint ## Day of year [0,365]. tm_isdst*: cint ## Daylight Savings flag. - Ttimespec* {.importc: "struct timespec", header: "<time.h>", final.} = object + Ttimespec* {.importc: "struct timespec", header: "<time.h>", final, pure.} = object tv_sec*: Ttime ## Seconds. tv_nsec*: int ## Nanoseconds. - titimerspec* {.importc: "struct itimerspec", header: "<time.h>", final.} = object + titimerspec* {.importc: "struct itimerspec", header: "<time.h>", final, pure.} = object it_interval*: ttimespec ## Timer period. it_value*: ttimespec ## Timer expiration. @@ -279,19 +274,19 @@ type ## Possibly volatile-qualified integer type of an object that can be ## accessed as an atomic entity, even in the presence of asynchronous ## interrupts. - Tsigset* {.importc: "sigset_t", header: "<signal.h>", final.} = object + Tsigset* {.importc: "sigset_t", header: "<signal.h>", final, pure.} = object - TsigEvent* {.importc: "struct sigevent", header: "<signal.h>", final.} = object + TsigEvent* {.importc: "struct sigevent", header: "<signal.h>", final, pure.} = object sigev_notify*: cint ## Notification type. sigev_signo*: cint ## Signal number. sigev_value*: Tsigval ## Signal value. sigev_notify_function*: proc (x: TSigval) {.noconv.} ## Notification function. sigev_notify_attributes*: ptr Tpthreadattr ## Notification attributes. - TsigVal* {.importc: "union sigval", header: "<signal.h>", final.} = object + TsigVal* {.importc: "union sigval", header: "<signal.h>", final, pure.} = object sival_ptr*: pointer ## pointer signal value; ## integer signal value not defined! - TSigaction* {.importc: "struct sigaction", header: "<signal.h>", final.} = object + TSigaction* {.importc: "struct sigaction", header: "<signal.h>", final, pure.} = object sa_handler*: proc (x: cint) {.noconv.} ## Pointer to a signal-catching ## function or one of the macros ## SIG_IGN or SIG_DFL. @@ -300,16 +295,16 @@ type sa_flags*: cint ## Special flags. sa_sigaction*: proc (x: cint, y: var TSigInfo, z: pointer) {.noconv.} - TStack* {.importc: "stack_t", header: "<signal.h>", final.} = object + TStack* {.importc: "stack_t", header: "<signal.h>", final, pure.} = object ss_sp*: pointer ## Stack base or pointer. ss_size*: int ## Stack size. ss_flags*: cint ## Flags. - TSigStack* {.importc: "struct sigstack", header: "<signal.h>", final.} = object + TSigStack* {.importc: "struct sigstack", header: "<signal.h>", final, pure.} = object ss_onstack*: cint ## Non-zero when signal stack is in use. ss_sp*: pointer ## Signal stack pointer. - TsigInfo* {.importc: "siginfo_t", header: "<signal.h>", final.} = object + TsigInfo* {.importc: "siginfo_t", header: "<signal.h>", final, pure.} = object si_signo*: cint ## Signal number. si_code*: cint ## Signal code. si_errno*: cint ## If non-zero, an errno value associated with @@ -324,7 +319,7 @@ type Tnl_item* {.importc: "nl_item", header: "<nl_types.h>".} = cint Tnl_catd* {.importc: "nl_catd", header: "<nl_types.h>".} = cint - Tsched_param* {.importc: "struct sched_param", header: "<sched.h>", final.} = object + Tsched_param* {.importc: "struct sched_param", header: "<sched.h>", final, pure.} = object sched_priority*: cint sched_ss_low_priority*: cint ## Low scheduling priority for ## sporadic server. @@ -334,15 +329,12 @@ type sched_ss_max_repl*: cint ## Maximum pending replenishments for ## sporadic server. - Ttimeval* {.importc: "struct timeval", header: "<sys/select.h>", final.} = object + Ttimeval* {.importc: "struct timeval", header: "<sys/select.h>", final, pure.} = object tv_sec*: ttime ## Seconds. tv_usec*: tsuseconds ## Microseconds. - Tfd_set* {.importc: "struct fd_set", header: "<sys/select.h>", final.} = object - - Tposix_spawnattr* {.importc: "posix_spawnattr_t", header: "<spawn.h>".} = cint - Tposix_spawn_file_actions* {.importc: "posix_spawn_file_actions_t", header: "<spawn.h>".} = cint - Tmcontext* {.importc: "mcontext_t", header: "<ucontext.h>", final.} = object - Tucontext* {.importc: "ucontext_t", header: "<ucontext.h>", final.} = object + Tfd_set* {.importc: "struct fd_set", header: "<sys/select.h>", final, pure.} = object + Tmcontext* {.importc: "mcontext_t", header: "<ucontext.h>", final, pure.} = object + Tucontext* {.importc: "ucontext_t", header: "<ucontext.h>", final, pure.} = object uc_link*: ptr Tucontext ## Pointer to the context that is resumed ## when this context returns. uc_sigmask*: Tsigset ## The set of signals that are blocked when this @@ -351,35 +343,52 @@ type uc_mcontext*: Tmcontext ## A machine-specific representation of the saved ## context. +when hasAioH: + type + Taiocb* {.importc: "struct aiocb", header: "<aio.h>", final, pure.} = object + aio_fildes*: cint ## File descriptor. + aio_offset*: TOff ## File offset. + aio_buf*: pointer ## Location of buffer. + aio_nbytes*: int ## Length of transfer. + aio_reqprio*: cint ## Request priority offset. + aio_sigevent*: TSigEvent ## Signal number and value. + aio_lio_opcode: cint ## Operation to be performed. + +when hasSpawnH: + type + Tposix_spawnattr* {.importc: "posix_spawnattr_t", header: "<spawn.h>".} = cint + Tposix_spawn_file_actions* {.importc: "posix_spawn_file_actions_t", header: "<spawn.h>".} = cint # Constants as variables: -var - AIO_ALLDONE* {.importc, header: "<aio.h>".}: cint - ## A return value indicating that none of the requested operations - ## could be canceled since they are already complete. - AIO_CANCELED* {.importc, header: "<aio.h>".}: cint - ## A return value indicating that all requested operations have - ## been canceled. - AIO_NOTCANCELED* {.importc, header: "<aio.h>".}: cint - ## A return value indicating that some of the requested operations could - ## not be canceled since they are in progress. - LIO_NOP* {.importc, header: "<aio.h>".}: cint - ## A lio_listio() element operation option indicating that no transfer is - ## requested. - LIO_NOWAIT* {.importc, header: "<aio.h>".}: cint - ## A lio_listio() synchronization operation indicating that the calling - ## thread is to continue execution while the lio_listio() operation is - ## being performed, and no notification is given when the operation is - ## complete. - LIO_READ* {.importc, header: "<aio.h>".}: cint - ## A lio_listio() element operation option requesting a read. - LIO_WAIT* {.importc, header: "<aio.h>".}: cint - ## A lio_listio() synchronization operation indicating that the calling - ## thread is to suspend until the lio_listio() operation is complete. - LIO_WRITE* {.importc, header: "<aio.h>".}: cint - ## A lio_listio() element operation option requesting a write. +when hasAioH: + var + AIO_ALLDONE* {.importc, header: "<aio.h>".}: cint + ## A return value indicating that none of the requested operations + ## could be canceled since they are already complete. + AIO_CANCELED* {.importc, header: "<aio.h>".}: cint + ## A return value indicating that all requested operations have + ## been canceled. + AIO_NOTCANCELED* {.importc, header: "<aio.h>".}: cint + ## A return value indicating that some of the requested operations could + ## not be canceled since they are in progress. + LIO_NOP* {.importc, header: "<aio.h>".}: cint + ## A lio_listio() element operation option indicating that no transfer is + ## requested. + LIO_NOWAIT* {.importc, header: "<aio.h>".}: cint + ## A lio_listio() synchronization operation indicating that the calling + ## thread is to continue execution while the lio_listio() operation is + ## being performed, and no notification is given when the operation is + ## complete. + LIO_READ* {.importc, header: "<aio.h>".}: cint + ## A lio_listio() element operation option requesting a read. + LIO_WAIT* {.importc, header: "<aio.h>".}: cint + ## A lio_listio() synchronization operation indicating that the calling + ## thread is to suspend until the lio_listio() operation is complete. + LIO_WRITE* {.importc, header: "<aio.h>".}: cint + ## A lio_listio() element operation option requesting a write. +var RTLD_LAZY* {.importc, header: "<dlfcn.h>".}: cint ## Relocations are performed at an implementation-defined time. RTLD_NOW* {.importc, header: "<dlfcn.h>".}: cint @@ -1246,23 +1255,30 @@ var SCHED_OTHER* {.importc, header: "<sched.h>".}: cint FD_SETSIZE* {.importc, header: "<sys/select.h>".}: cint - POSIX_SPAWN_RESETIDS* {.importc, header: "<spawn.h>".}: cint - POSIX_SPAWN_SETPGROUP* {.importc, header: "<spawn.h>".}: cint - POSIX_SPAWN_SETSCHEDPARAM* {.importc, header: "<spawn.h>".}: cint - POSIX_SPAWN_SETSCHEDULER* {.importc, header: "<spawn.h>".}: cint - POSIX_SPAWN_SETSIGDEF* {.importc, header: "<spawn.h>".}: cint - POSIX_SPAWN_SETSIGMASK* {.importc, header: "<spawn.h>".}: cint - -proc aio_cancel*(a1: cint, a2: ptr Taiocb): cint {.importc, header: "<aio.h>".} -proc aio_error*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".} -proc aio_fsync*(a1: cint, a2: ptr Taiocb): cint {.importc, header: "<aio.h>".} -proc aio_read*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".} -proc aio_return*(a1: ptr Taiocb): int {.importc, header: "<aio.h>".} -proc aio_suspend*(a1: ptr ptr Taiocb, a2: cint, a3: ptr ttimespec): cint {. - importc, header: "<aio.h>".} -proc aio_write*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".} -proc lio_listio*(a1: cint, a2: ptr ptr Taiocb, a3: cint, - a4: ptr Tsigevent): cint {.importc, header: "<aio.h>".} + SEEK_SET* {.importc, header: "<unistd.h>".}: cint + SEEK_CUR* {.importc, header: "<unistd.h>".}: cint + SEEK_END* {.importc, header: "<unistd.h>".}: cint + +when hasSpawnh: + var + POSIX_SPAWN_RESETIDS* {.importc, header: "<spawn.h>".}: cint + POSIX_SPAWN_SETPGROUP* {.importc, header: "<spawn.h>".}: cint + POSIX_SPAWN_SETSCHEDPARAM* {.importc, header: "<spawn.h>".}: cint + POSIX_SPAWN_SETSCHEDULER* {.importc, header: "<spawn.h>".}: cint + POSIX_SPAWN_SETSIGDEF* {.importc, header: "<spawn.h>".}: cint + POSIX_SPAWN_SETSIGMASK* {.importc, header: "<spawn.h>".}: cint + +when hasAioH: + proc aio_cancel*(a1: cint, a2: ptr Taiocb): cint {.importc, header: "<aio.h>".} + proc aio_error*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".} + proc aio_fsync*(a1: cint, a2: ptr Taiocb): cint {.importc, header: "<aio.h>".} + proc aio_read*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".} + proc aio_return*(a1: ptr Taiocb): int {.importc, header: "<aio.h>".} + proc aio_suspend*(a1: ptr ptr Taiocb, a2: cint, a3: ptr ttimespec): cint {. + importc, header: "<aio.h>".} + proc aio_write*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".} + proc lio_listio*(a1: cint, a2: ptr ptr Taiocb, a3: cint, + a4: ptr Tsigevent): cint {.importc, header: "<aio.h>".} # arpa/inet.h proc htonl*(a1: int32): int32 {.importc, header: "<arpa/inet.h>".} @@ -1371,8 +1387,8 @@ proc mq_unlink*(a1: cstring): cint {.importc, header: "<mqueue.h>".} proc getpwnam*(a1: cstring): ptr TPasswd {.importc, header: "<pwd.h>".} proc getpwuid*(a1: Tuid): ptr TPasswd {.importc, header: "<pwd.h>".} -proc getpwnam_r(a1: cstring, a2: ptr Tpasswd, a3: cstring, a4: int, - a5: ptr ptr Tpasswd): cint {.importc, header: "<pwd.h>".} +proc getpwnam_r*(a1: cstring, a2: ptr Tpasswd, a3: cstring, a4: int, + a5: ptr ptr Tpasswd): cint {.importc, header: "<pwd.h>".} proc getpwuid_r*(a1: Tuid, a2: ptr Tpasswd, a3: cstring, a4: int, a5: ptr ptr Tpasswd): cint {.importc, header: "<pwd.h>".} proc endpwent*() {.importc, header: "<pwd.h>".} @@ -1771,46 +1787,47 @@ proc pselect*(a1: cint, a2, a3, a4: var Tfd_set, a5: var ttimespec, proc select*(a1: cint, a2, a3, a4: var Tfd_set, a5: var ttimeval): cint {. importc, header: "<sys/select.h>".} -proc posix_spawn*(a1: var tpid, a2: cstring, - a3: var Tposix_spawn_file_actions, - a4: var Tposix_spawnattr, a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".} -proc posix_spawn_file_actions_addclose*(a1: var tposix_spawn_file_actions, - a2: cint): cint {.importc, header: "<spawn.h>".} -proc posix_spawn_file_actions_adddup2*(a1: var tposix_spawn_file_actions, - a2, a3: cint): cint {.importc, header: "<spawn.h>".} -proc posix_spawn_file_actions_addopen*(a1: var tposix_spawn_file_actions, - a2: cint, a3: cstring, a4: cint, a5: tmode): cint {.importc, header: "<spawn.h>".} -proc posix_spawn_file_actions_destroy*(a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".} -proc posix_spawn_file_actions_init*(a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".} -proc posix_spawnattr_destroy*(a1: var tposix_spawnattr): cint {.importc, header: "<spawn.h>".} -proc posix_spawnattr_getsigdefault*(a1: var tposix_spawnattr, - a2: var Tsigset): cint {.importc, header: "<spawn.h>".} -proc posix_spawnattr_getflags*(a1: var tposix_spawnattr, - a2: var cshort): cint {.importc, header: "<spawn.h>".} -proc posix_spawnattr_getpgroup*(a1: var tposix_spawnattr, - a2: var tpid): cint {.importc, header: "<spawn.h>".} -proc posix_spawnattr_getschedparam*(a1: var tposix_spawnattr, - a2: var tsched_param): cint {.importc, header: "<spawn.h>".} -proc posix_spawnattr_getschedpolicy*(a1: var tposix_spawnattr, - a2: var cint): cint {.importc, header: "<spawn.h>".} -proc posix_spawnattr_getsigmask*(a1: var tposix_spawnattr, - a2: var tsigset): cint {.importc, header: "<spawn.h>".} - -proc posix_spawnattr_init*(a1: var tposix_spawnattr): cint {.importc, header: "<spawn.h>".} -proc posix_spawnattr_setsigdefault*(a1: var tposix_spawnattr, - a2: var tsigset): cint {.importc, header: "<spawn.h>".} -proc posix_spawnattr_setflags*(a1: var tposix_spawnattr, a2: cshort): cint {.importc, header: "<spawn.h>".} -proc posix_spawnattr_setpgroup*(a1: var tposix_spawnattr, a2: tpid): cint {.importc, header: "<spawn.h>".} - -proc posix_spawnattr_setschedparam*(a1: var tposix_spawnattr, - a2: var tsched_param): cint {.importc, header: "<spawn.h>".} -proc posix_spawnattr_setschedpolicy*(a1: var tposix_spawnattr, a2: cint): cint {.importc, header: "<spawn.h>".} -proc posix_spawnattr_setsigmask*(a1: var tposix_spawnattr, - a2: var tsigset): cint {.importc, header: "<spawn.h>".} -proc posix_spawnp*(a1: var tpid, a2: cstring, - a3: var tposix_spawn_file_actions, - a4: var tposix_spawnattr, - a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".} +when hasSpawnH: + proc posix_spawn*(a1: var tpid, a2: cstring, + a3: var Tposix_spawn_file_actions, + a4: var Tposix_spawnattr, a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".} + proc posix_spawn_file_actions_addclose*(a1: var tposix_spawn_file_actions, + a2: cint): cint {.importc, header: "<spawn.h>".} + proc posix_spawn_file_actions_adddup2*(a1: var tposix_spawn_file_actions, + a2, a3: cint): cint {.importc, header: "<spawn.h>".} + proc posix_spawn_file_actions_addopen*(a1: var tposix_spawn_file_actions, + a2: cint, a3: cstring, a4: cint, a5: tmode): cint {.importc, header: "<spawn.h>".} + proc posix_spawn_file_actions_destroy*(a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".} + proc posix_spawn_file_actions_init*(a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_destroy*(a1: var tposix_spawnattr): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_getsigdefault*(a1: var tposix_spawnattr, + a2: var Tsigset): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_getflags*(a1: var tposix_spawnattr, + a2: var cshort): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_getpgroup*(a1: var tposix_spawnattr, + a2: var tpid): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_getschedparam*(a1: var tposix_spawnattr, + a2: var tsched_param): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_getschedpolicy*(a1: var tposix_spawnattr, + a2: var cint): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_getsigmask*(a1: var tposix_spawnattr, + a2: var tsigset): cint {.importc, header: "<spawn.h>".} + + proc posix_spawnattr_init*(a1: var tposix_spawnattr): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_setsigdefault*(a1: var tposix_spawnattr, + a2: var tsigset): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_setflags*(a1: var tposix_spawnattr, a2: cshort): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_setpgroup*(a1: var tposix_spawnattr, a2: tpid): cint {.importc, header: "<spawn.h>".} + + proc posix_spawnattr_setschedparam*(a1: var tposix_spawnattr, + a2: var tsched_param): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_setschedpolicy*(a1: var tposix_spawnattr, a2: cint): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_setsigmask*(a1: var tposix_spawnattr, + a2: var tsigset): cint {.importc, header: "<spawn.h>".} + proc posix_spawnp*(a1: var tpid, a2: cstring, + a3: var tposix_spawn_file_actions, + a4: var tposix_spawnattr, + a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".} proc getcontext*(a1: var Tucontext): cint {.importc, header: "<ucontext.h>".} proc makecontext*(a1: var Tucontext, a4: proc (){.noconv.}, a3: cint) {.varargs, importc, header: "<ucontext.h>".} diff --git a/lib/process.nim b/lib/process.nim deleted file mode 100644 index 8806264b9..000000000 --- a/lib/process.nim +++ /dev/null @@ -1,1009 +0,0 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2008 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - - -interface - -type - TProcess = opaque - -proc - open(out p: TProcess, command, workingDir: string, - -implementation - - -Uses Classes, - pipes, - SysUtils; - -Type - TProcessOption = (poRunSuspended,poWaitOnExit, - poUsePipes,poStderrToOutPut, - poNoConsole,poNewConsole, - poDefaultErrorMode,poNewProcessGroup, - poDebugProcess,poDebugOnlyThisProcess); - - TShowWindowOptions = (swoNone,swoHIDE,swoMaximize,swoMinimize,swoRestore,swoShow, - swoShowDefault,swoShowMaximized,swoShowMinimized, - swoshowMinNOActive,swoShowNA,swoShowNoActivate,swoShowNormal); - - TStartupOption = (suoUseShowWindow,suoUseSize,suoUsePosition, - suoUseCountChars,suoUseFillAttribute); - - TProcessPriority = (ppHigh,ppIdle,ppNormal,ppRealTime); - - TProcessOptions = Set of TPRocessOption; - TstartUpoptions = set of TStartupOption; - - -Type - TProcess = Class (TComponent) - Private - FProcessOptions : TProcessOptions; - FStartupOptions : TStartupOptions; - FProcessID : Integer; - FThreadID : Integer; - FProcessHandle : Thandle; - FThreadHandle : Thandle; - FFillAttribute : Cardinal; - FApplicationName : string; - FConsoleTitle : String; - FCommandLine : String; - FCurrentDirectory : String; - FDeskTop : String; - FEnvironment : Tstrings; - FExitCode : Cardinal; - FShowWindow : TShowWindowOptions; - FInherithandles : Boolean; - FInputSTream : TOutputPipeStream; - FOutputStream : TInPutPipeStream; - FStdErrStream : TInputPipeStream; - FRunning : Boolean; - FPRocessPriority : TProcessPriority; - dwXCountchars, - dwXSize, - dwYsize, - dwx, - dwYcountChars, - dwy : Cardinal; - Procedure FreeStreams; - Function GetExitStatus : Integer; - Function GetRunning : Boolean; - Function GetWindowRect : TRect; - Procedure SetWindowRect (Value : TRect); - Procedure SetShowWindow (Value : TShowWindowOptions); - Procedure SetWindowColumns (Value : Cardinal); - Procedure SetWindowHeight (Value : Cardinal); - Procedure SetWindowLeft (Value : Cardinal); - Procedure SetWindowRows (Value : Cardinal); - Procedure SetWindowTop (Value : Cardinal); - Procedure SetWindowWidth (Value : Cardinal); - Procedure CreateStreams(InHandle,OutHandle,Errhandle : Longint); - procedure SetApplicationname(const Value: String); - procedure SetProcessOptions(const Value: TProcessOptions); - procedure SetActive(const Value: Boolean); - procedure SetEnvironment(const Value: TStrings); - function PeekExitStatus: Boolean; - procedure CloseProcessHandles; - Public - Constructor Create (AOwner : TComponent);override; - Destructor Destroy; override; - Procedure Execute; virtual; - Function Resume : Integer; virtual; - Function Suspend : Integer; virtual; - Function Terminate (AExitCode : Integer): Boolean; virtual; - Function WaitOnExit : DWord; - Property WindowRect : Trect Read GetWindowRect Write SetWindowRect; - Property Handle : THandle Read FProcessHandle; - Property ProcessHandle : THandle Read FProcessHandle; - Property ThreadHandle : THandle Read FThreadHandle; - Property ProcessID : Integer Read FProcessID; - Property ThreadID : Integer Read FThreadID; - Property Input : TOutPutPipeStream Read FInPutStream; - Property OutPut : TInputPipeStream Read FOutPutStream; - Property StdErr : TinputPipeStream Read FStdErrStream; - Property ExitStatus : Integer Read GetExitStatus; - Property InheritHandles : Boolean Read FInheritHandles Write FInheritHandles; - Published - Property Active : Boolean Read Getrunning Write SetActive; - Property ApplicationName : String Read FApplicationname Write SetApplicationname; - Property CommandLine : String Read FCommandLine Write FCommandLine; - Property ConsoleTitle : String Read FConsoleTitle Write FConsoleTitle; - Property CurrentDirectory : String Read FCurrentDirectory Write FCurrentDirectory; - Property DeskTop : String Read FDeskTop Write FDeskTop; - Property Environment : TStrings Read FEnvironment Write SetEnvironment; - Property Options : TProcessOptions Read FProcessOptions Write SetPRocessOptions; - Property Priority : TProcessPriority Read FProcessPriority Write FProcessPriority; - Property StartUpOptions : TStartUpOptions Read FStartUpOptions Write FStartupOptions; - Property Running : Boolean Read GetRunning; - Property ShowWindow : TShowWindowOptions Read FShowWindow Write SetShowWindow; - Property WindowColumns : Cardinal Read dwXCountchars Write SetWindowColumns; - Property WindowHeight : Cardinal Read dwYsize Write SetWindowHeight; - Property WindowLeft : Cardinal Read dwx Write SetWindowLeft; - Property WindowRows : Cardinal Read dwYcountChars Write SetWindowRows; - Property WindowTop : Cardinal Read dwy Write SetWindowTop ; - Property WindowWidth : Cardinal Read dwXsize Write SetWindowWidth; - Property FillAttribute : Cardinal read FFillAttribute Write FFillAttribute; - end; - -implementation - -{ - Win32 Process .inc. -} - -uses Windows; - -Const - PriorityConstants : Array [TProcessPriority] of Cardinal = - (HIGH_PRIORITY_CLASS,IDLE_PRIORITY_CLASS, - NORMAL_PRIORITY_CLASS,REALTIME_PRIORITY_CLASS); - -procedure TProcess.CloseProcessHandles; -begin - if (FProcessHandle<>0) then - CloseHandle(FProcessHandle); - if (FThreadHandle<>0) then - CloseHandle(FThreadHandle); -end; - -Function TProcess.PeekExitStatus : Boolean; - -begin - GetExitCodeProcess(ProcessHandle,FExitCode); - Result:=(FExitCode<>Still_Active); -end; - -Function GetStartupFlags (P : TProcess): Cardinal; - -begin - With P do - begin - Result:=0; - if poUsePipes in FProcessOptions then - Result:=Result or Startf_UseStdHandles; - if suoUseShowWindow in FStartupOptions then - Result:=Result or startf_USESHOWWINDOW; - if suoUSESIZE in FStartupOptions then - Result:=Result or startf_usesize; - if suoUsePosition in FStartupOptions then - Result:=Result or startf_USEPOSITION; - if suoUSECOUNTCHARS in FStartupoptions then - Result:=Result or startf_usecountchars; - if suoUsefIllAttribute in FStartupOptions then - Result:=Result or startf_USEFILLATTRIBUTE; - end; -end; - -Function GetCreationFlags(P : TProcess) : Cardinal; - -begin - With P do - begin - Result:=0; - if poNoConsole in FProcessOptions then - Result:=Result or Detached_Process; - if poNewConsole in FProcessOptions then - Result:=Result or Create_new_console; - if poNewProcessGroup in FProcessOptions then - Result:=Result or CREATE_NEW_PROCESS_GROUP; - If poRunSuspended in FProcessOptions Then - Result:=Result or Create_Suspended; - if poDebugProcess in FProcessOptions Then - Result:=Result or DEBUG_PROCESS; - if poDebugOnlyThisProcess in FProcessOptions Then - Result:=Result or DEBUG_ONLY_THIS_PROCESS; - if poDefaultErrorMode in FProcessOptions Then - Result:=Result or CREATE_DEFAULT_ERROR_MODE; - result:=result or PriorityConstants[FProcessPriority]; - end; -end; - -Function StringsToPChars(List : TStrings): pointer; - -var - EnvBlock: string; - I: Integer; - -begin - EnvBlock := ''; - For I:=0 to List.Count-1 do - EnvBlock := EnvBlock + List[i] + #0; - EnvBlock := EnvBlock + #0; - GetMem(Result, Length(EnvBlock)); - CopyMemory(Result, @EnvBlock[1], Length(EnvBlock)); -end; - -Procedure InitProcessAttributes(P : TProcess; Var PA : TSecurityAttributes); - -begin - FillChar(PA,SizeOf(PA),0); - PA.nLength := SizeOf(PA); -end; - -Procedure InitThreadAttributes(P : TProcess; Var TA : TSecurityAttributes); - -begin - FillChar(TA,SizeOf(TA),0); - TA.nLength := SizeOf(TA); -end; - -Procedure InitStartupInfo(P : TProcess; Var SI : STARTUPINFO); - -Const - SWC : Array [TShowWindowOptions] of Cardinal = - (0,SW_HIDE,SW_Maximize,SW_Minimize,SW_Restore,SW_Show, - SW_ShowDefault,SW_ShowMaximized,SW_ShowMinimized, - SW_showMinNOActive,SW_ShowNA,SW_ShowNoActivate,SW_ShowNormal); - -begin - FillChar(SI,SizeOf(SI),0); - With SI do - begin - dwFlags:=GetStartupFlags(P); - if P.FShowWindow<>swoNone then - dwFlags:=dwFlags or Startf_UseShowWindow - else - dwFlags:=dwFlags and not Startf_UseShowWindow; - wShowWindow:=SWC[P.FShowWindow]; - if (poUsePipes in P.Options) then - begin - dwFlags:=dwFlags or Startf_UseStdHandles; - end; - if P.FillAttribute<>0 then - begin - dwFlags:=dwFlags or Startf_UseFillAttribute; - dwFillAttribute:=P.FillAttribute; - end; - dwXCountChars:=P.WindowColumns; - dwYCountChars:=P.WindowRows; - dwYsize:=P.WindowHeight; - dwXsize:=P.WindowWidth; - dwy:=P.WindowTop; - dwX:=P.WindowLeft; - end; -end; - -Procedure CreatePipes(Var HI,HO,HE : Thandle; Var SI : TStartupInfo; CE : Boolean); - - Procedure DoCreatePipeHandles(Var H1,H2 : THandle); - - Var - I,O : Longint; - - begin - CreatePipeHandles(I,O); - H1:=Thandle(I); - H2:=THandle(O); - end; - - - - -begin - DoCreatePipeHandles(SI.hStdInput,HI); - DoCreatePipeHandles(HO,Si.hStdOutput); - if CE then - DoCreatePipeHandles(HE,SI.hStdError) - else - begin - SI.hStdError:=SI.hStdOutput; - HE:=HO; - end; -end; - - -Procedure TProcess.Execute; - - -Var - PName,PDir,PCommandLine : PChar; - FEnv: pointer; - FCreationFlags : Cardinal; - FProcessAttributes : TSecurityAttributes; - FThreadAttributes : TSecurityAttributes; - FProcessInformation : TProcessInformation; - FStartupInfo : STARTUPINFO; - HI,HO,HE : THandle; - -begin - FInheritHandles:=True; - PName:=Nil; - PCommandLine:=Nil; - PDir:=Nil; - If FApplicationName<>'' then - PName:=Pchar(FApplicationName); - If FCommandLine<>'' then - PCommandLine:=Pchar(FCommandLine); - If FCurrentDirectory<>'' then - PDir:=Pchar(FCurrentDirectory); - if FEnvironment.Count<>0 then - FEnv:=StringsToPChars(FEnvironment) - else - FEnv:=Nil; - Try - FCreationFlags:=GetCreationFlags(Self); - InitProcessAttributes(Self,FProcessAttributes); - InitThreadAttributes(Self,FThreadAttributes); - InitStartupInfo(Self,FStartUpInfo); - If poUsePipes in FProcessOptions then - CreatePipes(HI,HO,HE,FStartupInfo,Not(poStdErrToOutPut in FProcessOptions)); - Try - If Not CreateProcess (PName,PCommandLine,@FProcessAttributes,@FThreadAttributes, - FInheritHandles,FCreationFlags,FEnv,PDir,FStartupInfo, - fProcessInformation) then - Raise Exception.CreateFmt('Failed to execute %s : %d',[FCommandLine,GetLastError]); - FProcessHandle:=FProcessInformation.hProcess; - FThreadHandle:=FProcessInformation.hThread; - FProcessID:=FProcessINformation.dwProcessID; - Finally - if POUsePipes in FProcessOptions then - begin - FileClose(FStartupInfo.hStdInput); - FileClose(FStartupInfo.hStdOutput); - if Not (poStdErrToOutPut in FProcessOptions) then - FileClose(FStartupInfo.hStdError); - CreateStreams(HI,HO,HE); - end; - end; - FRunning:=True; - Finally - If FEnv<>Nil then - FreeMem(FEnv); - end; - if not (csDesigning in ComponentState) and // This would hang the IDE ! - (poWaitOnExit in FProcessOptions) and - not (poRunSuspended in FProcessOptions) then - WaitOnExit; -end; - -Function TProcess.WaitOnExit : Dword; - -begin - Result:=WaitForSingleObject (FProcessHandle,Infinite); - If Result<>Wait_Failed then - GetExitStatus; - FRunning:=False; -end; - -Function TProcess.Suspend : Longint; - -begin - Result:=SuspendThread(ThreadHandle); -end; - -Function TProcess.Resume : LongInt; - -begin - Result:=ResumeThread(ThreadHandle); -end; - -Function TProcess.Terminate(AExitCode : Integer) : Boolean; - -begin - Result:=False; - If ExitStatus=Still_active then - Result:=TerminateProcess(Handle,AexitCode); -end; - -Procedure TProcess.SetShowWindow (Value : TShowWindowOptions); - - -begin - FShowWindow:=Value; -end; - -// ---------------------------- end of platform dependant code -------------- - -{ - Unix Process .inc. -} - -uses - Unix, - Baseunix; - - - -Const - PriorityConstants : Array [TProcessPriority] of Integer = - (20,20,0,-20); - -Const - GeometryOption : String = '-geometry'; - TitleOption : String ='-title'; - - - -procedure TProcess.CloseProcessHandles; - -begin - // Do nothing. Win32 call. -end; - -Function TProcess.PeekExitStatus : Boolean; - -begin - Result:=fpWaitPid(Handle,@FExitCode,WNOHANG)=Handle; - If Result then - FExitCode:=wexitstatus(FExitCode) - else - FexitCode:=0; -end; - -Type - TPCharArray = Array[Word] of pchar; - PPCharArray = ^TPcharArray; - -Function StringsToPCharList(List : TStrings) : PPChar; - -Var - I : Integer; - S : String; - -begin - I:=(List.Count)+1; - GetMem(Result,I*sizeOf(PChar)); - PPCharArray(Result)^[List.Count]:=Nil; - For I:=0 to List.Count-1 do - begin - S:=List[i]; - Result[i]:=StrNew(PChar(S)); - end; -end; - -Procedure FreePCharList(List : PPChar); - -Var - I : integer; - -begin - I:=0; - While List[i]<>Nil do - begin - StrDispose(List[i]); - Inc(I); - end; - FreeMem(List); -end; - - -Procedure CommandToList(S : String; List : TStrings); - - Function GetNextWord : String; - - Const - WhiteSpace = [' ',#8,#10]; - Literals = ['"','''']; - - Var - Wstart,wend : Integer; - InLiteral : Boolean; - LastLiteral : char; - - begin - WStart:=1; - While (WStart<=Length(S)) and (S[WStart] in WhiteSpace) do - Inc(WStart); - WEnd:=WStart; - InLiteral:=False; - LastLiteral:=#0; - While (Wend<=Length(S)) and (Not (S[Wend] in WhiteSpace) or InLiteral) do - begin - if S[Wend] in Literals then - If InLiteral then - InLiteral:=Not (S[Wend]=LastLiteral) - else - begin - InLiteral:=True; - LastLiteral:=S[Wend]; - end; - inc(wend); - end; - Result:=Copy(S,WStart,WEnd-WStart); - Result:=StringReplace(Result,'"','',[rfReplaceAll]); - Result:=StringReplace(Result,'''','',[rfReplaceAll]); - While (WEnd<=Length(S)) and (S[Wend] in WhiteSpace) do - inc(Wend); - Delete(S,1,WEnd-1); - - end; - -Var - W : String; - -begin - While Length(S)>0 do - begin - W:=GetNextWord; - If (W<>'') then - List.Add(W); - end; -end; - - -Function MakeCommand(P : TProcess) : PPchar; - -Const - SNoCommandLine = 'Cannot execute empty command-line'; - -Var - Cmd : String; - S : TStringList; - G : String; - -begin - if (P.ApplicationName='') then - begin - If (P.CommandLine='') then - Raise Exception.Create(SNoCommandline); - Cmd:=P.CommandLine; - end - else - begin - If (P.CommandLine='') then - Cmd:=P.ApplicationName - else - Cmd:=P.CommandLine; - end; - S:=TStringList.Create; - try - CommandToList(Cmd,S); - if poNewConsole in P.Options then - begin - S.Insert(0,'-e'); - If (P.ApplicationName<>'') then - begin - S.Insert(0,P.ApplicationName); - S.Insert(0,'-title'); - end; - if suoUseCountChars in P.StartupOptions then - begin - S.Insert(0,Format('%dx%d',[P.dwXCountChars,P.dwYCountChars])); - S.Insert(0,'-geometry'); - end; - S.Insert(0,'xterm'); - end; - if (P.ApplicationName<>'') then - begin - S.Add(TitleOption); - S.Add(P.ApplicationName); - end; - G:=''; - if (suoUseSize in P.StartupOptions) then - g:=format('%dx%d',[P.dwXSize,P.dwYsize]); - if (suoUsePosition in P.StartupOptions) then - g:=g+Format('+%d+%d',[P.dwX,P.dwY]); - if G<>'' then - begin - S.Add(GeometryOption); - S.Add(g); - end; - Result:=StringsToPcharList(S); - Finally - S.free; - end; -end; - -Function GetLastError : Integer; - -begin - Result:=-1; -end; - -Type - TPipeEnd = (peRead,peWrite); - TPipePair = Array[TPipeEnd] of Integer; - -Procedure CreatePipes(Var HI,HO,HE : TPipePair; CE : Boolean); - - Procedure CreatePair(Var P : TPipePair); - - begin - If not CreatePipeHandles(P[peRead],P[peWrite]) then - Raise Exception.Create('Failed to create pipes'); - end; - - Procedure ClosePair(Var P : TPipePair); - - begin - if (P[peRead]<>-1) then - FileClose(P[peRead]); - if (P[peWrite]<>-1) then - FileClose(P[peWrite]); - end; - -begin - HO[peRead]:=-1;HO[peWrite]:=-1; - HI[peRead]:=-1;HI[peWrite]:=-1; - HE[peRead]:=-1;HE[peWrite]:=-1; - Try - CreatePair(HO); - CreatePair(HI); - If CE then - CreatePair(HE); - except - ClosePair(HO); - ClosePair(HI); - If CE then - ClosePair(HE); - Raise; - end; -end; - -Procedure TProcess.Execute; - -Var - HI,HO,HE : TPipePair; - PID : Longint; - FEnv : PPChar; - Argv : PPChar; - fd : Integer; - PName : String; - -begin - If (poUsePipes in FProcessOptions) then - CreatePipes(HI,HO,HE,Not (poStdErrToOutPut in FProcessOptions)); - Try - if FEnvironment.Count<>0 then - FEnv:=StringsToPcharList(FEnvironment) - else - FEnv:=Nil; - Try - Argv:=MakeCommand(Self); - Try - If (Argv<>Nil) and (ArgV[0]<>Nil) then - PName:=StrPas(Argv[0]) - else - begin - // This should never happen, actually. - PName:=ApplicationName; - If (PName='') then - PName:=CommandLine; - end; - if (pos('/',PName)<>1) then - PName:=FileSearch(Pname,fpgetenv('PATH')); - Pid:=fpfork; - if Pid<0 then - Raise Exception.Create('Failed to Fork process'); - if (PID>0) then - begin - // Parent process. Copy process information. - FProcessHandle:=PID; - FThreadHandle:=PID; - FProcessId:=PID; - //FThreadId:=PID; - end - else - begin - { We're in the child } - if (FCurrentDirectory<>'') then - ChDir(FCurrentDirectory); - if PoUsePipes in Options then - begin - fpdup2(HI[peRead],0); - fpdup2(HO[peWrite],1); - if (poStdErrToOutPut in Options) then - fpdup2(HO[peWrite],2) - else - fpdup2(HE[peWrite],2); - end - else if poNoConsole in Options then - begin - fd:=FileOpen('/dev/null',fmOpenReadWrite); - fpdup2(fd,0); - fpdup2(fd,1); - fpdup2(fd,2); - end; - if (poRunSuspended in Options) then - sigraise(SIGSTOP); - if FEnv<>Nil then - fpexecve(PName,Argv,Fenv) - else - fpexecv(PName,argv); - Halt(127); - end - Finally - FreePcharList(Argv); - end; - Finally - If (FEnv<>Nil) then - FreePCharList(FEnv); - end; - Finally - if POUsePipes in FProcessOptions then - begin - FileClose(HO[peWrite]); - FileClose(HI[peRead]); - if Not (poStdErrToOutPut in FProcessOptions) then - FileClose(HE[peWrite]); - CreateStreams(HI[peWrite],HO[peRead],HE[peRead]); - end; - end; - FRunning:=True; - if not (csDesigning in ComponentState) and // This would hang the IDE ! - (poWaitOnExit in FProcessOptions) and - not (poRunSuspended in FProcessOptions) then - WaitOnExit; -end; - -Function TProcess.WaitOnExit : Dword; - -begin - Result:=fpWaitPid(Handle,@FExitCode,0); - If Result=Handle then - FExitCode:=WexitStatus(FExitCode); - FRunning:=False; -end; - -Function TProcess.Suspend : Longint; - -begin - If fpkill(Handle,SIGSTOP)<>0 then - Result:=-1 - else - Result:=1; -end; - -Function TProcess.Resume : LongInt; - -begin - If fpKill(Handle,SIGCONT)<>0 then - Result:=-1 - else - Result:=0; -end; - -Function TProcess.Terminate(AExitCode : Integer) : Boolean; - -begin - Result:=False; - Result:=fpkill(Handle,SIGTERM)=0; - If Result then - begin - If Running then - Result:=fpkill(Handle,SIGKILL)=0; - end; - GetExitStatus; -end; - -Procedure TProcess.SetShowWindow (Value : TShowWindowOptions); - -begin - FShowWindow:=Value; -end; - -// --------------------------------------------------------------------------- - - -Constructor TProcess.Create (AOwner : TComponent); -begin - Inherited; - FProcessPriority:=ppNormal; - FShowWindow:=swoNone; - FInheritHandles:=True; - FEnvironment:=TStringList.Create; -end; - -Destructor TProcess.Destroy; - -begin - FEnvironment.Free; - FreeStreams; - CloseProcessHandles; - Inherited Destroy; -end; - -Procedure TProcess.FreeStreams; - - procedure FreeStream(var S: THandleStream); - - begin - if (S<>Nil) then - begin - FileClose(S.Handle); - FreeAndNil(S); - end; - end; - -begin - If FStdErrStream<>FOutputStream then - FreeStream(FStdErrStream); - FreeStream(FOutputStream); - FreeStream(FInputStream); -end; - - -Function TProcess.GetExitStatus : Integer; - -begin - If FRunning then - PeekExitStatus; - Result:=FExitCode; -end; - - -Function TProcess.GetRunning : Boolean; - -begin - IF FRunning then - FRunning:=Not PeekExitStatus; - Result:=FRunning; -end; - - -Procedure TProcess.CreateStreams(InHandle,OutHandle,Errhandle : Longint); - -begin - FreeStreams; - FInputStream:=TOutputPipeStream.Create (InHandle); - FOutputStream:=TInputPipeStream.Create (OutHandle); - if Not (poStdErrToOutPut in FProcessOptions) then - FStdErrStream:=TInputPipeStream.Create(ErrHandle); -end; - - -Procedure TProcess.SetWindowColumns (Value : Cardinal); - -begin - if Value<>0 then - Include(FStartUpOptions,suoUseCountChars); - dwXCountChars:=Value; -end; - - -Procedure TProcess.SetWindowHeight (Value : Cardinal); - -begin - if Value<>0 then - include(FStartUpOptions,suoUsePosition); - dwYSize:=Value; -end; - -Procedure TProcess.SetWindowLeft (Value : Cardinal); - -begin - if Value<>0 then - Include(FStartUpOptions,suoUseSize); - dwx:=Value; -end; - -Procedure TProcess.SetWindowTop (Value : Cardinal); - -begin - if Value<>0 then - Include(FStartUpOptions,suoUsePosition); - dwy:=Value; -end; - -Procedure TProcess.SetWindowWidth (Value : Cardinal); -begin - If (Value<>0) then - Include(FStartUpOptions,suoUseSize); - dwXSize:=Value; -end; - -Function TProcess.GetWindowRect : TRect; -begin - With Result do - begin - Left:=dwx; - Right:=dwx+dwxSize; - Top:=dwy; - Bottom:=dwy+dwysize; - end; -end; - -Procedure TProcess.SetWindowRect (Value : Trect); -begin - Include(FStartupOptions,suouseSize); - Include(FStartupOptions,suoUsePosition); - With Value do - begin - dwx:=Left; - dwxSize:=Right-Left; - dwy:=Top; - dwySize:=Bottom-top; - end; -end; - - -Procedure TProcess.SetWindowRows (Value : Cardinal); - -begin - if Value<>0 then - Include(FStartUpOptions,suoUseCountChars); - dwYCountChars:=Value; -end; - -procedure TProcess.SetApplicationname(const Value: String); -begin - FApplicationname := Value; - If (csdesigning in ComponentState) and - (FCommandLine='') then - FCommandLine:=Value; -end; - -procedure TProcess.SetProcessOptions(const Value: TProcessOptions); -begin - FProcessOptions := Value; - If poNewConsole in FPRocessOptions then - Exclude(FProcessoptions,poNoConsole); - if poRunSuspended in FProcessOptions then - Exclude(FPRocessoptions,poWaitOnExit); -end; - -procedure TProcess.SetActive(const Value: Boolean); -begin - if (Value<>GetRunning) then - If Value then - Execute - else - Terminate(0); -end; - -procedure TProcess.SetEnvironment(const Value: TStrings); -begin - FEnvironment.Assign(Value); -end; - -function CallProcess(const command: string): string; -const - READ_BYTES = 2048; -// executes the command and returns the program's output -var - M: TMemoryStream; - P: TProcess; - n: LongInt; - BytesRead: LongInt; -begin - // We cannot use poWaitOnExit here since we don't - // know the size of the output. On Linux the size of the - // output pipe is 2 kB. If the output data is more, we - // need to read the data. This isn't possible since we are - // waiting. So we get a deadlock here. - // - // A temp Memorystream is used to buffer the output - - M := TMemoryStream.Create; - BytesRead := 0; - - P := TProcess.Create(nil); - P.CommandLine := Command; - P.Options := [poUsePipes]; - P.Execute; - while P.Running do begin - // make sure we have room - M.SetSize(BytesRead + READ_BYTES); - - // try reading it - n := P.Output.Read((M.Memory + BytesRead)^, READ_BYTES); - if n > 0 then - Inc(BytesRead, n) - else - // no data, wait 100 ms - Sleep(100) - end; - // read last part - repeat - // make sure we have room - M.SetSize(BytesRead + READ_BYTES); - // try reading it - n := P.Output.Read((M.Memory + BytesRead)^, READ_BYTES); - if n > 0 then Inc(BytesRead, n) - until n <= 0; - M.SetSize(BytesRead); - - setLength(result, bytesRead); - m.read(result[1], bytesRead); - P.Free; M.Free; -end; - -end. diff --git a/lib/repr.nim b/lib/repr.nim index 34a2ce2fb..2f29d839d 100644 --- a/lib/repr.nim +++ b/lib/repr.nim @@ -85,7 +85,7 @@ proc reprSetAux(result: var string, p: pointer, typ: PNimType) = else: var a = cast[pbyteArray](p) for i in 0 .. typ.size*8-1: - if (a[i div 8] and (1 shl (i mod 8))) != 0: + if (ze(a[i div 8]) and (1 shl (i mod 8))) != 0: if elemCounter > 0: add result, ", " addSetElem(result, i+typ.node.len, typ.base) inc(elemCounter) diff --git a/lib/sets.nim b/lib/sets.nim index 3aeae235c..395a2286c 100644 --- a/lib/sets.nim +++ b/lib/sets.nim @@ -24,36 +24,36 @@ include cntbits proc unionSets(res: var TNimSet, a, b: TNimSet, len: int) {. compilerproc, inline.} = - for i in countup(0, len-1): res[i] = toU8(ze(a[i]) or ze(b[i])) + for i in countup(0, len-1): res[i] = a[i] or b[i] proc diffSets(res: var TNimSet, a, b: TNimSet, len: int) {. compilerproc, inline.} = - for i in countup(0, len-1): res[i] = toU8(ze(a[i]) and not ze(b[i])) + for i in countup(0, len-1): res[i] = a[i] and not b[i] proc intersectSets(res: var TNimSet, a, b: TNimSet, len: int) {. compilerproc, inline.} = - for i in countup(0, len-1): res[i] = toU8(ze(a[i]) and ze(b[i])) + for i in countup(0, len-1): res[i] = a[i] and b[i] proc symdiffSets(res: var TNimSet, a, b: TNimSet, len: int) {. compilerproc, inline.} = - for i in countup(0, len-1): res[i] = toU8(ze(a[i]) xor ze(b[i])) + for i in countup(0, len-1): res[i] = a[i] xor b[i] proc containsSets(a, b: TNimSet, len: int): bool {.compilerproc, inline.} = # s1 <= s2 ? for i in countup(0, len-1): - if (ze(a[i]) and not ze(b[i])) != 0: return false + if (a[i] and not b[i]) != 0'i8: return false return true proc containsSubsets(a, b: TNimSet, len: int): bool {.compilerproc, inline.} = # s1 < s2 ? result = false # assume they are equal for i in countup(0, len-1): - if (ze(a[i]) and not ze(b[i])) != 0: return false - if ze(a[i]) != ze(b[i]): result = true # they are not equal + if (a[i]) and not b[i]) != 0'i32: return false + if a[i] != b[i]: result = true # they are not equal proc equalSets(a, b: TNimSet, len: int): bool {.compilerproc, inline.} = for i in countup(0, len-1): - if ze(a[i]) != ze(b[i]): return false + if a[i] != b[i]: return false return true proc cardSet(s: TNimSet, len: int): int {.compilerproc, inline.} = @@ -68,7 +68,7 @@ proc inSet(s: TNimSet, elem: int): bool {.compilerproc, inline.} = return (s[elem /% WORD_SIZE] and (1 shl (elem %% WORD_SIZE))) != 0 proc inclSets(s: var TNimSet, e: int) {.compilerproc, inline.} = - s[e /% WORD_SIZE] = toU8(s[e /% WORD_SIZE] or (1 shl (e %% WORD_SIZE))) + s[e /% WORD_SIZE] = s[e /% WORD_SIZE] or toU8(1 shl (e %% WORD_SIZE)) proc inclRange(s: var TNimSet, first, last: int) {.compilerproc.} = # not very fast, but it is seldom used @@ -80,8 +80,8 @@ proc smallInclRange(s: var int, first, last: int) {.compilerproc.} = s = s or (1 shl (i %% sizeof(int)*8)) proc exclSets(s: var TNimSet, e: int) {.compilerproc, inline.} = - s[e /% WORD_SIZE] = toU8(s[e /% WORD_SIZE] and - not (1 shl (e %% WORD_SIZE))) + s[e /% WORD_SIZE] = s[e /% WORD_SIZE] and + not toU8(1 shl (e %% WORD_SIZE)) proc smallContainsSubsets(a, b: int): bool {.compilerProc, inline.} = # not used by new code generator diff --git a/lib/smallalc.nim b/lib/smallalc.nim deleted file mode 100644 index b5a99db35..000000000 --- a/lib/smallalc.nim +++ /dev/null @@ -1,19 +0,0 @@ -# Handle small allocations efficiently -# We allocate and manage memory by pages. All objects within a page belong to -# the same type. Thus, we safe the type field. Minimum requested block is -# 8 bytes. Alignment is 8 bytes. - - -type - TChunk {.pure.} = object - kind: TChunkKind - prev, next: ptr TChunk - - TSmallChunk = object of TChunk # all objects of the same size - typ: PNimType - free: int - data: array [0.., int] - -proc allocSmall(typ: PNimType): pointer = - - \ No newline at end of file diff --git a/lib/strtabs.nim b/lib/strtabs.nim index dd57fdd17..e6abaee6f 100644 --- a/lib/strtabs.nim +++ b/lib/strtabs.nim @@ -11,11 +11,11 @@ ## from strings to strings. Supports a case-sensitive, case-insensitive and ## style-insensitive mode. An efficient string substitution operator ``%`` ## for the string table is also provided. - -import + +import os, hashes, strutils -type +type TStringTableMode* = enum # describes the tables operation mode modeCaseSensitive, # the table is case sensitive modeCaseInsensitive, # the table is case insensitive @@ -29,16 +29,16 @@ type PStringTable* = ref TStringTable ## use this type to declare string tables -proc newStringTable*(keyValuePairs: openarray[string], +proc newStringTable*(keyValuePairs: openarray[string], mode: TStringTableMode = modeCaseSensitive): PStringTable ## creates a new string table with given key value pairs. ## Example:: - ## var mytab = newStringTable("key1", "val1", "key2", "val2", + ## var mytab = newStringTable("key1", "val1", "key2", "val2", ## modeCaseInsensitive) proc newStringTable*(mode: TStringTableMode = modeCaseSensitive): PStringTable ## creates a new string table that is empty. - + proc `[]=`*(t: PStringTable, key, val: string) ## puts a (key, value)-pair into `t`. @@ -54,13 +54,13 @@ proc len*(t: PStringTable): int = ## returns the number of keys in `t`. result = t.counter -iterator pairs*(t: PStringTable): tuple[key, value: string] = +iterator pairs*(t: PStringTable): tuple[key, value: string] = ## iterates over any (key, value) pair in the table `t`. for h in 0..high(t.data): if not isNil(t.data[h].key): yield (t.data[h].key, t.data[h].val) -type +type TFormatFlag* = enum # flags for the `%` operator useEnvironment, # use environment variable if the ``$key`` # is not found in the table @@ -75,136 +75,131 @@ proc `%`*(f: string, t: PStringTable, flags: set[TFormatFlag] = {}): string # implementation -const +const growthFactor = 2 startSize = 64 -proc newStringTable(mode: TStringTableMode = modeCaseSensitive): PStringTable = +proc newStringTable(mode: TStringTableMode = modeCaseSensitive): PStringTable = new(result) result.mode = mode result.counter = 0 - result.data = [] - setlen(result.data, startSize) # XXX + newSeq(result.data, startSize) -proc newStringTable(keyValuePairs: openarray[string], - mode: TStringTableMode = modeCaseSensitive): PStringTable = +proc newStringTable(keyValuePairs: openarray[string], + mode: TStringTableMode = modeCaseSensitive): PStringTable = result = newStringTable(mode) var i = 0 - while i < high(keyValuePairs): + while i < high(keyValuePairs): result[keyValuePairs[i]] = keyValuePairs[i + 1] inc(i, 2) -proc myhash(t: PStringTable, key: string): THash = +proc myhash(t: PStringTable, key: string): THash = case t.mode of modeCaseSensitive: result = hashes.hash(key) of modeCaseInsensitive: result = hashes.hashIgnoreCase(key) of modeStyleInsensitive: result = hashes.hashIgnoreStyle(key) - -proc myCmp(t: PStringTable, a, b: string): bool = + +proc myCmp(t: PStringTable, a, b: string): bool = case t.mode of modeCaseSensitive: result = cmp(a, b) == 0 of modeCaseInsensitive: result = cmpIgnoreCase(a, b) == 0 of modeStyleInsensitive: result = cmpIgnoreStyle(a, b) == 0 - -proc mustRehash(length, counter: int): bool = + +proc mustRehash(length, counter: int): bool = assert(length > counter) result = (length * 2 < counter * 3) or (length - counter < 4) -const - EmptySeq = [] - -proc nextTry(h, maxHash: THash): THash = +proc nextTry(h, maxHash: THash): THash = result = ((5 * h) + 1) and maxHash # For any initial h in range(maxHash), repeating that maxHash times # generates each int in range(maxHash) exactly once (see any text on # random-number generation for proof). - -proc RawGet(t: PStringTable, key: string): int = + +proc RawGet(t: PStringTable, key: string): int = var h: THash h = myhash(t, key) and high(t.data) # start with real hash value - while not isNil(t.data[h].key): - if mycmp(t, t.data[h].key, key): + while not isNil(t.data[h].key): + if mycmp(t, t.data[h].key, key): return h h = nextTry(h, high(t.data)) result = - 1 -proc `[]`(t: PStringTable, key: string): string = +proc `[]`(t: PStringTable, key: string): string = var index: int index = RawGet(t, key) if index >= 0: result = t.data[index].val else: result = "" - -proc hasKey(t: PStringTable, key: string): bool = + +proc hasKey(t: PStringTable, key: string): bool = result = rawGet(t, key) >= 0 -proc RawInsert(t: PStringTable, data: var TKeyValuePairSeq, key, val: string) = +proc RawInsert(t: PStringTable, data: var TKeyValuePairSeq, key, val: string) = var h: THash h = myhash(t, key) and high(data) - while not isNil(data[h].key): + while not isNil(data[h].key): h = nextTry(h, high(data)) data[h].key = key data[h].val = val -proc Enlarge(t: PStringTable) = +proc Enlarge(t: PStringTable) = var n: TKeyValuePairSeq - n = emptySeq - setlen(n, len(t.data) * growthFactor) - for i in countup(0, high(t.data)): + newSeq(n, len(t.data) * growthFactor) + for i in countup(0, high(t.data)): if not isNil(t.data[i].key): RawInsert(t, n, t.data[i].key, t.data[i].val) swap(t.data, n) -proc `[]=`(t: PStringTable, key, val: string) = +proc `[]=`(t: PStringTable, key, val: string) = var index = RawGet(t, key) - if index >= 0: + if index >= 0: t.data[index].val = val - else: + else: if mustRehash(len(t.data), t.counter): Enlarge(t) RawInsert(t, t.data, key, val) inc(t.counter) -proc RaiseFormatException(s: string) = +proc RaiseFormatException(s: string) = var e: ref EInvalidValue new(e) e.msg = "format string: key not found: " & s raise e -proc getValue(t: PStringTable, flags: set[TFormatFlag], key: string): string = +proc getValue(t: PStringTable, flags: set[TFormatFlag], key: string): string = if hasKey(t, key): return t[key] if useEnvironment in flags: result = os.getEnv(key) else: result = "" - if (result == ""): + if (result == ""): if useKey in flags: result = '$' & key elif not (useEmpty in flags): raiseFormatException(key) - -proc `%`(f: string, t: PStringTable, flags: set[TFormatFlag] = {}): string = - const + +proc `%`(f: string, t: PStringTable, flags: set[TFormatFlag] = {}): string = + const PatternChars = {'a'..'z', 'A'..'Z', '0'..'9', '_', '\x80'..'\xFF'} - var + var i, j: int key: string result = "" i = strStart - while i <= len(f) + strStart - 1: - if f[i] == '$': + while i <= len(f) + strStart - 1: + if f[i] == '$': case f[i + 1] - of '$': + of '$': add(result, '$') inc(i, 2) - of '{': + of '{': j = i + 1 while (j <= len(f) + strStart - 1) and (f[j] != '}'): inc(j) key = copy(f, i + 2, j - 1) result = result & getValue(t, flags, key) i = j + 1 - of 'a'..'z', 'A'..'Z', '\x80'..'\xFF', '_': + of 'a'..'z', 'A'..'Z', '\x80'..'\xFF', '_': j = i + 1 while (j <= len(f) + strStart - 1) and (f[j] in PatternChars): inc(j) key = copy(f, i+1, j - 1) result = result & getValue(t, flags, key) i = j - else: + else: add(result, f[i]) inc(i) - else: + else: add(result, f[i]) inc(i) - + diff --git a/lib/strutils.nim b/lib/strutils.nim index 039a06251..7e1a329d6 100644 --- a/lib/strutils.nim +++ b/lib/strutils.nim @@ -24,6 +24,7 @@ template newException(exceptn, message: expr): expr = e.msg = message e + type TCharSet* = set[char] # for compability for Nim @@ -73,6 +74,9 @@ proc findSubStr*(sub: char, s: string, start: int = 0): int {.noSideEffect.} proc replaceStr*(s, sub, by: string): string {.noSideEffect.} ## Replaces `sub` in `s` by the string `by`. +proc replaceStr*(s: string, sub, by: char): string {.noSideEffect.} + ## optimized version for characters. + proc deleteStr*(s: var string, first, last: int) ## Deletes in `s` the characters at position `first`..`last`. This modifies ## `s` itself, it does not return a copy. @@ -113,6 +117,43 @@ iterator split*(s: string, seps: set[char] = Whitespace): string = while last < len(s) and s[last] not_in seps: inc(last) # BUGFIX! yield copy(s, first, last-1) +iterator splitLines*(s: string): string = + ## Splits the string `s` into its containing lines. Each newline + ## combination (CR, LF, CR-LF) is supported. The result strings contain + ## no trailing ``\n``. + ## + ## Example:: + ## + ## for line in lines("\nthis\nis\nan\n\nexample\n"): + ## writeln(stdout, line) + ## + ## Results in:: + ## + ## "" + ## "this" + ## "is" + ## "an" + ## "" + ## "example" + ## "" + var first = 0 + var last = 0 + while true: + while s[last] notin {'\0', '\c', '\l'}: inc(last) + yield copy(s, first, last-1) + # skip newlines: + if s[last] == '\l': inc(last) + elif s[last] == '\c': + inc(last) + if s[last] == '\l': inc(last) + else: break # was '\0' + first = last + +proc splitLinesSeq*(s: string): seq[string] {.noSideEffect.} = + ## The same as `split`, but is a proc that returns a sequence of substrings. + result = @[] + for line in splitLines(s): add(result, line) + proc splitSeq*(s: string, seps: set[char] = Whitespace): seq[string] {. noSideEffect.} ## The same as `split`, but is a proc that returns a sequence of substrings. @@ -159,7 +200,8 @@ proc ParseBiggestInt*(s: string): biggestInt {.noSideEffect.} proc ParseFloat*(s: string): float {.noSideEffect.} ## Parses a decimal floating point value contained in `s`. If `s` is not - ## a valid floating point number, `EInvalidValue` is raised. + ## a valid floating point number, `EInvalidValue` is raised. ``NAN``, + ## ``INF``, ``-INF`` are also supported (case insensitive comparison). # XXX: make this biggestfloat. # the stringify and format operators: @@ -344,7 +386,7 @@ proc cmpIgnoreStyle(a, b: string): int = # ---------- splitting ----------------------------------------------------- proc splitSeq(s: string, seps: set[char]): seq[string] = - result = [] + result = @[] for sub in split(s, seps): add result, sub # --------------------------------------------------------------------------- @@ -469,6 +511,14 @@ proc replaceStr(s, sub, by: string): string = # copy the rest: add result, copy(s, i) +proc replaceStr(s: string, sub, by: char): string = + result = newString(s.len) + var i = 0 + while i < s.len: + if s[i] == sub: result[i] = by + else: result[i] = s[i] + inc(i) + proc deleteStr(s: var string, first, last: int) = # example: "abc___uvwxyz\0" (___ is to be deleted) # --> first == 3, last == 5 @@ -489,7 +539,7 @@ proc toHex(x: BiggestInt, len: int): string = shift: BiggestInt result = newString(len) for j in countdown(len-1, 0): - result[j] = HexChars[toU32(x shr shift) and 0xF] + result[j] = HexChars[toU32(x shr shift) and 0xF'i32] shift = shift + 4 {.push overflowChecks: on.} @@ -552,6 +602,16 @@ proc ParseFloat(s: string): float = elif s[i] == '-': sign = -1.0 inc(i) + if s[i] == 'N' or s[i] == 'n': + if s[i+1] == 'A' or s[i+1] == 'a': + if s[i+2] == 'N' or s[i+2] == 'n': + if s[i+3] == '\0': return NaN + raise newException(EInvalidValue, "invalid float: " & s) + if s[i] == 'I' or s[i] == 'i': + if s[i+1] == 'N' or s[i+1] == 'n': + if s[i+2] == 'F' or s[i+2] == 'f': + if s[i+3] == '\0': return Inf*sign + raise newException(EInvalidValue, "invalid float: " & s) while s[i] in {'0'..'9'}: # Read integer part flags = flags or 1 @@ -572,7 +632,7 @@ proc ParseFloat(s: string): float = result = result / hd # this complicated way preserves precision # Again, read integer and fractional part if flags == 0: - raise newException(EInvalidValue, "invalid float:" & s) + raise newException(EInvalidValue, "invalid float: " & s) # Exponent? if s[i] in {'e', 'E'}: inc(i) @@ -624,4 +684,113 @@ proc toBin*(x: BiggestInt, len: int): string = shift = shift + 1 mask = mask shl 1 +proc escape*(s: string, prefix, suffix = "\""): string = + ## Escapes a string `s`. This does these operations (at the same time): + ## * replaces any ``\`` by ``\\`` + ## * replaces any ``'`` by ``\'`` + ## * replaces any ``"`` by ``\"`` + ## * replaces any other character in the set ``{'\0'..'\31', '\128'..'\255'}`` + ## by ``\xHH`` where ``HH`` is its hexadecimal value. + ## The procedure has been designed so that its output is usable for many + ## different common syntaxes. The resulting string is prefixed with + ## ``prefix`` and suffixed with ``suffix``. Both may be empty strings. + result = prefix + for c in items(s): + case c + of '\0'..'\31', '\128'..'\255': + add(result, '\\') + add(result, toHex(ord(c), 2)) + of '\\': add(result, "\\\\") + of '\'': add(result, "\\'") + of '\"': add(result, "\\\"") + else: add(result, c) + add(result, suffix) + +proc editDistance*(a, b: string): int = + ## returns the edit distance between `s` and `t`. This uses the Levenshtein + ## distance algorithm with only a linear memory overhead. This implementation + ## is highly optimized! + var len1 = a.len + var len2 = b.len + if len1 > len2: + # make `b` the longer string + return editDistance(b, a) + + # strip common prefix: + var s = 0 + while a[s] == b[s] and a[s] != '\0': + inc(s) + dec(len1) + dec(len2) + # strip common suffix: + while len1 > 0 and len2 > 0 and a[s+len1-1] == b[s+len2-1]: + dec(len1) + dec(len2) + # trivial cases: + if len1 == 0: return len2 + if len2 == 0: return len1 + + # another special case: + if len1 == 1: + for j in s..len2-1: + if a[s] == b[j]: return len2 - 1 + return len2 + + inc(len1) + inc(len2) + var half = len1 shr 1 + # initalize first row: + #var row = cast[ptr array[0..high(int) div 8, int]](alloc(len2 * sizeof(int))) + var row: seq[int] + newSeq(row, len2) + var e = s + len2 - 1 # end marker + for i in 1..len2 - half - 1: row[i] = i + row[0] = len1 - half - 1 + for i in 1 .. len1 - 1: + var char1 = a[i + s - 1] + var char2p: int + var D, x: int + var p: int + if i >= len1 - half: + # skip the upper triangle: + var offset = i - len1 + half + char2p = offset + p = offset + var c3 = row[p] + ord(char1 != b[s + char2p]) + inc(p) + inc(char2p) + x = row[p] + 1 + D = x + if x > c3: x = c3 + row[p] = x + inc(p) + else: + p = 1 + char2p = 0 + D = i + x = i + if i <= half + 1: + # skip the lower triangle: + e = len2 + i - half - 2 + # main: + while p <= e: + dec(D) + var c3 = D + ord(char1 != b[char2p + s]) + inc(char2p) + inc(x) + if x > c3: x = c3 + D = row[p] + 1 + if x > D: x = D + row[p] = x + inc(p) + # lower triangle sentinel: + if i <= half: + dec(D) + var c3 = D + ord(char1 != b[char2p + s]) + inc(x) + if x > c3: x = c3 + row[p] = x + result = row[e] + #dealloc(row) + {.pop.} diff --git a/lib/sysio.nim b/lib/sysio.nim index 6da47eb20..8887effa8 100644 --- a/lib/sysio.nim +++ b/lib/sysio.nim @@ -19,7 +19,7 @@ proc fputs(c: cstring, f: TFile) {.importc: "fputs", noDecl.} proc fgets(c: cstring, n: int, f: TFile): cstring {.importc: "fgets", noDecl.} proc fgetc(stream: TFile): int {.importc: "fgetc", nodecl.} -proc ungetc(c: int, f: TFile) {.importc: "ungetc", nodecl.} +proc ungetc(c: cint, f: TFile) {.importc: "ungetc", nodecl.} proc putc(c: Char, stream: TFile) {.importc: "putc", nodecl.} proc fprintf(f: TFile, frmt: CString) {.importc: "fprintf", nodecl, varargs.} proc strlen(c: cstring): int {.importc: "strlen", nodecl.} @@ -33,7 +33,7 @@ var IOFBF {.importc: "_IOFBF", nodecl.}: cint IONBF {.importc: "_IONBF", nodecl.}: cint -proc rawReadLine(f: TFile, result: var string) {.noStatic.} = +proc rawReadLine(f: TFile, result: var string) = # of course this could be optimized a bit; but IO is slow anyway... # and it was difficult to get this CORRECT with Ansi C's methods var @@ -41,13 +41,11 @@ proc rawReadLine(f: TFile, result: var string) {.noStatic.} = setLen(result, 0) # reuse the buffer! while True: c = fgetc(f) - if c < 0: - result = nil - break # EOF - if c == 10: break # LF - if c == 13: # CR + if c < 0'i32: break # EOF + if c == 10'i32: break # LF + if c == 13'i32: # CR c = fgetc(f) # is the next char LF? - if c != 10: ungetc(c, f) # no, put the character back + if c != 10'i32: ungetc(c, f) # no, put the character back break add result, chr(int(c)) @@ -72,7 +70,7 @@ proc readFile(filename: string): string = proc write(f: TFile, s: string) = fputs(s, f) proc write(f: TFile, i: int) = fprintf(f, "%ld", i) -proc write(f: TFile, b: bool) = +proc write(f: TFile, b: bool) = if b: write(f, "true") else: write(f, "false") proc write(f: TFile, r: float) = fprintf(f, "%g", r) @@ -117,11 +115,18 @@ proc OpenFile(f: var TFile, filename: string, result = (p != nil) f = cast[TFile](p) if bufSize > 0: - if setvbuf(f, nil, IOFBF, bufSize) != 0: + if setvbuf(f, nil, IOFBF, bufSize) != 0'i32: raise newException(EOutOfMemory, "out of memory") elif bufSize == 0: discard setvbuf(f, nil, IONBF, 0) +proc fdopen(filehandle: TFileHandle, mode: cstring): TFile {. + importc: pccHack & "fdopen", header: "<stdio.h>".} + +proc openFile(f: var TFile, filehandle: TFileHandle, mode: TFileMode): bool = + f = fdopen(filehandle, FormatOpen[mode]) + result = f != nil + # C routine that is used here: proc fread(buf: Pointer, size, n: int, f: TFile): int {. importc: "fread", noDecl.} diff --git a/lib/sysstr.nim b/lib/sysstr.nim index a3e5ab9f8..921a92ff5 100644 --- a/lib/sysstr.nim +++ b/lib/sysstr.nim @@ -16,53 +16,55 @@ # the programmer may not want type - TStringDesc {.importc, nodecl, final.} = object - len, space: int # len and space without counting the terminating zero - data: array[0..0, char] # for the '\0' character + # len and space without counting the terminating zero: + NimStringDesc {.compilerproc, final.} = object of TGenericSeq + data: array[0..100_000_000, char] # for the '\0' character - mstring {.importc: "string".} = ptr TStringDesc + NimString = ptr NimStringDesc # implementation: proc resize(old: int): int {.inline.} = - if old <= 0: return 1 + if old <= 0: return 4 elif old < 65536: return old * 2 else: return old * 3 div 2 # for large arrays * 3/2 is better -proc cmpStrings(a, b: mstring): int {.inline, compilerProc.} = +proc cmpStrings(a, b: NimString): int {.inline, compilerProc.} = if a == b: return 0 if a == nil: return -1 if b == nil: return 1 return c_strcmp(a.data, b.data) -proc eqStrings(a, b: mstring): bool {.inline, compilerProc.} = +proc eqStrings(a, b: NimString): bool {.inline, compilerProc.} = if a == b: return true if a == nil or b == nil: return false return a.len == b.len and - c_memcmp(a.data, b.data, a.len * sizeof(char)) == 0 - -proc rawNewString(space: int): mstring {.compilerProc.} = - result = cast[mstring](newObj(addr(strDesc), sizeof(TStringDesc) + - space * sizeof(char))) - result.len = 0 - result.space = space - result.data[0] = '\0' - -proc mnewString(len: int): mstring {.exportc.} = + c_memcmp(a.data, b.data, a.len * sizeof(char)) == 0'i32 + +proc rawNewString(space: int): NimString {.compilerProc.} = + var s = space + if s < 8: s = 7 + result = cast[NimString](newObj(addr(strDesc), sizeof(TGenericSeq) + + (s+1) * sizeof(char))) + #result.len = 0 + result.space = s + #result.data[0] = '\0' + +proc mnewString(len: int): NimString {.exportc.} = result = rawNewString(len) result.len = len - result.data[len] = '\0' + #result.data[len] = '\0' -proc toNimStr(str: CString, len: int): mstring {.compilerProc.} = +proc toNimStr(str: CString, len: int): NimString {.compilerProc.} = result = rawNewString(len) result.len = len c_memcpy(result.data, str, (len+1) * sizeof(Char)) result.data[len] = '\0' # IO.readline relies on this! -proc cstrToNimstr(str: CString): mstring {.compilerProc.} = +proc cstrToNimstr(str: CString): NimString {.compilerProc.} = return toNimstr(str, c_strlen(str)) -proc copyString(src: mstring): mstring {.compilerProc.} = +proc copyString(src: NimString): NimString {.compilerProc.} = if src == nil: return nil result = rawNewString(src.space) result.len = src.len @@ -71,9 +73,7 @@ proc copyString(src: mstring): mstring {.compilerProc.} = proc hashString(s: string): int {.compilerproc.} = # the compiler needs exactly the same hash function! # this used to be used for efficient generation of string case statements - var - h: int - h = 0 + var h = 0 for i in 0..Len(s)-1: h = h +% Ord(s[i]) h = h +% h shl 10 @@ -91,8 +91,7 @@ proc hashString(s: string): int {.compilerproc.} = # setLength(var s: string, newlen: int) # {.extern: "setLengthStr", noDecl, noSideEffect.} - -proc copyStrLast(s: mstring, start, last: int): mstring {.exportc.} = +proc copyStrLast(s: NimString, start, last: int): NimString {.exportc.} = var len: int if start >= s.len: return mnewString(0) # BUGFIX @@ -105,15 +104,19 @@ proc copyStrLast(s: mstring, start, last: int): mstring {.exportc.} = c_memcpy(result.data, addr(s.data[start]), len * sizeof(Char)) result.data[len] = '\0' -proc copyStr(s: mstring, start: int): mstring {.exportc.} = +proc copyStr(s: NimString, start: int): NimString {.exportc.} = return copyStrLast(s, start, s.len-1) -proc addChar(s: mstring, c: char): mstring {.compilerProc.} = +proc addChar(s: NimString, c: char): NimString {.compilerProc.} = result = s if result.len >= result.space: result.space = resize(result.space) - result = cast[mstring](growObj(result, - sizeof(TStringDesc) + result.space * sizeof(char))) + result = cast[NimString](growObj(result, + sizeof(TGenericSeq) + (result.space+1) * sizeof(char))) + #var space = resize(result.space) + #result = rawNewString(space) + #copyMem(result, s, s.len * sizeof(char) + sizeof(TGenericSeq)) + #result.space = space result.data[result.len] = c result.data[result.len+1] = '\0' inc(result.len) @@ -149,27 +152,28 @@ proc addChar(s: mstring, c: char): mstring {.compilerProc.} = # <generated C code> # s = rawNewString(0); -proc resizeString(dest: mstring, addlen: int): mstring {.compilerproc.} = +proc resizeString(dest: NimString, addlen: int): NimString {.compilerproc.} = if dest.len + addLen + 1 <= dest.space: # BUGFIX: this is horrible! result = dest else: # slow path: - var - sp = max(resize(dest.space), dest.len + addLen + 1) - result = cast[mstring](growObj(dest, sizeof(TStringDesc) + - sp * sizeof(Char))) - # DO NOT UPDATE LEN YET: dest.len = newLen + var sp = max(resize(dest.space), dest.len + addLen + 1) + result = cast[NimString](growObj(dest, sizeof(TGenericSeq) + + (sp+1) * sizeof(Char))) result.space = sp + #result = rawNewString(sp) + #copyMem(result, dest, dest.len * sizeof(char) + sizeof(TGenericSeq)) + # DO NOT UPDATE LEN YET: dest.len = newLen -proc appendString(dest, src: mstring) {.compilerproc, inline.} = +proc appendString(dest, src: NimString) {.compilerproc, inline.} = c_memcpy(addr(dest.data[dest.len]), src.data, (src.len + 1) * sizeof(Char)) inc(dest.len, src.len) -proc appendChar(dest: mstring, c: char) {.compilerproc, inline.} = +proc appendChar(dest: NimString, c: char) {.compilerproc, inline.} = dest.data[dest.len] = c dest.data[dest.len+1] = '\0' inc(dest.len) -proc setLengthStr(s: mstring, newLen: int): mstring {.compilerProc.} = +proc setLengthStr(s: NimString, newLen: int): NimString {.compilerProc.} = var n = max(newLen, 0) if n <= s.space: result = s @@ -187,37 +191,54 @@ proc incrSeq(seq: PGenericSeq, elemSize: int): PGenericSeq {.compilerProc.} = # add seq x generates: # seq = incrSeq(seq, sizeof(x)); # seq[seq->len-1] = x; - result = seq - if result.len >= result.space: - var - s: TAddress - result.space = resize(result.space) - result = cast[PGenericSeq](growObj(result, elemSize * result.space + - GenericSeqSize)) - # set new elements to zero: - s = cast[TAddress](result) - zeroMem(cast[pointer](s + GenericSeqSize + (result.len * elemSize)), - (result.space - result.len) * elemSize) - # for i in len .. space-1: - # seq->data[i] = 0 - inc(result.len) + when false: + # broken version: + result = seq + if result.len >= result.space: + var s = resize(result.space) + result = cast[PGenericSeq](newSeq(extGetCellType(seq), s)) + genericSeqAssign(result, seq, XXX) + #copyMem(result, seq, seq.len * elemSize + GenericSeqSize) + inc(result.len) + else: + result = seq + if result.len >= result.space: + result.space = resize(result.space) + result = cast[PGenericSeq](growObj(result, elemSize * result.space + + GenericSeqSize)) + # set new elements to zero: + #var s = cast[TAddress](result) + #zeroMem(cast[pointer](s + GenericSeqSize + (result.len * elemSize)), + # (result.space - result.len) * elemSize) + # for i in len .. space-1: + # seq->data[i] = 0 + inc(result.len) proc setLengthSeq(seq: PGenericSeq, elemSize, newLen: int): PGenericSeq {. compilerProc.} = - result = seq - if result.space < newLen: - var - s: TAddress - result.space = max(resize(result.space), newLen) - result = cast[PGenericSeq](growObj(result, elemSize * result.space + - GenericSeqSize)) - # set new elements to zero (needed for GC): - s = cast[TAddress](result) - zeroMem(cast[pointer](s + GenericSeqSize + (result.len * elemSize)), - (result.space - result.len) * elemSize) - # Else: We could decref references, if we had type information here :-( - # However, this does not happen often - result.len = newLen + when false: + # broken version: + result = seq + if result.space < newLen: + var s = max(resize(result.space), newLen) + result = cast[PGenericSeq](newSeq(extGetCellType(seq), s)) + result.len = newLen + else: + result = seq + if result.space < newLen: + result.space = max(resize(result.space), newLen) + result = cast[PGenericSeq](growObj(result, elemSize * result.space + + GenericSeqSize)) + elif newLen < result.len: + # we need to decref here, otherwise the GC leaks! + for i in newLen..result.len-1: + forAllChildrenAux(cast[pointer](cast[TAddress](result) +% + GenericSeqSize +% (i*%elemSize)), + extGetCellType(result).base, waZctDecRef) + # and set the memory to nil: + zeroMem(cast[pointer](cast[TAddress](result) +% GenericSeqSize +% + (newLen*%elemSize)), (result.len-%newLen) *% elemSize) + result.len = newLen # --------------- other string routines ---------------------------------- proc nimIntToStr(x: int): string {.compilerproc.} = diff --git a/lib/system.nim b/lib/system.nim index 285b921f8..97ad7297a 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -19,6 +19,30 @@ {.push hints: off.} +type + int* {.magic: Int.} ## default integer type; bitwidth depends on + ## architecture, but is always the same as a pointer + int8* {.magic: Int8.} ## signed 8 bit integer type + int16* {.magic: Int16.} ## signed 16 bit integer type + int32* {.magic: Int32.} ## signed 32 bit integer type + int64* {.magic: Int64.} ## signed 64 bit integer type + float* {.magic: Float.} ## default floating point type + float32* {.magic: Float32.} ## 32 bit floating point type + float64* {.magic: Float64.} ## 64 bit floating point type +type # we need to start a new type section here, so that ``0`` can have a type + bool* {.magic: Bool.} = enum ## built-in boolean type + false = 0, true = 1 + +type + char* {.magic: Char.} ## built-in 8 bit character type (unsigned) + string* {.magic: String.} ## built-in string type + cstring* {.magic: Cstring.} ## built-in cstring (*compatible string*) type + pointer* {.magic: Pointer.} ## built-in pointer type + TAnyEnum {.magic: AnyEnum.} + +type + `nil` {.magic: "Nil".} + proc defined*[T] (x: T): bool {.magic: "Defined", noSideEffect.} ## Special comile-time procedure that checks whether `x` is ## defined. `x` has to be an identifier or a qualified identifier. @@ -30,23 +54,6 @@ proc defined*[T] (x: T): bool {.magic: "Defined", noSideEffect.} ## # provide our own toUpper proc here, because strutils is ## # missing it. -when defined(macosX): - {.define: useDL.} - -when defined(linux): - {.define: useDL.} - -when defined(unix): - # This may seem strange, but we cannot write "when not defined" - # here, because ``not`` has not been defined yet. - {.hint: "unix is defined".} -else: - {.define: useDL.} - {.hint: "unix is not defined".} - # use Doug Lea's memory allocator; you can undefine it if you - # know that your system uses this library anyway (smaller code) or if - # your malloc() doesn't suck (most systems use it anyway) - # these require compiler magic: proc `not` *(x: bool): bool {.magic: "Not", noSideEffect.} ## Boolean not; returns true iff ``x == false``. @@ -98,9 +105,10 @@ type ## is an int type ranging from one to the maximum value ## of an int. This type is often useful for documentation and debugging. - TObject* = object ## the root of Nimrod's object hierarchy. Objects should - ## inherit from TObject or one of its descendants. However, - ## objects that have no ancestor are allowed. + TObject* {.exportc: "TNimObject".} = + object ## the root of Nimrod's object hierarchy. Objects should + ## inherit from TObject or one of its descendants. However, + ## objects that have no ancestor are allowed. PObject* = ref TObject ## reference to TObject E_Base* {.compilerproc.} = object of TObject ## base exception class; @@ -206,8 +214,14 @@ proc dec*[T](x: var T, y = 1) {.magic: "Dec".} ## exist, ``EOutOfRange`` is raised or a compile time error occurs. This is a ## short notation for: ``x = pred(x, y)``. +proc newSeq*[T](s: var seq[T], len: int) {.magic: "NewSeq".} + ## creates a new sequence of type ``seq[T]`` with length ``len``. + ## This is equivalent to ``s = []; setlen(s, len)``, but more + ## efficient since no relocation is needed. + proc len*[T](x: openarray[T]): int {.magic: "LengthOpenArray", noSideEffect.} proc len*(x: string): int {.magic: "LengthStr", noSideEffect.} +proc len*(x: cstring): int {.magic: "LengthStr", noSideEffect.} proc len*[I, T](x: array[I, T]): int {.magic: "LengthArray", noSideEffect.} proc len*[T](x: seq[T]): int {.magic: "LengthSeq", noSideEffect.} ## returns the length of an array, a sequence or a string. @@ -236,79 +250,241 @@ proc chr*(u: range[0..255]): char {.magic: "Chr", noSideEffect.} # -------------------------------------------------------------------------- # built-in operators +proc ze*(x: int8): int {.magic: "Ze8ToI", noSideEffect.} + ## zero extends a smaller integer type to ``int``. This treats `x` as + ## unsigned. +proc ze*(x: int16): int {.magic: "Ze16ToI", noSideEffect.} + ## zero extends a smaller integer type to ``int``. This treats `x` as + ## unsigned. + +proc ze64*(x: int8): int64 {.magic: "Ze8ToI64", noSideEffect.} + ## zero extends a smaller integer type to ``int64``. This treats `x` as + ## unsigned. +proc ze64*(x: int16): int64 {.magic: "Ze16ToI64", noSideEffect.} + ## zero extends a smaller integer type to ``int64``. This treats `x` as + ## unsigned. + +proc ze64*(x: int32): int64 {.magic: "Ze32ToI64", noSideEffect.} + ## zero extends a smaller integer type to ``int64``. This treats `x` as + ## unsigned. +proc ze64*(x: int): int64 {.magic: "ZeIToI64", noDecl, noSideEffect.} + ## zero extends a smaller integer type to ``int64``. This treats `x` as + ## unsigned. Does nothing if the size of an ``int`` is the same as ``int64``. + ## (This is the case on 64 bit processors.) + +proc toU8*(x: int): int8 {.magic: "ToU8", noSideEffect.} + ## treats `x` as unsigned and converts it to a byte by taking the last 8 bits + ## from `x`. +proc toU16*(x: int): int16 {.magic: "ToU16", noSideEffect.} + ## treats `x` as unsigned and converts it to an ``int16`` by taking the last + ## 16 bits from `x`. +proc toU32*(x: int64): int32 {.magic: "ToU32", noSideEffect.} + ## treats `x` as unsigned and converts it to an ``int32`` by taking the + ## last 32 bits from `x`. + + # integer calculations: proc `+` *(x: int): int {.magic: "UnaryPlusI", noSideEffect.} +proc `+` *(x: int8): int8 {.magic: "UnaryPlusI", noSideEffect.} +proc `+` *(x: int16): int16 {.magic: "UnaryPlusI", noSideEffect.} +proc `+` *(x: int32): int32 {.magic: "UnaryPlusI", noSideEffect.} +proc `+` *(x: int64): int64 {.magic: "UnaryPlusI64", noSideEffect.} ## Unary `+` operator for an integer. Has no effect. proc `-` *(x: int): int {.magic: "UnaryMinusI", noSideEffect.} +proc `-` *(x: int8): int8 {.magic: "UnaryMinusI", noSideEffect.} +proc `-` *(x: int16): int16 {.magic: "UnaryMinusI", noSideEffect.} +proc `-` *(x: int32): int32 {.magic: "UnaryMinusI", noSideEffect.} +proc `-` *(x: int64): int64 {.magic: "UnaryMinusI64", noSideEffect.} ## Unary `-` operator for an integer. Negates `x`. proc `not` *(x: int): int {.magic: "BitnotI", noSideEffect.} +proc `not` *(x: int8): int8 {.magic: "BitnotI", noSideEffect.} +proc `not` *(x: int16): int16 {.magic: "BitnotI", noSideEffect.} +proc `not` *(x: int32): int32 {.magic: "BitnotI", noSideEffect.} +proc `not` *(x: int64): int64 {.magic: "BitnotI64", noSideEffect.} ## computes the `bitwise complement` of the integer `x`. proc `+` *(x, y: int): int {.magic: "AddI", noSideEffect.} +proc `+` *(x, y: int8): int8 {.magic: "AddI", noSideEffect.} +proc `+` *(x, y: int16): int16 {.magic: "AddI", noSideEffect.} +proc `+` *(x, y: int32): int32 {.magic: "AddI", noSideEffect.} +proc `+` *(x, y: int64): int64 {.magic: "AddI64", noSideEffect.} + ## Binary `+` operator for an integer. + proc `-` *(x, y: int): int {.magic: "SubI", noSideEffect.} +proc `-` *(x, y: int8): int8 {.magic: "SubI", noSideEffect.} +proc `-` *(x, y: int16): int16 {.magic: "SubI", noSideEffect.} +proc `-` *(x, y: int32): int32 {.magic: "SubI", noSideEffect.} +proc `-` *(x, y: int64): int64 {.magic: "SubI64", noSideEffect.} + ## Binary `-` operator for an integer. + proc `*` *(x, y: int): int {.magic: "MulI", noSideEffect.} +proc `*` *(x, y: int8): int8 {.magic: "MulI", noSideEffect.} +proc `*` *(x, y: int16): int16 {.magic: "MulI", noSideEffect.} +proc `*` *(x, y: int32): int32 {.magic: "MulI", noSideEffect.} +proc `*` *(x, y: int64): int64 {.magic: "MulI64", noSideEffect.} + ## Binary `*` operator for an integer. + proc `div` *(x, y: int): int {.magic: "DivI", noSideEffect.} +proc `div` *(x, y: int8): int8 {.magic: "DivI", noSideEffect.} +proc `div` *(x, y: int16): int16 {.magic: "DivI", noSideEffect.} +proc `div` *(x, y: int32): int32 {.magic: "DivI", noSideEffect.} +proc `div` *(x, y: int64): int64 {.magic: "DivI64", noSideEffect.} ## computes the integer division. This is roughly the same as ## ``floor(x/y)``. + proc `mod` *(x, y: int): int {.magic: "ModI", noSideEffect.} +proc `mod` *(x, y: int8): int8 {.magic: "ModI", noSideEffect.} +proc `mod` *(x, y: int16): int16 {.magic: "ModI", noSideEffect.} +proc `mod` *(x, y: int32): int32 {.magic: "ModI", noSideEffect.} +proc `mod` *(x, y: int64): int64 {.magic: "ModI64", noSideEffect.} ## computes the integer modulo operation. This is the same as ## ``x - (x div y) * y``. proc `shr` *(x, y: int): int {.magic: "ShrI", noSideEffect.} +proc `shr` *(x, y: int8): int8 {.magic: "ShrI", noSideEffect.} +proc `shr` *(x, y: int16): int16 {.magic: "ShrI", noSideEffect.} +proc `shr` *(x, y: int32): int32 {.magic: "ShrI", noSideEffect.} +proc `shr` *(x, y: int64): int64 {.magic: "ShrI64", noSideEffect.} ## computes the `shift right` operation of `x` and `y`. + proc `shl` *(x, y: int): int {.magic: "ShlI", noSideEffect.} +proc `shl` *(x, y: int8): int8 {.magic: "ShlI", noSideEffect.} +proc `shl` *(x, y: int16): int16 {.magic: "ShlI", noSideEffect.} +proc `shl` *(x, y: int32): int32 {.magic: "ShlI", noSideEffect.} +proc `shl` *(x, y: int64): int64 {.magic: "ShlI64", noSideEffect.} ## computes the `shift left` operation of `x` and `y`. + proc `and` *(x, y: int): int {.magic: "BitandI", noSideEffect.} +proc `and` *(x, y: int8): int8 {.magic: "BitandI", noSideEffect.} +proc `and` *(x, y: int16): int16 {.magic: "BitandI", noSideEffect.} +proc `and` *(x, y: int32): int32 {.magic: "BitandI", noSideEffect.} +proc `and` *(x, y: int64): int64 {.magic: "BitandI64", noSideEffect.} ## computes the `bitwise and` of numbers `x` and `y`. + proc `or` *(x, y: int): int {.magic: "BitorI", noSideEffect.} +proc `or` *(x, y: int8): int8 {.magic: "BitorI", noSideEffect.} +proc `or` *(x, y: int16): int16 {.magic: "BitorI", noSideEffect.} +proc `or` *(x, y: int32): int32 {.magic: "BitorI", noSideEffect.} +proc `or` *(x, y: int64): int64 {.magic: "BitorI64", noSideEffect.} ## computes the `bitwise or` of numbers `x` and `y`. + proc `xor` *(x, y: int): int {.magic: "BitxorI", noSideEffect.} +proc `xor` *(x, y: int8): int8 {.magic: "BitxorI", noSideEffect.} +proc `xor` *(x, y: int16): int16 {.magic: "BitxorI", noSideEffect.} +proc `xor` *(x, y: int32): int32 {.magic: "BitxorI", noSideEffect.} +proc `xor` *(x, y: int64): int64 {.magic: "BitxorI64", noSideEffect.} ## computes the `bitwise xor` of numbers `x` and `y`. proc `==` *(x, y: int): bool {.magic: "EqI", noSideEffect.} +proc `==` *(x, y: int8): bool {.magic: "EqI", noSideEffect.} +proc `==` *(x, y: int16): bool {.magic: "EqI", noSideEffect.} +proc `==` *(x, y: int32): bool {.magic: "EqI", noSideEffect.} +proc `==` *(x, y: int64): bool {.magic: "EqI64", noSideEffect.} + ## Compares two integers for equality. + proc `<=` *(x, y: int): bool {.magic: "LeI", noSideEffect.} +proc `<=` *(x, y: int8): bool {.magic: "LeI", noSideEffect.} +proc `<=` *(x, y: int16): bool {.magic: "LeI", noSideEffect.} +proc `<=` *(x, y: int32): bool {.magic: "LeI", noSideEffect.} +proc `<=` *(x, y: int64): bool {.magic: "LeI64", noSideEffect.} + ## Returns true iff `x` is less than or equal to `y`. + proc `<` *(x, y: int): bool {.magic: "LtI", noSideEffect.} +proc `<` *(x, y: int8): bool {.magic: "LtI", noSideEffect.} +proc `<` *(x, y: int16): bool {.magic: "LtI", noSideEffect.} +proc `<` *(x, y: int32): bool {.magic: "LtI", noSideEffect.} +proc `<` *(x, y: int64): bool {.magic: "LtI64", noSideEffect.} + ## Returns true iff `x` is less than `y`. + proc abs*(x: int): int {.magic: "AbsI", noSideEffect.} +proc abs*(x: int8): int8 {.magic: "AbsI", noSideEffect.} +proc abs*(x: int16): int16 {.magic: "AbsI", noSideEffect.} +proc abs*(x: int32): int32 {.magic: "AbsI", noSideEffect.} +proc abs*(x: int64): int64 {.magic: "AbsI64", noSideEffect.} + ## returns the absolute value of `x`. If `x` is ``low(x)`` (that is + ## -MININT for its type), an overflow exception is thrown (if overflow + ## checking is turned on). + proc min*(x, y: int): int {.magic: "MinI", noSideEffect.} +proc min*(x, y: int8): int8 {.magic: "MinI", noSideEffect.} +proc min*(x, y: int16): int16 {.magic: "MinI", noSideEffect.} +proc min*(x, y: int32): int32 {.magic: "MinI", noSideEffect.} +proc min*(x, y: int64): int64 {.magic: "MinI64", noSideEffect.} + ## The minimum value of two integers. + proc max*(x, y: int): int {.magic: "MaxI", noSideEffect.} +proc max*(x, y: int8): int8 {.magic: "MaxI", noSideEffect.} +proc max*(x, y: int16): int16 {.magic: "MaxI", noSideEffect.} +proc max*(x, y: int32): int32 {.magic: "MaxI", noSideEffect.} +proc max*(x, y: int64): int64 {.magic: "MaxI64", noSideEffect.} + ## The maximum value of two integers. -proc `+` *(x: int64): int64 {.magic: "UnaryPlusI64", noSideEffect.} -proc `-` *(x: int64): int64 {.magic: "UnaryMinusI64", noSideEffect.} -proc `not` *(x: int64): int64 {.magic: "BitnotI64", noSideEffect.} - ## computes the `bitwise complement` of the integer `x`. +proc `+%` *(x, y: int): int {.magic: "AddU", noSideEffect.} +proc `+%` *(x, y: int8): int8 {.magic: "AddU", noSideEffect.} +proc `+%` *(x, y: int16): int16 {.magic: "AddU", noSideEffect.} +proc `+%` *(x, y: int32): int32 {.magic: "AddU", noSideEffect.} +proc `+%` *(x, y: int64): int64 {.magic: "AddU64", noSideEffect.} + ## treats `x` and `y` as unsigned and adds them. The result is truncated to + ## fit into the result. This implements modulo arithmetic. No overflow + ## errors are possible. -proc `+` *(x, y: int64): int64 {.magic: "AddI64", noSideEffect.} - ## Unary `+` operator for an integer. Has no effect. -proc `-` *(x, y: int64): int64 {.magic: "SubI64", noSideEffect.} - ## Unary `-` operator for an int64. Negates `x`. -proc `*` *(x, y: int64): int64 {.magic: "MulI64", noSideEffect.} -proc `div` *(x, y: int64): int64 {.magic: "DivI64", noSideEffect.} - ## computes the integer division. This is roughly the same as - ## ``floor(x/y)``. -proc `mod` *(x, y: int64): int64 {.magic: "ModI64", noSideEffect.} - ## computes the integer modulo operation. This is the same as - ## ``x - (x div y) * y``. -proc `shr` *(x, y: int64): int64 {.magic: "ShrI64", noSideEffect.} - ## computes the `shift right` operation of `x` and `y`. -proc `shl` *(x, y: int64): int64 {.magic: "ShlI64", noSideEffect.} - ## computes the `shift left` operation of `x` and `y`. -proc `and` *(x, y: int64): int64 {.magic: "BitandI64", noSideEffect.} - ## computes the `bitwise and` of numbers `x` and `y`. -proc `or` *(x, y: int64): int64 {.magic: "BitorI64", noSideEffect.} - ## computes the `bitwise or` of numbers `x` and `y`. -proc `xor` *(x, y: int64): int64 {.magic: "BitxorI64", noSideEffect.} - ## computes the `bitwise xor` of numbers `x` and `y`. +proc `-%` *(x, y: int): int {.magic: "SubU", noSideEffect.} +proc `-%` *(x, y: int8): int8 {.magic: "SubU", noSideEffect.} +proc `-%` *(x, y: int16): int16 {.magic: "SubU", noSideEffect.} +proc `-%` *(x, y: int32): int32 {.magic: "SubU", noSideEffect.} +proc `-%` *(x, y: int64): int64 {.magic: "SubU64", noSideEffect.} + ## treats `x` and `y` as unsigned and subtracts them. The result is + ## truncated to fit into the result. This implements modulo arithmetic. + ## No overflow errors are possible. -proc `==` *(x, y: int64): bool {.magic: "EqI64", noSideEffect.} -proc `<=` *(x, y: int64): bool {.magic: "LeI64", noSideEffect.} -proc `<` *(x, y: int64): bool {.magic: "LtI64", noSideEffect.} -proc abs*(x: int64): int64 {.magic: "AbsI64", noSideEffect.} -proc min*(x, y: int64): int64 {.magic: "MinI64", noSideEffect.} -proc max*(x, y: int64): int64 {.magic: "MaxI64", noSideEffect.} +proc `*%` *(x, y: int): int {.magic: "MulU", noSideEffect.} +proc `*%` *(x, y: int8): int8 {.magic: "MulU", noSideEffect.} +proc `*%` *(x, y: int16): int16 {.magic: "MulU", noSideEffect.} +proc `*%` *(x, y: int32): int32 {.magic: "MulU", noSideEffect.} +proc `*%` *(x, y: int64): int64 {.magic: "MulU64", noSideEffect.} + ## treats `x` and `y` as unsigned and multiplies them. The result is + ## truncated to fit into the result. This implements modulo arithmetic. + ## No overflow errors are possible. + +proc `/%` *(x, y: int): int {.magic: "DivU", noSideEffect.} +proc `/%` *(x, y: int8): int8 {.magic: "DivU", noSideEffect.} +proc `/%` *(x, y: int16): int16 {.magic: "DivU", noSideEffect.} +proc `/%` *(x, y: int32): int32 {.magic: "DivU", noSideEffect.} +proc `/%` *(x, y: int64): int64 {.magic: "DivU64", noSideEffect.} + ## treats `x` and `y` as unsigned and divides them. The result is + ## truncated to fit into the result. This implements modulo arithmetic. + ## No overflow errors are possible. + +proc `%%` *(x, y: int): int {.magic: "ModU", noSideEffect.} +proc `%%` *(x, y: int8): int8 {.magic: "ModU", noSideEffect.} +proc `%%` *(x, y: int16): int16 {.magic: "ModU", noSideEffect.} +proc `%%` *(x, y: int32): int32 {.magic: "ModU", noSideEffect.} +proc `%%` *(x, y: int64): int64 {.magic: "ModU64", noSideEffect.} + ## treats `x` and `y` as unsigned and compute the modulo of `x` and `y`. + ## The result is truncated to fit into the result. + ## This implements modulo arithmetic. + ## No overflow errors are possible. -# same for floating point: +proc `<=%` *(x, y: int): bool {.magic: "LeU", noSideEffect.} +proc `<=%` *(x, y: int8): bool {.magic: "LeU", noSideEffect.} +proc `<=%` *(x, y: int16): bool {.magic: "LeU", noSideEffect.} +proc `<=%` *(x, y: int32): bool {.magic: "LeU", noSideEffect.} +proc `<=%` *(x, y: int64): bool {.magic: "LeU64", noSideEffect.} + ## treats `x` and `y` as unsigned and compares them. + ## Returns true iff ``unsigned(x) <= unsigned(y)``. + +proc `<%` *(x, y: int): bool {.magic: "LtU", noSideEffect.} +proc `<%` *(x, y: int8): bool {.magic: "LtU", noSideEffect.} +proc `<%` *(x, y: int16): bool {.magic: "LtU", noSideEffect.} +proc `<%` *(x, y: int32): bool {.magic: "LtU", noSideEffect.} +proc `<%` *(x, y: int64): bool {.magic: "LtU64", noSideEffect.} + ## treats `x` and `y` as unsigned and compares them. + ## Returns true iff ``unsigned(x) < unsigned(y)``. + + +# floating point operations: proc `+` *(x: float): float {.magic: "UnaryPlusF64", noSideEffect.} proc `-` *(x: float): float {.magic: "UnaryMinusF64", noSideEffect.} proc `+` *(x, y: float): float {.magic: "AddF64", noSideEffect.} @@ -423,11 +599,21 @@ proc cmp*[T](x, y: T): int = proc cmp*(x, y: string): int {.noSideEffect.} ## Compare proc for strings. More efficient than the generic version. +proc `@` * [IDX, T](a: array[IDX, T]): seq[T] {. + magic: "ArrToSeq", nosideeffect.} + ## turns an array into a sequence. This most often useful for constructing + ## sequences with the array constructor: ``@[1, 2, 3]`` has the type + ## ``seq[int]``, while ``[1, 2, 3]`` has the type ``array[0..2, int]``. + # concat operator: -proc `&` * (x: string, y: char): string {.magic: "ConStrStr", noSideEffect.} -proc `&` * (x: char, y: char): string {.magic: "ConStrStr", noSideEffect.} -proc `&` * (x, y: string): string {.magic: "ConStrStr", noSideEffect.} -proc `&` * (x: char, y: string): string {.magic: "ConStrStr", noSideEffect.} +proc `&` * (x: string, y: char): string {. + magic: "ConStrStr", noSideEffect, merge.} +proc `&` * (x: char, y: char): string {. + magic: "ConStrStr", noSideEffect, merge.} +proc `&` * (x, y: string): string {. + magic: "ConStrStr", noSideEffect, merge.} +proc `&` * (x: char, y: string): string {. + magic: "ConStrStr", noSideEffect, merge.} ## is the `concatenation operator`. It concatenates `x` and `y`. proc add * (x: var string, y: char) {.magic: "AppendStrCh".} @@ -466,7 +652,7 @@ proc repr*[T](x: T): string {.magic: "Repr", noSideEffect.} type TAddress* = int ## is the signed integer type that should be used for converting - ## pointers to integer addresses. + ## pointers to integer addresses for readability. type BiggestInt* = int64 @@ -500,7 +686,7 @@ type # these work for most platforms: ## This is the same as the type ``long double`` in *C*. ## This C type is not supported by Nimrod's code generator - cstringArray* {.importc: "char**", nodecl.} = array [0..50_000, cstring] + cstringArray* {.importc: "char**", nodecl.} = ptr array [0..50_000, cstring] ## This is the same as the type ``char**`` in *C*. TEndian* = enum ## is a type describing the endianness of a processor. @@ -512,50 +698,49 @@ type # these work for most platforms: PInt32* = ptr Int32 ## an alias for ``ptr int32`` const - QuitSuccess* = 0 - ## is the value that should be passed to ``quit`` to indicate - ## success. - - QuitFailure* = 1 - ## is the value that should be passed to ``quit`` to indicate - ## failure. + isMainModule* {.magic: "IsMainModule".}: bool = false + ## is true only when accessed in the main module. This works thanks to + ## compiler magic. It is useful to embed testing code in a module. CompileDate* {.magic: "CompileDate"}: string = "0000-00-00" ## is the date of compilation as a string of the form - ## ``YYYY-MM-DD``. + ## ``YYYY-MM-DD``. This works thanks to compiler magic. CompileTime* {.magic: "CompileTime"}: string = "00:00:00" ## is the time of compilation as a string of the form - ## ``HH:MM:SS``. + ## ``HH:MM:SS``. This works thanks to compiler magic. NimrodVersion* {.magic: "NimrodVersion"}: string = "0.0.0" ## is the version of Nimrod as a string. + ## This works thanks to compiler magic. NimrodMajor* {.magic: "NimrodMajor"}: int = 0 ## is the major number of Nimrod's version. + ## This works thanks to compiler magic. NimrodMinor* {.magic: "NimrodMinor"}: int = 0 ## is the minor number of Nimrod's version. + ## This works thanks to compiler magic. NimrodPatch* {.magic: "NimrodPatch"}: int = 0 ## is the patch number of Nimrod's version. + ## This works thanks to compiler magic. cpuEndian* {.magic: "CpuEndian"}: TEndian = littleEndian - ## is the endianness of the target CPU. This is a valuable information - ## for low-level code only. - + ## is the endianness of the target CPU. This is a valuable piece of + ## information for low-level code only. This works thanks to compiler magic. proc toFloat*(i: int): float {. magic: "ToFloat", noSideEffect, importc: "toFloat".} ## converts an integer `i` into a ``float``. If the conversion - ## fails, `EInvalidValue` is raised. Note that on most platforms the - ## conversion cannot fail, however. + ## fails, `EInvalidValue` is raised. However, on most platforms the + ## conversion cannot fail. proc toBiggestFloat*(i: biggestint): biggestfloat {. magic: "ToBiggestFloat", noSideEffect, importc: "toBiggestFloat".} ## converts an biggestint `i` into a ``biggestfloat``. If the conversion - ## fails, `EInvalidValue` is raised. Note that on most platforms the - ## conversion cannot fail, however. + ## fails, `EInvalidValue` is raised. However, on most platforms the + ## conversion cannot fail. proc toInt*(f: float): int {. magic: "ToInt", noSideEffect, importc: "toInt".} @@ -569,15 +754,6 @@ proc toBiggestInt*(f: biggestfloat): biggestint {. ## rounds `f` if it does not contain an integer value. If the conversion ## fails (because `f` is infinite for example), `EInvalidValue` is raised. -proc quit*(errorcode: int = QuitSuccess) {. - magic: "Exit", importc: "exit", noDecl, noReturn.} - ## stops the program immediately; before stopping the program the - ## "quit procedures" are called in the opposite order they were added - ## with ``addQuitProc``. ``quit`` never returns and ignores any - ## exception that may have been raised by the quit procedures. - ## It does *not* call the garbage collector to free all the memory, - ## unless a quit procedure calls ``GC_collect``. - proc addQuitProc*(QuitProc: proc {.noconv.}) {.importc: "atexit", nodecl.} ## adds/registers a quit procedure. Each call to ``addQuitProc`` ## registers another quit procedure. Up to 30 procedures can be @@ -636,33 +812,29 @@ proc equalMem*(a, b: Pointer, size: int): bool {. ## *unsafe*. const - mallocHeader = if defined(useDL): "dlmalloc.h" else: "<stdlib.h>" + mallocHeader = "<stdlib.h>" proc alloc*(size: int): pointer {. - importc: if defined(useDL): "dlmalloc" else: "malloc", - header: mallocHeader, noconv.} + importc: "malloc", header: mallocHeader, noconv.} ## allocates a new memory block with at least ``size`` bytes. The ## block has to be freed with ``realloc(block, 0)`` or ## ``dealloc(block)``. The block is not initialized, so reading ## from it before writing to it is undefined behaviour! proc alloc0*(size: int): pointer {. - importc: if defined(useDL): "DL_ALLOC_0" else: "ALLOC_0", - header: mallocHeader, noconv.} + importc: "ALLOC_0", header: mallocHeader, noconv.} ## allocates a new memory block with at least ``size`` bytes. The ## block has to be freed with ``realloc(block, 0)`` or ## ``dealloc(block)``. The block is initialized with all bytes ## containing zero, so it is somewhat safer than ``alloc``. proc realloc*(p: Pointer, newsize: int): pointer {. - importc: if defined(useDL): "dlrealloc" else: "realloc", - header: mallocHeader, noconv.} + importc: "realloc", header: mallocHeader, noconv.} ## grows or shrinks a given memory block. If p is **nil** then a new ## memory block is returned. In either way the block has at least ## ``newsize`` bytes. If ``newsize == 0`` and p is not **nil** ## ``realloc`` calls ``dealloc(p)``. In other cases the block has to ## be freed with ``dealloc``. proc dealloc*(p: Pointer) {. - importc: if defined(useDL): "dlfree" else: "free", - header: mallocHeader, noconv.} + importc: "free", header: mallocHeader, noconv.} ## frees the memory allocated with ``alloc``, ``alloc0`` or ## ``realloc``. This procedure is dangerous! If one forgets to ## free the memory a leak occurs; if one tries to access freed @@ -687,79 +859,6 @@ proc swap*[T](a, b: var T) {.magic: "Swap".} ## swaps the values `a` and `b`. This is often more efficient than ## ``tmp = a; a = b; b = tmp``. Particularly useful for sorting algorithms. -proc ze*(x: int8): int {.magic: "Ze8ToI", noSideEffect.} - ## zero extends a smaller integer type to ``int``. This treats `x` as - ## unsigned. -proc ze*(x: int16): int {.magic: "Ze16ToI", noSideEffect.} - ## zero extends a smaller integer type to ``int``. This treats `x` as - ## unsigned. - -proc ze64*(x: int8): int64 {.magic: "Ze8ToI64", noSideEffect.} - ## zero extends a smaller integer type to ``int64``. This treats `x` as - ## unsigned. -proc ze64*(x: int16): int64 {.magic: "Ze16ToI64", noSideEffect.} - ## zero extends a smaller integer type to ``int64``. This treats `x` as - ## unsigned. - -proc ze64*(x: int32): int64 {.magic: "Ze32ToI64", noSideEffect.} - ## zero extends a smaller integer type to ``int64``. This treats `x` as - ## unsigned. -proc ze64*(x: int): int64 {.magic: "ZeIToI64", noDecl, noSideEffect.} - ## zero extends a smaller integer type to ``int64``. This treats `x` as - ## unsigned. Does nothing if the size of an ``int`` is the same as ``int64``. - ## (This is the case on 64 bit processors.) - -proc toU8*(x: int): int8 {.magic: "ToU8", noSideEffect.} - ## treats `x` as unsigned and converts it to a byte by taking the last 8 bits - ## from `x`. -proc toU16*(x: int): int16 {.magic: "ToU16", noSideEffect.} - ## treats `x` as unsigned and converts it to an ``int16`` by taking the last - ## 16 bits from `x`. -proc toU32*(x: int64): int32 {.magic: "ToU32", noSideEffect.} - ## treats `x` as unsigned and converts it to an ``int32`` by taking the - ## last 32 bits from `x`. - -proc `+%` *(x, y: int): int {.magic: "AddU", noSideEffect.} -proc `+%` *(x, y: int64): int64 {.magic: "AddU64", noSideEffect.} - ## treats `x` and `y` as unsigned and adds them. The result is truncated to - ## fit into the result. This implements modulo arithmetic. No overflow - ## errors are possible. - -proc `-%` *(x, y: int): int {.magic: "SubU", noSideEffect.} -proc `-%` *(x, y: int64): int64 {.magic: "SubU64", noSideEffect.} - ## treats `x` and `y` as unsigned and subtracts them. The result is - ## truncated to fit into the result. This implements modulo arithmetic. - ## No overflow errors are possible. - -proc `*%` *(x, y: int): int {.magic: "MulU", noSideEffect.} -proc `*%` *(x, y: int64): int64 {.magic: "MulU64", noSideEffect.} - ## treats `x` and `y` as unsigned and multiplies them. The result is - ## truncated to fit into the result. This implements modulo arithmetic. - ## No overflow errors are possible. - -proc `/%` *(x, y: int): int {.magic: "DivU", noSideEffect.} -proc `/%` *(x, y: int64): int64 {.magic: "DivU64", noSideEffect.} - ## treats `x` and `y` as unsigned and divides them. The result is - ## truncated to fit into the result. This implements modulo arithmetic. - ## No overflow errors are possible. - -proc `%%` *(x, y: int): int {.magic: "ModU", noSideEffect.} -proc `%%` *(x, y: int64): int64 {.magic: "ModU64", noSideEffect.} - ## treats `x` and `y` as unsigned and compute the modulo of `x` and `y`. - ## The result is truncated to fit into the result. - ## This implements modulo arithmetic. - ## No overflow errors are possible. - -proc `<=%` *(x, y: int): bool {.magic: "LeU", noSideEffect.} -proc `<=%` *(x, y: int64): bool {.magic: "LeU64", noSideEffect.} - ## treats `x` and `y` as unsigned and compares them. - ## Returns true iff ``unsigned(x) <= unsigned(y)``. - -proc `<%` *(x, y: int): bool {.magic: "LtU", noSideEffect.} -proc `<%` *(x, y: int64): bool {.magic: "LtU64", noSideEffect.} - ## treats `x` and `y` as unsigned and compares them. - ## Returns true iff ``unsigned(x) < unsigned(y)``. - template `>=%` *(x, y: expr): expr = y <=% x ## treats `x` and `y` as unsigned and compares them. ## Returns true iff ``unsigned(x) >= unsigned(y)``. @@ -803,17 +902,19 @@ proc getRefcount*[T](x: ref T): int {.importc: "getRefcount".} ## value is implementation-dependant. #proc writeStackTrace() {.export: "writeStackTrace".} -proc getCurrentExceptionMsg*(): string {.exportc.} - ## retrieves the error message that was attached to the current - ## exception; if there is none, "" is returned. + +when not defined(NimrodVM): + proc getCurrentExceptionMsg*(): string {.exportc.} + ## retrieves the error message that was attached to the current + ## exception; if there is none, "" is returned. # new constants: const - inf* {.magic: "Inf".} = 0.0 + inf* {.magic: "Inf".} = 1.0 / 0.0 ## contains the IEEE floating point value of positive infinity. - neginf* {.magic: "NegInf".} = 0.0 + neginf* {.magic: "NegInf".} = -inf ## contains the IEEE floating point value of negative infinity. - nan* {.magic: "NaN".} = 0.0 + nan* {.magic: "NaN".} = 0.0 / 0.0 ## contains an IEEE floating point value of *Not A Number*. Note ## that you cannot compare a floating point value to this value ## and expect a reasonable result - use the `classify` procedure @@ -826,20 +927,16 @@ var ## Only code compiled with the ``debugger:on`` switch calls this hook. # GC interface: -when defined(Unix) and not defined(macosX) and not defined(linux): - # BUGFIX for macosX - {.define: nativeDL.} -when defined(useDL) or defined(nativeDL): - proc getOccupiedMem*(): int - ## returns the number of bytes that are owned by the process and hold data. +proc getOccupiedMem*(): int + ## returns the number of bytes that are owned by the process and hold data. - proc getFreeMem*(): int - ## returns the number of bytes that are owned by the process, but do not - ## hold any meaningful data. +proc getFreeMem*(): int + ## returns the number of bytes that are owned by the process, but do not + ## hold any meaningful data. - proc getTotalMem*(): int - ## returns the number of bytes that are owned by the process. +proc getTotalMem*(): int + ## returns the number of bytes that are owned by the process. iterator countdown*[T](a, b: T, step = 1): T {.inline.} = @@ -906,7 +1003,6 @@ iterator items*(a: cstring): char {.inline.} = yield a[i] inc(i) - proc isNil*[T](x: seq[T]): bool {.noSideEffect, magic: "IsNil".} proc isNil*[T](x: ref T): bool {.noSideEffect, magic: "IsNil".} proc isNil*(x: string): bool {.noSideEffect, magic: "IsNil".} @@ -922,23 +1018,20 @@ proc isNil*(x: cstring): bool {.noSideEffect, magic: "IsNil".} # once in the system module. proc `&` *[T](x, y: seq[T]): seq[T] {.noSideEffect.} = - result = [] - setLen(result, x.len + y.len) + newSeq(result, x.len + y.len) for i in 0..x.len-1: result[i] = x[i] for i in 0..y.len-1: result[i] = y[i] proc `&` *[T](x: seq[T], y: T): seq[T] {.noSideEffect.} = - result = [] - setLen(x.len + 1) + newSeq(result, x.len + 1) for i in 0..x.len-1: result[i] = x[i] result[x.len] = y proc `&` *[T](x: T, y: seq[T]): seq[T] {.noSideEffect.} = - result = [] - setLen(y.len + 1) + newSeq(result, y.len + 1) for i in 0..y.len-1: result[i] = y[i] result[y.len] = x @@ -946,24 +1039,35 @@ proc `&` *[T](x: T, y: seq[T]): seq[T] {.noSideEffect.} = proc `&` *[T](x, y: T): seq[T] {.noSideEffect.} = return [x, y] -when not defined(ECMAScript): # XXX make this local procs - proc seqToPtr*[T](x: seq[T]): pointer {.inline, nosideeffect.} = - result = cast[pointer](x) -else: - proc seqToPtr*[T](x: seq[T]): pointer {.pure, nosideeffect.} = - asm """return `x`""" - -proc `==` *[T](x, y: seq[T]): bool {.noSideEffect.} = - ## Generic equals operator for sequences: relies on a equals operator for - ## the element type `T`. - if seqToPtr(x) == seqToPtr(y): - result = true - elif seqToPtr(x) == nil or seqToPtr(y) == nil: - result = false - elif x.len == y.len: - for i in 0..x.len-1: - if x[i] != y[i]: return false - result = true +when not defined(NimrodVM): + when not defined(ECMAScript): + # XXX make this local procs + proc seqToPtr*[T](x: seq[T]): pointer {.inline, nosideeffect.} = + result = cast[pointer](x) + else: + proc seqToPtr*[T](x: seq[T]): pointer {.pure, nosideeffect.} = + asm """return `x`""" + + proc `==` *[T](x, y: seq[T]): bool {.noSideEffect.} = + ## Generic equals operator for sequences: relies on a equals operator for + ## the element type `T`. + if seqToPtr(x) == seqToPtr(y): + result = true + elif seqToPtr(x) == nil or seqToPtr(y) == nil: + result = false + elif x.len == y.len: + for i in 0..x.len-1: + if x[i] != y[i]: return false + result = true + +proc find*[T, S](a: T, item: S): int {.inline.} = + ## Returns the first index of `item` in `a` or -1 if not found. This requires + ## appropriate `==` and `items` procs to work. + result = 0 + for i in items(a): + if i == item: return + inc(result) + result = -1 # ----------------- FPU ------------------------------------------------------ @@ -985,7 +1089,7 @@ proc GC_enable*() proc GC_fullCollect*() ## forces a full garbage collection pass. - ## Ordinary code does not need to call this. + ## Ordinary code does not need to call this (and should not). type TGC_Strategy* = enum ## the strategy the GC should use for the application @@ -1005,12 +1109,28 @@ proc GC_disableMarkAndSweep*() ## does not create cycles. Thus the mark and sweep phase can be deactivated ## and activated separately from the rest of the GC. - -{.push checks: off, line_dir: off, debugger: off, - assertions: on.} # obviously we cannot generate checking operations here :-) - # because it would yield into an endless recursion - # however, stack-traces are available for most parts - # of the code +proc GC_getStatistics*(): string + ## returns an informative string about the GC's activity. This may be useful + ## for tweaking. + +proc GC_ref*[T](x: ref T) {.magic: "GCref".} +proc GC_ref*[T](x: seq[T]) {.magic: "GCref".} +proc GC_ref*(x: string) {.magic: "GCref".} + ## marks the object `x` as referenced, so that it will not be freed until + ## it is unmarked via `GC_unref`. If called n-times for the same object `x`, + ## n calls to `GC_unref` are needed to unmark `x`. + +proc GC_unref*[T](x: ref T) {.magic: "GCunref".} +proc GC_unref*[T](x: seq[T]) {.magic: "GCunref".} +proc GC_unref*(x: string) {.magic: "GCunref".} + ## see the documentation of `GC_ref`. + + +{.push checks: off, line_dir: off, debugger: off.} +# obviously we cannot generate checking operations here :-) +# because it would yield into an endless recursion +# however, stack-traces are available for most parts +# of the code proc echo*[Ty](x: Ty) {.inline.} ## equivalent to ``writeln(stdout, x); flush(stdout)``. BUT: This is @@ -1025,7 +1145,29 @@ template newException(exceptn, message: expr): expr = e.msg = message e -when not defined(EcmaScript): +const + QuitSuccess* = 0 + ## is the value that should be passed to ``quit`` to indicate + ## success. + + QuitFailure* = 1 + ## is the value that should be passed to ``quit`` to indicate + ## failure. + +proc quit*(errorcode: int = QuitSuccess) {. + magic: "Exit", importc: "exit", noDecl, noReturn.} + ## stops the program immediately; before stopping the program the + ## "quit procedures" are called in the opposite order they were added + ## with ``addQuitProc``. ``quit`` never returns and ignores any + ## exception that may have been raised by the quit procedures. + ## It does *not* call the garbage collector to free all the memory, + ## unless a quit procedure calls ``GC_collect``. + +when not defined(EcmaScript) and not defined(NimrodVM): + proc quit*(errormsg: string) {.noReturn.} + ## a shorthand for ``echo(errormsg); quit(quitFailure)``. + +when not defined(EcmaScript) and not defined(NimrodVM): include hti @@ -1036,6 +1178,7 @@ when not defined(EcmaScript): strDesc.size = sizeof(string) strDesc.kind = tyString + strDesc.flags = {ntfAcyclic} initGC() # BUGFIX: need to be called here! {.push stack_trace: off.} @@ -1043,12 +1186,12 @@ when not defined(EcmaScript): include ansi_c proc cmp(x, y: string): int = - return c_strcmp(x, y) + return int(c_strcmp(x, y)) + const pccHack = if defined(pcc): "_" else: "" # Hack for PCC when defined(windows): # work-around C's sucking abstraction: # BUGFIX: stdin and stdout should be binary files! - const pccHack = if defined(pcc): "_" else: "" # Hack for PCC proc setmode(handle, mode: int) {.importc: pccHack & "setmode", header: "<io.h>".} proc fileno(f: C_TextFileStar): int {.importc: pccHack & "fileno", @@ -1082,6 +1225,9 @@ when not defined(EcmaScript): fmAppend ## Open the file for writing only; append data ## at the end. + TFileHandle* = cint ## type that represents an OS file handle; this is + ## useful for low-level file access + # text file handling: var stdin* {.importc: "stdin", noDecl.}: TFile ## The standard input stream. @@ -1106,6 +1252,12 @@ when not defined(EcmaScript): ## that the programmer needs to provide an appropriate error message anyway ## (yes, even in scripts). + proc OpenFile*(f: var TFile, filehandle: TFileHandle, + mode: TFileMode = fmRead): Bool + ## Creates a ``TFile`` from a `filehandle` with given `mode`. + ## + ## Default mode is readonly. Returns true iff the file could be opened. + proc CloseFile*(f: TFile) {.importc: "fclose", nodecl.} ## Closes the file. proc EndOfFile*(f: TFile): Bool @@ -1201,6 +1353,15 @@ when not defined(EcmaScript): yield res CloseFile(f) + proc fileHandle*(f: TFile): TFileHandle {.importc: "fileno", + header: "<stdio.h>"} + ## returns the OS file handle of the file ``f``. This is only useful for + ## platform specific programming. + + proc quit(errormsg: string) = + echo(errormsg) + quit(quitFailure) + # ---------------------------------------------------------------------------- include excpt @@ -1211,10 +1372,10 @@ when not defined(EcmaScript): # sequence type declarations here because the GC needs them too: type - TGenericSeq {.importc, nodecl, final.} = object + TGenericSeq {.compilerproc, pure.} = object len, space: int - PGenericSeq {.importc, nodecl.} = ptr TGenericSeq + PGenericSeq {.exportc.} = ptr TGenericSeq const GenericSeqSize = (2 * sizeof(int)) @@ -1235,10 +1396,32 @@ when not defined(EcmaScript): {.push stack_trace: off.} when defined(endb): include debugger + + when defined(profiler): + include profiler {.pop.} # stacktrace -else: +elif defined(ecmaScript): include ecmasys +elif defined(NimrodVM): + # Stubs for the GC interface: + proc GC_disable() = nil + proc GC_enable() = nil + proc GC_fullCollect() = nil + proc GC_setStrategy(strategy: TGC_Strategy) = nil + proc GC_enableMarkAndSweep() = nil + proc GC_disableMarkAndSweep() = nil + proc GC_getStatistics(): string = return "" + + proc getOccupiedMem(): int = return -1 + proc getFreeMem(): int = return -1 + proc getTotalMem(): int = return -1 + proc echo[Ty](x: Ty) = nil + + proc cmp(x, y: string): int = + if x == y: return 0 + if x < y: return -1 + return 1 include macros diff --git a/lib/times.nim b/lib/times.nim index 93524f568..774c9930c 100644 --- a/lib/times.nim +++ b/lib/times.nim @@ -23,8 +23,8 @@ type TWeekDay* = enum ## represents a weekday dMon, dTue, dWed, dThu, dFri, dSat, dSun - TTime* {.importc: "time_t", final.} = object ## abstract type that - ## represents a time + TTime* {.importc: "time_t", header: "<time.h>", final.} = object ## abstract type that + ## represents a time when defined(ECMAScript): getDay: proc (): int getFullYear: proc (): int @@ -96,11 +96,9 @@ proc TimeInfoToTime*(timeInfo: TTimeInfo): TTime ## them from the other information in the broken-down time structure. proc `$` *(timeInfo: TTimeInfo): string - ## converts a `TTimeInfo` object to a - ## string representation. + ## converts a `TTimeInfo` object to a string representation. proc `$` *(time: TTime): string - ## converts a calendar time to a - ## string representation. + ## converts a calendar time to a string representation. proc getDateStr*(): string ## gets the current date as a string of the format @@ -111,6 +109,14 @@ proc getClockStr*(): string proc `-` *(a, b: TTime): int64 ## computes the difference of two calendar times. Result is in seconds. +proc `<` * (a, b: TTime): bool = + ## returns true iff ``a < b``, that is iff a happened before b. + result = a - b < 0 + +proc `<=` * (a, b: TTime): bool = + ## returns true iff ``a <= b``. + result = a - b <= 0 + proc getStartMilsecs*(): int ## get the miliseconds from the start of the program @@ -162,7 +168,7 @@ when not defined(ECMAScript): result.hour = int(tm.hour) result.monthday = int(tm.monthday) result.month = TMonth(tm.month) - result.year = tm.year + 1900 + result.year = tm.year + 1900'i32 result.weekday = weekDays[int(tm.weekDay)] result.yearday = int(tm.yearday) @@ -180,8 +186,7 @@ when not defined(ECMAScript): result.isdst = -1 proc `-` (a, b: TTime): int64 = - return toInt(difftime(a, b)) # XXX: toBiggestInt is needed here, but - # Nim does not support it! + return toBiggestInt(difftime(a, b)) proc getStartMilsecs(): int = return clock() div (clocksPerSec div 1000) proc getTime(): TTime = return timec(nil) @@ -202,12 +207,23 @@ when not defined(ECMAScript): # because the header of mktime is broken in my version of libc return mktime(timeInfoToTM(cTimeInfo)) + proc toStringTillNL(p: cstring): string = + result = "" + var i = 0 + while p[i] != '\0' and p[i] != '\10' and p[i] != '\13': + add(result, p[i]) + inc(i) + return result + proc `$`(timeInfo: TTimeInfo): string = - return $asctime(timeInfoToTM(timeInfo)) + # BUGFIX: asctime returns a newline at the end! + var p = asctime(timeInfoToTM(timeInfo)) + result = toStringTillNL(p) proc `$`(time: TTime): string = + # BUGFIX: ctime returns a newline at the end! var a = time - return $ctime(addr(a)) + return toStringTillNL(ctime(addr(a))) else: proc getTime(): TTime {.importc: "new Date", nodecl.} diff --git a/lib/unicode.nim b/lib/unicode.nim index 6829ede50..de3b80c94 100644 --- a/lib/unicode.nim +++ b/lib/unicode.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2006 Andreas Rumpf +# (c) Copyright 2008 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -9,7 +9,7 @@ type TUniChar* = int32 ## type that can hold any Unicode character - TUniChar16* = int16 ## + TUniChar16* = int16 ## 16 bit Unicode character template ones(n) = ((1 shl n)-1) diff --git a/lib/windows/windows.nim b/lib/windows/windows.nim index ab87bbd98..d14f56d12 100644 --- a/lib/windows/windows.nim +++ b/lib/windows/windows.nim @@ -23,7 +23,7 @@ type SHORT* = int16 WINT* = int32 LONG* = int32 - DWORD* = int + DWORD* = int32 PINTEGER* = ptr int32 PBOOL* = ptr WINBOOL LONGLONG* = int64 @@ -39,9 +39,9 @@ type ULONG_PTR* = TAddress DWORDLONG* = int64 # was unsigned long PDWORDLONG* = ptr DWORDLONG - HANDLE* = int32 + HANDLE* = int THandle* = HANDLE - HRESULT* = int32 + HRESULT* = int PHRESULT* = ptr HRESULT HACCEL* = HANDLE HBITMAP* = HANDLE @@ -5030,10 +5030,9 @@ const # added manually PM, TREEITEM is not defined in the C headers type - TREEITEM* {.final.} = object - HTREEITEM* = ptr TREEITEM - TTREEITEM* = TREEITEM - PTREEITEM* = ptr TREEITEM # was #define dname def_expr + TTREEITEM* {.final, pure.} = object + HTREEITEM* = ptr TTREEITEM + PTREEITEM* = ptr TTREEITEM proc TVI_ROOT*(): HTREEITEM # was #define dname def_expr @@ -6481,31 +6480,27 @@ type # WARNING # va_list is just a dummy record # MvdV: Nevertheless it should be a pointer type, not a record va_list* = cstring - ABC* {.final.} = object + TABC* {.final, pure.} = object abcA*: int32 abcB*: UINT abcC*: int32 - LPABC* = ptr ABC - TABC* = ABC - PABC* = ptr ABC - ABCFLOAT* {.final.} = object + LPABC* = ptr TABC + PABC* = ptr TABC + TABCFLOAT* {.final, pure.} = object abcfA*: float32 abcfB*: float32 abcfC*: float32 + LPABCFLOAT* = ptr TABCFLOAT + PABCFLOAT* = ptr TABCFLOAT - LPABCFLOAT* = ptr ABCFLOAT - TABCFLOAT* = ABCFLOAT - PABCFLOAT* = ptr ABCFLOAT - ACCEL* {.final.} = object + TACCEL* {.final, pure.} = object fVirt*: int8 key*: int16 cmd*: int16 - - LPACCEL* = ptr ACCEL - TACCEL* = ACCEL - PACCEL* = ptr ACCEL - ACE_HEADER* {.final.} = object + LPACCEL* = ptr TACCEL + PACCEL* = ptr TACCEL + ACE_HEADER* {.final, pure.} = object AceType*: int8 AceFlags*: int8 AceSize*: int16 @@ -6514,27 +6509,27 @@ type # WARNING PACE_HEADER* = ptr ACE_HEADER ACCESS_MASK* = DWORD REGSAM* = ACCESS_MASK - ACCESS_ALLOWED_ACE* {.final.} = object + ACCESS_ALLOWED_ACE* {.final, pure.} = object Header*: ACE_HEADER Mask*: ACCESS_MASK SidStart*: DWORD TACCESS_ALLOWED_ACE* = ACCESS_ALLOWED_ACE PACCESS_ALLOWED_ACE* = ptr ACCESS_ALLOWED_ACE - ACCESS_DENIED_ACE* {.final.} = object + ACCESS_DENIED_ACE* {.final, pure.} = object Header*: ACE_HEADER Mask*: ACCESS_MASK SidStart*: DWORD TACCESS_DENIED_ACE* = ACCESS_DENIED_ACE - ACCESSTIMEOUT* {.final.} = object + ACCESSTIMEOUT* {.final, pure.} = object cbSize*: UINT dwFlags*: DWORD iTimeOutMSec*: DWORD TACCESSTIMEOUT* = ACCESSTIMEOUT PACCESSTIMEOUT* = ptr ACCESSTIMEOUT - ACL* {.final.} = object + ACL* {.final, pure.} = object AclRevision*: int8 Sbz1*: int8 AclSize*: int16 @@ -6543,23 +6538,23 @@ type # WARNING PACL* = ptr ACL TACL* = ACL - TACL_REVISION_INFORMATION* {.final.} = object + TACL_REVISION_INFORMATION* {.final, pure.} = object AclRevision*: DWORD PACLREVISIONINFORMATION* = ptr TACL_REVISION_INFORMATION - TACL_SIZE_INFORMATION* {.final.} = object + TACL_SIZE_INFORMATION* {.final, pure.} = object AceCount*: DWORD AclBytesInUse*: DWORD AclBytesFree*: DWORD PACLSIZEINFORMATION* = ptr TACL_SIZE_INFORMATION - ACTION_HEADER* {.final.} = object + ACTION_HEADER* {.final, pure.} = object transport_id*: ULONG action_code*: USHORT reserved*: USHORT TACTIONHEADER* = ACTION_HEADER PACTIONHEADER* = ptr ACTION_HEADER - ADAPTER_STATUS* {.final.} = object + ADAPTER_STATUS* {.final, pure.} = object adapter_address*: array[0..5, UCHAR] rev_major*: UCHAR reserved0*: UCHAR @@ -6590,33 +6585,33 @@ type # WARNING TADAPTERSTATUS* = ADAPTER_STATUS PADAPTERSTATUS* = ptr ADAPTER_STATUS - ADDJOB_INFO_1* {.final.} = object + ADDJOB_INFO_1* {.final, pure.} = object Path*: LPTSTR JobId*: DWORD TADDJOB_INFO_1* = ADDJOB_INFO_1 PADDJOB_INFO_1* = ptr ADDJOB_INFO_1 - ANIMATIONINFO* {.final.} = object + ANIMATIONINFO* {.final, pure.} = object cbSize*: UINT iMinAnimate*: int32 LPANIMATIONINFO* = ptr ANIMATIONINFO TANIMATIONINFO* = ANIMATIONINFO PANIMATIONINFO* = ptr ANIMATIONINFO - POINT* {.final.} = object + POINT* {.final, pure.} = object x*: LONG y*: LONG LPPOINT* = ptr POINT TPOINT* = POINT PPOINT* = ptr POINT - RECT* {.final.} = object + RECT* {.final, pure.} = object TopLeft*, BottomRight*: TPoint LPRECT* = ptr RECT TRECT* = RECT PRECT* = ptr RECT - RECTL* {.final.} = object + RECTL* {.final, pure.} = object left*: LONG top*: LONG right*: LONG @@ -6624,7 +6619,7 @@ type # WARNING TRECTL* = RECTL PRECTL* = ptr RECTL - APPBARDATA* {.final.} = object + APPBARDATA* {.final, pure.} = object cbSize*: DWORD hWnd*: HWND uCallbackMessage*: UINT @@ -6634,7 +6629,7 @@ type # WARNING TAppBarData* = APPBARDATA PAppBarData* = ptr APPBARDATA - BITMAP* {.final.} = object + BITMAP* {.final, pure.} = object bmType*: LONG bmWidth*: LONG bmHeight*: LONG @@ -6646,9 +6641,8 @@ type # WARNING PBITMAP* = ptr BITMAP NPBITMAP* = ptr BITMAP LPBITMAP* = ptr BITMAP - tagBITMAP* = BITMAP TBITMAP* = BITMAP - BITMAPCOREHEADER* {.final.} = object + BITMAPCOREHEADER* {.final, pure.} = object bcSize*: DWORD bcWidth*: int16 bcHeight*: int16 @@ -6657,14 +6651,14 @@ type # WARNING TBITMAPCOREHEADER* = BITMAPCOREHEADER PBITMAPCOREHEADER* = ptr BITMAPCOREHEADER - RGBTRIPLE* {.final.} = object + RGBTRIPLE* {.final, pure.} = object rgbtBlue*: int8 rgbtGreen*: int8 rgbtRed*: int8 TRGBTRIPLE* = RGBTRIPLE PRGBTRIPLE* = ptr RGBTRIPLE - BITMAPCOREINFO* {.final.} = object + BITMAPCOREINFO* {.final, pure.} = object bmciHeader*: BITMAPCOREHEADER bmciColors*: array[0..0, RGBTRIPLE] @@ -6674,7 +6668,7 @@ type # WARNING # WORD bfReserved1; # WORD bfReserved2; # in declarator_list - BITMAPINFOHEADER* {.final.} = object + BITMAPINFOHEADER* {.final, pure.} = object biSize*: DWORD biWidth*: LONG biHeight*: LONG @@ -6690,16 +6684,15 @@ type # WARNING LPBITMAPINFOHEADER* = ptr BITMAPINFOHEADER TBITMAPINFOHEADER* = BITMAPINFOHEADER PBITMAPINFOHEADER* = ptr BITMAPINFOHEADER - RGBQUAD* {.final.} = object + RGBQUAD* {.final, pure.} = object rgbBlue*: int8 rgbGreen*: int8 rgbRed*: int8 rgbReserved*: int8 - tagRGBQUAD* = RGBQUAD TRGBQUAD* = RGBQUAD PRGBQUAD* = ptr RGBQUAD - BITMAPINFO* {.final.} = object + BITMAPINFO* {.final, pure.} = object bmiHeader*: BITMAPINFOHEADER bmiColors*: array[0..0, RGBQUAD] @@ -6710,25 +6703,23 @@ type # WARNING LPFXPT2DOT30* = ptr FXPT2DOT30 TPFXPT2DOT30* = FXPT2DOT30 PPFXPT2DOT30* = ptr FXPT2DOT30 - CIEXYZ* {.final.} = object + CIEXYZ* {.final, pure.} = object ciexyzX*: FXPT2DOT30 ciexyzY*: FXPT2DOT30 ciexyzZ*: FXPT2DOT30 - tagCIEXYZ* = CIEXYZ LPCIEXYZ* = ptr CIEXYZ TPCIEXYZ* = CIEXYZ PCIEXYZ* = ptr CIEXYZ - CIEXYZTRIPLE* {.final.} = object + CIEXYZTRIPLE* {.final, pure.} = object ciexyzRed*: CIEXYZ ciexyzGreen*: CIEXYZ ciexyzBlue*: CIEXYZ - tagCIEXYZTRIPLE* = CIEXYZTRIPLE LPCIEXYZTRIPLE* = ptr CIEXYZTRIPLE TCIEXYZTRIPLE* = CIEXYZTRIPLE PCIEXYZTRIPLE* = ptr CIEXYZTRIPLE - BITMAPV4HEADER* {.final.} = object + BITMAPV4HEADER* {.final, pure.} = object bV4Size*: DWORD bV4Width*: LONG bV4Height*: LONG @@ -6753,20 +6744,20 @@ type # WARNING LPBITMAPV4HEADER* = ptr BITMAPV4HEADER TBITMAPV4HEADER* = BITMAPV4HEADER PBITMAPV4HEADER* = ptr BITMAPV4HEADER - BITMAPFILEHEADER* {.final.} = object + BITMAPFILEHEADER* {.final, pure.} = object bfType*: int16 bfSize*: DWord bfReserved1*: int16 bfReserved2*: int16 bfOffBits*: DWord - BLOB* {.final.} = object + BLOB* {.final, pure.} = object cbSize*: ULONG pBlobData*: ptr int8 TBLOB* = BLOB PBLOB* = ptr BLOB - SHITEMID* {.final.} = object + SHITEMID* {.final, pure.} = object cb*: USHORT abID*: array[0..0, int8] @@ -6774,14 +6765,14 @@ type # WARNING LPCSHITEMID* = ptr SHITEMID TSHITEMID* = SHITEMID PSHITEMID* = ptr SHITEMID - ITEMIDLIST* {.final.} = object + ITEMIDLIST* {.final, pure.} = object mkid*: SHITEMID LPITEMIDLIST* = ptr ITEMIDLIST LPCITEMIDLIST* = ptr ITEMIDLIST TITEMIDLIST* = ITEMIDLIST PITEMIDLIST* = ptr ITEMIDLIST - BROWSEINFO* {.final.} = object + BROWSEINFO* {.final, pure.} = object hwndOwner*: HWND pidlRoot*: LPCITEMIDLIST pszDisplayName*: LPSTR @@ -6794,14 +6785,14 @@ type # WARNING LPBROWSEINFO* = ptr BROWSEINFO Tbrowseinfo* = BROWSEINFO PBROWSEINFO* = ptr BROWSEINFO - FILETIME* {.final.} = object + FILETIME* {.final, pure.} = object dwLowDateTime*: DWORD dwHighDateTime*: DWORD LPFILETIME* = ptr FILETIME TFILETIME* = FILETIME PFILETIME* = ptr FILETIME - BY_HANDLE_FILE_INFORMATION* {.final.} = object + BY_HANDLE_FILE_INFORMATION* {.final, pure.} = object dwFileAttributes*: DWORD ftCreationTime*: FILETIME ftLastAccessTime*: FILETIME @@ -6816,34 +6807,34 @@ type # WARNING LPBY_HANDLE_FILE_INFORMATION* = ptr BY_HANDLE_FILE_INFORMATION TBYHANDLEFILEINFORMATION* = BY_HANDLE_FILE_INFORMATION PBYHANDLEFILEINFORMATION* = ptr BY_HANDLE_FILE_INFORMATION - FIXED* {.final.} = object + FIXED* {.final, pure.} = object fract*: int16 value*: SHORT TFIXED* = FIXED PFIXED* = ptr FIXED - POINTFX* {.final.} = object + POINTFX* {.final, pure.} = object x*: FIXED y*: FIXED TPOINTFX* = POINTFX PPOINTFX* = ptr POINTFX - POINTL* {.final.} = object + POINTL* {.final, pure.} = object x*: LONG y*: LONG TPOINTL* = POINTL PPOINTL* = ptr POINTL - TSmallPoint* {.final.} = object + TSmallPoint* {.final, pure.} = object X*, Y*: SHORT - POINTS* {.final.} = object + POINTS* {.final, pure.} = object x*: SHORT y*: SHORT TPOINTS* = POINTS PPOINTS* = ptr POINTS - CANDIDATEFORM* {.final.} = object + CANDIDATEFORM* {.final, pure.} = object dwIndex*: DWORD dwStyle*: DWORD ptCurrentPos*: POINT @@ -6852,7 +6843,7 @@ type # WARNING LPCANDIDATEFORM* = ptr CANDIDATEFORM TCANDIDATEFORM* = CANDIDATEFORM PCANDIDATEFORM* = ptr CANDIDATEFORM - CANDIDATELIST* {.final.} = object + CANDIDATELIST* {.final, pure.} = object dwSize*: DWORD dwStyle*: DWORD dwCount*: DWORD @@ -6864,7 +6855,7 @@ type # WARNING LPCANDIDATELIST* = ptr CANDIDATELIST TCANDIDATELIST* = CANDIDATELIST PCANDIDATELIST* = ptr CANDIDATELIST - CREATESTRUCT* {.final.} = object + CREATESTRUCT* {.final, pure.} = object lpCreateParams*: LPVOID hInstance*: HINST hMenu*: HMENU @@ -6881,25 +6872,25 @@ type # WARNING LPCREATESTRUCT* = ptr CREATESTRUCT TCREATESTRUCT* = CREATESTRUCT PCREATESTRUCT* = ptr CREATESTRUCT - CBT_CREATEWND* {.final.} = object + CBT_CREATEWND* {.final, pure.} = object lpcs*: LPCREATESTRUCT hwndInsertAfter*: HWND TCBT_CREATEWND* = CBT_CREATEWND PCBT_CREATEWND* = ptr CBT_CREATEWND - CBTACTIVATESTRUCT* {.final.} = object + CBTACTIVATESTRUCT* {.final, pure.} = object fMouse*: WINBOOL hWndActive*: HWND TCBTACTIVATESTRUCT* = CBTACTIVATESTRUCT PCBTACTIVATESTRUCT* = ptr CBTACTIVATESTRUCT - CHAR_INFO* {.final.} = object + CHAR_INFO* {.final, pure.} = object UnicodeChar*: WCHAR Attributes*: int16 # other union part: AsciiChar : CHAR TCHAR_INFO* = CHAR_INFO PCHAR_INFO* = ptr CHAR_INFO - CHARFORMAT* {.final.} = object + CHARFORMAT* {.final, pure.} = object cbSize*: UINT dwMask*: DWORD dwEffects*: DWORD @@ -6912,27 +6903,26 @@ type # WARNING Tcharformat* = CHARFORMAT Pcharformat* = ptr CHARFORMAT - CHARRANGE* {.final.} = object + CHARRANGE* {.final, pure.} = object cpMin*: LONG cpMax*: LONG Tcharrange* = CHARRANGE Pcharrange* = ptr CHARRANGE - CHARSET* {.final.} = object + CHARSET* {.final, pure.} = object aflBlock*: array[0..2, DWORD] flLang*: DWORD TCHARSET* = CHARSET PCHARSET* = ptr CHARSET - FONTSIGNATURE* {.final.} = object + FONTSIGNATURE* {.final, pure.} = object fsUsb*: array[0..3, DWORD] fsCsb*: array[0..1, DWORD] LPFONTSIGNATURE* = ptr FONTSIGNATURE - tagFONTSIGNATURE* = FONTSIGNATURE TFONTSIGNATURE* = FONTSIGNATURE PFONTSIGNATURE* = ptr FONTSIGNATURE - CHARSETINFO* {.final.} = object + CHARSETINFO* {.final, pure.} = object ciCharset*: UINT ciACP*: UINT fs*: FONTSIGNATURE @@ -6940,7 +6930,7 @@ type # WARNING LPCHARSETINFO* = ptr CHARSETINFO TCHARSETINFO* = CHARSETINFO PCHARSETINFO* = ptr CHARSETINFO #CHOOSECOLOR = record confilcts with function ChooseColor - TCHOOSECOLOR* {.final.} = object + TCHOOSECOLOR* {.final, pure.} = object lStructSize*: DWORD hwndOwner*: HWND hInstance*: HWND @@ -6953,7 +6943,7 @@ type # WARNING LPCHOOSECOLOR* = ptr TCHOOSECOLOR PCHOOSECOLOR* = ptr TCHOOSECOLOR - LOGFONT* {.final.} = object + LOGFONT* {.final, pure.} = object lfHeight*: LONG lfWidth*: LONG lfEscapement*: LONG @@ -6974,7 +6964,7 @@ type # WARNING TLOGFONTA* = LOGFONT PLOGFONT* = ptr LOGFONT PLOGFONTA* = PLOGFONT - LOGFONTW* {.final.} = object + LOGFONTW* {.final, pure.} = object lfHeight*: LONG lfWidth*: LONG lfEscapement*: LONG @@ -6994,7 +6984,7 @@ type # WARNING NPLOGFONTW* = ptr LOGFONTW TLogFontW* = LOGFONTW PLogFontW* = ptr TLogFontW - TCHOOSEFONT* {.final.} = object + TCHOOSEFONT* {.final, pure.} = object lStructSize*: DWORD hwndOwner*: HWND hDC*: HDC @@ -7014,22 +7004,21 @@ type # WARNING LPCHOOSEFONT* = ptr TCHOOSEFONT PCHOOSEFONT* = ptr TCHOOSEFONT - CIDA* {.final.} = object + CIDA* {.final, pure.} = object cidl*: UINT aoffset*: array[0..0, UINT] LPIDA* = ptr CIDA TIDA* = CIDA PIDA* = ptr CIDA - CLIENTCREATESTRUCT* {.final.} = object + CLIENTCREATESTRUCT* {.final, pure.} = object hWindowMenu*: HANDLE idFirstChild*: UINT LPCLIENTCREATESTRUCT* = ptr CLIENTCREATESTRUCT - tagCLIENTCREATESTRUCT* = CLIENTCREATESTRUCT TCLIENTCREATESTRUCT* = CLIENTCREATESTRUCT PCLIENTCREATESTRUCT* = ptr CLIENTCREATESTRUCT - CMINVOKECOMMANDINFO* {.final.} = object + CMINVOKECOMMANDINFO* {.final, pure.} = object cbSize*: DWORD fMask*: DWORD hwnd*: HWND @@ -7043,7 +7032,7 @@ type # WARNING LPCMINVOKECOMMANDINFO* = ptr CMINVOKECOMMANDINFO TCMInvokeCommandInfo* = CMINVOKECOMMANDINFO PCMInvokeCommandInfo* = ptr CMINVOKECOMMANDINFO - COLORADJUSTMENT* {.final.} = object + COLORADJUSTMENT* {.final, pure.} = object caSize*: int16 caFlags*: int16 caIlluminantIndex*: int16 @@ -7058,17 +7047,16 @@ type # WARNING caRedGreenTint*: SHORT LPCOLORADJUSTMENT* = ptr COLORADJUSTMENT - tagCOLORADJUSTMENT* = COLORADJUSTMENT TCOLORADJUSTMENT* = COLORADJUSTMENT PCOLORADJUSTMENT* = ptr COLORADJUSTMENT - COLORMAP* {.final.} = object + COLORMAP* {.final, pure.} = object `from`*: COLORREF `to`*: COLORREF # XXX! LPCOLORMAP* = ptr COLORMAP TCOLORMAP* = COLORMAP PCOLORMAP* = ptr COLORMAP - DCB* {.final.} = object + DCB* {.final, pure.} = object DCBlength*: DWORD BaudRate*: DWORD flags*: DWORD @@ -7148,7 +7136,7 @@ proc set_fAbortOnError*(a: var DCB, fAbortOnError: DWORD) proc fDummy2*(a: var DCB): DWORD proc set_fDummy2*(a: var DCB, fDummy2: DWORD) type - COMMCONFIG* {.final.} = object + COMMCONFIG* {.final, pure.} = object dwSize*: DWORD wVersion*: int16 wReserved*: int16 @@ -7161,7 +7149,7 @@ type LPCOMMCONFIG* = ptr COMMCONFIG TCOMMCONFIG* = COMMCONFIG PCOMMCONFIG* = ptr COMMCONFIG - COMMPROP* {.final.} = object + COMMPROP* {.final, pure.} = object wPacketLength*: int16 wPacketVersion*: int16 dwServiceMask*: DWORD @@ -7184,7 +7172,7 @@ type LPCOMMPROP* = ptr COMMPROP TCOMMPROP* = COMMPROP PCOMMPROP* = ptr COMMPROP - COMMTIMEOUTS* {.final.} = object + COMMTIMEOUTS* {.final, pure.} = object ReadIntervalTimeout*: DWORD ReadTotalTimeoutMultiplier*: DWORD ReadTotalTimeoutConstant*: DWORD @@ -7194,7 +7182,7 @@ type LPCOMMTIMEOUTS* = ptr COMMTIMEOUTS TCOMMTIMEOUTS* = COMMTIMEOUTS PCOMMTIMEOUTS* = ptr COMMTIMEOUTS - COMPAREITEMSTRUCT* {.final.} = object + COMPAREITEMSTRUCT* {.final, pure.} = object CtlType*: UINT CtlID*: UINT hwndItem*: HWND @@ -7203,17 +7191,16 @@ type itemID2*: UINT itemData2*: ULONG_PTR - tagCOMPAREITEMSTRUCT* = COMPAREITEMSTRUCT TCOMPAREITEMSTRUCT* = COMPAREITEMSTRUCT PCOMPAREITEMSTRUCT* = ptr COMPAREITEMSTRUCT - COMPCOLOR* {.final.} = object + COMPCOLOR* {.final, pure.} = object crText*: COLORREF crBackground*: COLORREF dwEffects*: DWORD TCOMPCOLOR* = COMPCOLOR PCOMPCOLOR* = ptr COMPCOLOR - COMPOSITIONFORM* {.final.} = object + COMPOSITIONFORM* {.final, pure.} = object dwStyle*: DWORD ptCurrentPos*: POINT rcArea*: RECT @@ -7222,7 +7209,7 @@ type TCOMPOSITIONFORM* = COMPOSITIONFORM PCOMPOSITIONFORM* = ptr COMPOSITIONFORM # TComStatFlags = set of (fCtsHold, fDsrHold, fRlsdHold , fXoffHold , # fXoffSent , fEof , fTxim , fReserved); - COMSTAT* {.final.} = object + COMSTAT* {.final, pure.} = object flag0*: DWORD # can't use tcomstatflags, set packing issues # and conflicts with macro's cbInQue*: DWORD @@ -7268,20 +7255,20 @@ proc set_fTxim*(a: var COMSTAT, fTxim: DWORD) proc fReserved*(a: var COMSTAT): DWORD proc set_fReserved*(a: var COMSTAT, fReserved: DWORD) type - CONSOLE_CURSOR_INFO* {.final.} = object + CONSOLE_CURSOR_INFO* {.final, pure.} = object dwSize*: DWORD bVisible*: WINBOOL PCONSOLE_CURSOR_INFO* = ptr CONSOLE_CURSOR_INFO TCONSOLECURSORINFO* = CONSOLE_CURSOR_INFO TCURSORINFO* = CONSOLE_CURSOR_INFO - COORD* {.final.} = object + COORD* {.final, pure.} = object X*: SHORT Y*: SHORT TCOORD* = COORD PCOORD* = ptr COORD - SMALL_RECT* {.final.} = object + SMALL_RECT* {.final, pure.} = object Left*: SHORT Top*: SHORT Right*: SHORT @@ -7289,7 +7276,7 @@ type TSMALL_RECT* = SMALL_RECT PSMALL_RECT* = ptr SMALL_RECT - CONSOLE_SCREEN_BUFFER_INFO* {.final.} = object + CONSOLE_SCREEN_BUFFER_INFO* {.final, pure.} = object dwSize*: COORD dwCursorPosition*: COORD wAttributes*: int16 @@ -7301,7 +7288,7 @@ type when defined(i386): type - FLOATING_SAVE_AREA* {.final.} = object + FLOATING_SAVE_AREA* {.final, pure.} = object ControlWord*: DWORD StatusWord*: DWORD TagWord*: DWORD @@ -7314,7 +7301,7 @@ when defined(i386): TFLOATINGSAVEAREA* = FLOATING_SAVE_AREA PFLOATINGSAVEAREA* = ptr FLOATING_SAVE_AREA - CONTEXT* {.final.} = object + CONTEXT* {.final, pure.} = object ContextFlags*: DWORD Dr0*: DWORD Dr1*: DWORD @@ -7345,7 +7332,7 @@ when defined(x86_64): # Define 128-bit 16-byte aligned xmm register type. # type - M128A* {.final.} = object + M128A* {.final, pure.} = object Low*: ULONGLONG High*: LONGLONG @@ -7355,7 +7342,7 @@ when defined(x86_64): # #typedef struct _XMM_SAVE_AREA32 { type - XMM_SAVE_AREA32* {.final.} = object + XMM_SAVE_AREA32* {.final, pure.} = object ControlWord*: int16 StatusWord*: int16 TagWord*: int8 @@ -7378,7 +7365,7 @@ when defined(x86_64): const LEGACY_SAVE_AREA_LENGTH* = sizeof(XMM_SAVE_AREA32) type - CONTEXT* {.final.} = object + CONTEXT* {.final, pure.} = object P1Home*: DWORD64 P2Home*: DWORD64 P3Home*: DWORD64 @@ -7465,7 +7452,7 @@ when defined(powerpc32): # Debug Status Register # Debug Control Register type - CONTEXT* {.final.} = object + CONTEXT* {.final, pure.} = object Fpr0*: float64 Fpr1*: float64 Fpr2*: float64 @@ -7554,13 +7541,13 @@ type PCONTEXT* = ptr CONTEXT type - LIST_ENTRY* {.final.} = object + LIST_ENTRY* {.final, pure.} = object Flink*: ptr LIST_ENTRY Blink*: ptr LIST_ENTRY TLISTENTRY* = LIST_ENTRY PLISTENTRY* = ptr LIST_ENTRY - CRITICAL_SECTION_DEBUG* {.final.} = object + CRITICAL_SECTION_DEBUG* {.final, pure.} = object `type`*: int16 CreatorBackTraceIndex*: int16 CriticalSection*: ptr TCRITICAL_SECTION @@ -7570,7 +7557,7 @@ type Depth*: DWORD OwnerBackTrace*: array[0..4, PVOID] - TRTL_CRITICAL_SECTION* {.final.} = object + TRTL_CRITICAL_SECTION* {.final, pure.} = object DebugInfo*: ptr CRITICAL_SECTION_DEBUG LockCount*: int32 RecursionCount*: int32 @@ -7586,7 +7573,7 @@ type TCRITICAL_SECTION* = TRTLCriticalSection PCRITICAL_SECTION* = PRTLCriticalSection LPCRITICAL_SECTION* = PRTLCriticalSection - SECURITY_QUALITY_OF_SERVICE* {.final.} = object + SECURITY_QUALITY_OF_SERVICE* {.final, pure.} = object len*: DWORD ImpersonationLevel*: SECURITY_IMPERSONATION_LEVEL ContextTrackingMode*: WINBOOL @@ -7594,7 +7581,7 @@ type PSECURITY_QUALITY_OF_SERVICE* = ptr SECURITY_QUALITY_OF_SERVICE TSECURITYQUALITYOFSERVICE* = SECURITY_QUALITY_OF_SERVICE - CONVCONTEXT* {.final.} = object + CONVCONTEXT* {.final, pure.} = object cb*: UINT wFlags*: UINT wCountryID*: UINT @@ -7605,7 +7592,7 @@ type TCONVCONTEXT* = CONVCONTEXT PCONVCONTEXT* = ptr CONVCONTEXT - CONVINFO* {.final.} = object + CONVINFO* {.final, pure.} = object cb*: DWORD hUser*: DWORD hConvPartner*: HCONV @@ -7623,18 +7610,16 @@ type hwnd*: HWND hwndPartner*: HWND - tagCONVINFO* = CONVINFO TCONVINFO* = CONVINFO PCONVINFO* = ptr CONVINFO - COPYDATASTRUCT* {.final.} = object + COPYDATASTRUCT* {.final, pure.} = object dwData*: DWORD cbData*: DWORD lpData*: PVOID - tagCOPYDATASTRUCT* = COPYDATASTRUCT TCOPYDATASTRUCT* = COPYDATASTRUCT PCOPYDATASTRUCT* = ptr COPYDATASTRUCT - CPINFO* {.final.} = object + CPINFO* {.final, pure.} = object MaxCharSize*: UINT DefaultChar*: array[0..(MAX_DEFAULTCHAR) - 1, int8] LeadByte*: array[0..(MAX_LEADBYTES) - 1, int8] @@ -7642,16 +7627,15 @@ type LPCPINFO* = ptr CPINFO Tcpinfo* = CPINFO Pcpinfo* = ptr CPINFO - CPLINFO* {.final.} = object + CPLINFO* {.final, pure.} = object idIcon*: int32 idName*: int32 idInfo*: int32 lData*: LONG - tagCPLINFO* = CPLINFO TCPLINFO* = CPLINFO PCPLINFO* = ptr CPLINFO - CREATE_PROCESS_DEBUG_INFO* {.final.} = object + CREATE_PROCESS_DEBUG_INFO* {.final, pure.} = object hFile*: HANDLE hProcess*: HANDLE hThread*: HANDLE @@ -7665,7 +7649,7 @@ type TCREATEPROCESSDEBUGINFO* = CREATE_PROCESS_DEBUG_INFO PCREATEPROCESSDEBUGINFO* = ptr CREATE_PROCESS_DEBUG_INFO - CREATE_THREAD_DEBUG_INFO* {.final.} = object + CREATE_THREAD_DEBUG_INFO* {.final, pure.} = object hThread*: HANDLE lpThreadLocalBase*: LPVOID lpStartAddress*: LPTHREAD_START_ROUTINE @@ -7686,7 +7670,7 @@ type # INT iProtocol; # } CSADDR_INFO; # - CURRENCYFMT* {.final.} = object + CURRENCYFMT* {.final, pure.} = object NumDigits*: UINT LeadingZero*: UINT Grouping*: UINT @@ -7698,7 +7682,7 @@ type Tcurrencyfmt* = CURRENCYFMT Pcurrencyfmt* = ptr CURRENCYFMT - CURSORSHAPE* {.final.} = object + CURSORSHAPE* {.final, pure.} = object xHotSpot*: int32 yHotSpot*: int32 cx*: int32 @@ -7710,7 +7694,7 @@ type LPCURSORSHAPE* = ptr CURSORSHAPE TCURSORSHAPE* = CURSORSHAPE PCURSORSHAPE* = ptr CURSORSHAPE - CWPRETSTRUCT* {.final.} = object + CWPRETSTRUCT* {.final, pure.} = object lResult*: LRESULT lParam*: LPARAM wParam*: WPARAM @@ -7719,7 +7703,7 @@ type TCWPRETSTRUCT* = CWPRETSTRUCT PCWPRETSTRUCT* = ptr CWPRETSTRUCT - CWPSTRUCT* {.final.} = object + CWPSTRUCT* {.final, pure.} = object lParam*: LPARAM wParam*: WPARAM message*: UINT @@ -7727,26 +7711,26 @@ type TCWPSTRUCT* = CWPSTRUCT PCWPSTRUCT* = ptr CWPSTRUCT - DATATYPES_INFO_1* {.final.} = object + DATATYPES_INFO_1* {.final, pure.} = object pName*: LPTSTR TDATATYPESINFO1* = DATATYPES_INFO_1 PDATATYPESINFO1* = ptr DATATYPES_INFO_1 - DDEACK* {.final.} = object + DDEACK* {.final, pure.} = object flag0*: int16 TDDEACK* = DDEACK PDDEACK* = ptr DDEACK const - bm_DDEACK_bAppReturnCode* = 0x000000FF - bp_DDEACK_bAppReturnCode* = 0 - bm_DDEACK_reserved* = 0x00003F00 - bp_DDEACK_reserved* = 8 - bm_DDEACK_fBusy* = 0x00004000 - bp_DDEACK_fBusy* = 14 - bm_DDEACK_fAck* = 0x00008000 - bp_DDEACK_fAck* = 15 + bm_DDEACK_bAppReturnCode* = 0x000000FF'i16 + bp_DDEACK_bAppReturnCode* = 0'i16 + bm_DDEACK_reserved* = 0x00003F00'i16 + bp_DDEACK_reserved* = 8'i16 + bm_DDEACK_fBusy* = 0x00004000'i16 + bp_DDEACK_fBusy* = 14'i16 + bm_DDEACK_fAck* = 0x00008000'i16 + bp_DDEACK_fAck* = 15'i16 proc bAppReturnCode*(a: var DDEACK): int16 proc set_bAppReturnCode*(a: var DDEACK, bAppReturnCode: int16) @@ -7757,7 +7741,7 @@ proc set_fBusy*(a: var DDEACK, fBusy: int16) proc fAck*(a: var DDEACK): int16 proc set_fAck*(a: var DDEACK, fAck: int16) type - DDEADVISE* {.final.} = object + DDEADVISE* {.final, pure.} = object flag0*: int16 cfFormat*: SHORT @@ -7765,12 +7749,12 @@ type PDDEADVISE* = ptr DDEADVISE const - bm_DDEADVISE_reserved* = 0x00003FFF - bp_DDEADVISE_reserved* = 0 - bm_DDEADVISE_fDeferUpd* = 0x00004000 - bp_DDEADVISE_fDeferUpd* = 14 - bm_DDEADVISE_fAckReq* = 0x00008000 - bp_DDEADVISE_fAckReq* = 15 + bm_DDEADVISE_reserved* = 0x00003FFF'i16 + bp_DDEADVISE_reserved* = 0'i16 + bm_DDEADVISE_fDeferUpd* = 0x00004000'i16 + bp_DDEADVISE_fDeferUpd* = 14'i16 + bm_DDEADVISE_fAckReq* = 0x00008000'i16 + bp_DDEADVISE_fAckReq* = 15'i16 proc reserved*(a: var DDEADVISE): int16 proc set_reserved*(a: var DDEADVISE, reserved: int16) @@ -7779,7 +7763,7 @@ proc set_fDeferUpd*(a: var DDEADVISE, fDeferUpd: int16) proc fAckReq*(a: var DDEADVISE): int16 proc set_fAckReq*(a: var DDEADVISE, fAckReq: int16) type - DDEDATA* {.final.} = object + DDEDATA* {.final, pure.} = object flag0*: int16 cfFormat*: SHORT Value*: array[0..0, int8] @@ -7787,16 +7771,16 @@ type PDDEDATA* = ptr DDEDATA const - bm_DDEDATA_unused* = 0x00000FFF - bp_DDEDATA_unused* = 0 - bm_DDEDATA_fResponse* = 0x00001000 - bp_DDEDATA_fResponse* = 12 - bm_DDEDATA_fRelease* = 0x00002000 - bp_DDEDATA_fRelease* = 13 - bm_DDEDATA_reserved* = 0x00004000 - bp_DDEDATA_reserved* = 14 - bm_DDEDATA_fAckReq* = 0x00008000 - bp_DDEDATA_fAckReq* = 15 + bm_DDEDATA_unused* = 0x00000FFF'i16 + bp_DDEDATA_unused* = 0'i16 + bm_DDEDATA_fResponse* = 0x00001000'i16 + bp_DDEDATA_fResponse* = 12'i16 + bm_DDEDATA_fRelease* = 0x00002000'i16 + bp_DDEDATA_fRelease* = 13'i16 + bm_DDEDATA_reserved* = 0x00004000'i16 + bp_DDEDATA_reserved* = 14'i16 + bm_DDEDATA_fAckReq* = 0x00008000'i16 + bp_DDEDATA_fAckReq* = 15'i16 proc unused*(a: var DDEDATA): int16 proc set_unused*(a: var DDEDATA, unused: int16) @@ -7809,7 +7793,7 @@ proc set_reserved*(a: var DDEDATA, reserved: int16) proc fAckReq*(a: var DDEDATA): int16 proc set_fAckReq*(a: var DDEDATA, fAckReq: int16) type - DDELN* {.final.} = object + DDELN* {.final, pure.} = object flag0*: int16 cfFormat*: SHORT @@ -7817,14 +7801,14 @@ type PDDELN* = ptr DDELN const - bm_DDELN_unused* = 0x00001FFF - bp_DDELN_unused* = 0 - bm_DDELN_fRelease* = 0x00002000 - bp_DDELN_fRelease* = 13 - bm_DDELN_fDeferUpd* = 0x00004000 - bp_DDELN_fDeferUpd* = 14 - bm_DDELN_fAckReq* = 0x00008000 - bp_DDELN_fAckReq* = 15 + bm_DDELN_unused* = 0x00001FFF'i16 + bp_DDELN_unused* = 0'i16 + bm_DDELN_fRelease* = 0x00002000'i16 + bp_DDELN_fRelease* = 13'i16 + bm_DDELN_fDeferUpd* = 0x00004000'i16 + bp_DDELN_fDeferUpd* = 14'i16 + bm_DDELN_fAckReq* = 0x00008000'i16 + bp_DDELN_fAckReq* = 15'i16 proc unused*(a: var DDELN): int16 proc set_unused*(a: var DDELN, unused: int16) @@ -7835,7 +7819,7 @@ proc set_fDeferUpd*(a: var DDELN, fDeferUpd: int16) proc fAckReq*(a: var DDELN): int16 proc set_fAckReq*(a: var DDELN, fAckReq: int16) type - DDEML_MSG_HOOK_DATA* {.final.} = object + DDEML_MSG_HOOK_DATA* {.final, pure.} = object uiLo*: UINT uiHi*: UINT cbData*: DWORD @@ -7843,7 +7827,7 @@ type TDDEMLMSGHOOKDATA* = DDEML_MSG_HOOK_DATA PDDEMLMSGHOOKDATA* = ptr DDEML_MSG_HOOK_DATA - DDEPOKE* {.final.} = object + DDEPOKE* {.final, pure.} = object flag0*: int16 cfFormat*: SHORT Value*: array[0..0, int8] @@ -7852,12 +7836,12 @@ type PDDEPOKE* = ptr DDEPOKE const - bm_DDEPOKE_unused* = 0x00001FFF - bp_DDEPOKE_unused* = 0 - bm_DDEPOKE_fRelease* = 0x00002000 - bp_DDEPOKE_fRelease* = 13 - bm_DDEPOKE_fReserved* = 0x0000C000 - bp_DDEPOKE_fReserved* = 14 + bm_DDEPOKE_unused* = 0x00001FFF'i16 + bp_DDEPOKE_unused* = 0'i16 + bm_DDEPOKE_fRelease* = 0x00002000'i16 + bp_DDEPOKE_fRelease* = 13'i16 + bm_DDEPOKE_fReserved* = 0x0000C000'i16 + bp_DDEPOKE_fReserved* = 14'i16 proc unused*(a: var DDEPOKE): int16 proc set_unused*(a: var DDEPOKE, unused: int16) @@ -7866,7 +7850,7 @@ proc set_fRelease*(a: var DDEPOKE, fRelease: int16) proc fReserved*(a: var DDEPOKE): int16 proc set_fReserved*(a: var DDEPOKE, fReserved: int16) type - DDEUP* {.final.} = object + DDEUP* {.final, pure.} = object flag0*: int16 cfFormat*: SHORT rgb*: array[0..0, int8] @@ -7875,16 +7859,16 @@ type PDDEUP* = ptr DDEUP const - bm_DDEUP_unused* = 0x00000FFF - bp_DDEUP_unused* = 0 - bm_DDEUP_fAck* = 0x00001000 - bp_DDEUP_fAck* = 12 - bm_DDEUP_fRelease* = 0x00002000 - bp_DDEUP_fRelease* = 13 - bm_DDEUP_fReserved* = 0x00004000 - bp_DDEUP_fReserved* = 14 - bm_DDEUP_fAckReq* = 0x00008000 - bp_DDEUP_fAckReq* = 15 + bm_DDEUP_unused* = 0x00000FFF'i16 + bp_DDEUP_unused* = 0'i16 + bm_DDEUP_fAck* = 0x00001000'i16 + bp_DDEUP_fAck* = 12'i16 + bm_DDEUP_fRelease* = 0x00002000'i16 + bp_DDEUP_fRelease* = 13'i16 + bm_DDEUP_fReserved* = 0x00004000'i16 + bp_DDEUP_fReserved* = 14'i16 + bm_DDEUP_fAckReq* = 0x00008000'i16 + bp_DDEUP_fAckReq* = 15'i16 proc unused*(a: var DDEUP): int16 proc set_unused*(a: var DDEUP, unused: int16) @@ -7897,7 +7881,7 @@ proc set_fReserved*(a: var DDEUP, fReserved: int16) proc fAckReq*(a: var DDEUP): int16 proc set_fAckReq*(a: var DDEUP, fAckReq: int16) type - EXCEPTION_RECORD* {.final.} = object + EXCEPTION_RECORD* {.final, pure.} = object ExceptionCode*: DWORD ExceptionFlags*: DWORD ExceptionRecord*: ptr EXCEPTION_RECORD @@ -7908,13 +7892,13 @@ type PEXCEPTION_RECORD* = ptr EXCEPTION_RECORD TEXCEPTIONRECORD* = EXCEPTION_RECORD - EXCEPTION_DEBUG_INFO* {.final.} = object + EXCEPTION_DEBUG_INFO* {.final, pure.} = object ExceptionRecord*: EXCEPTION_RECORD dwFirstChance*: DWORD PEXCEPTION_DEBUG_INFO* = ptr EXCEPTION_DEBUG_INFO TEXCEPTIONDEBUGINFO* = EXCEPTION_DEBUG_INFO - EXCEPTION_RECORD32* {.final.} = object + EXCEPTION_RECORD32* {.final, pure.} = object ExceptionCode*: DWORD ExceptionFlags*: DWORD ExceptionRecord*: DWORD @@ -7924,13 +7908,13 @@ type PEXCEPTION_RECORD32* = ptr EXCEPTION_RECORD32 TExceptionRecord32* = EXCEPTION_RECORD32 - EXCEPTION_DEBUG_INFO32* {.final.} = object + EXCEPTION_DEBUG_INFO32* {.final, pure.} = object ExceptionRecord*: EXCEPTION_RECORD32 dwFirstChance*: DWORD PEXCEPTION_DEBUG_INFO32* = ptr EXCEPTION_DEBUG_INFO32 TExceptionDebugInfo32* = EXCEPTION_DEBUG_INFO32 - EXCEPTION_RECORD64* {.final.} = object + EXCEPTION_RECORD64* {.final, pure.} = object ExceptionCode*: DWORD ExceptionFlags*: DWORD ExceptionRecord*: DWORD64 @@ -7941,23 +7925,23 @@ type PEXCEPTION_RECORD64* = ptr EXCEPTION_RECORD64 TExceptionRecord64* = EXCEPTION_RECORD64 - EXCEPTION_DEBUG_INFO64* {.final.} = object + EXCEPTION_DEBUG_INFO64* {.final, pure.} = object ExceptionRecord*: EXCEPTION_RECORD64 dwFirstChance*: DWORD PEXCEPTION_DEBUG_INFO64* = ptr EXCEPTION_DEBUG_INFO64 TExceptionDebugInfo64* = EXCEPTION_DEBUG_INFO64 - EXIT_PROCESS_DEBUG_INFO* {.final.} = object + EXIT_PROCESS_DEBUG_INFO* {.final, pure.} = object dwExitCode*: DWORD TEXITPROCESSDEBUGINFO* = EXIT_PROCESS_DEBUG_INFO PEXITPROCESSDEBUGINFO* = ptr EXIT_PROCESS_DEBUG_INFO - EXIT_THREAD_DEBUG_INFO* {.final.} = object + EXIT_THREAD_DEBUG_INFO* {.final, pure.} = object dwExitCode*: DWORD TEXITTHREADDEBUGINFO* = EXIT_THREAD_DEBUG_INFO PEXITTHREADDEBUGINFO* = ptr EXIT_THREAD_DEBUG_INFO - LOAD_DLL_DEBUG_INFO* {.final.} = object + LOAD_DLL_DEBUG_INFO* {.final, pure.} = object hFile*: HANDLE lpBaseOfDll*: LPVOID dwDebugInfoFileOffset*: DWORD @@ -7967,25 +7951,25 @@ type TLOADDLLDEBUGINFO* = LOAD_DLL_DEBUG_INFO PLOADDLLDEBUGINFO* = ptr LOAD_DLL_DEBUG_INFO - UNLOAD_DLL_DEBUG_INFO* {.final.} = object + UNLOAD_DLL_DEBUG_INFO* {.final, pure.} = object lpBaseOfDll*: LPVOID TUNLOADDLLDEBUGINFO* = UNLOAD_DLL_DEBUG_INFO PUNLOADDLLDEBUGINFO* = ptr UNLOAD_DLL_DEBUG_INFO - OUTPUT_DEBUG_STRING_INFO* {.final.} = object + OUTPUT_DEBUG_STRING_INFO* {.final, pure.} = object lpDebugStringData*: LPSTR fUnicode*: int16 nDebugStringLength*: int16 TOUTPUTDEBUGSTRINGINFO* = OUTPUT_DEBUG_STRING_INFO POUTPUTDEBUGSTRINGINFO* = ptr OUTPUT_DEBUG_STRING_INFO - RIP_INFO* {.final.} = object + RIP_INFO* {.final, pure.} = object dwError*: DWORD dwType*: DWORD TRIPINFO* = RIP_INFO PRIPINFO* = ptr RIP_INFO - DEBUG_EVENT* {.final.} = object + DEBUG_EVENT* {.final, pure.} = object dwDebugEventCode*: DWORD dwProcessId*: DWORD dwThreadId*: DWORD @@ -8004,7 +7988,7 @@ type LPDEBUG_EVENT* = ptr DEBUG_EVENT TDEBUGEVENT* = DEBUG_EVENT PDEBUGEVENT* = ptr DEBUG_EVENT - DEBUGHOOKINFO* {.final.} = object + DEBUGHOOKINFO* {.final, pure.} = object idThread*: DWORD idThreadInstaller*: DWORD lParam*: LPARAM @@ -8013,7 +7997,7 @@ type TDEBUGHOOKINFO* = DEBUGHOOKINFO PDEBUGHOOKINFO* = ptr DEBUGHOOKINFO - DELETEITEMSTRUCT* {.final.} = object + DELETEITEMSTRUCT* {.final, pure.} = object CtlType*: UINT CtlID*: UINT itemID*: UINT @@ -8022,14 +8006,14 @@ type TDELETEITEMSTRUCT* = DELETEITEMSTRUCT PDELETEITEMSTRUCT* = ptr DELETEITEMSTRUCT - DEV_BROADCAST_HDR* {.final.} = object + DEV_BROADCAST_HDR* {.final, pure.} = object dbch_size*: ULONG dbch_devicetype*: ULONG dbch_reserved*: ULONG PDEV_BROADCAST_HDR* = ptr DEV_BROADCAST_HDR TDEVBROADCASTHDR* = DEV_BROADCAST_HDR - DEV_BROADCAST_OEM* {.final.} = object + DEV_BROADCAST_OEM* {.final, pure.} = object dbco_size*: ULONG dbco_devicetype*: ULONG dbco_reserved*: ULONG @@ -8038,7 +8022,7 @@ type PDEV_BROADCAST_OEM* = ptr DEV_BROADCAST_OEM TDEVBROADCASTOEM* = DEV_BROADCAST_OEM - DEV_BROADCAST_PORT* {.final.} = object + DEV_BROADCAST_PORT* {.final, pure.} = object dbcp_size*: ULONG dbcp_devicetype*: ULONG dbcp_reserved*: ULONG @@ -8046,14 +8030,14 @@ type PDEV_BROADCAST_PORT* = ptr DEV_BROADCAST_PORT TDEVBROADCASTPORT* = DEV_BROADCAST_PORT - DEV_BROADCAST_USERDEFINED* {.final.} = object + DEV_BROADCAST_USERDEFINED* {.final, pure.} = object dbud_dbh*: DEV_BROADCAST_HDR dbud_szName*: array[0..0, char] dbud_rgbUserDefined*: array[0..0, int8] TDEVBROADCASTUSERDEFINED* = DEV_BROADCAST_USERDEFINED PDEVBROADCASTUSERDEFINED* = ptr DEV_BROADCAST_USERDEFINED - DEV_BROADCAST_VOLUME* {.final.} = object + DEV_BROADCAST_VOLUME* {.final, pure.} = object dbcv_size*: ULONG dbcv_devicetype*: ULONG dbcv_reserved*: ULONG @@ -8062,7 +8046,7 @@ type PDEV_BROADCAST_VOLUME* = ptr DEV_BROADCAST_VOLUME TDEVBROADCASTVOLUME* = DEV_BROADCAST_VOLUME - DEVMODE* {.final.} = object + DEVMODE* {.final, pure.} = object dmDeviceName*: array[0..(CCHDEVICENAME) - 1, BCHAR] dmSpecVersion*: int16 dmDriverVersion*: int16 @@ -8107,7 +8091,7 @@ type PDeviceMode* = LPDEVMODE TDEVMODE* = DEVMODE PDEVMODE* = LPDEVMODE - devmodeW* {.final.} = object + devmodeW* {.final, pure.} = object dmDeviceName*: array[0..CCHDEVICENAME - 1, WCHAR] dmSpecVersion*: int16 dmDriverVersion*: int16 @@ -8149,24 +8133,22 @@ type PDeviceModeW* = LPDEVMODEW TDEVMODEW* = DEVMODEW PDEVMODEW* = LPDEVMODEW - DEVNAMES* {.final.} = object + DEVNAMES* {.final, pure.} = object wDriverOffset*: int16 wDeviceOffset*: int16 wOutputOffset*: int16 wDefault*: int16 LPDEVNAMES* = ptr DEVNAMES - tagDEVNAMES* = DEVNAMES TDEVNAMES* = DEVNAMES PDEVNAMES* = ptr DEVNAMES - DIBSECTION* {.final.} = object + DIBSECTION* {.final, pure.} = object dsBm*: BITMAP dsBmih*: BITMAPINFOHEADER dsBitfields*: array[0..2, DWORD] dshSection*: HANDLE dsOffset*: DWORD - tagDIBSECTION* = DIBSECTION TDIBSECTION* = DIBSECTION PDIBSECTION* = ptr DIBSECTION # # LARGE_INTEGER = record @@ -8187,7 +8169,7 @@ type TLargeInteger* = Int64 PULARGE_INTEGER* = ptr ULARGE_INTEGER TULargeInteger* = int64 - DISK_GEOMETRY* {.final.} = object + DISK_GEOMETRY* {.final, pure.} = object Cylinders*: LARGE_INTEGER MediaType*: MEDIA_TYPE TracksPerCylinder*: DWORD @@ -8196,7 +8178,7 @@ type TDISKGEOMETRY* = DISK_GEOMETRY PDISKGEOMETRY* = ptr DISK_GEOMETRY - DISK_PERFORMANCE* {.final.} = object + DISK_PERFORMANCE* {.final, pure.} = object BytesRead*: LARGE_INTEGER BytesWritten*: LARGE_INTEGER ReadTime*: LARGE_INTEGER @@ -8207,7 +8189,7 @@ type TDISKPERFORMANCE* = DISK_PERFORMANCE PDISKPERFORMANCE* = ptr DISK_PERFORMANCE - DLGITEMTEMPLATE* {.final.} = object + DLGITEMTEMPLATE* {.final, pure.} = object style*: DWORD dwExtendedStyle*: DWORD x*: int16 @@ -8219,7 +8201,7 @@ type LPDLGITEMTEMPLATE* = ptr DLGITEMTEMPLATE TDLGITEMTEMPLATE* = DLGITEMTEMPLATE PDLGITEMTEMPLATE* = ptr DLGITEMTEMPLATE - DLGTEMPLATE* {.final.} = object + DLGTEMPLATE* {.final, pure.} = object style*: DWORD dwExtendedStyle*: DWORD cdit*: int16 @@ -8232,14 +8214,14 @@ type LPCDLGTEMPLATE* = ptr DLGTEMPLATE TDLGTEMPLATE* = DLGTEMPLATE PDLGTEMPLATE* = ptr DLGTEMPLATE - DOC_INFO_1* {.final.} = object + DOC_INFO_1* {.final, pure.} = object pDocName*: LPTSTR pOutputFile*: LPTSTR pDatatype*: LPTSTR TDOCINFO1* = DOC_INFO_1 PDOCINFO1* = ptr DOC_INFO_1 - DOC_INFO_2* {.final.} = object + DOC_INFO_2* {.final, pure.} = object pDocName*: LPTSTR pOutputFile*: LPTSTR pDatatype*: LPTSTR @@ -8248,7 +8230,7 @@ type TDOCINFO2* = DOC_INFO_2 PDOCINFO2* = ptr DOC_INFO_2 - DOCINFO* {.final.} = object + DOCINFO* {.final, pure.} = object cbSize*: int32 lpszDocName*: LPCTSTR lpszOutput*: LPCTSTR @@ -8258,7 +8240,7 @@ type TDOCINFO* = DOCINFO TDOCINFOA* = DOCINFO PDOCINFO* = ptr DOCINFO - DRAGLISTINFO* {.final.} = object + DRAGLISTINFO* {.final, pure.} = object uNotification*: UINT hWnd*: HWND ptCursor*: POINT @@ -8266,7 +8248,7 @@ type LPDRAGLISTINFO* = ptr DRAGLISTINFO TDRAGLISTINFO* = DRAGLISTINFO PDRAGLISTINFO* = ptr DRAGLISTINFO - DRAWITEMSTRUCT* {.final.} = object + DRAWITEMSTRUCT* {.final, pure.} = object CtlType*: UINT CtlID*: UINT itemID*: UINT @@ -8278,10 +8260,9 @@ type itemData*: ULONG_PTR LPDRAWITEMSTRUCT* = ptr DRAWITEMSTRUCT - tagDRAWITEMSTRUCT* = DRAWITEMSTRUCT TDRAWITEMSTRUCT* = DRAWITEMSTRUCT PDRAWITEMSTRUCT* = ptr DRAWITEMSTRUCT - DRAWTEXTPARAMS* {.final.} = object + DRAWTEXTPARAMS* {.final, pure.} = object cbSize*: UINT iTabLength*: int32 iLeftMargin*: int32 @@ -8291,7 +8272,7 @@ type LPDRAWTEXTPARAMS* = ptr DRAWTEXTPARAMS TDRAWTEXTPARAMS* = DRAWTEXTPARAMS PDRAWTEXTPARAMS* = ptr DRAWTEXTPARAMS - PARTITION_INFORMATION* {.final.} = object + PARTITION_INFORMATION* {.final, pure.} = object PartitionType*: int8 BootIndicator*: bool RecognizedPartition*: bool @@ -8302,19 +8283,19 @@ type TPARTITIONINFORMATION* = PARTITION_INFORMATION PPARTITIONINFORMATION* = ptr PARTITION_INFORMATION - DRIVE_LAYOUT_INFORMATION* {.final.} = object + DRIVE_LAYOUT_INFORMATION* {.final, pure.} = object PartitionCount*: DWORD Signature*: DWORD PartitionEntry*: array[0..0, PARTITION_INFORMATION] TDRIVELAYOUTINFORMATION* = DRIVE_LAYOUT_INFORMATION PDRIVELAYOUTINFORMATION* = ptr DRIVE_LAYOUT_INFORMATION - DRIVER_INFO_1* {.final.} = object + DRIVER_INFO_1* {.final, pure.} = object pName*: LPTSTR TDRIVERINFO1* = DRIVER_INFO_1 PDRIVERINFO1* = ptr DRIVER_INFO_1 - DRIVER_INFO_2* {.final.} = object + DRIVER_INFO_2* {.final, pure.} = object cVersion*: DWORD pName*: LPTSTR pEnvironment*: LPTSTR @@ -8324,7 +8305,7 @@ type TDRIVERINFO2* = DRIVER_INFO_2 PDRIVERINFO2* = ptr DRIVER_INFO_2 - DRIVER_INFO_3* {.final.} = object + DRIVER_INFO_3* {.final, pure.} = object cVersion*: DWORD pName*: LPTSTR pEnvironment*: LPTSTR @@ -8338,37 +8319,34 @@ type TDRIVERINFO3* = DRIVER_INFO_3 PDRIVERINFO3* = ptr DRIVER_INFO_3 - EDITSTREAM* {.final.} = object + EDITSTREAM* {.final, pure.} = object dwCookie*: DWORD dwError*: DWORD pfnCallback*: EDITSTREAMCALLBACK Teditstream* = EDITSTREAM Peditstream* = ptr EDITSTREAM - EMR* {.final.} = object + EMR* {.final, pure.} = object iType*: DWORD nSize*: DWORD - tagEMR* = EMR TEMR* = EMR PEMR* = ptr EMR - EMRANGLEARC* {.final.} = object + EMRANGLEARC* {.final, pure.} = object emr*: EMR ptlCenter*: POINTL nRadius*: DWORD eStartAngle*: float32 eSweepAngle*: float32 - tagEMRANGLEARC* = EMRANGLEARC TEMRANGLEARC* = EMRANGLEARC PEMRANGLEARC* = ptr EMRANGLEARC - EMRARC* {.final.} = object + EMRARC* {.final, pure.} = object emr*: EMR rclBox*: RECTL ptlStart*: POINTL ptlEnd*: POINTL - tagEMRARC* = EMRARC TEMRARC* = EMRARC PEMRARC* = ptr EMRARC EMRARCTO* = EMRARC @@ -8380,7 +8358,7 @@ type EMRPIE* = EMRARC TEMRPIE* = EMRARC PEMRPIE* = ptr EMRARC - XFORM* {.final.} = object + XFORM* {.final, pure.} = object eM11*: float32 eM12*: float32 eM21*: float32 @@ -8391,7 +8369,7 @@ type LPXFORM* = ptr XFORM TXFORM* = XFORM PXFORM* = ptr XFORM - EMRBITBLT* {.final.} = object + EMRBITBLT* {.final, pure.} = object emr*: EMR rclBounds*: RECTL xDest*: LONG @@ -8408,28 +8386,25 @@ type offBitsSrc*: DWORD cbBitsSrc*: DWORD - tagEMRBITBLT* = EMRBITBLT TEMRBITBLT* = EMRBITBLT PEMRBITBLT* = ptr EMRBITBLT - LOGBRUSH* {.final.} = object + LOGBRUSH* {.final, pure.} = object lbStyle*: UINT lbColor*: COLORREF lbHatch*: LONG - tagLOGBRUSH* = LOGBRUSH TLOGBRUSH* = LOGBRUSH PLOGBRUSH* = ptr LOGBRUSH - EMRCREATEBRUSHINDIRECT* {.final.} = object + EMRCREATEBRUSHINDIRECT* {.final, pure.} = object emr*: EMR ihBrush*: DWORD lb*: LOGBRUSH - tagEMRCREATEBRUSHINDIRECT* = EMRCREATEBRUSHINDIRECT TEMRCREATEBRUSHINDIRECT* = EMRCREATEBRUSHINDIRECT PEMRCREATEBRUSHINDIRECT* = ptr EMRCREATEBRUSHINDIRECT LCSCSTYPE* = LONG LCSGAMUTMATCH* = LONG - LOGCOLORSPACE* {.final.} = object + LOGCOLORSPACE* {.final, pure.} = object lcsSignature*: DWORD lcsVersion*: DWORD lcsSize*: DWORD @@ -8442,19 +8417,17 @@ type lcsFilename*: array[0..(MAX_PATH) - 1, TCHAR] LPLOGCOLORSPACE* = ptr LOGCOLORSPACE - tagLOGCOLORSPACE* = LOGCOLORSPACE TLOGCOLORSPACE* = LOGCOLORSPACE TLOGCOLORSPACEA* = LOGCOLORSPACE PLOGCOLORSPACE* = ptr LOGCOLORSPACE - EMRCREATECOLORSPACE* {.final.} = object + EMRCREATECOLORSPACE* {.final, pure.} = object emr*: EMR ihCS*: DWORD lcs*: LOGCOLORSPACE - tagEMRCREATECOLORSPACE* = EMRCREATECOLORSPACE TEMRCREATECOLORSPACE* = EMRCREATECOLORSPACE PEMRCREATECOLORSPACE* = ptr EMRCREATECOLORSPACE - EMRCREATEDIBPATTERNBRUSHPT* {.final.} = object + EMRCREATEDIBPATTERNBRUSHPT* {.final, pure.} = object emr*: EMR ihBrush*: DWORD iUsage*: DWORD @@ -8463,10 +8436,9 @@ type offBits*: DWORD cbBits*: DWORD - tagEMRCREATEDIBPATTERNBRUSHPT* = EMRCREATEDIBPATTERNBRUSHPT TEMRCREATEDIBPATTERNBRUSHPT* = EMRCREATEDIBPATTERNBRUSHPT PEMRCREATEDIBPATTERNBRUSHPT* = EMRCREATEDIBPATTERNBRUSHPT - EMRCREATEMONOBRUSH* {.final.} = object + EMRCREATEMONOBRUSH* {.final, pure.} = object emr*: EMR ihBrush*: DWORD iUsage*: DWORD @@ -8475,82 +8447,73 @@ type offBits*: DWORD cbBits*: DWORD - tagEMRCREATEMONOBRUSH* = EMRCREATEMONOBRUSH TEMRCREATEMONOBRUSH* = EMRCREATEMONOBRUSH PEMRCREATEMONOBRUSH* = ptr EMRCREATEMONOBRUSH - PALETTEENTRY* {.final.} = object + PALETTEENTRY* {.final, pure.} = object peRed*: int8 peGreen*: int8 peBlue*: int8 peFlags*: int8 LPPALETTEENTRY* = ptr PALETTEENTRY - tagPALETTEENTRY* = PALETTEENTRY TPALETTEENTRY* = PALETTEENTRY PPALETTEENTRY* = ptr PALETTEENTRY - LOGPALETTE* {.final.} = object + LOGPALETTE* {.final, pure.} = object palVersion*: int16 palNumEntries*: int16 palPalEntry*: array[0..0, PALETTEENTRY] LPLOGPALETTE* = ptr LOGPALETTE - tagLOGPALETTE* = LOGPALETTE TLOGPALETTE* = LOGPALETTE PLOGPALETTE* = ptr LOGPALETTE - EMRCREATEPALETTE* {.final.} = object + EMRCREATEPALETTE* {.final, pure.} = object emr*: EMR ihPal*: DWORD lgpl*: LOGPALETTE - tagEMRCREATEPALETTE* = EMRCREATEPALETTE TEMRCREATEPALETTE* = EMRCREATEPALETTE PEMRCREATEPALETTE* = ptr EMRCREATEPALETTE - LOGPEN* {.final.} = object + LOGPEN* {.final, pure.} = object lopnStyle*: UINT lopnWidth*: POINT lopnColor*: COLORREF - tagLOGPEN* = LOGPEN TLOGPEN* = LOGPEN PLOGPEN* = ptr LOGPEN - EMRCREATEPEN* {.final.} = object + EMRCREATEPEN* {.final, pure.} = object emr*: EMR ihPen*: DWORD lopn*: LOGPEN - tagEMRCREATEPEN* = EMRCREATEPEN TEMRCREATEPEN* = EMRCREATEPEN PEMRCREATEPEN* = ptr EMRCREATEPEN - EMRELLIPSE* {.final.} = object + EMRELLIPSE* {.final, pure.} = object emr*: EMR rclBox*: RECTL - tagEMRELLIPSE* = EMRELLIPSE TEMRELLIPSE* = EMRELLIPSE PEMRELLIPSE* = ptr EMRELLIPSE EMRRECTANGLE* = EMRELLIPSE TEMRRECTANGLE* = EMRELLIPSE PEMRRECTANGLE* = ptr EMRELLIPSE - EMREOF* {.final.} = object + EMREOF* {.final, pure.} = object emr*: EMR nPalEntries*: DWORD offPalEntries*: DWORD nSizeLast*: DWORD - tagEMREOF* = EMREOF TEMREOF* = EMREOF PEMREOF* = ptr EMREOF - EMREXCLUDECLIPRECT* {.final.} = object + EMREXCLUDECLIPRECT* {.final, pure.} = object emr*: EMR rclClip*: RECTL - tagEMREXCLUDECLIPRECT* = EMREXCLUDECLIPRECT TEMREXCLUDECLIPRECT* = EMREXCLUDECLIPRECT PEMREXCLUDECLIPRECT* = ptr EMREXCLUDECLIPRECT EMRINTERSECTCLIPRECT* = EMREXCLUDECLIPRECT TEMRINTERSECTCLIPRECT* = EMREXCLUDECLIPRECT PEMRINTERSECTCLIPRECT* = ptr EMREXCLUDECLIPRECT - PANOSE* {.final.} = object + PANOSE* {.final, pure.} = object bFamilyType*: int8 bSerifStyle*: int8 bWeight*: int8 @@ -8562,10 +8525,9 @@ type bMidline*: int8 bXHeight*: int8 - tagPANOSE* = PANOSE TPANOSE* = PANOSE PPANOSE* = ptr PANOSE - EXTLOGFONT* {.final.} = object + EXTLOGFONT* {.final, pure.} = object elfLogFont*: LOGFONT elfFullName*: array[0..(LF_FULLFACESIZE) - 1, BCHAR] elfStyle*: array[0..(LF_FACESIZE) - 1, BCHAR] @@ -8577,18 +8539,16 @@ type elfCulture*: DWORD elfPanose*: PANOSE - tagEXTLOGFONT* = EXTLOGFONT TEXTLOGFONT* = EXTLOGFONT PEXTLOGFONT* = ptr EXTLOGFONT - EMREXTCREATEFONTINDIRECTW* {.final.} = object + EMREXTCREATEFONTINDIRECTW* {.final, pure.} = object emr*: EMR ihFont*: DWORD elfw*: EXTLOGFONT - tagEMREXTCREATEFONTINDIRECTW* = EMREXTCREATEFONTINDIRECTW TEMREXTCREATEFONTINDIRECTW* = EMREXTCREATEFONTINDIRECTW PEMREXTCREATEFONTINDIRECTW* = ptr EMREXTCREATEFONTINDIRECTW - EXTLOGPEN* {.final.} = object + EXTLOGPEN* {.final, pure.} = object elpPenStyle*: UINT elpWidth*: UINT elpBrushStyle*: UINT @@ -8597,10 +8557,9 @@ type elpNumEntries*: DWORD elpStyleEntry*: array[0..0, DWORD] - tagEXTLOGPEN* = EXTLOGPEN TEXTLOGPEN* = EXTLOGPEN PEXTLOGPEN* = ptr EXTLOGPEN - EMREXTCREATEPEN* {.final.} = object + EMREXTCREATEPEN* {.final, pure.} = object emr*: EMR ihPen*: DWORD offBmi*: DWORD @@ -8609,28 +8568,25 @@ type cbBits*: DWORD elp*: EXTLOGPEN - tagEMREXTCREATEPEN* = EMREXTCREATEPEN TEMREXTCREATEPEN* = EMREXTCREATEPEN PEMREXTCREATEPEN* = ptr EMREXTCREATEPEN - EMREXTFLOODFILL* {.final.} = object + EMREXTFLOODFILL* {.final, pure.} = object emr*: EMR ptlStart*: POINTL crColor*: COLORREF iMode*: DWORD - tagEMREXTFLOODFILL* = EMREXTFLOODFILL TEMREXTFLOODFILL* = EMREXTFLOODFILL PEMREXTFLOODFILL* = ptr EMREXTFLOODFILL - EMREXTSELECTCLIPRGN* {.final.} = object + EMREXTSELECTCLIPRGN* {.final, pure.} = object emr*: EMR cbRgnData*: DWORD iMode*: DWORD RgnData*: array[0..0, int8] - tagEMREXTSELECTCLIPRGN* = EMREXTSELECTCLIPRGN TEMREXTSELECTCLIPRGN* = EMREXTSELECTCLIPRGN PEMREXTSELECTCLIPRGN* = ptr EMREXTSELECTCLIPRGN - EMRTEXT* {.final.} = object + EMRTEXT* {.final, pure.} = object ptlReference*: POINTL nChars*: DWORD offString*: DWORD @@ -8638,10 +8594,9 @@ type rcl*: RECTL offDx*: DWORD - tagEMRTEXT* = EMRTEXT TEMRTEXT* = EMRTEXT PEMRTEXT* = ptr EMRTEXT - EMREXTTEXTOUTA* {.final.} = object + EMREXTTEXTOUTA* {.final, pure.} = object emr*: EMR rclBounds*: RECTL iGraphicsMode*: DWORD @@ -8649,17 +8604,15 @@ type eyScale*: float32 emrtext*: EMRTEXT - tagEMREXTTEXTOUTA* = EMREXTTEXTOUTA TEMREXTTEXTOUTA* = EMREXTTEXTOUTA PEMREXTTEXTOUTA* = ptr EMREXTTEXTOUTA EMREXTTEXTOUTW* = EMREXTTEXTOUTA TEMREXTTEXTOUTW* = EMREXTTEXTOUTA PEMREXTTEXTOUTW* = ptr EMREXTTEXTOUTA - EMRFILLPATH* {.final.} = object + EMRFILLPATH* {.final, pure.} = object emr*: EMR rclBounds*: RECTL - tagEMRFILLPATH* = EMRFILLPATH TEMRFILLPATH* = EMRFILLPATH PEMRFILLPATH* = ptr EMRFILLPATH EMRSTROKEANDFILLPATH* = EMRFILLPATH @@ -8668,38 +8621,35 @@ type EMRSTROKEPATH* = EMRFILLPATH TEMRSTROKEPATH* = EMRFILLPATH PEMRSTROKEPATH* = ptr EMRFILLPATH - EMRFILLRGN* {.final.} = object + EMRFILLRGN* {.final, pure.} = object emr*: EMR rclBounds*: RECTL cbRgnData*: DWORD ihBrush*: DWORD RgnData*: array[0..0, int8] - tagEMRFILLRGN* = EMRFILLRGN TEMRFILLRGN* = EMRFILLRGN PEMRFILLRGN* = ptr EMRFILLRGN - EMRFORMAT* {.final.} = object + EMRFORMAT* {.final, pure.} = object dSignature*: DWORD nVersion*: DWORD cbData*: DWORD offData*: DWORD - tagEMRFORMAT* = EMRFORMAT TEMRFORMAT* = EMRFORMAT PEMRFORMAT* = ptr EMRFORMAT - SIZE* {.final.} = object + SIZE* {.final, pure.} = object cx*: LONG cy*: LONG LPSIZE* = ptr SIZE - tagSIZE* = SIZE TSIZE* = SIZE PSIZE* = ptr SIZE SIZEL* = SIZE TSIZEL* = SIZE PSIZEL* = ptr SIZE LPSIZEL* = ptr SIZE - EMRFRAMERGN* {.final.} = object + EMRFRAMERGN* {.final, pure.} = object emr*: EMR rclBounds*: RECTL cbRgnData*: DWORD @@ -8707,40 +8657,36 @@ type szlStroke*: SIZEL RgnData*: array[0..0, int8] - tagEMRFRAMERGN* = EMRFRAMERGN TEMRFRAMERGN* = EMRFRAMERGN PEMRFRAMERGN* = ptr EMRFRAMERGN - EMRGDICOMMENT* {.final.} = object + EMRGDICOMMENT* {.final, pure.} = object emr*: EMR cbData*: DWORD Data*: array[0..0, int8] - tagEMRGDICOMMENT* = EMRGDICOMMENT TEMRGDICOMMENT* = EMRGDICOMMENT PEMRGDICOMMENT* = ptr EMRGDICOMMENT - EMRINVERTRGN* {.final.} = object + EMRINVERTRGN* {.final, pure.} = object emr*: EMR rclBounds*: RECTL cbRgnData*: DWORD RgnData*: array[0..0, int8] - tagEMRINVERTRGN* = EMRINVERTRGN TEMRINVERTRGN* = EMRINVERTRGN PEMRINVERTRGN* = ptr EMRINVERTRGN EMRPAINTRGN* = EMRINVERTRGN TEMRPAINTRGN* = EMRINVERTRGN PEMRPAINTRGN* = ptr EMRINVERTRGN - EMRLINETO* {.final.} = object + EMRLINETO* {.final, pure.} = object emr*: EMR ptl*: POINTL - tagEMRLINETO* = EMRLINETO TEMRLINETO* = EMRLINETO PEMRLINETO* = ptr EMRLINETO EMRMOVETOEX* = EMRLINETO TEMRMOVETOEX* = EMRLINETO PEMRMOVETOEX* = ptr EMRLINETO - EMRMASKBLT* {.final.} = object + EMRMASKBLT* {.final, pure.} = object emr*: EMR rclBounds*: RECTL xDest*: LONG @@ -8765,25 +8711,22 @@ type offBitsMask*: DWORD cbBitsMask*: DWORD - tagEMRMASKBLT* = EMRMASKBLT TEMRMASKBLT* = EMRMASKBLT PEMRMASKBLT* = ptr EMRMASKBLT - EMRMODIFYWORLDTRANSFORM* {.final.} = object + EMRMODIFYWORLDTRANSFORM* {.final, pure.} = object emr*: EMR xform*: XFORM iMode*: DWORD - tagEMRMODIFYWORLDTRANSFORM* = EMRMODIFYWORLDTRANSFORM TEMRMODIFYWORLDTRANSFORM* = EMRMODIFYWORLDTRANSFORM PEMRMODIFYWORLDTRANSFORM* = EMRMODIFYWORLDTRANSFORM - EMROFFSETCLIPRGN* {.final.} = object + EMROFFSETCLIPRGN* {.final, pure.} = object emr*: EMR ptlOffset*: POINTL - tagEMROFFSETCLIPRGN* = EMROFFSETCLIPRGN TEMROFFSETCLIPRGN* = EMROFFSETCLIPRGN PEMROFFSETCLIPRGN* = ptr EMROFFSETCLIPRGN - EMRPLGBLT* {.final.} = object + EMRPLGBLT* {.final, pure.} = object emr*: EMR rclBounds*: RECTL aptlDest*: array[0..2, POINTL] @@ -8806,36 +8749,32 @@ type offBitsMask*: DWORD cbBitsMask*: DWORD - tagEMRPLGBLT* = EMRPLGBLT TEMRPLGBLT* = EMRPLGBLT PEMRPLGBLT* = ptr EMRPLGBLT - EMRPOLYDRAW* {.final.} = object + EMRPOLYDRAW* {.final, pure.} = object emr*: EMR rclBounds*: RECTL cptl*: DWORD aptl*: array[0..0, POINTL] abTypes*: array[0..0, int8] - tagEMRPOLYDRAW* = EMRPOLYDRAW TEMRPOLYDRAW* = EMRPOLYDRAW PEMRPOLYDRAW* = ptr EMRPOLYDRAW - EMRPOLYDRAW16* {.final.} = object + EMRPOLYDRAW16* {.final, pure.} = object emr*: EMR rclBounds*: RECTL cpts*: DWORD apts*: array[0..0, POINTS] abTypes*: array[0..0, int8] - tagEMRPOLYDRAW16* = EMRPOLYDRAW16 TEMRPOLYDRAW16* = EMRPOLYDRAW16 PEMRPOLYDRAW16* = ptr EMRPOLYDRAW16 - EMRPOLYLINE* {.final.} = object + EMRPOLYLINE* {.final, pure.} = object emr*: EMR rclBounds*: RECTL cptl*: DWORD aptl*: array[0..0, POINTL] - tagEMRPOLYLINE* = EMRPOLYLINE TEMRPOLYLINE* = EMRPOLYLINE PEMRPOLYLINE* = ptr EMRPOLYLINE EMRPOLYBEZIER* = EMRPOLYLINE @@ -8850,13 +8789,12 @@ type EMRPOLYLINETO* = EMRPOLYLINE TEMRPOLYLINETO* = EMRPOLYLINE PEMRPOLYLINETO* = ptr EMRPOLYLINE - EMRPOLYLINE16* {.final.} = object + EMRPOLYLINE16* {.final, pure.} = object emr*: EMR rclBounds*: RECTL cpts*: DWORD apts*: array[0..0, POINTL] - tagEMRPOLYLINE16* = EMRPOLYLINE16 TEMRPOLYLINE16* = EMRPOLYLINE16 PEMRPOLYLINE16* = ptr EMRPOLYLINE16 EMRPOLYBEZIER16* = EMRPOLYLINE16 @@ -8871,7 +8809,7 @@ type EMRPOLYLINETO16* = EMRPOLYLINE16 TEMRPOLYLINETO16* = EMRPOLYLINE16 PEMRPOLYLINETO16* = ptr EMRPOLYLINE16 - EMRPOLYPOLYLINE* {.final.} = object + EMRPOLYPOLYLINE* {.final, pure.} = object emr*: EMR rclBounds*: RECTL nPolys*: DWORD @@ -8879,13 +8817,12 @@ type aPolyCounts*: array[0..0, DWORD] aptl*: array[0..0, POINTL] - tagEMRPOLYPOLYLINE* = EMRPOLYPOLYLINE TEMRPOLYPOLYLINE* = EMRPOLYPOLYLINE PEMRPOLYPOLYLINE* = ptr EMRPOLYPOLYLINE EMRPOLYPOLYGON* = EMRPOLYPOLYLINE TEMRPOLYPOLYGON* = EMRPOLYPOLYLINE PEMRPOLYPOLYGON* = ptr EMRPOLYPOLYLINE - EMRPOLYPOLYLINE16* {.final.} = object + EMRPOLYPOLYLINE16* {.final, pure.} = object emr*: EMR rclBounds*: RECTL nPolys*: DWORD @@ -8893,13 +8830,12 @@ type aPolyCounts*: array[0..0, DWORD] apts*: array[0..0, POINTS] - tagEMRPOLYPOLYLINE16* = EMRPOLYPOLYLINE16 TEMRPOLYPOLYLINE16* = EMRPOLYPOLYLINE16 PEMRPOLYPOLYLINE16* = ptr EMRPOLYPOLYLINE16 EMRPOLYPOLYGON16* = EMRPOLYPOLYLINE16 TEMRPOLYPOLYGON16* = EMRPOLYPOLYLINE16 PEMRPOLYPOLYGON16* = ptr EMRPOLYPOLYLINE16 - EMRPOLYTEXTOUTA* {.final.} = object + EMRPOLYTEXTOUTA* {.final, pure.} = object emr*: EMR rclBounds*: RECTL iGraphicsMode*: DWORD @@ -8908,100 +8844,89 @@ type cStrings*: LONG aemrtext*: array[0..0, EMRTEXT] - tagEMRPOLYTEXTOUTA* = EMRPOLYTEXTOUTA TEMRPOLYTEXTOUTA* = EMRPOLYTEXTOUTA PEMRPOLYTEXTOUTA* = ptr EMRPOLYTEXTOUTA EMRPOLYTEXTOUTW* = EMRPOLYTEXTOUTA TEMRPOLYTEXTOUTW* = EMRPOLYTEXTOUTA PEMRPOLYTEXTOUTW* = ptr EMRPOLYTEXTOUTA - EMRRESIZEPALETTE* {.final.} = object + EMRRESIZEPALETTE* {.final, pure.} = object emr*: EMR ihPal*: DWORD cEntries*: DWORD - tagEMRRESIZEPALETTE* = EMRRESIZEPALETTE TEMRRESIZEPALETTE* = EMRRESIZEPALETTE PEMRRESIZEPALETTE* = ptr EMRRESIZEPALETTE - EMRRESTOREDC* {.final.} = object + EMRRESTOREDC* {.final, pure.} = object emr*: EMR iRelative*: LONG - tagEMRRESTOREDC* = EMRRESTOREDC TEMRRESTOREDC* = EMRRESTOREDC PEMRRESTOREDC* = ptr EMRRESTOREDC - EMRROUNDRECT* {.final.} = object + EMRROUNDRECT* {.final, pure.} = object emr*: EMR rclBox*: RECTL szlCorner*: SIZEL - tagEMRROUNDRECT* = EMRROUNDRECT TEMRROUNDRECT* = EMRROUNDRECT PEMRROUNDRECT* = ptr EMRROUNDRECT - EMRSCALEVIEWPORTEXTEX* {.final.} = object + EMRSCALEVIEWPORTEXTEX* {.final, pure.} = object emr*: EMR xNum*: LONG xDenom*: LONG yNum*: LONG yDenom*: LONG - tagEMRSCALEVIEWPORTEXTEX* = EMRSCALEVIEWPORTEXTEX TEMRSCALEVIEWPORTEXTEX* = EMRSCALEVIEWPORTEXTEX PEMRSCALEVIEWPORTEXTEX* = ptr EMRSCALEVIEWPORTEXTEX EMRSCALEWINDOWEXTEX* = EMRSCALEVIEWPORTEXTEX TEMRSCALEWINDOWEXTEX* = EMRSCALEVIEWPORTEXTEX PEMRSCALEWINDOWEXTEX* = ptr EMRSCALEVIEWPORTEXTEX - EMRSELECTCOLORSPACE* {.final.} = object + EMRSELECTCOLORSPACE* {.final, pure.} = object emr*: EMR ihCS*: DWORD - tagEMRSELECTCOLORSPACE* = EMRSELECTCOLORSPACE TEMRSELECTCOLORSPACE* = EMRSELECTCOLORSPACE PEMRSELECTCOLORSPACE* = ptr EMRSELECTCOLORSPACE EMRDELETECOLORSPACE* = EMRSELECTCOLORSPACE TEMRDELETECOLORSPACE* = EMRSELECTCOLORSPACE PEMRDELETECOLORSPACE* = ptr EMRSELECTCOLORSPACE - EMRSELECTOBJECT* {.final.} = object + EMRSELECTOBJECT* {.final, pure.} = object emr*: EMR ihObject*: DWORD - tagEMRSELECTOBJECT* = EMRSELECTOBJECT TEMRSELECTOBJECT* = EMRSELECTOBJECT PEMRSELECTOBJECT* = ptr EMRSELECTOBJECT EMRDELETEOBJECT* = EMRSELECTOBJECT TEMRDELETEOBJECT* = EMRSELECTOBJECT PEMRDELETEOBJECT* = ptr EMRSELECTOBJECT - EMRSELECTPALETTE* {.final.} = object + EMRSELECTPALETTE* {.final, pure.} = object emr*: EMR ihPal*: DWORD - tagEMRSELECTPALETTE* = EMRSELECTPALETTE TEMRSELECTPALETTE* = EMRSELECTPALETTE PEMRSELECTPALETTE* = ptr EMRSELECTPALETTE - EMRSETARCDIRECTION* {.final.} = object + EMRSETARCDIRECTION* {.final, pure.} = object emr*: EMR iArcDirection*: DWORD - tagEMRSETARCDIRECTION* = EMRSETARCDIRECTION TEMRSETARCDIRECTION* = EMRSETARCDIRECTION PEMRSETARCDIRECTION* = ptr EMRSETARCDIRECTION - EMRSETBKCOLOR* {.final.} = object + EMRSETBKCOLOR* {.final, pure.} = object emr*: EMR crColor*: COLORREF - tagEMRSETTEXTCOLOR* = EMRSETBKCOLOR TEMRSETBKCOLOR* = EMRSETBKCOLOR PEMRSETBKCOLOR* = ptr EMRSETBKCOLOR EMRSETTEXTCOLOR* = EMRSETBKCOLOR TEMRSETTEXTCOLOR* = EMRSETBKCOLOR PEMRSETTEXTCOLOR* = ptr EMRSETBKCOLOR - EMRSETCOLORADJUSTMENT* {.final.} = object + EMRSETCOLORADJUSTMENT* {.final, pure.} = object emr*: EMR ColorAdjustment*: COLORADJUSTMENT - tagEMRSETCOLORADJUSTMENT* = EMRSETCOLORADJUSTMENT TEMRSETCOLORADJUSTMENT* = EMRSETCOLORADJUSTMENT PEMRSETCOLORADJUSTMENT* = ptr EMRSETCOLORADJUSTMENT - EMRSETDIBITSTODEVICE* {.final.} = object + EMRSETDIBITSTODEVICE* {.final, pure.} = object emr*: EMR rclBounds*: RECTL xDest*: LONG @@ -9018,56 +8943,49 @@ type iStartScan*: DWORD cScans*: DWORD - tagEMRSETDIBITSTODEVICE* = EMRSETDIBITSTODEVICE TEMRSETDIBITSTODEVICE* = EMRSETDIBITSTODEVICE PEMRSETDIBITSTODEVICE* = ptr EMRSETDIBITSTODEVICE - EMRSETMAPPERFLAGS* {.final.} = object + EMRSETMAPPERFLAGS* {.final, pure.} = object emr*: EMR dwFlags*: DWORD - tagEMRSETMAPPERFLAGS* = EMRSETMAPPERFLAGS TEMRSETMAPPERFLAGS* = EMRSETMAPPERFLAGS PEMRSETMAPPERFLAGS* = ptr EMRSETMAPPERFLAGS - EMRSETMITERLIMIT* {.final.} = object + EMRSETMITERLIMIT* {.final, pure.} = object emr*: EMR eMiterLimit*: float32 - tagEMRSETMITERLIMIT* = EMRSETMITERLIMIT TEMRSETMITERLIMIT* = EMRSETMITERLIMIT PEMRSETMITERLIMIT* = ptr EMRSETMITERLIMIT - EMRSETPALETTEENTRIES* {.final.} = object + EMRSETPALETTEENTRIES* {.final, pure.} = object emr*: EMR ihPal*: DWORD iStart*: DWORD cEntries*: DWORD aPalEntries*: array[0..0, PALETTEENTRY] - tagEMRSETPALETTEENTRIES* = EMRSETPALETTEENTRIES TEMRSETPALETTEENTRIES* = EMRSETPALETTEENTRIES PEMRSETPALETTEENTRIES* = ptr EMRSETPALETTEENTRIES - EMRSETPIXELV* {.final.} = object + EMRSETPIXELV* {.final, pure.} = object emr*: EMR ptlPixel*: POINTL crColor*: COLORREF - tagEMRSETPIXELV* = EMRSETPIXELV TEMRSETPIXELV* = EMRSETPIXELV PEMRSETPIXELV* = ptr EMRSETPIXELV - EMRSETVIEWPORTEXTEX* {.final.} = object + EMRSETVIEWPORTEXTEX* {.final, pure.} = object emr*: EMR szlExtent*: SIZEL - tagEMRSETVIEWPORTEXTEX* = EMRSETVIEWPORTEXTEX TEMRSETVIEWPORTEXTEX* = EMRSETVIEWPORTEXTEX PEMRSETVIEWPORTEXTEX* = ptr EMRSETVIEWPORTEXTEX EMRSETWINDOWEXTEX* = EMRSETVIEWPORTEXTEX TEMRSETWINDOWEXTEX* = EMRSETVIEWPORTEXTEX PEMRSETWINDOWEXTEX* = ptr EMRSETVIEWPORTEXTEX - EMRSETVIEWPORTORGEX* {.final.} = object + EMRSETVIEWPORTORGEX* {.final, pure.} = object emr*: EMR ptlOrigin*: POINTL - tagEMRSETVIEWPORTORGEX* = EMRSETVIEWPORTORGEX TEMRSETVIEWPORTORGEX* = EMRSETVIEWPORTORGEX PEMRSETVIEWPORTORGEX* = ptr EMRSETVIEWPORTORGEX EMRSETWINDOWORGEX* = EMRSETVIEWPORTORGEX @@ -9076,14 +8994,13 @@ type EMRSETBRUSHORGEX* = EMRSETVIEWPORTORGEX TEMRSETBRUSHORGEX* = EMRSETVIEWPORTORGEX PEMRSETBRUSHORGEX* = ptr EMRSETVIEWPORTORGEX - EMRSETWORLDTRANSFORM* {.final.} = object + EMRSETWORLDTRANSFORM* {.final, pure.} = object emr*: EMR xform*: XFORM - tagEMRSETWORLDTRANSFORM* = EMRSETWORLDTRANSFORM TEMRSETWORLDTRANSFORM* = EMRSETWORLDTRANSFORM PEMRSETWORLDTRANSFORM* = ptr EMRSETWORLDTRANSFORM - EMRSTRETCHBLT* {.final.} = object + EMRSTRETCHBLT* {.final, pure.} = object emr*: EMR rclBounds*: RECTL xDest*: LONG @@ -9103,10 +9020,9 @@ type cxSrc*: LONG cySrc*: LONG - tagEMRSTRETCHBLT* = EMRSTRETCHBLT TEMRSTRETCHBLT* = EMRSTRETCHBLT PEMRSTRETCHBLT* = ptr EMRSTRETCHBLT - EMRSTRETCHDIBITS* {.final.} = object + EMRSTRETCHDIBITS* {.final, pure.} = object emr*: EMR rclBounds*: RECTL xDest*: LONG @@ -9124,15 +9040,13 @@ type cxDest*: LONG cyDest*: LONG - tagEMRSTRETCHDIBITS* = EMRSTRETCHDIBITS TEMRSTRETCHDIBITS* = EMRSTRETCHDIBITS PEMRSTRETCHDIBITS* = ptr EMRSTRETCHDIBITS - EMRABORTPATH* {.final.} = object + EMRABORTPATH* {.final, pure.} = object emr*: EMR TEMRABORTPATH* = EMRABORTPATH PEMRABORTPATH* = ptr EMRABORTPATH - tagABORTPATH* = EMRABORTPATH TABORTPATH* = EMRABORTPATH EMRBEGINPATH* = EMRABORTPATH TEMRBEGINPATH* = EMRABORTPATH @@ -9158,11 +9072,10 @@ type EMRREALIZEPALETTE* = EMRABORTPATH TEMRREALIZEPALETTE* = EMRABORTPATH PEMRREALIZEPALETTE* = ptr EMRABORTPATH - EMRSELECTCLIPPATH* {.final.} = object + EMRSELECTCLIPPATH* {.final, pure.} = object emr*: EMR iMode*: DWORD - tagEMRSELECTCLIPPATH* = EMRSELECTCLIPPATH TEMRSELECTCLIPPATH* = EMRSELECTCLIPPATH PEMRSELECTCLIPPATH* = ptr EMRSELECTCLIPPATH EMRSETBKMODE* = EMRSELECTCLIPPATH @@ -9186,41 +9099,40 @@ type EMRENABLEICM* = EMRSELECTCLIPPATH TEMRENABLEICM* = EMRSELECTCLIPPATH PEMRENABLEICM* = ptr EMRSELECTCLIPPATH - NMHDR* {.final.} = object + NMHDR* {.final, pure.} = object hwndFrom*: HWND idFrom*: UINT code*: UINT - tagNMHDR* = NMHDR TNMHDR* = NMHDR PNMHDR* = ptr NMHDR - TENCORRECTTEXT* {.final.} = object + TENCORRECTTEXT* {.final, pure.} = object nmhdr*: NMHDR chrg*: CHARRANGE seltyp*: int16 Pencorrecttext* = ptr TENCORRECTTEXT - TENDROPFILES* {.final.} = object + TENDROPFILES* {.final, pure.} = object nmhdr*: NMHDR hDrop*: HANDLE cp*: LONG fProtected*: WINBOOL Pendropfiles* = ptr TENDROPFILES - TENSAVECLIPBOARD* {.final.} = object + TENSAVECLIPBOARD* {.final, pure.} = object nmhdr*: NMHDR cObjectCount*: LONG cch*: LONG PENSAVECLIPBOARD* = ptr TENSAVECLIPBOARD - TENOLEOPFAILED* {.final.} = object + TENOLEOPFAILED* {.final, pure.} = object nmhdr*: NMHDR iob*: LONG lOper*: LONG hr*: HRESULT PENOLEOPFAILED* = ptr TENOLEOPFAILED - TENHMETAHEADER* {.final.} = object + TENHMETAHEADER* {.final, pure.} = object iType*: DWORD nSize*: DWORD rclBounds*: RECTL @@ -9239,14 +9151,14 @@ type LPENHMETAHEADER* = ptr TENHMETAHEADER PENHMETAHEADER* = ptr TENHMETAHEADER - TENHMETARECORD* {.final.} = object + TENHMETARECORD* {.final, pure.} = object iType*: DWORD nSize*: DWORD dParm*: array[0..0, DWORD] LPENHMETARECORD* = ptr TENHMETARECORD PENHMETARECORD* = ptr TENHMETARECORD - TENPROTECTED* {.final.} = object + TENPROTECTED* {.final, pure.} = object nmhdr*: NMHDR msg*: UINT wParam*: WPARAM @@ -9254,7 +9166,7 @@ type chrg*: CHARRANGE Penprotected* = ptr TENPROTECTED - SERVICE_STATUS* {.final.} = object + SERVICE_STATUS* {.final, pure.} = object dwServiceType*: DWORD dwCurrentState*: DWORD dwControlsAccepted*: DWORD @@ -9266,7 +9178,7 @@ type LPSERVICE_STATUS* = ptr SERVICE_STATUS TSERVICESTATUS* = SERVICE_STATUS PSERVICESTATUS* = ptr SERVICE_STATUS - ENUM_SERVICE_STATUS* {.final.} = object + ENUM_SERVICE_STATUS* {.final, pure.} = object lpServiceName*: LPTSTR lpDisplayName*: LPTSTR ServiceStatus*: SERVICE_STATUS @@ -9274,20 +9186,19 @@ type LPENUM_SERVICE_STATUS* = ptr ENUM_SERVICE_STATUS TENUMSERVICESTATUS* = ENUM_SERVICE_STATUS PENUMSERVICESTATUS* = ptr ENUM_SERVICE_STATUS - ENUMLOGFONT* {.final.} = object + ENUMLOGFONT* {.final, pure.} = object elfLogFont*: LOGFONT elfFullName*: array[0..(LF_FULLFACESIZE) - 1, BCHAR] elfStyle*: array[0..(LF_FACESIZE) - 1, BCHAR] TENUMLOGFONT* = ENUMLOGFONT PENUMLOGFONT* = ptr ENUMLOGFONT - ENUMLOGFONTEX* {.final.} = object + ENUMLOGFONTEX* {.final, pure.} = object elfLogFont*: LOGFONT elfFullName*: array[0..(LF_FULLFACESIZE) - 1, BCHAR] elfStyle*: array[0..(LF_FACESIZE) - 1, BCHAR] elfScript*: array[0..(LF_FACESIZE) - 1, BCHAR] - tagENUMLOGFONTEX* = ENUMLOGFONTEX TENUMLOGFONTEX* = ENUMLOGFONTEX PENUMLOGFONTEX* = ptr ENUMLOGFONTEX # # Then follow: @@ -9300,7 +9211,7 @@ type # CHAR Pad[] # DWORD Length; # - EVENTLOGRECORD* {.final.} = object + EVENTLOGRECORD* {.final, pure.} = object len*: DWORD Reserved*: DWORD RecordNumber*: DWORD @@ -9320,24 +9231,23 @@ type TEVENTLOGRECORD* = EVENTLOGRECORD PEVENTLOGRECORD* = ptr EVENTLOGRECORD - EVENTMSG* {.final.} = object + EVENTMSG* {.final, pure.} = object message*: UINT paramL*: UINT paramH*: UINT time*: DWORD hwnd*: HWND - tagEVENTMSG* = EVENTMSG TEVENTMSG* = EVENTMSG PEVENTMSG* = ptr EVENTMSG - EXCEPTION_POINTERS* {.final.} = object + EXCEPTION_POINTERS* {.final, pure.} = object ExceptionRecord*: PEXCEPTION_RECORD ContextRecord*: PCONTEXT LPEXCEPTION_POINTERS* = ptr EXCEPTION_POINTERS PEXCEPTION_POINTERS* = ptr EXCEPTION_POINTERS TEXCEPTIONPOINTERS* = EXCEPTION_POINTERS - EXT_BUTTON* {.final.} = object + EXT_BUTTON* {.final, pure.} = object idCommand*: int16 idsHelp*: int16 fsStyle*: int16 @@ -9345,7 +9255,7 @@ type LPEXT_BUTTON* = ptr EXT_BUTTON TEXTBUTTON* = EXT_BUTTON PEXTBUTTON* = ptr EXT_BUTTON - FILTERKEYS* {.final.} = object + FILTERKEYS* {.final, pure.} = object cbSize*: UINT dwFlags*: DWORD iWaitMSec*: DWORD @@ -9355,7 +9265,7 @@ type TFILTERKEYS* = FILTERKEYS PFILTERKEYS* = ptr FILTERKEYS - FIND_NAME_BUFFER* {.final.} = object + FIND_NAME_BUFFER* {.final, pure.} = object len*: UCHAR access_control*: UCHAR frame_control*: UCHAR @@ -9365,14 +9275,14 @@ type TFINDNAMEBUFFER* = FIND_NAME_BUFFER PFINDNAMEBUFFER* = ptr FIND_NAME_BUFFER - FIND_NAME_HEADER* {.final.} = object + FIND_NAME_HEADER* {.final, pure.} = object node_count*: int16 reserved*: UCHAR unique_group*: UCHAR TFINDNAMEHEADER* = FIND_NAME_HEADER PFINDNAMEHEADER* = ptr FIND_NAME_HEADER - FINDREPLACE* {.final.} = object + FINDREPLACE* {.final, pure.} = object lStructSize*: DWORD hwndOwner*: HWND hInstance*: HINST @@ -9388,19 +9298,19 @@ type LPFINDREPLACE* = ptr FINDREPLACE TFINDREPLACE* = FINDREPLACE PFINDREPLACE* = ptr FINDREPLACE #FINDTEXT = record conflicts with FindText function - TFINDTEXT* {.final.} = object + TFINDTEXT* {.final, pure.} = object chrg*: CHARRANGE lpstrText*: LPSTR Pfindtext* = ptr TFINDTEXT - FINDTEXTEX* {.final.} = object + FINDTEXTEX* {.final, pure.} = object chrg*: CHARRANGE lpstrText*: LPSTR chrgText*: CHARRANGE Tfindtextex* = FINDTEXTEX Pfindtextex* = ptr FINDTEXTEX - FMS_GETDRIVEINFO* {.final.} = object + FMS_GETDRIVEINFO* {.final, pure.} = object dwTotalSpace*: DWORD dwFreeSpace*: DWORD szPath*: array[0..259, TCHAR] @@ -9409,7 +9319,7 @@ type TFMSGETDRIVEINFO* = FMS_GETDRIVEINFO PFMSGETDRIVEINFO* = ptr FMS_GETDRIVEINFO - FMS_GETFILESEL* {.final.} = object + FMS_GETFILESEL* {.final, pure.} = object ftTime*: FILETIME dwSize*: DWORD bAttr*: int8 @@ -9417,7 +9327,7 @@ type TFMSGETFILESEL* = FMS_GETFILESEL PFMSGETFILESEL* = ptr FMS_GETFILESEL - FMS_LOAD* {.final.} = object + FMS_LOAD* {.final, pure.} = object dwSize*: DWORD szMenuName*: array[0..(MENU_TEXT_LEN) - 1, TCHAR] hMenu*: HMENU @@ -9425,7 +9335,7 @@ type TFMSLOAD* = FMS_LOAD PFMSLOAD* = ptr FMS_LOAD - FMS_TOOLBARLOAD* {.final.} = object + FMS_TOOLBARLOAD* {.final, pure.} = object dwSize*: DWORD lpButtons*: LPEXT_BUTTON cButtons*: int16 @@ -9435,12 +9345,12 @@ type TFMSTOOLBARLOAD* = FMS_TOOLBARLOAD PFMSTOOLBARLOAD* = ptr FMS_TOOLBARLOAD - FOCUS_EVENT_RECORD* {.final.} = object + FOCUS_EVENT_RECORD* {.final, pure.} = object bSetFocus*: WINBOOL TFOCUSEVENTRECORD* = FOCUS_EVENT_RECORD PFOCUSEVENTRECORD* = ptr FOCUS_EVENT_RECORD - FORM_INFO_1* {.final.} = object + FORM_INFO_1* {.final, pure.} = object Flags*: DWORD pName*: LPTSTR Size*: SIZEL @@ -9448,7 +9358,7 @@ type TFORMINFO1* = FORM_INFO_1 PFORMINFO1* = ptr FORM_INFO_1 - FORMAT_PARAMETERS* {.final.} = object + FORMAT_PARAMETERS* {.final, pure.} = object MediaType*: MEDIA_TYPE StartCylinderNumber*: DWORD EndCylinderNumber*: DWORD @@ -9457,7 +9367,7 @@ type TFORMATPARAMETERS* = FORMAT_PARAMETERS PFORMATPARAMETERS* = ptr FORMAT_PARAMETERS - FORMATRANGE* {.final.} = object + FORMATRANGE* {.final, pure.} = object hdc*: HDC hdcTarget*: HDC rc*: RECT @@ -9466,7 +9376,7 @@ type Tformatrange* = FORMATRANGE Pformatrange* = ptr FORMATRANGE - GCP_RESULTS* {.final.} = object + GCP_RESULTS* {.final, pure.} = object lStructSize*: DWORD lpOutString*: LPTSTR lpOrder*: ptr UINT @@ -9478,10 +9388,9 @@ type nMaxFit*: UINT LPGCP_RESULTS* = ptr GCP_RESULTS - tagGCP_RESULTS* = GCP_RESULTS TGCPRESULTS* = GCP_RESULTS PGCPRESULTS* = ptr GCP_RESULTS - GENERIC_MAPPING* {.final.} = object + GENERIC_MAPPING* {.final, pure.} = object GenericRead*: ACCESS_MASK GenericWrite*: ACCESS_MASK GenericExecute*: ACCESS_MASK @@ -9489,7 +9398,7 @@ type PGENERIC_MAPPING* = ptr GENERIC_MAPPING TGENERICMAPPING* = GENERIC_MAPPING - GLYPHMETRICS* {.final.} = object + GLYPHMETRICS* {.final, pure.} = object gmBlackBoxX*: UINT gmBlackBoxY*: UINT gmptGlyphOrigin*: POINT @@ -9499,20 +9408,19 @@ type LPGLYPHMETRICS* = ptr GLYPHMETRICS TGLYPHMETRICS* = GLYPHMETRICS PGLYPHMETRICS* = ptr GLYPHMETRICS - HANDLETABLE* {.final.} = object + HANDLETABLE* {.final, pure.} = object objectHandle*: array[0..0, HGDIOBJ] - tagHANDLETABLE* = HANDLETABLE THANDLETABLE* = HANDLETABLE LPHANDLETABLE* = ptr HANDLETABLE - HD_HITTESTINFO* {.final.} = object + HD_HITTESTINFO* {.final, pure.} = object pt*: POINT flags*: UINT iItem*: int32 THDHITTESTINFO* = HD_HITTESTINFO PHDHITTESTINFO* = ptr HD_HITTESTINFO - HD_ITEM* {.final.} = object + HD_ITEM* {.final, pure.} = object mask*: UINT cxy*: int32 pszText*: LPTSTR @@ -9523,7 +9431,7 @@ type THDITEM* = HD_ITEM PHDITEM* = ptr HD_ITEM - WINDOWPOS* {.final.} = object + WINDOWPOS* {.final, pure.} = object hwnd*: HWND hwndInsertAfter*: HWND x*: int32 @@ -9535,13 +9443,13 @@ type LPWINDOWPOS* = ptr WINDOWPOS TWINDOWPOS* = WINDOWPOS PWINDOWPOS* = ptr WINDOWPOS - HD_LAYOUT* {.final.} = object + HD_LAYOUT* {.final, pure.} = object prc*: ptr RECT pwpos*: ptr WINDOWPOS THDLAYOUT* = HD_LAYOUT PHDLAYOUT* = ptr HD_LAYOUT - HD_NOTIFY* {.final.} = object + HD_NOTIFY* {.final, pure.} = object hdr*: NMHDR iItem*: int32 iButton*: int32 @@ -9549,7 +9457,7 @@ type THDNOTIFY* = HD_NOTIFY PHDNOTIFY* = ptr HD_NOTIFY - HELPINFO* {.final.} = object + HELPINFO* {.final, pure.} = object cbSize*: UINT iContextType*: int32 iCtrlId*: int32 @@ -9558,10 +9466,9 @@ type MousePos*: POINT LPHELPINFO* = ptr HELPINFO - tagHELPINFO* = HELPINFO THELPINFO* = HELPINFO PHELPINFO* = ptr HELPINFO - HELPWININFO* {.final.} = object + HELPWININFO* {.final, pure.} = object wStructSize*: int32 x*: int32 y*: int32 @@ -9572,23 +9479,21 @@ type THELPWININFO* = HELPWININFO PHELPWININFO* = ptr HELPWININFO - HIGHCONTRAST* {.final.} = object + HIGHCONTRAST* {.final, pure.} = object cbSize*: UINT dwFlags*: DWORD lpszDefaultScheme*: LPTSTR LPHIGHCONTRAST* = ptr HIGHCONTRAST - tagHIGHCONTRAST* = HIGHCONTRAST THIGHCONTRAST* = HIGHCONTRAST PHIGHCONTRAST* = ptr HIGHCONTRAST - HSZPAIR* {.final.} = object + HSZPAIR* {.final, pure.} = object hszSvc*: HSZ hszTopic*: HSZ - tagHSZPAIR* = HSZPAIR THSZPAIR* = HSZPAIR PHSZPAIR* = ptr HSZPAIR - ICONINFO* {.final.} = object + ICONINFO* {.final, pure.} = object fIcon*: WINBOOL xHotspot*: DWORD yHotspot*: DWORD @@ -9597,7 +9502,7 @@ type TICONINFO* = ICONINFO PICONINFO* = ptr ICONINFO - ICONMETRICS* {.final.} = object + ICONMETRICS* {.final, pure.} = object cbSize*: UINT iHorzSpacing*: int32 iVertSpacing*: int32 @@ -9605,10 +9510,9 @@ type lfFont*: LOGFONT LPICONMETRICS* = ptr ICONMETRICS - tagICONMETRICS* = ICONMETRICS TICONMETRICS* = ICONMETRICS PICONMETRICS* = ptr ICONMETRICS - IMAGEINFO* {.final.} = object + IMAGEINFO* {.final, pure.} = object hbmImage*: HBITMAP hbmMask*: HBITMAP Unused1*: int32 @@ -9617,7 +9521,7 @@ type TIMAGEINFO* = IMAGEINFO PIMAGEINFO* = ptr IMAGEINFO - KEY_EVENT_RECORD* {.final.} = object + KEY_EVENT_RECORD* {.final, pure.} = object bKeyDown*: WINBOOL wRepeatCount*: int16 wVirtualKeyCode*: int16 @@ -9627,7 +9531,7 @@ type TKEYEVENTRECORD* = KEY_EVENT_RECORD PKEYEVENTRECORD* = ptr KEY_EVENT_RECORD - MOUSE_EVENT_RECORD* {.final.} = object + MOUSE_EVENT_RECORD* {.final, pure.} = object dwMousePosition*: COORD dwButtonState*: DWORD dwControlKeyState*: DWORD @@ -9635,17 +9539,17 @@ type TMOUSEEVENTRECORD* = MOUSE_EVENT_RECORD PMOUSEEVENTRECORD* = ptr MOUSE_EVENT_RECORD - WINDOW_BUFFER_SIZE_RECORD* {.final.} = object + WINDOW_BUFFER_SIZE_RECORD* {.final, pure.} = object dwSize*: COORD TWINDOWBUFFERSIZERECORD* = WINDOW_BUFFER_SIZE_RECORD PWINDOWBUFFERSIZERECORD* = ptr WINDOW_BUFFER_SIZE_RECORD - MENU_EVENT_RECORD* {.final.} = object + MENU_EVENT_RECORD* {.final, pure.} = object dwCommandId*: UINT PMENU_EVENT_RECORD* = ptr MENU_EVENT_RECORD TMENUEVENTRECORD* = MENU_EVENT_RECORD - INPUT_RECORD* {.final.} = object + INPUT_RECORD* {.final, pure.} = object EventType*: int16 Reserved*: int16 event*: array[0..5, DWORD] #Event : record case longint of @@ -9658,7 +9562,7 @@ type PINPUT_RECORD* = ptr INPUT_RECORD TINPUTRECORD* = INPUT_RECORD - SYSTEMTIME* {.final.} = object + SYSTEMTIME* {.final, pure.} = object wYear*: int16 wMonth*: int16 wDayOfWeek*: int16 @@ -9671,7 +9575,7 @@ type LPSYSTEMTIME* = ptr SYSTEMTIME TSYSTEMTIME* = SYSTEMTIME PSYSTEMTIME* = ptr SYSTEMTIME - JOB_INFO_1* {.final.} = object + JOB_INFO_1* {.final, pure.} = object JobId*: DWORD pPrinterName*: LPTSTR pMachineName*: LPTSTR @@ -9688,13 +9592,13 @@ type TJOBINFO1* = JOB_INFO_1 PJOBINFO1* = ptr JOB_INFO_1 - SID_IDENTIFIER_AUTHORITY* {.final.} = object + SID_IDENTIFIER_AUTHORITY* {.final, pure.} = object Value*: array[0..5, int8] LPSID_IDENTIFIER_AUTHORITY* = ptr SID_IDENTIFIER_AUTHORITY PSID_IDENTIFIER_AUTHORITY* = ptr SID_IDENTIFIER_AUTHORITY TSIDIDENTIFIERAUTHORITY* = SID_IDENTIFIER_AUTHORITY - SID* {.final.} = object + SID* {.final, pure.} = object Revision*: int8 SubAuthorityCount*: int8 IdentifierAuthority*: SID_IDENTIFIER_AUTHORITY @@ -9705,7 +9609,7 @@ type SECURITY_DESCRIPTOR_CONTROL* = int16 PSECURITY_DESCRIPTOR_CONTROL* = ptr SECURITY_DESCRIPTOR_CONTROL TSECURITYDESCRIPTORCONTROL* = SECURITY_DESCRIPTOR_CONTROL - SECURITY_DESCRIPTOR* {.final.} = object + SECURITY_DESCRIPTOR* {.final, pure.} = object Revision*: int8 Sbz1*: int8 Control*: SECURITY_DESCRIPTOR_CONTROL @@ -9716,7 +9620,7 @@ type PSECURITY_DESCRIPTOR* = ptr SECURITY_DESCRIPTOR TSECURITYDESCRIPTOR* = SECURITY_DESCRIPTOR - JOB_INFO_2* {.final.} = object + JOB_INFO_2* {.final, pure.} = object JobId*: DWORD pPrinterName*: LPTSTR pMachineName*: LPTSTR @@ -9743,7 +9647,7 @@ type TJOBINFO2* = JOB_INFO_2 PJOBINFO2* = ptr JOB_INFO_2 - KERNINGPAIR* {.final.} = object + KERNINGPAIR* {.final, pure.} = object wFirst*: int16 wSecond*: int16 iKernAmount*: int32 @@ -9751,13 +9655,13 @@ type LPKERNINGPAIR* = ptr KERNINGPAIR TKERNINGPAIR* = KERNINGPAIR PKERNINGPAIR* = ptr KERNINGPAIR - LANA_ENUM* {.final.} = object + LANA_ENUM* {.final, pure.} = object len*: UCHAR lana*: array[0..(MAX_LANA) - 1, UCHAR] TLANAENUM* = LANA_ENUM PLANAENUM* = ptr LANA_ENUM - LDT_ENTRY* {.final.} = object + LDT_ENTRY* {.final, pure.} = object LimitLow*: int16 BaseLow*: int16 BaseMid*: int8 @@ -9792,20 +9696,19 @@ const bp_LDT_ENTRY_BaseHi* = 24 type - LOCALESIGNATURE* {.final.} = object + LOCALESIGNATURE* {.final, pure.} = object lsUsb*: array[0..3, DWORD] lsCsbDefault*: array[0..1, DWORD] lsCsbSupported*: array[0..1, DWORD] - tagLOCALESIGNATURE* = LOCALESIGNATURE TLOCALESIGNATURE* = LOCALESIGNATURE PLOCALESIGNATURE* = ptr LOCALESIGNATURE - LOCALGROUP_MEMBERS_INFO_0* {.final.} = object + LOCALGROUP_MEMBERS_INFO_0* {.final, pure.} = object lgrmi0_sid*: PSID TLOCALGROUPMEMBERSINFO0* = LOCALGROUP_MEMBERS_INFO_0 PLOCALGROUPMEMBERSINFO0* = ptr LOCALGROUP_MEMBERS_INFO_0 - LOCALGROUP_MEMBERS_INFO_3* {.final.} = object + LOCALGROUP_MEMBERS_INFO_3* {.final, pure.} = object lgrmi3_domainandname*: LPWSTR TLOCALGROUPMEMBERSINFO3* = LOCALGROUP_MEMBERS_INFO_3 @@ -9817,7 +9720,7 @@ type LUID* = TlargeInteger TLUID* = LUID PLUID* = ptr LUID - LUID_AND_ATTRIBUTES* {.final.} = object + LUID_AND_ATTRIBUTES* {.final, pure.} = object Luid*: LUID Attributes*: DWORD @@ -9826,7 +9729,7 @@ type LUID_AND_ATTRIBUTES_ARRAY* = array[0..(ANYSIZE_ARRAY) - 1, LUID_AND_ATTRIBUTES] PLUID_AND_ATTRIBUTES_ARRAY* = ptr LUID_AND_ATTRIBUTES_ARRAY TLUIDANDATTRIBUTESARRAY* = LUID_AND_ATTRIBUTES_ARRAY - LV_COLUMN* {.final.} = object + LV_COLUMN* {.final, pure.} = object mask*: UINT fmt*: int32 cx*: int32 @@ -9836,7 +9739,7 @@ type TLVCOLUMN* = LV_COLUMN PLVCOLUMN* = ptr LV_COLUMN - LV_ITEM* {.final.} = object + LV_ITEM* {.final, pure.} = object mask*: UINT iItem*: int32 iSubItem*: int32 @@ -9849,14 +9752,13 @@ type TLVITEM* = LV_ITEM PLVITEM* = ptr LV_ITEM - LV_DISPINFO* {.final.} = object + LV_DISPINFO* {.final, pure.} = object hdr*: NMHDR item*: LV_ITEM - tagLV_DISPINFO* = LV_DISPINFO TLVDISPINFO* = LV_DISPINFO PLVDISPINFO* = ptr LV_DISPINFO - LV_FINDINFO* {.final.} = object + LV_FINDINFO* {.final, pure.} = object flags*: UINT psz*: LPCTSTR lParam*: LPARAM @@ -9865,22 +9767,21 @@ type TLVFINDINFO* = LV_FINDINFO PLVFINDINFO* = ptr LV_FINDINFO - LV_HITTESTINFO* {.final.} = object + LV_HITTESTINFO* {.final, pure.} = object pt*: POINT flags*: UINT iItem*: int32 TLVHITTESTINFO* = LV_HITTESTINFO PLVHITTESTINFO* = ptr LV_HITTESTINFO - LV_KEYDOWN* {.final.} = object + LV_KEYDOWN* {.final, pure.} = object hdr*: NMHDR wVKey*: int16 flags*: UINT - tagLV_KEYDOWN* = LV_KEYDOWN TLVKEYDOWN* = LV_KEYDOWN PLVKEYDOWN* = ptr LV_KEYDOWN - MAT2* {.final.} = object + MAT2* {.final, pure.} = object eM11*: FIXED eM12*: FIXED eM21*: FIXED @@ -9888,7 +9789,7 @@ type TMAT2* = MAT2 PMAT2* = ptr MAT2 - MDICREATESTRUCT* {.final.} = object + MDICREATESTRUCT* {.final, pure.} = object szClass*: LPCTSTR szTitle*: LPCTSTR hOwner*: HANDLE @@ -9900,10 +9801,9 @@ type lParam*: LPARAM LPMDICREATESTRUCT* = ptr MDICREATESTRUCT - tagMDICREATESTRUCT* = MDICREATESTRUCT TMDICREATESTRUCT* = MDICREATESTRUCT PMDICREATESTRUCT* = ptr MDICREATESTRUCT - MEASUREITEMSTRUCT* {.final.} = object + MEASUREITEMSTRUCT* {.final, pure.} = object CtlType*: UINT CtlID*: UINT itemID*: UINT @@ -9912,10 +9812,9 @@ type itemData*: ULONG_PTR LPMEASUREITEMSTRUCT* = ptr MEASUREITEMSTRUCT - tagMEASUREITEMSTRUCT* = MEASUREITEMSTRUCT TMEASUREITEMSTRUCT* = MEASUREITEMSTRUCT PMEASUREITEMSTRUCT* = ptr MEASUREITEMSTRUCT - MEMORY_BASIC_INFORMATION* {.final.} = object + MEMORY_BASIC_INFORMATION* {.final, pure.} = object BaseAddress*: PVOID AllocationBase*: PVOID AllocationProtect*: DWORD @@ -9926,7 +9825,7 @@ type PMEMORY_BASIC_INFORMATION* = ptr MEMORY_BASIC_INFORMATION TMEMORYBASICINFORMATION* = MEMORY_BASIC_INFORMATION - MEMORYSTATUS* {.final.} = object + MEMORYSTATUS* {.final, pure.} = object dwLength*: DWORD dwMemoryLoad*: DWORD dwTotalPhys*: int @@ -9936,7 +9835,7 @@ type dwTotalVirtual*: int dwAvailVirtual*: int - TGUID* {.final.} = object + TGUID* {.final, pure.} = object D1*: int32 D2*: int16 D3*: int16 @@ -9945,14 +9844,14 @@ type LPMEMORYSTATUS* = ptr MEMORYSTATUS TMEMORYSTATUS* = MEMORYSTATUS PMEMORYSTATUS* = ptr MEMORYSTATUS - MENUEX_TEMPLATE_HEADER* {.final.} = object + MENUEX_TEMPLATE_HEADER* {.final, pure.} = object wVersion*: int16 wOffset*: int16 dwHelpId*: DWORD TMENUXTEMPLATEHEADER* = MENUEX_TEMPLATE_HEADER PMENUXTEMPLATEHEADER* = ptr MENUEX_TEMPLATE_HEADER - MENUEX_TEMPLATE_ITEM* {.final.} = object + MENUEX_TEMPLATE_ITEM* {.final, pure.} = object dwType*: DWORD dwState*: DWORD uId*: UINT @@ -9962,7 +9861,7 @@ type TMENUEXTEMPLATEITEM* = MENUEX_TEMPLATE_ITEM PMENUEXTEMPLATEITEM* = ptr MENUEX_TEMPLATE_ITEM - MENUINFO* {.final.} = object + MENUINFO* {.final, pure.} = object cbSize*: DWORD fMask*: DWORD dwStyle*: DWORD @@ -9973,10 +9872,9 @@ type LPMENUINFO* = ptr MENUINFO LPCMENUINFO* = ptr MENUINFO - tagMENUINFO* = MENUINFO TMENUINFO* = MENUINFO PMENUINFO* = ptr MENUINFO - MENUITEMINFO* {.final.} = object + MENUITEMINFO* {.final, pure.} = object cbSize*: UINT fMask*: UINT fType*: UINT @@ -9992,38 +9890,36 @@ type LPMENUITEMINFO* = ptr MENUITEMINFO LPCMENUITEMINFO* = ptr MENUITEMINFO - tagMENUITEMINFO* = MENUITEMINFO TMENUITEMINFO* = MENUITEMINFO TMENUITEMINFOA* = MENUITEMINFO PMENUITEMINFO* = ptr MENUITEMINFO - MENUITEMTEMPLATE* {.final.} = object + MENUITEMTEMPLATE* {.final, pure.} = object mtOption*: int16 mtID*: int16 mtString*: array[0..0, WCHAR] TMENUITEMTEMPLATE* = MENUITEMTEMPLATE PMENUITEMTEMPLATE* = ptr MENUITEMTEMPLATE - MENUITEMTEMPLATEHEADER* {.final.} = object + MENUITEMTEMPLATEHEADER* {.final, pure.} = object versionNumber*: int16 offset*: int16 TMENUITEMTEMPLATEHEADER* = MENUITEMTEMPLATEHEADER PMENUITEMTEMPLATEHEADER* = ptr MENUITEMTEMPLATEHEADER - MENUTEMPLATE* {.final.} = object + MENUTEMPLATE* {.final, pure.} = object LPMENUTEMPLATE* = ptr MENUTEMPLATE TMENUTEMPLATE* = MENUTEMPLATE PMENUTEMPLATE* = ptr MENUTEMPLATE - METAFILEPICT* {.final.} = object + METAFILEPICT* {.final, pure.} = object mm*: LONG xExt*: LONG yExt*: LONG hMF*: HMETAFILE LPMETAFILEPICT* = ptr METAFILEPICT - tagMETAFILEPICT* = METAFILEPICT TMETAFILEPICT* = METAFILEPICT PMETAFILEPICT* = ptr METAFILEPICT - METAHEADER* {.final.} = object + METAHEADER* {.final, pure.} = object mtType*: int16 mtHeaderSize*: int16 mtVersion*: int16 @@ -10032,19 +9928,17 @@ type mtMaxRecord*: DWORD mtNoParameters*: int16 - tagMETAHEADER* = METAHEADER TMETAHEADER* = METAHEADER PMETAHEADER* = ptr METAHEADER - METARECORD* {.final.} = object + METARECORD* {.final, pure.} = object rdSize*: DWORD rdFunction*: int16 rdParm*: array[0..0, int16] LPMETARECORD* = ptr METARECORD - tagMETARECORD* = METARECORD TMETARECORD* = METARECORD PMETARECORD* = ptr METARECORD - MINIMIZEDMETRICS* {.final.} = object + MINIMIZEDMETRICS* {.final, pure.} = object cbSize*: UINT iWidth*: int32 iHorzGap*: int32 @@ -10052,20 +9946,18 @@ type iArrange*: int32 LPMINIMIZEDMETRICS* = ptr MINIMIZEDMETRICS - tagMINIMIZEDMETRICS* = MINIMIZEDMETRICS TMINIMIZEDMETRICS* = MINIMIZEDMETRICS PMINIMIZEDMETRICS* = ptr MINIMIZEDMETRICS - MINMAXINFO* {.final.} = object + MINMAXINFO* {.final, pure.} = object ptReserved*: POINT ptMaxSize*: POINT ptMaxPosition*: POINT ptMinTrackSize*: POINT ptMaxTrackSize*: POINT - tagMINMAXINFO* = MINMAXINFO TMINMAXINFO* = MINMAXINFO PMINMAXINFO* = ptr MINMAXINFO - MODEMDEVCAPS* {.final.} = object + MODEMDEVCAPS* {.final, pure.} = object dwActualSize*: DWORD dwRequiredSize*: DWORD dwDevSpecificOffset*: DWORD @@ -10090,8 +9982,7 @@ type LPMODEMDEVCAPS* = ptr MODEMDEVCAPS TMODEMDEVCAPS* = MODEMDEVCAPS PMODEMDEVCAPS* = ptr MODEMDEVCAPS - modemdevcaps_tag* = MODEMDEVCAPS - MODEMSETTINGS* {.final.} = object + MODEMSETTINGS* {.final, pure.} = object dwActualSize*: DWORD dwRequiredSize*: DWORD dwDevSpecificOffset*: DWORD @@ -10108,8 +9999,7 @@ type LPMODEMSETTINGS* = ptr MODEMSETTINGS TMODEMSETTINGS* = MODEMSETTINGS PMODEMSETTINGS* = ptr MODEMSETTINGS - modemsettings_tag* = MODEMSETTINGS - MONCBSTRUCT* {.final.} = object + MONCBSTRUCT* {.final, pure.} = object cb*: UINT dwTime*: DWORD hTask*: HANDLE @@ -10126,10 +10016,9 @@ type cbData*: DWORD Data*: array[0..7, DWORD] - tagMONCBSTRUCT* = MONCBSTRUCT TMONCBSTRUCT* = MONCBSTRUCT PMONCBSTRUCT* = ptr MONCBSTRUCT - MONCONVSTRUCT* {.final.} = object + MONCONVSTRUCT* {.final, pure.} = object cb*: UINT fConnect*: WINBOOL dwTime*: DWORD @@ -10139,19 +10028,17 @@ type hConvClient*: HCONV hConvServer*: HCONV - tagMONCONVSTRUCT* = MONCONVSTRUCT TMONCONVSTRUCT* = MONCONVSTRUCT PMONCONVSTRUCT* = ptr MONCONVSTRUCT - MONERRSTRUCT* {.final.} = object + MONERRSTRUCT* {.final, pure.} = object cb*: UINT wLastError*: UINT dwTime*: DWORD hTask*: HANDLE - tagMONERRSTRUCT* = MONERRSTRUCT TMONERRSTRUCT* = MONERRSTRUCT PMONERRSTRUCT* = ptr MONERRSTRUCT - MONHSZSTRUCT* {.final.} = object + MONHSZSTRUCT* {.final, pure.} = object cb*: UINT fsAction*: WINBOOL dwTime*: DWORD @@ -10159,22 +10046,21 @@ type hTask*: HANDLE str*: array[0..0, TCHAR] - tagMONHSZSTRUCT* = MONHSZSTRUCT TMONHSZSTRUCT* = MONHSZSTRUCT PMONHSZSTRUCT* = ptr MONHSZSTRUCT - MONITOR_INFO_1* {.final.} = object + MONITOR_INFO_1* {.final, pure.} = object pName*: LPTSTR TMONITORINFO1* = MONITOR_INFO_1 PMONITORINFO1* = ptr MONITOR_INFO_1 - MONITOR_INFO_2* {.final.} = object + MONITOR_INFO_2* {.final, pure.} = object pName*: LPTSTR pEnvironment*: LPTSTR pDLLName*: LPTSTR TMONITORINFO2* = MONITOR_INFO_2 PMONITORINFO2* = ptr MONITOR_INFO_2 - MONLINKSTRUCT* {.final.} = object + MONLINKSTRUCT* {.final, pure.} = object cb*: UINT dwTime*: DWORD hTask*: HANDLE @@ -10188,10 +10074,9 @@ type hConvServer*: HCONV hConvClient*: HCONV - tagMONLINKSTRUCT* = MONLINKSTRUCT TMONLINKSTRUCT* = MONLINKSTRUCT PMONLINKSTRUCT* = ptr MONLINKSTRUCT - MONMSGSTRUCT* {.final.} = object + MONMSGSTRUCT* {.final, pure.} = object cb*: UINT hwndTo*: HWND dwTime*: DWORD @@ -10201,20 +10086,18 @@ type lParam*: LPARAM dmhd*: DDEML_MSG_HOOK_DATA - tagMONMSGSTRUCT* = MONMSGSTRUCT TMONMSGSTRUCT* = MONMSGSTRUCT PMONMSGSTRUCT* = ptr MONMSGSTRUCT - MOUSEHOOKSTRUCT* {.final.} = object + MOUSEHOOKSTRUCT* {.final, pure.} = object pt*: POINT hwnd*: HWND wHitTestCode*: UINT dwExtraInfo*: DWORD LPMOUSEHOOKSTRUCT* = ptr MOUSEHOOKSTRUCT - tagMOUSEHOOKSTRUCT* = MOUSEHOOKSTRUCT TMOUSEHOOKSTRUCT* = MOUSEHOOKSTRUCT PMOUSEHOOKSTRUCT* = ptr MOUSEHOOKSTRUCT - MOUSEKEYS* {.final.} = object + MOUSEKEYS* {.final, pure.} = object cbSize*: DWORD dwFlags*: DWORD iMaxSpeed*: DWORD @@ -10227,7 +10110,7 @@ type PMOUSEKEYS* = ptr MOUSEKEYS MSGBOXCALLBACK* = proc (lpHelpInfo: LPHELPINFO){.stdcall.} TMSGBOXCALLBACK* = MSGBOXCALLBACK - MSGBOXPARAMS* {.final.} = object + MSGBOXPARAMS* {.final, pure.} = object cbSize*: UINT hwndOwner*: HWND hInstance*: HINST @@ -10243,7 +10126,7 @@ type TMSGBOXPARAMS* = MSGBOXPARAMS TMSGBOXPARAMSA* = MSGBOXPARAMS PMSGBOXPARAMS* = ptr MSGBOXPARAMS - MSGFILTER* {.final.} = object + MSGFILTER* {.final, pure.} = object nmhdr*: NMHDR msg*: UINT wParam*: WPARAM @@ -10251,15 +10134,14 @@ type Tmsgfilter* = MSGFILTER Pmsgfilter* = ptr MSGFILTER - MULTIKEYHELP* {.final.} = object + MULTIKEYHELP* {.final, pure.} = object mkSize*: DWORD mkKeylist*: TCHAR szKeyphrase*: array[0..0, TCHAR] - tagMULTIKEYHELP* = MULTIKEYHELP TMULTIKEYHELP* = MULTIKEYHELP PMULTIKEYHELP* = ptr MULTIKEYHELP - NAME_BUFFER* {.final.} = object + NAME_BUFFER* {.final, pure.} = object name*: array[0..(NCBNAMSZ) - 1, UCHAR] name_num*: UCHAR name_flags*: UCHAR @@ -10267,7 +10149,7 @@ type TNAMEBUFFER* = NAME_BUFFER PNAMEBUFFER* = ptr NAME_BUFFER p_NCB* = ptr NCB - NCB* {.final.} = object + NCB* {.final, pure.} = object ncb_command*: UCHAR ncb_retcode*: UCHAR ncb_lsn*: UCHAR @@ -10285,13 +10167,13 @@ type ncb_event*: HANDLE TNCB* = NCB - NCCALCSIZE_PARAMS* {.final.} = object + NCCALCSIZE_PARAMS* {.final, pure.} = object rgrc*: array[0..2, RECT] lppos*: PWINDOWPOS TNCCALCSIZEPARAMS* = NCCALCSIZE_PARAMS PNCCALCSIZEPARAMS* = ptr NCCALCSIZE_PARAMS - NDDESHAREINFO* {.final.} = object + NDDESHAREINFO* {.final, pure.} = object lRevision*: LONG lpszShareName*: LPTSTR lShareType*: LONG @@ -10306,7 +10188,7 @@ type TNDDESHAREINFO* = NDDESHAREINFO PNDDESHAREINFO* = ptr NDDESHAREINFO - NETRESOURCE* {.final.} = object + NETRESOURCE* {.final, pure.} = object dwScope*: DWORD dwType*: DWORD dwDisplayType*: DWORD @@ -10321,7 +10203,7 @@ type TNETRESOURCEA* = NETRESOURCE PNETRESOURCE* = ptr NETRESOURCE PNETRESOURCEA* = ptr NETRESOURCE - NEWCPLINFO* {.final.} = object + NEWCPLINFO* {.final, pure.} = object dwSize*: DWORD dwFlags*: DWORD dwHelpContext*: DWORD @@ -10331,10 +10213,9 @@ type szInfo*: array[0..63, TCHAR] szHelpFile*: array[0..127, TCHAR] - tagNEWCPLINFO* = NEWCPLINFO TNEWCPLINFO* = NEWCPLINFO PNEWCPLINFO* = ptr NEWCPLINFO - NEWTEXTMETRIC* {.final.} = object + NEWTEXTMETRIC* {.final, pure.} = object tmHeight*: LONG tmAscent*: LONG tmDescent*: LONG @@ -10360,17 +10241,15 @@ type ntmCellHeight*: UINT ntmAvgWidth*: UINT - tagNEWTEXTMETRIC* = NEWTEXTMETRIC TNEWTEXTMETRIC* = NEWTEXTMETRIC PNEWTEXTMETRIC* = ptr NEWTEXTMETRIC - NEWTEXTMETRICEX* {.final.} = object + NEWTEXTMETRICEX* {.final, pure.} = object ntmentm*: NEWTEXTMETRIC ntmeFontSignature*: FONTSIGNATURE - tagNEWTEXTMETRICEX* = NEWTEXTMETRICEX TNEWTEXTMETRICEX* = NEWTEXTMETRICEX PNEWTEXTMETRICEX* = ptr NEWTEXTMETRICEX - NM_LISTVIEW* {.final.} = object + NM_LISTVIEW* {.final, pure.} = object hdr*: NMHDR iItem*: int32 iSubItem*: int32 @@ -10380,10 +10259,9 @@ type ptAction*: POINT lParam*: LPARAM - tagNM_LISTVIEW* = NM_LISTVIEW TNMLISTVIEW* = NM_LISTVIEW PNMLISTVIEW* = ptr NM_LISTVIEW - TV_ITEM* {.final.} = object + TV_ITEM* {.final, pure.} = object mask*: UINT hItem*: HTREEITEM state*: UINT @@ -10398,7 +10276,7 @@ type LPTV_ITEM* = ptr TV_ITEM TTVITEM* = TV_ITEM PTVITEM* = ptr TV_ITEM - NM_TREEVIEW* {.final.} = object + NM_TREEVIEW* {.final, pure.} = object hdr*: NMHDR action*: UINT itemOld*: TV_ITEM @@ -10408,14 +10286,14 @@ type LPNM_TREEVIEW* = ptr NM_TREEVIEW TNMTREEVIEW* = NM_TREEVIEW PNMTREEVIEW* = ptr NM_TREEVIEW - NM_UPDOWNW* {.final.} = object + NM_UPDOWNW* {.final, pure.} = object hdr*: NMHDR iPos*: int32 iDelta*: int32 TNMUPDOWN* = NM_UPDOWNW PNMUPDOWN* = ptr NM_UPDOWNW - NONCLIENTMETRICS* {.final.} = object + NONCLIENTMETRICS* {.final, pure.} = object cbSize*: UINT iBorderWidth*: int32 iScrollWidth*: int32 @@ -10433,10 +10311,9 @@ type lfMessageFont*: LOGFONT LPNONCLIENTMETRICS* = ptr NONCLIENTMETRICS - tagNONCLIENTMETRICS* = NONCLIENTMETRICS TNONCLIENTMETRICS* = NONCLIENTMETRICS PNONCLIENTMETRICS* = ptr NONCLIENTMETRICS - SERVICE_ADDRESS* {.final.} = object + SERVICE_ADDRESS* {.final, pure.} = object dwAddressType*: DWORD dwAddressFlags*: DWORD dwAddressLength*: DWORD @@ -10446,7 +10323,7 @@ type TSERVICEADDRESS* = SERVICE_ADDRESS PSERVICEADDRESS* = ptr SERVICE_ADDRESS - SERVICE_ADDRESSES* {.final.} = object + SERVICE_ADDRESSES* {.final, pure.} = object dwAddressCount*: DWORD Addresses*: array[0..0, SERVICE_ADDRESS] @@ -10459,7 +10336,7 @@ type LPCLSID* = ptr CLSID TCLSID* = CLSID PCLSID* = ptr CLSID - SERVICE_INFO* {.final.} = object + SERVICE_INFO* {.final, pure.} = object lpServiceType*: LPGUID lpServiceName*: LPTSTR lpComment*: LPTSTR @@ -10473,13 +10350,13 @@ type TSERVICEINFO* = SERVICE_INFO PSERVICEINFO* = ptr SERVICE_INFO - NS_SERVICE_INFO* {.final.} = object + NS_SERVICE_INFO* {.final, pure.} = object dwNameSpace*: DWORD ServiceInfo*: SERVICE_INFO TNSSERVICEINFO* = NS_SERVICE_INFO PNSSERVICEINFO* = ptr NS_SERVICE_INFO - NUMBERFMT* {.final.} = object + NUMBERFMT* {.final, pure.} = object NumDigits*: UINT LeadingZero*: UINT Grouping*: UINT @@ -10489,7 +10366,7 @@ type Tnumberfmt* = NUMBERFMT Pnumberfmt* = ptr NUMBERFMT - OFSTRUCT* {.final.} = object + OFSTRUCT* {.final, pure.} = object cBytes*: int8 fFixedDisk*: int8 nErrCode*: int16 @@ -10500,7 +10377,7 @@ type LPOFSTRUCT* = ptr OFSTRUCT TOFSTRUCT* = OFSTRUCT POFSTRUCT* = ptr OFSTRUCT - OPENFILENAME_NT4* {.final.} = object + OPENFILENAME_NT4* {.final, pure.} = object lStructSize*: DWORD hwndOwner*: HWND hInstance*: HINST @@ -10525,7 +10402,7 @@ type LPOPENFILENAME_NT4* = ptr OPENFILENAME_NT4 TOPENFILENAME_NT4* = OPENFILENAME_NT4 POPENFILENAME_NT4* = ptr OPENFILENAME_NT4 - TOPENFILENAME* {.final.} = object + TOPENFILENAME* {.final, pure.} = object lStructSize*: DWORD hwndOwner*: HWND hInstance*: HINST @@ -10554,7 +10431,7 @@ type POPENFILENAME* = ptr TOPENFILENAME OFN* = TOPENFILENAME POFN* = ptr TOPENFILENAME - OFNOTIFY* {.final.} = object + OFNOTIFY* {.final, pure.} = object hdr*: NMHDR lpOFN*: LPOPENFILENAME pszFile*: LPTSTR @@ -10562,7 +10439,7 @@ type LPOFNOTIFY* = ptr OFNOTIFY TOFNOTIFY* = OFNOTIFY POFNOTIFY* = ptr OFNOTIFY - OSVERSIONINFO* {.final.} = object + OSVERSIONINFO* {.final, pure.} = object dwOSVersionInfoSize*: DWORD dwMajorVersion*: DWORD dwMinorVersion*: DWORD @@ -10573,7 +10450,7 @@ type LPOSVERSIONINFO* = ptr OSVERSIONINFO TOSVERSIONINFO* = OSVERSIONINFO POSVERSIONINFO* = ptr OSVERSIONINFO - OSVERSIONINFOW* {.final.} = object + OSVERSIONINFOW* {.final, pure.} = object dwOSVersionInfoSize*: DWORD dwMajorVersion*: DWORD dwMinorVersion*: DWORD @@ -10584,7 +10461,7 @@ type LPOSVERSIONINFOW* = ptr OSVERSIONINFOW TOSVERSIONINFOW* = OSVERSIONINFOW POSVERSIONINFOW* = ptr OSVERSIONINFOW - TEXTMETRIC* {.final.} = object + TEXTMETRIC* {.final, pure.} = object tmHeight*: LONG tmAscent*: LONG tmDescent*: LONG @@ -10607,10 +10484,9 @@ type tmCharSet*: int8 LPTEXTMETRIC* = ptr TEXTMETRIC - tagTEXTMETRIC* = TEXTMETRIC TTEXTMETRIC* = TEXTMETRIC PTEXTMETRIC* = ptr TEXTMETRIC - TEXTMETRICW* {.final.} = object + TEXTMETRICW* {.final, pure.} = object tmHeight*: LONG tmAscent*: LONG tmDescent*: LONG @@ -10633,10 +10509,9 @@ type tmCharSet*: int8 LPTEXTMETRICW* = ptr TEXTMETRICW - tagTEXTMETRICW* = TEXTMETRICW TTEXTMETRICW* = TEXTMETRICW PTEXTMETRICW* = ptr TEXTMETRICW - OUTLINETEXTMETRIC* {.final.} = object + OUTLINETEXTMETRIC* {.final, pure.} = object otmSize*: UINT otmTextMetrics*: TEXTMETRIC otmFiller*: int8 @@ -10673,7 +10548,7 @@ type LPOUTLINETEXTMETRIC* = ptr OUTLINETEXTMETRIC TOUTLINETEXTMETRIC* = OUTLINETEXTMETRIC POUTLINETEXTMETRIC* = ptr OUTLINETEXTMETRIC - OVERLAPPED* {.final.} = object + OVERLAPPED* {.final, pure.} = object Internal*: DWORD InternalHigh*: DWORD Offset*: DWORD @@ -10683,7 +10558,7 @@ type LPOVERLAPPED* = ptr OVERLAPPED TOVERLAPPED* = OVERLAPPED POVERLAPPED* = ptr OVERLAPPED #PAGESETUPDLG = record conflicts with function PageSetupDlg - TPAGESETUPDLG* {.final.} = object + TPAGESETUPDLG* {.final, pure.} = object lStructSize*: DWORD hwndOwner*: HWND hDevMode*: HGLOBAL @@ -10701,10 +10576,9 @@ type LPPAGESETUPDLG* = ptr TPAGESETUPDLG PPAGESETUPDLG* = ptr TPAGESETUPDLG - tagPSD* = TPAGESETUPDLG TPSD* = TPAGESETUPDLG PPSD* = ptr TPAGESETUPDLG - PAINTSTRUCT* {.final.} = object + PAINTSTRUCT* {.final, pure.} = object hdc*: HDC fErase*: WINBOOL rcPaint*: RECT @@ -10713,10 +10587,9 @@ type rgbReserved*: array[0..31, int8] LPPAINTSTRUCT* = ptr PAINTSTRUCT - tagPAINTSTRUCT* = PAINTSTRUCT TPAINTSTRUCT* = PAINTSTRUCT PPAINTSTRUCT* = ptr PAINTSTRUCT - PARAFORMAT* {.final.} = object + PARAFORMAT* {.final, pure.} = object cbSize*: UINT dwMask*: DWORD wNumbering*: int16 @@ -10730,12 +10603,12 @@ type Tparaformat* = PARAFORMAT Pparaformat* = ptr PARAFORMAT - PERF_COUNTER_BLOCK* {.final.} = object + PERF_COUNTER_BLOCK* {.final, pure.} = object ByteLength*: DWORD TPERFCOUNTERBLOCK* = PERF_COUNTER_BLOCK PPERFCOUNTERBLOCK* = ptr PERF_COUNTER_BLOCK - PERF_COUNTER_DEFINITION* {.final.} = object + PERF_COUNTER_DEFINITION* {.final, pure.} = object ByteLength*: DWORD CounterNameTitleIndex*: DWORD CounterNameTitle*: LPWSTR @@ -10749,7 +10622,7 @@ type TPERFCOUNTERDEFINITION* = PERF_COUNTER_DEFINITION PPERFCOUNTERDEFINITION* = ptr PERF_COUNTER_DEFINITION - PERF_DATA_BLOCK* {.final.} = object + PERF_DATA_BLOCK* {.final, pure.} = object Signature*: array[0..3, WCHAR] LittleEndian*: DWORD Version*: DWORD @@ -10767,7 +10640,7 @@ type TPERFDATABLOCK* = PERF_DATA_BLOCK PPERFDATABLOCK* = ptr PERF_DATA_BLOCK - PERF_INSTANCE_DEFINITION* {.final.} = object + PERF_INSTANCE_DEFINITION* {.final, pure.} = object ByteLength*: DWORD ParentObjectTitleIndex*: DWORD ParentObjectInstance*: DWORD @@ -10777,7 +10650,7 @@ type TPERFINSTANCEDEFINITION* = PERF_INSTANCE_DEFINITION PPERFINSTANCEDEFINITION* = PERF_INSTANCE_DEFINITION - PERF_OBJECT_TYPE* {.final.} = object + PERF_OBJECT_TYPE* {.final, pure.} = object TotalByteLength*: DWORD DefinitionLength*: DWORD HeaderLength*: DWORD @@ -10795,7 +10668,7 @@ type TPERFOBJECTTYPE* = PERF_OBJECT_TYPE PPERFOBJECTTYPE* = ptr PERF_OBJECT_TYPE - POLYTEXT* {.final.} = object + POLYTEXT* {.final, pure.} = object x*: int32 y*: int32 n*: UINT @@ -10806,12 +10679,12 @@ type TPOLYTEXT* = POLYTEXT PPOLYTEXT* = ptr POLYTEXT - PORT_INFO_1* {.final.} = object + PORT_INFO_1* {.final, pure.} = object pName*: LPTSTR TPORTINFO1* = PORT_INFO_1 PPORTINFO1* = ptr PORT_INFO_1 - PORT_INFO_2* {.final.} = object + PORT_INFO_2* {.final, pure.} = object pPortName*: LPSTR pMonitorName*: LPSTR pDescription*: LPSTR @@ -10820,12 +10693,12 @@ type TPORTINFO2* = PORT_INFO_2 PPORTINFO2* = ptr PORT_INFO_2 - PREVENT_MEDIA_REMOVAL* {.final.} = object + PREVENT_MEDIA_REMOVAL* {.final, pure.} = object PreventMediaRemoval*: bool TPREVENTMEDIAREMOVAL* = PREVENT_MEDIA_REMOVAL PPREVENTMEDIAREMOVAL* = ptr PREVENT_MEDIA_REMOVAL #PRINTDLG = record conflicts with PrintDlg function - TPRINTDLG* {.final.} = object + TPRINTDLG* {.final, pure.} = object lStructSize*: DWORD hwndOwner*: HWND hDevMode*: HANDLE @@ -10848,17 +10721,16 @@ type LPPRINTDLG* = ptr TPRINTDLG PPRINTDLG* = ptr TPRINTDLG - tagPD* = TPRINTDLG TPD* = TPRINTDLG PPD* = ptr TPRINTDLG - PRINTER_DEFAULTS* {.final.} = object + PRINTER_DEFAULTS* {.final, pure.} = object pDatatype*: LPTSTR pDevMode*: LPDEVMODE DesiredAccess*: ACCESS_MASK TPRINTERDEFAULTS* = PRINTER_DEFAULTS PPRINTERDEFAULTS* = ptr PRINTER_DEFAULTS - PRINTER_INFO_1* {.final.} = object + PRINTER_INFO_1* {.final, pure.} = object Flags*: DWORD pDescription*: LPTSTR pName*: LPTSTR @@ -10867,7 +10739,7 @@ type LPPRINTER_INFO_1* = ptr PRINTER_INFO_1 PPRINTER_INFO_1* = ptr PRINTER_INFO_1 TPRINTERINFO1* = PRINTER_INFO_1 - PRINTER_INFO_2* {.final.} = object + PRINTER_INFO_2* {.final, pure.} = object pServerName*: LPTSTR pPrinterName*: LPTSTR pShareName*: LPTSTR @@ -10892,19 +10764,19 @@ type TPRINTERINFO2* = PRINTER_INFO_2 PPRINTERINFO2* = ptr PRINTER_INFO_2 - PRINTER_INFO_3* {.final.} = object + PRINTER_INFO_3* {.final, pure.} = object pSecurityDescriptor*: PSECURITY_DESCRIPTOR TPRINTERINFO3* = PRINTER_INFO_3 PPRINTERINFO3* = ptr PRINTER_INFO_3 - PRINTER_INFO_4* {.final.} = object + PRINTER_INFO_4* {.final, pure.} = object pPrinterName*: LPTSTR pServerName*: LPTSTR Attributes*: DWORD TPRINTERINFO4* = PRINTER_INFO_4 PPRINTERINFO4* = ptr PRINTER_INFO_4 - PRINTER_INFO_5* {.final.} = object + PRINTER_INFO_5* {.final, pure.} = object pPrinterName*: LPTSTR pPortName*: LPTSTR Attributes*: DWORD @@ -10913,7 +10785,7 @@ type TPRINTERINFO5* = PRINTER_INFO_5 PPRINTERINFO5* = ptr PRINTER_INFO_5 - PRINTER_NOTIFY_INFO_DATA* {.final.} = object + PRINTER_NOTIFY_INFO_DATA* {.final, pure.} = object `type`*: int16 Field*: int16 Reserved*: DWORD @@ -10923,7 +10795,7 @@ type TPRINTERNOTIFYINFODATA* = PRINTER_NOTIFY_INFO_DATA PPRINTERNOTIFYINFODATA* = ptr PRINTER_NOTIFY_INFO_DATA - PRINTER_NOTIFY_INFO* {.final.} = object + PRINTER_NOTIFY_INFO* {.final, pure.} = object Version*: DWORD Flags*: DWORD Count*: DWORD @@ -10931,7 +10803,7 @@ type TPRINTERNOTIFYINFO* = PRINTER_NOTIFY_INFO PPRINTERNOTIFYINFO* = ptr PRINTER_NOTIFY_INFO - PRINTER_NOTIFY_OPTIONS_TYPE* {.final.} = object + PRINTER_NOTIFY_OPTIONS_TYPE* {.final, pure.} = object `type`*: int16 Reserved0*: int16 Reserved1*: DWORD @@ -10941,7 +10813,7 @@ type PPRINTER_NOTIFY_OPTIONS_TYPE* = ptr PRINTER_NOTIFY_OPTIONS_TYPE TPRINTERNOTIFYOPTIONSTYPE* = PRINTER_NOTIFY_OPTIONS_TYPE - PRINTER_NOTIFY_OPTIONS* {.final.} = object + PRINTER_NOTIFY_OPTIONS* {.final, pure.} = object Version*: DWORD Flags*: DWORD Count*: DWORD @@ -10949,12 +10821,12 @@ type TPRINTERNOTIFYOPTIONS* = PRINTER_NOTIFY_OPTIONS PPRINTERNOTIFYOPTIONS* = ptr PRINTER_NOTIFY_OPTIONS - PRINTPROCESSOR_INFO_1* {.final.} = object + PRINTPROCESSOR_INFO_1* {.final, pure.} = object pName*: LPTSTR TPRINTPROCESSORINFO1* = PRINTPROCESSOR_INFO_1 PPRINTPROCESSORINFO1* = ptr PRINTPROCESSOR_INFO_1 - PRIVILEGE_SET* {.final.} = object + PRIVILEGE_SET* {.final, pure.} = object PrivilegeCount*: DWORD Control*: DWORD Privilege*: array[0..(ANYSIZE_ARRAY) - 1, LUID_AND_ATTRIBUTES] @@ -10962,7 +10834,7 @@ type LPPRIVILEGE_SET* = ptr PRIVILEGE_SET PPRIVILEGE_SET* = ptr PRIVILEGE_SET TPRIVILEGESET* = PRIVILEGE_SET - PROCESS_HEAPENTRY* {.final.} = object + PROCESS_HEAPENTRY* {.final, pure.} = object lpData*: PVOID cbData*: DWORD cbOverhead*: int8 @@ -10977,7 +10849,7 @@ type LPPROCESS_HEAP_ENTRY* = ptr PROCESS_HEAPENTRY TPROCESSHEAPENTRY* = PROCESS_HEAPENTRY PPROCESSHEAPENTRY* = ptr PROCESS_HEAPENTRY - PROCESS_INFORMATION* {.final.} = object + PROCESS_INFORMATION* {.final, pure.} = object hProcess*: HANDLE hThread*: HANDLE dwProcessId*: DWORD @@ -10989,7 +10861,7 @@ type LPFNPSPCALLBACK* = proc (para1: HWND, para2: UINT, para3: LPVOID): UINT{. stdcall.} TFNPSPCALLBACK* = LPFNPSPCALLBACK - PROPSHEETPAGE* {.final.} = object + PROPSHEETPAGE* {.final, pure.} = object dwSize*: DWORD dwFlags*: DWORD hInstance*: HINST @@ -11004,10 +10876,10 @@ type LPCPROPSHEETPAGE* = ptr PROPSHEETPAGE TPROPSHEETPAGE* = PROPSHEETPAGE PPROPSHEETPAGE* = ptr PROPSHEETPAGE - emptyrecord* {.final.} = object + emptyrecord* {.final, pure.} = object lpemptyrecord* = ptr emptyrecord HPROPSHEETPAGE* = ptr emptyrecord - PROPSHEETHEADER* {.final.} = object + PROPSHEETHEADER* {.final, pure.} = object dwSize*: DWORD dwFlags*: DWORD hwndParent*: HWND @@ -11032,7 +10904,7 @@ type LPFNADDPROPSHEETPAGES* = proc (para1: LPVOID, para2: LPFNADDPROPSHEETPAGE, para3: LPARAM): WINBOOL{.stdcall.} TFNADDPROPSHEETPAGES* = LPFNADDPROPSHEETPAGES - PROTOCOL_INFO* {.final.} = object + PROTOCOL_INFO* {.final, pure.} = object dwServiceFlags*: DWORD iAddressFamily*: WINT iMaxSockAddr*: WINT @@ -11044,27 +10916,27 @@ type TPROTOCOLINFO* = PROTOCOL_INFO PPROTOCOLINFO* = ptr PROTOCOL_INFO - PROVIDOR_INFO_1* {.final.} = object + PROVIDOR_INFO_1* {.final, pure.} = object pName*: LPTSTR pEnvironment*: LPTSTR pDLLName*: LPTSTR TPROVIDORINFO1* = PROVIDOR_INFO_1 PPROVIDORINFO1* = ptr PROVIDOR_INFO_1 - PSHNOTIFY* {.final.} = object + PSHNOTIFY* {.final, pure.} = object hdr*: NMHDR lParam*: LPARAM LPPSHNOTIFY* = ptr PSHNOTIFY TPSHNOTIFY* = PSHNOTIFY PPSHNOTIFY* = ptr PSHNOTIFY - PUNCTUATION* {.final.} = object + PUNCTUATION* {.final, pure.} = object iSize*: UINT szPunctuation*: LPSTR Tpunctuation* = PUNCTUATION Ppunctuation* = ptr PUNCTUATION - TQUERY_SERVICE_CONFIG* {.final.} = object + TQUERY_SERVICE_CONFIG* {.final, pure.} = object dwServiceType*: DWORD dwStartType*: DWORD dwErrorControl*: DWORD @@ -11077,14 +10949,14 @@ type LPQUERY_SERVICE_CONFIG* = ptr TQUERY_SERVICE_CONFIG PQUERYSERVICECONFIG* = ptr TQUERY_SERVICE_CONFIG - TQUERY_SERVICE_LOCK_STATUS* {.final.} = object + TQUERY_SERVICE_LOCK_STATUS* {.final, pure.} = object fIsLocked*: DWORD lpLockOwner*: LPTSTR dwLockDuration*: DWORD LPQUERY_SERVICE_LOCK_STATUS* = ptr TQUERY_SERVICE_LOCK_STATUS PQUERYSERVICELOCKSTATUS* = ptr TQUERY_SERVICE_LOCK_STATUS - RASAMB* {.final.} = object + RASAMB* {.final, pure.} = object dwSize*: DWORD dwError*: DWORD szNetBiosError*: array[0..(NETBIOS_NAME_LEN + 1) - 1, TCHAR] @@ -11092,7 +10964,7 @@ type TRASAMB* = RASAMB PRASAMB* = ptr RASAMB - RASCONN* {.final.} = object + RASCONN* {.final, pure.} = object dwSize*: DWORD hrasconn*: HRASCONN szEntryName*: array[0..(RAS_MaxEntryName + 1) - 1, TCHAR] @@ -11101,7 +10973,7 @@ type TRASCONN* = RASCONN PRASCONN* = ptr RASCONN - RASCONNSTATUS* {.final.} = object + RASCONNSTATUS* {.final, pure.} = object dwSize*: DWORD rasconnstate*: RASCONNSTATE dwError*: DWORD @@ -11110,7 +10982,7 @@ type TRASCONNSTATUS* = RASCONNSTATUS PRASCONNSTATUS* = ptr RASCONNSTATUS - RASDIALEXTENSIONS* {.final.} = object + RASDIALEXTENSIONS* {.final, pure.} = object dwSize*: DWORD dwfOptions*: DWORD hwndParent*: HWND @@ -11118,7 +10990,7 @@ type TRASDIALEXTENSIONS* = RASDIALEXTENSIONS PRASDIALEXTENSIONS* = ptr RASDIALEXTENSIONS - RASDIALPARAMS* {.final.} = object + RASDIALPARAMS* {.final, pure.} = object dwSize*: DWORD szEntryName*: array[0..(RAS_MaxEntryName + 1) - 1, TCHAR] szPhoneNumber*: array[0..(RAS_MaxPhoneNumber + 1) - 1, TCHAR] @@ -11129,27 +11001,27 @@ type TRASDIALPARAMS* = RASDIALPARAMS PRASDIALPARAMS* = ptr RASDIALPARAMS - RASENTRYNAME* {.final.} = object + RASENTRYNAME* {.final, pure.} = object dwSize*: DWORD szEntryName*: array[0..(RAS_MaxEntryName + 1) - 1, TCHAR] TRASENTRYNAME* = RASENTRYNAME PRASENTRYNAME* = ptr RASENTRYNAME - RASPPPIP* {.final.} = object + RASPPPIP* {.final, pure.} = object dwSize*: DWORD dwError*: DWORD szIpAddress*: array[0..(RAS_MaxIpAddress + 1) - 1, TCHAR] TRASPPPIP* = RASPPPIP PRASPPPIP* = ptr RASPPPIP - RASPPPIPX* {.final.} = object + RASPPPIPX* {.final, pure.} = object dwSize*: DWORD dwError*: DWORD szIpxAddress*: array[0..(RAS_MaxIpxAddress + 1) - 1, TCHAR] TRASPPPIPX* = RASPPPIPX PRASPPPIPX* = ptr RASPPPIPX - RASPPPNBF* {.final.} = object + RASPPPNBF* {.final, pure.} = object dwSize*: DWORD dwError*: DWORD dwNetBiosError*: DWORD @@ -11159,7 +11031,7 @@ type TRASPPPNBF* = RASPPPNBF PRASPPPNBF* = ptr RASPPPNBF - RASTERIZER_STATUS* {.final.} = object + RASTERIZER_STATUS* {.final, pure.} = object nSize*: short wFlags*: short nLanguageID*: short @@ -11167,14 +11039,14 @@ type LPRASTERIZER_STATUS* = ptr RASTERIZER_STATUS TRASTERIZERSTATUS* = RASTERIZER_STATUS PRASTERIZERSTATUS* = ptr RASTERIZER_STATUS - REASSIGN_BLOCKS* {.final.} = object + REASSIGN_BLOCKS* {.final, pure.} = object Reserved*: int16 Count*: int16 BlockNumber*: array[0..0, DWORD] TREASSIGNBLOCKS* = REASSIGN_BLOCKS PREASSIGNBLOCKS* = ptr REASSIGN_BLOCKS - REMOTE_NAME_INFO* {.final.} = object + REMOTE_NAME_INFO* {.final, pure.} = object lpUniversalName*: LPTSTR lpConnectionName*: LPTSTR lpRemainingPath*: LPTSTR @@ -11195,19 +11067,19 @@ type # DWORD dwUser; # } REOBJECT; # - REPASTESPECIAL* {.final.} = object + REPASTESPECIAL* {.final, pure.} = object dwAspect*: DWORD dwParam*: DWORD Trepastespecial* = REPASTESPECIAL Prepastespecial* = ptr REPASTESPECIAL - REQRESIZE* {.final.} = object + REQRESIZE* {.final, pure.} = object nmhdr*: NMHDR rc*: RECT Treqresize* = REQRESIZE Preqresize* = ptr REQRESIZE - RGNDATAHEADER* {.final.} = object + RGNDATAHEADER* {.final, pure.} = object dwSize*: DWORD iType*: DWORD nCount*: DWORD @@ -11216,14 +11088,14 @@ type TRGNDATAHEADER* = RGNDATAHEADER PRGNDATAHEADER* = ptr RGNDATAHEADER - RGNDATA* {.final.} = object + RGNDATA* {.final, pure.} = object rdh*: RGNDATAHEADER Buffer*: array[0..0, char] LPRGNDATA* = ptr RGNDATA TRGNDATA* = RGNDATA PRGNDATA* = ptr RGNDATA - SCROLLINFO* {.final.} = object + SCROLLINFO* {.final, pure.} = object cbSize*: UINT fMask*: UINT nMin*: int32 @@ -11236,7 +11108,7 @@ type LPCSCROLLINFO* = ptr SCROLLINFO TSCROLLINFO* = SCROLLINFO PSCROLLINFO* = ptr SCROLLINFO - SECURITY_ATTRIBUTES* {.final.} = object + SECURITY_ATTRIBUTES* {.final, pure.} = object nLength*: DWORD lpSecurityDescriptor*: LPVOID bInheritHandle*: WINBOOL @@ -11247,14 +11119,14 @@ type SECURITY_INFORMATION* = DWORD PSECURITY_INFORMATION* = ptr SECURITY_INFORMATION TSECURITYINFORMATION* = SECURITY_INFORMATION - SELCHANGE* {.final.} = object + SELCHANGE* {.final, pure.} = object nmhdr*: NMHDR chrg*: CHARRANGE seltyp*: int16 Tselchange* = SELCHANGE Pselchange* = ptr SELCHANGE - SERIALKEYS* {.final.} = object + SERIALKEYS* {.final, pure.} = object cbSize*: DWORD dwFlags*: DWORD lpszActivePort*: LPSTR @@ -11265,14 +11137,14 @@ type LPSERIALKEYS* = ptr SERIALKEYS TSERIALKEYS* = SERIALKEYS PSERIALKEYS* = ptr SERIALKEYS - SERVICE_TABLE_ENTRY* {.final.} = object + SERVICE_TABLE_ENTRY* {.final, pure.} = object lpServiceName*: LPTSTR lpServiceProc*: LPSERVICE_MAIN_FUNCTION LPSERVICE_TABLE_ENTRY* = ptr SERVICE_TABLE_ENTRY TSERVICETABLEENTRY* = SERVICE_TABLE_ENTRY PSERVICETABLEENTRY* = ptr SERVICE_TABLE_ENTRY - SERVICE_TYPE_VALUE_ABS* {.final.} = object + SERVICE_TYPE_VALUE_ABS* {.final, pure.} = object dwNameSpace*: DWORD dwValueType*: DWORD dwValueSize*: DWORD @@ -11281,14 +11153,14 @@ type TSERVICETYPEVALUEABS* = SERVICE_TYPE_VALUE_ABS PSERVICETYPEVALUEABS* = ptr SERVICE_TYPE_VALUE_ABS - SERVICE_TYPE_INFO_ABS* {.final.} = object + SERVICE_TYPE_INFO_ABS* {.final, pure.} = object lpTypeName*: LPTSTR dwValueCount*: DWORD Values*: array[0..0, SERVICE_TYPE_VALUE_ABS] TSERVICETYPEINFOABS* = SERVICE_TYPE_INFO_ABS PSERVICETYPEINFOABS* = ptr SERVICE_TYPE_INFO_ABS - SESSION_BUFFER* {.final.} = object + SESSION_BUFFER* {.final, pure.} = object lsn*: UCHAR state*: UCHAR local_name*: array[0..(NCBNAMSZ) - 1, UCHAR] @@ -11298,7 +11170,7 @@ type TSESSIONBUFFER* = SESSION_BUFFER PSESSIONBUFFER* = ptr SESSION_BUFFER - SESSION_HEADER* {.final.} = object + SESSION_HEADER* {.final, pure.} = object sess_name*: UCHAR num_sess*: UCHAR rcv_dg_outstanding*: UCHAR @@ -11306,7 +11178,7 @@ type TSESSIONHEADER* = SESSION_HEADER PSESSIONHEADER* = ptr SESSION_HEADER - SET_PARTITION_INFORMATION* {.final.} = object + SET_PARTITION_INFORMATION* {.final, pure.} = object PartitionType*: int8 TSETPARTITIONINFORMATION* = SET_PARTITION_INFORMATION @@ -11314,7 +11186,7 @@ type SHCONTF* = enum SHCONTF_FOLDERS = 32, SHCONTF_NONFOLDERS = 64, SHCONTF_INCLUDEHIDDEN = 128 TSHCONTF* = SHCONTF - SHFILEINFO* {.final.} = object + SHFILEINFO* {.final, pure.} = object hIcon*: HICON iIcon*: int32 dwAttributes*: DWORD @@ -11326,7 +11198,7 @@ type FILEOP_FLAGS* = int16 TFILEOPFLAGS* = FILEOP_FLAGS PFILEOPFLAGS* = ptr FILEOP_FLAGS - SHFILEOPSTRUCT* {.final.} = object + SHFILEOPSTRUCT* {.final, pure.} = object hwnd*: HWND wFunc*: UINT pFrom*: LPCSTR @@ -11341,9 +11213,8 @@ type PSHFILEOPSTRUCT* = ptr SHFILEOPSTRUCT SHGNO* = enum SHGDN_NORMAL = 0, SHGDN_INFOLDER = 1, SHGDN_FORPARSING = 0x00008000 - tagSHGDN* = SHGNO TSHGDN* = SHGNO - SHNAMEMAPPING* {.final.} = object + SHNAMEMAPPING* {.final, pure.} = object pszOldPath*: LPSTR pszNewPath*: LPSTR cchOldPath*: int32 @@ -11352,7 +11223,7 @@ type LPSHNAMEMAPPING* = ptr SHNAMEMAPPING TSHNAMEMAPPING* = SHNAMEMAPPING PSHNAMEMAPPING* = ptr SHNAMEMAPPING - SID_AND_ATTRIBUTES* {.final.} = object + SID_AND_ATTRIBUTES* {.final, pure.} = object Sid*: PSID Attributes*: DWORD @@ -11361,12 +11232,12 @@ type SID_AND_ATTRIBUTES_ARRAY* = array[0..(ANYSIZE_ARRAY) - 1, SID_AND_ATTRIBUTES] PSID_AND_ATTRIBUTES_ARRAY* = ptr SID_AND_ATTRIBUTES_ARRAY TSIDANDATTRIBUTESARRAY* = SID_AND_ATTRIBUTES_ARRAY - SINGLE_LIST_ENTRY* {.final.} = object + SINGLE_LIST_ENTRY* {.final, pure.} = object Next*: ptr SINGLE_LIST_ENTRY TSINGLELISTENTRY* = SINGLE_LIST_ENTRY PSINGLELISTENTRY* = ptr SINGLE_LIST_ENTRY - SOUNDSENTRY* {.final.} = object + SOUNDSENTRY* {.final, pure.} = object cbSize*: UINT dwFlags*: DWORD iFSTextEffect*: DWORD @@ -11381,10 +11252,9 @@ type iWindowsEffectOrdinal*: DWORD LPSOUNDSENTRY* = ptr SOUNDSENTRY - tagSOUNDSENTRY* = SOUNDSENTRY TSOUNDSENTRY* = SOUNDSENTRY PSOUNDSENTRY* = ptr SOUNDSENTRY - STARTUPINFO* {.final.} = object + STARTUPINFO* {.final, pure.} = object cb*: DWORD lpReserved*: LPTSTR lpDesktop*: LPTSTR @@ -11407,42 +11277,42 @@ type LPSTARTUPINFO* = ptr STARTUPINFO TSTARTUPINFO* = STARTUPINFO PSTARTUPINFO* = ptr STARTUPINFO - STICKYKEYS* {.final.} = object + STICKYKEYS* {.final, pure.} = object cbSize*: DWORD dwFlags*: DWORD LPSTICKYKEYS* = ptr STICKYKEYS TSTICKYKEYS* = STICKYKEYS PSTICKYKEYS* = ptr STICKYKEYS - STRRET* {.final.} = object + STRRET* {.final, pure.} = object uType*: UINT cStr*: array[0..(MAX_PATH) - 1, char] LPSTRRET* = ptr STRRET TSTRRET* = STRRET PSTRRET* = ptr STRRET - STYLEBUF* {.final.} = object + STYLEBUF* {.final, pure.} = object dwStyle*: DWORD szDescription*: array[0..31, CHAR] LPSTYLEBUF* = ptr STYLEBUF TSTYLEBUF* = STYLEBUF PSTYLEBUF* = ptr STYLEBUF - STYLESTRUCT* {.final.} = object + STYLESTRUCT* {.final, pure.} = object styleOld*: DWORD styleNew*: DWORD LPSTYLESTRUCT* = ptr STYLESTRUCT TSTYLESTRUCT* = STYLESTRUCT PSTYLESTRUCT* = ptr STYLESTRUCT - SYSTEM_AUDIT_ACE* {.final.} = object + SYSTEM_AUDIT_ACE* {.final, pure.} = object Header*: ACE_HEADER Mask*: ACCESS_MASK SidStart*: DWORD TSYSTEMAUDITACE* = SYSTEM_AUDIT_ACE PSYSTEMAUDITACE* = ptr SYSTEM_AUDIT_ACE - SYSTEM_INFO* {.final.} = object + SYSTEM_INFO* {.final, pure.} = object dwOemId*: DWORD dwPageSize*: DWORD lpMinimumApplicationAddress*: LPVOID @@ -11457,7 +11327,7 @@ type LPSYSTEM_INFO* = ptr SYSTEM_INFO TSYSTEMINFO* = SYSTEM_INFO PSYSTEMINFO* = ptr SYSTEM_INFO - SYSTEM_POWER_STATUS* {.final.} = object + SYSTEM_POWER_STATUS* {.final, pure.} = object ACLineStatus*: int8 BatteryFlag*: int8 BatteryLifePercent*: int8 @@ -11468,12 +11338,12 @@ type TSYSTEMPOWERSTATUS* = SYSTEM_POWER_STATUS PSYSTEMPOWERSTATUS* = ptr SYSTEM_POWER_STATUS LPSYSTEM_POWER_STATUS* = ptr emptyrecord - TAPE_ERASE* {.final.} = object + TAPE_ERASE* {.final, pure.} = object `type`*: ULONG TTAPEERASE* = TAPE_ERASE PTAPEERASE* = ptr TAPE_ERASE - TAPE_GET_DRIVE_PARAMETERS* {.final.} = object + TAPE_GET_DRIVE_PARAMETERS* {.final, pure.} = object ECC*: bool Compression*: bool DataPadding*: bool @@ -11488,7 +11358,7 @@ type TTAPEGETDRIVEPARAMETERS* = TAPE_GET_DRIVE_PARAMETERS PTAPEGETDRIVEPARAMETERS* = ptr TAPE_GET_DRIVE_PARAMETERS - TAPE_GET_MEDIA_PARAMETERS* {.final.} = object + TAPE_GET_MEDIA_PARAMETERS* {.final, pure.} = object Capacity*: LARGE_INTEGER Remaining*: LARGE_INTEGER BlockSize*: DWORD @@ -11497,7 +11367,7 @@ type TTAPEGETMEDIAPARAMETERS* = TAPE_GET_MEDIA_PARAMETERS PTAPEGETMEDIAPARAMETERS* = ptr TAPE_GET_MEDIA_PARAMETERS - TAPE_GET_POSITION* {.final.} = object + TAPE_GET_POSITION* {.final, pure.} = object `type`*: ULONG Partition*: ULONG OffsetLow*: ULONG @@ -11505,12 +11375,12 @@ type TTAPEGETPOSITION* = TAPE_GET_POSITION PTAPEGETPOSITION* = ptr TAPE_GET_POSITION - TAPE_PREPARE* {.final.} = object + TAPE_PREPARE* {.final, pure.} = object Operation*: ULONG TTAPEPREPARE* = TAPE_PREPARE PTAPEPREPARE* = ptr TAPE_PREPARE - TAPE_SET_DRIVE_PARAMETERS* {.final.} = object + TAPE_SET_DRIVE_PARAMETERS* {.final, pure.} = object ECC*: bool Compression*: bool DataPadding*: bool @@ -11519,12 +11389,12 @@ type TTAPESETDRIVEPARAMETERS* = TAPE_SET_DRIVE_PARAMETERS PTAPESETDRIVEPARAMETERS* = ptr TAPE_SET_DRIVE_PARAMETERS - TAPE_SET_MEDIA_PARAMETERS* {.final.} = object + TAPE_SET_MEDIA_PARAMETERS* {.final, pure.} = object BlockSize*: ULONG TTAPESETMEDIAPARAMETERS* = TAPE_SET_MEDIA_PARAMETERS PTAPESETMEDIAPARAMETERS* = ptr TAPE_SET_MEDIA_PARAMETERS - TAPE_SET_POSITION* {.final.} = object + TAPE_SET_POSITION* {.final, pure.} = object `Method`*: ULONG Partition*: ULONG OffsetLow*: ULONG @@ -11532,19 +11402,19 @@ type TTAPESETPOSITION* = TAPE_SET_POSITION PTAPESETPOSITION* = ptr TAPE_SET_POSITION - TAPE_WRITE_MARKS* {.final.} = object + TAPE_WRITE_MARKS* {.final, pure.} = object `type`*: ULONG Count*: ULONG TTAPEWRITEMARKS* = TAPE_WRITE_MARKS PTAPEWRITEMARKS* = ptr TAPE_WRITE_MARKS - TTBADDBITMAP* {.final.} = object + TTBADDBITMAP* {.final, pure.} = object hInst*: HINST nID*: UINT LPTBADDBITMAP* = ptr TTBADDBITMAP PTBADDBITMAP* = ptr TTBADDBITMAP - TBBUTTON* {.final.} = object + TBBUTTON* {.final, pure.} = object iBitmap*: int32 idCommand*: int32 fsState*: int8 @@ -11556,7 +11426,7 @@ type LPCTBBUTTON* = ptr TBBUTTON TTBBUTTON* = TBBUTTON PTBBUTTON* = ptr TBBUTTON - TBNOTIFY* {.final.} = object + TBNOTIFY* {.final, pure.} = object hdr*: NMHDR iItem*: int32 tbButton*: TBBUTTON @@ -11566,20 +11436,20 @@ type LPTBNOTIFY* = ptr TBNOTIFY TTBNOTIFY* = TBNOTIFY PTBNOTIFY* = ptr TBNOTIFY - TBSAVEPARAMS* {.final.} = object + TBSAVEPARAMS* {.final, pure.} = object hkr*: HKEY pszSubKey*: LPCTSTR pszValueName*: LPCTSTR TTBSAVEPARAMS* = TBSAVEPARAMS PTBSAVEPARAMS* = ptr TBSAVEPARAMS - TC_HITTESTINFO* {.final.} = object + TC_HITTESTINFO* {.final, pure.} = object pt*: POINT flags*: UINT TTCHITTESTINFO* = TC_HITTESTINFO PTCHITTESTINFO* = ptr TC_HITTESTINFO - TC_ITEM* {.final.} = object + TC_ITEM* {.final, pure.} = object mask*: UINT lpReserved1*: UINT lpReserved2*: UINT @@ -11590,7 +11460,7 @@ type TTCITEM* = TC_ITEM PTCITEM* = ptr TC_ITEM - TC_ITEMHEADER* {.final.} = object + TC_ITEMHEADER* {.final, pure.} = object mask*: UINT lpReserved1*: UINT lpReserved2*: UINT @@ -11600,20 +11470,20 @@ type TTCITEMHEADER* = TC_ITEMHEADER PTCITEMHEADER* = ptr TC_ITEMHEADER - TC_KEYDOWN* {.final.} = object + TC_KEYDOWN* {.final, pure.} = object hdr*: NMHDR wVKey*: int16 flags*: UINT TTCKEYDOWN* = TC_KEYDOWN PTCKEYDOWN* = ptr TC_KEYDOWN - TEXTRANGE* {.final.} = object + TEXTRANGE* {.final, pure.} = object chrg*: CHARRANGE lpstrText*: LPSTR Ttextrange* = TEXTRANGE Ptextrange* = ptr TEXTRANGE - TIME_ZONE_INFORMATION* {.final.} = object + TIME_ZONE_INFORMATION* {.final, pure.} = object Bias*: LONG StandardName*: array[0..31, WCHAR] StandardDate*: SYSTEMTIME @@ -11625,18 +11495,18 @@ type LPTIME_ZONE_INFORMATION* = ptr TIME_ZONE_INFORMATION TTIMEZONEINFORMATION* = TIME_ZONE_INFORMATION PTIMEZONEINFORMATION* = ptr TIME_ZONE_INFORMATION - TOGGLEKEYS* {.final.} = object + TOGGLEKEYS* {.final, pure.} = object cbSize*: DWORD dwFlags*: DWORD TTOGGLEKEYS* = TOGGLEKEYS PTOGGLEKEYS* = ptr TOGGLEKEYS - TTOKEN_SOURCE* {.final.} = object + TTOKEN_SOURCE* {.final, pure.} = object SourceName*: array[0..7, CHAR] SourceIdentifier*: LUID PTOKENSOURCE* = ptr TTOKEN_SOURCE - TOKEN_CONTROL* {.final.} = object + TOKEN_CONTROL* {.final, pure.} = object TokenId*: LUID AuthenticationId*: LUID ModifiedId*: LUID @@ -11644,31 +11514,31 @@ type TTOKENCONTROL* = TOKEN_CONTROL PTOKENCONTROL* = ptr TOKEN_CONTROL - TTOKEN_DEFAULT_DACL* {.final.} = object + TTOKEN_DEFAULT_DACL* {.final, pure.} = object DefaultDacl*: PACL PTOKENDEFAULTDACL* = ptr TTOKEN_DEFAULT_DACL - TTOKEN_GROUPS* {.final.} = object + TTOKEN_GROUPS* {.final, pure.} = object GroupCount*: DWORD Groups*: array[0..(ANYSIZE_ARRAY) - 1, SID_AND_ATTRIBUTES] LPTOKEN_GROUPS* = ptr TTOKEN_GROUPS PTOKENGROUPS* = ptr TTOKEN_GROUPS - TTOKEN_OWNER* {.final.} = object + TTOKEN_OWNER* {.final, pure.} = object Owner*: PSID PTOKENOWNER* = ptr TTOKEN_OWNER - TTOKEN_PRIMARY_GROUP* {.final.} = object + TTOKEN_PRIMARY_GROUP* {.final, pure.} = object PrimaryGroup*: PSID PTOKENPRIMARYGROUP* = ptr TTOKEN_PRIMARY_GROUP - TTOKEN_PRIVILEGES* {.final.} = object + TTOKEN_PRIVILEGES* {.final, pure.} = object PrivilegeCount*: DWORD Privileges*: array[0..(ANYSIZE_ARRAY) - 1, LUID_AND_ATTRIBUTES] PTOKEN_PRIVILEGES* = ptr TTOKEN_PRIVILEGES LPTOKEN_PRIVILEGES* = ptr TTOKEN_PRIVILEGES - TTOKEN_STATISTICS* {.final.} = object + TTOKEN_STATISTICS* {.final, pure.} = object TokenId*: LUID AuthenticationId*: LUID ExpirationTime*: LARGE_INTEGER @@ -11681,11 +11551,11 @@ type ModifiedId*: LUID PTOKENSTATISTICS* = ptr TTOKEN_STATISTICS - TTOKEN_USER* {.final.} = object + TTOKEN_USER* {.final, pure.} = object User*: SID_AND_ATTRIBUTES PTOKENUSER* = ptr TTOKEN_USER - TOOLINFO* {.final.} = object + TOOLINFO* {.final, pure.} = object cbSize*: UINT uFlags*: UINT hwnd*: HWND @@ -11697,7 +11567,7 @@ type LPTOOLINFO* = ptr TOOLINFO TTOOLINFO* = TOOLINFO PTOOLINFO* = ptr TOOLINFO - TOOLTIPTEXT* {.final.} = object + TOOLTIPTEXT* {.final, pure.} = object hdr*: NMHDR lpszText*: LPTSTR szText*: array[0..79, char] @@ -11707,15 +11577,14 @@ type LPTOOLTIPTEXT* = ptr TOOLTIPTEXT TTOOLTIPTEXT* = TOOLTIPTEXT PTOOLTIPTEXT* = ptr TOOLTIPTEXT - TPMPARAMS* {.final.} = object + TPMPARAMS* {.final, pure.} = object cbSize*: UINT rcExclude*: RECT LPTPMPARAMS* = ptr TPMPARAMS - tagTPMPARAMS* = TPMPARAMS TTPMPARAMS* = TPMPARAMS PTPMPARAMS* = ptr TPMPARAMS - TRANSMIT_FILE_BUFFERS* {.final.} = object + TRANSMIT_FILE_BUFFERS* {.final, pure.} = object Head*: PVOID HeadLength*: DWORD Tail*: PVOID @@ -11723,7 +11592,7 @@ type TTRANSMITFILEBUFFERS* = TRANSMIT_FILE_BUFFERS PTRANSMITFILEBUFFERS* = ptr TRANSMIT_FILE_BUFFERS - TTHITTESTINFO* {.final.} = object + TTHITTESTINFO* {.final, pure.} = object hwnd*: HWND pt*: POINT ti*: TOOLINFO @@ -11731,7 +11600,7 @@ type LPHITTESTINFO* = ptr TTHITTESTINFO TTTHITTESTINFO* = TTHITTESTINFO PTTHITTESTINFO* = ptr TTHITTESTINFO - TTPOLYCURVE* {.final.} = object + TTPOLYCURVE* {.final, pure.} = object wType*: int16 cpfx*: int16 apfx*: array[0..0, POINTFX] @@ -11739,7 +11608,7 @@ type LPTTPOLYCURVE* = ptr TTPOLYCURVE TTTPOLYCURVE* = TTPOLYCURVE PTTPOLYCURVE* = ptr TTPOLYCURVE - TTPOLYGONHEADER* {.final.} = object + TTPOLYGONHEADER* {.final, pure.} = object cb*: DWORD dwType*: DWORD pfxStart*: POINTFX @@ -11747,13 +11616,13 @@ type LPTTPOLYGONHEADER* = ptr TTPOLYGONHEADER TTTPOLYGONHEADER* = TTPOLYGONHEADER PTTPOLYGONHEADER* = ptr TTPOLYGONHEADER - TV_DISPINFO* {.final.} = object + TV_DISPINFO* {.final, pure.} = object hdr*: NMHDR item*: TV_ITEM TTVDISPINFO* = TV_DISPINFO PTVDISPINFO* = ptr TV_DISPINFO - TV_HITTESTINFO* {.final.} = object + TV_HITTESTINFO* {.final, pure.} = object pt*: POINT flags*: UINT hItem*: HTREEITEM @@ -11761,7 +11630,7 @@ type LPTV_HITTESTINFO* = ptr TV_HITTESTINFO TTVHITTESTINFO* = TV_HITTESTINFO PTVHITTESTINFO* = ptr TV_HITTESTINFO - TV_INSERTSTRUCT* {.final.} = object + TV_INSERTSTRUCT* {.final, pure.} = object hParent*: HTREEITEM hInsertAfter*: HTREEITEM item*: TV_ITEM @@ -11769,14 +11638,14 @@ type LPTV_INSERTSTRUCT* = ptr TV_INSERTSTRUCT TTVINSERTSTRUCT* = TV_INSERTSTRUCT PTVINSERTSTRUCT* = ptr TV_INSERTSTRUCT - TV_KEYDOWN* {.final.} = object + TV_KEYDOWN* {.final, pure.} = object hdr*: NMHDR wVKey*: int16 flags*: UINT TTVKEYDOWN* = TV_KEYDOWN PTVKEYDOWN* = ptr TV_KEYDOWN - TV_SORTCB* {.final.} = object + TV_SORTCB* {.final, pure.} = object hParent*: HTREEITEM lpfnCompare*: PFNTVCOMPARE lParam*: LPARAM @@ -11784,26 +11653,25 @@ type LPTV_SORTCB* = ptr TV_SORTCB TTVSORTCB* = TV_SORTCB PTVSORTCB* = ptr TV_SORTCB - UDACCEL* {.final.} = object + UDACCEL* {.final, pure.} = object nSec*: UINT nInc*: UINT TUDACCEL* = UDACCEL PUDACCEL* = ptr UDACCEL - UNIVERSAL_NAME_INFO* {.final.} = object + UNIVERSAL_NAME_INFO* {.final, pure.} = object lpUniversalName*: LPTSTR TUNIVERSALNAMEINFO* = UNIVERSAL_NAME_INFO PUNIVERSALNAMEINFO* = ptr UNIVERSAL_NAME_INFO - USEROBJECTFLAGS* {.final.} = object + USEROBJECTFLAGS* {.final, pure.} = object fInherit*: WINBOOL fReserved*: WINBOOL dwFlags*: DWORD - tagUSEROBJECTFLAGS* = USEROBJECTFLAGS TUSEROBJECTFLAGS* = USEROBJECTFLAGS PUSEROBJECTFLAGS* = ptr USEROBJECTFLAGS - VALENT* {.final.} = object + VALENT* {.final, pure.} = object ve_valuename*: LPTSTR ve_valuelen*: DWORD ve_valueptr*: DWORD @@ -11814,13 +11682,13 @@ type value_ent* = VALENT Tvalue_ent* = VALENT Pvalue_ent* = ptr VALENT - VERIFY_INFORMATION* {.final.} = object + VERIFY_INFORMATION* {.final, pure.} = object StartingOffset*: LARGE_INTEGER len*: DWORD TVERIFYINFORMATION* = VERIFY_INFORMATION PVERIFYINFORMATION* = ptr VERIFY_INFORMATION - VS_FIXEDFILEINFO* {.final.} = object + VS_FIXEDFILEINFO* {.final, pure.} = object dwSignature*: DWORD dwStrucVersion*: DWORD dwFileVersionMS*: DWORD @@ -11837,7 +11705,7 @@ type TVSFIXEDFILEINFO* = VS_FIXEDFILEINFO PVSFIXEDFILEINFO* = ptr VS_FIXEDFILEINFO - WIN32_FIND_DATA* {.final.} = object + WIN32_FIND_DATA* {.final, pure.} = object dwFileAttributes*: DWORD ftCreationTime*: FILETIME ftLastAccessTime*: FILETIME @@ -11853,7 +11721,7 @@ type PWIN32_FIND_DATA* = ptr WIN32_FIND_DATA TWIN32FINDDATA* = WIN32_FIND_DATA TWIN32FINDDATAA* = WIN32_FIND_DATA - WIN32_FIND_DATAW* {.final.} = object + WIN32_FIND_DATAW* {.final, pure.} = object dwFileAttributes*: DWORD ftCreationTime*: FILETIME ftLastAccessTime*: FILETIME @@ -11868,7 +11736,7 @@ type LPWIN32_FIND_DATAW* = ptr WIN32_FIND_DATAW PWIN32_FIND_DATAW* = ptr WIN32_FIND_DATAW TWIN32FINDDATAW* = WIN32_FIND_DATAW - WIN32_STREAM_ID* {.final.} = object + WIN32_STREAM_ID* {.final, pure.} = object dwStreamId*: DWORD dwStreamAttributes*: DWORD Size*: LARGE_INTEGER @@ -11877,7 +11745,7 @@ type TWIN32STREAMID* = WIN32_STREAM_ID PWIN32STREAMID* = ptr WIN32_STREAM_ID - WINDOWPLACEMENT* {.final.} = object + WINDOWPLACEMENT* {.final, pure.} = object len*: UINT flags*: UINT showCmd*: UINT @@ -11887,7 +11755,7 @@ type TWINDOWPLACEMENT* = WINDOWPLACEMENT PWINDOWPLACEMENT* = ptr WINDOWPLACEMENT - WNDCLASS* {.final.} = object + WNDCLASS* {.final, pure.} = object style*: UINT lpfnWndProc*: WNDPROC cbClsExtra*: int32 @@ -11903,7 +11771,7 @@ type TWNDCLASS* = WNDCLASS TWNDCLASSA* = WNDCLASS PWNDCLASS* = ptr WNDCLASS - WNDCLASSW* {.final.} = object + WNDCLASSW* {.final, pure.} = object style*: UINT lpfnWndProc*: WNDPROC cbClsExtra*: int32 @@ -11918,7 +11786,7 @@ type LPWNDCLASSW* = ptr WNDCLASSW TWNDCLASSW* = WNDCLASSW PWNDCLASSW* = ptr WNDCLASSW - WNDCLASSEX* {.final.} = object + WNDCLASSEX* {.final, pure.} = object cbSize*: UINT style*: UINT lpfnWndProc*: WNDPROC @@ -11936,7 +11804,7 @@ type TWNDCLASSEX* = WNDCLASSEX TWNDCLASSEXA* = WNDCLASSEX PWNDCLASSEX* = ptr WNDCLASSEX - WNDCLASSEXW* {.final.} = object + WNDCLASSEXW* {.final, pure.} = object cbSize*: UINT style*: UINT lpfnWndProc*: WNDPROC @@ -11953,7 +11821,7 @@ type LPWNDCLASSEXW* = ptr WNDCLASSEXW TWNDCLASSEXW* = WNDCLASSEXW PWNDCLASSEXW* = ptr WNDCLASSEXW - CONNECTDLGSTRUCT* {.final.} = object + CONNECTDLGSTRUCT* {.final, pure.} = object cbStructure*: DWORD hwndOwner*: HWND lpConnRes*: LPNETRESOURCE @@ -11963,7 +11831,7 @@ type LPCONNECTDLGSTRUCT* = ptr CONNECTDLGSTRUCT TCONNECTDLGSTRUCT* = CONNECTDLGSTRUCT PCONNECTDLGSTRUCT* = ptr CONNECTDLGSTRUCT - DISCDLGSTRUCT* {.final.} = object + DISCDLGSTRUCT* {.final, pure.} = object cbStructure*: DWORD hwndOwner*: HWND lpLocalName*: LPTSTR @@ -11974,7 +11842,7 @@ type TDISCDLGSTRUCT* = DISCDLGSTRUCT TDISCDLGSTRUCTA* = DISCDLGSTRUCT PDISCDLGSTRUCT* = ptr DISCDLGSTRUCT - NETINFOSTRUCT* {.final.} = object + NETINFOSTRUCT* {.final, pure.} = object cbStructure*: DWORD dwProviderVersion*: DWORD dwStatus*: DWORD @@ -11987,7 +11855,7 @@ type LPNETINFOSTRUCT* = ptr NETINFOSTRUCT TNETINFOSTRUCT* = NETINFOSTRUCT PNETINFOSTRUCT* = ptr NETINFOSTRUCT - NETCONNECTINFOSTRUCT* {.final.} = object + NETCONNECTINFOSTRUCT* {.final, pure.} = object cbStructure*: DWORD dwFlags*: DWORD dwSpeed*: DWORD @@ -12009,13 +11877,13 @@ type para3: int32, para4: LPARAM): int32{.stdcall.} LPOVERLAPPED_COMPLETION_ROUTINE* = proc (para1: DWORD, para2: DWORD, para3: LPOVERLAPPED){.stdcall.} # Structures for the extensions to OpenGL - POINTFLOAT* {.final.} = object + POINTFLOAT* {.final, pure.} = object x*: float32 y*: float32 TPOINTFLOAT* = POINTFLOAT PPOINTFLOAT* = ptr POINTFLOAT - GLYPHMETRICSFLOAT* {.final.} = object + GLYPHMETRICSFLOAT* {.final, pure.} = object gmfBlackBoxX*: float32 gmfBlackBoxY*: float32 gmfptGlyphOrigin*: POINTFLOAT @@ -12025,7 +11893,7 @@ type LPGLYPHMETRICSFLOAT* = ptr GLYPHMETRICSFLOAT TGLYPHMETRICSFLOAT* = GLYPHMETRICSFLOAT PGLYPHMETRICSFLOAT* = ptr GLYPHMETRICSFLOAT - LAYERPLANEDESCRIPTOR* {.final.} = object + LAYERPLANEDESCRIPTOR* {.final, pure.} = object nSize*: int16 nVersion*: int16 dwFlags*: DWORD @@ -12052,10 +11920,9 @@ type crTransparent*: COLORREF LPLAYERPLANEDESCRIPTOR* = ptr LAYERPLANEDESCRIPTOR - tagLAYERPLANEDESCRIPTOR* = LAYERPLANEDESCRIPTOR TLAYERPLANEDESCRIPTOR* = LAYERPLANEDESCRIPTOR PLAYERPLANEDESCRIPTOR* = ptr LAYERPLANEDESCRIPTOR - PIXELFORMATDESCRIPTOR* {.final.} = object + PIXELFORMATDESCRIPTOR* {.final, pure.} = object nSize*: int16 nVersion*: int16 dwFlags*: DWORD @@ -12084,10 +11951,9 @@ type dwDamageMask*: DWORD LPPIXELFORMATDESCRIPTOR* = ptr PIXELFORMATDESCRIPTOR - tagPIXELFORMATDESCRIPTOR* = PIXELFORMATDESCRIPTOR TPIXELFORMATDESCRIPTOR* = PIXELFORMATDESCRIPTOR PPIXELFORMATDESCRIPTOR* = ptr PIXELFORMATDESCRIPTOR - USER_INFO_2* {.final.} = object + USER_INFO_2* {.final, pure.} = object usri2_name*: LPWSTR usri2_password*: LPWSTR usri2_password_age*: DWORD @@ -12116,13 +11982,13 @@ type PUSER_INFO_2* = ptr USER_INFO_2 LPUSER_INFO_2* = ptr USER_INFO_2 TUSERINFO2* = USER_INFO_2 - USER_INFO_0* {.final.} = object + USER_INFO_0* {.final, pure.} = object usri0_name*: LPWSTR PUSER_INFO_0* = ptr USER_INFO_0 LPUSER_INFO_0* = ptr USER_INFO_0 TUSERINFO0* = USER_INFO_0 - USER_INFO_3* {.final.} = object + USER_INFO_3* {.final, pure.} = object usri3_name*: LPWSTR usri3_password*: LPWSTR usri3_password_age*: DWORD @@ -12156,7 +12022,7 @@ type PUSER_INFO_3* = ptr USER_INFO_3 LPUSER_INFO_3* = ptr USER_INFO_3 TUSERINFO3* = USER_INFO_3 - GROUP_INFO_2* {.final.} = object + GROUP_INFO_2* {.final, pure.} = object grpi2_name*: LPWSTR grpi2_comment*: LPWSTR grpi2_group_id*: DWORD @@ -12164,13 +12030,13 @@ type PGROUP_INFO_2* = ptr GROUP_INFO_2 TGROUPINFO2* = GROUP_INFO_2 - LOCALGROUP_INFO_0* {.final.} = object + LOCALGROUP_INFO_0* {.final, pure.} = object lgrpi0_name*: LPWSTR PLOCALGROUP_INFO_0* = ptr LOCALGROUP_INFO_0 LPLOCALGROUP_INFO_0* = ptr LOCALGROUP_INFO_0 TLOCALGROUPINFO0* = LOCALGROUP_INFO_0 - IMAGE_DOS_HEADER* {.final.} = object + IMAGE_DOS_HEADER* {.final, pure.} = object e_magic*: int16 e_cblp*: int16 e_cp*: int16 @@ -12193,7 +12059,7 @@ type PIMAGE_DOS_HEADER* = ptr IMAGE_DOS_HEADER TIMAGEDOSHEADER* = IMAGE_DOS_HEADER - NOTIFYICONDATAA* {.final.} = object + NOTIFYICONDATAA* {.final, pure.} = object cbSize*: DWORD Wnd*: HWND uID*: UINT @@ -12203,7 +12069,7 @@ type szTip*: array[0..63, Char] NOTIFYICONDATA* = NOTIFYICONDATAA - NOTIFYICONDATAW* {.final.} = object + NOTIFYICONDATAW* {.final, pure.} = object cbSize*: DWORD Wnd*: HWND uID*: UINT @@ -12224,7 +12090,7 @@ type type PWaveFormatEx* = ptr TWaveFormatEx - TWaveFormatEx* {.final.} = object + TWaveFormatEx* {.final, pure.} = object wFormatTag*: int16 # format type nChannels*: int16 # number of channels (i.e. mono, stereo, etc.) nSamplesPerSec*: DWORD # sample rate @@ -12233,7 +12099,7 @@ type wBitsPerSample*: int16 # number of bits per sample of mono data cbSize*: int16 # the count in bytes of the size of - WIN32_FILE_ATTRIBUTE_DATA* {.final.} = object + WIN32_FILE_ATTRIBUTE_DATA* {.final, pure.} = object dwFileAttributes*: DWORD ftCreationTime*: FILETIME ftLastAccessTime*: FILETIME @@ -12244,7 +12110,7 @@ type LPWIN32_FILE_ATTRIBUTE_DATA* = ptr WIN32_FILE_ATTRIBUTE_DATA TWIN32FILEATTRIBUTEDATA* = WIN32_FILE_ATTRIBUTE_DATA PWIN32FILEATTRIBUTEDATA* = ptr WIN32_FILE_ATTRIBUTE_DATA # TrackMouseEvent. NT or higher only. - TTrackMouseEvent* {.final.} = object + TTrackMouseEvent* {.final, pure.} = object cbSize*: DWORD dwFlags*: DWORD hwndTrack*: HWND @@ -13317,7 +13183,7 @@ else: HALFPARAM* = int16 HALFPARAMBOOL* = WORDBOOL type - MSG* {.final.} = object + MSG* {.final, pure.} = object hwnd*: HWND message*: UINT wParam*: WPARAM @@ -13326,24 +13192,23 @@ type pt*: POINT LPMSG* = ptr MSG - tagMSG* = MSG TMSG* = MSG PMSG* = ptr MSG PMessage* = ptr TMessage - TMessage* {.final.} = object #fields according to ICS + TMessage* {.final, pure.} = object #fields according to ICS msg*: UINT wParam*: WPARAM lParam*: LPARAM Result*: LRESULT - TWMSize* {.final.} = object + TWMSize* {.final, pure.} = object Msg*: UINT SizeType*: WPARAM Width*: HALFPARAM Height*: HALFPARAM Result*: LRESULT - TWMNoParams* {.final.} = object + TWMNoParams* {.final, pure.} = object Msg*: UINT Unused*: array[0..3, HALFPARAM] Result*: LRESULT @@ -13353,7 +13218,7 @@ type TWMDestroy* = TWMNoParams TWMClose* = TWMNoParams TWMQueryUIState* = TWMNoParams - TWMUIState* {.final.} = object + TWMUIState* {.final, pure.} = object Msg*: UINT Action*: int16 Flags*: int16 @@ -13361,7 +13226,7 @@ type TWMChangeUIState* = TWMUIState TWMUpdateUIState* = TWMUIState - TWMKey* {.final.} = object + TWMKey* {.final, pure.} = object Msg*: UINT CharCode*: int16 Unused*: int16 @@ -13374,7 +13239,7 @@ type TWMSysChar* = TWMKey TWMSysKeyDown* = TWMKey TWMSysKeyUp* = TWMKey - TWMMenuChar* {.final.} = object + TWMMenuChar* {.final, pure.} = object Msg*: UINT User*: Char MenuFlag*: int16 @@ -13386,7 +13251,7 @@ type TWMGetFont* = TWMNoParams TWMSysColorChange* = TWMNoParams TWMQueryDragIcon* = TWMNoParams - TWMScroll* {.final.} = object + TWMScroll* {.final, pure.} = object Msg*: UINT ScrollCode*: HALFPARAM Pos*: HALFPARAM @@ -13395,59 +13260,59 @@ type TWMHScroll* = TWMScroll TWMVScroll* = TWMScroll - TWMGetText* {.final.} = object + TWMGetText* {.final, pure.} = object Msg*: UINT TextMax*: LPARAM Text*: cstring Result*: LRESULT TWMGetTextLength* = TWMNoParams - TWMKillFocus* {.final.} = object + TWMKillFocus* {.final, pure.} = object Msg*: UINT FocusedWnd*: HWND UnUsed*: WPARAM Result*: LRESULT - TWMSetCursor* {.final.} = object + TWMSetCursor* {.final, pure.} = object Msg*: UINT CursorWnd*: HWND HitTest*: HALFPARAM MouseMsg*: HALFPARAM Result*: LRESULT - TWMSetFocus* {.final.} = object + TWMSetFocus* {.final, pure.} = object Msg*: UINT FocusedWnd*: HWND Unused*: WPARAM Result*: LRESULT - TWMSetFont* {.final.} = object + TWMSetFont* {.final, pure.} = object Msg*: UINT Font*: HFONT Redraw*: HALFPARAMBOOL Unused*: HALFPARAM Result*: LRESULT - TWMShowWindow* {.final.} = object + TWMShowWindow* {.final, pure.} = object Msg*: UINT Show*: HALFPARAMBOOL Unused*: HALFPARAM Status*: WPARAM Result*: LRESULT - TWMEraseBkgnd* {.final.} = object + TWMEraseBkgnd* {.final, pure.} = object Msg*: UINT DC*: HDC Unused*: LPARAM Result*: LRESULT - TWMNCHitTest* {.final.} = object + TWMNCHitTest* {.final, pure.} = object Msg*: UINT Unused*: int32 Pos*: TSmallPoint Result*: LRESULT - TWMMouse* {.final.} = object + TWMMouse* {.final, pure.} = object Msg*: UINT Keys*: int32 Pos*: TSmallPoint @@ -13459,14 +13324,14 @@ type TWMMButtonDblClk* = TWMMouse TWMMButtonDown* = TWMMouse TWMMButtonUp* = TWMMouse - TWMMouseWheel* {.final.} = object + TWMMouseWheel* {.final, pure.} = object Msg*: UINT Keys*: int16 WheelDelta*: int16 Pos*: TSmallPoint Result*: LRESULT - TWMNCHitMessage* {.final.} = object + TWMNCHitMessage* {.final, pure.} = object Msg*: UINT HitTest*: int32 XCursor*: int16 @@ -13484,51 +13349,51 @@ type TWMRButtonDown* = TWMMouse TWMRButtonUp* = TWMMouse TWMMouseMove* = TWMMouse - TWMPaint* {.final.} = object + TWMPaint* {.final, pure.} = object Msg*: UINT DC*: HDC Unused*: int32 Result*: LRESULT - TWMCommand* {.final.} = object + TWMCommand* {.final, pure.} = object Msg*: UINT ItemID*: int16 NotifyCode*: int16 Ctl*: HWND Result*: LRESULT - TWMNotify* {.final.} = object + TWMNotify* {.final, pure.} = object Msg*: UINT IDCtrl*: int32 NMHdr*: PNMHdr Result*: LRESULT - TWMPrint* {.final.} = object + TWMPrint* {.final, pure.} = object Msg*: UINT DC*: HDC Flags*: int Result*: LRESULT TWMPrintClient* = TWMPrint - TWMWinIniChange* {.final.} = object + TWMWinIniChange* {.final, pure.} = object Msg*: UINT Unused*: int Section*: cstring Result*: LRESULT - TWMContextMenu* {.final.} = object + TWMContextMenu* {.final, pure.} = object Msg*: UINT hWnd*: HWND Pos*: TSmallPoint Result*: LRESULT - TWMNCCalcSize* {.final.} = object + TWMNCCalcSize* {.final, pure.} = object Msg*: UINT CalcValidRects*: WINBOOL CalcSize_Params*: PNCCalcSizeParams Result*: LRESULT - TWMCharToItem* {.final.} = object + TWMCharToItem* {.final, pure.} = object Msg*: UINT Key*: int16 CaretPos*: int16 @@ -13537,7 +13402,7 @@ type TWMVKeyToItem* = TWMCharToItem TMyEventRange = range[0'i16..16000'i16] - TWMParentNotify* {.final.} = object + TWMParentNotify* {.final, pure.} = object Msg*: UINT case Event*: TMyEventRange of TMyEventRange(WM_CREATE), TMyEventRange(WM_DESTROY): @@ -13556,7 +13421,7 @@ type Value2*: int32 Result*: LRESULT - TWMSysCommand* {.final.} = object + TWMSysCommand* {.final, pure.} = object Msg*: UINT CmdType*: int32 XPos*: int16 @@ -13574,13 +13439,13 @@ type # else: # of SC_KEYMENU: # Key*: int16 - TWMMove* {.final.} = object + TWMMove* {.final, pure.} = object Msg*: UINT Unused*: int Pos*: TSmallPoint Result*: LRESULT - TWMWindowPosMsg* {.final.} = object + TWMWindowPosMsg* {.final, pure.} = object Msg*: UINT Unused*: int WindowPos*: PWindowPos @@ -13588,101 +13453,101 @@ type TWMWindowPosChanged* = TWMWindowPosMsg TWMWindowPosChanging* = TWMWindowPosMsg - TWMCompareItem* {.final.} = object + TWMCompareItem* {.final, pure.} = object Msg*: UINT Ctl*: HWnd CompareItemStruct*: PCompareItemStruct Result*: LRESULT - TWMDeleteItem* {.final.} = object + TWMDeleteItem* {.final, pure.} = object Msg*: UINT Ctl*: HWND DeleteItemStruct*: PDeleteItemStruct Result*: LRESULT - TWMDrawItem* {.final.} = object + TWMDrawItem* {.final, pure.} = object Msg*: UINT Ctl*: HWND DrawItemStruct*: PDrawItemStruct Result*: LRESULT - TWMMeasureItem* {.final.} = object + TWMMeasureItem* {.final, pure.} = object Msg*: UINT IDCtl*: HWnd MeasureItemStruct*: PMeasureItemStruct Result*: LRESULT - TWMNCCreate* {.final.} = object + TWMNCCreate* {.final, pure.} = object Msg*: UINT Unused*: int CreateStruct*: PCreateStruct Result*: LRESULT - TWMInitMenuPopup* {.final.} = object + TWMInitMenuPopup* {.final, pure.} = object Msg*: UINT MenuPopup*: HMENU Pos*: int16 SystemMenu*: WordBool Result*: LRESULT - TWMMenuSelect* {.final.} = object + TWMMenuSelect* {.final, pure.} = object Msg*: UINT IDItem*: int16 MenuFlag*: int16 Menu*: HMENU Result*: LRESULT - TWMActivate* {.final.} = object + TWMActivate* {.final, pure.} = object Msg*: UINT Active*: int16 Minimized*: WordBool ActiveWindow*: HWND Result*: LRESULT - TWMQueryEndSession* {.final.} = object + TWMQueryEndSession* {.final, pure.} = object Msg*: UINT Source*: int32 Unused*: int32 Result*: LRESULT - TWMMDIActivate* {.final.} = object + TWMMDIActivate* {.final, pure.} = object Msg*: UINT DeactiveWnd*: HWND ActiveWnd*: HWND Result*: LRESULT - TWMNextDlgCtl* {.final.} = object + TWMNextDlgCtl* {.final, pure.} = object Msg*: UINT CtlFocus*: int32 Handle*: WordBool Unused*: int16 Result*: LRESULT - TWMHelp* {.final.} = object + TWMHelp* {.final, pure.} = object Msg*: UINT Unused*: int HelpInfo*: PHelpInfo Result*: LRESULT - TWMGetMinMaxInfo* {.final.} = object + TWMGetMinMaxInfo* {.final, pure.} = object Msg*: UINT Unused*: int MinMaxInfo*: PMinMaxInfo Result*: LRESULT - TWMSettingChange* {.final.} = object + TWMSettingChange* {.final, pure.} = object Msg*: UINT Flag*: int Section*: cstring Result*: LRESULT - TWMCreate* {.final.} = object + TWMCreate* {.final, pure.} = object Msg*: UINT Unused*: int CreateStruct*: PCreateStruct Result*: LRESULT - TWMCtlColor* {.final.} = object + TWMCtlColor* {.final, pure.} = object Msg*: UINT ChildDC*: HDC ChildWnd*: HWND @@ -13695,38 +13560,38 @@ type TWMCtlColorMsgbox* = TWMCtlColor TWMCtlColorDlg* = TWMCtlColor TWMCtlColorEdit* = TWMCtlColor - TWMInitDialog* {.final.} = object + TWMInitDialog* {.final, pure.} = object Msg*: UINT Focus*: HWND InitParam*: int32 Result*: LRESULT - TWMNCPaint* {.final.} = object + TWMNCPaint* {.final, pure.} = object Msg*: UINT RGN*: HRGN Unused*: int32 Result*: LRESULT - TWMSetText* {.final.} = object + TWMSetText* {.final, pure.} = object Msg*: UINT Unused*: int32 Text*: cstring Result*: LRESULT - TWMSizeClipboard* {.final.} = object + TWMSizeClipboard* {.final, pure.} = object Msg*: UINT Viewer*: HWND RC*: THandle Result*: LRESULT - TWMSpoolerStatus* {.final.} = object + TWMSpoolerStatus* {.final, pure.} = object Msg*: UINT JobStatus*: LPARAM JobsLeft*: WPARAM Unused*: WPARAM Result*: LRESULT - TWMStyleChange* {.final.} = object + TWMStyleChange* {.final, pure.} = object Msg*: UINT StyleType*: LPARAM StyleStruct*: PStyleStruct @@ -13734,54 +13599,54 @@ type TWMStyleChanged* = TWMStyleChange TWMStyleChanging* = TWMStyleChange - TWMSysDeadChar* {.final.} = object + TWMSysDeadChar* {.final, pure.} = object Msg*: UINT CharCode*: WPARAM Unused*: WPARAM KeyData*: LPARAM Result*: LRESULT - TWMSystemError* {.final.} = object + TWMSystemError* {.final, pure.} = object Msg*: UINT ErrSpec*: WPARAM Unused*: LPARAM Result*: LRESULT TWMTimeChange* = TWMNoParams - TWMTimer* {.final.} = object + TWMTimer* {.final, pure.} = object Msg*: UINT TimerID*: LPARAM TimerProc*: TFarProc Result*: LRESULT TWMUndo* = TWMNoParams - TWMVScrollClipboard* {.final.} = object + TWMVScrollClipboard* {.final, pure.} = object Msg*: UINT Viewer*: HWND ScollCode*: WPARAM ThumbPos*: WPARAM Result*: LRESULT - TWMDisplayChange* {.final.} = object + TWMDisplayChange* {.final, pure.} = object Msg*: UINT BitsPerPixel*: int Width*: WPARAM Height*: WPARAM Result*: LRESULT - TWMDropFiles* {.final.} = object + TWMDropFiles* {.final, pure.} = object Msg*: UINT Drop*: THANDLE Unused*: LPARAM Result*: LRESULT - TWMEnable* {.final.} = object + TWMEnable* {.final, pure.} = object Msg*: int Enabled*: WINBOOL Unused*: int32 Result*: int32 - TWMMouseActivate* {.final.} = object + TWMMouseActivate* {.final, pure.} = object Msg*: int TopLevel*: HWND HitTestCode*: int16 @@ -20686,7 +20551,7 @@ type TFNFiberStartRoutine* = FARPROC TFNHookProc* = HOOKPROC PObjectTypeList* = ptr TObjectTypeList - OBJECT_TYPE_LIST* {.final.} = object + OBJECT_TYPE_LIST* {.final, pure.} = object Level*: int16 Sbz*: int16 ObjectType*: PGUID @@ -20694,14 +20559,14 @@ type TObjectTypeList* = OBJECT_TYPE_LIST AUDIT_EVENT_TYPE* = DWORD PBlendFunction* = ptr TBlendFunction - BLENDFUNCTION* {.final.} = object + BLENDFUNCTION* {.final, pure.} = object BlendOp*: int8 BlendFlags*: int8 SourceConstantAlpha*: int8 AlphaFormat*: int8 TBlendFunction* = BLENDFUNCTION - WIN_CERTIFICATE* {.final.} = object + WIN_CERTIFICATE* {.final, pure.} = object dwLength*: DWord wRevision*: int16 wCertificateType*: int16 @@ -20709,7 +20574,7 @@ type TWinCertificate* = WIN_CERTIFICATE PWinCertificate* = ptr TWinCertificate - TMaxLogPalette* {.final.} = object + TMaxLogPalette* {.final, pure.} = object palVersion*: int16 palNumEntries*: int16 palPalEntry*: array[int8, TPaletteEntry] @@ -22549,79 +22414,78 @@ proc AnsiLowerBuff*(lpsz: LPSTR, cchLength: DWORD): DWORD{.stdcall, # argument types are unknown proc GetBValue(rgb: int32): int8 = - result = int8(rgb shr 16) + result = toU8(rgb shr 16'i32) proc GetGValue(rgb: int32): int8 = - result = int8((int16(rgb)) shr 8) + result = toU8(rgb shr 8'i32) proc GetRValue(rgb: int32): int8 = - result = int8(rgb) + result = toU8(rgb) proc RGB(r, g, b: int32): DWORD = - result = DWORD(((DWORD(int8(r))) or ((DWORD(int16(g))) shl 8)) or - ((DWORD(int8(b))) shl 16)) + result = toU8(r) or toU8(g shl 8'i32) or toU8(b shl 16'i32) proc HIBYTE(w: int32): int8 = - result = int8(((int16(w)) shr 8) and 0x000000FF) + result = toU8(w shr 8'i32 and 0x000000FF'i32) proc HIWORD(L: int32): int16 = - result = int16(((DWORD(L)) shr 16) and 0x0000FFFF) + result = toU16(L shr 16'i32 and 0x0000FFFF'i32) proc LOBYTE(w: int32): int8 = - result = int8(w) + result = toU8(w) proc LOWORD(L: int32): int16 = - result = int16(L) + result = toU16(L) proc MAKELONG(a, b: int32): LONG = - result = LONG((int16(a)) or ((DWORD(int16(b))) shl 16)) + result = a and 0x0000ffff'i32 or b shl 16'i32 proc MAKEWORD(a, b: int32): int16 = - result = int16((int8(a)) or ((int16(int8(b))) shl 8)) + result = toU16(a and 0xff'i32) or toU16(b shl 8'i32) proc SEXT_HIWORD(L: int32): int32 = # return type might be wrong - result = (int32(L)) shr 16 + result = HIWORD(L) proc ZEXT_HIWORD(L: int32): int32 = # return type might be wrong - result = (int(L)) shr 16 + result = ze(HIWORD(L)) proc SEXT_LOWORD(L: int32): int32 = - result = int32(SHORT(L)) + result = LOWORD(L) proc INDEXTOOVERLAYMASK(i: int32): int32 = # return type might be wrong - result = i shl 8 + result = i shl 8'i32 proc INDEXTOSTATEIMAGEMASK(i: int32): int32 = # return type might be wrong - result = i shl 12 + result = i shl 12'i32 proc MAKEINTATOM(i: int32): LPTSTR = - result = cast[LPTSTR](cast[ULONG_PTR](int16(i))) + result = cast[LPTSTR](cast[ULONG_PTR](ToU16(i))) proc MAKELANGID(p, s: int32): int32 = # return type might be wrong - result = ((int16(s)) shl 10) or (int16(p)) + result = toU16(s) shl 10'i16 or toU16(p) proc PRIMARYLANGID(lgid: int32): int16 = # PRIMARYLANGID:=WORD(lgid(@($3ff))); # h2pas error here corrected by hand PM - result = int16(lgid) and (0x000003FF) + result = toU16(lgid) and 0x000003FF'i16 proc SUBLANGID(lgid: int32): int32 = # return type might be wrong - result = (int16(lgid)) shr 10 + result = toU16(lgid) shr 10'i16 proc LANGIDFROMLCID(lcid: int32): int16 = - result = int16(lcid) + result = toU16(lcid) proc SORTIDFROMLCID(lcid: int32): int16 = - result = int16(((DWORD(lcid)) and 0x000FFFFF) shr 16) + result = toU16((lcid and 0x000FFFFF'i32) shr 16'i32) proc MAKELCID(lgid, srtid: int32): DWORD = - result = DWORD(((DWORD(int16(srtid))) shl 16) or (DWORD(int16(lgid)))) + result = toU32(srtid shl 16'i32 or lgid and 0xffff'i32) proc MAKELPARAM(L, h: int32): LPARAM = result = LPARAM(MAKELONG(L, h)) @@ -22630,7 +22494,7 @@ proc MAKELRESULT(L, h: int32): LRESULT = result = LRESULT(MAKELONG(L, h)) proc MAKEROP4(fore, back: int32): DWORD = - result = DWORD((DWORD(back shl 8) and 0xFF000000) or DWORD(fore)) + result = back shl 8'i32 and 0xFF000000'i32 or fore proc MAKEWPARAM(L, h: int32): WPARAM = result = WPARAM(MAKELONG(L, h)) @@ -22642,14 +22506,14 @@ proc GET_Y_LPARAM(lp: Windows.LParam): int32 = result = int16(HIWORD(lp)) proc PALETTEINDEX(i: int32): COLORREF = - result = COLORREF(0x01000000 or (DWORD(int16(i)))) + result = COLORREF(0x01000000'i32 or i and 0xffff'i32) proc PALETTERGB(r, g, b: int32): int32 = # return type might be wrong result = 0x02000000 or (RGB(r, g, b)) proc UNICODE_NULL(): WCHAR = - result = 0 + result = 0'i16 proc IDC_ARROW(): LPTSTR = # return type might be wrong @@ -22865,7 +22729,7 @@ proc GET_WM_HSCROLL_POS(w, L: int32): int32 = proc GET_WM_MDIACTIVATE_FACTIVATE(h, a, b: int32): int32 = # return type might be wrong - result = int32(int(b) == LONG(h)) + result = ord(b == h) proc GET_WM_MDIACTIVATE_HWNDACTIVATE(a, b: int32): HWND = result = HWND(b) @@ -23839,71 +23703,71 @@ proc InternalGetLargestConsoleWindowSize(hConsoleOutput: HANDLE): DWord{. proc GetLargestConsoleWindowSize(hConsoleOutput: HANDLE): COORD = var res: dword res = InternalGetLargestConsoleWindowSize(hConsoleOutput) - result.y = res and 0x0000ffff # XXX: correct? - result.x = res shr 16 + result.y = toU16(res and 0x0000ffff) # XXX: correct? + result.x = toU16(res shr 16) proc Succeeded(Status: HRESULT): WINBOOL = - result = (Status and 0x80000000) + result = (Status and 0x80000000'i32) proc Failed(Status: HRESULT): WINBOOL = - result = (Status and 0x80000000) + result = (Status and 0x80000000'i32) proc IsError(Status: HRESULT): WINBOOL = - result = ord((Status shr 31) == SEVERITY_ERROR) + result = ord((int(Status) shr 31) == SEVERITY_ERROR) proc HResultCode(hr: HRESULT): int32 = - result = hr and 0x0000FFFF + result = hr and 0x0000FFFF'i32 proc HResultFacility(hr: HRESULT): int32 = - result = (hr shr 16) and 0x00001FFF + result = (hr shr 16'i32) and 0x00001FFF'i32 proc HResultSeverity(hr: HRESULT): int32 = - result = (hr shr 31) and 0x00000001 + result = (hr shr 31'i32) and 0x00000001'i32 proc MakeResult(p1, p2, mask: int32): HRESULT = - result = (p1 shl 31) or (p2 shl 16) or mask + result = (p1 shl 31'i32) or (p2 shl 16'i32) or mask proc HResultFromWin32(x: int32): HRESULT = result = x - if result != 0: - result = ((result and 0x0000FFFF) or (FACILITY_WIN32 shl 16) or - 0x80000000) + if result != 0'i32: + result = ((result and 0x0000FFFF'i32) or (int32(FACILITY_WIN32) shl 16'i32) or + 0x80000000'i32) proc HResultFromNT(x: int32): HRESULT = - result = x or FACILITY_NT_BIT + result = x or int32(FACILITY_NT_BIT) proc MAKELANGID(PrimaryLang, SubLang: USHORT): int16 = - result = (SubLang shl 10) or PrimaryLang + result = (SubLang shl 10'i16) or PrimaryLang proc PRIMARYLANGID(LangId: int16): int16 = - result = LangId and 0x000003FF + result = LangId and 0x000003FF'i16 proc SUBLANGID(LangId: int16): int16 = - result = LangId shr 10 + result = LangId shr 10'i16 proc MAKELCID(LangId, SortId: int16): DWORD = - result = (DWORD(SortId) shl 16) or DWORD(LangId) + result = toU32((ze(SortId) shl 16) or ze(LangId)) proc MAKESORTLCID(LangId, SortId, SortVersion: int16): DWORD = - result = MAKELCID(LangId, SortId) or (SortVersion shl 20) + result = MAKELCID(LangId, SortId) or int(SortVersion shl 20'i32) proc LANGIDFROMLCID(LocaleId: LCID): int16 = - result = int16(LocaleId) + result = toU16(LocaleId) proc SORTIDFROMLCID(LocaleId: LCID): int16 = - result = int16((DWORD(LocaleId) shr 16) and 0x0000000F) + result = toU16((DWORD(LocaleId) shr 16) and 0x0000000F) proc SORTVERSIONFROMLCID(LocaleId: LCID): int16 = - result = int16((DWORD(LocaleId) shr 20) and 0x0000000F) + result = toU16((DWORD(LocaleId) shr 20) and 0x0000000F) proc LANG_SYSTEM_DEFAULT(): int16 = - result = MAKELANGID(int16(LANG_NEUTRAL), SUBLANG_SYS_DEFAULT) + result = toU16(MAKELANGID(toU16(LANG_NEUTRAL), SUBLANG_SYS_DEFAULT)) proc LANG_USER_DEFAULT(): int16 = - result = MAKELANGID(int16(LANG_NEUTRAL), SUBLANG_DEFAULT) + result = toU16(MAKELANGID(toU16(LANG_NEUTRAL), SUBLANG_DEFAULT)) proc LOCALE_NEUTRAL(): DWORD = - result = MAKELCID(MAKELANGID(int16(LANG_NEUTRAL), SUBLANG_NEUTRAL), SORT_DEFAULT) + result = MAKELCID(MAKELANGID(toU16(LANG_NEUTRAL), SUBLANG_NEUTRAL), SORT_DEFAULT) proc LOCALE_INVARIANT(): DWORD = - result = MAKELCID(MAKELANGID(int16(LANG_INVARIANT), SUBLANG_NEUTRAL), SORT_DEFAULT) + result = MAKELCID(MAKELANGID(toU16(LANG_INVARIANT), SUBLANG_NEUTRAL), SORT_DEFAULT) diff --git a/makefile b/makefile index 932d53022..75ac2d09b 100644 --- a/makefile +++ b/makefile @@ -1,14 +1,13 @@ -# Dummy makefile for people who don't read "readme" files, or automated +# Dummy makefile for people who don't read "readme" files, or for automated # installations -# (c) 2007 Andreas Rumpf .PHONY : all all: - python koch.py all + python koch.py boot -d:release .PHONY : install install: - python koch.py install + sh install.sh /usr/bin .PHONY : clean clean: diff --git a/nim/ast.pas b/nim/ast.pas index 587284d56..c84262db4 100644 --- a/nim/ast.pas +++ b/nim/ast.pas @@ -1,1122 +1,1426 @@ -// -// -// The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf -// -// See the file "copying.txt", included in this -// distribution, for details about the copyright. -// -unit ast; - -// abstract syntax tree + symbol table - -interface - -{$include 'config.inc'} - -uses - nsystem, charsets, msgs, hashes, - nversion, options, strutils, crc, ropes, idents, lists; - -const - ImportTablePos = 0; - ModuleTablePos = 1; - -type - TCallingConvention = ( - ccDefault, // proc has no explicit calling convention - ccStdCall, // procedure is stdcall - ccCDecl, // cdecl - ccSafeCall, // safecall - ccSysCall, // system call - ccInline, // proc should be inlined - ccFastCall, // fastcall (pass parameters in registers) - ccClosure, // proc has a closure - ccNoConvention // needed for generating proper C procs sometimes - ); - -const - CallingConvToStr: array [TCallingConvention] of string = ( - '', 'stdcall', 'cdecl', 'safecall', 'syscall', 'inline', 'fastcall', - 'closure', 'noconv'); - -(*[[[cog -def toEnum(name, elems, prefixlen=0): - body = "" - strs = "" - prefix = "" - counter = 0 - for e in elems: - if counter % 4 == 0: prefix = "\n " - else: prefix = "" - body += prefix + e + ', ' - strs += prefix + "'%s', " % e[prefixlen:] - counter += 1 - - return ("type\n T%s = (%s);\n T%ss = set of T%s;\n" - % (name, body.rstrip(", "), name, name), - "const\n %sToStr: array [T%s] of string = (%s);\n" - % (name, name, strs.rstrip(", "))) - -enums = eval(file("data/ast.yml").read()) -for key, val in enums.iteritems(): - (a, b) = toEnum(key, val) - cog.out(a) - cog.out(b) -]]]*) -type - TNodeKind = ( - nkNone, nkEmpty, nkIdent, nkSym, - nkType, nkCharLit, nkIntLit, nkInt8Lit, - nkInt16Lit, nkInt32Lit, nkInt64Lit, nkFloatLit, - nkFloat32Lit, nkFloat64Lit, nkStrLit, nkRStrLit, - nkTripleStrLit, nkMetaNode, nkNilLit, nkDotCall, - nkCommand, nkCall, nkGenericCall, nkExplicitTypeListCall, - nkExprEqExpr, nkExprColonExpr, nkIdentDefs, nkInfix, - nkPrefix, nkPostfix, nkPar, nkCurly, - nkBracket, nkBracketExpr, nkPragmaExpr, nkRange, - nkDotExpr, nkCheckedFieldExpr, nkDerefExpr, nkIfExpr, - nkElifExpr, nkElseExpr, nkLambda, nkAccQuoted, - nkHeaderQuoted, nkTableConstr, nkQualified, nkHiddenStdConv, - nkHiddenSubConv, nkHiddenCallConv, nkConv, nkCast, - nkAddr, nkHiddenAddr, nkHiddenDeref, nkObjDownConv, - nkObjUpConv, nkChckRangeF, nkChckRange64, nkChckRange, - nkStringToCString, nkCStringToString, nkPassAsOpenArray, nkAsgn, - nkDefaultTypeParam, nkGenericParams, nkFormalParams, nkOfInherit, - nkModule, nkProcDef, nkConverterDef, nkMacroDef, - nkTemplateDef, nkIteratorDef, nkOfBranch, nkElifBranch, - nkExceptBranch, nkElse, nkMacroStmt, nkAsmStmt, - nkPragma, nkIfStmt, nkWhenStmt, nkForStmt, - nkWhileStmt, nkCaseStmt, nkVarSection, nkConstSection, - nkConstDef, nkTypeSection, nkTypeDef, nkYieldStmt, - nkTryStmt, nkFinally, nkRaiseStmt, nkReturnStmt, - nkBreakStmt, nkContinueStmt, nkBlockStmt, nkDiscardStmt, - nkStmtList, nkImportStmt, nkFromStmt, nkImportAs, - nkIncludeStmt, nkAccessStmt, nkCommentStmt, nkStmtListExpr, - nkBlockExpr, nkVm, nkTypeOfExpr, nkObjectTy, - nkTupleTy, nkRecList, nkRecCase, nkRecWhen, - nkRefTy, nkPtrTy, nkVarTy, nkProcTy, - nkEnumTy, nkEnumFieldDef, nkReturnToken); - TNodeKinds = set of TNodeKind; -const - NodeKindToStr: array [TNodeKind] of string = ( - 'nkNone', 'nkEmpty', 'nkIdent', 'nkSym', - 'nkType', 'nkCharLit', 'nkIntLit', 'nkInt8Lit', - 'nkInt16Lit', 'nkInt32Lit', 'nkInt64Lit', 'nkFloatLit', - 'nkFloat32Lit', 'nkFloat64Lit', 'nkStrLit', 'nkRStrLit', - 'nkTripleStrLit', 'nkMetaNode', 'nkNilLit', 'nkDotCall', - 'nkCommand', 'nkCall', 'nkGenericCall', 'nkExplicitTypeListCall', - 'nkExprEqExpr', 'nkExprColonExpr', 'nkIdentDefs', 'nkInfix', - 'nkPrefix', 'nkPostfix', 'nkPar', 'nkCurly', - 'nkBracket', 'nkBracketExpr', 'nkPragmaExpr', 'nkRange', - 'nkDotExpr', 'nkCheckedFieldExpr', 'nkDerefExpr', 'nkIfExpr', - 'nkElifExpr', 'nkElseExpr', 'nkLambda', 'nkAccQuoted', - 'nkHeaderQuoted', 'nkTableConstr', 'nkQualified', 'nkHiddenStdConv', - 'nkHiddenSubConv', 'nkHiddenCallConv', 'nkConv', 'nkCast', - 'nkAddr', 'nkHiddenAddr', 'nkHiddenDeref', 'nkObjDownConv', - 'nkObjUpConv', 'nkChckRangeF', 'nkChckRange64', 'nkChckRange', - 'nkStringToCString', 'nkCStringToString', 'nkPassAsOpenArray', 'nkAsgn', - 'nkDefaultTypeParam', 'nkGenericParams', 'nkFormalParams', 'nkOfInherit', - 'nkModule', 'nkProcDef', 'nkConverterDef', 'nkMacroDef', - 'nkTemplateDef', 'nkIteratorDef', 'nkOfBranch', 'nkElifBranch', - 'nkExceptBranch', 'nkElse', 'nkMacroStmt', 'nkAsmStmt', - 'nkPragma', 'nkIfStmt', 'nkWhenStmt', 'nkForStmt', - 'nkWhileStmt', 'nkCaseStmt', 'nkVarSection', 'nkConstSection', - 'nkConstDef', 'nkTypeSection', 'nkTypeDef', 'nkYieldStmt', - 'nkTryStmt', 'nkFinally', 'nkRaiseStmt', 'nkReturnStmt', - 'nkBreakStmt', 'nkContinueStmt', 'nkBlockStmt', 'nkDiscardStmt', - 'nkStmtList', 'nkImportStmt', 'nkFromStmt', 'nkImportAs', - 'nkIncludeStmt', 'nkAccessStmt', 'nkCommentStmt', 'nkStmtListExpr', - 'nkBlockExpr', 'nkVm', 'nkTypeOfExpr', 'nkObjectTy', - 'nkTupleTy', 'nkRecList', 'nkRecCase', 'nkRecWhen', - 'nkRefTy', 'nkPtrTy', 'nkVarTy', 'nkProcTy', - 'nkEnumTy', 'nkEnumFieldDef', 'nkReturnToken'); -type - TSymFlag = ( - sfTypeCheck, sfForward, sfImportc, sfExportc, - sfVolatile, sfUsed, sfWrite, sfRegister, - sfPure, sfCodeGenerated, sfPrivate, sfGlobal, - sfResult, sfNoSideEffect, sfMainModule, sfSystemModule, - sfNoReturn, sfAddrTaken, sfInInterface, sfNoStatic, - sfCompilerProc, sfCppMethod, sfDiscriminant, sfDeprecated, - sfInClosure, sfIsCopy, sfStar, sfMinus); - TSymFlags = set of TSymFlag; -const - SymFlagToStr: array [TSymFlag] of string = ( - 'sfTypeCheck', 'sfForward', 'sfImportc', 'sfExportc', - 'sfVolatile', 'sfUsed', 'sfWrite', 'sfRegister', - 'sfPure', 'sfCodeGenerated', 'sfPrivate', 'sfGlobal', - 'sfResult', 'sfNoSideEffect', 'sfMainModule', 'sfSystemModule', - 'sfNoReturn', 'sfAddrTaken', 'sfInInterface', 'sfNoStatic', - 'sfCompilerProc', 'sfCppMethod', 'sfDiscriminant', 'sfDeprecated', - 'sfInClosure', 'sfIsCopy', 'sfStar', 'sfMinus'); -type - TTypeKind = ( - tyNone, tyBool, tyChar, tyEmptySet, - tyArrayConstr, tyNil, tyGeneric, tyGenericInst, - tyGenericParam, tyEnum, tyAnyEnum, tyArray, - tyObject, tyTuple, tySet, tyRange, - tyPtr, tyRef, tyVar, tySequence, - tyProc, tyPointer, tyOpenArray, tyString, - tyCString, tyForward, tyInt, tyInt8, - tyInt16, tyInt32, tyInt64, tyFloat, - tyFloat32, tyFloat64, tyFloat128); - TTypeKinds = set of TTypeKind; -const - TypeKindToStr: array [TTypeKind] of string = ( - 'tyNone', 'tyBool', 'tyChar', 'tyEmptySet', - 'tyArrayConstr', 'tyNil', 'tyGeneric', 'tyGenericInst', - 'tyGenericParam', 'tyEnum', 'tyAnyEnum', 'tyArray', - 'tyObject', 'tyTuple', 'tySet', 'tyRange', - 'tyPtr', 'tyRef', 'tyVar', 'tySequence', - 'tyProc', 'tyPointer', 'tyOpenArray', 'tyString', - 'tyCString', 'tyForward', 'tyInt', 'tyInt8', - 'tyInt16', 'tyInt32', 'tyInt64', 'tyFloat', - 'tyFloat32', 'tyFloat64', 'tyFloat128'); -type - TNodeFlag = ( - nfNone, nfBase2, nfBase8, nfBase16, - nfAllConst); - TNodeFlags = set of TNodeFlag; -const - NodeFlagToStr: array [TNodeFlag] of string = ( - 'nfNone', 'nfBase2', 'nfBase8', 'nfBase16', - 'nfAllConst'); -type - TTypeFlag = ( - tfIsDistinct, tfGeneric, tfExternal, tfImported, - tfInfoGenerated, tfSemChecked, tfHasOutParams, tfEnumHasWholes, - tfVarargs, tfFinal); - TTypeFlags = set of TTypeFlag; -const - TypeFlagToStr: array [TTypeFlag] of string = ( - 'tfIsDistinct', 'tfGeneric', 'tfExternal', 'tfImported', - 'tfInfoGenerated', 'tfSemChecked', 'tfHasOutParams', 'tfEnumHasWholes', - 'tfVarargs', 'tfFinal'); -type - TSymKind = ( - skUnknownSym, skConditional, skDynLib, skParam, - skTypeParam, skTemp, skType, skConst, - skVar, skProc, skIterator, skConverter, - skMacro, skTemplate, skField, skEnumField, - skForVar, skModule, skLabel); - TSymKinds = set of TSymKind; -const - SymKindToStr: array [TSymKind] of string = ( - 'skUnknownSym', 'skConditional', 'skDynLib', 'skParam', - 'skTypeParam', 'skTemp', 'skType', 'skConst', - 'skVar', 'skProc', 'skIterator', 'skConverter', - 'skMacro', 'skTemplate', 'skField', 'skEnumField', - 'skForVar', 'skModule', 'skLabel'); -{[[[end]]]} - -type - // symbols that require compiler magic: - TMagic = ( - //[[[cog - //magics = eval(file("data/magic.yml").read()) - //for i in range(0, len(magics)-1): - // cog.out("m" + magics[i] + ", ") - // if (i+1) % 6 == 0: cog.outl("") - //cog.outl("m" + magics[-1]) - //]]] - mNone, mDefined, mNew, mNewFinalize, mLow, mHigh, - mSizeOf, mRegisterFinalizer, mSucc, mPred, mInc, mDec, - mLengthOpenArray, mLengthStr, mLengthArray, mLengthSeq, mIncl, mExcl, - mCard, mOrd, mChr, mAddI, mSubI, mMulI, - mDivI, mModI, mAddI64, mSubI64, mMulI64, mDivI64, - mModI64, mShrI, mShlI, mBitandI, mBitorI, mBitxorI, - mMinI, mMaxI, mShrI64, mShlI64, mBitandI64, mBitorI64, - mBitxorI64, mMinI64, mMaxI64, mAddF64, mSubF64, mMulF64, - mDivF64, mMinF64, mMaxF64, mAddU, mSubU, mMulU, - mDivU, mModU, mAddU64, mSubU64, mMulU64, mDivU64, - mModU64, mEqI, mLeI, mLtI, mEqI64, mLeI64, - mLtI64, mEqF64, mLeF64, mLtF64, mLeU, mLtU, - mLeU64, mLtU64, mEqEnum, mLeEnum, mLtEnum, mEqCh, - mLeCh, mLtCh, mEqB, mLeB, mLtB, mEqRef, - mEqProc, mEqUntracedRef, mLePtr, mLtPtr, mEqCString, mXor, - mUnaryMinusI, mUnaryMinusI64, mAbsI, mAbsI64, mNot, mUnaryPlusI, - mBitnotI, mUnaryPlusI64, mBitnotI64, mUnaryPlusF64, mUnaryMinusF64, mAbsF64, - mZe8ToI, mZe8ToI64, mZe16ToI, mZe16ToI64, mZe32ToI64, mZeIToI64, - mToU8, mToU16, mToU32, mToFloat, mToBiggestFloat, mToInt, - mToBiggestInt, mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr, mFloatToStr, - mCStrToStr, mStrToStr, mAnd, mOr, mEqStr, mLeStr, - mLtStr, mEqSet, mLeSet, mLtSet, mMulSet, mPlusSet, - mMinusSet, mSymDiffSet, mConStrStr, mConArrArr, mConArrT, mConTArr, - mConTT, mSlice, mAppendStrCh, mAppendStrStr, mAppendSeqElem, mAppendSeqSeq, - mInRange, mInSet, mIs, mAsgn, mRepr, mExit, - mSetLengthStr, mSetLengthSeq, mAssert, mSwap, mIsNil, mArray, - mOpenArray, mRange, mSet, mSeq, mCompileDate, mCompileTime, - mNimrodVersion, mNimrodMajor, mNimrodMinor, mNimrodPatch, mCpuEndian, mNaN, - mInf, mNegInf, mNLen, mNChild, mNSetChild, mNAdd, - mNAddMultiple, mNDel, mNKind, mNIntVal, mNFloatVal, mNSymbol, - mNIdent, mNGetType, mNStrVal, mNSetIntVal, mNSetFloatVal, mNSetSymbol, - mNSetIdent, mNSetType, mNSetStrVal, mNNewNimNode, mNCopyNimNode, mNCopyNimTree, - mStrToIdent, mIdentToStr, mEqIdent, mNHint, mNWarning, mNError - //[[[end]]] - ); - -type - PNode = ^TNode; - PNodePtr = ^{@ptr}PNode; - TNodeSeq = array of PNode; - - PType = ^TType; - PSym = ^TSym; - - TNode = {@ignore} record // keep this below 32 bytes; - // otherwise the AST grows too much - typ: PType; - strVal: string; - comment: string; - sons: TNodeSeq; // else! - info: TLineInfo; - flags: TNodeFlags; - case Kind: TNodeKind of - nkCharLit, nkIntLit, nkInt8Lit, nkInt16Lit, nkInt32Lit, nkInt64Lit: - (intVal: biggestInt); - nkFloatLit, nkFloat32Lit, nkFloat64Lit: - (floatVal: biggestFloat); - nkSym: (sym: PSym); - nkIdent: (ident: PIdent); - nkMetaNode: (nodePtr: PNodePtr); - end; - {@emit - record // keep this below 32 bytes; otherwise the AST grows too much - typ: PType; - comment: string; - info: TLineInfo; - flags: TNodeFlags; - case Kind: TNodeKind of - nkCharLit..nkInt64Lit: - (intVal: biggestInt); - nkFloatLit..nkFloat64Lit: - (floatVal: biggestFloat); - nkStrLit..nkTripleStrLit: - (strVal: string); - nkSym: (sym: PSym); - nkIdent: (ident: PIdent); - nkMetaNode: (nodePtr: PNodePtr); - else (sons: TNodeSeq); - end; } - - TSymSeq = array of PSym; - TStrTable = object // a table[PIdent] of PSym - counter: int; - data: TSymSeq; - end; - -// -------------- backend information ------------------------------- - - TLocKind = ( - locNone, // no location - locTemp, // temporary location - locLocalVar, // location is a local variable - locGlobalVar, // location is a global variable - locParam, // location is a parameter - locField, // location is a record field - locArrayElem, // location is an array element - locExpr, // "location" is really an expression - locImmediate, // location is an immediate value - locProc, // location is a proc (an address of a procedure) - locData, // location is a constant - locCall, // location is a call expression - locOther // location is something other - ); - - TLocFlag = ( - lfIndirect, // backend introduced a pointer - lfNoDeepCopy, // no need for a deep copy - lfNoDecl, // do not declare it in C - lfDynamicLib, // link symbol to dynamic library - lfHeader // include header file for symbol - ); - - TStorageLoc = ( - OnUnknown, // location is unknown (stack, heap or static) - OnStack, // location is on hardware stack - OnHeap // location is on heap or global (reference counting needed) - ); - - TLocFlags = set of TLocFlag; - TLoc = record - k: TLocKind; // kind of location - s: TStorageLoc; - flags: TLocFlags; // location's flags - t: PType; // type of location - r: PRope; // rope value of location (code generators) - a: int; // location's "address", i.e. slot for temporaries - end; - -// ---------------- end of backend information ------------------------------ - - TSym = object(TIdObj) // symbols are identical iff they have the same - // id! - kind: TSymKind; - typ: PType; - name: PIdent; - info: TLineInfo; - owner: PSym; - flags: TSymFlags; - magic: TMagic; - tab: TStrTable; // interface table for modules - ast: PNode; // syntax tree of proc, iterator, etc.: - // the whole proc including header; this is used - // for easy generation of proper error messages - // for variant record fields the discriminant - // expression - options: TOptions; - position: int; // used for many different things: - // for enum fields its position; - // for fields its offset - // for parameters its position - // for a conditional: - // 1 iff the symbol is defined, else 0 - // (or not in symbol table) - offset: int; // offset of record field - loc: TLoc; - annex: PObject; // additional fields (seldom used, so we use a - // reference to another object to safe space) - end; - - PTypeSeq = array of PType; - TType = object(TIdObj) // types are identical iff they have the - // same id; there may be multiple copies of a type - // in memory! - kind: TTypeKind; // kind of type - sons: PTypeSeq; // base types, etc. - n: PNode; // node for types: - // for range types a nkRange node - // for record types a nkRecord node - // for enum types a list of symbols - // else: unused - flags: TTypeFlags; // flags of the type - callConv: TCallingConvention; // for procs - owner: PSym; // the 'owner' of the type - sym: PSym; // types have the sym associated with them - // it is used for converting types to strings - size: BiggestInt; // the size of the type in bytes - // -1 means that the size is unkwown - align: int; // the type's alignment requirements - containerID: int; // used for type checking of generics - loc: TLoc; - end; - - // these are not part of the syntax tree, but nevertherless inherit from TNode - TPair = record - key, val: PObject; - end; - TPairSeq = array of TPair; - - TTable = record // the same as table[PObject] of PObject - counter: int; - data: TPairSeq; - end; - - TIdPair = record - key: PIdObj; - val: PObject; - end; - TIdPairSeq = array of TIdPair; - - TIdTable = record // the same as table[PIdent] of PObject - counter: int; - data: TIdPairSeq; - end; - - TIdNodePair = record - key: PIdObj; - val: PNode; - end; - TIdNodePairSeq = array of TIdNodePair; - - TIdNodeTable = record // the same as table[PIdObj] of PNode - counter: int; - data: TIdNodePairSeq; - end; - - TNodePair = record - h: THash; // because it is expensive to compute! - key: PNode; - val: PNode; - end; - TNodePairSeq = array of TNodePair; - - TNodeTable = record // the same as table[PNode] of PNode; - // nodes are compared by structure! - counter: int; - data: TNodePairSeq; - end; - - TObjectSeq = array of PObject; - - TObjectSet = record - counter: int; - data: TObjectSeq; - end; - TLibKind = (libHeader, libDynamic, libDynamicGenerated); - TLib = object(lists.TListEntry) // also misused for headers! - kind: TLibKind; - // needed for the backends: - name: PRope; - path: string; - syms: TObjectSet; - end; - PLib = ^TLib; - -const - OverloadableSyms = {@set}[skProc, skIterator, skConverter]; - -const // "MagicToStr" array: - MagicToStr: array [TMagic] of string = ( - //[[[cog - //for i in range(0, len(magics)-1): - // cog.out("'%s', " % magics[i]) - // if (i+1) % 6 == 0: cog.outl("") - //cog.outl("'%s'" % magics[-1]) - //]]] - 'None', 'Defined', 'New', 'NewFinalize', 'Low', 'High', - 'SizeOf', 'RegisterFinalizer', 'Succ', 'Pred', 'Inc', 'Dec', - 'LengthOpenArray', 'LengthStr', 'LengthArray', 'LengthSeq', 'Incl', 'Excl', - 'Card', 'Ord', 'Chr', 'AddI', 'SubI', 'MulI', - 'DivI', 'ModI', 'AddI64', 'SubI64', 'MulI64', 'DivI64', - 'ModI64', 'ShrI', 'ShlI', 'BitandI', 'BitorI', 'BitxorI', - 'MinI', 'MaxI', 'ShrI64', 'ShlI64', 'BitandI64', 'BitorI64', - 'BitxorI64', 'MinI64', 'MaxI64', 'AddF64', 'SubF64', 'MulF64', - 'DivF64', 'MinF64', 'MaxF64', 'AddU', 'SubU', 'MulU', - 'DivU', 'ModU', 'AddU64', 'SubU64', 'MulU64', 'DivU64', - 'ModU64', 'EqI', 'LeI', 'LtI', 'EqI64', 'LeI64', - 'LtI64', 'EqF64', 'LeF64', 'LtF64', 'LeU', 'LtU', - 'LeU64', 'LtU64', 'EqEnum', 'LeEnum', 'LtEnum', 'EqCh', - 'LeCh', 'LtCh', 'EqB', 'LeB', 'LtB', 'EqRef', - 'EqProc', 'EqUntracedRef', 'LePtr', 'LtPtr', 'EqCString', 'Xor', - 'UnaryMinusI', 'UnaryMinusI64', 'AbsI', 'AbsI64', 'Not', 'UnaryPlusI', - 'BitnotI', 'UnaryPlusI64', 'BitnotI64', 'UnaryPlusF64', 'UnaryMinusF64', 'AbsF64', - 'Ze8ToI', 'Ze8ToI64', 'Ze16ToI', 'Ze16ToI64', 'Ze32ToI64', 'ZeIToI64', - 'ToU8', 'ToU16', 'ToU32', 'ToFloat', 'ToBiggestFloat', 'ToInt', - 'ToBiggestInt', 'CharToStr', 'BoolToStr', 'IntToStr', 'Int64ToStr', 'FloatToStr', - 'CStrToStr', 'StrToStr', 'And', 'Or', 'EqStr', 'LeStr', - 'LtStr', 'EqSet', 'LeSet', 'LtSet', 'MulSet', 'PlusSet', - 'MinusSet', 'SymDiffSet', 'ConStrStr', 'ConArrArr', 'ConArrT', 'ConTArr', - 'ConTT', 'Slice', 'AppendStrCh', 'AppendStrStr', 'AppendSeqElem', 'AppendSeqSeq', - 'InRange', 'InSet', 'Is', 'Asgn', 'Repr', 'Exit', - 'SetLengthStr', 'SetLengthSeq', 'Assert', 'Swap', 'IsNil', 'Array', - 'OpenArray', 'Range', 'Set', 'Seq', 'CompileDate', 'CompileTime', - 'NimrodVersion', 'NimrodMajor', 'NimrodMinor', 'NimrodPatch', 'CpuEndian', 'NaN', - 'Inf', 'NegInf', 'NLen', 'NChild', 'NSetChild', 'NAdd', - 'NAddMultiple', 'NDel', 'NKind', 'NIntVal', 'NFloatVal', 'NSymbol', - 'NIdent', 'NGetType', 'NStrVal', 'NSetIntVal', 'NSetFloatVal', 'NSetSymbol', - 'NSetIdent', 'NSetType', 'NSetStrVal', 'NNewNimNode', 'NCopyNimNode', 'NCopyNimTree', - 'StrToIdent', 'IdentToStr', 'EqIdent', 'NHint', 'NWarning', 'NError' - //[[[end]]] - ); - -const - GenericTypes: TTypeKinds = {@set}[tyGeneric, tyGenericParam]; - - StructuralEquivTypes: TTypeKinds = {@set}[ - tyEmptySet, tyArrayConstr, tyNil, tyTuple, - tyArray, - tySet, - tyRange, - tyPtr, tyRef, - tyVar, - tySequence, - tyProc, tyOpenArray - ]; - - ConcreteTypes: TTypeKinds = {@set}[ - // types of the expr that may occur in:: - // var x = expr - tyBool, tyChar, tyEnum, tyArray, tyObject, tySet, tyTuple, - tyRange, tyPtr, tyRef, tyVar, tySequence, tyProc, - tyPointer, tyOpenArray, - tyString, tyCString, - tyInt..tyInt64, - tyFloat..tyFloat128 - ]; - ConstantDataTypes: TTypeKinds = {@set}[tyArray, tySet, tyTuple]; - ExportableSymKinds = {@set}[skVar, skConst, skProc, skType, - skIterator, skMacro, skTemplate, skConverter]; - namePos = 0; - genericParamsPos = 1; - paramsPos = 2; - pragmasPos = 3; - codePos = 4; - resultPos = 5; - -function getID: int; -procedure setID(id: int); - -// creator procs: -function NewSym(symKind: TSymKind; Name: PIdent; owner: PSym): PSym; - -function NewType(kind: TTypeKind; owner: PSym): PType; overload; - -function newNode(kind: TNodeKind): PNode; -function newIntNode(kind: TNodeKind; const intVal: BiggestInt): PNode; -function newIntTypeNode(kind: TNodeKind; const intVal: BiggestInt; - typ: PType): PNode; -function newFloatNode(kind: TNodeKind; const floatVal: BiggestFloat): PNode; -function newStrNode(kind: TNodeKind; const strVal: string): PNode; -function newIdentNode(ident: PIdent; const info: TLineInfo): PNode; -function newSymNode(sym: PSym): PNode; -function newNodeI(kind: TNodeKind; const info: TLineInfo): PNode; -function newNodeIT(kind: TNodeKind; const info: TLineInfo; typ: PType): PNode; - -procedure initStrTable(out x: TStrTable); -procedure initTable(out x: TTable); -procedure initIdTable(out x: TIdTable); -procedure initObjectSet(out x: TObjectSet); -procedure initIdNodeTable(out x: TIdNodeTable); -procedure initNodeTable(out x: TNodeTable); - -// copy procs: -function copyType(t: PType; owner: PSym): PType; -function copySym(s: PSym; keepId: bool = false): PSym; -procedure assignType(dest, src: PType); - -procedure copyStrTable(out dest: TStrTable; const src: TStrTable); -procedure copyTable(out dest: TTable; const src: TTable); -procedure copyObjectSet(out dest: TObjectSet; const src: TObjectSet); - -function sonsLen(n: PNode): int; overload; -function sonsLen(n: PType): int; overload; - -function lastSon(n: PNode): PNode; overload; -function lastSon(n: PType): PType; overload; -procedure newSons(father: PNode; len: int); overload; -procedure newSons(father: PType; len: int); overload; - -procedure addSon(father, son: PNode); overload; -procedure addSon(father, son: PType); overload; - -procedure addSonIfNotNil(father, n: PNode); -procedure delSon(father: PNode; idx: int); -function hasSonWith(n: PNode; kind: TNodeKind): boolean; -function hasSubnodeWith(n: PNode; kind: TNodeKind): boolean; -procedure replaceSons(n: PNode; oldKind, newKind: TNodeKind); -function sonsNotNil(n: PNode): bool; // for assertions - -function copyNode(src: PNode): PNode; -// does not copy its sons! - -function copyTree(src: PNode): PNode; -// does copy its sons! - -procedure discardSons(father: PNode); - -const // for all kind of hash tables: - GrowthFactor = 2; // must be power of 2, > 0 - StartSize = 8; // must be power of 2, > 0 - -function SameValue(a, b: PNode): Boolean; // a, b are literals -function leValue(a, b: PNode): Boolean; // a <= b? a, b are literals - -function ValueToString(a: PNode): string; - -implementation - -var - gId: int; - -function getID: int; -begin - inc(gId); - result := gId -end; - -procedure setId(id: int); -begin - gId := max(gId, id) -end; - -function leValue(a, b: PNode): Boolean; // a <= b? -begin - result := false; - case a.kind of - nkCharLit..nkInt64Lit: - if b.kind in [nkCharLit..nkInt64Lit] then - result := a.intVal <= b.intVal; - nkFloatLit..nkFloat64Lit: - if b.kind in [nkFloatLit..nkFloat64Lit] then - result := a.floatVal <= b.floatVal; - nkStrLit..nkTripleStrLit: begin - if b.kind in [nkStrLit..nkTripleStrLit] then - result := a.strVal <= b.strVal; - end - else InternalError(a.info, 'leValue'); - end -end; - -function SameValue(a, b: PNode): Boolean; -begin - result := false; - case a.kind of - nkCharLit..nkInt64Lit: - if b.kind in [nkCharLit..nkInt64Lit] then - result := a.intVal = b.intVal; - nkFloatLit..nkFloat64Lit: - if b.kind in [nkFloatLit..nkFloat64Lit] then - result := a.floatVal = b.floatVal; - nkStrLit..nkTripleStrLit: begin - if b.kind in [nkStrLit..nkTripleStrLit] then - result := a.strVal = b.strVal; - end - else InternalError(a.info, 'SameValue'); - end -end; - -function ValueToString(a: PNode): string; -begin - case a.kind of - nkCharLit..nkInt64Lit: - result := ToString(a.intVal); - nkFloatLit, nkFloat32Lit, nkFloat64Lit: - result := toStringF(a.floatVal); - nkStrLit..nkTripleStrLit: - result := a.strVal; - else begin - InternalError(a.info, 'valueToString'); - result := '' - end - end -end; - -procedure copyStrTable(out dest: TStrTable; const src: TStrTable); -var - i: int; -begin - dest.counter := src.counter; -{@emit - if isNil(src.data) then exit; -} - setLength(dest.data, length(src.data)); - for i := 0 to high(src.data) do - dest.data[i] := src.data[i]; -end; - -procedure copyTable(out dest: TTable; const src: TTable); -var - i: int; -begin - dest.counter := src.counter; -{@emit - if isNil(src.data) then exit; -} - setLength(dest.data, length(src.data)); - for i := 0 to high(src.data) do - dest.data[i] := src.data[i]; -end; - -procedure copyObjectSet(out dest: TObjectSet; const src: TObjectSet); -var - i: int; -begin - dest.counter := src.counter; -{@emit - if isNil(src.data) then exit; -} - setLength(dest.data, length(src.data)); - for i := 0 to high(src.data) do - dest.data[i] := src.data[i]; -end; - -procedure discardSons(father: PNode); -begin - father.sons := nil; -end; - -function newNode(kind: TNodeKind): PNode; -begin - new(result); -{@ignore} - FillChar(result^, sizeof(result^), 0); -{@emit} - result.kind := kind; - result.info := UnknownLineInfo(); -end; - -function newIntNode(kind: TNodeKind; const intVal: BiggestInt): PNode; -begin - result := newNode(kind); - result.intVal := intVal -end; - -function newIntTypeNode(kind: TNodeKind; const intVal: BiggestInt; - typ: PType): PNode; -begin - result := newIntNode(kind, intVal); - result.typ := typ; -end; - -function newFloatNode(kind: TNodeKind; const floatVal: BiggestFloat): PNode; -begin - result := newNode(kind); - result.floatVal := floatVal -end; - -function newStrNode(kind: TNodeKind; const strVal: string): PNode; -begin - result := newNode(kind); - result.strVal := strVal -end; - -function newIdentNode(ident: PIdent; const info: TLineInfo): PNode; -begin - result := newNode(nkIdent); - result.ident := ident; - result.info := info; -end; - -function newSymNode(sym: PSym): PNode; -begin - result := newNode(nkSym); - result.sym := sym; - result.typ := sym.typ; - result.info := sym.info; -end; - -function newNodeI(kind: TNodeKind; const info: TLineInfo): PNode; -begin - result := newNode(kind); - result.info := info; -end; - -function newNodeIT(kind: TNodeKind; const info: TLineInfo; typ: PType): PNode; -begin - result := newNode(kind); - result.info := info; - result.typ := typ; -end; - -function NewType(kind: TTypeKind; owner: PSym): PType; overload; -begin - new(result); -{@ignore} - FillChar(result^, sizeof(result^), 0); -{@emit} - result.kind := kind; - result.owner := owner; - result.size := -1; - result.align := 2; // default alignment - result.id := getID() -end; - -procedure assignType(dest, src: PType); -var - i: int; -begin - dest.kind := src.kind; - dest.flags := src.flags; - dest.callConv := src.callConv; - dest.n := src.n; - dest.size := src.size; - dest.align := src.align; - dest.containerID := src.containerID; - newSons(dest, sonsLen(src)); - for i := 0 to sonsLen(src)-1 do - dest.sons[i] := src.sons[i]; -end; - -function copyType(t: PType; owner: PSym): PType; -begin - result := newType(t.Kind, owner); - assignType(result, t); - if owner = t.owner then result.id := t.id - else result.id := getID(); - result.sym := t.sym; - // backend-info should not be copied -end; - -function copySym(s: PSym; keepId: bool = false): PSym; -begin - result := newSym(s.kind, s.name, s.owner); - result.ast := nil; // BUGFIX; was: s.ast which made problems - result.info := s.info; - result.typ := s.typ; - if keepId then result.id := s.id else result.id := getID(); - result.flags := s.flags; - result.magic := s.magic; - copyStrTable(result.tab, s.tab); - result.options := s.options; - result.position := s.position; - result.loc := s.loc; - result.annex := s.annex; // BUGFIX -end; - -function NewSym(symKind: TSymKind; Name: PIdent; owner: PSym): PSym; -// generates a symbol and initializes the hash field too -begin - new(result); -{@ignore} - FillChar(result^, sizeof(result^), 0); -{@emit} - result.Name := Name; - result.Kind := symKind; - result.flags := {@set}[]; - result.info := UnknownLineInfo(); - result.options := gOptions; - result.owner := owner; - result.offset := -1; - result.id := getID() -end; - -procedure initStrTable(out x: TStrTable); -begin - x.counter := 0; -{@emit - x.data := []; } - setLength(x.data, startSize); -{@ignore} - fillChar(x.data[0], length(x.data)*sizeof(x.data[0]), 0); -{@emit} -end; - -procedure initTable(out x: TTable); -begin - x.counter := 0; -{@emit - x.data := []; } - setLength(x.data, startSize); -{@ignore} - fillChar(x.data[0], length(x.data)*sizeof(x.data[0]), 0); -{@emit} -end; - -procedure initIdTable(out x: TIdTable); -begin - x.counter := 0; -{@emit - x.data := []; } - setLength(x.data, startSize); -{@ignore} - fillChar(x.data[0], length(x.data)*sizeof(x.data[0]), 0); -{@emit} -end; - -procedure initObjectSet(out x: TObjectSet); -begin - x.counter := 0; -{@emit - x.data := []; } - setLength(x.data, startSize); -{@ignore} - fillChar(x.data[0], length(x.data)*sizeof(x.data[0]), 0); -{@emit} -end; - -procedure initIdNodeTable(out x: TIdNodeTable); -begin - x.counter := 0; -{@emit - x.data := []; } - setLength(x.data, startSize); -{@ignore} - fillChar(x.data[0], length(x.data)*sizeof(x.data[0]), 0); -{@emit} -end; - -procedure initNodeTable(out x: TNodeTable); -begin - x.counter := 0; -{@emit - x.data := []; } - setLength(x.data, startSize); -{@ignore} - fillChar(x.data[0], length(x.data)*sizeof(x.data[0]), 0); -{@emit} -end; - -function sonsLen(n: PType): int; -begin - if n.sons = nil then result := 0 - else result := length(n.sons) -end; - -procedure newSons(father: PType; len: int); -var - i, L: int; -begin -{@emit - if father.sons = nil then father.sons := []; } - L := length(father.sons); - setLength(father.sons, L + len); -{@ignore} - for i := L to L+len-1 do father.sons[i] := nil // needed for FPC -{@emit} -end; - -procedure addSon(father, son: PType); -var - L: int; -begin -{@emit - if father.sons = nil then father.sons := []; } - L := length(father.sons); - setLength(father.sons, L+1); - father.sons[L] := son; -end; - -function sonsLen(n: PNode): int; -begin - if n.sons = nil then result := 0 - else result := length(n.sons) -end; - -procedure newSons(father: PNode; len: int); -var - i, L: int; -begin -{@emit - if father.sons = nil then father.sons := []; } - L := length(father.sons); - setLength(father.sons, L + len); -{@ignore} - for i := L to L+len-1 do father.sons[i] := nil // needed for FPC -{@emit} -end; - -procedure addSon(father, son: PNode); -var - L: int; -begin -{@emit - if father.sons = nil then father.sons := []; } - L := length(father.sons); - setLength(father.sons, L+1); - father.sons[L] := son; -end; - -procedure delSon(father: PNode; idx: int); -var - len, i: int; -begin -{@emit - if father.sons = nil then exit; } - len := sonsLen(father); - for i := idx to len-2 do - father.sons[i] := father.sons[i+1]; - setLength(father.sons, len-1); -end; - -function copyNode(src: PNode): PNode; -// does not copy its sons! -begin - if src = nil then begin result := nil; exit end; - result := newNode(src.kind); - result.info := src.info; - result.typ := src.typ; - result.flags := src.flags; - case src.Kind of - nkCharLit..nkInt64Lit: - result.intVal := src.intVal; - nkFloatLit, nkFloat32Lit, nkFloat64Lit: - result.floatVal := src.floatVal; - nkSym: - result.sym := src.sym; - nkIdent: - result.ident := src.ident; - nkStrLit..nkTripleStrLit: - result.strVal := src.strVal; - nkMetaNode: - result.nodePtr := src.nodePtr; - else begin end; - end; -end; - -function copyTree(src: PNode): PNode; -// copy a whole syntax tree; performs deep copying -var - i: int; -begin - if src = nil then begin result := nil; exit end; - result := newNode(src.kind); - result.info := src.info; - result.typ := src.typ; - result.flags := src.flags; - case src.Kind of - nkCharLit..nkInt64Lit: - result.intVal := src.intVal; - nkFloatLit, nkFloat32Lit, nkFloat64Lit: - result.floatVal := src.floatVal; - nkSym: - result.sym := src.sym; - nkIdent: - result.ident := src.ident; - nkStrLit..nkTripleStrLit: - result.strVal := src.strVal; - nkMetaNode: - result.nodePtr := src.nodePtr; - else begin - result.sons := nil; - newSons(result, sonsLen(src)); - for i := 0 to sonsLen(src)-1 do - result.sons[i] := copyTree(src.sons[i]); - end; - end -end; - -function lastSon(n: PNode): PNode; -begin - result := n.sons[sonsLen(n)-1]; -end; - -function lastSon(n: PType): PType; -begin - result := n.sons[sonsLen(n)-1]; -end; - -function hasSonWith(n: PNode; kind: TNodeKind): boolean; -var - i: int; -begin - for i := 0 to sonsLen(n)-1 do begin - if (n.sons[i] <> nil) and (n.sons[i].kind = kind) then begin - result := true; exit - end - end; - result := false -end; - -function hasSubnodeWith(n: PNode; kind: TNodeKind): boolean; -var - i: int; -begin - case n.kind of - nkEmpty..nkNilLit: result := n.kind = kind; - else begin - for i := 0 to sonsLen(n)-1 do begin - if (n.sons[i] <> nil) and (n.sons[i].kind = kind) - or hasSubnodeWith(n.sons[i], kind) then begin - result := true; exit - end - end; - result := false - end - end -end; - -procedure replaceSons(n: PNode; oldKind, newKind: TNodeKind); -var - i: int; -begin - for i := 0 to sonsLen(n)-1 do - if n.sons[i].kind = oldKind then n.sons[i].kind := newKind -end; - -function sonsNotNil(n: PNode): bool; -var - i: int; -begin - for i := 0 to sonsLen(n)-1 do - if n.sons[i] = nil then begin result := false; exit end; - result := true -end; - -procedure addSonIfNotNil(father, n: PNode); -begin - if n <> nil then addSon(father, n) -end; - -end. +// +// +// The Nimrod Compiler +// (c) Copyright 2008 Andreas Rumpf +// +// See the file "copying.txt", included in this +// distribution, for details about the copyright. +// +unit ast; + +// abstract syntax tree + symbol table + +interface + +{$include 'config.inc'} + +uses + nsystem, charsets, msgs, hashes, + nversion, options, strutils, crc, ropes, idents, lists; + +const + ImportTablePos = 0; + ModuleTablePos = 1; + +type + TCallingConvention = ( + ccDefault, // proc has no explicit calling convention + ccStdCall, // procedure is stdcall + ccCDecl, // cdecl + ccSafeCall, // safecall + ccSysCall, // system call + ccInline, // proc should be inlined + ccNoInline, // proc should not be inlined + ccFastCall, // fastcall (pass parameters in registers) + ccClosure, // proc has a closure + ccNoConvention // needed for generating proper C procs sometimes + ); + +const + CallingConvToStr: array [TCallingConvention] of string = ( + '', 'stdcall', 'cdecl', 'safecall', 'syscall', 'inline', 'noinline', + 'fastcall', 'closure', 'noconv'); + +(*[[[cog +def toEnum(name, elems, prefixlen=0): + body = "" + strs = "" + prefix = "" + counter = 0 + for e in elems: + if counter % 4 == 0: prefix = "\n " + else: prefix = "" + body = body + prefix + e + ', ' + strs = strs + prefix + "'%s', " % e[prefixlen:] + counter = counter + 1 + + return ("type\n T%s = (%s);\n T%ss = set of T%s;\n" + % (name, body[:-2], name, name), + "const\n %sToStr: array [T%s] of string = (%s);\n" + % (name, name, strs[:-2])) + +enums = eval(open("data/ast.yml").read()) +for key, val in enums.items(): + (a, b) = toEnum(key, val) + cog.out(a) + cog.out(b) +]]]*) +type + TTypeFlag = ( + tfVarargs, tfFinal, tfAcyclic, tfEnumHasWholes); + TTypeFlags = set of TTypeFlag; +const + TypeFlagToStr: array [TTypeFlag] of string = ( + 'tfVarargs', 'tfFinal', 'tfAcyclic', 'tfEnumHasWholes'); +type + TTypeKind = ( + tyNone, tyBool, tyChar, tyEmpty, + tyArrayConstr, tyNil, tyGeneric, tyGenericInst, + tyGenericParam, tyEnum, tyAnyEnum, tyArray, + tyObject, tyTuple, tySet, tyRange, + tyPtr, tyRef, tyVar, tySequence, + tyProc, tyPointer, tyOpenArray, tyString, + tyCString, tyForward, tyInt, tyInt8, + tyInt16, tyInt32, tyInt64, tyFloat, + tyFloat32, tyFloat64, tyFloat128); + TTypeKinds = set of TTypeKind; +const + TypeKindToStr: array [TTypeKind] of string = ( + 'tyNone', 'tyBool', 'tyChar', 'tyEmpty', + 'tyArrayConstr', 'tyNil', 'tyGeneric', 'tyGenericInst', + 'tyGenericParam', 'tyEnum', 'tyAnyEnum', 'tyArray', + 'tyObject', 'tyTuple', 'tySet', 'tyRange', + 'tyPtr', 'tyRef', 'tyVar', 'tySequence', + 'tyProc', 'tyPointer', 'tyOpenArray', 'tyString', + 'tyCString', 'tyForward', 'tyInt', 'tyInt8', + 'tyInt16', 'tyInt32', 'tyInt64', 'tyFloat', + 'tyFloat32', 'tyFloat64', 'tyFloat128'); +type + TSymFlag = ( + sfUsed, sfStar, sfMinus, sfInInterface, + sfFromGeneric, sfGlobal, sfForward, sfImportc, + sfExportc, sfVolatile, sfRegister, sfPure, + sfResult, sfNoSideEffect, sfMainModule, sfSystemModule, + sfNoReturn, sfAddrTaken, sfCompilerProc, sfCppMethod, + sfDiscriminant, sfDeprecated, sfInClosure, sfTypeCheck, + sfCompileTime, sfThreadVar, sfMerge); + TSymFlags = set of TSymFlag; +const + SymFlagToStr: array [TSymFlag] of string = ( + 'sfUsed', 'sfStar', 'sfMinus', 'sfInInterface', + 'sfFromGeneric', 'sfGlobal', 'sfForward', 'sfImportc', + 'sfExportc', 'sfVolatile', 'sfRegister', 'sfPure', + 'sfResult', 'sfNoSideEffect', 'sfMainModule', 'sfSystemModule', + 'sfNoReturn', 'sfAddrTaken', 'sfCompilerProc', 'sfCppMethod', + 'sfDiscriminant', 'sfDeprecated', 'sfInClosure', 'sfTypeCheck', + 'sfCompileTime', 'sfThreadVar', 'sfMerge'); +type + TNodeFlag = ( + nfNone, nfBase2, nfBase8, nfBase16, + nfAllConst, nfTransf, nfSem); + TNodeFlags = set of TNodeFlag; +const + NodeFlagToStr: array [TNodeFlag] of string = ( + 'nfNone', 'nfBase2', 'nfBase8', 'nfBase16', + 'nfAllConst', 'nfTransf', 'nfSem'); +type + TSymKind = ( + skUnknownSym, skConditional, skDynLib, skParam, + skTypeParam, skTemp, skType, skConst, + skVar, skProc, skIterator, skConverter, + skMacro, skTemplate, skField, skEnumField, + skForVar, skModule, skLabel, skStub); + TSymKinds = set of TSymKind; +const + SymKindToStr: array [TSymKind] of string = ( + 'skUnknownSym', 'skConditional', 'skDynLib', 'skParam', + 'skTypeParam', 'skTemp', 'skType', 'skConst', + 'skVar', 'skProc', 'skIterator', 'skConverter', + 'skMacro', 'skTemplate', 'skField', 'skEnumField', + 'skForVar', 'skModule', 'skLabel', 'skStub'); +type + TNodeKind = ( + nkNone, nkEmpty, nkIdent, nkSym, + nkType, nkCharLit, nkIntLit, nkInt8Lit, + nkInt16Lit, nkInt32Lit, nkInt64Lit, nkFloatLit, + nkFloat32Lit, nkFloat64Lit, nkStrLit, nkRStrLit, + nkTripleStrLit, nkMetaNode, nkNilLit, nkDotCall, + nkCommand, nkCall, nkGenericCall, nkExplicitTypeListCall, + nkExprEqExpr, nkExprColonExpr, nkIdentDefs, nkInfix, + nkPrefix, nkPostfix, nkPar, nkCurly, + nkBracket, nkBracketExpr, nkPragmaExpr, nkRange, + nkDotExpr, nkCheckedFieldExpr, nkDerefExpr, nkIfExpr, + nkElifExpr, nkElseExpr, nkLambda, nkAccQuoted, + nkHeaderQuoted, nkTableConstr, nkQualified, nkHiddenStdConv, + nkHiddenSubConv, nkHiddenCallConv, nkConv, nkCast, + nkAddr, nkHiddenAddr, nkHiddenDeref, nkObjDownConv, + nkObjUpConv, nkChckRangeF, nkChckRange64, nkChckRange, + nkStringToCString, nkCStringToString, nkPassAsOpenArray, nkAsgn, + nkDefaultTypeParam, nkGenericParams, nkFormalParams, nkOfInherit, + nkModule, nkProcDef, nkConverterDef, nkMacroDef, + nkTemplateDef, nkIteratorDef, nkOfBranch, nkElifBranch, + nkExceptBranch, nkElse, nkMacroStmt, nkAsmStmt, + nkPragma, nkIfStmt, nkWhenStmt, nkForStmt, + nkWhileStmt, nkCaseStmt, nkVarSection, nkConstSection, + nkConstDef, nkTypeSection, nkTypeDef, nkYieldStmt, + nkTryStmt, nkFinally, nkRaiseStmt, nkReturnStmt, + nkBreakStmt, nkContinueStmt, nkBlockStmt, nkDiscardStmt, + nkStmtList, nkImportStmt, nkFromStmt, nkImportAs, + nkIncludeStmt, nkAccessStmt, nkCommentStmt, nkStmtListExpr, + nkBlockExpr, nkStmtListType, nkBlockType, nkVm, + nkTypeOfExpr, nkObjectTy, nkTupleTy, nkRecList, + nkRecCase, nkRecWhen, nkRefTy, nkPtrTy, + nkVarTy, nkProcTy, nkEnumTy, nkEnumFieldDef, + nkReturnToken); + TNodeKinds = set of TNodeKind; +const + NodeKindToStr: array [TNodeKind] of string = ( + 'nkNone', 'nkEmpty', 'nkIdent', 'nkSym', + 'nkType', 'nkCharLit', 'nkIntLit', 'nkInt8Lit', + 'nkInt16Lit', 'nkInt32Lit', 'nkInt64Lit', 'nkFloatLit', + 'nkFloat32Lit', 'nkFloat64Lit', 'nkStrLit', 'nkRStrLit', + 'nkTripleStrLit', 'nkMetaNode', 'nkNilLit', 'nkDotCall', + 'nkCommand', 'nkCall', 'nkGenericCall', 'nkExplicitTypeListCall', + 'nkExprEqExpr', 'nkExprColonExpr', 'nkIdentDefs', 'nkInfix', + 'nkPrefix', 'nkPostfix', 'nkPar', 'nkCurly', + 'nkBracket', 'nkBracketExpr', 'nkPragmaExpr', 'nkRange', + 'nkDotExpr', 'nkCheckedFieldExpr', 'nkDerefExpr', 'nkIfExpr', + 'nkElifExpr', 'nkElseExpr', 'nkLambda', 'nkAccQuoted', + 'nkHeaderQuoted', 'nkTableConstr', 'nkQualified', 'nkHiddenStdConv', + 'nkHiddenSubConv', 'nkHiddenCallConv', 'nkConv', 'nkCast', + 'nkAddr', 'nkHiddenAddr', 'nkHiddenDeref', 'nkObjDownConv', + 'nkObjUpConv', 'nkChckRangeF', 'nkChckRange64', 'nkChckRange', + 'nkStringToCString', 'nkCStringToString', 'nkPassAsOpenArray', 'nkAsgn', + 'nkDefaultTypeParam', 'nkGenericParams', 'nkFormalParams', 'nkOfInherit', + 'nkModule', 'nkProcDef', 'nkConverterDef', 'nkMacroDef', + 'nkTemplateDef', 'nkIteratorDef', 'nkOfBranch', 'nkElifBranch', + 'nkExceptBranch', 'nkElse', 'nkMacroStmt', 'nkAsmStmt', + 'nkPragma', 'nkIfStmt', 'nkWhenStmt', 'nkForStmt', + 'nkWhileStmt', 'nkCaseStmt', 'nkVarSection', 'nkConstSection', + 'nkConstDef', 'nkTypeSection', 'nkTypeDef', 'nkYieldStmt', + 'nkTryStmt', 'nkFinally', 'nkRaiseStmt', 'nkReturnStmt', + 'nkBreakStmt', 'nkContinueStmt', 'nkBlockStmt', 'nkDiscardStmt', + 'nkStmtList', 'nkImportStmt', 'nkFromStmt', 'nkImportAs', + 'nkIncludeStmt', 'nkAccessStmt', 'nkCommentStmt', 'nkStmtListExpr', + 'nkBlockExpr', 'nkStmtListType', 'nkBlockType', 'nkVm', + 'nkTypeOfExpr', 'nkObjectTy', 'nkTupleTy', 'nkRecList', + 'nkRecCase', 'nkRecWhen', 'nkRefTy', 'nkPtrTy', + 'nkVarTy', 'nkProcTy', 'nkEnumTy', 'nkEnumFieldDef', + 'nkReturnToken'); +{[[[end]]]} + +type + // symbols that require compiler magic: + TMagic = ( + //[[[cog + //magics = eval(open("data/magic.yml").read()) + //for i in range(0, len(magics)-1): + // cog.out("m" + magics[i] + ", ") + // if (i+1) % 6 == 0: cog.outl("") + //cog.outl("m" + magics[-1]) + //]]] + mNone, mDefined, mLow, mHigh, mSizeOf, mIs, + mSucc, mPred, mInc, mDec, mOrd, mNew, + mNewFinalize, mNewSeq, mRegisterFinalizer, mLengthOpenArray, mLengthStr, mLengthArray, + mLengthSeq, mIncl, mExcl, mCard, mChr, mGCref, + mGCunref, mAddI, mSubI, mMulI, mDivI, mModI, + mAddI64, mSubI64, mMulI64, mDivI64, mModI64, mShrI, + mShlI, mBitandI, mBitorI, mBitxorI, mMinI, mMaxI, + mShrI64, mShlI64, mBitandI64, mBitorI64, mBitxorI64, mMinI64, + mMaxI64, mAddF64, mSubF64, mMulF64, mDivF64, mMinF64, + mMaxF64, mAddU, mSubU, mMulU, mDivU, mModU, + mAddU64, mSubU64, mMulU64, mDivU64, mModU64, mEqI, + mLeI, mLtI, mEqI64, mLeI64, mLtI64, mEqF64, + mLeF64, mLtF64, mLeU, mLtU, mLeU64, mLtU64, + mEqEnum, mLeEnum, mLtEnum, mEqCh, mLeCh, mLtCh, + mEqB, mLeB, mLtB, mEqRef, mEqProc, mEqUntracedRef, + mLePtr, mLtPtr, mEqCString, mXor, mUnaryMinusI, mUnaryMinusI64, + mAbsI, mAbsI64, mNot, mUnaryPlusI, mBitnotI, mUnaryPlusI64, + mBitnotI64, mUnaryPlusF64, mUnaryMinusF64, mAbsF64, mZe8ToI, mZe8ToI64, + mZe16ToI, mZe16ToI64, mZe32ToI64, mZeIToI64, mToU8, mToU16, + mToU32, mToFloat, mToBiggestFloat, mToInt, mToBiggestInt, mCharToStr, + mBoolToStr, mIntToStr, mInt64ToStr, mFloatToStr, mCStrToStr, mStrToStr, + mAnd, mOr, mEqStr, mLeStr, mLtStr, mEqSet, + mLeSet, mLtSet, mMulSet, mPlusSet, mMinusSet, mSymDiffSet, + mConStrStr, mConArrArr, mConArrT, mConTArr, mConTT, mSlice, + mAppendStrCh, mAppendStrStr, mAppendSeqElem, mAppendSeqSeq, mInRange, mInSet, + mAsgn, mRepr, mExit, mSetLengthStr, mSetLengthSeq, mAssert, + mSwap, mIsNil, mArrToSeq, mArray, mOpenArray, mRange, + mSet, mSeq, mInt, mInt8, mInt16, mInt32, + mInt64, mFloat, mFloat32, mFloat64, mBool, mChar, + mString, mCstring, mPointer, mAnyEnum, mEmptySet, mIntSetBaseType, + mNil, mIsMainModule, mCompileDate, mCompileTime, mNimrodVersion, mNimrodMajor, + mNimrodMinor, mNimrodPatch, mCpuEndian, mNaN, mInf, mNegInf, + mNLen, mNChild, mNSetChild, mNAdd, mNAddMultiple, mNDel, + mNKind, mNIntVal, mNFloatVal, mNSymbol, mNIdent, mNGetType, + mNStrVal, mNSetIntVal, mNSetFloatVal, mNSetSymbol, mNSetIdent, mNSetType, + mNSetStrVal, mNNewNimNode, mNCopyNimNode, mNCopyNimTree, mStrToIdent, mIdentToStr, + mEqIdent, mNHint, mNWarning, mNError + //[[[end]]] + ); + +type + PNode = ^TNode; + PNodePtr = ^{@ptr}PNode; + TNodeSeq = array of PNode; + + PType = ^TType; + PSym = ^TSym; + + TNode = {@ignore} record + typ: PType; + strVal: string; + comment: string; + sons: TNodeSeq; // else! + info: TLineInfo; + flags: TNodeFlags; + case Kind: TNodeKind of + nkCharLit, nkIntLit, nkInt8Lit, nkInt16Lit, nkInt32Lit, nkInt64Lit: + (intVal: biggestInt); + nkFloatLit, nkFloat32Lit, nkFloat64Lit: + (floatVal: biggestFloat); + nkSym: (sym: PSym); + nkIdent: (ident: PIdent); + nkMetaNode: (nodePtr: PNodePtr); + end; + {@emit + record // on a 32bit machine, this takes 32 bytes + typ: PType; + comment: string; + info: TLineInfo; + flags: TNodeFlags; + case Kind: TNodeKind of + nkCharLit..nkInt64Lit: + (intVal: biggestInt); + nkFloatLit..nkFloat64Lit: + (floatVal: biggestFloat); + nkStrLit..nkTripleStrLit: + (strVal: string); + nkSym: (sym: PSym); + nkIdent: (ident: PIdent); + nkMetaNode: (nodePtr: PNodePtr); + else (sons: TNodeSeq); + end acyclic; } + + TSymSeq = array of PSym; + TStrTable = object // a table[PIdent] of PSym + counter: int; + data: TSymSeq; + end; + +// -------------- backend information ------------------------------- + + TLocKind = ( + locNone, // no location + locTemp, // temporary location + locLocalVar, // location is a local variable + locGlobalVar, // location is a global variable + locParam, // location is a parameter + locField, // location is a record field + locArrayElem, // location is an array element + locExpr, // "location" is really an expression + locImmediate, // location is an immediate value + locProc, // location is a proc (an address of a procedure) + locData, // location is a constant + locCall, // location is a call expression + locOther // location is something other + ); + + TLocFlag = ( + lfIndirect, // backend introduced a pointer + lfNoDeepCopy, // no need for a deep copy + lfNoDecl, // do not declare it in C + lfDynamicLib, // link symbol to dynamic library + lfHeader // include header file for symbol + ); + + TStorageLoc = ( + OnUnknown, // location is unknown (stack, heap or static) + OnStack, // location is on hardware stack + OnHeap // location is on heap or global (reference counting needed) + ); + + TLocFlags = set of TLocFlag; + TLoc = record + k: TLocKind; // kind of location + s: TStorageLoc; + flags: TLocFlags; // location's flags + t: PType; // type of location + r: PRope; // rope value of location (code generators) + a: int; // location's "address", i.e. slot for temporaries + end; + +// ---------------- end of backend information ------------------------------ + TLibKind = (libHeader, libDynamic, libDynamicGenerated); + TLib = object(lists.TListEntry) // also misused for headers! + kind: TLibKind; + // needed for the backends: + name: PRope; + path: string; + end; + PLib = ^TLib; + + TSym = object(TIdObj) // symbols are identical iff they have the same + // id! + kind: TSymKind; + magic: TMagic; + typ: PType; + name: PIdent; + info: TLineInfo; + owner: PSym; + flags: TSymFlags; + tab: TStrTable; // interface table for modules + ast: PNode; // syntax tree of proc, iterator, etc.: + // the whole proc including header; this is used + // for easy generation of proper error messages + // for variant record fields the discriminant + // expression + options: TOptions; + position: int; // used for many different things: + // for enum fields its position; + // for fields its offset + // for parameters its position + // for a conditional: + // 1 iff the symbol is defined, else 0 + // (or not in symbol table) + offset: int; // offset of record field + loc: TLoc; + annex: PLib; // additional fields (seldom used, so we use a + // reference to another object to safe space) + end; + + TTypeSeq = array of PType; + TType = object(TIdObj) // types are identical iff they have the + // same id; there may be multiple copies of a type + // in memory! + kind: TTypeKind; // kind of type + sons: TTypeSeq; // base types, etc. + n: PNode; // node for types: + // for range types a nkRange node + // for record types a nkRecord node + // for enum types a list of symbols + // else: unused + flags: TTypeFlags; // flags of the type + callConv: TCallingConvention; // for procs + owner: PSym; // the 'owner' of the type + sym: PSym; // types have the sym associated with them + // it is used for converting types to strings + size: BiggestInt; // the size of the type in bytes + // -1 means that the size is unkwown + align: int; // the type's alignment requirements + containerID: int; // used for type checking of generics + loc: TLoc; + end; + + // these are not part of the syntax tree, but nevertherless inherit from TNode + TPair = record + key, val: PObject; + end; + TPairSeq = array of TPair; + + TTable = record // the same as table[PObject] of PObject + counter: int; + data: TPairSeq; + end; + + TIdPair = record + key: PIdObj; + val: PObject; + end; + TIdPairSeq = array of TIdPair; + + TIdTable = record // the same as table[PIdent] of PObject + counter: int; + data: TIdPairSeq; + end; + + TIdNodePair = record + key: PIdObj; + val: PNode; + end; + TIdNodePairSeq = array of TIdNodePair; + + TIdNodeTable = record // the same as table[PIdObj] of PNode + counter: int; + data: TIdNodePairSeq; + end; + + TNodePair = record + h: THash; // because it is expensive to compute! + key: PNode; + val: int; + end; + TNodePairSeq = array of TNodePair; + + TNodeTable = record // the same as table[PNode] of int; + // nodes are compared by structure! + counter: int; + data: TNodePairSeq; + end; + + TObjectSeq = array of PObject; + + TObjectSet = record + counter: int; + data: TObjectSeq; + end; + +const + OverloadableSyms = {@set}[skProc, skIterator, skConverter]; + +const // "MagicToStr" array: + MagicToStr: array [TMagic] of string = ( + //[[[cog + //for i in range(0, len(magics)-1): + // cog.out("'%s', " % magics[i]) + // if (i+1) % 6 == 0: cog.outl("") + //cog.outl("'%s'" % magics[-1]) + //]]] + 'None', 'Defined', 'Low', 'High', 'SizeOf', 'Is', + 'Succ', 'Pred', 'Inc', 'Dec', 'Ord', 'New', + 'NewFinalize', 'NewSeq', 'RegisterFinalizer', 'LengthOpenArray', 'LengthStr', 'LengthArray', + 'LengthSeq', 'Incl', 'Excl', 'Card', 'Chr', 'GCref', + 'GCunref', 'AddI', 'SubI', 'MulI', 'DivI', 'ModI', + 'AddI64', 'SubI64', 'MulI64', 'DivI64', 'ModI64', 'ShrI', + 'ShlI', 'BitandI', 'BitorI', 'BitxorI', 'MinI', 'MaxI', + 'ShrI64', 'ShlI64', 'BitandI64', 'BitorI64', 'BitxorI64', 'MinI64', + 'MaxI64', 'AddF64', 'SubF64', 'MulF64', 'DivF64', 'MinF64', + 'MaxF64', 'AddU', 'SubU', 'MulU', 'DivU', 'ModU', + 'AddU64', 'SubU64', 'MulU64', 'DivU64', 'ModU64', 'EqI', + 'LeI', 'LtI', 'EqI64', 'LeI64', 'LtI64', 'EqF64', + 'LeF64', 'LtF64', 'LeU', 'LtU', 'LeU64', 'LtU64', + 'EqEnum', 'LeEnum', 'LtEnum', 'EqCh', 'LeCh', 'LtCh', + 'EqB', 'LeB', 'LtB', 'EqRef', 'EqProc', 'EqUntracedRef', + 'LePtr', 'LtPtr', 'EqCString', 'Xor', 'UnaryMinusI', 'UnaryMinusI64', + 'AbsI', 'AbsI64', 'Not', 'UnaryPlusI', 'BitnotI', 'UnaryPlusI64', + 'BitnotI64', 'UnaryPlusF64', 'UnaryMinusF64', 'AbsF64', 'Ze8ToI', 'Ze8ToI64', + 'Ze16ToI', 'Ze16ToI64', 'Ze32ToI64', 'ZeIToI64', 'ToU8', 'ToU16', + 'ToU32', 'ToFloat', 'ToBiggestFloat', 'ToInt', 'ToBiggestInt', 'CharToStr', + 'BoolToStr', 'IntToStr', 'Int64ToStr', 'FloatToStr', 'CStrToStr', 'StrToStr', + 'And', 'Or', 'EqStr', 'LeStr', 'LtStr', 'EqSet', + 'LeSet', 'LtSet', 'MulSet', 'PlusSet', 'MinusSet', 'SymDiffSet', + 'ConStrStr', 'ConArrArr', 'ConArrT', 'ConTArr', 'ConTT', 'Slice', + 'AppendStrCh', 'AppendStrStr', 'AppendSeqElem', 'AppendSeqSeq', 'InRange', 'InSet', + 'Asgn', 'Repr', 'Exit', 'SetLengthStr', 'SetLengthSeq', 'Assert', + 'Swap', 'IsNil', 'ArrToSeq', 'Array', 'OpenArray', 'Range', + 'Set', 'Seq', 'Int', 'Int8', 'Int16', 'Int32', + 'Int64', 'Float', 'Float32', 'Float64', 'Bool', 'Char', + 'String', 'Cstring', 'Pointer', 'AnyEnum', 'EmptySet', 'IntSetBaseType', + 'Nil', 'IsMainModule', 'CompileDate', 'CompileTime', 'NimrodVersion', 'NimrodMajor', + 'NimrodMinor', 'NimrodPatch', 'CpuEndian', 'NaN', 'Inf', 'NegInf', + 'NLen', 'NChild', 'NSetChild', 'NAdd', 'NAddMultiple', 'NDel', + 'NKind', 'NIntVal', 'NFloatVal', 'NSymbol', 'NIdent', 'NGetType', + 'NStrVal', 'NSetIntVal', 'NSetFloatVal', 'NSetSymbol', 'NSetIdent', 'NSetType', + 'NSetStrVal', 'NNewNimNode', 'NCopyNimNode', 'NCopyNimTree', 'StrToIdent', 'IdentToStr', + 'EqIdent', 'NHint', 'NWarning', 'NError' + //[[[end]]] + ); + +const + GenericTypes: TTypeKinds = {@set}[tyGeneric, tyGenericParam]; + + StructuralEquivTypes: TTypeKinds = {@set}[ + tyArrayConstr, tyNil, tyTuple, + tyArray, + tySet, + tyRange, + tyPtr, tyRef, + tyVar, + tySequence, + tyProc, tyOpenArray + ]; + + ConcreteTypes: TTypeKinds = {@set}[ + // types of the expr that may occur in:: + // var x = expr + tyBool, tyChar, tyEnum, tyArray, tyObject, tySet, tyTuple, + tyRange, tyPtr, tyRef, tyVar, tySequence, tyProc, + tyPointer, tyOpenArray, + tyString, tyCString, + tyInt..tyInt64, + tyFloat..tyFloat128 + ]; + ConstantDataTypes: TTypeKinds = {@set}[tyArray, tySet, tyTuple]; + ExportableSymKinds = {@set}[skVar, skConst, skProc, skType, + skIterator, skMacro, skTemplate, skConverter, + skStub]; + PersistentNodeFlags: TNodeFlags = {@set}[ + nfBase2, nfBase8, nfBase16, nfAllConst]; + namePos = 0; + genericParamsPos = 1; + paramsPos = 2; + pragmasPos = 3; + codePos = 4; + resultPos = 5; + +var + gId: int; + +function getID: int; +procedure setID(id: int); +procedure IDsynchronizationPoint(idRange: int); + +// creator procs: +function NewSym(symKind: TSymKind; Name: PIdent; owner: PSym): PSym; + +function NewType(kind: TTypeKind; owner: PSym): PType; overload; + +function newNode(kind: TNodeKind): PNode; +function newIntNode(kind: TNodeKind; const intVal: BiggestInt): PNode; +function newIntTypeNode(kind: TNodeKind; const intVal: BiggestInt; + typ: PType): PNode; +function newFloatNode(kind: TNodeKind; const floatVal: BiggestFloat): PNode; +function newStrNode(kind: TNodeKind; const strVal: string): PNode; +function newIdentNode(ident: PIdent; const info: TLineInfo): PNode; +function newSymNode(sym: PSym): PNode; +function newNodeI(kind: TNodeKind; const info: TLineInfo): PNode; +function newNodeIT(kind: TNodeKind; const info: TLineInfo; typ: PType): PNode; + +procedure initStrTable(out x: TStrTable); +procedure initTable(out x: TTable); +procedure initIdTable(out x: TIdTable); +procedure initObjectSet(out x: TObjectSet); +procedure initIdNodeTable(out x: TIdNodeTable); +procedure initNodeTable(out x: TNodeTable); + +// copy procs: +function copyType(t: PType; owner: PSym; keepId: bool): PType; +function copySym(s: PSym; keepId: bool = false): PSym; +procedure assignType(dest, src: PType); + +procedure copyStrTable(out dest: TStrTable; const src: TStrTable); +procedure copyTable(out dest: TTable; const src: TTable); +procedure copyObjectSet(out dest: TObjectSet; const src: TObjectSet); +procedure copyIdTable(var dest: TIdTable; const src: TIdTable); + +function sonsLen(n: PNode): int; overload; +function sonsLen(n: PType): int; overload; + +function lastSon(n: PNode): PNode; overload; +function lastSon(n: PType): PType; overload; +procedure newSons(father: PNode; len: int); overload; +procedure newSons(father: PType; len: int); overload; + +procedure addSon(father, son: PNode); overload; +procedure addSon(father, son: PType); overload; + +procedure addSonIfNotNil(father, n: PNode); +procedure delSon(father: PNode; idx: int); +function hasSonWith(n: PNode; kind: TNodeKind): boolean; +function hasSubnodeWith(n: PNode; kind: TNodeKind): boolean; +procedure replaceSons(n: PNode; oldKind, newKind: TNodeKind); +function sonsNotNil(n: PNode): bool; // for assertions + +function copyNode(src: PNode): PNode; +// does not copy its sons! + +function copyTree(src: PNode): PNode; +// does copy its sons! + +procedure discardSons(father: PNode); + +const // for all kind of hash tables: + GrowthFactor = 2; // must be power of 2, > 0 + StartSize = 8; // must be power of 2, > 0 + +function SameValue(a, b: PNode): Boolean; // a, b are literals +function leValue(a, b: PNode): Boolean; // a <= b? a, b are literals + +function ValueToString(a: PNode): string; + +// ------------- efficient integer sets ------------------------------------- +const + IntsPerTrunk = 8; + InitIntSetSize = 8; // must be a power of two! + BitsPerTrunk = IntsPerTrunk * sizeof(int) * 8; + BitsPerInt = sizeof(int) * 8; + +type + PTrunk = ^TTrunk; + TTrunk = record + next: PTrunk; // all nodes are connected with this pointer + key: int; // start address at bit 0 + bits: array [0..IntsPerTrunk-1] of int; // a bit vector + end; + TTrunkSeq = array of PTrunk; + TIntSet = record + counter, max: int; + head: PTrunk; + data: TTrunkSeq; + end; + +function IntSetContains(const s: TIntSet; key: int): bool; +procedure IntSetIncl(var s: TIntSet; key: int); +procedure IntSetInit(var s: TIntSet); + +function IntSetContainsOrIncl(var s: TIntSet; key: int): bool; + + +const + debugIds = false; + +procedure registerID(id: PIdObj); + +// owner handling: +function getCurrOwner(): PSym; +procedure PushOwner(owner: PSym); +procedure PopOwner; + +implementation + +var + gOwners: array of PSym; // owner stack (used for initializing the + // owner field of syms) + // the documentation comment always gets + // assigned to the current owner + // BUGFIX: global array is needed! +{@emit gOwners := @[]; } + +function getCurrOwner(): PSym; +begin + result := gOwners[high(gOwners)]; +end; + +procedure PushOwner(owner: PSym); +var + len: int; +begin + len := length(gOwners); + setLength(gOwners, len+1); + gOwners[len] := owner; +end; + +procedure PopOwner; +var + len: int; +begin + len := length(gOwners); + if (len <= 0) then InternalError('popOwner'); + setLength(gOwners, len - 1); +end; + +var + usedIds: TIntSet; + +procedure registerID(id: PIdObj); +begin + if debugIDs then + if (id.id = -1) or IntSetContainsOrIncl(usedIds, id.id) then + InternalError('ID already used: ' + toString(id.id)); +end; + +function getID: int; +begin + result := gId; + inc(gId) +end; + +procedure setId(id: int); +begin + gId := max(gId, id+1); +end; + +procedure IDsynchronizationPoint(idRange: int); +begin + gId := (gId div IdRange +1) * IdRange + 1; +end; + +function leValue(a, b: PNode): Boolean; // a <= b? +begin + result := false; + case a.kind of + nkCharLit..nkInt64Lit: + if b.kind in [nkCharLit..nkInt64Lit] then + result := a.intVal <= b.intVal; + nkFloatLit..nkFloat64Lit: + if b.kind in [nkFloatLit..nkFloat64Lit] then + result := a.floatVal <= b.floatVal; + nkStrLit..nkTripleStrLit: begin + if b.kind in [nkStrLit..nkTripleStrLit] then + result := a.strVal <= b.strVal; + end + else InternalError(a.info, 'leValue'); + end +end; + +function SameValue(a, b: PNode): Boolean; +begin + result := false; + case a.kind of + nkCharLit..nkInt64Lit: + if b.kind in [nkCharLit..nkInt64Lit] then + result := a.intVal = b.intVal; + nkFloatLit..nkFloat64Lit: + if b.kind in [nkFloatLit..nkFloat64Lit] then + result := a.floatVal = b.floatVal; + nkStrLit..nkTripleStrLit: begin + if b.kind in [nkStrLit..nkTripleStrLit] then + result := a.strVal = b.strVal; + end + else InternalError(a.info, 'SameValue'); + end +end; + +function ValueToString(a: PNode): string; +begin + case a.kind of + nkCharLit..nkInt64Lit: + result := ToString(a.intVal); + nkFloatLit, nkFloat32Lit, nkFloat64Lit: + result := toStringF(a.floatVal); + nkStrLit..nkTripleStrLit: + result := a.strVal; + else begin + InternalError(a.info, 'valueToString'); + result := '' + end + end +end; + +procedure copyStrTable(out dest: TStrTable; const src: TStrTable); +var + i: int; +begin + dest.counter := src.counter; +{@emit + if isNil(src.data) then exit; +} + setLength(dest.data, length(src.data)); + for i := 0 to high(src.data) do + dest.data[i] := src.data[i]; +end; + +procedure copyIdTable(var dest: TIdTable; const src: TIdTable); +var + i: int; +begin + dest.counter := src.counter; +{@emit + if isNil(src.data) then exit; +} +{@ignore} + setLength(dest.data, length(src.data)); +{@emit + newSeq(dest.data, length(src.data)); } + for i := 0 to high(src.data) do + dest.data[i] := src.data[i]; +end; + +procedure copyTable(out dest: TTable; const src: TTable); +var + i: int; +begin + dest.counter := src.counter; +{@emit + if isNil(src.data) then exit; +} + setLength(dest.data, length(src.data)); + for i := 0 to high(src.data) do + dest.data[i] := src.data[i]; +end; + +procedure copyObjectSet(out dest: TObjectSet; const src: TObjectSet); +var + i: int; +begin + dest.counter := src.counter; +{@emit + if isNil(src.data) then exit; +} + setLength(dest.data, length(src.data)); + for i := 0 to high(src.data) do + dest.data[i] := src.data[i]; +end; + +procedure discardSons(father: PNode); +begin + father.sons := nil; +end; + +function newNode(kind: TNodeKind): PNode; +begin + new(result); +{@ignore} + FillChar(result^, sizeof(result^), 0); +{@emit} + result.kind := kind; + //result.info := UnknownLineInfo(); inlined: + result.info.fileIndex := int32(-1); + result.info.col := int16(-1); + result.info.line := int16(-1); +end; + +function newIntNode(kind: TNodeKind; const intVal: BiggestInt): PNode; +begin + result := newNode(kind); + result.intVal := intVal +end; + +function newIntTypeNode(kind: TNodeKind; const intVal: BiggestInt; + typ: PType): PNode; +begin + result := newIntNode(kind, intVal); + result.typ := typ; +end; + +function newFloatNode(kind: TNodeKind; const floatVal: BiggestFloat): PNode; +begin + result := newNode(kind); + result.floatVal := floatVal +end; + +function newStrNode(kind: TNodeKind; const strVal: string): PNode; +begin + result := newNode(kind); + result.strVal := strVal +end; + +function newIdentNode(ident: PIdent; const info: TLineInfo): PNode; +begin + result := newNode(nkIdent); + result.ident := ident; + result.info := info; +end; + +function newSymNode(sym: PSym): PNode; +begin + result := newNode(nkSym); + result.sym := sym; + result.typ := sym.typ; + result.info := sym.info; +end; + +function newNodeI(kind: TNodeKind; const info: TLineInfo): PNode; +begin + result := newNode(kind); + result.info := info; +end; + +function newNodeIT(kind: TNodeKind; const info: TLineInfo; typ: PType): PNode; +begin + result := newNode(kind); + result.info := info; + result.typ := typ; +end; + +function NewType(kind: TTypeKind; owner: PSym): PType; overload; +begin + new(result); +{@ignore} + FillChar(result^, sizeof(result^), 0); +{@emit} + result.kind := kind; + result.owner := owner; + result.size := -1; + result.align := 2; // default alignment + result.id := getID(); + if debugIds then RegisterId(result); + //if result.id < 2000 then + // MessageOut(typeKindToStr[kind] +{&} ' has id: ' +{&} toString(result.id)); +end; + +procedure assignType(dest, src: PType); +var + i: int; +begin + dest.kind := src.kind; + dest.flags := src.flags; + dest.callConv := src.callConv; + dest.n := src.n; + dest.size := src.size; + dest.align := src.align; + dest.containerID := src.containerID; + newSons(dest, sonsLen(src)); + for i := 0 to sonsLen(src)-1 do + dest.sons[i] := src.sons[i]; +end; + +function copyType(t: PType; owner: PSym; keepId: bool): PType; +begin + result := newType(t.Kind, owner); + assignType(result, t); + if keepId then result.id := t.id + else begin + result.id := getID(); + if debugIds then RegisterId(result); + end; + result.sym := t.sym; + // backend-info should not be copied +end; + +function copySym(s: PSym; keepId: bool = false): PSym; +begin + result := newSym(s.kind, s.name, s.owner); + result.ast := nil; // BUGFIX; was: s.ast which made problems + result.info := s.info; + result.typ := s.typ; + if keepId then result.id := s.id + else begin + result.id := getID(); + if debugIds then RegisterId(result); + end; + result.flags := s.flags; + result.magic := s.magic; + copyStrTable(result.tab, s.tab); + result.options := s.options; + result.position := s.position; + result.loc := s.loc; + result.annex := s.annex; // BUGFIX +end; + +function NewSym(symKind: TSymKind; Name: PIdent; owner: PSym): PSym; +// generates a symbol and initializes the hash field too +begin + new(result); +{@ignore} + FillChar(result^, sizeof(result^), 0); +{@emit} + result.Name := Name; + result.Kind := symKind; + result.flags := {@set}[]; + result.info := UnknownLineInfo(); + result.options := gOptions; + result.owner := owner; + result.offset := -1; + result.id := getID(); + if debugIds then RegisterId(result); + //if result.id < 2000 then + // MessageOut(name.s +{&} ' has id: ' +{&} toString(result.id)); +end; + +procedure initStrTable(out x: TStrTable); +begin + x.counter := 0; +{@emit + newSeq(x.data, startSize); } +{@ignore} + setLength(x.data, startSize); + fillChar(x.data[0], length(x.data)*sizeof(x.data[0]), 0); +{@emit} +end; + +procedure initTable(out x: TTable); +begin + x.counter := 0; +{@emit + newSeq(x.data, startSize); } +{@ignore} + setLength(x.data, startSize); + fillChar(x.data[0], length(x.data)*sizeof(x.data[0]), 0); +{@emit} +end; + +procedure initIdTable(out x: TIdTable); +begin + x.counter := 0; +{@emit + newSeq(x.data, startSize); } +{@ignore} + setLength(x.data, startSize); + fillChar(x.data[0], length(x.data)*sizeof(x.data[0]), 0); +{@emit} +end; + +procedure initObjectSet(out x: TObjectSet); +begin + x.counter := 0; +{@emit + newSeq(x.data, startSize); } +{@ignore} + setLength(x.data, startSize); + fillChar(x.data[0], length(x.data)*sizeof(x.data[0]), 0); +{@emit} +end; + +procedure initIdNodeTable(out x: TIdNodeTable); +begin + x.counter := 0; +{@emit + newSeq(x.data, startSize); } +{@ignore} + setLength(x.data, startSize); + fillChar(x.data[0], length(x.data)*sizeof(x.data[0]), 0); +{@emit} +end; + +procedure initNodeTable(out x: TNodeTable); +begin + x.counter := 0; +{@emit + newSeq(x.data, startSize); } +{@ignore} + setLength(x.data, startSize); + fillChar(x.data[0], length(x.data)*sizeof(x.data[0]), 0); +{@emit} +end; + +function sonsLen(n: PType): int; +begin +{@ignore} + result := length(n.sons); +{@emit + if isNil(n.sons) then result := 0 + else result := length(n.sons); } +end; + +procedure newSons(father: PType; len: int); +var + i, L: int; +begin +{@emit + if isNil(father.sons) then father.sons := @[]; } + L := length(father.sons); + setLength(father.sons, L + len); +{@ignore} + for i := L to L+len-1 do father.sons[i] := nil // needed for FPC +{@emit} +end; + +procedure addSon(father, son: PType); +var + L: int; +begin +{@ignore} + L := length(father.sons); + setLength(father.sons, L+1); + father.sons[L] := son; +{@emit + if isNil(father.sons) then father.sons := @[]; } +{@emit add(father.sons, son); } +end; + +function sonsLen(n: PNode): int; +begin +{@ignore} + result := length(n.sons); +{@emit + if isNil(n.sons) then result := 0 + else result := length(n.sons); } +end; + +procedure newSons(father: PNode; len: int); +var + i, L: int; +begin +{@emit + if isNil(father.sons) then father.sons := @[]; } + L := length(father.sons); + setLength(father.sons, L + len); +{@ignore} + for i := L to L+len-1 do father.sons[i] := nil // needed for FPC +{@emit} +end; + +procedure addSon(father, son: PNode); +var + L: int; +begin +{@ignore} + L := length(father.sons); + setLength(father.sons, L+1); + father.sons[L] := son; +{@emit + if isNil(father.sons) then father.sons := @[]; } +{@emit add(father.sons, son); } +end; + +procedure delSon(father: PNode; idx: int); +var + len, i: int; +begin +{@emit + if isNil(father.sons) then exit; } + len := sonsLen(father); + for i := idx to len-2 do + father.sons[i] := father.sons[i+1]; + setLength(father.sons, len-1); +end; + +function copyNode(src: PNode): PNode; +// does not copy its sons! +begin + if src = nil then begin result := nil; exit end; + result := newNode(src.kind); + result.info := src.info; + result.typ := src.typ; + result.flags := src.flags * PersistentNodeFlags; + case src.Kind of + nkCharLit..nkInt64Lit: + result.intVal := src.intVal; + nkFloatLit, nkFloat32Lit, nkFloat64Lit: + result.floatVal := src.floatVal; + nkSym: + result.sym := src.sym; + nkIdent: + result.ident := src.ident; + nkStrLit..nkTripleStrLit: + result.strVal := src.strVal; + nkMetaNode: + result.nodePtr := src.nodePtr; + else begin end; + end; +end; + +function copyTree(src: PNode): PNode; +// copy a whole syntax tree; performs deep copying +var + i: int; +begin + if src = nil then begin result := nil; exit end; + result := newNode(src.kind); + result.info := src.info; + result.typ := src.typ; + result.flags := src.flags * PersistentNodeFlags; + case src.Kind of + nkCharLit..nkInt64Lit: + result.intVal := src.intVal; + nkFloatLit, nkFloat32Lit, nkFloat64Lit: + result.floatVal := src.floatVal; + nkSym: + result.sym := src.sym; + nkIdent: + result.ident := src.ident; + nkStrLit..nkTripleStrLit: + result.strVal := src.strVal; + nkMetaNode: + result.nodePtr := src.nodePtr; + else begin + result.sons := nil; + newSons(result, sonsLen(src)); + for i := 0 to sonsLen(src)-1 do + result.sons[i] := copyTree(src.sons[i]); + end; + end +end; + +function lastSon(n: PNode): PNode; +begin + result := n.sons[sonsLen(n)-1]; +end; + +function lastSon(n: PType): PType; +begin + result := n.sons[sonsLen(n)-1]; +end; + +function hasSonWith(n: PNode; kind: TNodeKind): boolean; +var + i: int; +begin + for i := 0 to sonsLen(n)-1 do begin + if (n.sons[i] <> nil) and (n.sons[i].kind = kind) then begin + result := true; exit + end + end; + result := false +end; + +function hasSubnodeWith(n: PNode; kind: TNodeKind): boolean; +var + i: int; +begin + case n.kind of + nkEmpty..nkNilLit: result := n.kind = kind; + else begin + for i := 0 to sonsLen(n)-1 do begin + if (n.sons[i] <> nil) and (n.sons[i].kind = kind) + or hasSubnodeWith(n.sons[i], kind) then begin + result := true; exit + end + end; + result := false + end + end +end; + +procedure replaceSons(n: PNode; oldKind, newKind: TNodeKind); +var + i: int; +begin + for i := 0 to sonsLen(n)-1 do + if n.sons[i].kind = oldKind then n.sons[i].kind := newKind +end; + +function sonsNotNil(n: PNode): bool; +var + i: int; +begin + for i := 0 to sonsLen(n)-1 do + if n.sons[i] = nil then begin result := false; exit end; + result := true +end; + +procedure addSonIfNotNil(father, n: PNode); +begin + if n <> nil then addSon(father, n) +end; + +// ---------------- efficient integer sets ---------------------------------- +// Same algorithm as the one the GC uses + +function mustRehash(len, counter: int): bool; +begin + assert(len > counter); + result := (len * 2 < counter * 3) or (len-counter < 4); +end; + +function nextTry(h, maxHash: THash): THash; +begin + result := ((5*h) + 1) and maxHash; + // For any initial h in range(maxHash), repeating that maxHash times + // generates each int in range(maxHash) exactly once (see any text on + // random-number generation for proof). +end; + +procedure IntSetInit(var s: TIntSet); +begin +{@ignore} + fillChar(s, sizeof(s), 0); +{@emit} +{@ignore} + setLength(s.data, InitIntSetSize); + fillChar(s.data[0], length(s.data)*sizeof(s.data[0]), 0); +{@emit + newSeq(s.data, InitIntSetSize); } + s.max := InitIntSetSize-1; + s.counter := 0; + s.head := nil +end; + +function IntSetGet(const t: TIntSet; key: int): PTrunk; +var + h: int; +begin + h := key and t.max; + while t.data[h] <> nil do begin + if t.data[h].key = key then begin + result := t.data[h]; exit + end; + h := nextTry(h, t.max) + end; + result := nil +end; + +procedure IntSetRawInsert(const t: TIntSet; var data: TTrunkSeq; + desc: PTrunk); +var + h: int; +begin + h := desc.key and t.max; + while data[h] <> nil do begin + assert(data[h] <> desc); + h := nextTry(h, t.max) + end; + assert(data[h] = nil); + data[h] := desc +end; + +procedure IntSetEnlarge(var t: TIntSet); +var + n: TTrunkSeq; + i, oldMax: int; +begin + oldMax := t.max; + t.max := ((t.max+1)*2)-1; +{@ignore} + setLength(n, t.max + 1); + fillChar(n[0], length(n)*sizeof(n[0]), 0); +{@emit + newSeq(n, t.max+1); } + for i := 0 to oldmax do + if t.data[i] <> nil then + IntSetRawInsert(t, n, t.data[i]); +{@ignore} + t.data := n; +{@emit + swap(t.data, n); } +end; + +function IntSetPut(var t: TIntSet; key: int): PTrunk; +var + h: int; +begin + h := key and t.max; + while t.data[h] <> nil do begin + if t.data[h].key = key then begin + result := t.data[h]; exit + end; + h := nextTry(h, t.max) + end; + + if mustRehash(t.max+1, t.counter) then IntSetEnlarge(t); + inc(t.counter); + h := key and t.max; + while t.data[h] <> nil do h := nextTry(h, t.max); + assert(t.data[h] = nil); + new(result); +{@ignore} + fillChar(result^, sizeof(result^), 0); +{@emit} + result.next := t.head; + result.key := key; + t.head := result; + t.data[h] := result; +end; + +// ---------- slightly higher level procs ---------------------------------- + +function transform(key: int): int; +begin + if key < 0 then result := 1000000000 + key // avoid negative numbers! + else result := key +end; + +function IntSetContains(const s: TIntSet; key: int): bool; +var + u: int; + t: PTrunk; +begin + u := transform(key); + t := IntSetGet(s, u div BitsPerTrunk); + if t <> nil then begin + u := u mod BitsPerTrunk; + result := (t.bits[u div BitsPerInt] + and (1 shl (u mod BitsPerInt))) <> 0 + end + else + result := false +end; + +procedure IntSetIncl(var s: TIntSet; key: int); +var + u: int; + t: PTrunk; +begin + u := transform(key); + t := IntSetPut(s, u div BitsPerTrunk); + u := u mod BitsPerTrunk; + t.bits[u div BitsPerInt] := t.bits[u div BitsPerInt] + or (1 shl (u mod BitsPerInt)); +end; + +function IntSetContainsOrIncl(var s: TIntSet; key: int): bool; +var + u: int; + t: PTrunk; +begin + u := transform(key); + t := IntSetGet(s, u div BitsPerTrunk); + if t <> nil then begin + u := u mod BitsPerTrunk; + result := (t.bits[u div BitsPerInt] + and (1 shl (u mod BitsPerInt))) <> 0; + if not result then + t.bits[u div BitsPerInt] := t.bits[u div BitsPerInt] + or (1 shl (u mod BitsPerInt)); + end + else begin + IntSetIncl(s, key); + result := false + end +end; + + +initialization + if debugIDs then IntSetInit(usedIds); +end. diff --git a/nim/astalgo.pas b/nim/astalgo.pas index a7ee3fc83..ddd646efb 100644 --- a/nim/astalgo.pas +++ b/nim/astalgo.pas @@ -133,7 +133,8 @@ procedure debug(n: PNode); overload; // --------------------------- ident tables ---------------------------------- -function IdTableGet(const t: TIdTable; key: PIdObj): PObject; +function IdTableGet(const t: TIdTable; key: PIdObj): PObject; overload; +function IdTableGet(const t: TIdTable; key: int): PObject; overload; procedure IdTablePut(var t: TIdTable; key: PIdObj; val: PObject); function IdTableHasObjectAsKey(const t: TIdTable; key: PIdObj): bool; @@ -145,33 +146,6 @@ procedure IdNodeTablePut(var t: TIdNodeTable; key: PIdObj; val: PNode); procedure writeIdNodeTable(const t: TIdNodeTable); -// ------------- efficient integer sets ------------------------------------- -const - IntsPerTrunk = 8; - InitIntSetSize = 8; // must be a power of two! - BitsPerTrunk = IntsPerTrunk * sizeof(int) * 8; - BitsPerInt = sizeof(int) * 8; - -type - PTrunk = ^TTrunk; - TTrunk = record - next: PTrunk; // all nodes are connected with this pointer - key: int; // start address at bit 0 - bits: array [0..IntsPerTrunk-1] of int; // a bit vector - end; - TTrunkSeq = array of PTrunk; - TIntSet = record - counter, max: int; - head: PTrunk; - data: TTrunkSeq; - end; - -function IntSetContains(const s: TIntSet; key: int): bool; -procedure IntSetIncl(var s: TIntSet; key: int); -procedure IntSetInit(var s: TIntSet); - -function IntSetContainsOrIncl(var s: TIntSet; key: int): bool; - // --------------------------------------------------------------------------- function getSymFromList(list: PNode; ident: PIdent; start: int = 0): PSym; function lookupInRecord(n: PNode; field: PIdent): PSym; @@ -181,6 +155,24 @@ function getModule(s: PSym): PSym; function mustRehash(len, counter: int): bool; function nextTry(h, maxHash: THash): THash; +// ------------- table[int, int] --------------------------------------------- +const + InvalidKey = low(int); + +type + TIIPair = record + key, val: int; + end; + TIIPairSeq = array of TIIPair; + TIITable = record // table[int, int] + counter: int; + data: TIIPairSeq; + end; + +procedure initIITable(out x: TIITable); +function IITableGet(const t: TIITable; key: int): int; +procedure IITablePut(var t: TIITable; key, val: int); + implementation function lookupInRecord(n: PNode; field: PIdent): PSym; @@ -281,14 +273,14 @@ begin result := nil; res := '"' + ''; for i := strStart to length(s)+strStart-1 do begin - if i mod MaxLineLength = 0 then begin + if (i-strStart+1) mod MaxLineLength = 0 then begin res := res +{&} '"' +{&} nl; app(result, toRope(res)); res := '"'+''; // reset end; res := res +{&} toYamlChar(s[i]); end; - res := res + '"'; + addChar(res, '"'); app(result, toRope(res)); end; @@ -349,16 +341,16 @@ begin toRope(toLinenumber(info)), toRope(toColumn(info))]); end; -function treeToYamlAux(n: PNode; var marker: TObjectSet; +function treeToYamlAux(n: PNode; var marker: TIntSet; indent: int; maxRecDepth: int): PRope; forward; -function symToYamlAux(n: PSym; var marker: TObjectSet; +function symToYamlAux(n: PSym; var marker: TIntSet; indent: int; maxRecDepth: int): PRope; forward; -function typeToYamlAux(n: PType; var marker: TObjectSet; +function typeToYamlAux(n: PType; var marker: TIntSet; indent: int; maxRecDepth: int): PRope; forward; -function strTableToYaml(const n: TStrTable; var marker: TObjectSet; +function strTableToYaml(const n: TStrTable; var marker: TIntSet; indent: int; maxRecDepth: int): PRope; var istr: PRope; @@ -396,14 +388,14 @@ begin appf(result, '$n$1}', [spaces(indent)]); end; -function symToYamlAux(n: PSym; var marker: TObjectSet; +function symToYamlAux(n: PSym; var marker: TIntSet; indent: int; maxRecDepth: int): PRope; var ast: PRope; begin if n = nil then result := toRope('null') - else if ObjectSetContainsOrIncl(marker, n) then + else if IntSetContainsOrIncl(marker, n.id) then result := ropef('"$1 @$2"', [ toRope(n.name.s), toRope(strutils.toHex({@cast}TAddress(n), sizeof(n)*2))]) @@ -424,12 +416,12 @@ begin // YYY: backend info? end; -function typeToYamlAux(n: PType; var marker: TObjectSet; +function typeToYamlAux(n: PType; var marker: TIntSet; indent: int; maxRecDepth: int): PRope; begin if n = nil then result := toRope('null') - else if objectSetContainsOrIncl(marker, n) then + else if intSetContainsOrIncl(marker, n.id) then result := ropef('"$1 @$2"', [ toRope(typeKindToStr[n.kind]), toRope(strutils.toHex({@cast}TAddress(n), sizeof(n)*2))]) @@ -446,7 +438,7 @@ begin end end; -function treeToYamlAux(n: PNode; var marker: TObjectSet; indent: int; +function treeToYamlAux(n: PNode; var marker: TIntSet; indent: int; maxRecDepth: int): PRope; var istr: PRope; @@ -503,25 +495,25 @@ end; function treeToYaml(n: PNode; indent: int = 0; maxRecDepth: int = -1): PRope; var - marker: TObjectSet; + marker: TIntSet; begin - initObjectSet(marker); + IntSetInit(marker); result := treeToYamlAux(n, marker, indent, maxRecDepth) end; function typeToYaml(n: PType; indent: int = 0; maxRecDepth: int = -1): PRope; var - marker: TObjectSet; + marker: TIntSet; begin - initObjectSet(marker); + IntSetInit(marker); result := typeToYamlAux(n, marker, indent, maxRecDepth) end; function symToYaml(n: PSym; indent: int = 0; maxRecDepth: int = -1): PRope; var - marker: TObjectSet; + marker: TIntSet; begin - initObjectSet(marker); + IntSetInit(marker); result := symToYamlAux(n, marker, indent, maxRecDepth) end; @@ -617,7 +609,7 @@ const EmptySeq = nil; {@emit const - EmptySeq = []; + EmptySeq = @[]; } function nextTry(h, maxHash: THash): THash; @@ -661,11 +653,12 @@ var n: TObjectSeq; i: int; begin +{@ignore} n := emptySeq; setLength(n, length(t.data) * growthFactor); -{@ignore} fillChar(n[0], length(n)*sizeof(n[0]), 0); -{@emit} +{@emit + newSeq(n, length(t.data) * growthFactor); } for i := 0 to high(t.data) do if t.data[i] <> nil then objectSetRawInsert(n, t.data[i]); {@ignore} @@ -769,11 +762,12 @@ var n: TPairSeq; i: int; begin +{@ignore} n := emptySeq; setLength(n, length(t.data) * growthFactor); -{@ignore} fillChar(n[0], length(n)*sizeof(n[0]), 0); -{@emit} +{@emit + newSeq(n, length(t.data) * growthFactor); } for i := 0 to high(t.data) do if t.data[i].key <> nil then TableRawInsert(n, t.data[i].key, t.data[i].val); @@ -833,11 +827,12 @@ var n: TSymSeq; i: int; begin +{@ignore} n := emptySeq; setLength(n, length(t.data) * growthFactor); -{@ignore} fillChar(n[0], length(n)*sizeof(n[0]), 0); -{@emit} +{@emit + newSeq(n, length(t.data) * growthFactor); } for i := 0 to high(t.data) do if t.data[i] <> nil then StrTableRawInsert(n, t.data[i]); {@ignore} @@ -1022,13 +1017,13 @@ begin result := false end; -function IdTableRawGet(const t: TIdTable; key: PIdObj): int; +function IdTableRawGet(const t: TIdTable; key: int): int; var h: THash; begin - h := key.id and high(t.data); // start with real hash value + h := key and high(t.data); // start with real hash value while t.data[h].key <> nil do begin - if (t.data[h].key.id = key.id) then begin + if (t.data[h].key.id = key) then begin result := h; exit end; h := nextTry(h, high(t.data)) @@ -1040,7 +1035,7 @@ function IdTableHasObjectAsKey(const t: TIdTable; key: PIdObj): bool; var index: int; begin - index := IdTableRawGet(t, key); + index := IdTableRawGet(t, key.id); if index >= 0 then result := t.data[index].key = key else result := false end; @@ -1049,6 +1044,15 @@ function IdTableGet(const t: TIdTable; key: PIdObj): PObject; var index: int; begin + index := IdTableRawGet(t, key.id); + if index >= 0 then result := t.data[index].val + else result := nil +end; + +function IdTableGet(const t: TIdTable; key: int): PObject; +var + index: int; +begin index := IdTableRawGet(t, key); if index >= 0 then result := t.data[index].val else result := nil @@ -1074,18 +1078,18 @@ var index, i: int; n: TIdPairSeq; begin - index := IdTableRawGet(t, key); + index := IdTableRawGet(t, key.id); if index >= 0 then begin assert(t.data[index].key <> nil); t.data[index].val := val end else begin if mustRehash(length(t.data), t.counter) then begin - {@emit n := [];} - setLength(n, length(t.data) * growthFactor); {@ignore} + setLength(n, length(t.data) * growthFactor); fillChar(n[0], length(n)*sizeof(n[0]), 0); - {@emit} + {@emit + newSeq(n, length(t.data) * growthFactor); } for i := 0 to high(t.data) do if t.data[i].key <> nil then IdTableRawInsert(n, t.data[i].key, t.data[i].val); @@ -1166,11 +1170,11 @@ begin end else begin if mustRehash(length(t.data), t.counter) then begin - {@emit n := [];} - setLength(n, length(t.data) * growthFactor); {@ignore} + setLength(n, length(t.data) * growthFactor); fillChar(n[0], length(n)*sizeof(n[0]), 0); - {@emit} + {@emit + newSeq(n, length(t.data) * growthFactor); } for i := 0 to high(t.data) do if t.data[i].key <> nil then IdNodeTableRawInsert(n, t.data[i].key, t.data[i].val); @@ -1185,156 +1189,86 @@ begin end; end; -// ---------------- efficient integer sets ---------------------------------- -// Same algorithm as the one the GC uses +// ------------- int-to-int-mapping ------------------------------------------ -procedure IntSetInit(var s: TIntSet); +procedure initIITable(out x: TIITable); +var + i: int; begin + x.counter := 0; {@ignore} - fillChar(s, sizeof(s), 0); + setLength(x.data, startSize); {@emit - s.data := []; } - setLength(s.data, InitIntSetSize); -{@ignore} - fillChar(s.data[0], length(s.data)*sizeof(s.data[0]), 0); -{@emit} - s.max := InitIntSetSize-1; - s.counter := 0; - s.head := nil + newSeq(x.data, startSize); } + for i := 0 to startSize-1 do x.data[i].key := InvalidKey; end; -function IntSetGet(const t: TIntSet; key: int): PTrunk; +function IITableRawGet(const t: TIITable; key: int): int; var - h: int; + h: THash; begin - h := key and t.max; - while t.data[h] <> nil do begin - if t.data[h].key = key then begin - result := t.data[h]; exit + h := key and high(t.data); // start with real hash value + while t.data[h].key <> InvalidKey do begin + if (t.data[h].key = key) then begin + result := h; exit end; - h := nextTry(h, t.max) - end; - result := nil -end; - -procedure IntSetRawInsert(const t: TIntSet; var data: TTrunkSeq; - desc: PTrunk); -var - h: int; -begin - h := desc.key and t.max; - while data[h] <> nil do begin - assert(data[h] <> desc); - h := nextTry(h, t.max) + h := nextTry(h, high(t.data)) end; - assert(data[h] = nil); - data[h] := desc + result := -1 end; -procedure IntSetEnlarge(var t: TIntSet); +function IITableGet(const t: TIITable; key: int): int; var - n: TTrunkSeq; - i, oldMax: int; + index: int; begin - oldMax := t.max; - t.max := ((t.max+1)*2)-1; - {@emit n := []} - setLength(n, t.max + 1); -{@ignore} - fillChar(n[0], length(n)*sizeof(n[0]), 0); -{@emit} - for i := 0 to oldmax do - if t.data[i] <> nil then - IntSetRawInsert(t, n, t.data[i]); -{@ignore} - t.data := n; -{@emit - swap(t.data, n); -} + index := IITableRawGet(t, key); + if index >= 0 then result := t.data[index].val + else result := InvalidKey end; -function IntSetPut(var t: TIntSet; key: int): PTrunk; +procedure IITableRawInsert(var data: TIIPairSeq; + key, val: int); var - h: int; + h: THash; begin - h := key and t.max; - while t.data[h] <> nil do begin - if t.data[h].key = key then begin - result := t.data[h]; exit - end; - h := nextTry(h, t.max) + h := key and high(data); + while data[h].key <> InvalidKey do begin + assert(data[h].key <> key); + h := nextTry(h, high(data)) end; - - if mustRehash(t.max+1, t.counter) then IntSetEnlarge(t); - inc(t.counter); - h := key and t.max; - while t.data[h] <> nil do h := nextTry(h, t.max); - assert(t.data[h] = nil); - new(result); -{@ignore} - fillChar(result^, sizeof(result^), 0); -{@emit} - result.next := t.head; - result.key := key; - t.head := result; - t.data[h] := result; -end; - -// ---------- slightly higher level procs ---------------------------------- - -function transform(key: int): int; -begin - if key < 0 then result := 1000000000 + key // avoid negative numbers! - else result := key -end; - -function IntSetContains(const s: TIntSet; key: int): bool; -var - u: int; - t: PTrunk; -begin - u := transform(key); - t := IntSetGet(s, u div BitsPerTrunk); - if t <> nil then begin - u := u mod BitsPerTrunk; - result := (t.bits[u div BitsPerInt] - and (1 shl (u mod BitsPerInt))) <> 0 - end - else - result := false + assert(data[h].key = InvalidKey); + data[h].key := key; + data[h].val := val; end; -procedure IntSetIncl(var s: TIntSet; key: int); +procedure IITablePut(var t: TIITable; key, val: int); var - u: int; - t: PTrunk; + index, i: int; + n: TIIPairSeq; begin - u := transform(key); - t := IntSetPut(s, u div BitsPerTrunk); - u := u mod BitsPerTrunk; - t.bits[u div BitsPerInt] := t.bits[u div BitsPerInt] - or (1 shl (u mod BitsPerInt)); -end; - -function IntSetContainsOrIncl(var s: TIntSet; key: int): bool; -var - u: int; - t: PTrunk; -begin - u := transform(key); - t := IntSetGet(s, u div BitsPerTrunk); - if t <> nil then begin - u := u mod BitsPerTrunk; - result := (t.bits[u div BitsPerInt] - and (1 shl (u mod BitsPerInt))) <> 0; - if not result then - t.bits[u div BitsPerInt] := t.bits[u div BitsPerInt] - or (1 shl (u mod BitsPerInt)); + index := IITableRawGet(t, key); + if index >= 0 then begin + assert(t.data[index].key <> InvalidKey); + t.data[index].val := val end else begin - IntSetIncl(s, key); - result := false - end + if mustRehash(length(t.data), t.counter) then begin + {@ignore} + setLength(n, length(t.data) * growthFactor); + {@emit + newSeq(n, length(t.data) * growthFactor); } + for i := 0 to high(n) do n[i].key := InvalidKey; + for i := 0 to high(t.data) do + if t.data[i].key <> InvalidKey then + IITableRawInsert(n, t.data[i].key, t.data[i].val); + {@ignore} + t.data := n; + {@emit + swap(t.data, n); } + end; + IITableRawInsert(t.data, key, val); + inc(t.counter) + end; end; end. diff --git a/nim/backends.pas b/nim/backends.pas deleted file mode 100644 index e1ac616e9..000000000 --- a/nim/backends.pas +++ /dev/null @@ -1,59 +0,0 @@ -// -// -// The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf -// -// See the file "copying.txt", included in this -// distribution, for details about the copyright. -// -unit backends; - -// This module only contains the PBackend type declaration/interface, each -// backend has to adhere to. - -interface - -{$include 'config.inc'} - -uses - nsystem, idents, ropes, msgs, ast; - -type - PBackend = ^TBackend; - - TBackendEvent = (eNone, eAfterModule); - TEventMask = set of TBackendEvent; - TBackend = object(NObject) - eventMask: TEventMask; - module: PSym; - filename: string; - backendCreator: function (oldBackend: PBackend; module: PSym; - const filename: string): PBackend; - afterModuleEvent: procedure (b: PBackend; module: PNode); - // triggered AFTER a whole module has been checked for semantics - end; - -function backendCreator(b: PBackend; module: PSym; - const filename: string): PBackend; -function newBackend(module: PSym; const filename: string): PBackend; - -implementation - -function newBackend(module: PSym; const filename: string): PBackend; -begin - new(result); -{@ignore} - fillChar(result^, sizeof(result^), 0); -{@emit} - result.backendCreator := backendCreator; - result.module := module; - result.filename := filename; -end; - -function backendCreator(b: PBackend; module: PSym; - const filename: string): PBackend; -begin - result := newBackend(module, filename); -end; - -end. diff --git a/nim/bitsets.pas b/nim/bitsets.pas index ba039a786..78c6d1f36 100644 --- a/nim/bitsets.pas +++ b/nim/bitsets.pas @@ -8,7 +8,7 @@ // unit bitsets; -// this unit handles Nimrod sets; it implements symbolic sets +// this unit handles Nimrod sets; it implements bit sets // the code here should be reused in the Nimrod standard library interface @@ -44,57 +44,58 @@ implementation function BitSetIn(const x: TBitSet; const e: BiggestInt): Boolean; begin - result := (x[int(e div ElemSize)] and (1 shl (e mod ElemSize))) <> 0 + result := (x[int(e div ElemSize)] and toU8(int(1 shl (e mod ElemSize)))) <> toU8(0) end; procedure BitSetIncl(var x: TBitSet; const elem: BiggestInt); begin assert(elem >= 0); - x[int(elem div ElemSize)] := toU8(x[int(elem div ElemSize)] or - int(1 shl (elem mod ElemSize))) + x[int(elem div ElemSize)] := x[int(elem div ElemSize)] or + toU8(int(1 shl (elem mod ElemSize))) end; procedure BitSetExcl(var x: TBitSet; const elem: BiggestInt); begin - x[int(elem div ElemSize)] := toU8(x[int(elem div ElemSize)] and - not int(1 shl (elem mod ElemSize))) + x[int(elem div ElemSize)] := x[int(elem div ElemSize)] and + not toU8(int(1 shl (elem mod ElemSize))) end; procedure BitSetInit(out b: TBitSet; len: int); begin - {@emit b := [];} - setLength(b, len); {@ignore} + setLength(b, len); fillChar(b[0], length(b)*sizeof(b[0]), 0); -{@emit} +{@emit + newSeq(b, len); +} end; procedure BitSetUnion(var x: TBitSet; const y: TBitSet); var i: int; begin - for i := 0 to high(x) do x[i] := toU8(x[i] or int(y[i])) + for i := 0 to high(x) do x[i] := x[i] or y[i] end; procedure BitSetDiff(var x: TBitSet; const y: TBitSet); var i: int; begin - for i := 0 to high(x) do x[i] := toU8(x[i] and not int(y[i])) + for i := 0 to high(x) do x[i] := x[i] and not y[i] end; procedure BitSetSymDiff(var x: TBitSet; const y: TBitSet); var i: int; begin - for i := 0 to high(x) do x[i] := toU8(x[i] xor int(y[i])) + for i := 0 to high(x) do x[i] := x[i] xor y[i] end; procedure BitSetIntersect(var x: TBitSet; const y: TBitSet); var i: int; begin - for i := 0 to high(x) do x[i] := toU8(x[i] and int(y[i])) + for i := 0 to high(x) do x[i] := x[i] and y[i] end; function BitSetEquals(const x, y: TBitSet): Boolean; @@ -102,7 +103,7 @@ var i: int; begin for i := 0 to high(x) do - if (x[i] <> int(y[i])) then begin + if x[i] <> y[i] then begin result := false; exit; end; result := true @@ -113,7 +114,7 @@ var i: int; begin for i := 0 to high(x) do - if (x[i] and not int(y[i])) <> 0 then begin + if (x[i] and not y[i]) <> byte(0) then begin result := false; exit; end; result := true diff --git a/nim/ccgexprs.pas b/nim/ccgexprs.pas index 7668f114a..97828680b 100644 --- a/nim/ccgexprs.pas +++ b/nim/ccgexprs.pas @@ -24,7 +24,7 @@ end; function int32Literal(i: Int): PRope; begin - if i = low(int32) then + if i = int(low(int32)) then // Nimrod has the same bug for the same reasons :-) result := toRope('(-2147483647 -1)') else @@ -32,7 +32,7 @@ begin end; function genHexLiteral(v: PNode): PRope; -// in C hex literals are unsigned (at least I think so) +// hex literals are unsigned in C (at least I think so) // so we don't generate hex literals any longer. begin if not (v.kind in [nkIntLit..nkInt64Lit]) then @@ -42,15 +42,16 @@ end; function getStrLit(m: BModule; const s: string): PRope; begin - inc(gunique); - result := con('Str', toRope(gunique)); + useMagic(m, 'TGenericSeq'); + result := con('TMP', toRope(getID())); appf(m.s[cfsData], 'STRING_LITERAL($1, $2, $3);$n', - [result, makeCString(s), ToRope(length(s))]) + [result, makeCString(s), ToRope(length(s))]); end; function genLiteral(p: BProc; v: PNode; ty: PType): PRope; overload; var f: biggestFloat; + id: int; begin if ty = nil then internalError(v.info, 'genLiteral: ty is nil'); case v.kind of @@ -75,8 +76,18 @@ begin nkNilLit: result := toRope('0'+''); nkStrLit..nkTripleStrLit: begin - if skipVarGenericRange(ty).kind = tyString then - result := ropef('((string) &$1)', [getStrLit(p.module, v.strVal)]) + if skipVarGenericRange(ty).kind = tyString then begin + id := NodeTableTestOrSet(p.module.dataCache, v, gid); + if id = gid then begin + // string literal not found in the cache: + useMagic(p.module, 'NimStringDesc'); + result := ropef('((NimStringDesc*) &$1)', + [getStrLit(p.module, v.strVal)]) + end + else + result := ropef('((NimStringDesc*) &TMP$1)', + [toRope(id)]); + end else result := makeCString(v.strVal) end; @@ -138,21 +149,27 @@ begin end end else - result := toRope('0x' + ToHex(bitSetToWord(cs, size), size * 2)) + result := intLiteral(bitSetToWord(cs, size)) + // result := toRope('0x' + ToHex(bitSetToWord(cs, size), size * 2)) end; function genSetNode(p: BProc; n: PNode): PRope; var cs: TBitSet; - size: int; + size, id: int; begin size := int(getSize(n.typ)); toBitSet(n, cs); if size > 8 then begin - result := getTempName(); - appf(p.module.s[cfsData], - 'static NIM_CONST $1 $2 = $3;', - [getTypeDesc(p.module, n.typ), result, genRawSetData(cs, size)]) + id := NodeTableTestOrSet(p.module.dataCache, n, gid); + result := con('TMP', toRope(id)); + if id = gid then begin + // not found in cache: + inc(gid); + appf(p.module.s[cfsData], + 'static NIM_CONST $1 $2 = $3;', + [getTypeDesc(p.module, n.typ), result, genRawSetData(cs, size)]) + end end else result := genRawSetData(cs, size) @@ -209,15 +226,48 @@ begin result := ropef('((NU8)($1))', [result]) end; -procedure genRefAssign(p: BProc; const dest, src: TLoc); +type + TAssignmentFlag = (needToCopy, needForSubtypeCheck, + afDestIsNil, afDestIsNotNil, + afSrcIsNil, afSrcIsNotNil); + TAssignmentFlags = set of TAssignmentFlag; + +procedure genRefAssign(p: BProc; const dest, src: TLoc; + flags: TAssignmentFlags); begin if (dest.s = OnStack) or not (optRefcGC in gGlobalOptions) then // location is on hardware stack appf(p.s[cpsStmts], '$1 = $2;$n', [rdLoc(dest), rdLoc(src)]) else if dest.s = OnHeap then begin // location is on heap - UseMagic(p.module, 'asgnRef'); - appf(p.s[cpsStmts], 'asgnRef((void**) $1, $2);$n', - [addrLoc(dest), rdLoc(src)]) + // now the writer barrier is inlined for performance: + (* + if afSrcIsNotNil in flags then begin + UseMagic(p.module, 'nimGCref'); + appf(p.s[cpsStmts], 'nimGCref($1);$n', [rdLoc(src)]); + end + else if not (afSrcIsNil in flags) then begin + UseMagic(p.module, 'nimGCref'); + appf(p.s[cpsStmts], 'if ($1) nimGCref($1);$n', [rdLoc(src)]); + end; + if afDestIsNotNil in flags then begin + UseMagic(p.module, 'nimGCunref'); + appf(p.s[cpsStmts], 'nimGCunref($1);$n', [rdLoc(dest)]); + end + else if not (afDestIsNil in flags) then begin + UseMagic(p.module, 'nimGCunref'); + appf(p.s[cpsStmts], 'if ($1) nimGCunref($1);$n', [rdLoc(dest)]); + end; + appf(p.s[cpsStmts], '$1 = $2;$n', [rdLoc(dest), rdLoc(src)]); *) + if canFormAcycle(dest.t) then begin + UseMagic(p.module, 'asgnRef'); + appf(p.s[cpsStmts], 'asgnRef((void**) $1, $2);$n', + [addrLoc(dest), rdLoc(src)]) + end + else begin + UseMagic(p.module, 'asgnRefNoCycle'); + appf(p.s[cpsStmts], 'asgnRefNoCycle((void**) $1, $2);$n', + [addrLoc(dest), rdLoc(src)]) + end end else begin UseMagic(p.module, 'unsureAsgnRef'); @@ -226,10 +276,6 @@ begin end end; -type - TAssignmentFlag = (needToCopy, needForSubtypeCheck); - TAssignmentFlags = set of TAssignmentFlag; - procedure genAssignment(p: BProc; const dest, src: TLoc; flags: TAssignmentFlags); overload; // This function replaces all other methods for generating @@ -240,10 +286,10 @@ begin; ty := skipVarGenericRange(dest.t); case ty.kind of tyRef: - genRefAssign(p, dest, src); + genRefAssign(p, dest, src, flags); tySequence: begin if not (needToCopy in flags) then - genRefAssign(p, dest, src) + genRefAssign(p, dest, src, flags) else begin useMagic(p.module, 'genericSeqAssign'); // BUGFIX appf(p.s[cpsStmts], 'genericSeqAssign($1, $2, $3);$n', @@ -252,16 +298,16 @@ begin; end; tyString: begin if not (needToCopy in flags) then - genRefAssign(p, dest, src) + genRefAssign(p, dest, src, flags) else begin useMagic(p.module, 'copyString'); if (dest.s = OnStack) or not (optRefcGC in gGlobalOptions) then appf(p.s[cpsStmts], '$1 = copyString($2);$n', [rdLoc(dest), rdLoc(src)]) else if dest.s = OnHeap then begin - useMagic(p.module, 'asgnRef'); + useMagic(p.module, 'asgnRefNoCycle'); useMagic(p.module, 'copyString'); // BUGFIX - appf(p.s[cpsStmts], 'asgnRef((void**) $1, copyString($2));$n', + appf(p.s[cpsStmts], 'asgnRefNoCycle((void**) $1, copyString($2));$n', [addrLoc(dest), rdLoc(src)]) end else begin @@ -337,15 +383,15 @@ end; procedure expr(p: BProc; e: PNode; var d: TLoc); forward; -function initLocExpr(p: BProc; e: PNode): TLoc; +procedure initLocExpr(p: BProc; e: PNode; var result: TLoc); begin - result := initLoc(locNone, getUniqueType(e.typ), OnUnknown); + initLoc(result, locNone, getUniqueType(e.typ), OnUnknown); expr(p, e, result) end; procedure getDestLoc(p: BProc; var d: TLoc; typ: PType); begin - if d.k = locNone then d := getTemp(p, typ) + if d.k = locNone then getTemp(p, typ, d) end; procedure putLocIntoDest(p: BProc; var d: TLoc; const s: TLoc); @@ -364,7 +410,7 @@ var a: TLoc; begin if d.k <> locNone then begin // need to generate an assignment here - a := initLoc(locExpr, getUniqueType(t), OnUnknown); + initLoc(a, locExpr, getUniqueType(t), OnUnknown); a.r := r; if lfNoDeepCopy in d.flags then genAssignment(p, d, a, {@set}[]) @@ -387,13 +433,25 @@ var begin if (d.k <> locNone) then InternalError(e.info, 'binaryStmt'); if magic <> '' then useMagic(p.module, magic); - a := InitLocExpr(p, e.sons[1]); - b := InitLocExpr(p, e.sons[2]); + InitLocExpr(p, e.sons[1], a); + InitLocExpr(p, e.sons[2], b); appf(p.s[cpsStmts], frmt, [rdLoc(a), rdLoc(b)]); freeTemp(p, a); freeTemp(p, b) end; +procedure unaryStmt(p: BProc; e: PNode; var d: TLoc; + const magic, frmt: string); +var + a: TLoc; +begin + if (d.k <> locNone) then InternalError(e.info, 'unaryStmt'); + if magic <> '' then useMagic(p.module, magic); + InitLocExpr(p, e.sons[1], a); + appf(p.s[cpsStmts], frmt, [rdLoc(a)]); + freeTemp(p, a); +end; + procedure binaryStmtChar(p: BProc; e: PNode; var d: TLoc; const magic, frmt: string); var @@ -401,8 +459,8 @@ var begin if (d.k <> locNone) then InternalError(e.info, 'binaryStmtChar'); if magic <> '' then useMagic(p.module, magic); - a := InitLocExpr(p, e.sons[1]); - b := InitLocExpr(p, e.sons[2]); + InitLocExpr(p, e.sons[1], a); + InitLocExpr(p, e.sons[2], b); appf(p.s[cpsStmts], frmt, [rdCharLoc(a), rdCharLoc(b)]); freeTemp(p, a); freeTemp(p, b) @@ -416,9 +474,10 @@ begin if magic <> '' then useMagic(p.module, magic); assert(e.sons[1].typ <> nil); assert(e.sons[2].typ <> nil); - a := InitLocExpr(p, e.sons[1]); - b := InitLocExpr(p, e.sons[2]); - putIntoDest(p, d, e.typ, ropef(frmt, [rdLoc(a), rdLoc(b)])); + InitLocExpr(p, e.sons[1], a); + InitLocExpr(p, e.sons[2], b); + putIntoDest(p, d, e.typ, + ropef(frmt, [rdLoc(a), rdLoc(b), getTypeDesc(p.module, e.typ)])); if d.k <> locExpr then begin // BACKPORT freeTemp(p, a); freeTemp(p, b) @@ -433,8 +492,8 @@ begin if magic <> '' then useMagic(p.module, magic); assert(e.sons[1].typ <> nil); assert(e.sons[2].typ <> nil); - a := InitLocExpr(p, e.sons[1]); - b := InitLocExpr(p, e.sons[2]); + InitLocExpr(p, e.sons[1], a); + InitLocExpr(p, e.sons[2], b); putIntoDest(p, d, e.typ, ropef(frmt, [rdCharLoc(a), rdCharLoc(b)])); if d.k <> locExpr then begin // BACKPORT freeTemp(p, a); @@ -448,8 +507,9 @@ var a: TLoc; begin if magic <> '' then useMagic(p.module, magic); - a := InitLocExpr(p, e.sons[1]); - putIntoDest(p, d, e.typ, ropef(frmt, [rdLoc(a)])); + InitLocExpr(p, e.sons[1], a); + putIntoDest(p, d, e.typ, ropef(frmt, + [rdLoc(a), getTypeDesc(p.module, e.typ)])); if d.k <> locExpr then // BACKPORT freeTemp(p, a) end; @@ -460,7 +520,7 @@ var a: TLoc; begin if magic <> '' then useMagic(p.module, magic); - a := InitLocExpr(p, e.sons[1]); + InitLocExpr(p, e.sons[1], a); putIntoDest(p, d, e.typ, ropef(frmt, [rdCharLoc(a)])); if d.k <> locExpr then // BACKPORT freeTemp(p, a) @@ -472,15 +532,16 @@ const 'addInt64', 'subInt64', 'mulInt64', 'divInt64', 'modInt64' ); binWoOverflowTab: array [mAddi..mModi64] of string = ( - '($1 + $2)', '($1 - $2)', '($1 * $2)', '($1 / $2)', '($1 % $2)', + '($3)($1 + $2)', '($3)($1 - $2)', '($3)($1 * $2)', '($3)($1 / $2)', + '($3)($1 % $2)', '($1 + $2)', '($1 - $2)', '($1 * $2)', '($1 / $2)', '($1 % $2)' ); binArithTab: array [mShrI..mXor] of string = ( - '(NI)((NU)($1) >> (NU)($2))', // ShrI - '(NI)((NU)($1) << (NU)($2))', // ShlI - '($1 & $2)', // BitandI - '($1 | $2)', // BitorI - '($1 ^ $2)', // BitxorI + '($3)((NU)($1) >> (NU)($2))', // ShrI + '($3)((NU)($1) << (NU)($2))', // ShlI + '($3)($1 & $2)', // BitandI + '($3)($1 | $2)', // BitorI + '($3)($1 ^ $2)', // BitxorI '(($1 <= $2) ? $1 : $2)', // MinI '(($1 >= $2) ? $1 : $2)', // MaxI '(NI64)((NU64)($1) >> (NU64)($2))', // ShrI64 @@ -498,11 +559,11 @@ const '(($1 <= $2) ? $1 : $2)', // MinF64 '(($1 >= $2) ? $1 : $2)', // MaxF64 - '(NI)((NU)($1) + (NU)($2))', // AddU - '(NI)((NU)($1) - (NU)($2))', // SubU - '(NI)((NU)($1) * (NU)($2))', // MulU - '(NI)((NU)($1) / (NU)($2))', // DivU - '(NI)((NU)($1) % (NU)($2))', // ModU + '($3)((NU)($1) + (NU)($2))', // AddU + '($3)((NU)($1) - (NU)($2))', // SubU + '($3)((NU)($1) * (NU)($2))', // MulU + '($3)((NU)($1) / (NU)($2))', // DivU + '($3)((NU)($1) % (NU)($2))', // ModU '(NI64)((NU64)($1) + (NU64)($2))', // AddU64 '(NI64)((NU64)($1) - (NU64)($2))', // SubU64 '(NI64)((NU64)($1) * (NU64)($2))', // MulU64 @@ -545,8 +606,8 @@ const ); unArithTab: array [mNot..mToBiggestInt] of string = ( '!($1)', // Not - '+($1)', // UnaryPlusI - '~($1)', // BitnotI + '$1', // UnaryPlusI + '(($2) ~($1))', // BitnotI '+($1)', // UnaryPlusI64 '~($1)', // BitnotI64 '+($1)', // UnaryPlusF64 @@ -576,9 +637,9 @@ const 'absInt64' // AbsI64 ); unWoOverflowTab: array [mUnaryMinusI..mAbsI64] of string = ( - '-($1)', // UnaryMinusI + '(($2)-($1))', // UnaryMinusI '-($1)', // UnaryMinusI64 - 'abs($1)', // AbsI + '($2)abs($1)', // AbsI '($1 > 0? ($1) : -($1))' // AbsI64 ); @@ -588,11 +649,38 @@ begin end; procedure binaryArithOverflow(p: BProc; e: PNode; var d: TLoc; op: TMagic); +var + a, b: TLoc; begin - if optOverflowCheck in p.options then - binaryExpr(p, e, d, binOverflowTab[op], binOverflowTab[op] + '($1, $2)') - else + if not (optOverflowCheck in p.options) then binaryExpr(p, e, d, '', binWoOverflowTab[op]) + else begin + case op of + mAddi..mModi: begin + if (skipGeneric(e.typ).kind = tyInt) then + binaryExpr(p, e, d, binOverflowTab[op], + binOverflowTab[op] + '($1, $2)') + else begin + InitLocExpr(p, e.sons[1], a); + InitLocExpr(p, e.sons[2], b); + UseMagic(p.module, binOverflowTab[op]); + UseMagic(p.module, 'raiseOverflow'); + a.r := ropef(binOverflowTab[op] + '($1, $2)', + [rdLoc(a), rdLoc(b)]); + if d.k = locNone then getTemp(p, getSysType(tyInt), d); + genAssignment(p, d, a, {@set}[]); + appf(p.s[cpsStmts], 'if ($1 < $2 || $1 > $3) raiseOverflow();$n', + [rdLoc(d), intLiteral(firstOrd(e.typ)), + intLiteral(lastOrd(e.typ))]); + d.t := e.typ; + d.r := ropef('($1)($2)', [getTypeDesc(p.module, e.typ), rdLoc(d)]); + end + end; + mAddi64..mModi64: + binaryExpr(p, e, d, binOverflowTab[op], binOverflowTab[op] + '($1, $2)'); + else InternalError(e.info, 'binaryArithOverflow'); + end + end end; procedure unaryArith(p: BProc; e: PNode; var d: TLoc; op: TMagic); @@ -603,7 +691,7 @@ end; procedure unaryArithOverflow(p: BProc; e: PNode; var d: TLoc; op: TMagic); begin if optOverflowCheck in p.options then - unaryExpr(p, e, d, unOverflowTab[op], unOverflowTab[op] + '($1)') + unaryExpr(p, e, d, unOverflowTab[op], '($2)' + unOverflowTab[op] + '($1)') else unaryExpr(p, e, d, '', unWoOverflowTab[op]) end; @@ -615,7 +703,7 @@ begin if mapType(e.sons[0].typ) = ctArray then expr(p, e.sons[0], d) else begin - a := initLocExpr(p, e.sons[0]); + initLocExpr(p, e.sons[0], a); case skipGeneric(a.t).kind of tyRef: d.s := OnHeap; tyVar: d.s := OnUnknown; @@ -633,7 +721,7 @@ begin if mapType(e.sons[0].typ) = ctArray then expr(p, e.sons[0], d) else begin - a := InitLocExpr(p, e.sons[0]); + InitLocExpr(p, e.sons[0], a); putIntoDest(p, d, e.typ, addrLoc(a)); if d.k <> locExpr then freeTemp(p, a) end @@ -641,7 +729,7 @@ end; function genRecordFieldAux(p: BProc; e: PNode; var d, a: TLoc): PType; begin - a := initLocExpr(p, e.sons[0]); + initLocExpr(p, e.sons[0], a); if (e.sons[1].kind <> nkSym) then InternalError(e.info, 'genRecordFieldAux'); if d.k = locNone then d.s := a.s; {@discard} getTypeDesc(p.module, a.t); // fill the record's fields.loc @@ -679,12 +767,13 @@ var a, u, v, test: TLoc; f, field, op: PSym; ty: PType; - r: PRope; - i: int; + r, strLit: PRope; + i, id: int; it: PNode; begin if optFieldCheck in p.options then begin useMagic(p.module, 'raiseFieldError'); + useMagic(p.module, 'NimStringDesc'); ty := genRecordFieldAux(p, e.sons[0], d, a); r := rdLoc(a); f := e.sons[0].sons[1].sym; @@ -706,19 +795,26 @@ begin op := it.sons[0].sym; if op.magic = mNot then it := it.sons[1]; assert(it.sons[2].kind = nkSym); - test := initLoc(locNone, it.typ, OnStack); - u := InitLocExpr(p, it.sons[1]); - v := initLoc(locExpr, it.sons[2].typ, OnUnknown); + initLoc(test, locNone, it.typ, OnStack); + InitLocExpr(p, it.sons[1], u); + initLoc(v, locExpr, it.sons[2].typ, OnUnknown); v.r := ropef('$1.$2', [r, it.sons[2].sym.loc.r]); genInExprAux(p, it, u, v, test); + + id := NodeTableTestOrSet(p.module.dataCache, + newStrNode(nkStrLit, field.name.s), gid); + if id = gid then + strLit := getStrLit(p.module, field.name.s) + else + strLit := con('TMP', toRope(id)); if op.magic = mNot then appf(p.s[cpsStmts], - 'if ($1) raiseFieldError(((string) &$2));$n', - [rdLoc(test), getStrLit(p.module, field.name.s)]) + 'if ($1) raiseFieldError(((NimStringDesc*) &$2));$n', + [rdLoc(test), strLit]) else appf(p.s[cpsStmts], - 'if (!($1)) raiseFieldError(((string) &$2));$n', - [rdLoc(test), getStrLit(p.module, field.name.s)]) + 'if (!($1)) raiseFieldError(((NimStringDesc*) &$2));$n', + [rdLoc(test), strLit]) end; appf(r, '.$1', [field.loc.r]); putIntoDest(p, d, field.typ, r); @@ -733,17 +829,24 @@ var ty: PType; first: PRope; begin - a := initLocExpr(p, e.sons[0]); - b := initLocExpr(p, e.sons[1]); + initLocExpr(p, e.sons[0], a); + initLocExpr(p, e.sons[1], b); ty := skipPtrsGeneric(skipVarGenericRange(a.t)); first := intLiteral(firstOrd(ty)); // emit range check: - if optBoundsCheck in p.options then + if (optBoundsCheck in p.options) then if b.k <> locImmediate then begin // semantic pass has already checked: useMagic(p.module, 'raiseIndexError'); - appf(p.s[cpsStmts], - 'if ($1 < $2 || $1 > $3) raiseIndexError();$n', - [rdCharLoc(b), first, intLiteral(lastOrd(ty))]) + if firstOrd(ty) = 0 then begin + if lastOrd(b.t) > lastOrd(ty) then + appf(p.s[cpsStmts], + 'if ((NU)($1) > (NU)($2)) raiseIndexError();$n', + [rdCharLoc(b), intLiteral(lastOrd(ty))]) + end + else + appf(p.s[cpsStmts], + 'if ($1 < $2 || $1 > $3) raiseIndexError();$n', + [rdCharLoc(b), first, intLiteral(lastOrd(ty))]) end; if d.k = locNone then d.s := a.s; putIntoDest(p, d, elemType(skipVarGeneric(ty)), ropef('$1[($2)-$3]', @@ -757,8 +860,8 @@ var a, b: TLoc; ty: PType; begin - a := initLocExpr(p, e.sons[0]); - b := initLocExpr(p, e.sons[1]); + initLocExpr(p, e.sons[0], a); + initLocExpr(p, e.sons[1], b); ty := skipVarGenericRange(a.t); if d.k = locNone then d.s := a.s; putIntoDest(p, d, elemType(skipVarGeneric(ty)), ropef('$1[$2]', @@ -771,13 +874,13 @@ procedure genOpenArrayElem(p: BProc; e: PNode; var d: TLoc); var a, b: TLoc; begin - a := initLocExpr(p, e.sons[0]); - b := initLocExpr(p, e.sons[1]); + initLocExpr(p, e.sons[0], a); + initLocExpr(p, e.sons[1], b); // emit range check: - if optBoundsCheck in p.options then begin + if (optBoundsCheck in p.options) then begin useMagic(p.module, 'raiseIndexError'); appf(p.s[cpsStmts], - 'if ((NU)($1) > (NU)($2Len0)) raiseIndexError();$n', [rdLoc(b), a.r]) + 'if ((NU)($1) > (NU)($2Len0)) raiseIndexError();$n', [rdLoc(b), rdLoc(a)]) end; if d.k = locNone then d.s := a.s; putIntoDest(p, d, elemType(skipVarGeneric(a.t)), ropef('$1[$2]', @@ -791,20 +894,20 @@ var a, b: TLoc; ty: PType; begin - a := initLocExpr(p, e.sons[0]); - b := initLocExpr(p, e.sons[1]); + initLocExpr(p, e.sons[0], a); + initLocExpr(p, e.sons[1], b); ty := skipVarGenericRange(a.t); if ty.kind in [tyRef, tyPtr] then ty := skipVarGenericRange(ty.sons[0]); // emit range check: - if optBoundsCheck in p.options then begin + if (optBoundsCheck in p.options) then begin useMagic(p.module, 'raiseIndexError'); if ty.kind = tyString then appf(p.s[cpsStmts], - 'if ((NU)($1) > (NU)($2->len)) raiseIndexError();$n', + 'if ((NU)($1) > (NU)($2->Sup.len)) raiseIndexError();$n', [rdLoc(b), rdLoc(a)]) else appf(p.s[cpsStmts], - 'if ((NU)($1) >= (NU)($2->len)) raiseIndexError();$n', + 'if ((NU)($1) >= (NU)($2->Sup.len)) raiseIndexError();$n', [rdLoc(b), rdLoc(a)]) end; if d.k = locNone then d.s := OnHeap; @@ -841,7 +944,7 @@ var L: TLabel; tmp: TLoc; begin - tmp := getTemp(p, e.typ); // force it into a temp! + getTemp(p, e.typ, tmp); // force it into a temp! expr(p, e.sons[1], tmp); L := getLabel(p); if m = mOr then @@ -877,13 +980,13 @@ var a, tmp: TLoc; Lend, Lelse: TLabel; begin - tmp := getTemp(p, n.typ); // force it into a temp! + getTemp(p, n.typ, tmp); // force it into a temp! Lend := getLabel(p); for i := 0 to sonsLen(n)-1 do begin it := n.sons[i]; case it.kind of nkElifExpr: begin - a := initLocExpr(p, it.sons[0]); + initLocExpr(p, it.sons[0], a); Lelse := getLabel(p); appf(p.s[cpsStmts], 'if (!$1) goto $2;$n', [rdLoc(a), Lelse]); freeTemp(p, a); @@ -909,55 +1012,51 @@ end; procedure genCall(p: BProc; t: PNode; var d: TLoc); var param: PSym; - a: array of TLoc; invalidRetType: bool; typ: PType; pl: PRope; // parameter list - op, list: TLoc; + op, list, a: TLoc; len, i: int; begin -{@emit - a := []; -} - op := initLocExpr(p, t.sons[0]); + // this is a hotspot in the compiler + initLocExpr(p, t.sons[0], op); pl := con(op.r, '('+''); - typ := getUniqueType(t.sons[0].typ); + //typ := getUniqueType(t.sons[0].typ); + typ := t.sons[0].typ; // getUniqueType() is too expensive here! assert(typ.kind = tyProc); invalidRetType := isInvalidReturnType(typ.sons[0]); len := sonsLen(t); - setLength(a, len-1); for i := 1 to len-1 do begin - a[i-1] := initLocExpr(p, t.sons[i]); // generate expression for param + initLocExpr(p, t.sons[i], a); // generate expression for param assert(sonsLen(typ) = sonsLen(typ.n)); if (i < sonsLen(typ)) then begin assert(typ.n.sons[i].kind = nkSym); param := typ.n.sons[i].sym; - if ccgIntroducedPtr(param) then app(pl, addrLoc(a[i-1])) - else app(pl, rdLoc(a[i-1])); + if ccgIntroducedPtr(param) then app(pl, addrLoc(a)) + else app(pl, rdLoc(a)); end else - app(pl, rdLoc(a[i-1])); + app(pl, rdLoc(a)); if (i < len-1) or (invalidRetType and (typ.sons[0] <> nil)) then app(pl, ', ') end; if (typ.sons[0] <> nil) and invalidRetType then begin - if d.k = locNone then d := getTemp(p, typ.sons[0]); + if d.k = locNone then getTemp(p, typ.sons[0], d); app(pl, addrLoc(d)); end; app(pl, ')'+''); - for i := 0 to high(a) do - freeTemp(p, a[i]); // important to free the temporaries - freeTemp(p, op); if (typ.sons[0] <> nil) and not invalidRetType then begin - if d.k = locNone then d := getTemp(p, typ.sons[0]); + if d.k = locNone then getTemp(p, typ.sons[0], d); assert(d.t <> nil); // generate an assignment to d: - list := initLoc(locCall, nil, OnUnknown); + initLoc(list, locCall, nil, OnUnknown); list.r := pl; genAssignment(p, d, list, {@set}[]) // no need for deep copying end - else - appf(p.s[cpsStmts], '$1;$n', [pl]) + else begin + app(p.s[cpsStmts], pl); + app(p.s[cpsStmts], ';' + tnl) + end end; procedure genStrConcat(p: BProc; e: PNode; var d: TLoc); @@ -984,17 +1083,17 @@ var L, i: int; begin useMagic(p.module, 'rawNewString'); - tmp := getTemp(p, e.typ); + getTemp(p, e.typ, tmp); L := 0; appends := nil; lens := nil; -{@emit - a := []; -} +{@ignore} setLength(a, sonsLen(e)-1); +{@emit + newSeq(a, sonsLen(e)-1); } for i := 0 to sonsLen(e)-2 do begin // compute the length expression: - a[i] := initLocExpr(p, e.sons[i+1]); + initLocExpr(p, e.sons[i+1], a[i]); if skipVarGenericRange(e.sons[i+1].Typ).kind = tyChar then begin Inc(L); useMagic(p.module, 'appendChar'); @@ -1004,7 +1103,7 @@ begin if e.sons[i+1].kind in [nkStrLit..nkTripleStrLit] then // string literal? Inc(L, length(e.sons[i+1].strVal)) else - appf(lens, '$1->len + ', [rdLoc(a[i])]); + appf(lens, '$1->Sup.len + ', [rdLoc(a[i])]); useMagic(p.module, 'appendString'); appf(appends, 'appendString($1, $2);$n', [tmp.r, rdLoc(a[i])]) end @@ -1044,14 +1143,14 @@ begin L := 0; appends := nil; lens := nil; -{@emit - a := []; -} +{@ignore} setLength(a, sonsLen(e)-1); +{@emit + newSeq(a, sonsLen(e)-1); } expr(p, e.sons[1], a[0]); for i := 0 to sonsLen(e)-3 do begin // compute the length expression: - a[i+1] := initLocExpr(p, e.sons[i+2]); + initLocExpr(p, e.sons[i+2], a[i+1]); if skipVarGenericRange(e.sons[i+2].Typ).kind = tyChar then begin Inc(L); useMagic(p.module, 'appendChar'); @@ -1062,7 +1161,7 @@ begin if e.sons[i+2].kind in [nkStrLit..nkTripleStrLit] then // string literal? Inc(L, length(e.sons[i+2].strVal)) else - appf(lens, '$1->len + ', [rdLoc(a[i+1])]); + appf(lens, '$1->Sup.len + ', [rdLoc(a[i+1])]); useMagic(p.module, 'appendString'); appf(appends, 'appendString($1, $2);$n', [rdLoc(a[0]), rdLoc(a[i+1])]) @@ -1077,23 +1176,50 @@ end; procedure genSeqElemAppend(p: BProc; e: PNode; var d: TLoc); // seq &= x --> -// seq = (typeof seq) incrSeq( (TGenericSeq*) seq, sizeof(x)); +// seq = (typeof seq) incrSeq(&seq->Sup, sizeof(x)); // seq->data[seq->len-1] = x; var a, b, dest: TLoc; begin useMagic(p.module, 'incrSeq'); - a := InitLocExpr(p, e.sons[1]); - b := InitLocExpr(p, e.sons[2]); + InitLocExpr(p, e.sons[1], a); + InitLocExpr(p, e.sons[2], b); appf(p.s[cpsStmts], - '$1 = ($2) incrSeq((TGenericSeq*) $1, sizeof($3));$n', + '$1 = ($2) incrSeq(&($1)->Sup, sizeof($3));$n', [rdLoc(a), getTypeDesc(p.module, skipVarGeneric(e.sons[1].typ)), getTypeDesc(p.module, skipVarGeneric(e.sons[2].Typ))]); - dest := initLoc(locExpr, b.t, OnHeap); - dest.r := ropef('$1->data[$1->len-1]', [rdLoc(a)]); - genAssignment(p, dest, b, {@set}[needToCopy]); - freeTemp(p, a); - freeTemp(p, b) + initLoc(dest, locExpr, b.t, OnHeap); + dest.r := ropef('$1->data[$1->Sup.len-1]', [rdLoc(a)]); + genAssignment(p, dest, b, {@set}[needToCopy, afDestIsNil]); +end; + +procedure genObjectInit(p: BProc; t: PType; const a: TLoc; takeAddr: bool); +var + r: PRope; + s: PType; +begin + case analyseObjectWithTypeField(t) of + frNone: begin end; + frHeader: begin + r := rdLoc(a); + if not takeAddr then r := ropef('(*$1)', [r]); + s := t; + while (s.kind = tyObject) and (s.sons[0] <> nil) do begin + app(r, '.Sup'); + s := skipGeneric(s.sons[0]); + end; + appf(p.s[cpsStmts], '$1.m_type = $2;$n', + [r, genTypeInfo(p.module, t)]) + end; + frEmbedded: begin + // worst case for performance: + useMagic(p.module, 'objectInit'); + if takeAddr then r := addrLoc(a) + else r := rdLoc(a); + appf(p.s[cpsStmts], 'objectInit($1, $2);$n', + [r, genTypeInfo(p.module, t)]) + end + end end; procedure genNew(p: BProc; e: PNode); @@ -1103,20 +1229,63 @@ var begin useMagic(p.module, 'newObj'); refType := skipVarGenericRange(e.sons[1].typ); - a := InitLocExpr(p, e.sons[1]); - b := initLoc(locExpr, a.t, OnHeap); + InitLocExpr(p, e.sons[1], a); + initLoc(b, locExpr, a.t, OnHeap); b.r := ropef('($1) newObj($2, sizeof($3))', [getTypeDesc(p.module, reftype), genTypeInfo(p.module, refType), getTypeDesc(p.module, skipGenericRange(reftype.sons[0]))]); genAssignment(p, a, b, {@set}[]); // set the object type: bt := skipGenericRange(refType.sons[0]); - if containsObject(bt) then begin - useMagic(p.module, 'objectInit'); - appf(p.s[cpsStmts], 'objectInit($1, $2);$n', - [rdLoc(a), genTypeInfo(p.module, bt)]) + genObjectInit(p, bt, a, false); +end; + +procedure genNewSeq(p: BProc; e: PNode); +var + a, b, c: TLoc; + seqtype: PType; +begin + useMagic(p.module, 'newSeq'); + seqType := skipVarGenericRange(e.sons[1].typ); + InitLocExpr(p, e.sons[1], a); + InitLocExpr(p, e.sons[2], b); + initLoc(c, locExpr, a.t, OnHeap); + c.r := ropef('($1) newSeq($2, $3)', + [getTypeDesc(p.module, seqtype), + genTypeInfo(p.module, seqType), + rdLoc(b)]); + genAssignment(p, a, c, {@set}[]); +end; + +procedure genIs(p: BProc; n: PNode; var d: TLoc); +var + a: TLoc; + dest, t: PType; + r, nilcheck: PRope; +begin + initLocExpr(p, n.sons[1], a); + dest := skipPtrsGeneric(n.sons[2].typ); + useMagic(p.module, 'isObj'); + r := rdLoc(a); + nilCheck := nil; + t := skipGeneric(a.t); + while t.kind in [tyVar, tyPtr, tyRef] do begin + if t.kind <> tyVar then nilCheck := r; + r := ropef('(*$1)', [r]); + t := skipGeneric(t.sons[0]) end; - freeTemp(p, a) + if gCmd <> cmdCompileToCpp then + while (t.kind = tyObject) and (t.sons[0] <> nil) do begin + app(r, '.Sup'); + t := skipGeneric(t.sons[0]); + end; + if nilCheck <> nil then + r := ropef('(($1) && isObj($2.m_type, $3))', + [nilCheck, r, genTypeInfo(p.module, dest)]) + else + r := ropef('isObj($1.m_type, $2)', + [r, genTypeInfo(p.module, dest)]); + putIntoDest(p, d, n.typ, r); end; procedure genNewFinalize(p: BProc; e: PNode); @@ -1127,9 +1296,9 @@ var begin useMagic(p.module, 'newObj'); refType := skipVarGenericRange(e.sons[1].typ); - a := InitLocExpr(p, e.sons[1]); - f := InitLocExpr(p, e.sons[2]); - b := initLoc(locExpr, a.t, OnHeap); + InitLocExpr(p, e.sons[1], a); + InitLocExpr(p, e.sons[2], f); + initLoc(b, locExpr, a.t, OnHeap); ti := genTypeInfo(p.module, refType); appf(p.module.s[cfsTypeInit3], '$1->finalizer = (void*)$2;$n', [ ti, rdLoc(f)]); @@ -1139,13 +1308,7 @@ begin genAssignment(p, a, b, {@set}[]); // set the object type: bt := skipGenericRange(refType.sons[0]); - if containsObject(bt) then begin - useMagic(p.module, 'objectInit'); - appf(p.s[cpsStmts], 'objectInit($1, $2);$n', - [rdLoc(a), genTypeInfo(p.module, bt)]) - end; - freeTemp(p, a); - freeTemp(p, f) + genObjectInit(p, bt, a, false); end; procedure genRepr(p: BProc; e: PNode; var d: TLoc); @@ -1153,7 +1316,7 @@ var a: TLoc; t: PType; begin - a := InitLocExpr(p, e.sons[1]); + InitLocExpr(p, e.sons[1], a); t := skipVarGenericRange(e.sons[1].typ); case t.kind of tyInt..tyInt64: begin @@ -1192,7 +1355,7 @@ begin tyOpenArray: putIntoDest(p, d, e.typ, ropef('$1, $1Len0', [rdLoc(a)])); tyString, tySequence: - putIntoDest(p, d, e.typ, ropef('$1->data, $1->len', [rdLoc(a)])); + putIntoDest(p, d, e.typ, ropef('$1->data, $1->Sup.len', [rdLoc(a)])); tyArray, tyArrayConstr: putIntoDest(p, d, e.typ, ropef('$1, $2', [rdLoc(a), toRope(lengthOrd(a.t))])); @@ -1221,9 +1384,11 @@ procedure genDollar(p: BProc; n: PNode; var d: TLoc; const magic, frmt: string); var a: TLoc; begin - a := InitLocExpr(p, n.sons[1]); + InitLocExpr(p, n.sons[1], a); UseMagic(p.module, magic); - putIntoDest(p, d, n.typ, ropef(frmt, [rdLoc(a)])) + a.r := ropef(frmt, [rdLoc(a)]); + if d.k = locNone then getTemp(p, n.typ, d); + genAssignment(p, d, a, {@set}[]); end; procedure genArrayLen(p: BProc; e: PNode; var d: TLoc; op: TMagic); @@ -1238,13 +1403,18 @@ begin if op = mHigh then unaryExpr(p, e, d, '', '($1Len0-1)') else - unaryExpr(p, e, d, '', '$1Len0/*len*/'); + unaryExpr(p, e, d, '', '$1Len0'); end; + tyCstring: + if op = mHigh then + unaryExpr(p, e, d, '', '(strlen($1)-1)') + else + unaryExpr(p, e, d, '', 'strlen($1)'); tyString, tySequence: if op = mHigh then - unaryExpr(p, e, d, '', '($1->len-1)') + unaryExpr(p, e, d, '', '($1->Sup.len-1)') else - unaryExpr(p, e, d, '', '$1->len'); + unaryExpr(p, e, d, '', '$1->Sup.len'); tyArray, tyArrayConstr: begin // YYY: length(sideeffect) is optimized away incorrectly? if op = mHigh then @@ -1264,11 +1434,11 @@ var begin assert(d.k = locNone); useMagic(p.module, 'setLengthSeq'); - a := InitLocExpr(p, e.sons[1]); - b := InitLocExpr(p, e.sons[2]); + InitLocExpr(p, e.sons[1], a); + InitLocExpr(p, e.sons[2], b); t := skipVarGeneric(e.sons[1].typ); appf(p.s[cpsStmts], - '$1 = ($3) setLengthSeq((TGenericSeq*) ($1), sizeof($4), $2);$n', + '$1 = ($3) setLengthSeq(&($1)->Sup, sizeof($4), $2);$n', [rdLoc(a), rdLoc(b), getTypeDesc(p.module, t), getTypeDesc(p.module, t.sons[0])]); freeTemp(p, a); @@ -1288,9 +1458,9 @@ procedure genSwap(p: BProc; e: PNode; var d: TLoc); var a, b, tmp: TLoc; begin - tmp := getTemp(p, skipVarGeneric(e.sons[1].typ)); - a := InitLocExpr(p, e.sons[1]); // eval a - b := InitLocExpr(p, e.sons[2]); // eval b + getTemp(p, skipVarGeneric(e.sons[1].typ), tmp); + InitLocExpr(p, e.sons[1], a); // eval a + InitLocExpr(p, e.sons[2], b); // eval b genAssignment(p, tmp, a, {@set}[]); genAssignment(p, a, b, {@set}[]); genAssignment(p, b, tmp, {@set}[]); @@ -1348,8 +1518,8 @@ var a, b: TLoc; begin assert(d.k = locNone); - a := InitLocExpr(p, e.sons[1]); - b := InitLocExpr(p, e.sons[2]); + InitLocExpr(p, e.sons[1], a); + InitLocExpr(p, e.sons[2], b); appf(p.s[cpsStmts], frmt, [rdLoc(a), rdSetElemLoc(b, a.t)]); freeTemp(p, a); freeTemp(p, b) @@ -1364,22 +1534,22 @@ begin if (e.sons[1].Kind = nkCurly) and fewCmps(e.sons[1]) then begin // a set constructor but not a constant set: // do not emit the set, but generate a bunch of comparisons - a := initLocExpr(p, e.sons[2]); - b := initLoc(locExpr, e.typ, OnUnknown); + initLocExpr(p, e.sons[2], a); + initLoc(b, locExpr, e.typ, OnUnknown); b.r := toRope('('+''); len := sonsLen(e.sons[1]); - {@emit c := [];} + {@emit c := @[];} for i := 0 to len-1 do begin if e.sons[1].sons[i].Kind = nkRange then begin setLength(c, length(c)+2); - c[high(c)-1] := InitLocExpr(p, e.sons[1].sons[i].sons[0]); - c[high(c)] := InitLocExpr(p, e.sons[1].sons[i].sons[1]); + InitLocExpr(p, e.sons[1].sons[i].sons[0], c[high(c)-1]); + InitLocExpr(p, e.sons[1].sons[i].sons[1], c[high(c)]); appf(b.r, '$1 >= $2 && $1 <= $3', [rdCharLoc(a), rdCharLoc(c[high(c)-1]), rdCharLoc(c[high(c)])]) end else begin setLength(c, length(c)+1); - c[high(c)] := InitLocExpr(p, e.sons[1].sons[i]); + InitLocExpr(p, e.sons[1].sons[i], c[high(c)]); appf(b.r, '$1 == $2', [rdCharLoc(a), rdCharLoc(c[high(c)])]) end; if i < len - 1 then @@ -1395,8 +1565,8 @@ begin else begin assert(e.sons[1].typ <> nil); assert(e.sons[2].typ <> nil); - a := InitLocExpr(p, e.sons[1]); - b := InitLocExpr(p, e.sons[2]); + InitLocExpr(p, e.sons[1], a); + InitLocExpr(p, e.sons[2], b); genInExprAux(p, e, a, b, d); end end; @@ -1459,11 +1629,10 @@ begin mCard: unaryExprChar(p, e, d, 'countBitsVar', 'countBitsVar($1, ' + ToString(size) + ')'); mLtSet, mLeSet: begin - i := getTemp(p, getSysType(tyInt)); // our counter - a := initLocExpr(p, e.sons[1]); - b := initLocExpr(p, e.sons[2]); - if d.k = locNone then - d := getTemp(p, a.t); + getTemp(p, getSysType(tyInt), i); // our counter + initLocExpr(p, e.sons[1], a); + initLocExpr(p, e.sons[2], b); + if d.k = locNone then getTemp(p, a.t, d); appf(p.s[cpsStmts], lookupOpr[op], [rdLoc(i), toRope(size), rdLoc(d), rdLoc(a), rdLoc(b)]); freeTemp(p, a); @@ -1475,11 +1644,10 @@ begin '(memcmp($1, $2, ' + ToString(size) + ')==0)'); mMulSet, mPlusSet, mMinusSet, mSymDiffSet: begin // we inline the simple for loop for better code generation: - i := getTemp(p, getSysType(tyInt)); // our counter - a := initLocExpr(p, e.sons[1]); - b := initLocExpr(p, e.sons[2]); - if d.k = locNone then - d := getTemp(p, a.t); + getTemp(p, getSysType(tyInt), i); // our counter + initLocExpr(p, e.sons[1], a); + initLocExpr(p, e.sons[2], b); + if d.k = locNone then getTemp(p, a.t, d); appf(p.s[cpsStmts], 'for ($1 = 0; $1 < $2; $1++) $n' + ' $3[$1] = $4[$1] $6 $5[$1];$n', [rdLoc(i), toRope(size), @@ -1510,7 +1678,7 @@ const var a: TLoc; begin - a := InitLocExpr(p, e.sons[1]); + InitLocExpr(p, e.sons[1], a); if (skipGenericRange(e.typ).kind in ValueTypes) and not (lfIndirect in a.flags) then putIntoDest(p, d, e.typ, ropef('(*($1*) ($2))', @@ -1528,12 +1696,12 @@ var begin dest := skipVarGeneric(n.typ); if not (optRangeCheck in p.options) then begin - a := InitLocExpr(p, n.sons[0]); + InitLocExpr(p, n.sons[0], a); putIntoDest(p, d, n.typ, ropef('(($1) ($2))', [getTypeDesc(p.module, dest), rdCharLoc(a)])); end else begin - a := InitLocExpr(p, n.sons[0]); + InitLocExpr(p, n.sons[0], a); useMagic(p.module, magic); putIntoDest(p, d, dest, ropef('(($1)' +{&} magic +{&} '($2, $3, $4))', @@ -1555,16 +1723,16 @@ var dest: PType; begin dest := skipVarGeneric(n.typ); - a := initLocExpr(p, n.sons[0]); - case a.t.kind of + initLocExpr(p, n.sons[0], a); + case skipVarGeneric(a.t).kind of tyOpenArray: putIntoDest(p, d, dest, ropef('$1, $1Len0', [rdLoc(a)])); tyString, tySequence: - putIntoDest(p, d, dest, ropef('$1->data, $1->len', [rdLoc(a)])); + putIntoDest(p, d, dest, ropef('$1->data, $1->Sup.len', [rdLoc(a)])); tyArray, tyArrayConstr: putIntoDest(p, d, dest, ropef('$1, $2', [rdLoc(a), toRope(lengthOrd(a.t))])); - else InternalError(n.sons[0].info, 'passToOpenArray()') + else InternalError(n.sons[0].info, 'passToOpenArray: ' + typeToString(a.t)) end; if d.k <> locExpr then freeTemp(p, a) end; @@ -1573,7 +1741,7 @@ procedure convStrToCStr(p: BProc; n: PNode; var d: TLoc); var a: TLoc; begin - a := initLocExpr(p, n.sons[0]); + initLocExpr(p, n.sons[0], a); putIntoDest(p, d, skipVarGeneric(n.typ), ropef('$1->data', [rdLoc(a)])); if d.k <> locExpr then freeTemp(p, a) end; @@ -1583,12 +1751,85 @@ var a: TLoc; begin useMagic(p.module, 'cstrToNimstr'); - a := initLocExpr(p, n.sons[0]); + initLocExpr(p, n.sons[0], a); putIntoDest(p, d, skipVarGeneric(n.typ), ropef('cstrToNimstr($1)', [rdLoc(a)])); if d.k <> locExpr then freeTemp(p, a) end; +procedure genStrEquals(p: BProc; e: PNode; var d: TLoc); +var + a, b: PNode; + x: TLoc; +begin + a := e.sons[1]; + b := e.sons[2]; + if (a.kind = nkNilLit) or (b.kind = nkNilLit) then + binaryExpr(p, e, d, '', '($1 == $2)') + else if (a.kind in [nkStrLit..nkTripleStrLit]) and (a.strVal = '') then begin + initLocExpr(p, e.sons[2], x); + putIntoDest(p, d, e.typ, ropef('(($1) && ($1)->Sup.len == 0)', [rdLoc(x)])); + end + else if (b.kind in [nkStrLit..nkTripleStrLit]) and (b.strVal = '') then begin + initLocExpr(p, e.sons[1], x); + putIntoDest(p, d, e.typ, ropef('(($1) && ($1)->Sup.len == 0)', [rdLoc(x)])); + end + else + binaryExpr(p, e, d, 'eqStrings', 'eqStrings($1, $2)'); +end; + +procedure genSeqConstr(p: BProc; t: PNode; var d: TLoc); +var + newSeq, arr: TLoc; + i: int; +begin + useMagic(p.module, 'newSeq'); + if d.k = locNone then getTemp(p, t.typ, d); + // generate call to newSeq before adding the elements per hand: + + initLoc(newSeq, locExpr, t.typ, OnHeap); + newSeq.r := ropef('($1) newSeq($2, $3)', + [getTypeDesc(p.module, t.typ), + genTypeInfo(p.module, t.typ), intLiteral(sonsLen(t))]); + genAssignment(p, d, newSeq, {@set}[afSrcIsNotNil]); + for i := 0 to sonsLen(t)-1 do begin + initLoc(arr, locExpr, elemType(skipGeneric(t.typ)), OnHeap); + arr.r := ropef('$1->data[$2]', [rdLoc(d), intLiteral(i)]); + arr.s := OnHeap; // we know that sequences are on the heap + expr(p, t.sons[i], arr) + end +end; + +procedure genArrToSeq(p: BProc; t: PNode; var d: TLoc); +var + newSeq, elem, a, arr: TLoc; + L, i: int; +begin + if t.kind = nkBracket then begin + t.sons[1].typ := t.typ; + genSeqConstr(p, t.sons[1], d); + exit + end; + useMagic(p.module, 'newSeq'); + if d.k = locNone then getTemp(p, t.typ, d); + // generate call to newSeq before adding the elements per hand: + L := int(lengthOrd(t.sons[1].typ)); + initLoc(newSeq, locExpr, t.typ, OnHeap); + newSeq.r := ropef('($1) newSeq($2, $3)', + [getTypeDesc(p.module, t.typ), + genTypeInfo(p.module, t.typ), intLiteral(L)]); + genAssignment(p, d, newSeq, {@set}[afSrcIsNotNil]); + initLocExpr(p, t.sons[1], a); + for i := 0 to L-1 do begin + initLoc(elem, locExpr, elemType(skipGeneric(t.typ)), OnHeap); + elem.r := ropef('$1->data[$2]', [rdLoc(d), intLiteral(i)]); + elem.s := OnHeap; // we know that sequences are on the heap + initLoc(arr, locExpr, elemType(skipGeneric(t.sons[1].typ)), a.s); + arr.r := ropef('$1[$2]', [rdLoc(a), intLiteral(i)]); + genAssignment(p, elem, arr, {@set}[afDestIsNil, needToCopy]); + end +end; + procedure genMagicExpr(p: BProc; e: PNode; var d: TLoc; op: TMagic); var a: TLoc; @@ -1602,7 +1843,7 @@ begin mAddi..mModi64: binaryArithOverflow(p, e, d, op); mRepr: genRepr(p, e, d); mAsgn: begin - a := InitLocExpr(p, e.sons[1]); + InitLocExpr(p, e.sons[1], a); assert(a.t <> nil); expr(p, e.sons[2], a); freeTemp(p, a) @@ -1616,7 +1857,7 @@ begin end; mSucc: begin // XXX: range checking? if not (optOverflowCheck in p.Options) then - binaryExpr(p, e, d, '', '$1 - $2') + binaryExpr(p, e, d, '', '$1 + $2') else binaryExpr(p, e, d, 'addInt', 'addInt($1, $2)') end; @@ -1624,7 +1865,7 @@ begin mAppendStrCh: binaryStmt(p, e, d, 'addChar', '$1 = addChar($1, $2);$n'); mAppendStrStr: genStrAppend(p, e, d); mAppendSeqElem: genSeqElemAppend(p, e, d); - mEqStr: binaryExpr(p, e, d, 'eqStrings', 'eqStrings($1, $2)'); + mEqStr: genStrEquals(p, e, d); mLeStr: binaryExpr(p, e, d, 'cmpStrings', '(cmpStrings($1, $2) <= 0)'); mLtStr: binaryExpr(p, e, d, 'cmpStrings', '(cmpStrings($1, $2) < 0)'); mIsNil: unaryExpr(p, e, d, '', '$1 == 0'); @@ -1645,11 +1886,13 @@ begin [filen, line, rdLoc(d)]) end end; + mIs: genIs(p, e, d); mNew: genNew(p, e); mNewFinalize: genNewFinalize(p, e); + mNewSeq: genNewSeq(p, e); mSizeOf: putIntoDest(p, d, e.typ, - ropef('sizeof($1)', [getTypeDesc(p.module, e.sons[1].typ)])); + ropef('((NI)sizeof($1))', [getTypeDesc(p.module, e.sons[1].typ)])); mChr: genCast(p, e, d); // expr(p, e.sons[1], d); mOrd: genOrd(p, e, d); mLengthArray, mHigh, mLengthStr, mLengthSeq, mLengthOpenArray: @@ -1670,17 +1913,45 @@ begin else binaryStmt(p, e, d, 'subInt', '$1 = subInt($1, $2);$n') end; + mGCref: unaryStmt(p, e, d, 'nimGCref', 'nimGCref($1);$n'); + mGCunref: unaryStmt(p, e, d, 'nimGCunref', 'nimGCunref($1);$n'); mSetLengthStr: genSetLengthStr(p, e, d); mSetLengthSeq: genSetLengthSeq(p, e, d); mIncl, mExcl, mCard, mLtSet, mLeSet, mEqSet, mMulSet, mPlusSet, mMinusSet, mInSet: genSetOp(p, e, d, op); mExit: genCall(p, e, d); + mArrToSeq: genArrToSeq(p, e, d); mNLen..mNError: liMessage(e.info, errCannotGenerateCodeForX, e.sons[0].sym.name.s); else internalError(e.info, 'genMagicExpr: ' + magicToStr[op]); end end; +function genConstExpr(p: BProc; n: PNode): PRope; forward; + +function handleConstExpr(p: BProc; n: PNode; var d: TLoc): bool; +var + id: int; + t: PType; +begin + if (nfAllConst in n.flags) and (d.k = locNone) + and (sonsLen(n) > 0) then begin + t := getUniqueType(n.typ); + {@discard} getTypeDesc(p.module, t); // so that any fields are initialized + id := NodeTableTestOrSet(p.module.dataCache, n, gid); + fillLoc(d, locData, t, con('TMP', toRope(id)), OnHeap); + if id = gid then begin + // expression not found in the cache: + inc(gid); + appf(p.module.s[cfsData], 'NIM_CONST $1 $2 = $3;$n', + [getTypeDesc(p.module, t), d.r, genConstExpr(p, n)]); + end; + result := true + end + else + result := false +end; + procedure genSetConstr(p: BProc; e: PNode; var d: TLoc); // example: { a..b, c, d, e, f..g } // we have to emit an expression of the form: @@ -1694,14 +1965,14 @@ begin if nfAllConst in e.flags then putIntoDest(p, d, e.typ, genSetNode(p, e)) else begin - if d.k = locNone then d := getTemp(p, e.typ); + if d.k = locNone then getTemp(p, e.typ, d); if getSize(e.typ) > 8 then begin // big set: appf(p.s[cpsStmts], 'memset($1, 0, sizeof($1));$n', [rdLoc(d)]); for i := 0 to sonsLen(e)-1 do begin if e.sons[i].kind = nkRange then begin - idx := getTemp(p, getSysType(tyInt)); // our counter - a := initLocExpr(p, e.sons[i].sons[1]); - b := initLocExpr(p, e.sons[i].sons[2]); + getTemp(p, getSysType(tyInt), idx); // our counter + initLocExpr(p, e.sons[i].sons[0], a); + initLocExpr(p, e.sons[i].sons[1], b); appf(p.s[cpsStmts], 'for ($1 = $3; $1 <= $4; $1++) $n' + '$2[$1/8] |=(1<<($1%8));$n', @@ -1712,7 +1983,7 @@ begin freeTemp(p, idx) end else begin - a := initLocExpr(p, e.sons[i]); + initLocExpr(p, e.sons[i], a); appf(p.s[cpsStmts], '$1[$2/8] |=(1<<($2%8));$n', [rdLoc(d), rdSetElemLoc(a, e.typ)]); freeTemp(p, a) @@ -1724,9 +1995,9 @@ begin appf(p.s[cpsStmts], '$1 = 0;$n', [rdLoc(d)]); for i := 0 to sonsLen(e) - 1 do begin if e.sons[i].kind = nkRange then begin - idx := getTemp(p, getSysType(tyInt)); // our counter - a := initLocExpr(p, e.sons[i].sons[1]); - b := initLocExpr(p, e.sons[i].sons[2]); + getTemp(p, getSysType(tyInt), idx); // our counter + initLocExpr(p, e.sons[i].sons[0], a); + initLocExpr(p, e.sons[i].sons[1], b); appf(p.s[cpsStmts], 'for ($1 = $3; $1 <= $4; $1++) $n' +{&} '$2 |=(1<<((' +{&} ts +{&} ')($1)%(sizeof(' +{&}ts+{&}')*8)));$n', @@ -1737,7 +2008,7 @@ begin freeTemp(p, idx) end else begin - a := initLocExpr(p, e.sons[i]); + initLocExpr(p, e.sons[i], a); appf(p.s[cpsStmts], '$1 |=(1<<((' +{&} ts +{&} ')($2)%(sizeof(' +{&}ts+{&} ')*8)));$n', @@ -1758,20 +2029,22 @@ var begin // the code generator assumes that there are only tuple constructors with // field names! - t := getUniqueType(n.typ); - {@discard} getTypeDesc(p.module, t); // so that any fields are initialized - if d.k = locNone then d := getTemp(p, t); - if t.n = nil then InternalError(n.info, 'genTupleConstr'); - if sonsLen(t.n) <> sonsLen(n) then - InternalError(n.info, 'genTupleConstr'); - for i := 0 to sonsLen(n)-1 do begin - it := n.sons[i]; - if it.kind <> nkExprColonExpr then InternalError(n.info, 'genTupleConstr'); - rec := initLoc(locExpr, it.sons[1].typ, d.s); - if (t.n.sons[i].kind <> nkSym) then + if not handleConstExpr(p, n, d) then begin + t := getUniqueType(n.typ); + {@discard} getTypeDesc(p.module, t); // so that any fields are initialized + if d.k = locNone then getTemp(p, t, d); + if t.n = nil then InternalError(n.info, 'genTupleConstr'); + if sonsLen(t.n) <> sonsLen(n) then InternalError(n.info, 'genTupleConstr'); - rec.r := ropef('$1.$2', [rdLoc(d), mangleRecFieldName(t.n.sons[i].sym, t)]); - expr(p, it.sons[1], rec); + for i := 0 to sonsLen(n)-1 do begin + it := n.sons[i]; + if it.kind <> nkExprColonExpr then InternalError(n.info, 'genTupleConstr'); + initLoc(rec, locExpr, it.sons[1].typ, d.s); + if (t.n.sons[i].kind <> nkSym) then + InternalError(n.info, 'genTupleConstr'); + rec.r := ropef('$1.$2', [rdLoc(d), mangleRecFieldName(t.n.sons[i].sym, t)]); + expr(p, it.sons[1], rec); + end end end; @@ -1780,34 +2053,13 @@ var arr: TLoc; i: int; begin - if d.k = locNone then d := getTemp(p, n.typ); - for i := 0 to sonsLen(n)-1 do begin - arr := initLoc(locExpr, elemType(skipGeneric(n.typ)), d.s); - arr.r := ropef('$1[$2]', [rdLoc(d), intLiteral(i)]); - expr(p, n.sons[i], arr) - end -end; - -procedure genSeqConstr(p: BProc; t: PNode; var d: TLoc); -var - newSeq, arr: TLoc; - i: int; -begin - useMagic(p.module, 'newSeq'); - if d.k = locNone then - d := getTemp(p, t.typ); - // generate call to newSeq before adding the elements per hand: - - newSeq := initLoc(locExpr, t.typ, OnHeap); - newSeq.r := ropef('($1) newSeq($2, $3)', - [getTypeDesc(p.module, t.typ), - genTypeInfo(p.module, t.typ), toRope(sonsLen(t))]); - genAssignment(p, d, newSeq, {@set}[]); - for i := 0 to sonsLen(t)-1 do begin - arr := initLoc(locExpr, elemType(skipGeneric(t.typ)), OnHeap); - arr.r := ropef('$1->data[$2]', [rdLoc(d), intLiteral(i)]); - arr.s := OnHeap; // we know that sequences are on the heap - expr(p, t.sons[i], arr) + if not handleConstExpr(p, n, d) then begin + if d.k = locNone then getTemp(p, n.typ, d); + for i := 0 to sonsLen(n)-1 do begin + initLoc(arr, locExpr, elemType(skipGeneric(n.typ)), d.s); + arr.r := ropef('$1[$2]', [rdLoc(d), intLiteral(i)]); + expr(p, n.sons[i], arr) + end end end; @@ -1833,7 +2085,7 @@ var dest, t: PType; r, nilCheck: PRope; begin - a := initLocExpr(p, n.sons[0]); + initLocExpr(p, n.sons[0], a); dest := skipPtrsGeneric(n.typ); if (optObjCheck in p.options) and not (isPureObject(dest)) then begin useMagic(p.module, 'chckObj'); @@ -1877,7 +2129,7 @@ begin else begin dest := skipPtrsGeneric(n.typ); src := skipPtrsGeneric(n.sons[0].typ); - a := initLocExpr(p, n.sons[0]); + initLocExpr(p, n.sons[0], a); r := rdLoc(a); if skipGeneric(n.sons[0].typ).kind in [tyRef, tyPtr, tyVar] then begin app(r, '->Sup'); @@ -1941,7 +2193,7 @@ begin putIntoDest(p, d, e.typ, genLiteral(p, e)); d.k := locImmediate // for removal of index checks end; - nkCall, nkHiddenCallConv: begin + nkCall, nkHiddenCallConv, nkInfix, nkPrefix, nkPostfix, nkCommand: begin if (e.sons[0].kind = nkSym) and (e.sons[0].sym.magic <> mNone) then genMagicExpr(p, e, d, e.sons[0].sym.magic) @@ -2017,8 +2269,6 @@ begin end; end; -function genConstExpr(p: BProc; n: PNode): PRope; forward; - function genConstSimpleList(p: BProc; n: PNode): PRope; var len, i: int; diff --git a/nim/ccgstmts.pas b/nim/ccgstmts.pas index a59ef42d2..b00751edd 100644 --- a/nim/ccgstmts.pas +++ b/nim/ccgstmts.pas @@ -48,25 +48,16 @@ begin app(p.s[cpsStmts], 'goto BeforeRet;' + tnl) end; -procedure genObjectInit(p: BProc; sym: PSym); -begin - if containsObject(sym.typ) then begin - useMagic(p.module, 'objectInit'); - appf(p.s[cpsInit], 'objectInit($1, $2);$n', - [addrLoc(sym.loc), genTypeInfo(p.module, sym.typ)]) - end -end; - procedure initVariable(p: BProc; v: PSym); begin if containsGarbageCollectedRef(v.typ) or (v.ast = nil) then // Language change: always initialize variables if v.ast == nil! if not (skipVarGenericRange(v.typ).Kind in [tyArray, tyArrayConstr, tySet, tyTuple, tyObject]) then - appf(p.s[cpsStmts], '$1 = 0;$n', [v.loc.r]) + appf(p.s[cpsStmts], '$1 = 0;$n', [rdLoc(v.loc)]) else - appf(p.s[cpsStmts], 'memset((void*)&$1, 0, sizeof($1));$n', - [v.loc.r]) + appf(p.s[cpsStmts], 'memset((void*)$1, 0, sizeof($2));$n', + [addrLoc(v.loc), rdLoc(v.loc)]) end; procedure genVarStmt(p: BProc; n: PNode); @@ -93,7 +84,7 @@ begin genLineDir(p, a); expr(p, a.sons[2], v.loc); end; - genObjectInit(p, v); // XXX: correct position? + genObjectInit(p, v.typ, v.loc, true); // correct position end end; @@ -147,7 +138,7 @@ begin it := n.sons[i]; case it.kind of nkElifBranch: begin - a := initLocExpr(p, it.sons[0]); + initLocExpr(p, it.sons[0], a); Lelse := getLabel(p); appf(p.s[cpsStmts], 'if (!$1) goto $2;$n', [rdLoc(a), Lelse]); freeTemp(p, a); @@ -177,17 +168,23 @@ begin genLineDir(p, t); assert(sonsLen(t) = 2); inc(p.labels); - Labl := con('L'+'', toRope(p.labels)); + Labl := con('LA', toRope(p.labels)); len := length(p.blocks); setLength(p.blocks, len+1); - p.blocks[len].id := p.labels; // positive because we use it right away: + p.blocks[len].id := -p.labels; // negative because it isn't used yet p.blocks[len].nestedTryStmts := p.nestedTryStmts; app(p.s[cpsStmts], 'while (1) {' + tnl); - a := initLocExpr(p, t.sons[0]); - appf(p.s[cpsStmts], 'if (!$1) goto $2;$n', [rdLoc(a), Labl]); + initLocExpr(p, t.sons[0], a); + if (t.sons[0].kind <> nkIntLit) or (t.sons[0].intVal = 0) then begin + p.blocks[len].id := abs(p.blocks[len].id); + appf(p.s[cpsStmts], 'if (!$1) goto $2;$n', [rdLoc(a), Labl]); + end; freeTemp(p, a); genStmts(p, t.sons[1]); - appf(p.s[cpsStmts], '} $1: ;$n', [Labl]); + if p.blocks[len].id > 0 then + appf(p.s[cpsStmts], '} $1: ;$n', [Labl]) + else + app(p.s[cpsStmts], '}'+tnl); setLength(p.blocks, length(p.blocks)-1) end; @@ -210,7 +207,7 @@ begin if t.kind = nkBlockExpr then genStmtListExpr(p, t.sons[1], d) else genStmts(p, t.sons[1]); if p.blocks[idx].id > 0 then // label has been used: - appf(p.s[cpsStmts], 'L$1: ;$n', [toRope(p.blocks[idx].id)]); + appf(p.s[cpsStmts], 'LA$1: ;$n', [toRope(p.blocks[idx].id)]); setLength(p.blocks, idx) end; @@ -236,7 +233,7 @@ begin end; p.blocks[idx].id := abs(p.blocks[idx].id); // label is used finishTryStmt(p, p.nestedTryStmts - p.blocks[idx].nestedTryStmts); - appf(p.s[cpsStmts], 'goto L$1;$n', [toRope(p.blocks[idx].id)]) + appf(p.s[cpsStmts], 'goto LA$1;$n', [toRope(p.blocks[idx].id)]) end; procedure genAsmStmt(p: BProc; t: PNode); @@ -287,7 +284,7 @@ begin genLineDir(p, t); if t.sons[0] <> nil then begin if gCmd <> cmdCompileToCpp then useMagic(p.module, 'raiseException'); - a := InitLocExpr(p, t.sons[0]); + InitLocExpr(p, t.sons[0], a); e := rdLoc(a); freeTemp(p, a); typ := t.sons[0].typ; @@ -324,15 +321,15 @@ begin len := sonsLen(b); for i := 0 to len - 2 do begin if b.sons[i].kind = nkRange then begin - x := initLocExpr(p, b.sons[i].sons[0]); - y := initLocExpr(p, b.sons[i].sons[1]); + initLocExpr(p, b.sons[i].sons[0], x); + initLocExpr(p, b.sons[i].sons[1], y); freeTemp(p, x); freeTemp(p, y); appf(p.s[cpsStmts], rangeFormat, [rdCharLoc(e), rdCharLoc(x), rdCharLoc(y), labl]) end else begin - x := initLocExpr(p, b.sons[i]); + initLocExpr(p, b.sons[i], x); freeTemp(p, x); appf(p.s[cpsStmts], eqFormat, [rdCharLoc(e), rdCharLoc(x), labl]) @@ -347,7 +344,7 @@ var begin Lend := getLabel(p); for i := 1 to sonsLen(t) - 1 do begin - appf(p.s[cpsStmts], 'L$1: ;$n', [toRope(labId+i)]); + appf(p.s[cpsStmts], 'LA$1: ;$n', [toRope(labId+i)]); if t.sons[i].kind = nkOfBranch then begin len := sonsLen(t.sons[i]); genStmts(p, t.sons[i].sons[len-1]); @@ -366,17 +363,17 @@ var a: TLoc; i, labId: int; begin - a := initLocExpr(p, t.sons[0]); + initLocExpr(p, t.sons[0], a); // fist pass: gnerate ifs+goto: labId := p.labels; for i := 1 to sonsLen(t) - 1 do begin inc(p.labels); if t.sons[i].kind = nkOfBranch then genCaseGenericBranch(p, t.sons[i], a, rangeFormat, eqFormat, - con('L'+'', toRope(p.labels))) + con('LA', toRope(p.labels))) else // else statement - appf(p.s[cpsStmts], 'goto L$1;$n', [toRope(p.labels)]); + appf(p.s[cpsStmts], 'goto LA$1;$n', [toRope(p.labels)]); end; // second pass: generate statements genCaseSecondPass(p, t, labId); @@ -416,13 +413,13 @@ begin else begin a := 0; for i := 0 to Length(s)-1 do begin - a := a +{%} Ord(s[i]); - a := a +{%} a shl 10; - a := a xor (a shr 6); + a := a +{%} int32(Ord(s[i])); + a := a +{%} a shl int32(10); + a := a xor (a shr int32(6)); end; - a := a +{%} a shl 3; - a := a xor (a shr 11); - a := a +{%} a shl 15; + a := a +{%} a shl int32(3); + a := a xor (a shr int32(11)); + a := a +{%} a shl int32(15); result := a end end; @@ -450,7 +447,7 @@ begin len := sonsLen(b); for i := 0 to len - 2 do begin assert(b.sons[i].kind <> nkRange); - x := initLocExpr(p, b.sons[i]); + initLocExpr(p, b.sons[i], x); freeTemp(p, x); assert(b.sons[i].kind in [nkStrLit..nkTripleStrLit]); j := int(hashString(b.sons[i].strVal) and high(branches)); @@ -473,14 +470,16 @@ begin if strings > stringCaseThreshold then begin useMagic(p.module, 'hashString'); bitMask := nmath.nextPowerOfTwo(strings)-1; + {@ignore} setLength(branches, bitMask+1); - a := initLocExpr(p, t.sons[0]); + {@emit newSeq(branches, bitMask+1);} + initLocExpr(p, t.sons[0], a); // fist pass: gnerate ifs+goto: labId := p.labels; for i := 1 to sonsLen(t) - 1 do begin inc(p.labels); if t.sons[i].kind = nkOfBranch then - genCaseStringBranch(p, t.sons[i], a, con('L'+'', toRope(p.labels)), + genCaseStringBranch(p, t.sons[i], a, con('LA', toRope(p.labels)), branches) else begin // else statement: nothing to do yet @@ -497,7 +496,7 @@ begin app(p.s[cpsStmts], '}' + tnl); // else statement: if t.sons[sonsLen(t)-1].kind <> nkOfBranch then - appf(p.s[cpsStmts], 'goto L$1;$n', [toRope(p.labels)]); + appf(p.s[cpsStmts], 'goto LA$1;$n', [toRope(p.labels)]); // third pass: generate statements genCaseSecondPass(p, t, labId); freeTemp(p, a); @@ -540,7 +539,7 @@ begin break end; if canGenerateSwitch then begin - a := initLocExpr(p, t.sons[0]); + initLocExpr(p, t.sons[0], a); appf(p.s[cpsStmts], 'switch ($1) {$n', [rdCharLoc(a)]); freeTemp(p, a); for i := 1 to sonsLen(t)-1 do begin @@ -821,7 +820,7 @@ var a: TLoc; begin genLineDir(p, e); // BUGFIX - a := InitLocExpr(p, e.sons[0]); + InitLocExpr(p, e.sons[0], a); assert(a.t <> nil); expr(p, e.sons[1], a); freeTemp(p, a) @@ -837,10 +836,10 @@ begin if inCheckpoint(t.info) then MessageOut(renderTree(t)); case t.kind of - nkEmpty: begin end; // nothing to do! - nkStmtList: - for i := 0 to sonsLen(t) - 1 do - genStmts(p, t.sons[i]); + nkEmpty: begin end; // nothing to do! + nkStmtList: begin + for i := 0 to sonsLen(t)-1 do genStmts(p, t.sons[i]); + end; nkBlockStmt: genBlock(p, t, a); nkIfStmt: genIfStmt(p, t); nkWhileStmt: genWhileStmt(p, t); @@ -852,23 +851,25 @@ begin nkBreakStmt: genBreakStmt(p, t); nkCall: begin genLineDir(p, t); - a := initLocExpr(p, t); + initLocExpr(p, t, a); freeTemp(p, a); end; nkAsgn: genAsgn(p, t); nkDiscardStmt: begin genLineDir(p, t); - a := initLocExpr(p, t.sons[0]); + initLocExpr(p, t.sons[0], a); freeTemp(p, a) end; nkAsmStmt: genAsmStmt(p, t); - nkTryStmt: + nkTryStmt: begin if gCmd = cmdCompileToCpp then genTryStmtCpp(p, t) else genTryStmt(p, t); + end; nkRaiseStmt: genRaiseStmt(p, t); nkTypeSection: begin - // nothing to do: - // we generate only when the symbol is accessed + // we have to emit the type information for object types here to support + // seperate compilation: + genTypeSection(p.module, t); end; nkCommentStmt, nkNilLit, nkIteratorDef, nkIncludeStmt, nkImportStmt, nkFromStmt, nkTemplateDef, nkMacroDef: begin end; diff --git a/nim/ccgtypes.pas b/nim/ccgtypes.pas index 329d9f60c..2c238ce84 100644 --- a/nim/ccgtypes.pas +++ b/nim/ccgtypes.pas @@ -7,16 +7,27 @@ // distribution, for details about the copyright. // +//var +// newDummyVar: int; // just to check the rodgen mechanism + // ------------------------- Name Mangling -------------------------------- function mangle(const name: string): string; var i: int; begin - if name[strStart] in ['A'..'Z', '0'..'9', 'a'..'z'] then - result := toUpper(name[strStart])+'' - else - result := 'HEX' + toHex(ord(name[strStart]), 2); + case name[strStart] of + 'a'..'z': begin + result := ''; + addChar(result, chr(ord(name[strStart]) - ord('a') + ord('A'))); + end; + '0'..'9', 'A'..'Z': begin + result := ''; + addChar(result, name[strStart]); + end; + else + result := 'HEX' + toHex(ord(name[strStart]), 2); + end; for i := strStart+1 to length(name) + strStart-1 do begin case name[i] of 'A'..'Z': addChar(result, chr(ord(name[i]) - ord('A') + ord('a'))); @@ -29,11 +40,28 @@ end; function mangleName(s: PSym): PRope; begin - result := ropef('$1_$2', [toRope(mangle(s.name.s)), toRope(s.id)]); - if optGenMapping in gGlobalOptions then - if s.owner <> nil then - appf(gMapping, '$1.$2 $3$n', - [toRope(s.owner.Name.s), toRope(s.name.s), result]) + result := s.loc.r; + if result = nil then begin + result := toRope(mangle(s.name.s)); + app(result, '_'+''); + app(result, toRope(s.id)); + if optGenMapping in gGlobalOptions then + if s.owner <> nil then + appf(gMapping, '"$1.$2": $3$n', + [toRope(s.owner.Name.s), toRope(s.name.s), result]); + s.loc.r := result; + end +end; + +function getTypeName(typ: PType): PRope; +begin + if (typ.sym <> nil) and ([sfImportc, sfExportc] * typ.sym.flags <> []) then + result := typ.sym.loc.r + else begin + if typ.loc.r = nil then typ.loc.r := con('TY', toRope(typ.id)); + result := typ.loc.r + end; + if result = nil then InternalError('getTypeName: ' + typeKindToStr[typ.kind]); end; // ------------------------------ C type generator ------------------------ @@ -44,7 +72,7 @@ begin tyNone: result := ctVoid; tyBool: result := ctBool; tyChar: result := ctChar; - tyEmptySet, tySet: begin + tySet: begin case int(getSize(typ)) of 1: result := ctInt8; 2: result := ctInt16; @@ -90,7 +118,8 @@ begin end end; -function getTypeDesc(m: BModule; typ: PType): PRope; forward; +function getTypeDescAux(m: BModule; typ: PType; + var check: TIntSet): PRope; forward; function needsComplexAssignment(typ: PType): bool; begin @@ -107,7 +136,8 @@ begin result := true else begin case mapType(rettype) of - ctArray: result := true; + ctArray: + result := not (skipGeneric(rettype).kind in [tyVar, tyRef, tyPtr]); ctStruct: result := needsComplexAssignment(skipGeneric(rettype)); else result := false; end @@ -119,18 +149,20 @@ const 'N_STDCALL', 'N_CDECL', 'N_SAFECALL', 'N_SYSCALL', // this is probably not correct for all platforms, // but one can //define it to what you want so there will no problem - 'N_INLINE', 'N_FASTCALL', 'N_CLOSURE', 'N_NOCONV'); + 'N_INLINE', 'N_NOINLINE', 'N_FASTCALL', 'N_CLOSURE', 'N_NOCONV'); function CacheGetType(const tab: TIdTable; key: PType): PRope; begin // returns nil if we need to declare this type - result := PRope(TableGetType(tab, key)) + // since types are now unique via the ``GetUniqueType`` mechanism, this slow + // linear search is not necessary anymore: + result := PRope(IdTableGet(tab, key)) end; function getTempName(): PRope; begin - inc(gUnique); - result := con('T'+'', toRope(gUnique)) + result := con('TMP', toRope(gId)); + inc(gId); end; function ccgIntroducedPtr(s: PSym): bool; @@ -166,7 +198,8 @@ begin end end; -procedure genProcParams(m: BModule; t: PType; out rettype, params: PRope); +procedure genProcParams(m: BModule; t: PType; out rettype, params: PRope; + var check: TIntSet); var i, j: int; param: PSym; @@ -177,12 +210,12 @@ begin // C cannot return arrays (what a poor language...) rettype := toRope('void') else - rettype := getTypeDesc(m, t.sons[0]); + rettype := getTypeDescAux(m, t.sons[0], check); for i := 1 to sonsLen(t.n)-1 do begin if t.n.sons[i].kind <> nkSym then InternalError(t.n.info, 'genProcParams'); param := t.n.sons[i].sym; fillLoc(param.loc, locParam, param.typ, mangleName(param), OnStack); - app(params, getTypeDesc(m, param.typ)); + app(params, getTypeDescAux(m, param.typ, check)); if ccgIntroducedPtr(param) then begin app(params, '*'+''); include(param.loc.flags, lfIndirect); @@ -203,7 +236,7 @@ begin end; if (t.sons[0] <> nil) and isInvalidReturnType(t.sons[0]) then begin if params <> nil then app(params, ', '); - app(params, getTypeDesc(m, t.sons[0])); + app(params, getTypeDescAux(m, t.sons[0], check)); if mapType(t.sons[0]) <> ctArray then app(params, '*'+''); app(params, ' Result'); end; @@ -227,25 +260,16 @@ begin result := (t.sym <> nil) and (sfImportc in t.sym.flags) end; -function getTypeName(typ: PType): PRope; -begin - if (typ.sym <> nil) and ([sfImportc, sfExportc] * typ.sym.flags <> []) then - result := typ.sym.loc.r - else begin - if typ.loc.r = nil then typ.loc.r := con('Ty', toRope(typ.id)); - result := typ.loc.r - end -end; - -function typeNameOrLiteral(typ: PType; const literal: string): PRope; +function typeNameOrLiteral(t: PType; const literal: string): PRope; begin - if isImportedType(typ) then - result := getTypeName(typ) + if (t.sym <> nil) and (sfImportc in t.sym.flags) and + (t.sym.magic = mNone) then + result := getTypeName(t) else result := toRope(literal) end; -function getSimpleTypeDesc(typ: PType): PRope; +function getSimpleTypeDesc(m: BModule; typ: PType): PRope; const NumericalTypeToStr: array [tyInt..tyFloat128] of string = ( 'NI', 'NI8', 'NI16', 'NI32', 'NI64', 'NF', 'NF32', 'NF64', 'NF128'); @@ -267,14 +291,17 @@ begin end end end; - tyString: result := typeNameOrLiteral(typ, 'string'); + tyString: begin + useMagic(m, 'NimStringDesc'); + result := typeNameOrLiteral(typ, 'NimStringDesc*'); + end; tyCstring: result := typeNameOrLiteral(typ, 'NCSTRING'); tyBool: result := typeNameOrLiteral(typ, 'NIM_BOOL'); tyChar: result := typeNameOrLiteral(typ, 'NIM_CHAR'); tyNil: result := typeNameOrLiteral(typ, '0'+''); tyInt..tyFloat128: result := typeNameOrLiteral(typ, NumericalTypeToStr[typ.Kind]); - tyRange: result := getSimpleTypeDesc(typ.sons[0]); + tyRange: result := getSimpleTypeDesc(m, typ.sons[0]); else result := nil; end end; @@ -284,7 +311,7 @@ begin if typ = nil then result := toRope('void') else begin - result := getSimpleTypeDesc(typ); + result := getSimpleTypeDesc(m, typ); if result = nil then result := CacheGetType(m.typeCache, typ) end @@ -325,7 +352,7 @@ begin end; function genRecordFieldsAux(m: BModule; n: PNode; accessExpr: PRope; - rectype: PType): PRope; + rectype: PType; var check: TIntSet): PRope; var i: int; ae, uname, sname, a: PRope; @@ -336,13 +363,14 @@ begin case n.kind of nkRecList: begin for i := 0 to sonsLen(n)-1 do begin - app(result, genRecordFieldsAux(m, n.sons[i], accessExpr, rectype)); + app(result, genRecordFieldsAux(m, n.sons[i], accessExpr, + rectype, check)); end end; nkRecCase: begin if (n.sons[0].kind <> nkSym) then InternalError(n.info, 'genRecordFieldsAux'); - app(result, genRecordFieldsAux(m, n.sons[0], accessExpr, rectype)); + app(result, genRecordFieldsAux(m, n.sons[0], accessExpr, rectype, check)); uname := toRope(mangle(n.sons[0].sym.name.s)+ 'U'); if accessExpr <> nil then ae := ropef('$1.$2', [accessExpr, uname]) else ae := uname; @@ -354,14 +382,14 @@ begin if k.kind <> nkSym then begin sname := con('S'+'', toRope(i)); a := genRecordFieldsAux(m, k, ropef('$1.$2', [ae, sname]), - rectype); + rectype, check); if a <> nil then begin app(result, 'struct {'); app(result, a); appf(result, '} $1;$n', [sname]); end end - else app(result, genRecordFieldsAux(m, k, ae, rectype)); + else app(result, genRecordFieldsAux(m, k, ae, rectype, check)); end; else internalError('genRecordFieldsAux(record case branch)'); end; @@ -375,18 +403,19 @@ begin if accessExpr <> nil then ae := ropef('$1.$2', [accessExpr, sname]) else ae := sname; fillLoc(field.loc, locField, field.typ, ae, OnUnknown); - appf(result, '$1 $2;$n', [getTypeDesc(m, field.loc.t), sname]) + appf(result, '$1 $2;$n', [getTypeDescAux(m, field.loc.t, check), sname]) end; else internalError(n.info, 'genRecordFieldsAux()'); end end; -function getRecordFields(m: BModule; typ: PType): PRope; +function getRecordFields(m: BModule; typ: PType; var check: TIntSet): PRope; begin - result := genRecordFieldsAux(m, typ.n, nil, typ); + result := genRecordFieldsAux(m, typ.n, nil, typ, check); end; -function getRecordDesc(m: BModule; typ: PType; name: PRope): PRope; +function getRecordDesc(m: BModule; typ: PType; name: PRope; + var check: TIntSet): PRope; var desc: PRope; hasField: bool; @@ -406,18 +435,18 @@ begin end else if gCmd = cmdCompileToCpp then begin result := ropef('struct $1 : public $2 {$n', - [name, getTypeDesc(m, typ.sons[0])]); + [name, getTypeDescAux(m, typ.sons[0], check)]); hasField := true end else begin result := ropef('struct $1 {$n $2 Sup;$n', - [name, getTypeDesc(m, typ.sons[0])]); + [name, getTypeDescAux(m, typ.sons[0], check)]); hasField := true end end else result := ropef('struct $1 {$n', [name]); - desc := getRecordFields(m, typ); + desc := getRecordFields(m, typ, check); if (desc = nil) and not hasField then // no fields in struct are not valid in C, so generate a dummy: appf(result, 'char dummy;$n', []) @@ -435,7 +464,7 @@ begin m.typeStack[L] := typ; end; -function getTypeDesc(m: BModule; typ: PType): PRope; +function getTypeDescAux(m: BModule; typ: PType; var check: TIntSet): PRope; // returns only the type's name var name, rettype, desc, recdesc: PRope; @@ -443,12 +472,18 @@ var t, et: PType; begin t := getUniqueType(typ); - if t = nil then InternalError('getTypeDesc: t == nil'); + if t = nil then InternalError('getTypeDescAux: t == nil'); if t.sym <> nil then useHeader(m, t.sym); result := getTypePre(m, t); if result <> nil then exit; + if IntSetContainsOrIncl(check, t.id) then begin + InternalError('cannot generate C type for: ' + typeToString(typ)); + // XXX: this BUG is hard to fix -> we need to introduce helper structs, + // but determining when this needs to be done is hard. We should split + // C type generation into an analysis and a code generation phase somehow. + end; case t.Kind of - tyRef, tyPtr, tyVar, tyOpenArray: begin + tyRef, tyPtr, tyVar: begin et := getUniqueType(t.sons[0]); if et.kind in [tyArrayConstr, tyArray, tyOpenArray] then et := getUniqueType(elemType(et)); @@ -469,15 +504,20 @@ begin end; else begin // else we have a strong dependency :-( - result := con(getTypeDesc(m, et), '*'+''); + result := con(getTypeDescAux(m, et, check), '*'+''); IdTablePut(m.typeCache, t, result) end end end; + tyOpenArray: begin + et := getUniqueType(t.sons[0]); + result := con(getTypeDescAux(m, et, check), '*'+''); + IdTablePut(m.typeCache, t, result) + end; tyProc: begin result := getTypeName(t); IdTablePut(m.typeCache, t, result); - genProcParams(m, t, rettype, desc); + genProcParams(m, t, rettype, desc, check); if not isImportedType(t) then begin if t.callConv <> ccClosure then appf(m.s[cfsTypes], 'typedef $1_PTR($2, $3) $4;$n', @@ -501,12 +541,14 @@ begin end; assert(CacheGetType(m.typeCache, t) = nil); IdTablePut(m.typeCache, t, con(result, '*'+'')); - if not isImportedType(t) then + if not isImportedType(t) then begin + useMagic(m, 'TGenericSeq'); appf(m.s[cfsSeqTypes], 'struct $2 {$n' + - ' NI len, space;$n' + + ' TGenericSeq Sup;$n' + ' $1 data[SEQ_DECL_SIZE];$n' + - '};$n', [getTypeDesc(m, t.sons[0]), result]); + '};$n', [getTypeDescAux(m, t.sons[0], check), result]); + end; app(result, '*'+''); end; tyArrayConstr, tyArray: begin @@ -516,7 +558,7 @@ begin IdTablePut(m.typeCache, t, result); if not isImportedType(t) then appf(m.s[cfsTypes], 'typedef $1 $2[$3];$n', - [getTypeDesc(m, t.sons[1]), result, ToRope(n)]) + [getTypeDescAux(m, t.sons[1], check), result, ToRope(n)]) end; tyObject, tyTuple: begin result := CacheGetType(m.forwTypeCache, t); @@ -528,7 +570,8 @@ begin IdTablePut(m.forwTypeCache, t, result) end; IdTablePut(m.typeCache, t, result); - recdesc := getRecordDesc(m, t, result); // always call for sideeffects + // always call for sideeffects: + recdesc := getRecordDesc(m, t, result, check); if not isImportedType(t) then app(m.s[cfsTypes], recdesc); end; tySet: begin @@ -546,14 +589,22 @@ begin end end end; - tyGenericInst: result := getTypeDesc(m, lastSon(t)); + tyGenericInst: result := getTypeDescAux(m, lastSon(t), check); else begin - InternalError('getTypeDesc(' + typeKindToStr[t.kind] + ')'); + InternalError('getTypeDescAux(' + typeKindToStr[t.kind] + ')'); result := nil end end end; +function getTypeDesc(m: BModule; typ: PType): PRope; +var + check: TIntSet; +begin + IntSetInit(check); + result := getTypeDescAux(m, typ, check); +end; + procedure finishTypeDescriptions(m: BModule); var i: int; @@ -568,14 +619,16 @@ end; function genProcHeader(m: BModule; prc: PSym): PRope; var rettype, params: PRope; + check: TIntSet; begin // using static is needed for inline procs if (prc.typ.callConv = ccInline) then result := toRope('static ') else result := nil; + IntSetInit(check); fillLoc(prc.loc, locProc, prc.typ, mangleName(prc), OnUnknown); - genProcParams(m, prc.typ, rettype, params); + genProcParams(m, prc.typ, rettype, params, check); appf(result, '$1($2, $3)$4', [toRope(CallingConvToStr[prc.typ.callConv]), rettype, prc.loc.r, params]) @@ -583,25 +636,33 @@ end; // ----------------------- type information ---------------------------------- -var - gTypeInfoGenerated: TIntSet; - function genTypeInfo(m: BModule; typ: PType): PRope; forward; -procedure allocMemTI(m: BModule; name: PRope); +function getNimNode(m: BModule): PRope; +begin + result := ropef('$1[$2]', [m.typeNodesName, toRope(m.typeNodes)]); + inc(m.typeNodes); +end; + +function getNimType(m: BModule): PRope; +begin + result := ropef('$1[$2]', [m.nimTypesName, toRope(m.nimTypes)]); + inc(m.nimTypes); +end; + +procedure allocMemTI(m: BModule; typ: PType; name: PRope); var tmp: PRope; begin - tmp := getTempName(); - appf(m.s[cfsTypeInit1], 'static TNimType $1;$n', [tmp]); + tmp := getNimType(m); appf(m.s[cfsTypeInit2], '$2 = &$1;$n', [tmp, name]); end; procedure genTypeInfoAuxBase(m: BModule; typ: PType; name, base: PRope); var - nimtypeKind: int; + nimtypeKind, flags: int; begin - allocMemTI(m, name); + allocMemTI(m, typ, name); if (typ.kind = tyObject) and (tfFinal in typ.flags) and (typ.sons[0] = nil) then nimtypeKind := ord(high(TTypeKind))+1 // tyPureObject @@ -612,7 +673,15 @@ begin '$1->kind = $3;$n' + '$1->base = $4;$n', [ name, getTypeDesc(m, typ), toRope(nimtypeKind), base]); - appf(m.s[cfsVars], 'TNimType* $1;$n', [name]); + // compute type flags for GC optimization + flags := 0; + if not containsGarbageCollectedRef(typ) then flags := flags or 1; + if not canFormAcycle(typ) then flags := flags or 2; + //else MessageOut('can contain a cycle: ' + typeToString(typ)); + if flags <> 0 then + appf(m.s[cfsTypeInit3], '$1->flags = $2;$n', [name, toRope(flags)]); + appf(m.s[cfsVars], 'TNimType* $1; /* $2 */$n', + [name, toRope(typeToString(typ))]); end; procedure genTypeInfoAux(m: BModule; typ: PType; name: PRope); @@ -643,10 +712,8 @@ begin appf(m.s[cfsTypeInit1], 'static TNimNode* $1[$2];$n', [tmp, toRope(len)]); for i := 0 to len-1 do begin - tmp2 := getTempName(); - appf(m.s[cfsTypeInit1], 'static TNimNode $1;$n', [tmp2]); - appf(m.s[cfsTypeInit3], '$1[$2] = &$3;$n', - [tmp, toRope(i), tmp2]); + tmp2 := getNimNode(m); + appf(m.s[cfsTypeInit3], '$1[$2] = &$3;$n', [tmp, toRope(i), tmp2]); genObjectFields(m, typ, n.sons[i], tmp2); end; appf(m.s[cfsTypeInit3], @@ -676,10 +743,8 @@ begin [tmp, toRope(lengthOrd(field.typ)+1)]); for i := 1 to len-1 do begin b := n.sons[i]; // branch - tmp2 := getTempName(); - appf(m.s[cfsTypeInit1], 'static TNimNode $1;$n', [tmp2]); + tmp2 := getNimNode(m); genObjectFields(m, typ, lastSon(b), tmp2); - //writeln(output, renderTree(b.sons[j])); case b.kind of nkOfBranch: begin if sonsLen(b) < 2 then @@ -728,42 +793,54 @@ var begin if typ.kind = tyObject then genTypeInfoAux(m, typ, name) else genTypeInfoAuxBase(m, typ, name, toRope('0'+'')); - tmp := getTempName(); - appf(m.s[cfsTypeInit1], 'static TNimNode $1;$n', [tmp]); + tmp := getNimNode(m); genObjectFields(m, typ, typ.n, tmp); appf(m.s[cfsTypeInit3], '$1->node = &$2;$n', [name, tmp]); end; procedure genEnumInfo(m: BModule; typ: PType; name: PRope); var - tmp, tmp2, tmp3: PRope; - len, i: int; + nodePtrs, elemNode, enumNames, enumArray, counter, specialCases: PRope; + len, i, firstNimNode: int; field: PSym; begin + // Type information for enumerations is quite heavy, so we do some + // optimizations here: The ``typ`` field is never set, as it is redundant + // anyway. We generate a cstring array and a loop over it. Exceptional + // positions will be reset after the loop. genTypeInfoAux(m, typ, name); - tmp := getTempName(); - tmp2 := getTempName(); + nodePtrs := getTempName(); len := sonsLen(typ.n); - appf(m.s[cfsTypeInit1], 'static TNimNode* $1[$2];$n' + - 'static TNimNode $3;$n', - [tmp, toRope(len), tmp2]); + appf(m.s[cfsTypeInit1], 'static TNimNode* $1[$2];$n', [nodePtrs, toRope(len)]); + enumNames := nil; + specialCases := nil; + firstNimNode := m.typeNodes; for i := 0 to len-1 do begin assert(typ.n.sons[i].kind = nkSym); field := typ.n.sons[i].sym; - tmp3 := getTempName(); - appf(m.s[cfsTypeInit1], 'static TNimNode $1;$n', [tmp3]); - appf(m.s[cfsTypeInit3], '$1[$2] = &$3;$n' + - '$3.kind = 1;$n' + - '$3.offset = $4;$n' + - '$3.typ = $5;$n' + - '$3.name = $6;$n', - [tmp, toRope(i), tmp3, - toRope(field.position), - name, makeCString(field.name.s)]); + elemNode := getNimNode(m); + app(enumNames, makeCString(field.name.s)); + if i < len-1 then app(enumNames, ', '+tnl); + if field.position <> i then + appf(specialCases, '$1.offset = $2;$n', [elemNode, toRope(field.position)]); end; + enumArray := getTempName(); + counter := getTempName(); + appf(m.s[cfsTypeInit1], 'NI $1;$n', [counter]); + appf(m.s[cfsTypeInit1], 'static char* NIM_CONST $1[$2] = {$n$3};$n', + [enumArray, toRope(len), enumNames]); + appf(m.s[cfsTypeInit3], 'for ($1 = 0; $1 < $2; $1++) {$n' + + '$3[$1+$4].kind = 1;$n' + + '$3[$1+$4].offset = $1;$n' + + '$3[$1+$4].name = $5[$1];$n' + + '$6[$1] = &$3[$1+$4];$n' + + '}$n', + [counter, toRope(len), m.typeNodesName, toRope(firstNimNode), + enumArray, nodePtrs]); + app(m.s[cfsTypeInit3], specialCases); appf(m.s[cfsTypeInit3], '$1.len = $2; $1.kind = 2; $1.sons = &$3[0];$n$4->node = &$1;$n', [ - tmp2, toRope(len), tmp, name]); + getNimNode(m), toRope(len), nodePtrs, name]); end; procedure genSetInfo(m: BModule; typ: PType; name: PRope); @@ -772,8 +849,7 @@ var begin assert(typ.sons[0] <> nil); genTypeInfoAux(m, typ, name); - tmp := getTempName(); - appf(m.s[cfsTypeInit1], 'static TNimNode $1;$n', [tmp]); + tmp := getNimNode(m); appf(m.s[cfsTypeInit3], '$1.len = $2; $1.kind = 0;$n' + '$3->node = &$1;$n', [tmp, toRope(firstOrd(typ)), name]); @@ -784,28 +860,96 @@ begin genTypeInfoAuxBase(m, typ, name, genTypeInfo(m, typ.sons[1])); end; +var + gToTypeInfoId: TIiTable; + +(* // this does not work any longer thanks to separate compilation: +function getTypeInfoName(t: PType): PRope; +begin + result := ropef('NTI$1', [toRope(t.id)]); +end;*) + function genTypeInfo(m: BModule; typ: PType): PRope; var t: PType; + id: int; + dataGen: bool; begin t := getUniqueType(typ); - result := ropef('NTI$1', [toRope(t.id)]); + id := IiTableGet(gToTypeInfoId, t.id); + if id = invalidKey then begin + dataGen := false; + case t.kind of + tyEnum, tyBool: begin + id := t.id; + dataGen := true + end; + tyObject: begin + if sfPure in t.sym.flags then + id := getID() + else begin + id := t.id; + dataGen := true + end + end + else + id := getID(); + end; + IiTablePut(gToTypeInfoId, t.id, id); + end + else + dataGen := true; + result := ropef('NTI$1', [toRope(id)]); if not IntSetContainsOrIncl(m.typeInfoMarker, t.id) then begin // declare type information structures: useMagic(m, 'TNimType'); useMagic(m, 'TNimNode'); - appf(m.s[cfsVars], 'extern TNimType* $1;$n', [result]); + if dataGen then + appf(m.s[cfsVars], 'extern TNimType* $1; /* $2 */$n', + [result, toRope(typeToString(t))]); end; - if IntSetContainsOrIncl(gTypeInfoGenerated, t.id) then exit; + if dataGen then exit; case t.kind of - tyPointer, tyProc, tyBool, tyChar, tyCString, tyString, tyInt..tyFloat128: + tyPointer, tyProc, tyBool, tyChar, tyCString, tyString, + tyInt..tyFloat128, tyVar: genTypeInfoAuxBase(m, t, result, toRope('0'+'')); tyRef, tyPtr, tySequence, tyRange: genTypeInfoAux(m, t, result); tyArrayConstr, tyArray: genArrayInfo(m, t, result); tySet: genSetInfo(m, t, result); tyEnum: genEnumInfo(m, t, result); tyObject, tyTuple: genObjectInfo(m, t, result); - tyVar: result := genTypeInfo(m, typ.sons[0]); else InternalError('genTypeInfo(' + typekindToStr[t.kind] + ')'); end end; + +procedure genTypeSection(m: BModule; n: PNode); +var + i: int; + a: PNode; + t: PType; +begin + for i := 0 to sonsLen(n)-1 do begin + a := n.sons[i]; + if a.kind = nkCommentStmt then continue; + if (a.sons[0].kind <> nkSym) then InternalError(a.info, 'genTypeSection'); + t := a.sons[0].sym.typ; + if (a.sons[2] = nil) + or not (a.sons[2].kind in [nkSym, nkIdent, nkAccQuoted]) then + if t <> nil then + case t.kind of + tyEnum, tyBool: begin + useMagic(m, 'TNimType'); + useMagic(m, 'TNimNode'); + genEnumInfo(m, t, ropef('NTI$1', [toRope(t.id)])); + end; + tyObject: begin + if not (sfPure in t.sym.flags) then begin + useMagic(m, 'TNimType'); + useMagic(m, 'TNimNode'); + genObjectInfo(m, t, ropef('NTI$1', [toRope(t.id)])); + end + end + else begin end + end + end +end; diff --git a/nim/ccgutils.pas b/nim/ccgutils.pas index 09cd504bc..8e3775d22 100644 --- a/nim/ccgutils.pas +++ b/nim/ccgutils.pas @@ -6,7 +6,6 @@ // See the file "copying.txt", included in this // distribution, for details about the copyright. // - unit ccgutils; interface @@ -35,21 +34,28 @@ var t: PType; h: THash; begin + // this was a hotspot in the compiler! result := key; if key = nil then exit; - assert(key.kind <> tyForward); - if key.kind = tyGenericInst then begin - result := GetUniqueType(lastSon(key)); - exit - end; - if IdTableHasObjectAsKey(gTypeTable, key) then exit; - // we have to do a slow linear search because types may need - // to be compared by their structure: - for h := 0 to high(gTypeTable.data) do begin - t := PType(gTypeTable.data[h].key); - if (t <> nil) and sameType(t, key) then begin result := t; exit end + case key.Kind of + tyEmpty, tyChar, tyBool, tyNil, tyPointer, tyString, tyCString, + tyInt..tyFloat128, tyProc, tyEnum, tyObject, tyAnyEnum: begin end; + tyNone, tyForward: + InternalError('GetUniqueType: ' + typeToString(key)); + tyGenericParam, tyGeneric, tySequence, + tyOpenArray, tySet, tyVar, tyRef, tyPtr, tyArrayConstr, + tyArray, tyTuple, tyRange: begin + // we have to do a slow linear search because types may need + // to be compared by their structure: + if IdTableHasObjectAsKey(gTypeTable, key) then exit; + for h := 0 to high(gTypeTable.data) do begin + t := PType(gTypeTable.data[h].key); + if (t <> nil) and sameType(t, key) then begin result := t; exit end + end; + IdTablePut(gTypeTable, key, key); + end; + tyGenericInst: result := GetUniqueType(lastSon(key)); end; - IdTablePut(gTypeTable, key, key); end; function TableGetType(const tab: TIdTable; key: PType): PObject; @@ -102,7 +108,7 @@ begin end; res := res +{&} toCChar(s[i]); end; - res := res +{&} '"'+''; + addChar(res, '"'); app(result, toRope(res)); end; diff --git a/nim/cgen.pas b/nim/cgen.pas index 677a9b0ac..2f89c4208 100644 --- a/nim/cgen.pas +++ b/nim/cgen.pas @@ -6,7 +6,6 @@ // See the file "copying.txt", included in this // distribution, for details about the copyright. // - unit cgen; // This is the new C code generator; much cleaner and faster @@ -19,10 +18,10 @@ interface uses nsystem, ast, astalgo, strutils, hashes, trees, platform, magicsys, extccomp, options, nversion, nimsets, msgs, crc, bitsets, idents, - lists, types, ccgutils, nos, ntime, ropes, nmath, backends, - wordrecg, rnimsyn; - -function CBackend(b: PBackend; module: PSym; const filename: string): PBackend; + lists, types, ccgutils, nos, ntime, ropes, nmath, passes, rodread, + wordrecg, rnimsyn, treetab; + +function cgenPass(): TPass; implementation @@ -95,7 +94,6 @@ type // (the vars must be volatile then) labels: Natural; // for generating unique labels in the C proc blocks: array of TBlock; // nested blocks - locals: array of TLoc; // locNone means slot is free again options: TOptions; // options that should be used for code // generation; this is the same as prc.options // unless prc == nil @@ -105,7 +103,9 @@ type module: BModule; // used to prevent excessive parameter passing end; TTypeSeq = array of PType; - TCGen = object(TBackend) // represents a C source file + TCGen = object(TPassContext) // represents a C source file + module: PSym; + filename: string; s: TCFileSections; // sections of the C file cfilename: string; // filename of the module (including path, // without extension) @@ -114,18 +114,21 @@ type declaredThings: TIntSet; // things we have declared in this .c file debugDeclared: TIntSet; // for debugging purposes headerFiles: TLinkedList; // needed headers to include - //unique: Natural; // for generating unique names typeInfoMarker: TIntSet; // needed for generating type information initProc: BProc; // code for init procedure typeStack: TTypeSeq; // used for type generation + dataCache: TNodeTable; + typeNodes, nimTypes: int;// used for type info generation + typeNodesName, nimTypesName: PRope; // used for type info generation end; var - gUnique: Natural; mainModProcs, mainModInit: PRope; // parts of the main module gMapping: PRope; // the generated mapping file (if requested) + gProcProfile: Natural; // proc profile counter -function initLoc(k: TLocKind; typ: PType; s: TStorageLoc): TLoc; + +procedure initLoc(var result: TLoc; k: TLocKind; typ: PType; s: TStorageLoc); begin result.k := k; result.s := s; @@ -162,11 +165,8 @@ begin result.options := gOptions; {@ignore} setLength(result.blocks, 0); - setLength(result.locals, 0); -{@emit - result.blocks := [];} {@emit - result.locals := [];} + result.blocks := @[];} end; function isSimpleConst(typ: PType): bool; @@ -179,15 +179,12 @@ procedure useHeader(m: BModule; sym: PSym); begin if lfHeader in sym.loc.Flags then begin assert(sym.annex <> nil); - {@discard} lists.IncludeStr(m.headerFiles, PLib(sym.annex).path) + {@discard} lists.IncludeStr(m.headerFiles, sym.annex.path) end end; procedure UseMagic(m: BModule; const name: string); forward; -// ----------------------------- name mangling -// +++++++++++++++++++++++++++++ type generation -// +++++++++++++++++++++++++++++ type info generation {$include 'ccgtypes.pas'} // ------------------------------ Manager of temporaries ------------------ @@ -198,41 +195,20 @@ begin result := sameType(skipGenericRange(a), skipGenericRange(b)) end; -function getTemp(p: BProc; t: PType): TLoc; -var - i, index: int; - name: PRope; -begin (* - for i := 0 to high(p.locals) do begin - assert(i = p.locals[i].a); - if (p.locals[i].k = locNone) and beEqualTypes(p.locals[i].t, t) then begin - // free slot of the appropriate type? - p.locals[i].k := locTemp; // is filled again - result := p.locals[i]; - exit - end - end; *) - // not found: - index := length(p.locals); - setLength(p.locals, index+1); - // declare the new temporary: - name := con('Loc', toRope(index)); - appf(p.s[cpsLocals], '$1 $2; /* temporary */$n', - [getTypeDesc(p.module, t), name]); - p.locals[index].k := locTemp; - p.locals[index].a := index; - p.locals[index].r := name; - p.locals[index].t := getUniqueType(t); - p.locals[index].s := OnStack; - p.locals[index].flags := {@set}[]; - result := p.locals[index] // BUGFIX! +procedure getTemp(p: BProc; t: PType; var result: TLoc); +begin + inc(p.labels); + result.r := con('LOC', toRope(p.labels)); + appf(p.s[cpsLocals], '$1 $2;$n', [getTypeDesc(p.module, t), result.r]); + result.k := locTemp; + result.a := -1; + result.t := getUniqueType(t); + result.s := OnStack; + result.flags := {@set}[]; end; procedure freeTemp(p: BProc; const temp: TLoc); -begin (* - if (temp.a >= 0) and (temp.a < length(p.locals)) and - (p.locals[temp.a].k = locTemp) then - p.locals[temp.a].k := locNone *) +begin end; // -------------------------- Variable manager ---------------------------- @@ -245,6 +221,8 @@ begin app(m.s[cfsVars], ' register'); if sfVolatile in s.flags then app(m.s[cfsVars], ' volatile'); + if sfThreadVar in s.flags then + app(m.s[cfsVars], ' NIM_THREADVAR'); appf(m.s[cfsVars], ' $1;$n', [s.loc.r]) end end; @@ -314,7 +292,7 @@ end; function getLabel(p: BProc): TLabel; begin inc(p.labels); - result := con('L'+'', toRope(p.labels)) + result := con('LA', toRope(p.labels)) end; procedure fixLabel(p: BProc; labl: TLabel); @@ -344,10 +322,11 @@ begin lib.kind := libDynamicGenerated; useMagic(m, 'nimLoadLibrary'); useMagic(m, 'nimUnloadLibrary'); + useMagic(m, 'NimStringDesc'); tmp := getTempName(); appf(m.s[cfsVars], 'static void* $1;$n', [tmp]); appf(m.s[cfsDynLibInit], - '$1 = nimLoadLibrary((string) &$2);$n', + '$1 = nimLoadLibrary((NimStringDesc*) &$2);$n', [tmp, getStrLit(m, lib.path)]); appf(m.s[cfsDynLibDeinit], 'if ($1 != NIM_NIL) nimUnloadLibrary($1);$n', [tmp]); @@ -361,7 +340,7 @@ var lib: PLib; extname, tmp: PRope; begin - lib := PLib(sym.annex); + lib := sym.annex; extname := sym.loc.r; loadDynamicLib(m, lib); useMagic(m, 'nimGetProcAddr'); @@ -434,7 +413,7 @@ procedure genProc(m: BModule; prc: PSym); var p: BProc; generatedProc, header, returnStmt: PRope; - i: int; + i, profileId: int; res, param: PSym; begin useHeader(m, prc); @@ -454,21 +433,20 @@ begin returnStmt := nil; assert(prc.ast <> nil); - if not (sfPure in prc.flags) then begin + if not (sfPure in prc.flags) and (prc.typ.sons[0] <> nil) then begin + res := prc.ast.sons[resultPos].sym; // get result symbol if not isInvalidReturnType(prc.typ.sons[0]) then begin - res := prc.ast.sons[resultPos].sym; // get result symbol // declare the result symbol: assignLocalVar(p, res); assert(res.loc.r <> nil); - initVariable(p, res); - genObjectInit(p, res); returnStmt := ropef('return $1;$n', [rdLoc(res.loc)]); end - else if (prc.typ.sons[0] <> nil) then begin - res := prc.ast.sons[resultPos].sym; // get result symbol + else begin fillResult(res); - assignParam(p, res) - end + assignParam(p, res); + end; + initVariable(p, res); + genObjectInit(p, res.typ, res.loc, true); end; for i := 1 to sonsLen(prc.typ.n)-1 do begin param := prc.typ.n.sons[i].sym; @@ -492,16 +470,31 @@ begin [makeCString(prc.owner.name.s +{&} '.' +{&} prc.name.s), makeCString(toFilename(prc.info))])); end; + if optProfiler in prc.options then begin + if gProcProfile >= 64*1024 then // XXX: hard coded value! + InternalError(prc.info, 'too many procedures for profiling'); + useMagic(m, 'profileData'); + app(p.s[cpsLocals], 'ticks NIM_profilingStart;'+tnl); + if prc.loc.a < 0 then begin + appf(m.s[cfsDebugInit], 'profileData[$1].procname = $2;$n', + [toRope(gProcProfile), + makeCString(prc.owner.name.s +{&} '.' +{&} prc.name.s)]); + prc.loc.a := gProcProfile; + inc(gProcProfile); + end; + prepend(p.s[cpsInit], toRope('NIM_profilingStart = getticks();' + tnl)); + end; app(generatedProc, con(p.s)); if p.beforeRetNeeded then app(generatedProc, 'BeforeRet: ;' + tnl); if optStackTrace in prc.options then app(generatedProc, 'framePtr = framePtr->prev;' + tnl); + if optProfiler in prc.options then + appf(generatedProc, + 'profileData[$1].total += elapsed(getticks(), NIM_profilingStart);$n', + [toRope(prc.loc.a)]); app(generatedProc, returnStmt); app(generatedProc, '}' + tnl); - // only now we can free the syntax tree: - //if prc.typ.callConv <> ccInline then - // prc.ast.sons[codePos] := nil; end; app(m.s[cfsProcs], generatedProc); end @@ -524,6 +517,8 @@ begin app(m.s[cfsVars], ' register'); if sfVolatile in sym.flags then app(m.s[cfsVars], ' volatile'); + if sfThreadVar in sym.flags then + app(m.s[cfsVars], ' NIM_THREADVAR'); appf(m.s[cfsVars], ' $1;$n', [sym.loc.r]) end end; @@ -572,22 +567,28 @@ end; function getFileHeader(const cfilenoext: string): PRope; begin - result := ropef( - '/* Generated by the Nimrod Compiler v$1 */$n' + - '/* (c) 2008 Andreas Rumpf */$n' + - '/* Compiled for: $2, $3, $4 */$n' + - '/* Command for C compiler:$n $5 */$n', - [toRope(versionAsString), toRope(platform.OS[targetOS].name), - toRope(platform.CPU[targetCPU].name), - toRope(extccomp.CC[extccomp.ccompiler].name), - toRope(getCompileCFileCmd(cfilenoext))]); + if optCompileOnly in gGlobalOptions then + result := ropef( + '/* Generated by the Nimrod Compiler v$1 */$n' + + '/* (c) 2008 Andreas Rumpf */$n', + [toRope(versionAsString)]) + else + result := ropef( + '/* Generated by the Nimrod Compiler v$1 */$n' + + '/* (c) 2008 Andreas Rumpf */$n' + + '/* Compiled for: $2, $3, $4 */$n' + + '/* Command for C compiler:$n $5 */$n', + [toRope(versionAsString), toRope(platform.OS[targetOS].name), + toRope(platform.CPU[targetCPU].name), + toRope(extccomp.CC[extccomp.ccompiler].name), + toRope(getCompileCFileCmd(cfilenoext))]); case platform.CPU[targetCPU].intSize of 16: appf(result, '$ntypedef short int NI;$n' + - 'typedef unsigned short int NU;$n', []); + 'typedef unsigned short int NU;$n', []); 32: appf(result, '$ntypedef long int NI;$n' + - 'typedef unsigned long int NU;$n', []); + 'typedef unsigned long int NU;$n', []); 64: appf(result, '$ntypedef long long int NI;$n' + - 'typedef unsigned long long int NU;$n', []); + 'typedef unsigned long long int NU;$n', []); else begin end end end; @@ -645,18 +646,43 @@ begin appf(m.s[cfsProcs], frmt, [gBreakpoints, mainModInit]) end; +function getInitName(m: PSym): PRope; +begin + result := con(m.name.s, toRope('Init')); +end; + +procedure registerModuleToMain(m: PSym); +var + initname: PRope; +begin + initname := getInitName(m); + appf(mainModProcs, 'N_NOINLINE(void, $1)(void);$n', + [initname]); + if not (sfSystemModule in m.flags) then + appf(mainModInit, '$1();$n', [initname]); +end; + procedure genInitCode(m: BModule); var initname, prc: PRope; begin - initname := con(m.module.name.s, toRope('Init')); - appf(mainModProcs, 'N_NIMCALL(void, $1)(void);$n', - [initname]); - if not (sfSystemModule in m.module.flags) then - appf(mainModInit, '$1();$n', [initname]); - prc := ropef('N_NIMCALL(void, $1)(void) {$n', [initname]); + if optProfiler in m.initProc.options then begin + // This does not really belong here, but there is no good place for this + // code. I don't want to put this to the proc generation as the + // ``IncludeStr`` call is quite slow. + {@discard} lists.IncludeStr(m.headerFiles, '<cycle.h>'); + end; + initname := getInitName(m.module); + registerModuleToMain(m.module); + prc := ropef('N_NOINLINE(void, $1)(void) {$n', [initname]); + if m.typeNodes > 0 then + appf(m.s[cfsTypeInit1], 'static TNimNode $1[$2];$n', + [m.typeNodesName, toRope(m.typeNodes)]); + if m.nimTypes > 0 then + appf(m.s[cfsTypeInit1], 'static TNimType $1[$2];$n', + [m.nimTypesName, toRope(m.nimTypes)]); if optStackTrace in m.initProc.options then begin - prepend(m.initProc.s[cpsLocals], toRope('volatile TFrame F;' + tnl)); + getFrameDecl(m.initProc); app(prc, m.initProc.s[cpsLocals]); app(prc, m.s[cfsTypeInit1]); appf(prc, @@ -704,13 +730,42 @@ begin intSetInit(result.declaredThings); intSetInit(result.debugDeclared); result.cfilename := filename; + result.filename := filename; initIdTable(result.typeCache); initIdTable(result.forwTypeCache); result.module := module; intSetInit(result.typeInfoMarker); result.initProc := newProc(nil, result); result.initProc.options := gOptions; -{@emit result.typeStack := [];} + initNodeTable(result.dataCache); +{@emit result.typeStack := @[];} + result.typeNodesName := getTempName(); + result.nimTypesName := getTempName(); +end; + +function myOpen(module: PSym; const filename: string): PPassContext; +begin + result := newModule(module, filename); +end; + +function myOpenCached(module: PSym; const filename: string; + rd: PRodReader): PPassContext; +var + cfile, cfilenoext, objFile: string; +begin + //MessageOut('cgen.myOpenCached has been called ' + filename); + cfile := changeFileExt(completeCFilePath(filename), cExt); + cfilenoext := changeFileExt(cfile, ''); + (* + objFile := toObjFile(cfilenoext); + if ExistsFile(objFile) and nos.FileNewer(objFile, cfile) then begin + end + else begin + addFileToCompile(cfilenoext); // is to compile + end; *) + addFileToLink(cfilenoext); + registerModuleToMain(module); + result := nil; end; function shouldRecompile(code: PRope; const cfile, cfilenoext: string): bool; @@ -718,7 +773,7 @@ var objFile: string; begin result := true; - if optCFileCache in gGlobalOptions then begin + if not (optForceFullMake in gGlobalOptions) then begin objFile := toObjFile(cfilenoext); if writeRopeIfNotEqual(code, cfile) then exit; if ExistsFile(objFile) and nos.FileNewer(objFile, cfile) then @@ -728,47 +783,57 @@ begin writeRope(code, cfile); end; -procedure finishModule(b: PBackend; n: PNode); +function myProcess(b: PPassContext; n: PNode): PNode; var - cfile, cfilenoext: string; m: BModule; - code: PRope; begin + result := n; + if b = nil then exit; m := BModule(b); m.initProc.options := gOptions; genStmts(m.initProc, n); +end; + +function myClose(b: PPassContext; n: PNode): PNode; +var + cfile, cfilenoext: string; + m: BModule; + code: PRope; +begin + result := n; + if b = nil then exit; + m := BModule(b); + if n <> nil then begin + m.initProc.options := gOptions; + genStmts(m.initProc, n); + end; // generate code for the init statements of the module: genInitCode(m); finishTypeDescriptions(m); + cfile := completeCFilePath(m.cfilename); + cfilenoext := changeFileExt(cfile, ''); if sfMainModule in m.module.flags then begin - // generate mapping file (if requested): - if gMapping <> nil then - WriteRope(gMapping, ChangeFileExt(cfile + '_map', 'txt')); - // generate main file: app(m.s[cfsProcHeaders], mainModProcs); genMainProc(m); end; - cfile := completeCFilePath(m.cfilename); - cfilenoext := changeFileExt(cfile, ''); code := genModule(m, cfilenoext); if shouldRecompile(code, changeFileExt(cfile, cExt), cfilenoext) then begin addFileToCompile(cfilenoext); // is to compile end; addFileToLink(cfilenoext); + if sfMainModule in m.module.flags then writeMapping(cfile, gMapping); end; -function CBackend(b: PBackend; module: PSym; const filename: string): PBackend; -var - g: BModule; +function cgenPass(): TPass; begin - g := newModule(module, filename); - g.backendCreator := CBackend; - g.eventMask := {@set}[eAfterModule]; - g.afterModuleEvent := finishModule; - result := g; + initPass(result); + result.open := myOpen; + result.openCached := myOpenCached; + result.process := myProcess; + result.close := myClose; end; initialization - intSetInit(gTypeInfoGenerated); + InitIiTable(gToTypeInfoId); end. diff --git a/nim/commands.pas b/nim/commands.pas index ad6f21b07..be863e917 100644 --- a/nim/commands.pas +++ b/nim/commands.pas @@ -16,7 +16,8 @@ interface {$include 'config.inc'} uses - nsystem, charsets, msgs; + nsystem, charsets, nos, msgs, options, nversion, condsyms, strutils, extccomp, + platform, lists, wordrecg; procedure writeCommandLineUsage; @@ -33,10 +34,6 @@ procedure processSwitch(const switch, arg: string; pass: TCmdlinePass; implementation -uses - options, nversion, condsyms, strutils, extccomp, platform, nos, lists, - wordrecg; - {@ignore} const {$ifdef fpc} @@ -54,19 +51,18 @@ const const Usage = '' //[[[cog -//def f(x): return "+{&} '" + x.replace("'", "''")[:-1] + "' +{&} nl" -//for line in file("data/basicopt.txt"): +//from string import replace +//def f(x): return "+{&} '" + replace(x, "'", "''")[:-1] + "' +{&} nl" +//for line in open("data/basicopt.txt").readlines(): // cog.outl(f(line)) //]]] +{&} 'Usage::' +{&} nl +{&} ' nimrod command [options] inputfile [arguments]' +{&} nl +{&} 'Command::' +{&} nl -+{&} ' compile compile project with default code generator (C)' +{&} nl -+{&} ' compile_to_c compile project with C code generator' +{&} nl -+{&} ' compile_to_cpp compile project with C++ code generator' +{&} nl -+{&} ' compile_to_ecmascript compile project to ECMAScript code (experimental)' +{&} nl -+{&} ' doc generate the documentation for inputfile;' +{&} nl -+{&} ' with --run switch opens it with $BROWSER' +{&} nl ++{&} ' compile, c compile project with default code generator (C)' +{&} nl ++{&} ' compile_to_c, cc compile project with C code generator' +{&} nl ++{&} ' doc generate the documentation for inputfile' +{&} nl ++{&} ' rst2html converts a reStructuredText file to HTML' +{&} nl +{&} 'Arguments:' +{&} nl +{&} ' arguments are passed to the program being run (if --run option is selected)' +{&} nl +{&} 'Options:' +{&} nl @@ -74,7 +70,8 @@ const +{&} ' -o, --out:FILE set the output filename' +{&} nl +{&} ' -d, --define:SYMBOL define a conditional symbol' +{&} nl +{&} ' -u, --undef:SYMBOL undefine a conditional symbol' +{&} nl -+{&} ' -b, --force_build force rebuilding of all modules' +{&} nl ++{&} ' -f, --force_build force rebuilding of all modules' +{&} nl ++{&} ' --symbol_files:on|off use symbol files to speed up compilation (buggy!)' +{&} nl +{&} ' --stack_trace:on|off code generation for stack trace ON|OFF' +{&} nl +{&} ' --line_trace:on|off code generation for line trace ON|OFF' +{&} nl +{&} ' --debugger:on|off turn Embedded Nimrod Debugger ON|OFF' +{&} nl @@ -95,7 +92,7 @@ const AdvancedUsage = '' //[[[cog -//for line in file("data/advopt.txt"): +//for line in open("data/advopt.txt").readlines(): // cog.outl(f(line)) //]]] +{&} 'Advanced commands::' +{&} nl @@ -104,21 +101,17 @@ const +{&} ' gen_depend generate a DOT file containing the' +{&} nl +{&} ' module dependency graph' +{&} nl +{&} ' list_def list all defined conditionals and exit' +{&} nl -+{&} ' rst2html converts a reStructuredText file to HTML' +{&} nl +{&} ' check checks the project for syntax and semantic' +{&} nl +{&} ' parse parses a single file (for debugging Nimrod)' +{&} nl -+{&} ' scan tokenizes a single file (for debugging Nimrod)' +{&} nl -+{&} ' debugtrans for debugging the transformation pass' +{&} nl +{&} 'Advanced options:' +{&} nl +{&} ' -w, --warnings:on|off warnings ON|OFF' +{&} nl +{&} ' --warning[X]:on|off specific warning X ON|OFF' +{&} nl +{&} ' --hints:on|off hints ON|OFF' +{&} nl +{&} ' --hint[X]:on|off specific hint X ON|OFF' +{&} nl -+{&} ' --cc:C_COMPILER set the C/C++ compiler to use' +{&} nl +{&} ' --lib:PATH set the system library path' +{&} nl +{&} ' -c, --compile_only compile only; do not assemble or link' +{&} nl +{&} ' --no_linking compile but do not link' +{&} nl -+{&} ' --gen_script generate a compile script (in the ''rod_gen''' +{&} nl ++{&} ' --gen_script generate a compile script (in the ''nimcache''' +{&} nl +{&} ' subdirectory named ''compile_$project$scriptext'')' +{&} nl +{&} ' --os:SYMBOL set the target operating system (cross-compilation)' +{&} nl +{&} ' --cpu:SYMBOL set the target processor (cross-compilation)' +{&} nl @@ -127,50 +120,16 @@ const +{&} ' -l, --passl:OPTION pass an option to the linker' +{&} nl +{&} ' --gen_mapping generate a mapping file containing' +{&} nl +{&} ' (Nimrod, mangled) identifier pairs' +{&} nl -+{&} ' --merge_output generate only one C output file' +{&} nl +{&} ' --line_dir:on|off generation of #line directive ON|OFF' +{&} nl +{&} ' --checkpoints:on|off turn on|off checkpoints; for debugging Nimrod' +{&} nl +{&} ' --skip_cfg do not read the general configuration file' +{&} nl +{&} ' --skip_proj_cfg do not read the project''s configuration file' +{&} nl +{&} ' --import:MODULE_FILE import the given module implicitly for each module' +{&} nl -+{&} ' --maxerr:NUMBER stop compilation after NUMBER errors; broken!' +{&} nl -+{&} ' --ast_cache:on|off caching of ASTs ON|OFF (default: OFF)' +{&} nl -+{&} ' --c_file_cache:on|off caching of generated C files ON|OFF (default: OFF)' +{&} nl +{&} ' --index:FILE use FILE to generate a documenation index file' +{&} nl +{&} ' --putenv:key=value set an environment variable' +{&} nl +{&} ' --list_cmd list the commands used to execute external programs' +{&} nl -+{&} ' -v, --verbose show what Nimrod is doing' +{&} nl -+{&} ' --version show detailed version information' +{&} nl -//[[[end]]] - ; - - VersionInformation = '' -//[[[cog -//for line in file("data/changes.txt"): -// cog.outl(f(line)) -//]]] -+{&} '0.1.0' +{&} nl -+{&} '* new config system' +{&} nl -+{&} '* new build system' +{&} nl -+{&} '* source renderer' +{&} nl -+{&} '* pas2nim integrated' +{&} nl -+{&} '* support for C++' +{&} nl -+{&} '* local variables are always initialized' +{&} nl -+{&} '* Rod file reader and writer' +{&} nl -+{&} '* new --out, -o command line options' +{&} nl -+{&} '* fixed bug in nimconf.pas: we now have several' +{&} nl -+{&} ' string token types' +{&} nl -+{&} '* changed nkIdentDef to nkIdentDefs' +{&} nl -+{&} '* added type(expr) in the parser and the grammer' +{&} nl -+{&} '* added template' +{&} nl -+{&} '* added command calls' +{&} nl -+{&} '* added case in records/objects' +{&} nl -+{&} '* added --skip_proj_cfg switch for nim.dpr' +{&} nl -+{&} '* added missing features to pasparse' +{&} nl -+{&} '* rewrote the source generator' +{&} nl -+{&} '* ``addr`` and ``cast`` are now keywords; grammar updated' +{&} nl -+{&} '* implemented ` notation; grammar updated' +{&} nl -+{&} '* specification replaced by a manual' +{&} nl ++{&} ' --verbosity:0|1|2|3 set Nimrod''s verbosity level (0 is default)' +{&} nl ++{&} ' -v, --version show detailed version information' +{&} nl //[[[end]]] ; @@ -212,7 +171,7 @@ begin versionWritten := true; helpWritten := true; messageOut(format(HelpMessage, [VersionAsString, platform.os[hostOS].name, - cpu[hostCPU].name]) +{&} VersionInformation) + cpu[hostCPU].name])) end end; @@ -378,14 +337,10 @@ begin if pass in {@set}[passCmd2, passPP] then addFileToLink(arg); end; - wDebuginfo: - include(gGlobalOptions, optCDebug); - wCompileOnly, wC: - include(gGlobalOptions, optCompileOnly); - wNoLinking: - include(gGlobalOptions, optNoLinking); - wForceBuild, wF: - include(gGlobalOptions, optForceFullMake); + wDebuginfo: include(gGlobalOptions, optCDebug); + wCompileOnly, wC: include(gGlobalOptions, optCompileOnly); + wNoLinking: include(gGlobalOptions, optNoLinking); + wForceBuild, wF: include(gGlobalOptions, optForceFullMake); wGC: begin case whichKeyword(arg) of wBoehm: begin @@ -406,20 +361,13 @@ begin liMessage(info, errNoneBoehmRefcExpectedButXFound, arg) end end; - wWarnings, wW: - ProcessOnOffSwitch({@set}[optWarns], arg, pass, info); - wWarning: - ProcessSpecificNote(arg, wWarning, pass, info); - wHint: - ProcessSpecificNote(arg, wHint, pass, info); - wHints: - ProcessOnOffSwitch({@set}[optHints], arg, pass, info); - wCheckpoints: - ProcessOnOffSwitch({@set}[optCheckpoints], arg, pass, info); - wStackTrace: - ProcessOnOffSwitch({@set}[optStackTrace], arg, pass, info); - wLineTrace: - ProcessOnOffSwitch({@set}[optLineTrace], arg, pass, info); + wWarnings, wW: ProcessOnOffSwitch({@set}[optWarns], arg, pass, info); + wWarning: ProcessSpecificNote(arg, wWarning, pass, info); + wHint: ProcessSpecificNote(arg, wHint, pass, info); + wHints: ProcessOnOffSwitch({@set}[optHints], arg, pass, info); + wCheckpoints: ProcessOnOffSwitch({@set}[optCheckpoints], arg, pass, info); + wStackTrace: ProcessOnOffSwitch({@set}[optStackTrace], arg, pass, info); + wLineTrace: ProcessOnOffSwitch({@set}[optLineTrace], arg, pass, info); wDebugger: begin ProcessOnOffSwitch({@set}[optEndb], arg, pass, info); if optEndb in gOptions then @@ -427,26 +375,19 @@ begin else UndefSymbol('endb') end; - wChecks, wX: - ProcessOnOffSwitch(checksOptions, arg, pass, info); - wObjChecks: - ProcessOnOffSwitch({@set}[optObjCheck], arg, pass, info); - wFieldChecks: - ProcessOnOffSwitch({@set}[optFieldCheck], arg, pass, info); - wRangeChecks: - ProcessOnOffSwitch({@set}[optRangeCheck], arg, pass, info); - wBoundChecks: - ProcessOnOffSwitch({@set}[optBoundsCheck], arg, pass, info); - wOverflowChecks: - ProcessOnOffSwitch({@set}[optOverflowCheck], arg, pass, info); - wLineDir: - ProcessOnOffSwitch({@set}[optLineDir], arg, pass, info); - wAssertions, wA: - ProcessOnOffSwitch({@set}[optAssert], arg, pass, info); - wCFileCache: - ProcessOnOffSwitchG({@set}[optCFileCache], arg, pass, info); - wAstCache: - ProcessOnOffSwitchG({@set}[optAstCache], arg, pass, info); + wProfiler: begin + ProcessOnOffSwitch({@set}[optProfiler], arg, pass, info); + if optProfiler in gOptions then DefineSymbol('profiler') + else UndefSymbol('profiler') + end; + wChecks, wX: ProcessOnOffSwitch(checksOptions, arg, pass, info); + wObjChecks: ProcessOnOffSwitch({@set}[optObjCheck], arg, pass, info); + wFieldChecks: ProcessOnOffSwitch({@set}[optFieldCheck], arg, pass, info); + wRangeChecks: ProcessOnOffSwitch({@set}[optRangeCheck], arg, pass, info); + wBoundChecks: ProcessOnOffSwitch({@set}[optBoundsCheck], arg, pass, info); + wOverflowChecks: ProcessOnOffSwitch({@set}[optOverflowCheck], arg, pass, info); + wLineDir: ProcessOnOffSwitch({@set}[optLineDir], arg, pass, info); + wAssertions, wA: ProcessOnOffSwitch({@set}[optAssert], arg, pass, info); wOpt: begin case whichKeyword(arg) of wSpeed: begin @@ -505,10 +446,8 @@ begin expectArg(switch, arg, pass, info); options.addImplicitMod(arg); end; - wListCmd: - include(gGlobalOptions, optListCmd); - wGenMapping: - include(gGlobalOptions, optGenMapping); + wListCmd: include(gGlobalOptions, optListCmd); + wGenMapping: include(gGlobalOptions, optGenMapping); wOS: begin if (pass = passCmd1) then begin theOS := platform.NameToOS(arg); @@ -533,26 +472,18 @@ begin end end end; - wRun, wR: - include(gGlobalOptions, optRun); - wVerbose, wV: - include(gGlobalOptions, optVerbose); - wMergeOutput: - include(gGlobalOptions, optMergeOutput); - wVersion: - writeVersionInfo(pass); - wAdvanced: - writeAdvancedUsage(pass); - wHelp, wH: - helpOnError(pass); - wCompileSys: - include(gGlobalOptions, optCompileSys); - wSkipCfg: - include(gGlobalOptions, optSkipConfigFile); - wSkipProjCfg: - include(gGlobalOptions, optSkipProjConfigFile); - wGenScript: - include(gGlobalOptions, optGenScript); + wRun, wR: include(gGlobalOptions, optRun); + wVerbosity: begin + expectArg(switch, arg, pass, info); + gVerbosity := parseInt(arg); + end; + wVersion, wV: writeVersionInfo(pass); + wAdvanced: writeAdvancedUsage(pass); + wHelp, wH: helpOnError(pass); + wSymbolFiles: ProcessOnOffSwitchG({@set}[optSymbolFiles], arg, pass, info); + wSkipCfg: include(gGlobalOptions, optSkipConfigFile); + wSkipProjCfg: include(gGlobalOptions, optSkipProjConfigFile); + wGenScript: include(gGlobalOptions, optGenScript); wLib: begin expectArg(switch, arg, pass, info); libpath := processPath(arg) diff --git a/nim/condsyms.pas b/nim/condsyms.pas index 369ceafad..c018a37ea 100644 --- a/nim/condsyms.pas +++ b/nim/condsyms.pas @@ -6,7 +6,6 @@ // See the file "copying.txt", included in this // distribution, for details about the copyright. // - unit condsyms; // This module handles the conditional symbols. @@ -16,7 +15,7 @@ unit condsyms; interface uses - ast, astalgo, msgs, hashes, platform, strutils, idents; + nsystem, ast, astalgo, msgs, hashes, platform, strutils, idents; var gSymbols: TStrTable; @@ -29,6 +28,8 @@ procedure UndefSymbol(const symbol: string); function isDefined(symbol: PIdent): Boolean; procedure ListSymbols; +function countDefinedSymbols: int; + implementation procedure DefineSymbol(const symbol: string); @@ -39,7 +40,12 @@ begin i := getIdent(symbol); sym := StrTableGet(gSymbols, i); if sym = nil then begin - sym := NewSym(skConditional, i, nil); + new(sym); // circumvent the ID mechanism + {@ignore} + fillChar(sym^, sizeof(sym^), 0); + {@emit} + sym.kind := skConditional; + sym.name := i; StrTableAdd(gSymbols, sym); end; sym.position := 1; @@ -75,6 +81,19 @@ begin MessageOut('-- End of list --'); end; +function countDefinedSymbols: int; +var + it: TTabIter; + s: PSym; +begin + s := InitTabIter(it, gSymbols); + result := 0; + while s <> nil do begin + if s.position = 1 then inc(result); + s := nextIter(it, gSymbols); + end; +end; + procedure InitDefines; begin initStrTable(gSymbols); @@ -92,7 +111,7 @@ begin DefineSymbol('win32'); end; osLinux, osMorphOS, osSkyOS, osIrix, osPalmOS, osQNX, - osAtari: begin + osAtari, osAix: begin // these are all 'unix-like' DefineSymbol('unix'); DefineSymbol('posix'); diff --git a/nim/copying.txt b/nim/copying.txt deleted file mode 100644 index 65b743e4a..000000000 --- a/nim/copying.txt +++ /dev/null @@ -1,18 +0,0 @@ -======================================================= - The Nimrod Compiler - Copyright (C) 2004-2008 Andreas Rumpf -======================================================= - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. diff --git a/nim/crc.pas b/nim/crc.pas index d4c5d0661..429f0ec30 100644 --- a/nim/crc.pas +++ b/nim/crc.pas @@ -21,6 +21,8 @@ type const InitCrc32 = TCrc32(-1); + InitAdler32 = int32(1); + function updateCrc32(val: Byte; crc: TCrc32): TCrc32; overload; function updateCrc32(val: Char; crc: TCrc32): TCrc32; overload; @@ -29,6 +31,9 @@ function strCrc32(const s: string): TCrc32; function crcFromFile(const filename: string): TCrc32; +function updateAdler32(adler: int32; buf: pointer; len: int): int32; + + implementation {@ignore} @@ -121,12 +126,12 @@ const function updateCrc32(val: Byte; crc: TCrc32): TCrc32; overload; begin - result := crc32Table[(int(crc) xor val) and $ff] xor (crc shr 8); + result := crc32Table[(int(crc) xor (int(val) and $ff)) and $ff] xor (int(crc) shr 8); end; function updateCrc32(val: Char; crc: TCrc32): TCrc32; overload; begin - result := updateCrc32(ord(val), crc); + result := updateCrc32(byte(ord(val)), crc); end; function strCrc32(const s: string): TCrc32; @@ -173,6 +178,39 @@ begin CloseFile(bin); end; + +const + base = int32(65521); { largest prime smaller than 65536 } + {NMAX = 5552; original code with unsigned 32 bit integer } + { NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 } + nmax = 3854; { code with signed 32 bit integer } + { NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^31-1 } + { The penalty is the time loss in the extra MOD-calls. } + +function updateAdler32(adler: int32; buf: pointer; len: int): int32; +var + s1, s2: int32; + L, k, b: int; +begin + s1 := adler and int32($ffff); + s2 := (adler shr int32(16)) and int32($ffff); + L := len; + b := 0; + while (L > 0) do begin + if L < nmax then k := L + else k := nmax; + dec(L, k); + while (k > 0) do begin + s1 := s1 +{%} int32(({@cast}cstring(buf))[b]); + s2 := s2 +{%} s1; + inc(b); dec(k); + end; + s1 := modu(s1, base); + s2 := modu(s2, base); + end; + result := (s2 shl int32(16)) or s1; +end; + {@ignore} {$ifdef Q_on} {$undef Q_on} diff --git a/nim/docgen.pas b/nim/docgen.pas index a6d2725c3..fd835db57 100644 --- a/nim/docgen.pas +++ b/nim/docgen.pas @@ -114,11 +114,11 @@ begin {@ignore} fillChar(result^, sizeof(result^), 0); {@emit - result.tocPart := []; + result.tocPart := @[]; } result.filename := filename; result.id := 100; - result.splitAfter := 25; + result.splitAfter := 20; s := getConfigVar('split.item.toc'); if s <> '' then result.splitAfter := parseInt(s); @@ -212,19 +212,51 @@ begin '&': dest := dest + '&'; '<': dest := dest + '<'; '>': dest := dest + '>'; + '"': dest := dest + '"'; else addChar(dest, c) end end; -function toXml(const s: string; splitAfter: int = -1): string; +function nextSplitPoint(const s: string; start: int): int; var i: int; begin + result := start; + while result < length(s)+strStart do begin + case s[result] of + '_': exit; + 'a'..'z': begin + if result+1 < length(s)+strStart then + if s[result+1] in ['A'..'Z'] then exit; + end; + else begin end; + end; + inc(result); + end; + dec(result); // last valid index +end; + +function toXml(const s: string; splitAfter: int = -1): string; +var + i, j, k, partLen: int; +begin result := ''; - for i := strStart to length(s)+strStart-1 do begin - if (splitAfter >= 0) and ((i-strStart+1) mod splitAfter = 0) then - addChar(result, ' '); - addXmlChar(result, s[i]) + if splitAfter >= 0 then begin + partLen := 0; + j := strStart; + while j < length(s)+strStart do begin + k := nextSplitPoint(s, j); + if partLen + k - j + 1 > splitAfter then begin + partLen := 0; + addChar(result, ' '); + end; + for i := j to k do addXmlChar(result, s[i]); + inc(partLen, k - j + 1); + j := k+1; + end; + end + else begin + for i := strStart to length(s)+strStart-1 do addXmlChar(result, s[i]) end end; diff --git a/nim/ecmasgen.pas b/nim/ecmasgen.pas index 53ab4f069..d50be9b0c 100644 --- a/nim/ecmasgen.pas +++ b/nim/ecmasgen.pas @@ -19,15 +19,17 @@ interface uses nsystem, ast, astalgo, strutils, hashes, trees, platform, magicsys, extccomp, options, nversion, nimsets, msgs, crc, bitsets, idents, - lists, types, nos, ntime, ropes, nmath, backends, ccgutils, wordrecg, rnimsyn; + lists, types, nos, ntime, ropes, nmath, passes, ccgutils, wordrecg, rnimsyn, + rodread; -function EcmasBackend(b: PBackend; module: PSym; - const filename: string): PBackend; +function ecmasgenPass(): TPass; implementation type - TEcmasGen = object(TBackend) + TEcmasGen = object(TPassContext) + filename: string; + module: PSym; end; BModule = ^TEcmasGen; @@ -93,7 +95,7 @@ begin {@ignore} fillChar(p, sizeof(p), 0); {@emit - p.blocks := [];} + p.blocks := @[];} p.options := options; p.module := module; p.procDef := procDef; @@ -103,8 +105,7 @@ end; const MappedToObject = {@set}[tyObject, tyArray, tyArrayConstr, tyTuple, - tyEmptySet, tyOpenArray, tySet, tyVar, - tyRef, tyPtr]; + tyOpenArray, tySet, tyVar, tyRef, tyPtr]; function mapType(typ: PType): TEcmasTypeKind; begin @@ -129,10 +130,10 @@ begin end; tyString, tySequence: result := etyInt; // little hack to get the right semantics - tyObject, tyArray, tyArrayConstr, tyTuple, tyEmptySet, tyOpenArray: + tyObject, tyArray, tyArrayConstr, tyTuple, tyOpenArray: result := etyObject; tyNil: result := etyNull; - tyGenericInst, tyGenericParam, tyGeneric, tyNone, tyForward: + tyGenericInst, tyGenericParam, tyGeneric, tyNone, tyForward, tyEmpty: result := etyNone; tyProc: result := etyProc; tyCString: result := etyString; @@ -1832,38 +1833,56 @@ begin end end; -procedure finishModule(b: PBackend; n: PNode); +function myProcess(b: PPassContext; n: PNode): PNode; var m: BModule; - outfile: string; p: TProc; r: TCompRes; - code: PRope; begin + result := n; m := BModule(b); - if m.module = nil then InternalError(n.info, 'finishModule'); + if m.module = nil then InternalError(n.info, 'myProcess'); initProc(p, globals, m, nil, m.module.options); genModule(p, n, r); app(p.globals.code, p.data); app(p.globals.code, mergeStmt(r)); +end; + +function myClose(b: PPassContext; n: PNode): PNode; +var + m: BModule; + code: PRope; + outfile: string; +begin + result := myProcess(b, n); + m := BModule(b); if sfMainModule in m.module.flags then begin // write the file: - code := con(p.globals.typeInfo, p.globals.code); + code := con(globals.typeInfo, globals.code); outfile := changeFileExt(completeCFilePath(m.filename), 'js'); {@discard} writeRopeIfNotEqual(con(genHeader(), code), outfile); - end; + end end; -function EcmasBackend(b: PBackend; module: PSym; - const filename: string): PBackend; -var - g: BModule; +function myOpenCached(s: PSym; const filename: string; + rd: PRodReader): PPassContext; +begin + InternalError('symbol files are not possible with the Ecmas code generator'); + result := nil; +end; + +function myOpen(s: PSym; const filename: string): PPassContext; +begin + result := newModule(s, filename); +end; + +function ecmasgenPass(): TPass; begin - g := newModule(module, filename); - g.backendCreator := EcmasBackend; - g.eventMask := {@set}[eAfterModule]; - g.afterModuleEvent := finishModule; - result := g; + InitPass(result); + result.open := myOpen; + result.close := myClose; + result.openCached := myOpenCached; + result.process := myProcess; end; end. diff --git a/nim/eval.pas b/nim/eval.pas deleted file mode 100644 index 501667c80..000000000 --- a/nim/eval.pas +++ /dev/null @@ -1,1177 +0,0 @@ -// -// -// The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf -// -// See the file "copying.txt", included in this -// distribution, for details about the copyright. -// - -// This file implements the evaluator for Nimrod code. -// The evaluator is very slow, but simple. Since this -// is used mainly for evaluating macros and some other -// stuff at compile time, performance is not that -// important. Later a real interpreter may get out of this... - -// We reuse the TTranscon type here:: -// -// TTransCon = record # part of TContext; stackable -// mapping: TIdNodeTable # mapping from symbols to nodes -// owner: PSym # current owner; proc that is evaluated -// forStmt: PNode # unused -// next: PTransCon # for stacking; up the call stack - -const - evalMaxIterations = 10000000; // max iterations of all loops - evalMaxRecDepth = 100000; // max recursion depth for evaluation - -type - PBinding = PContext; - PCallStack = PTransCon; - -var - emptyNode: PNode; - -function evalAux(c: PContext; n: PNode): PNode; forward; - -procedure stackTraceAux(x: PCallStack); -begin - if x <> nil then begin - stackTraceAux(x.next); - messageOut(format('file: $1, line: $2', [toFilename(x.forStmt.info), - toString(toLineNumber(x.forStmt.info))])); - end -end; - -procedure stackTrace(c: PBinding; n: PNode; msg: TMsgKind; - const arg: string = ''); -begin - messageOut('stack trace: (most recent call last)'); - stackTraceAux(c.transCon); - liMessage(n.info, msg, arg); -end; - -function evalIf(c: PBinding; n: PNode): PNode; -var - i, len: int; -begin - i := 0; - len := sonsLen(n); - while (i < len) and (sonsLen(n.sons[i]) >= 2) do begin - result := evalAux(c, n.sons[i].sons[0]); - if result.kind = nkExceptBranch then exit; - if (result.kind = nkIntLit) and (result.intVal <> 0) then begin - result := evalAux(c, n.sons[i].sons[1]); - exit - end; - inc(i) - end; - if (i < len) and (sonsLen(n.sons[i]) < 2) then // eval else-part - result := evalAux(c, n.sons[0]) - else - result := emptyNode -end; - -function evalCase(c: PBinding; n: PNode): PNode; -var - i, j: int; - res: PNode; -begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - res := result; - result := emptyNode; - for i := 1 to sonsLen(n)-1 do begin - if n.sons[i].kind = nkOfBranch then begin - for j := 0 to sonsLen(n.sons[i])-2 do begin - if overlap(res, n.sons[i].sons[j]) then begin - result := evalAux(c, lastSon(n.sons[i])); - exit - end - end - end - else begin - result := evalAux(c, lastSon(n.sons[i])); - end - end; -end; - -var - gWhileCounter: int; // Use a counter to prevend endless loops! - // We make this counter global, because otherwise - // nested loops could make the compiler extremely slow. - gNestedEvals: int; // count the recursive calls to ``evalAux`` to prevent - // endless recursion - -function evalWhile(c: PBinding; n: PNode): PNode; -begin - while true do begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - if getOrdValue(result) = 0 then break; - result := evalAux(c, n.sons[1]); - case result.kind of - nkBreakStmt: begin - if result.sons[0] = nil then begin - result := emptyNode; // consume ``break`` token - break - end - end; - nkExceptBranch, nkReturnToken: break; - else begin end - end; - dec(gWhileCounter); - if gWhileCounter <= 0 then begin - stackTrace(c, n, errTooManyIterations); - break; - end - end -end; - -function evalBlock(c: PBinding; n: PNode): PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkBreakStmt then begin - if result.sons[0] <> nil then begin - assert(result.sons[0].kind = nkSym); - if n.sons[0] <> nil then begin - assert(n.sons[0].kind = nkSym); - if result.sons[0].sym.id = n.sons[0].sym.id then - result := emptyNode - end - end - else - result := emptyNode // consume ``break`` token - end -end; - -function evalFinally(c: PBinding; n, exc: PNode): PNode; -var - finallyNode: PNode; -begin - finallyNode := lastSon(n); - if finallyNode.kind = nkFinally then begin - result := evalAux(c, finallyNode); - if result.kind <> nkExceptBranch then - result := exc - end - else - result := exc -end; - -function evalTry(c: PBinding; n: PNode): PNode; -var - exc: PNode; - i, j, len, blen: int; -begin - result := evalAux(c, n.sons[0]); - case result.kind of - nkBreakStmt, nkReturnToken: begin end; - nkExceptBranch: begin - // exception token! - exc := result; - i := 1; - len := sonsLen(n); - while (i < len) and (n.sons[i].kind = nkExceptBranch) do begin - blen := sonsLen(n.sons[i]); - if blen = 1 then begin - // general except section: - result := evalAux(c, n.sons[i].sons[0]); - exc := result; - break - end - else begin - for j := 0 to blen-2 do begin - assert(n.sons[i].sons[j].kind = nkType); - if exc.typ.id = n.sons[i].sons[j].typ.id then begin - result := evalAux(c, n.sons[i].sons[blen-1]); - exc := result; - break - end - end - end; - inc(i); - end; - result := evalFinally(c, n, exc); - end; - else - result := evalFinally(c, n, emptyNode); - end -end; - -function getNullValue(typ: PType; const info: TLineInfo): PNode; -var - i: int; - t: PType; -begin - t := skipGenericRange(typ); - result := emptyNode; - case t.kind of - tyBool, tyChar, tyInt..tyInt64: result := newNodeIT(nkIntLit, info, t); - tyFloat..tyFloat128: result := newNodeIt(nkFloatLit, info, t); - tyVar, tyPointer, tyPtr, tyRef, tyCString, tySequence, tyString: - result := newNodeIT(nkNilLit, info, t); - tyObject: begin - result := newNodeIT(nkPar, info, t); - internalError(info, 'init to implement'); - end; - tyArray, tyArrayConstr: begin - result := newNodeIT(nkBracket, info, t); - for i := 0 to int(lengthOrd(t))-1 do - addSon(result, getNullValue(elemType(t), info)); - end; - tyTuple: begin - result := newNodeIT(nkPar, info, t); - for i := 0 to sonsLen(t)-1 do - addSon(result, getNullValue(t.sons[i], info)); - end; - else InternalError('getNullValue') - end -end; - -function evalVar(c: PBinding; n: PNode): PNode; -var - i: int; - v: PSym; - a: PNode; -begin - for i := 0 to sonsLen(n)-1 do begin - a := n.sons[i]; - if a.kind = nkCommentStmt then continue; - assert(a.kind = nkIdentDefs); - assert(a.sons[0].kind = nkSym); - v := a.sons[0].sym; - if a.sons[2] <> nil then begin - result := evalAux(c, a.sons[2]); - if result.kind = nkExceptBranch then exit; - end - else - result := getNullValue(a.sons[0].typ, a.sons[0].info); - IdNodeTablePut(c.transCon.mapping, v, result); - end; - result := emptyNode; -end; - -function evalCall(c: PBinding; n: PNode): PNode; -var - d: PCallStack; - prc: PNode; - i: int; -begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - prc := result; - // bind the actual params to the local parameter - // of a new binding - d := newTransCon(); - d.forStmt := n; - if prc.kind = nkSym then begin - d.owner := prc.sym; - if not (prc.sym.kind in [skProc, skConverter]) then - InternalError(n.info, 'evalCall'); - end; - setLength(d.params, sonsLen(n)); - for i := 1 to sonsLen(n)-1 do begin - result := evalAux(c, n.sons[i]); - if result.kind = nkExceptBranch then exit; - d.params[i] := result; - end; - if n.typ <> nil then d.params[0] := getNullValue(n.typ, n.info); - pushTransCon(c, d); - result := evalAux(c, prc); - if n.typ <> nil then result := d.params[0]; - popTransCon(c); -end; - -function evalVariable(c: PCallStack; sym: PSym): PNode; -// We need to return a node to the actual value, -// which can be modified. -var - x: PCallStack; -begin - x := c; - while x <> nil do begin - if sfResult in sym.flags then begin - result := x.params[0]; - exit - end; - result := IdNodeTableGet(x.mapping, sym); - if result <> nil then exit; - x := x.next - end; - result := emptyNode; -end; - -function evalArrayAccess(c: PBinding; n: PNode): PNode; -var - x: PNode; - idx: biggestInt; -begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - x := result; - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - idx := getOrdValue(result); - result := emptyNode; - case x.kind of - nkBracket, nkPar, nkMetaNode: begin - if (idx >= 0) and (idx < sonsLen(x)) then - result := x.sons[int(idx)] - else - stackTrace(c, n, errIndexOutOfBounds); - end; - nkStrLit..nkTripleStrLit: begin - result := newNodeIT(nkCharLit, x.info, getSysType(tyChar)); - if (idx >= 0) and (idx < length(x.strVal)) then - result.intVal := ord(x.strVal[int(idx)+strStart]) - else if idx = length(x.strVal) then begin end - else - stackTrace(c, n, errIndexOutOfBounds); - end; - else - stackTrace(c, n, errIndexNoIntType); - end -end; - -function evalFieldAccess(c: PBinding; n: PNode): PNode; -// a real field access; proc calls have already been -// transformed -// XXX: field checks! -var - x: PNode; - field: PSym; - i: int; -begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - x := result; - if x.kind <> nkPar then InternalError(n.info, 'evalFieldAccess'); - field := n.sons[1].sym; - for i := 0 to sonsLen(n)-1 do begin - if x.sons[i].kind <> nkExprColonExpr then - InternalError(n.info, 'evalFieldAccess'); - if x.sons[i].sons[0].sym.name.id = field.id then begin - result := x.sons[i].sons[1]; exit - end - end; - stackTrace(c, n, errFieldXNotFound, field.name.s); - result := emptyNode; -end; - -function evalAsgn(c: PBinding; n: PNode): PNode; -var - x: PNode; - i: int; -begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - x := result; - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - x.kind := result.kind; - x.typ := result.typ; - case x.kind of - nkCharLit..nkInt64Lit: x.intVal := result.intVal; - nkFloatLit..nkFloat64Lit: x.floatVal := result.floatVal; - nkStrLit..nkTripleStrLit: begin - x.strVal := result.strVal; - end - else begin - if not (x.kind in [nkEmpty..nkNilLit]) then begin - discardSons(x); - for i := 0 to sonsLen(result)-1 do addSon(x, result.sons[i]); - end - end - end; - result := emptyNode -end; - -function evalSwap(c: PBinding; n: PNode): PNode; -var - x: PNode; - i: int; - tmpi: biggestInt; - tmpf: biggestFloat; - tmps: string; - tmpn: PNode; -begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - x := result; - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - if (x.kind <> result.kind) then - stackTrace(c, n, errCannotInterpretNodeX, nodeKindToStr[n.kind]) - else begin - case x.kind of - nkCharLit..nkInt64Lit: begin - tmpi := x.intVal; - x.intVal := result.intVal; - result.intVal := tmpi - end; - nkFloatLit..nkFloat64Lit: begin - tmpf := x.floatVal; - x.floatVal := result.floatVal; - result.floatVal := tmpf; - end; - nkStrLit..nkTripleStrLit: begin - tmps := x.strVal; - x.strVal := result.strVal; - result.strVal := tmps; - end - else begin - tmpn := copyTree(x); - discardSons(x); - for i := 0 to sonsLen(result)-1 do - addSon(x, result.sons[i]); - discardSons(result); - for i := 0 to sonsLen(tmpn)-1 do - addSon(result, tmpn.sons[i]); - end - end - end; - result := emptyNode -end; - -function evalSym(c: PBinding; n: PNode): PNode; -begin - case n.sym.kind of - skProc, skConverter, skMacro: result := n.sym.ast.sons[codePos]; - skVar, skForVar, skTemp: result := evalVariable(c.transCon, n.sym); - skParam: result := c.transCon.params[n.sym.position+1]; - skConst: result := n.sym.ast; - else begin - stackTrace(c, n, errCannotInterpretNodeX, symKindToStr[n.sym.kind]); - result := emptyNode - end - end; - if result = nil then InternalError(n.info, 'evalSym: ' + n.sym.name.s); -end; - -function evalIncDec(c: PBinding; n: PNode; sign: biggestInt): PNode; -var - a, b: PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := result; - case a.kind of - nkCharLit..nkInt64Lit: a.intval := a.intVal + sign * getOrdValue(b); - else internalError(n.info, 'evalIncDec'); - end; - result := emptyNode -end; - -function evalExit(c: PBinding; n: PNode): PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - liMessage(n.info, hintQuitCalled); - halt(int(getOrdValue(result))); -end; - -function evalOr(c: PBinding; n: PNode): PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - if result.kind <> nkIntLit then InternalError(n.info, 'evalOr'); - if result.intVal = 0 then result := evalAux(c, n.sons[2]) -end; - -function evalAnd(c: PBinding; n: PNode): PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - if result.kind <> nkIntLit then InternalError(n.info, 'evalAnd'); - if result.intVal <> 0 then result := evalAux(c, n.sons[2]) -end; - -function evalNew(c: PBinding; n: PNode): PNode; -var - t: PType; -begin - t := skipVarGeneric(n.sons[1].typ); - result := newNodeIT(nkRefTy, n.info, t); - addSon(result, getNullValue(t.sons[0], n.info)); -end; - -function evalDeref(c: PBinding; n: PNode): PNode; -begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - if result.kind <> nkRefTy then InternalError(n.info, 'evalDeref'); - result := result.sons[0]; -end; - -function evalAddr(c: PBinding; n: PNode): PNode; -var - a: PNode; -begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - if result.kind <> nkRefTy then InternalError(n.info, 'evalDeref'); - a := result; - result := newNodeIT(nkRefTy, n.info, makePtrType(c, a.typ)); - addSon(result, a); -end; - -function evalConv(c: PBinding; n: PNode): PNode; -begin - // hm, I cannot think of any conversions that need to be handled here... - result := evalAux(c, n.sons[1]); - result.typ := n.typ; -end; - -function evalCheckedFieldAccess(c: PBinding; n: PNode): PNode; -begin - result := evalAux(c, n.sons[0]); -end; - -function evalUpConv(c: PBinding; n: PNode): PNode; -var - dest, src: PType; -begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - dest := skipPtrsGeneric(n.typ); - src := skipPtrsGeneric(result.typ); - if inheritanceDiff(src, dest) > 0 then - stackTrace(c, n, errInvalidConversionFromTypeX, typeToString(src)); -end; - -function evalRangeChck(c: PBinding; n: PNode): PNode; -var - x, a, b: PNode; -begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - x := result; - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := result; - - if leValueConv(a, x) and leValueConv(x, b) then begin - result := x; // a <= x and x <= b - result.typ := n.typ - end - else - stackTrace(c, n, errGenerated, - format(msgKindToString(errIllegalConvFromXtoY), - [typeToString(n.sons[0].typ), typeToString(n.typ)])); -end; - -function evalConvStrToCStr(c: PBinding; n: PNode): PNode; -begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - result.typ := n.typ; -end; - -function evalConvCStrToStr(c: PBinding; n: PNode): PNode; -begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - result.typ := n.typ; -end; - -function evalRaise(c: PBinding; n: PNode): PNode; -var - a: PNode; -begin - if n.sons[0] <> nil then begin - result := evalAux(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - a := result; - result := newNodeIT(nkExceptBranch, n.info, a.typ); - addSon(result, a); - c.lastException := result; - end - else if c.lastException <> nil then - result := c.lastException - else begin - stackTrace(c, n, errExceptionAlreadyHandled); - result := newNodeIT(nkExceptBranch, n.info, nil); - addSon(result, nil); - end -end; - -function evalReturn(c: PBinding; n: PNode): PNode; -begin - if n.sons[0] <> nil then begin - result := evalAsgn(c, n.sons[0]); - if result.kind = nkExceptBranch then exit; - end; - result := newNodeIT(nkReturnToken, n.info, nil); -end; - -function evalProc(c: PBinding; n: PNode): PNode; -var - v: PSym; -begin - if n.sons[genericParamsPos] = nil then begin - if (resultPos < sonsLen(n)) and (n.sons[resultPos] <> nil) then begin - v := n.sons[resultPos].sym; - result := getNullValue(v.typ, n.info); - IdNodeTablePut(c.transCon.mapping, v, result); - end; - result := evalAux(c, transform(c, n.sons[codePos])); - if result.kind = nkReturnToken then - result := IdNodeTableGet(c.transCon.mapping, v); - end - else - result := emptyNode -end; - -function evalHigh(c: PBinding; n: PNode): PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - case skipVarGeneric(n.sons[1].typ).kind of - tyOpenArray, tySequence: - result := newIntNodeT(sonsLen(result), n); - tyString: - result := newIntNodeT(length(result.strVal)-1, n); - else InternalError(n.info, 'evalHigh') - end -end; - -function evalSetLengthStr(c: PBinding; n: PNode): PNode; -var - a, b: PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := result; - case a.kind of - nkStrLit..nkTripleStrLit: setLength(a.strVal, int(getOrdValue(b))); - else InternalError(n.info, 'evalSetLengthStr') - end; - result := emptyNode -end; - -function evalSetLengthSeq(c: PBinding; n: PNode): PNode; -var - a, b: PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := result; - if a.kind = nkBracket then setLength(a.sons, int(getOrdValue(b))) - else InternalError(n.info, 'evalSetLengthSeq'); - result := emptyNode -end; - -function evalAssert(c: PBinding; n: PNode): PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - if getOrdValue(result) <> 0 then - result := emptyNode - else - stackTrace(c, n, errAssertionFailed) -end; - -function evalIncl(c: PBinding; n: PNode): PNode; -var - a, b: PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := result; - if not inSet(a, b) then addSon(a, copyTree(b)); - result := emptyNode; -end; - -function evalExcl(c: PBinding; n: PNode): PNode; -var - a, b, r: PNode; - i: int; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := newNodeIT(nkCurly, n.info, n.sons[1].typ); - addSon(b, result); - r := diffSets(a, b); - discardSons(a); - for i := 0 to sonsLen(r)-1 do addSon(a, r.sons[i]); - result := emptyNode; -end; - -function evalAppendStrCh(c: PBinding; n: PNode): PNode; -var - a, b: PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := result; - case a.kind of - nkStrLit..nkTripleStrLit: addChar(a.strVal, chr(int(getOrdValue(b)))); - else InternalError(n.info, 'evalAppendStrCh'); - end; - result := emptyNode; -end; - -function getStrValue(n: PNode): string; -begin - case n.kind of - nkStrLit..nkTripleStrLit: result := n.strVal; - else begin InternalError(n.info, 'getStrValue'); result := '' end; - end -end; - -function evalAppendStrStr(c: PBinding; n: PNode): PNode; -var - a, b: PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := result; - case a.kind of - nkStrLit..nkTripleStrLit: a.strVal := a.strVal +{&} getStrValue(b); - else InternalError(n.info, 'evalAppendStrStr'); - end; - result := emptyNode; -end; - -function evalAppendSeqElem(c: PBinding; n: PNode): PNode; -var - a, b: PNode; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := result; - if a.kind = nkBracket then addSon(a, copyTree(b)) - else InternalError(n.info, 'evalAppendSeqElem'); - result := emptyNode; -end; - -function evalAppendSeqSeq(c: PBinding; n: PNode): PNode; -var - a, b: PNode; - i: int; -begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := result; - if a.kind = nkBracket then - for i := 0 to sonsLen(b)-1 do addSon(a, copyTree(b.sons[i])) - else InternalError(n.info, 'evalAppendSeqSeq'); - result := emptyNode; -end; - -function evalMagicOrCall(c: PBinding; n: PNode): PNode; -var - m: TMagic; - a, b: PNode; - k: biggestInt; - i: int; -begin - m := getMagic(n); - case m of - mNone: result := evalCall(c, n); - mSizeOf: internalError(n.info, 'sizeof() should have been evaluated'); - mHigh: result := evalHigh(c, n); - mAssert: result := evalAssert(c, n); - mExit: result := evalExit(c, n); - mNew, mNewFinalize: result := evalNew(c, n); - mSwap: result := evalSwap(c, n); - mInc: result := evalIncDec(c, n, 1); - ast.mDec: result := evalIncDec(c, n, -1); - mSetLengthStr: result := evalSetLengthStr(c, n); - mSetLengthSeq: result := evalSetLengthSeq(c, n); - mIncl: result := evalIncl(c, n); - mExcl: result := evalExcl(c, n); - mAnd: result := evalAnd(c, n); - mOr: result := evalOr(c, n); - - mAppendStrCh: result := evalAppendStrCh(c, n); - mAppendStrStr: result := evalAppendStrStr(c, n); - mAppendSeqElem: result := evalAppendSeqElem(c, n); - mAppendSeqSeq: result := evalAppendSeqSeq(c, n); - - mNLen: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := newNodeIT(nkIntLit, n.info, n.typ); - case a.kind of - nkEmpty..nkNilLit: begin end; - else result.intVal := sonsLen(a); - end - end; - mNChild: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - k := getOrdValue(result); - if (k >= 0) and (k < sonsLen(a)) - and not (a.kind in [nkEmpty..nkNilLit]) then - result := a.sons[int(k)] - else begin - stackTrace(c, n, errIndexOutOfBounds); - result := emptyNode - end; - end; - mNSetChild: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := result; - result := evalAux(c, n.sons[3]); - if result.kind = nkExceptBranch then exit; - k := getOrdValue(b); - if (k >= 0) and (k < sonsLen(a)) - and not (a.kind in [nkEmpty..nkNilLit]) then - a.sons[int(k)] := result - else - stackTrace(c, n, errIndexOutOfBounds); - result := emptyNode; - end; - mNAdd: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - addSon(a, result); - result := emptyNode - end; - mNAddMultiple: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - for i := 0 to sonsLen(result)-1 do addSon(a, result.sons[i]); - result := emptyNode - end; - mNDel: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := result; - result := evalAux(c, n.sons[3]); - if result.kind = nkExceptBranch then exit; - for i := 0 to int(getOrdValue(result))-1 do - delSon(a, int(getOrdValue(b))); - result := emptyNode; - end; - mNKind: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := newNodeIT(nkIntLit, n.info, n.typ); - result.intVal := ord(a.kind); - end; - mNIntVal: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := newNodeIT(nkIntLit, n.info, n.typ); - case a.kind of - nkCharLit..nkInt64Lit: result.intVal := a.intVal; - else InternalError(n.info, 'no int value') - end - end; - mNFloatVal: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := newNodeIT(nkFloatLit, n.info, n.typ); - case a.kind of - nkFloatLit..nkFloat64Lit: result.floatVal := a.floatVal; - else InternalError(n.info, 'no float value') - end - end; - mNSymbol: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - if result.kind <> nkSym then InternalError(n.info, 'no symbol') - end; - mNIdent: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - if result.kind <> nkIdent then InternalError(n.info, 'no symbol') - end; - mNGetType: result := evalAux(c, n.sons[1]); - mNStrVal: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := newNodeIT(nkStrLit, n.info, n.typ); - case a.kind of - nkStrLit..nkTripleStrLit: result.strVal := a.strVal; - else InternalError(n.info, 'no string value') - end - end; - mNSetIntVal: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - a.intVal := result.intVal; // XXX: exception handling? - result := emptyNode - end; - mNSetFloatVal: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - a.floatVal := result.floatVal; // XXX: exception handling? - result := emptyNode - end; - mNSetSymbol: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - a.sym := result.sym; // XXX: exception handling? - result := emptyNode - end; - mNSetIdent: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - a.ident := result.ident; // XXX: exception handling? - result := emptyNode - end; - mNSetType: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - a.typ := result.typ; // XXX: exception handling? - result := emptyNode - end; - mNSetStrVal: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - a.strVal := result.strVal; // XXX: exception handling? - result := emptyNode - end; - mNNewNimNode: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - k := getOrdValue(result); - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - a := result; - if (k < 0) or (k > ord(high(TNodeKind))) then - internalError(n.info, 'request to create a NimNode with invalid kind'); - if a.kind = nkNilLit then - result := newNodeI(TNodeKind(int(k)), n.info) - else - result := newNodeI(TNodeKind(int(k)), a.info) - end; - mNCopyNimNode: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - result := copyNode(result); - end; - mNCopyNimTree: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - result := copyTree(result); - end; - mStrToIdent: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - if not (result.kind in [nkStrLit..nkTripleStrLit]) then - InternalError(n.info, 'no string node'); - a := result; - result := newNodeIT(nkIdent, n.info, n.typ); - result.ident := getIdent(a.strVal); - end; - mIdentToStr: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - if result.kind <> nkIdent then - InternalError(n.info, 'no ident node'); - a := result; - result := newNodeIT(nkStrLit, n.info, n.typ); - result.strVal := a.ident.s; - end; - mEqIdent: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - b := result; - result := newNodeIT(nkIntLit, n.info, n.typ); - if (a.kind = nkIdent) and (b.kind = nkIdent) then - if a.ident.id = b.ident.id then result.intVal := 1 - end; - mNHint: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - liMessage(n.info, hintUser, getStrValue(result)); - result := emptyNode - end; - mNWarning: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - liMessage(n.info, warnUser, getStrValue(result)); - result := emptyNode - end; - mNError: begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - liMessage(n.info, errUser, getStrValue(result)); - result := emptyNode - end; - else begin - result := evalAux(c, n.sons[1]); - if result.kind = nkExceptBranch then exit; - a := result; - if sonsLen(n) > 2 then begin - result := evalAux(c, n.sons[2]); - if result.kind = nkExceptBranch then exit; - end - else - result := nil; - result := evalOp(m, n, a, result); - end - end -end; - -function evalAux(c: PContext; n: PNode): PNode; -var - i: int; -begin - result := emptyNode; - dec(gNestedEvals); - if gNestedEvals <= 0 then stackTrace(c, n, errTooManyIterations); - case n.kind of // atoms: - nkEmpty: result := n; - nkSym: result := evalSym(c, n); - nkType..pred(nkNilLit): result := copyNode(n); - nkNilLit: result := n; // end of atoms - - nkCall, nkHiddenCallConv, nkMacroStmt: result := evalMagicOrCall(c, n); - nkCurly, nkBracket: begin - result := copyNode(n); - for i := 0 to sonsLen(n)-1 do addSon(result, evalAux(c, n.sons[i])); - end; - nkPar: begin - result := copyTree(n); - for i := 0 to sonsLen(n)-1 do - result.sons[i].sons[1] := evalAux(c, n.sons[i].sons[1]); - end; - nkBracketExpr: result := evalArrayAccess(c, n); - nkDotExpr: result := evalFieldAccess(c, n); - nkDerefExpr, nkHiddenDeref: result := evalDeref(c, n); - nkAddr, nkHiddenAddr: result := evalAddr(c, n); - nkHiddenStdConv, nkHiddenSubConv, nkConv: result := evalConv(c, n); - nkAsgn: result := evalAsgn(c, n); - nkWhenStmt, nkIfStmt, nkIfExpr: result := evalIf(c, n); - nkWhileStmt: result := evalWhile(c, n); - nkCaseStmt: result := evalCase(c, n); - nkVarSection: result := evalVar(c, n); - nkTryStmt: result := evalTry(c, n); - nkRaiseStmt: result := evalRaise(c, n); - nkReturnStmt: result := evalReturn(c, n); - nkBreakStmt, nkReturnToken: result := n; - nkBlockExpr, nkBlockStmt: result := evalBlock(c, n); - nkDiscardStmt: result := evalAux(c, n.sons[0]); - nkCheckedFieldExpr: result := evalCheckedFieldAccess(c, n); - nkObjDownConv: result := evalAux(c, n.sons[0]); - nkObjUpConv: result := evalUpConv(c, n); - nkChckRangeF, nkChckRange64, nkChckRange: result := evalRangeChck(c, n); - nkStringToCString: result := evalConvStrToCStr(c, n); - nkCStringToString: result := evalConvCStrToStr(c, n); - nkPassAsOpenArray: result := evalAux(c, n.sons[0]); - - nkStmtListExpr, nkStmtList, nkModule: begin - for i := 0 to sonsLen(n)-1 do begin - result := evalAux(c, n.sons[i]); - case result.kind of - nkExceptBranch, nkReturnToken, nkBreakStmt: break; - else begin end - end - end - end; - nkProcDef, nkMacroDef, nkCommentStmt: begin end; - nkIdentDefs, nkCast, nkYieldStmt, nkAsmStmt, nkForStmt, nkPragmaExpr, - nkQualified, nkLambda, nkContinueStmt: - stackTrace(c, n, errCannotInterpretNodeX, nodeKindToStr[n.kind]); - else InternalError(n.info, 'evalAux: ' + nodekindToStr[n.kind]); - end; - if result = nil then - InternalError(n.info, 'evalAux: returned nil ' + nodekindToStr[n.kind]); - inc(gNestedEvals); -end; - -function eval(c: PContext; n: PNode): PNode; -begin - gWhileCounter := evalMaxIterations; - gNestedEvals := evalMaxRecDepth; - result := evalAux(c, transform(c, n)); - if result.kind = nkExceptBranch then - stackTrace(c, n, errUnhandledExceptionX, typeToString(result.typ)); -end; - -function semMacroExpr(c: PContext; n: PNode; sym: PSym): PNode; -var - p: PTransCon; -begin - p := newTransCon(); - p.forStmt := n; - setLength(p.params, 2); - p.params[0] := newNodeIT(nkNilLit, n.info, sym.typ.sons[0]); - p.params[1] := n; - pushTransCon(c, p); - {@discard} eval(c, sym.ast.sons[codePos]); - result := p.params[0]; - popTransCon(c); - if cyclicTree(result) then liMessage(n.info, errCyclicTree); - result := semStmt(c, result); - // now, that was easy ... - // and we get more flexibility than in any other programming language -end; diff --git a/nim/extccomp.pas b/nim/extccomp.pas index a6d8cc147..5bc7011c1 100644 --- a/nim/extccomp.pas +++ b/nim/extccomp.pas @@ -15,7 +15,8 @@ interface {$include 'config.inc'} uses - nsystem, nimconf, msgs; + nsystem, charsets, lists, ropes, nos, strutils, platform, condsyms, options, + msgs; // some things are read in from the configuration file @@ -89,7 +90,7 @@ const optSpeed: ' -O -p6 '; optSize: ' -O -p6 '; compilerExe: 'lcc'; - compileTmpl: '-e1 $options $include -Fo$objfile $file'; + compileTmpl: '$options $include -Fo$objfile $file'; buildGui: ' -subsystem windows'; buildDll: ' -dll'; linkerExe: 'lcclnk'; @@ -287,13 +288,10 @@ function NameToCC(const name: string): TSystemCC; procedure initVars; procedure setCC(const ccname: string); +procedure writeMapping(const cfile: string; gSymbolMapping: PRope); implementation -uses - charsets, - lists, options, ropes, nos, strutils, platform, condsyms; - var toLink, toCompile, externalToCompile: TLinkedList; linkOptions: string = ''; @@ -301,16 +299,31 @@ var ccompilerpath: string = ''; -procedure initVars; +procedure setCC(const ccname: string); +var + i: TSystemCC; begin - // BUGFIX: '.' forgotten + linkOptions := ''; + ccompiler := nameToCC(ccname); + if ccompiler = ccNone then rawMessage(errUnknownCcompiler, ccname); compileOptions := getConfigVar(CC[ccompiler].name + '.options.always'); - // have the variables not been initialized? ccompilerpath := getConfigVar(CC[ccompiler].name + '.path'); + for i := low(CC) to high(CC) do undefSymbol(CC[i].name); + defineSymbol(CC[ccompiler].name); +end; + +procedure initVars; +var + i: TSystemCC; +begin // we need to define the symbol here, because ``CC`` may have never been set! - setCC(CC[ccompiler].name); + for i := low(CC) to high(CC) do undefSymbol(CC[i].name); + defineSymbol(CC[ccompiler].name); if gCmd = cmdCompileToCpp then cExt := '.cpp'; + addCompileOption(getConfigVar(CC[ccompiler].name + '.options.always')); + if length(ccompilerPath) = 0 then + ccompilerpath := getConfigVar(CC[ccompiler].name + '.path'); end; function completeCFilePath(const cfile: string; @@ -331,28 +344,28 @@ begin end; -procedure setCC(const ccname: string); -var - i: TSystemCC; +procedure addStr(var dest: string; const src: string); begin - ccompiler := nameToCC(ccname); - if ccompiler = ccNone then - rawMessage(errUnknownCcompiler, ccname); - for i := low(CC) to high(CC) do - undefSymbol(CC[i].name); - defineSymbol(CC[ccompiler].name) + dest := dest +{&} src; +end; + +procedure addOpt(var dest: string; const src: string); +begin + if (length(dest) = 0) or (dest[length(dest)-1+strStart] <> ' ') then + addStr(dest, ' '+''); + addStr(dest, src); end; procedure addCompileOption(const option: string); begin if strutils.findSubStr(option, compileOptions, strStart) < strStart then - compileOptions := compileOptions + ' ' +{&} option + addOpt(compileOptions, option) end; procedure addLinkOption(const option: string); begin if findSubStr(option, linkOptions, strStart) < strStart then - linkOptions := linkOptions + ' ' +{&} option + addOpt(linkOptions, option) end; function toObjFile(const filenameWithoutExt: string): string; @@ -378,9 +391,9 @@ end; procedure execExternalProgram(const cmd: string); begin - if optListCmd in gGlobalOptions then + if (optListCmd in gGlobalOptions) or (gVerbosity > 0) then MessageOut('Executing: ' +{&} nl +{&} cmd); - if ExecuteProcess(cmd) <> 0 then + if executeShellCommand(cmd) <> 0 then rawMessage(errExecutionOfProgramFailed); end; @@ -391,12 +404,7 @@ begin splitPath(projectFile, path, scriptname); SplitFilename(scriptname, name, ext); name := appendFileExt('compile_' + name, platform.os[targetOS].scriptExt); - WriteRope(script, joinPath([path, genSubDir, name])); -end; - -procedure addStr(var dest: string; const src: string); -begin - dest := dest +{&} src; + WriteRope(script, joinPath(path, name)); end; function getOptSpeed(c: TSystemCC): string; @@ -420,17 +428,51 @@ begin result := cc[c].optSize // use default settings from this file end; +const + specialFileA = 42; + specialFileB = 42; +var + fileCounter: int; + function getCompileCFileCmd(const cfilename: string; isExternal: bool = false): string; var - cfile, objfile, options, includeCmd, compilePattern: string; + cfile, objfile, options, includeCmd, compilePattern, key, trunk, exe: string; c: TSystemCC; // an alias to ccompiler begin c := ccompiler; options := compileOptions; - if optCDebug in gGlobalOptions then addStr(options, ' ' + getDebug(c)); - if optOptimizeSpeed in gOptions then addStr(options, ' ' + getOptSpeed(c)) - else if optOptimizeSize in gOptions then addStr(options, ' ' + getOptSize(c)); + trunk := getFileTrunk(cfilename); + if optCDebug in gGlobalOptions then begin + key := trunk + '.debug'; + if existsConfigVar(key) then + addOpt(options, getConfigVar(key)) + else + addOpt(options, getDebug(c)) + end; + if (optOptimizeSpeed in gOptions) then begin + //if ((fileCounter >= specialFileA) and (fileCounter <= specialFileB)) then + key := trunk + '.speed'; + if existsConfigVar(key) then + addOpt(options, getConfigVar(key)) + else + addOpt(options, getOptSpeed(c)) + end + else if optOptimizeSize in gOptions then begin + key := trunk + '.size'; + if existsConfigVar(key) then + addOpt(options, getConfigVar(key)) + else + addOpt(options, getOptSize(c)) + end; + key := trunk + '.always'; + if existsConfigVar(key) then + addOpt(options, getConfigVar(key)); + + exe := cc[c].compilerExe; + key := cc[c].name + '.exe'; + if existsConfigVar(key) then + exe := getConfigVar(key); if (optGenDynLib in gGlobalOptions) and (ospNeedsPIC in platform.OS[targetOS].props) then @@ -441,8 +483,7 @@ begin includeCmd := cc[c].includeCmd; // this is more complex than needed, but // a workaround of a FPC bug... addStr(includeCmd, libpath); - compilePattern := quoteIfSpaceExists( - JoinPath(ccompilerpath, cc[c].compilerExe)); + compilePattern := quoteIfSpaceExists(JoinPath(ccompilerpath, exe)); end else begin includeCmd := ''; @@ -458,7 +499,7 @@ begin else objfile := completeCFilePath(toObjFile(cfile)); - result := compilePattern +{&} ' ' +{&} format(cc[c].compileTmpl, + result := format(compilePattern +{&} ' ' +{&} cc[c].compileTmpl, ['file', AppendFileExt(cfile, cExt), 'objfile', objfile, 'options', options, @@ -476,6 +517,7 @@ var begin it := PStrEntry(list.head); while it <> nil do begin + inc(fileCounter); // call the C compiler for the .c file: compileCmd := getCompileCFileCmd(it.data, isExternal); if not (optCompileOnly in gGlobalOptions) then @@ -491,16 +533,15 @@ end; procedure CallCCompiler(const projectfile: string); var it: PStrEntry; - linkCmd, objfiles, exefile, buildgui, builddll: string; + linkCmd, objfiles, exefile, buildgui, builddll, linkerExe: string; c: TSystemCC; // an alias to ccompiler script: PRope; begin if (gGlobalOptions * [optCompileOnly, optGenScript] = [optCompileOnly]) then exit; // speed up that call if only compiling and no script shall be // generated - initVars(); if (toCompile.head = nil) and (externalToCompile.head = nil) then exit; - //initVars(); + fileCounter := 0; c := ccompiler; script := nil; CompileCFile(toCompile, script, false); @@ -508,10 +549,13 @@ begin if not (optNoLinking in gGlobalOptions) then begin // call the linker: + linkerExe := getConfigVar(cc[c].name + '.linkerexe'); + if length(linkerExe) = 0 then linkerExe := cc[c].linkerExe; + if (hostOS <> targetOS) then - linkCmd := cc[c].linkerExe + linkCmd := linkerExe else - linkCmd := quoteIfSpaceExists(JoinPath(ccompilerpath, cc[c].linkerExe)); + linkCmd := quoteIfSpaceExists(JoinPath(ccompilerpath, linkerExe)); if optGenDynLib in gGlobalOptions then buildDll := cc[c].buildDll @@ -546,7 +590,7 @@ begin it := PStrEntry(it.next); end; - linkCmd := linkCmd +{&} ' ' +{&} format(cc[c].linkTmpl, [ + linkCmd := format(linkCmd +{&} ' ' +{&} cc[c].linkTmpl, [ 'builddll', builddll, 'buildgui', buildgui, 'options', linkOptions, @@ -567,4 +611,28 @@ begin end end; +function genMappingFiles(const list: TLinkedList): PRope; +var + it: PStrEntry; +begin + result := nil; + it := PStrEntry(list.head); + while it <> nil do begin + appf(result, '--file:"$1"$n', [toRope(AppendFileExt(it.data, cExt))]); + it := PStrEntry(it.next); + end; +end; + +procedure writeMapping(const cfile: string; gSymbolMapping: PRope); +var + code: PRope; +begin + if not (optGenMapping in gGlobalOptions) then exit; + code := toRope('[C_Files]'+nl); + app(code, genMappingFiles(toCompile)); + app(code, genMappingFiles(externalToCompile)); + appf(code, '[Symbols]$n$1', [gSymbolMapping]); + WriteRope(code, joinPath(projectPath, 'mapping.txt')); +end; + end. diff --git a/nim/gpl.html b/nim/gpl.html deleted file mode 100644 index 0aec9fff0..000000000 --- a/nim/gpl.html +++ /dev/null @@ -1,493 +0,0 @@ -<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN"> -<html> -<head> -<title>GNU General Public License - GNU Project - Free Software Foundation (FSF)</title> -</head> -<body bgcolor="#FFFFFF" text="#000000" link="#1F00FF" alink="#FF0000" vlink="#9900DD"> -<h1>GNU General Public License</h1> -<hr> -<h2>Table of Contents</h2> -<ul> - <li><a name="TOC1" href="gpl.html#SEC1">GNU GENERAL PUBLIC LICENSE</a> -<ul> -<li><a name="TOC2" href="gpl.html#SEC2">Preamble</a> -<li><a name="TOC3" href="gpl.html#SEC3">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a> -<li><a name="TOC4" href="gpl.html#SEC4">How to Apply These Terms to Your New Programs</a> - -</ul> -</ul> - -<p> - -<hr> - -<p> - - - -<h2><a name="SEC1" href="gpl.html#TOC1">GNU GENERAL PUBLIC LICENSE</a></h2> -<p> -Version 2, June 1991 - -</p> - -<pre> -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -</pre> - - - -<h2><a name="SEC2" href="gpl.html#TOC2">Preamble</a></h2> - -<p> - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - -</p> -<p> - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - -</p> -<p> - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -</p> -<p> - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - -</p> -<p> - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -</p> -<p> - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -</p> -<p> - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - -</p> -<p> - The precise terms and conditions for copying, distribution and -modification follow. - -</p> - - -<h2><a name="SEC3" href="gpl.html#TOC3">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></h2> - - -<p> - -<strong>0.</strong> - This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". -<p> - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - -<p> - -<strong>1.</strong> - You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. -<p> - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. -<p> - -<strong>2.</strong> - You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: -<p> - -<ul> - -<li><strong>a)</strong> - You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - -<p> -<li><strong>b)</strong> - You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - -<p> -<li><strong>c)</strong> - If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) -</ul> - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. -<p> - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. -<p> - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - -<p> - -<strong>3.</strong> - You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - -<!-- we use this doubled UL to get the sub-sections indented, --> -<!-- while making the bullets as unobvious as possible. --> -<ul> - -<li><strong>a)</strong> - Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - -<p> -<li><strong>b)</strong> - Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - -<p> -<li><strong>c)</strong> - Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) -</ul> - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. -<p> - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. -<p> - -<strong>4.</strong> - You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - -<p> - -<strong>5.</strong> - You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - -<p> - -<strong>6.</strong> - Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - -<p> - -<strong>7.</strong> - If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. -<p> - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. -<p> - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. -<p> - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - -<p> - -<strong>8.</strong> - If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - -<p> - -<strong>9.</strong> - The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. -<p> - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - -<p> - - -<strong>10.</strong> - If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - - -<p><strong>NO WARRANTY</strong></p> - -<p> - -<strong>11.</strong> - BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - -<p> - -<strong>12.</strong> - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - -<p> - - -<h2>END OF TERMS AND CONDITIONS</h2> - - - -<h2><a name="SEC4" href="gpl.html#TOC4">How to Apply These Terms to Your New Programs</a></h2> - -<p> - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -</p> -<p> - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - -</p> - -<pre> -<var>one line to give the program's name and an idea of what it does.</var> -Copyright (C) <var>yyyy</var> <var>name of author</var> - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -</pre> - -<p> -Also add information on how to contact you by electronic and paper mail. - -</p> -<p> -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - -</p> - -<pre> -Gnomovision version 69, Copyright (C) <var>year</var> <var>name of author</var> -Gnomovision comes with ABSOLUTELY NO WARRANTY; for details -type `show w'. This is free software, and you are welcome -to redistribute it under certain conditions; type `show c' -for details. -</pre> - -<p> -The hypothetical commands <samp>`show w'</samp> and <samp>`show c'</samp> should show -the appropriate parts of the General Public License. Of course, the -commands you use may be called something other than <samp>`show w'</samp> and -<samp>`show c'</samp>; they could even be mouse-clicks or menu items--whatever -suits your program. - -</p> -<p> -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - -</p> - -<pre> -Yoyodyne, Inc., hereby disclaims all copyright -interest in the program `Gnomovision' -(which makes passes at compilers) written -by James Hacker. - -<var>signature of Ty Coon</var>, 1 April 1989 -Ty Coon, President of Vice -</pre> - -<p> -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. -</body></html> diff --git a/nim/hashes.pas b/nim/hashes.pas index 059a42998..cf5ab03bc 100644 --- a/nim/hashes.pas +++ b/nim/hashes.pas @@ -8,6 +8,8 @@ // unit hashes; +{$include 'config.inc'} + interface uses diff --git a/nim/highlite.pas b/nim/highlite.pas index 8547d9904..5ef4acc12 100644 --- a/nim/highlite.pas +++ b/nim/highlite.pas @@ -358,7 +358,7 @@ begin end end; g.len := pos - g.pos; - assert((g.kind = gtEof) or (g.len > 0)); + if (g.kind <> gtEof) and (g.len <= 0) then InternalError('nimNextToken'); g.pos := pos; end; @@ -633,7 +633,7 @@ begin end end; g.len := pos - g.pos; - assert((g.kind = gtEof) or (g.len > 0)); + if (g.kind <> gtEof) and (g.len <= 0) then InternalError('clikeNextToken'); g.pos := pos; end; @@ -711,7 +711,7 @@ begin langCsharp: csharpNextToken(g); langC: cNextToken(g); langJava: javaNextToken(g); - else assert(false); + else InternalError('getNextToken'); end end; diff --git a/nim/idents.pas b/nim/idents.pas index 8779abb2b..44957ba7a 100644 --- a/nim/idents.pas +++ b/nim/idents.pas @@ -30,7 +30,7 @@ type s: string; next: PIdent; // for hash-table chaining h: THash; // hash value of s - end; + end {@acyclic}; function getIdent(const identifier: string): PIdent; overload; function getIdent(const identifier: string; h: THash): PIdent; overload; diff --git a/nim/importer.pas b/nim/importer.pas index 0658783a3..5c49259c2 100644 --- a/nim/importer.pas +++ b/nim/importer.pas @@ -6,9 +6,26 @@ // See the file "copying.txt", included in this // distribution, for details about the copyright. // +unit importer; // This module implements the symbol importing mechanism. +interface + +{$include 'config.inc'} + +uses + nsystem, charsets, strutils, nos, + ast, astalgo, msgs, options, idents, rodread, lookups, semdata, passes; + +function evalImport(c: PContext; n: PNode): PNode; +function evalFrom(c: PContext; n: PNode): PNode; +procedure importAllSymbols(c: PContext; fromMod: PSym); + +function getModuleFile(n: PNode): string; + +implementation + function findModule(const info: TLineInfo; const modulename: string): string; // returns path to module begin @@ -41,32 +58,45 @@ var check, copy, e: PSym; j: int; etyp: PType; // enumeration type + it: TIdentIter; begin - //copy := copySym(s, true); - //copy.ast := s.ast; + // This does not handle stubs, because otherwise loading on demand would be + // basically pointless. So importing stubs is fine here! copy := s; // do not copy symbols when importing! // check if we have already a symbol of the same name: check := StrTableGet(c.tab.stack[importTablePos], s.name); - if check <> nil then begin + if (check <> nil) and (check.id <> copy.id) then begin if not (s.kind in OverloadableSyms) then begin - {@discard} StrTableIncl(c.AmbigiousSymbols, copy); - {@discard} StrTableIncl(c.AmbigiousSymbols, check); - // s and check need to be qualified + // s and check need to be qualified: + IntSetIncl(c.AmbigiousSymbols, copy.id); + IntSetIncl(c.AmbigiousSymbols, check.id); end end; StrTableAdd(c.tab.stack[importTablePos], copy); if s.kind = skType then begin etyp := s.typ; - if etyp.kind = tyEnum then begin + if etyp.kind in [tyBool, tyEnum] then begin for j := 0 to sonsLen(etyp.n)-1 do begin e := etyp.n.sons[j].sym; - if (e.Kind = skEnumField) then rawImportSymbol(c, e) - else InternalError(s.info, 'rawImportSymbol'); + if (e.Kind <> skEnumField) then + InternalError(s.info, 'rawImportSymbol'); + // BUGFIX: because of aliases for enums the symbol may already + // have been put into the symbol table + // BUGFIX: but only iff they are the same symbols! + check := InitIdentIter(it, c.tab.stack[importTablePos], e.name); + while check <> nil do begin + if check.id = e.id then begin e := nil; break end; + check := NextIdentIter(it, c.tab.stack[importTablePos]); + end; + if e <> nil then rawImportSymbol(c, e); + //check := StrTableGet(c.tab.stack[importTablePos], e.name); + //if (check = nil) or (check.id <> e.id) then + // rawImportSymbol(c, e) end end end else if s.kind = skConverter then - addConverter(c, s); + addConverter(c, s); // rodgen assures that converters are no stubs end; procedure importSymbol(c: PContext; ident: PNode; fromMod: PSym); @@ -78,6 +108,7 @@ begin s := StrTableGet(fromMod.tab, ident.ident); if s = nil then liMessage(ident.info, errUndeclaredIdentifier, ident.ident.s); + if s.kind = skStub then loadStub(s); if not (s.Kind in ExportableSymKinds) then InternalError(ident.info, 'importSymbol: 2'); // for an enumeration we have to add all identifiers @@ -106,7 +137,7 @@ begin if s.kind <> skModule then begin if s.kind <> skEnumField then begin if not (s.Kind in ExportableSymKinds) then - InternalError(s.info, 'importAllSymbols'); + InternalError(s.info, 'importAllSymbols: ' + symKindToStr[s.kind]); rawImportSymbol(c, s); // this is correct! end end; @@ -118,14 +149,15 @@ function evalImport(c: PContext; n: PNode): PNode; var m: PSym; i: int; + f: string; begin - result := copyNode(n); + result := n; for i := 0 to sonsLen(n)-1 do begin - m := c.ImportModule(getModuleFile(n.sons[i]), c.b); + f := getModuleFile(n.sons[i]); + m := gImportModule(f); // ``addDecl`` needs to be done before ``importAllSymbols``! addDecl(c, m); // add symbol to symbol table of module importAllSymbols(c, m); - addSon(result, newSymNode(m)); end; end; @@ -133,24 +165,15 @@ function evalFrom(c: PContext; n: PNode): PNode; var m: PSym; i: int; + f: string; begin result := n; checkMinSonsLen(n, 2); - m := c.ImportModule(getModuleFile(n.sons[0]), c.b); + f := getModuleFile(n.sons[0]); + m := gImportModule(f); n.sons[0] := newSymNode(m); addDecl(c, m); // add symbol to symbol table of module for i := 1 to sonsLen(n)-1 do importSymbol(c, n.sons[i], m); end; -function evalInclude(c: PContext; n: PNode): PNode; -var - i: int; - x: PNode; -begin - result := newNodeI(nkStmtList, n.info); - for i := 0 to sonsLen(n)-1 do begin - x := c.includeFile(getModuleFile(n.sons[i])); - x := semStmt(c, x); - addSon(result, x); - end; -end; +end. diff --git a/nim/instgen.pas b/nim/instgen.pas deleted file mode 100644 index e64034f9e..000000000 --- a/nim/instgen.pas +++ /dev/null @@ -1,267 +0,0 @@ -// -// -// The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf -// -// See the file "copying.txt", included in this -// distribution, for details about the copyright. -// - -// This module does the instantiation of generic procs and types. - -function generateInstance(c: PContext; fn: PSym; const pt: TIdTable; - const instantiator: TLineInfo): PSym; forward; -// generates an instantiated proc - -type - TInstantiateClosure = object(NObject) - mapping: TIdTable; // map {ptype, psym} to {ptype, psym} - fn: PSym; - module: PSym; - newOwner: PSym; - instantiator: TLineInfo; - end; - PInstantiateClosure = ^TInstantiateClosure; - PInstClosure = PInstantiateClosure; - -function instantiateTree(c: PInstantiateClosure; t: PNode): PNode; forward; -function instantiateSym(c: PInstantiateClosure; sym: PSym): PSym; forward; -function instantiateType(c: PInstantiateClosure; typ: PType): PType; forward; - -function containsGenericTypeIter(t: PType; closure: PObject): bool; -begin - result := t.kind in GenericTypes; -end; - -function containsGenericType(t: PType): bool; -begin - result := iterOverType(t, containsGenericTypeIter, nil); -end; - -function instTypeNode(c: PInstantiateClosure; n: PNode): PNode; -var - i: int; -begin - result := nil; - if n <> nil then begin - result := copyNode(n); - result.typ := instantiateType(c, n.typ); - case n.kind of - nkNone..nkNilLit: begin // a leaf - end; - else begin - for i := 0 to sonsLen(n)-1 do - addSon(result, instTypeNode(c, n.sons[i])); - end - end - end -end; - -function instantiateType(c: PInstantiateClosure; typ: PType): PType; -var - i: int; -begin - result := PType(idTableGet(c.mapping, typ)); - if result <> nil then exit; - if containsGenericType(typ) then begin - result := copyType(typ, c.newOwner); - idTablePut(c.mapping, typ, result); // to avoid cycles - for i := 0 to sonsLen(result)-1 do - result.sons[i] := instantiateType(c, result.sons[i]); - if result.n <> nil then - result.n := instTypeNode(c, result.n); - end - else - result := typ; - if result.Kind in GenericTypes then begin - liMessage(c.instantiator, errCannotInstantiateX, - TypeToString(typ, preferName)); - end - else if result.kind = tyVar then begin - if result.sons[0].kind = tyVar then - liMessage(c.instantiator, errVarVarTypeNotAllowed); - end; -end; - -function instantiateSym(c: PInstantiateClosure; sym: PSym): PSym; -begin - if sym = nil then begin result := nil; exit end; // BUGFIX - result := PSym(idTableGet(c.mapping, sym)); - if (result = nil) then begin - if (sym.owner.id = c.fn.id) or (sym.id = c.fn.id) then begin - result := copySym(sym); - if sym.id = c.fn.id then c.newOwner := result; - include(result.flags, sfIsCopy); - idTablePut(c.mapping, sym, result); // BUGFIX - result.typ := instantiateType(c, sym.typ); - if (result.owner <> nil) and (result.owner.kind = skModule) then - result.owner := c.module // BUGFIX - else - result.owner := instantiateSym(c, result.owner); - if sym.ast <> nil then begin - result.ast := instantiateTree(c, sym.ast); - end - end - else - result := sym // do not copy t! - end -end; - -function instantiateTree(c: PInstantiateClosure; t: PNode): PNode; -var - len, i: int; -begin - if t = nil then begin result := nil; exit end; - result := copyNode(t); - if result.typ <> nil then result.typ := instantiateType(c, result.typ); - case t.kind of - nkNone..pred(nkSym), succ(nkSym)..nkNilLit: begin end; - nkSym: begin - if result.sym <> nil then result.sym := instantiateSym(c, result.sym); - end - else begin - len := sonsLen(t); - if len > 0 then begin - newSons(result, len); - for i := 0 to len-1 do - result.sons[i] := instantiateTree(c, t.sons[i]); - end - end - end -end; - -procedure instantiateGenericParamList(c: PContext; n: PNode; - const pt: TIdTable); -var - i: int; - s, q: PSym; - t: PType; -begin - assert(n.kind = nkGenericParams); - for i := 0 to sonsLen(n)-1 do begin - if n.sons[i].kind = nkDefaultTypeParam then begin - internalError(n.sons[i].info, - 'instantiateGenericParamList() to implement'); - // XXX - end; - assert(n.sons[i].kind = nkSym); - q := n.sons[i].sym; - s := newSym(skType, q.name, getCurrOwner(c)); - t := PType(IdTableGet(pt, q.typ)); - if t = nil then - liMessage(n.sons[i].info, errCannotInstantiateX, s.name.s); - assert(t.kind <> tyGenericParam); - s.typ := t; - addDecl(c, s); - end -end; - -function GenericCacheGet(c: PContext; genericSym, instSym: PSym): PSym; -var - i: int; - a, b: PSym; -begin - result := nil; - for i := 0 to sonsLen(c.generics)-1 do begin - if c.generics.sons[i].kind <> nkExprEqExpr then - InternalError(genericSym.info, 'GenericCacheGet'); - a := c.generics.sons[i].sons[0].sym; - if genericSym.id = a.id then begin - b := c.generics.sons[i].sons[1].sym; - if equalParams(b.typ.n, instSym.typ.n) = paramsEqual then begin - result := b; exit - end - end - end -end; - -procedure GenericCacheAdd(c: PContext; genericSym, instSym: PSym); -var - n: PNode; -begin - n := newNode(nkExprEqExpr); - addSon(n, newSymNode(genericSym)); - addSon(n, newSymNode(instSym)); - addSon(c.generics, n); -end; - -procedure semParamList(c: PContext; n: PNode; s: PSym); forward; -procedure addParams(c: PContext; n: PNode); forward; -procedure addResult(c: PContext; t: PType; const info: TLineInfo); forward; -procedure addResultNode(c: PContext; n: PNode); forward; - -function generateInstance(c: PContext; fn: PSym; const pt: TIdTable; - const instantiator: TLineInfo): PSym; -// generates an instantiated proc -var - oldPrc: PSym; - oldP: PProcCon; - n: PNode; -begin - oldP := c.p; // restore later - result := copySym(fn); - result.owner := getCurrOwner(c); - n := copyTree(fn.ast); - result.ast := n; - pushOwner(c, result); - openScope(c.tab); - assert(n.sons[genericParamsPos] <> nil); - n.sons[namePos] := newSymNode(result); - pushInfoContext(instantiator); - - instantiateGenericParamList(c, n.sons[genericParamsPos], pt); - n.sons[genericParamsPos] := nil; - // semantic checking for the parameters: - if n.sons[paramsPos] <> nil then begin - semParamList(c, n.sons[ParamsPos], result); - addParams(c, result.typ.n); - end - else begin - result.typ := newTypeS(tyProc, c); - addSon(result.typ, nil); - end; - - // now check if we have already such a proc generated - oldPrc := GenericCacheGet(c, fn, result); - if oldPrc = nil then begin - // add it here, so that recursive generic procs are possible: - addDecl(c, result); - if n.sons[codePos] <> nil then begin - c.p := newProcCon(result); - if result.kind in [skProc, skConverter] then begin - addResult(c, result.typ.sons[0], n.info); - addResultNode(c, n); - end; - n.sons[codePos] := semStmtScope(c, n.sons[codePos]); - end; - GenericCacheAdd(c, fn, result); - end - else - result := oldPrc; - popInfoContext(); - closeScope(c.tab); // close scope for parameters - popOwner(c); - c.p := oldP; // restore -end; - -function generateTypeInstance(p: PContext; const pt: TIdTable; - const instantiator: TLineInfo; t: PType): PType; -var - c: PInstantiateClosure; -begin - new(c); -{@ignore} - fillChar(c^, sizeof(c^), 0); -{@emit} - c.mapping := pt; // making a copy is not necessary - c.fn := nil; - c.instantiator := instantiator; - c.module := p.module; - c.newOwner := getCurrOwner(p); - result := instantiateType(c, t); -end; - -function partialSpecialization(c: PContext; n: PNode; s: PSym): PNode; -begin - result := n; -end; diff --git a/nim/lexbase.pas b/nim/lexbase.pas index c840dc6d2..11200f652 100644 --- a/nim/lexbase.pas +++ b/nim/lexbase.pas @@ -16,7 +16,7 @@ unit lexbase; interface uses - nsystem, charsets, strutils; + nsystem, llstream, charsets, strutils; {@emit const @@ -44,25 +44,21 @@ const type TBaseLexer = object(NObject) bufpos: int; - buf: PChar; // NOT zero terminated! + buf: PChar; bufLen: int; // length of buffer in characters - f: TBinaryFile; // we use a binary file here for efficiency + stream: PLLStream; // we read from this stream LineNumber: int; // the current line number // private data: sentinel: int; lineStart: int; // index of last line start in buffer - fileOpened: boolean; end; -function initBaseLexer(out L: TBaseLexer; - const filename: string; - bufLen: int = 8192): boolean; +procedure openBaseLexer(out L: TBaseLexer; + inputstream: PLLStream; + bufLen: int = 8192); // 8K is a reasonable buffer size -procedure initBaseLexerFromBuffer(out L: TBaseLexer; - const buffer: string); - -procedure deinitBaseLexer(var L: TBaseLexer); +procedure closeBaseLexer(var L: TBaseLexer); function getCurrentLine(const L: TBaseLexer; marker: boolean = true): string; function getColNumber(const L: TBaseLexer; pos: int): int; @@ -82,10 +78,10 @@ implementation const chrSize = sizeof(char); -procedure deinitBaseLexer(var L: TBaseLexer); +procedure closeBaseLexer(var L: TBaseLexer); begin dealloc(L.buf); - if L.fileOpened then closeFile(L.f); + LLStreamClose(L.stream); end; {@ignore} @@ -119,8 +115,8 @@ begin if toCopy > 0 then MoveMem(L.buf, addr(L.buf[L.sentinel+1]), toCopy * chrSize); // "moveMem" handles overlapping regions - charsRead := ReadBuffer(L.f, addr(L.buf[toCopy]), (L.sentinel+1) * chrSize) - div chrSize; + charsRead := LLStreamRead(L.stream, addr(L.buf[toCopy]), + (L.sentinel+1) * chrSize) div chrSize; s := toCopy + charsRead; if charsRead < L.sentinel+1 then begin L.buf[s] := EndOfFile; // set end marker @@ -144,8 +140,8 @@ begin L.bufLen := L.BufLen * 2; L.buf := {@cast}PChar(realloc(L.buf, L.bufLen*chrSize)); assert(L.bufLen - oldBuflen = oldBufLen); - charsRead := ReadBuffer(L.f, addr(L.buf[oldBufLen]), oldBufLen*chrSize) - div chrSize; + charsRead := LLStreamRead(L.stream, addr(L.buf[oldBufLen]), + oldBufLen*chrSize) div chrSize; if charsRead < oldBufLen then begin L.buf[oldBufLen+charsRead] := EndOfFile; L.sentinel := oldBufLen+charsRead; @@ -198,8 +194,8 @@ begin end end; -function initBaseLexer(out L: TBaseLexer; const filename: string; - bufLen: int = 8192): boolean; +procedure openBaseLexer(out L: TBaseLexer; inputstream: PLLStream; + bufLen: int = 8192); begin assert(bufLen > 0); L.bufpos := 0; @@ -208,30 +204,8 @@ begin L.sentinel := bufLen-1; L.lineStart := 0; L.linenumber := 1; // lines start at 1 - L.fileOpened := openFile(L.f, filename); - result := L.fileOpened; - if result then begin - fillBuffer(L); - skip_UTF_8_BOM(L) - end; -end; - -procedure initBaseLexerFromBuffer(out L: TBaseLexer; - const buffer: string); -begin - L.bufpos := 0; - L.bufLen := length(buffer)+1; - L.buf := {@cast}PChar(alloc(L.bufLen * chrSize)); - L.sentinel := L.bufLen-1; - L.lineStart := 0; - L.linenumber := 1; // lines start at 1 - L.fileOpened := false; - if L.bufLen > 0 then begin - copyMem(L.buf, {@cast}pointer(buffer), L.bufLen); - L.buf[L.bufLen-1] := EndOfFile; - end - else - L.buf[0] := EndOfFile; + L.stream := inputstream; + fillBuffer(L); skip_UTF_8_BOM(L); end; diff --git a/nim/lookup.pas b/nim/lookup.pas deleted file mode 100644 index 192dba7ca..000000000 --- a/nim/lookup.pas +++ /dev/null @@ -1,237 +0,0 @@ -// -// -// The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf -// -// See the file "copying.txt", included in this -// distribution, for details about the copyright. -// - -// This module implements lookup helpers. - -function getSymRepr(s: PSym): string; -begin - case s.kind of - skProc, skConverter, skIterator: result := getProcHeader(s); - else result := s.name.s - end -end; - -procedure CloseScope(var tab: TSymTab); -var - it: TTabIter; - s: PSym; -begin - // check if all symbols have been used and defined: - if (tab.tos > length(tab.stack)) then InternalError('CloseScope'); - s := InitTabIter(it, tab.stack[tab.tos-1]); - while s <> nil do begin - if sfForward in s.flags then - liMessage(s.info, errImplOfXexpected, getSymRepr(s)) - else if ([sfUsed, sfInInterface] * s.flags = []) and - (optHints in s.options) then // BUGFIX: check options in s! - if not (s.kind in [skForVar, skParam]) then - liMessage(s.info, hintXDeclaredButNotUsed, getSymRepr(s)); - s := NextIter(it, tab.stack[tab.tos-1]); - end; - astalgo.rawCloseScope(tab); -end; - -procedure AddSym(var t: TStrTable; n: PSym); -begin - if StrTableIncl(t, n) then liMessage(n.info, errAttemptToRedefine, n.name.s); -end; - -procedure addDecl(c: PContext; sym: PSym); -begin - if SymTabAddUnique(c.tab, sym) = Failure then - liMessage(sym.info, errAttemptToRedefine, sym.Name.s); -end; - -procedure addDeclAt(c: PContext; sym: PSym; at: Natural); -begin - if SymTabAddUniqueAt(c.tab, sym, at) = Failure then - liMessage(sym.info, errAttemptToRedefine, sym.Name.s); -end; - -procedure addOverloadableSymAt(c: PContext; fn: PSym; at: Natural); -var - check: PSym; -begin - if not (fn.kind in OverloadableSyms) then - InternalError(fn.info, 'addOverloadableSymAt'); - check := StrTableGet(c.tab.stack[at], fn.name); - if (check <> nil) and (check.Kind <> fn.kind) then - liMessage(fn.info, errAttemptToRedefine, fn.Name.s); - SymTabAddAt(c.tab, fn, at); -end; - -procedure AddInterfaceDeclAux(c: PContext; sym: PSym); -begin - if (sfInInterface in sym.flags) then begin - // add to interface: - if c.module = nil then InternalError(sym.info, 'AddInterfaceDeclAux'); - StrTableAdd(c.module.tab, sym); - end; - if getCurrOwner(c).kind = skModule then - include(sym.flags, sfGlobal) -end; - -procedure addInterfaceDecl(c: PContext; sym: PSym); -begin // it adds the symbol to the interface if appropriate - addDecl(c, sym); - AddInterfaceDeclAux(c, sym); -end; - -procedure addInterfaceOverloadableSymAt(c: PContext; sym: PSym; at: int); -begin // it adds the symbol to the interface if appropriate - addOverloadableSymAt(c, sym, at); - AddInterfaceDeclAux(c, sym); -end; - -function lookUp(c: PContext; n: PNode): PSym; -// Looks up a symbol. Generates an error in case of nil. -begin - case n.kind of - nkAccQuoted: result := lookup(c, n.sons[0]); - nkSym: begin - result := SymtabGet(c.Tab, n.sym.name); - if result = nil then - liMessage(n.info, errUndeclaredIdentifier, n.sym.name.s); - include(result.flags, sfUsed); - end; - nkIdent: begin - result := SymtabGet(c.Tab, n.ident); - if result = nil then - liMessage(n.info, errUndeclaredIdentifier, n.ident.s); - include(result.flags, sfUsed); - end - else InternalError(n.info, 'lookUp'); - end -end; - -function QualifiedLookUp(c: PContext; n: PNode; ambigiousCheck: bool): PSym; -var - m: PSym; - ident: PIdent; -begin - case n.kind of - nkIdent: begin - result := SymtabGet(c.Tab, n.ident); - if result = nil then - liMessage(n.info, errUndeclaredIdentifier, n.ident.s) - else if ambigiousCheck - and StrTableContains(c.AmbigiousSymbols, result) then - liMessage(n.info, errUseQualifier, n.ident.s) - end; - nkSym: begin - result := SymtabGet(c.Tab, n.sym.name); - if result = nil then - liMessage(n.info, errUndeclaredIdentifier, n.sym.name.s) - else if ambigiousCheck - and StrTableContains(c.AmbigiousSymbols, result) then - liMessage(n.info, errUseQualifier, n.sym.name.s) - end; - nkDotExpr, nkQualified: begin - result := nil; - m := qualifiedLookUp(c, n.sons[0], false); - if (m <> nil) and (m.kind = skModule) then begin - if (n.sons[1].kind = nkIdent) then begin - ident := n.sons[1].ident; - if m = c.module then - // a module may access its private members: - result := StrTableGet(c.tab.stack[ModuleTablePos], ident) - else - result := StrTableGet(m.tab, ident); - if result = nil then - liMessage(n.sons[1].info, errUndeclaredIdentifier, ident.s) - end - else - liMessage(n.sons[1].info, errIdentifierExpected, ''); - end - end; - nkAccQuoted: result := QualifiedLookup(c, n.sons[0], ambigiousCheck); - else begin - result := nil; - //liMessage(n.info, errIdentifierExpected, '') - end; - end; -end; - -type - TOverloadIterMode = (oimNoQualifier, oimSelfModule, oimOtherModule); - TOverloadIter = record - stackPtr: int; - it: TIdentIter; - m: PSym; - mode: TOverloadIterMode; - end; - -function InitOverloadIter(out o: TOverloadIter; c: PContext; n: PNode): PSym; -var - ident: PIdent; -begin - result := nil; - case n.kind of - nkIdent: begin - o.stackPtr := c.tab.tos; - o.mode := oimNoQualifier; - while (result = nil) do begin - dec(o.stackPtr); - if o.stackPtr < 0 then break; - result := InitIdentIter(o.it, c.tab.stack[o.stackPtr], n.ident); - end; - end; - nkSym: begin - o.stackPtr := c.tab.tos; - o.mode := oimNoQualifier; - while (result = nil) do begin - dec(o.stackPtr); - if o.stackPtr < 0 then break; - result := InitIdentIter(o.it, c.tab.stack[o.stackPtr], n.sym.name); - end; - end; - nkDotExpr, nkQualified: begin - o.mode := oimOtherModule; - o.m := qualifiedLookUp(c, n.sons[0], false); - if (o.m <> nil) and (o.m.kind = skModule) then begin - if (n.sons[1].kind = nkIdent) then begin - ident := n.sons[1].ident; - if o.m = c.module then begin - // a module may access its private members: - result := InitIdentIter(o.it, c.tab.stack[ModuleTablePos], ident); - o.mode := oimSelfModule; - end - else - result := InitIdentIter(o.it, o.m.tab, ident); - end - else - liMessage(n.sons[1].info, errIdentifierExpected, ''); - end - end; - nkAccQuoted: result := InitOverloadIter(o, c, n.sons[0]); - else begin end - end -end; - -function nextOverloadIter(var o: TOverloadIter; c: PContext; n: PNode): PSym; -begin - case o.mode of - oimNoQualifier: begin - if n.kind = nkAccQuoted then - result := nextOverloadIter(o, c, n.sons[0]) // BUGFIX - else if o.stackPtr >= 0 then begin - result := nextIdentIter(o.it, c.tab.stack[o.stackPtr]); - while (result = nil) do begin - dec(o.stackPtr); - if o.stackPtr < 0 then break; - result := InitIdentIter(o.it, c.tab.stack[o.stackPtr], o.it.name); - // BUGFIX: o.it.name <-> n.ident - end - end - else result := nil; - end; - oimSelfModule: result := nextIdentIter(o.it, c.tab.stack[ModuleTablePos]); - oimOtherModule: result := nextIdentIter(o.it, o.m.tab); - end -end; diff --git a/nim/magicsys.pas b/nim/magicsys.pas index 2f314065d..55ec0b002 100644 --- a/nim/magicsys.pas +++ b/nim/magicsys.pas @@ -8,8 +8,7 @@ // unit magicsys; -// This module declares built-in System types like int or string in the -// system module. +// Built-in types and compilerprocs are registered here. interface @@ -17,44 +16,102 @@ interface uses nsystem, - ast, astalgo, hashes, msgs, platform, nversion, ntime, idents; + ast, astalgo, hashes, msgs, platform, nversion, ntime, idents, rodread; var // magic symbols in the system module: - notSym: PSym; // 'not' operator (for bool) - countUpSym: PSym; // countup iterator - SystemModule: PSym; - intSetBaseType: PType; - - compilerprocs: TStrTable; +procedure registerSysType(t: PType); function getSysType(const kind: TTypeKind): PType; -function getMatic(m: TMagic; const name: string): PSym; + function getCompilerProc(const name: string): PSym; +procedure registerCompilerProc(s: PSym); procedure InitSystem(var tab: TSymTab); procedure FinishSystem(const tab: TStrTable); -procedure setSize(t: PType; size: int); - implementation var gSysTypes: array [TTypeKind] of PType; + compilerprocs: TStrTable; + +procedure registerSysType(t: PType); +begin + if gSysTypes[t.kind] = nil then gSysTypes[t.kind] := t; +end; + +function newSysType(kind: TTypeKind; size: int): PType; +begin + result := newType(kind, systemModule); + result.size := size; + result.align := size; +end; + +function sysTypeFromName(const name: string): PType; +var + s: PSym; +begin + s := StrTableGet(systemModule.tab, getIdent(name)); + if s = nil then rawMessage(errSystemNeeds, name); + if s.kind = skStub then loadStub(s); + result := s.typ; +end; function getSysType(const kind: TTypeKind): PType; begin result := gSysTypes[kind]; - assert(result <> nil); + if result = nil then begin + case kind of + tyInt: result := sysTypeFromName('int'); + tyInt8: result := sysTypeFromName('int8'); + tyInt16: result := sysTypeFromName('int16'); + tyInt32: result := sysTypeFromName('int32'); + tyInt64: result := sysTypeFromName('int64'); + tyFloat: result := sysTypeFromName('float'); + tyFloat32: result := sysTypeFromName('float32'); + tyFloat64: result := sysTypeFromName('float64'); + tyBool: result := sysTypeFromName('bool'); + tyChar: result := sysTypeFromName('char'); + tyString: result := sysTypeFromName('string'); + tyCstring: result := sysTypeFromName('cstring'); + tyPointer: result := sysTypeFromName('pointer'); + tyAnyEnum: result := newSysType(tyAnyEnum, 1); + tyNil: result := newSysType(tyNil, ptrSize); + else InternalError('request for typekind: ' + typeKindToStr[kind]); + end; + gSysTypes[kind] := result; + end; + if result.kind <> kind then + InternalError('wanted: ' + typeKindToStr[kind] + +{&} ' got: ' +{&} typeKindToStr[result.kind]); + if result = nil then InternalError('type not found: ' + typeKindToStr[kind]); end; - function getCompilerProc(const name: string): PSym; +var + ident: PIdent; begin - result := StrTableGet(compilerprocs, getIdent(name, getNormalizedHash(name))); - if result = nil then rawMessage(errSystemNeeds, name) + ident := getIdent(name, getNormalizedHash(name)); + result := StrTableGet(compilerprocs, ident); + if result = nil then begin + result := StrTableGet(rodCompilerProcs, ident); + if result = nil then rawMessage(errSystemNeeds, name); + strTableAdd(compilerprocs, result); + if result.kind = skStub then loadStub(result); + // A bit hacky that this code is needed here, but it is the easiest + // solution in order to avoid special cases for sfCompilerProc in the + // rodgen module. Another solution would be to always recompile the system + // module. But I don't want to do that as that would mean less testing of + // the new symbol file cache (and worse performance). + end; end; +procedure registerCompilerProc(s: PSym); +begin + strTableAdd(compilerprocs, s); +end; +(* function FindMagic(const tab: TStrTable; m: TMagic; const s: string): PSym; var ti: TIdentIter; @@ -66,11 +123,6 @@ begin end end; -function getMatic(m: TMagic; const name: string): PSym; -begin - result := findMagic(systemModule.tab, m, name); -end; - function NewMagic(kind: TSymKind; const name: string; const info: TLineInfo): PSym; begin @@ -84,7 +136,6 @@ function newMagicType(const info: TLineInfo; kind: TTypeKind; begin result := newType(kind, SystemModule); result.sym := magicSym; - assert(SystemModule <> nil); end; procedure setSize(t: PType; size: int); @@ -93,15 +144,6 @@ begin t.size := size; end; - -// not -(unary) 700 -// * / div mod 600 -// + - 500 -// & .. 400 -// == <= < >= > != in not_in 300 -// and 200 -// or xor 100 - procedure addMagicSym(var tab: TSymTab; sym: PSym; sys: PSym); begin SymTabAdd(tab, sym); @@ -132,13 +174,10 @@ begin s.typ := newMagicType(fakeInfo, tyAnyEnum, s); SymTabAdd(tab, s); end; - +*) procedure InitSystem(var tab: TSymTab); -var - c: PSym; - typ: PType; -begin - initStrTable(compilerprocs); +begin (* + if SystemModule = nil then InternalError('systemModule == nil'); fakeInfo := newLineInfo('system.nim', 1, 1); // symbols with compiler magic are pretended to be in system at line 1 @@ -209,25 +248,26 @@ begin intSetBaseType := newMagicType(fakeInfo, tyRange, nil); addSon(intSetBaseType, gSysTypes[tyInt]); // base type setSize(intSetBaseType, int(gSysTypes[tyInt].size)); - intSetBaseType.n := newNode(nkRange); - intSetBaseType.n.info := fakeInfo; + intSetBaseType.n := newNodeI(nkRange, fakeInfo); addSon(intSetBaseType.n, newIntNode(nkIntLit, 0)); addSon(intSetBaseType.n, newIntNode(nkIntLit, nversion.MaxSetElements-1)); intSetBaseType.n.sons[0].info := fakeInfo; intSetBaseType.n.sons[1].info := fakeInfo; intSetBaseType.n.sons[0].typ := gSysTypes[tyInt]; - intSetBaseType.n.sons[1].typ := gSysTypes[tyInt]; + intSetBaseType.n.sons[1].typ := gSysTypes[tyInt]; *) end; procedure FinishSystem(const tab: TStrTable); -begin +begin (* notSym := findMagic(tab, mNot, 'not'); if (notSym = nil) then rawMessage(errSystemNeeds, 'not'); countUpSym := StrTableGet(tab, getIdent('countup')); if (countUpSym = nil) then - rawMessage(errSystemNeeds, 'countup'); + rawMessage(errSystemNeeds, 'countup'); *) end; +initialization + initStrTable(compilerprocs); end. diff --git a/nim/main.pas b/nim/main.pas index 6e0afda98..7cf3fbd0a 100644 --- a/nim/main.pas +++ b/nim/main.pas @@ -15,10 +15,11 @@ unit main; interface uses - nsystem, strutils, ast, astalgo, scanner, pnimsyn, rnimsyn, options, msgs, - nos, lists, condsyms, paslex, pasparse, rodgen, ropes, trees, - wordrecg, sem, idents, magicsys, backends, docgen, extccomp, cgen, - platform, ecmasgen; + nsystem, llstream, strutils, ast, astalgo, scanner, pnimsyn, rnimsyn, + options, msgs, nos, lists, condsyms, paslex, pasparse, rodread, rodwrite, + ropes, trees, wordrecg, sem, semdata, idents, passes, docgen, + extccomp, cgen, ecmasgen, platform, ptmplsyn, interact, nimconf, importer, + passaux, depends, transf, evals, types; procedure MainCommand(const cmd, filename: string); @@ -33,7 +34,7 @@ type end; TFileModuleMap = array of TFileModuleRec; var - compMods: TFileModuleMap = {@ignore} nil {@emit []}; + compMods: TFileModuleMap = {@ignore} nil {@emit @[]}; // all compiled modules procedure registerModule(const filename: string; module: PSym); @@ -58,28 +59,17 @@ end; // ---------------------------------------------------------------------------- -function getFileTrunk(const filename: string): string; -var - f, e, dir: string; -begin - splitPath(filename, dir, f); - splitFilename(f, result, e); -end; - -function newIsMainModuleSym(module: PSym; isMainModule: bool): PSym; -begin - result := newSym(skConst, getIdent('isMainModule'), module); - result.info := module.info; - result.typ := getSysType(tyBool); - result.ast := newIntNode(nkIntLit, ord(isMainModule)); - result.ast.typ := result.typ; - StrTableAdd(module.tab, result); - if isMainModule then include(module.flags, sfMainModule); -end; - function newModule(const filename: string): PSym; begin - result := newSym(skModule, getIdent(getFileTrunk(filename)), nil); + // We cannot call ``newSym`` here, because we have to circumvent the ID + // mechanism, which we do in order to assign each module a persistent ID. + new(result); +{@ignore} + fillChar(result^, sizeof(result^), 0); +{@emit} + result.id := -1; // for better error checking + result.kind := skModule; + result.name := getIdent(getFileTrunk(filename)); result.owner := result; // a module belongs to itself result.info := newLineInfo(filename, 1, 1); include(result.flags, sfUsed); @@ -89,173 +79,83 @@ begin StrTableAdd(result.tab, result); // a module knows itself end; -procedure msgCompiling(const modname: string); -begin - if optVerbose in gGlobalOptions then MessageOut('compiling: ' + modname); -end; - -procedure msgCompiled(const modname: string); -begin - if optVerbose in gGlobalOptions then MessageOut('compiled: ' + modname); -end; - -function CompileModule(const filename: string; backend: PBackend; +function CompileModule(const filename: string; isMainFile, isSystemFile: bool): PSym; forward; -function importModule(const filename: string; backend: PBackend): PSym; +function importModule(const filename: string): PSym; // this is called by the semantic checking phase begin result := getModule(filename); if result = nil then begin // compile the module - // XXX: here caching could be implemented - result := compileModule(filename, backend, false, false); + result := compileModule(filename, false, false); end else if sfSystemModule in result.flags then liMessage(result.info, errAttemptToRedefine, result.Name.s); end; -function CompileModule(const filename: string; backend: PBackend; +function CompileModule(const filename: string; isMainFile, isSystemFile: bool): PSym; var - ast: PNode; - c: PContext; + rd: PRodReader; + f: string; begin + rd := nil; + f := appendFileExt(filename, nimExt); result := newModule(filename); - result.info := newLineInfo(filename, 1, 1); - msgCompiling(result.name.s); - ast := parseFile(appendFileExt(filename, nimExt)); - if ast = nil then exit; - c := newContext(filename); - c.b := backend.backendCreator(backend, result, filename); - c.module := result; - c.includeFile := parseFile; - c.importModule := importModule; - openScope(c.tab); // scope for imported symbols - SymTabAdd(c.tab, result); - if not isSystemFile then begin - SymTabAdd(c.tab, magicsys.SystemModule); // import the "System" identifier - importAllSymbols(c, magicsys.SystemModule); - SymTabAdd(c.tab, newIsMainModuleSym(result, isMainFile)); + if isMainFile then include(result.flags, sfMainModule); + if isSystemFile then include(result.flags, sfSystemModule); + if (gCmd = cmdCompileToC) or (gCmd = cmdCompileToCpp) then begin + rd := handleSymbolFile(result, f); + if result.id < 0 then + InternalError('handleSymbolFile should have set the module''s ID'); end - else begin - include(result.flags, sfSystemModule); - magicsys.SystemModule := result; // set global variable! - InitSystem(c.tab); // adds magics like "int", "ord" to the system module - end; - {@discard} semModule(c, ast); - rawCloseScope(c.tab); // imported symbols; don't check for unused ones! - msgCompiled(result.name.s); + else + result.id := getID(); + processModule(result, f, nil, rd); end; -procedure CompileProject(const filename: string; backend: PBackend); +procedure CompileProject(const filename: string); begin {@discard} CompileModule( - JoinPath(options.libpath, appendFileExt('system', nimExt)), - backend, false, true); - {@discard} CompileModule(filename, backend, true, false); + JoinPath(options.libpath, appendFileExt('system', nimExt)), false, true); + {@discard} CompileModule(filename, true, false); end; -// ------------ dependency generator ---------------------------------------- - -var - gDotGraph: PRope; // the generated DOT file; we need a global variable - -procedure addDependencyAux(importing, imported: PSym); +procedure semanticPasses; begin - appf(gDotGraph, '$1 -> $2;$n', [toRope(importing.name.s), - toRope(imported.name.s)]); - // s1 -> s2_4 [label="[0-9]"]; -end; - -procedure addDotDependency(b: PBackend; n: PNode); -var - i: int; -begin - if n = nil then exit; - case n.kind of - nkEmpty..nkNilLit: begin end; // atom - nkImportStmt: begin - for i := 0 to sonsLen(n)-1 do begin - assert(n.sons[i].kind = nkSym); - addDependencyAux(b.module, n.sons[i].sym); - end - end; - nkFromStmt: begin - assert(n.sons[0].kind = nkSym); - addDependencyAux(b.module, n.sons[0].sym); - end; - nkStmtList, nkBlockStmt, nkStmtListExpr, nkBlockExpr: begin - for i := 0 to sonsLen(n)-1 do addDotDependency(b, n.sons[i]); - end - else begin end - end -end; - -procedure generateDot(const project: string); -begin - writeRope( - ropef('digraph $1 {$n$2}$n', [ - toRope(changeFileExt(extractFileName(project), '')), gDotGraph]), - changeFileExt(project, 'dot') ); -end; - -function genDependCreator(b: PBackend; module: PSym; - const filename: string): PBackend; -begin - result := newBackend(module, filename); - include(result.eventMask, eAfterModule); - result.afterModuleEvent := addDotDependency; - result.backendCreator := genDependCreator; + registerPass(verbosePass()); + registerPass(sem.semPass()); + registerPass(transf.transfPass()); + registerPass(rodwrite.rodwritePass()); end; procedure CommandGenDepend(const filename: string); -var - b: PBackend; begin - b := genDependCreator(nil, nil, filename); - compileProject(filename, b); + semanticPasses(); + registerPass(genDependPass()); + registerPass(cleanupPass()); + compileProject(filename); generateDot(filename); execExternalProgram('dot -Tpng -o' +{&} changeFileExt(filename, 'png') +{&} ' ' +{&} changeFileExt(filename, 'dot')); end; -// -------------------------------------------------------------------------- - -procedure genDebugTrans(b: PBackend; module: PNode); -begin - if module <> nil then - renderModule(module, getOutFile(b.filename, 'pretty.'+NimExt)); -end; - -function genDebugTransCreator(b: PBackend; module: PSym; - const filename: string): PBackend; -begin - result := newBackend(module, filename); - include(result.eventMask, eAfterModule); - result.backendCreator := genDebugTransCreator; - result.afterModuleEvent := genDebugTrans; -end; - -procedure CommandDebugTrans(const filename: string); -var - b: PBackend; -begin - b := genDebugTransCreator(nil, nil, filename); - compileProject(filename, b); -end; - -// -------------------------------------------------------------------------- - procedure CommandCheck(const filename: string); begin + semanticPasses(); // use an empty backend for semantic checking only - compileProject(filename, newBackend(nil, filename)); + compileProject(filename); end; procedure CommandCompileToC(const filename: string); begin - compileProject(filename, CBackend(nil, nil, filename)); + semanticPasses(); + registerPass(cgen.cgenPass()); + registerPass(cleanupPass()); + compileProject(filename); + //for i := low(TTypeKind) to high(TTypeKind) do + // MessageOut('kind: ' +{&} typeKindToStr[i] +{&} ' = ' +{&} toString(sameTypeA[i])); extccomp.CallCCompiler(changeFileExt(filename, '')); end; @@ -264,7 +164,33 @@ begin include(gGlobalOptions, optSafeCode); setTarget(osEcmaScript, cpuEcmaScript); initDefines(); - compileProject(filename, EcmasBackend(nil, nil, filename)); + + semanticPasses(); + registerPass(ecmasgenPass()); + compileProject(filename); +end; + +procedure CommandInteractive(); +var + m: PSym; +begin + include(gGlobalOptions, optSafeCode); + setTarget(osNimrodVM, cpuNimrodVM); + initDefines(); + + registerPass(verbosePass()); + registerPass(sem.semPass()); + registerPass(transf.transfPass()); + registerPass(evals.evalPass()); + + // load system module: + {@discard} CompileModule( + JoinPath(options.libpath, appendFileExt('system', nimExt)), false, true); + + m := newModule('stdin'); + m.id := getID(); + include(m.flags, sfMainModule); + processModule(m, 'stdin', LLStreamOpenStdIn(), nil); end; // -------------------------------------------------------------------------- @@ -322,12 +248,17 @@ procedure CommandLexPas(const filename: string); var L: TPasLex; tok: TPasTok; + f: string; + stream: PLLStream; begin {@ignore} fillChar(tok, sizeof(tok), 0); fillChar(L, sizeof(L), 0); {@emit} - if OpenLexer(L, appendFileExt(filename, 'pas')) = success then begin + f := appendFileExt(filename, 'pas'); + stream := LLStreamOpen(f, fmRead); + if stream <> nil then begin + OpenLexer(L, f, stream); getPasTok(L, tok); while tok.xkind <> pxEof do begin printPasTok(tok); @@ -335,7 +266,7 @@ begin end end else - rawMessage(errCannotOpenFile, appendFileExt(filename, 'pas')); + rawMessage(errCannotOpenFile, f); closeLexer(L); end; @@ -343,47 +274,44 @@ procedure CommandPas(const filename: string); var p: TPasParser; module: PNode; + f: string; + stream: PLLStream; begin - if OpenPasParser(p, appendFileExt(filename, 'pas')) = failure then begin - rawMessage(errCannotOpenFile, appendFileExt(filename, 'pas')); - exit - end; - module := parseUnit(p); - closePasParser(p); - renderModule(module, getOutFile(filename, NimExt)); -end; - -procedure CommandTestRod(const filename: string); -var - module, rod: PNode; -begin - module := parseFile(appendFileExt(filename, nimExt)); - if module <> nil then begin - generateRod(module, changeFileExt(filename, rodExt)); - rod := readRod(changeFileExt(filename, rodExt), {@set}[]); - assert(rod <> nil); - assert(sameTree(module, rod)); + f := appendFileExt(filename, 'pas'); + stream := LLStreamOpen(f, fmRead); + if stream <> nil then begin + OpenPasParser(p, f, stream); + module := parseUnit(p); + closePasParser(p); + renderModule(module, getOutFile(filename, NimExt)); end + else + rawMessage(errCannotOpenFile, f); end; procedure CommandScan(const filename: string); var L: TLexer; tok: PToken; + f: string; + stream: PLLStream; begin new(tok); {@ignore} fillChar(tok^, sizeof(tok^), 0); {@emit} - if openLexer(L, appendFileExt(filename, nimExt)) = Success then begin + f := appendFileExt(filename, nimExt); + stream := LLStreamOpen(f, fmRead); + if stream <> nil then begin + openLexer(L, f, stream); repeat rawGetTok(L, tok^); - PrintTok(tok) + PrintTok(tok); until tok.tokType = tkEof; - CloseLexer(L) + CloseLexer(L); end else - rawMessage(errCannotOpenFile, appendFileExt(filename, nimExt)); + rawMessage(errCannotOpenFile, f); end; procedure WantFile(const filename: string); @@ -396,16 +324,19 @@ procedure MainCommand(const cmd, filename: string); var dir, f: string; begin + appendStr(searchPaths, options.libpath); if filename <> '' then begin - appendStr(searchPaths, options.libpath); - splitPath(filename, dir, f); // current path is always looked first for modules prependStr(searchPaths, dir); end; + setID(100); + passes.gIncludeFile := parseFile; + passes.gIncludeTmplFile := ptmplsyn.parseTmplFile; + passes.gImportModule := importModule; case whichKeyword(cmd) of - wCompile, wCompileToC: begin + wCompile, wCompileToC, wC, wCC: begin // compile means compileToC currently gCmd := cmdCompileToC; wantFile(filename); @@ -422,7 +353,6 @@ begin CommandCompileToEcmaScript(filename); end; wPretty: begin - // compile means compileToC currently gCmd := cmdPretty; wantFile(filename); //CommandExportSymbols(filename); @@ -430,9 +360,16 @@ begin end; wDoc: begin gCmd := cmdDoc; + LoadSpecialConfig(DocConfig); wantFile(filename); CommandDoc(filename); end; + wRst2html: begin + gCmd := cmdRst2html; + LoadSpecialConfig(DocConfig); + wantFile(filename); + CommandRst2Html(filename); + end; wPas: begin gCmd := cmdPas; wantFile(filename); @@ -468,16 +405,10 @@ begin CommandScan(filename); MessageOut('Beware: Indentation tokens depend on the parser''s state!'); end; - wDebugTrans: begin - gCmd := cmdDebugTrans; - wantFile(filename); - CommandDebugTrans(filename); + wI: begin + gCmd := cmdInteractive; + CommandInteractive(); end; - wRst2html: begin - gCmd := cmdRst2html; - wantFile(filename); - CommandRst2Html(filename); - end else rawMessage(errInvalidCommandX, cmd); end end; diff --git a/nim/msgs.pas b/nim/msgs.pas index 8112b8df7..d65a5a1e4 100644 --- a/nim/msgs.pas +++ b/nim/msgs.pas @@ -1,53 +1,54 @@ -// -// -// The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf -// -// See the file "copying.txt", included in this -// distribution, for details about the copyright. -// -unit msgs; - -interface - -{$include 'config.inc'} - -uses - nsystem, options, strutils, nos; - -//[[[cog -//enum = "type\n TMsgKind = (\n" -//msgs = "const\n MsgKindToStr: array [TMsgKind] of string = (\n" -//warns = "const\n WarningsToStr: array [0..%d] of string = (\n" -//hints = "const\n HintsToStr: array [0..%d] of string = (\n" -//w = 0 # counts the warnings -//h = 0 # counts the hints -// -//for elem in eval(file('data/messages.yml').read()): -// for key, val in elem.iteritems(): -// enum += ' %s,\n' % key -// v = val.replace("'", "''") -// if key.startswith('warn'): -// msgs += " '%s [%s]',\n" % (v, key[4:]) -// warns += " '%s',\n" % key[4:] -// w += 1 -// elif key.startswith('hint'): -// msgs += " '%s [%s]',\n" % (v, key[4:]) -// hints += " '%s',\n" % key[4:] -// h += 1 -// else: -// msgs += " '%s',\n" % v -// -//enum = enum[:-2] + ');\n\n' -//msgs = msgs[:-2] + '\n );\n' -//warns = (warns[:-2] + '\n );\n') % (w-1) -//hints = (hints[:-2] + '\n );\n') % (h-1) -// -//cog.out(enum) -//cog.out(msgs) -//cog.out(warns) -//cog.out(hints) -//]]] +// +// +// The Nimrod Compiler +// (c) Copyright 2008 Andreas Rumpf +// +// See the file "copying.txt", included in this +// distribution, for details about the copyright. +// +unit msgs; + +interface + +{$include 'config.inc'} + +uses + nsystem, options, strutils, nos; + +//[[[cog +//from string import replace +//enum = "type\n TMsgKind = (\n" +//msgs = "const\n MsgKindToStr: array [TMsgKind] of string = (\n" +//warns = "const\n WarningsToStr: array [0..%d] of string = (\n" +//hints = "const\n HintsToStr: array [0..%d] of string = (\n" +//w = 0 # counts the warnings +//h = 0 # counts the hints +// +//for elem in eval(open('data/messages.yml').read()): +// for key, val in elem.items(): +// enum = enum + ' %s,\n' % key +// v = replace(val, "'", "''") +// if key[0:4] == 'warn': +// msgs = msgs + " '%s [%s]',\n" % (v, key[4:]) +// warns = warns + " '%s',\n" % key[4:] +// w = w + 1 +// elif key[0:4] == 'hint': +// msgs = msgs + " '%s [%s]',\n" % (v, key[4:]) +// hints = hints + " '%s',\n" % key[4:] +// h = h + 1 +// else: +// msgs = msgs + " '%s',\n" % v +// +//enum = enum[:-2] + ');\n\n' +//msgs = msgs[:-2] + '\n );\n' +//warns = (warns[:-2] + '\n );\n') % (w-1) +//hints = (hints[:-2] + '\n );\n') % (h-1) +// +//cog.out(enum) +//cog.out(msgs) +//cog.out(warns) +//cog.out(hints) +//]]] type TMsgKind = ( errUnknown, @@ -293,16 +294,17 @@ type warnCommentXIgnored, warnUser, hintSuccess, + hintSuccessX, hintLineTooLong, hintXDeclaredButNotUsed, hintConvToBaseNotNeeded, hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, - hintMo2FileInvalid, - hintModuleHasChanged, - hintCannotOpenMo2File, hintQuitCalled, hintProcessing, + hintCodeBegin, + hintCodeEnd, + hintConf, hintUser); const @@ -439,7 +441,7 @@ const 'computing the type''s size produced an overflow', 'set is too large', 'base type of a set must be an ordinal', - 'inheritance only works non-final objects', + 'inheritance only works with non-final objects', 'inheritance only works with an enum', 'illegal recursion in type ''$1''', 'cannot instantiate: ''$1''', @@ -550,16 +552,17 @@ const 'comment ''$1'' ignored [CommentXIgnored]', '$1 [User]', 'operation successful [Success]', + 'operation successful ($1 lines compiled; $2 sec total) [SuccessX]', 'line too long [LineTooLong]', '''$1'' is declared but not used [XDeclaredButNotUsed]', 'conversion to base object is not needed [ConvToBaseNotNeeded]', 'conversion from $1 to itself is pointless [ConvFromXtoItselfNotNeeded]', 'expression evaluates always to ''$1'' [ExprAlwaysX]', - 'mo2 file ''$1'' is invalid [Mo2FileInvalid]', - 'module ''$1'' has been changed [ModuleHasChanged]', - 'mo2 file ''$1'' does not exist [CannotOpenMo2File]', 'quit() called [QuitCalled]', - 'processing [Processing]', + 'processing $1 [Processing]', + 'generated code listing: [CodeBegin]', + 'end of listing [CodeEnd]', + 'used config file ''$1'' [Conf]', '$1 [User]' ); const @@ -580,261 +583,265 @@ const 'User' ); const - HintsToStr: array [0..11] of string = ( + HintsToStr: array [0..12] of string = ( 'Success', + 'SuccessX', 'LineTooLong', 'XDeclaredButNotUsed', 'ConvToBaseNotNeeded', 'ConvFromXtoItselfNotNeeded', 'ExprAlwaysX', - 'Mo2FileInvalid', - 'ModuleHasChanged', - 'CannotOpenMo2File', 'QuitCalled', 'Processing', + 'CodeBegin', + 'CodeEnd', + 'Conf', 'User' ); -//[[[end]]] - -const - fatalMin = errUnknown; - fatalMax = errInternal; - errMin = errUnknown; - errMax = errUser; - warnMin = warnCannotOpenFile; - warnMax = pred(hintSuccess); - hintMin = hintSuccess; - hintMax = high(TMsgKind); - -type - TNoteKind = warnMin..hintMax; - // "notes" are warnings or hints - TNoteKinds = set of TNoteKind; - - TLineInfo = record - // This is designed to be as small as possible, because it is used - // in syntax nodes. We safe space here by using two int16 and an int32 - // on 64 bit and on 32 bit systems this is only 8 bytes. - line, col: int16; - fileIndex: int32; - end; - -function UnknownLineInfo(): TLineInfo; - -var - gNotes: TNoteKinds = [low(TNoteKind)..high(TNoteKind)]; - gErrorCounter: int = 0; // counts the number of errors - gHintCounter: int = 0; - gWarnCounter: int = 0; - gErrorMax: int = 1; // stop after gErrorMax errors - -const // this format is understood by many text editors: it is the same that - // Borland and Freepascal use - PosErrorFormat = '$1($2, $3) Error: $4'; - PosWarningFormat = '$1($2, $3) Warning: $4'; - PosHintFormat = '$1($2, $3) Hint: $4'; - - RawErrorFormat = 'Error: $1'; - RawWarningFormat = 'Warning: $1'; - RawHintFormat = 'Hint: $1'; - -procedure MessageOut(const s: string); - -procedure rawMessage(const msg: TMsgKind; const arg: string = ''); -procedure liMessage(const info: TLineInfo; const msg: TMsgKind; - const arg: string = ''); - -procedure InternalError(const info: TLineInfo; const errMsg: string); - overload; -procedure InternalError(const errMsg: string); overload; - -function newLineInfo(const filename: string; line, col: int): TLineInfo; - -function ToFilename(const info: TLineInfo): string; -function toColumn(const info: TLineInfo): int; -function ToLinenumber(const info: TLineInfo): int; - -function MsgKindToString(kind: TMsgKind): string; - -// checkpoints are used for debugging: -function checkpoint(const info: TLineInfo; const filename: string; - line: int): boolean; - -procedure addCheckpoint(const info: TLineInfo); overload; -procedure addCheckpoint(const filename: string; line: int); overload; -function inCheckpoint(const current: TLineInfo): boolean; -// prints the line information if in checkpoint - -procedure pushInfoContext(const info: TLineInfo); -procedure popInfoContext; - -implementation - -function UnknownLineInfo(): TLineInfo; -begin - result.line := -1; - result.col := -1; - result.fileIndex := -1; -end; - -{@ignore} -var - filenames: array of string; - msgContext: array of TLineInfo; -{@emit -var - filenames: array of string = []; - msgContext: array of TLineInfo = []; -} - -procedure pushInfoContext(const info: TLineInfo); -var - len: int; -begin - len := length(msgContext); - setLength(msgContext, len+1); - msgContext[len] := info; -end; - -procedure popInfoContext; -begin - setLength(msgContext, length(msgContext)-1); -end; - -function includeFilename(const f: string): int; -var - i: int; -begin - for i := high(filenames) downto low(filenames) do - if filenames[i] = f then begin - result := i; exit - end; - // not found, so add it: - result := length(filenames); - setLength(filenames, result+1); - filenames[result] := f; -end; - -function checkpoint(const info: TLineInfo; const filename: string; - line: int): boolean; -begin - result := (info.line = line) and ( - ChangeFileExt(extractFilename(filenames[info.fileIndex]), '') = filename); -end; - - -{@ignore} -var - checkPoints: array of TLineInfo; -{@emit -var - checkPoints: array of TLineInfo = []; -} - -procedure addCheckpoint(const info: TLineInfo); overload; -var - len: int; -begin - len := length(checkPoints); - setLength(checkPoints, len+1); - checkPoints[len] := info; -end; - -procedure addCheckpoint(const filename: string; line: int); overload; -begin - addCheckpoint(newLineInfo(filename, line, -1)); -end; - -function newLineInfo(const filename: string; line, col: int): TLineInfo; -begin - result.fileIndex := includeFilename(filename); - result.line := int16(line); - result.col := int16(col); -end; - -function ToFilename(const info: TLineInfo): string; -begin - if info.fileIndex = -1 then result := '???' - else result := filenames[info.fileIndex] -end; - -function ToLinenumber(const info: TLineInfo): int; -begin - result := info.line -end; - -function toColumn(const info: TLineInfo): int; -begin - result := info.col -end; - -procedure MessageOut(const s: string); -begin // change only this proc to put it elsewhere - Writeln(output, s); -end; - -function coordToStr(const coord: int): string; -begin - if coord = -1 then result := '???' - else result := toString(coord) -end; - -function MsgKindToString(kind: TMsgKind): string; -begin // later versions may provide translated error messages - result := msgKindToStr[kind]; -end; - -function getMessageStr(msg: TMsgKind; const arg: string): string; -begin - result := format(msgKindToString(msg), [arg]); -end; - -function inCheckpoint(const current: TLineInfo): boolean; -var - i: int; -begin - result := false; - if not (optCheckpoints in gOptions) then exit; // ignore all checkpoints - for i := 0 to high(checkPoints) do begin - if (current.line = int(checkPoints[i].line)) and - (current.fileIndex = int(checkPoints[i].fileIndex)) then begin - MessageOut(Format('$1($2, $3) Checkpoint: ', [toFilename(current), - coordToStr(current.line), - coordToStr(current.col)])); - result := true; - exit - end - end -end; - -procedure handleError(const msg: TMsgKind); -begin - if (msg >= fatalMin) and (msg <= fatalMax) then begin - if optVerbose in gGlobalOptions then assert(false); - halt(1) - end; - if (msg >= errMin) and (msg <= errMax) then begin - inc(gErrorCounter); - if gErrorCounter >= gErrorMax then begin - if optVerbose in gGlobalOptions then assert(false); - halt(1) // one error stops the compiler - end - end -end; - -procedure writeContext; -var - i: int; -begin - for i := 0 to length(msgContext)-1 do begin - MessageOut(Format(posErrorFormat, [toFilename(msgContext[i]), - coordToStr(msgContext[i].line), - coordToStr(msgContext[i].col), - getMessageStr(errInstantiationFrom, '')])); - end; -end; - -procedure rawMessage(const msg: TMsgKind; const arg: string = ''); +//[[[end]]] + +const + fatalMin = errUnknown; + fatalMax = errInternal; + errMin = errUnknown; + errMax = errUser; + warnMin = warnCannotOpenFile; + warnMax = pred(hintSuccess); + hintMin = hintSuccess; + hintMax = high(TMsgKind); + +type + TNoteKind = warnMin..hintMax; + // "notes" are warnings or hints + TNoteKinds = set of TNoteKind; + + TLineInfo = record + // This is designed to be as small as possible, because it is used + // in syntax nodes. We safe space here by using two int16 and an int32 + // on 64 bit and on 32 bit systems this is only 8 bytes. + line, col: int16; + fileIndex: int32; + end; + +function UnknownLineInfo(): TLineInfo; + +var + gNotes: TNoteKinds = [low(TNoteKind)..high(TNoteKind)]; + gErrorCounter: int = 0; // counts the number of errors + gHintCounter: int = 0; + gWarnCounter: int = 0; + gErrorMax: int = 1; // stop after gErrorMax errors + +const // this format is understood by many text editors: it is the same that + // Borland and Freepascal use + PosErrorFormat = '$1($2, $3) Error: $4'; + PosWarningFormat = '$1($2, $3) Warning: $4'; + PosHintFormat = '$1($2, $3) Hint: $4'; + + RawErrorFormat = 'Error: $1'; + RawWarningFormat = 'Warning: $1'; + RawHintFormat = 'Hint: $1'; + +procedure MessageOut(const s: string); + +procedure rawMessage(const msg: TMsgKind; const arg: string = ''); overload; +procedure rawMessage(const msg: TMsgKind; const args: array of string); overload; + +procedure liMessage(const info: TLineInfo; const msg: TMsgKind; + const arg: string = ''); + +procedure InternalError(const info: TLineInfo; const errMsg: string); + overload; +procedure InternalError(const errMsg: string); overload; + +function newLineInfo(const filename: string; line, col: int): TLineInfo; + +function ToFilename(const info: TLineInfo): string; +function toColumn(const info: TLineInfo): int; +function ToLinenumber(const info: TLineInfo): int; + +function MsgKindToString(kind: TMsgKind): string; + +// checkpoints are used for debugging: +function checkpoint(const info: TLineInfo; const filename: string; + line: int): boolean; + +procedure addCheckpoint(const info: TLineInfo); overload; +procedure addCheckpoint(const filename: string; line: int); overload; +function inCheckpoint(const current: TLineInfo): boolean; +// prints the line information if in checkpoint + +procedure pushInfoContext(const info: TLineInfo); +procedure popInfoContext; + +implementation + +function UnknownLineInfo(): TLineInfo; +begin + result.line := int16(-1); + result.col := int16(-1); + result.fileIndex := -1; +end; + +{@ignore} +var + filenames: array of string; + msgContext: array of TLineInfo; +{@emit +var + filenames: array of string = @[]; + msgContext: array of TLineInfo = @[]; +} + +procedure pushInfoContext(const info: TLineInfo); +var + len: int; +begin + len := length(msgContext); + setLength(msgContext, len+1); + msgContext[len] := info; +end; + +procedure popInfoContext; +begin + setLength(msgContext, length(msgContext)-1); +end; + +function includeFilename(const f: string): int; +var + i: int; +begin + for i := high(filenames) downto low(filenames) do + if filenames[i] = f then begin + result := i; exit + end; + // not found, so add it: + result := length(filenames); + setLength(filenames, result+1); + filenames[result] := f; +end; + +function checkpoint(const info: TLineInfo; const filename: string; + line: int): boolean; +begin + result := (int(info.line) = line) and ( + ChangeFileExt(extractFilename(filenames[info.fileIndex]), '') = filename); +end; + + +{@ignore} +var + checkPoints: array of TLineInfo; +{@emit +var + checkPoints: array of TLineInfo = @[]; +} + +procedure addCheckpoint(const info: TLineInfo); overload; +var + len: int; +begin + len := length(checkPoints); + setLength(checkPoints, len+1); + checkPoints[len] := info; +end; + +procedure addCheckpoint(const filename: string; line: int); overload; +begin + addCheckpoint(newLineInfo(filename, line, -1)); +end; + +function newLineInfo(const filename: string; line, col: int): TLineInfo; +begin + result.fileIndex := includeFilename(filename); + result.line := int16(line); + result.col := int16(col); +end; + +function ToFilename(const info: TLineInfo): string; +begin + if info.fileIndex = -1 then result := '???' + else result := filenames[info.fileIndex] +end; + +function ToLinenumber(const info: TLineInfo): int; +begin + result := info.line +end; + +function toColumn(const info: TLineInfo): int; +begin + result := info.col +end; + +procedure MessageOut(const s: string); +begin // change only this proc to put it elsewhere + Writeln(output, s); +end; + +function coordToStr(const coord: int): string; +begin + if coord = -1 then result := '???' + else result := toString(coord) +end; + +function MsgKindToString(kind: TMsgKind): string; +begin // later versions may provide translated error messages + result := msgKindToStr[kind]; +end; + +function getMessageStr(msg: TMsgKind; const arg: string): string; +begin + result := format(msgKindToString(msg), [arg]); +end; + +function inCheckpoint(const current: TLineInfo): boolean; +var + i: int; +begin + result := false; + if not (optCheckpoints in gOptions) then exit; // ignore all checkpoints + for i := 0 to high(checkPoints) do begin + if (current.line = checkPoints[i].line) and + (current.fileIndex = (checkPoints[i].fileIndex)) then begin + MessageOut(Format('$1($2, $3) Checkpoint: ', [toFilename(current), + coordToStr(current.line), + coordToStr(current.col)])); + result := true; + exit + end + end +end; + +procedure handleError(const msg: TMsgKind); +begin + if msg = errInternal then assert(false); // we want a stack trace here + if (msg >= fatalMin) and (msg <= fatalMax) then begin + if gVerbosity >= 3 then assert(false); + halt(1) + end; + if (msg >= errMin) and (msg <= errMax) then begin + inc(gErrorCounter); + if gErrorCounter >= gErrorMax then begin + if gVerbosity >= 3 then assert(false); + halt(1) // one error stops the compiler + end + end +end; + +procedure writeContext; +var + i: int; +begin + for i := 0 to length(msgContext)-1 do begin + MessageOut(Format(posErrorFormat, [toFilename(msgContext[i]), + coordToStr(msgContext[i].line), + coordToStr(msgContext[i].col), + getMessageStr(errInstantiationFrom, '')])); + end; +end; + +procedure rawMessage(const msg: TMsgKind; const args: array of string); var frmt: string; begin @@ -857,51 +864,56 @@ begin end; else assert(false) // cannot happen end; - MessageOut(Format(frmt, [getMessageStr(msg, arg)])); - handleError(msg); -end; - -procedure liMessage(const info: TLineInfo; const msg: TMsgKind; - const arg: string = ''); -var - frmt: string; -begin - case msg of - errMin..errMax: begin - writeContext(); - frmt := posErrorFormat; - end; - warnMin..warnMax: begin - if not (optWarns in gOptions) then exit; - if not (msg in gNotes) then exit; - frmt := posWarningFormat; - inc(gWarnCounter); - end; - hintMin..hintMax: begin - if not (optHints in gOptions) then exit; - if not (msg in gNotes) then exit; - frmt := posHintFormat; - inc(gHintCounter); - end; - else assert(false) // cannot happen - end; - MessageOut(Format(frmt, [toFilename(info), - coordToStr(info.line), - coordToStr(info.col), - getMessageStr(msg, arg)])); + MessageOut(Format(frmt, format(msgKindToString(msg), args))); handleError(msg); end; - -procedure InternalError(const info: TLineInfo; const errMsg: string); + +procedure rawMessage(const msg: TMsgKind; const arg: string = ''); begin - writeContext(); - liMessage(info, errInternal, errMsg); -end; - -procedure InternalError(const errMsg: string); overload; -begin - writeContext(); - rawMessage(errInternal, errMsg); -end; - -end. + rawMessage(msg, [arg]); +end; + +procedure liMessage(const info: TLineInfo; const msg: TMsgKind; + const arg: string = ''); +var + frmt: string; +begin + case msg of + errMin..errMax: begin + writeContext(); + frmt := posErrorFormat; + end; + warnMin..warnMax: begin + if not (optWarns in gOptions) then exit; + if not (msg in gNotes) then exit; + frmt := posWarningFormat; + inc(gWarnCounter); + end; + hintMin..hintMax: begin + if not (optHints in gOptions) then exit; + if not (msg in gNotes) then exit; + frmt := posHintFormat; + inc(gHintCounter); + end; + else assert(false) // cannot happen + end; + MessageOut(Format(frmt, [toFilename(info), + coordToStr(info.line), + coordToStr(info.col), + getMessageStr(msg, arg)])); + handleError(msg); +end; + +procedure InternalError(const info: TLineInfo; const errMsg: string); +begin + writeContext(); + liMessage(info, errInternal, errMsg); +end; + +procedure InternalError(const errMsg: string); overload; +begin + writeContext(); + rawMessage(errInternal, errMsg); +end; + +end. diff --git a/nim/nimconf.pas b/nim/nimconf.pas index 5a4a13702..1a70abdbe 100644 --- a/nim/nimconf.pas +++ b/nim/nimconf.pas @@ -17,11 +17,13 @@ unit nimconf; interface uses - nsystem, nversion, commands, nos, strutils, msgs, platform, condsyms, - scanner, options, idents, wordrecg; + nsystem, llstream, nversion, commands, nos, strutils, msgs, platform, + condsyms, scanner, options, idents, wordrecg; procedure LoadConfig(const project: string); +procedure LoadSpecialConfig(const configfilename: string); + implementation @@ -96,7 +98,7 @@ var condStack: array of bool; {@emit - condStack := []; + condStack := @[]; } procedure doEnd(var L: TLexer; tok: PToken); @@ -276,14 +278,13 @@ begin checkSymbol(L, tok); val := val +{&} tokToStr(tok); confTok(L, tok); // skip symbol - while tok.ident.id = getIdent('&'+'').id do begin + while (tok.ident <> nil) and (tok.ident.id = getIdent('&'+'').id) do begin confTok(L, tok); checkSymbol(L, tok); val := val +{&} tokToStr(tok); confTok(L, tok) end end; - //writeln(stdout, "##" & s & "##" & val & "##") processSwitch(s, val, passPP, info) end; @@ -291,25 +292,49 @@ procedure readConfigFile(const filename: string); var L: TLexer; tok: PToken; + stream: PLLStream; begin new(tok); {@ignore} fillChar(tok^, sizeof(tok^), 0); fillChar(L, sizeof(L), 0); {@emit} - if openLexer(L, filename) = Success then begin + stream := LLStreamOpen(filename, fmRead); + if stream <> nil then begin + openLexer(L, filename, stream); tok.tokType := tkEof; // to avoid a pointless warning confTok(L, tok); // read in the first token while tok.tokType <> tkEof do parseAssignment(L, tok); if length(condStack) > 0 then lexMessage(L, errTokenExpected, '@end'); - closeLexer(L) + closeLexer(L); + if gVerbosity >= 1 then rawMessage(hintConf, filename); end end; // ------------------------------------------------------------------------ +function getConfigPath(const filename: string): string; +begin + // try local configuration file: + result := joinPath(getConfigDir(), filename); + if not ExistsFile(result) then begin + // try standard configuration file (installation did not distribute files + // the UNIX way) + result := joinPath([getPrefixDir(), 'config', filename]); + if not ExistsFile(result) then begin + result := '/etc/' +{&} filename + end + end +end; + +procedure LoadSpecialConfig(const configfilename: string); +begin + if not (optSkipConfigFile in gGlobalOptions) then + readConfigFile(getConfigPath(configfilename)); +end; + procedure LoadConfig(const project: string); var conffile: string; @@ -319,12 +344,9 @@ begin // choose default libpath: libpath := joinPath(getPrefixDir(), 'lib'); // read default config file: - if not (optSkipConfigFile in gGlobalOptions) then begin - readConfigFile(joinPath([getPrefixDir(), 'config', 'nimrod.cfg'])); - readConfigFile(joinPath([getPrefixDir(), 'config', 'doctempl.cfg'])); - end; + LoadSpecialConfig('nimrod.cfg'); // read project config file: - if not (optSkipProjConfigFile in gGlobalOptions) then begin + if not (optSkipProjConfigFile in gGlobalOptions) and (project <> '') then begin conffile := changeFileExt(project, 'cfg'); if existsFile(conffile) then readConfigFile(conffile) diff --git a/nim/nimrod.pas b/nim/nimrod.pas index 5d3785af4..d197a3448 100644 --- a/nim/nimrod.pas +++ b/nim/nimrod.pas @@ -16,7 +16,7 @@ program nimrod; {@emit} uses - nsystem, + nsystem, ntime, charsets, sysutils, commands, scanner, condsyms, options, msgs, nversion, nimconf, ropes, extccomp, strutils, nos, platform, main, parseopt; @@ -54,10 +54,17 @@ begin end end; +{@ignore} +type + TTime = int; +{@emit} + procedure HandleCmdLine; var command, filename: string; + start: TTime; begin + {@emit start := getTime(); } if paramCount() = 0 then writeCommandLineUsage() else begin @@ -65,19 +72,26 @@ begin command := ''; filename := ''; ProcessCmdLine(passCmd1, command, filename); - if filename <> '' then begin - if gCmd = cmdInterpret then DefineSymbol('interpreting'); - nimconf.LoadConfig(filename); // load the right config file - // now process command line arguments again, because some options in the - // command line can overwite the config file's settings - extccomp.initVars(); - command := ''; - filename := ''; - ProcessCmdLine(passCmd2, command, filename); - end; + if filename <> '' then options.projectPath := extractDir(filename); + nimconf.LoadConfig(filename); // load the right config file + // now process command line arguments again, because some options in the + // command line can overwite the config file's settings + extccomp.initVars(); + + command := ''; + filename := ''; + ProcessCmdLine(passCmd2, command, filename); MainCommand(command, filename); - if (gCmd <> cmdInterpret) and (msgs.gErrorCounter = 0) then + {@emit + if gVerbosity >= 2 then echo(GC_getStatistics()); } + if (gCmd <> cmdInterpret) and (msgs.gErrorCounter = 0) then begin + {@ignore} rawMessage(hintSuccess); + {@emit + rawMessage(hintSuccessX, [toString(gLinesCompiled), + toString(getTime() - start)]); + } + end; if optRun in gGlobalOptions then execExternalProgram(changeFileExt(filename, '') +{&} ' ' +{&} arguments) end diff --git a/nim/nimsets.pas b/nim/nimsets.pas index 04ec943e7..7fa3dbc12 100644 --- a/nim/nimsets.pas +++ b/nim/nimsets.pas @@ -142,7 +142,7 @@ var begin elemType := settype.sons[0]; first := firstOrd(elemType); - result := newNode(nkCurly); + result := newNodeI(nkCurly, info); result.typ := settype; result.info := info; @@ -157,7 +157,7 @@ begin if a = b then // a single element: addSon(result, newIntTypeNode(nkIntLit, a + first, elemType)) else begin - n := newNode(nkRange); + n := newNodeI(nkRange, info); n.typ := elemType; addSon(n, newIntTypeNode(nkIntLit, a + first, elemType)); addSon(n, newIntTypeNode(nkIntLit, b + first, elemType)); diff --git a/nim/nos.pas b/nim/nos.pas index b4c77681b..002803b53 100644 --- a/nim/nos.pas +++ b/nim/nos.pas @@ -10,8 +10,6 @@ unit nos; // This module provides Nimrod's os module in Pascal // Note: Only implement what is really needed here! -// This is not portable! It only works on Windows and Linux! But -// it does not matter since this is only needed for bootstraping. interface @@ -45,7 +43,7 @@ const sep = dirsep; // alternative name extsep = '.'; -function executeProcess(const cmd: string): int; +function executeShellCommand(const cmd: string): int; // like exec, but gets a command function FileNewer(const a, b: string): Boolean; @@ -67,6 +65,9 @@ function extractFilename(const f: string): string; function getApplicationDir(): string; function getApplicationFilename(): string; +function getCurrentDir: string; +function GetConfigDir(): string; + procedure SplitFilename(const filename: string; out name, extension: string); @@ -74,7 +75,7 @@ function ExistsFile(const filename: string): Boolean; function AppendFileExt(const filename, ext: string): string; function ChangeFileExt(const filename, ext: string): string; -procedure createDir(dir: string); +procedure createDir(const dir: string); function expandFilename(filename: string): string; function UnixToNativePath(const path: string): string; @@ -83,6 +84,20 @@ function sameFile(const path1, path2: string): boolean; implementation +function GetConfigDir(): string; +begin +{$ifdef windows} + result := getEnv('APPDATA') + '\'; +{$else} + result := getEnv('HOME') + '/.config/'; +{$endif} +end; + +function getCurrentDir: string; +begin + result := sysutils.GetCurrentDir(); +end; + function UnixToNativePath(const path: string): string; begin if dirSep <> '/' then @@ -102,9 +117,14 @@ begin expandFilename(UnixToNativePath(path2))) = 0; end; -procedure createDir(dir: string); +procedure createDir(const dir: string); +var + i: int; begin - sysutils.CreateDir(Dir); + for i := 1 to length(dir) do begin + if dir[i] in [sep, altsep] then sysutils.createDir(ncopy(dir, 1, i-1)); + end; + sysutils.createDir(dir); end; function searchExtPos(const s: string): int; @@ -157,7 +177,7 @@ begin extPos := searchExtPos(filename); if extPos > 0 then begin name := ncopy(filename, 1, extPos-1); - extension := ncopy(filename, extPos+1); + extension := ncopy(filename, extPos); end else begin name := filename; @@ -405,7 +425,7 @@ end; {$ifdef windows} -function ExecuteProcess(const cmd: string): int; +function executeShellCommand(const cmd: string): int; var SI: TStartupInfo; ProcInfo: TProcessInformation; @@ -437,14 +457,14 @@ end; {$else} {$ifdef windows} -function executeProcess(const cmd: string): int; +function executeShellCommand(const cmd: string): int; begin result := dos.Exec(cmd, '') end; //C:\Eigenes\compiler\MinGW\bin; {$else} // fpc has a portable function for this -function executeProcess(const cmd: string): int; +function executeShellCommand(const cmd: string): int; begin result := shell(cmd); end; diff --git a/nim/nsystem.pas b/nim/nsystem.pas index 9f3adfc7d..340477461 100644 --- a/nim/nsystem.pas +++ b/nim/nsystem.pas @@ -155,6 +155,7 @@ function leU(a, b: biggestInt): bool; function toU8(a: biggestInt): byte; function toU32(a: biggestInt): int32; function ze64(a: byte): biggestInt; +function ze(a: byte): int; {@emit} function alloc(size: int): Pointer; @@ -173,9 +174,15 @@ type function OpenFile(out f: tTextFile; const filename: string; mode: TFileMode = fmRead): Boolean; overload; +function endofFile(var f: tBinaryFile): boolean; overload; +function endofFile(var f: textFile): boolean; overload; + function readChar(var f: tTextFile): char; -function readLine(var f: tTextFile): string; -procedure nimWrite(var f: tTextFile; const str: string); +function readLine(var f: tTextFile): string; overload; +function readLine(var f: tBinaryFile): string; overload; +function readLine(var f: textFile): string; overload; + +procedure nimWrite(var f: tTextFile; const str: string); overload; procedure nimCloseFile(var f: tTextFile); overload; // binary file handling: @@ -197,6 +204,8 @@ procedure setFilePos(var f: tBinaryFile; pos: int64); function readFile(const filename: string): string; +procedure nimWrite(var f: tBinaryFile; const str: string); overload; + implementation @@ -279,6 +288,11 @@ function ze64(a: byte): biggestInt; begin result := a end; + +function ze(a: byte): int; +begin + result := a +end; {@emit} procedure addChar(var s: string; c: Char); @@ -400,7 +414,7 @@ end; function readChar(var f: tTextFile): char; begin - Readln(f.sysFile, result); + Read(f.sysFile, result); end; procedure nimWrite(var f: tTextFile; const str: string); @@ -413,6 +427,16 @@ begin Readln(f.sysFile, result); end; +function endofFile(var f: tBinaryFile): boolean; +begin + result := eof(f) +end; + +function endofFile(var f: textFile): boolean; +begin + result := eof(f) +end; + procedure nimCloseFile(var f: tTextFile); begin closeFile(f.sysFile); @@ -457,6 +481,35 @@ begin BlockRead(f, buffer^, len, result) end; +procedure nimWrite(var f: tBinaryFile; const str: string); overload; +begin + writeBuffer(f, addr(str[1]), length(str)); +end; + +function readLine(var f: tBinaryFile): string; overload; +var + c: char; +begin + result := ''; + while readBuffer(f, addr(c), 1) = 1 do begin + case c of + #13: begin + readBuffer(f, addr(c), 1); // skip #10 + break; + end; + #10: break; + else begin end + end; + addChar(result, c); + end +end; + +function readLine(var f: textFile): string; overload; +begin + result := ''; + readln(f, result); +end; + function readBuffer(var f: tBinaryFile): string; overload; const bufSize = 4096; diff --git a/nim/nversion.pas b/nim/nversion.pas index 4958353f8..51390a073 100644 --- a/nim/nversion.pas +++ b/nim/nversion.pas @@ -18,31 +18,22 @@ interface uses strutils; -// the Pascal version number gets a little star ('*'), the Nimrod version -// does not! This helps distinguishing the different builds. -{@ignore} -const - VersionStar = '*'+''; -{@emit -const - VersionStar = ''; -} - const MaxSetElements = 1 shl 16; // (2^16) to support unicode character sets? defaultAsmMarkerSymbol = '!'; //[[[cog //from koch import NIMROD_VERSION - //cog.outl("VersionAsString = '%s'+VersionStar;" % NIMROD_VERSION) - //ver = NIMROD_VERSION.split('.') + //from string import split + //cog.outl("VersionAsString = '%s';" % NIMROD_VERSION) + //ver = split(NIMROD_VERSION, '.') //cog.outl('VersionMajor = %s;' % ver[0]) //cog.outl('VersionMinor = %s;' % ver[1]) //cog.outl('VersionPatch = %s;' % ver[2]) //]]] - VersionAsString = '0.6.0'+VersionStar; + VersionAsString = '0.7.0'; VersionMajor = 0; - VersionMinor = 6; + VersionMinor = 7; VersionPatch = 0; //[[[[end]]]] diff --git a/nim/options.pas b/nim/options.pas index 93b56c330..9a9eaae36 100644 --- a/nim/options.pas +++ b/nim/options.pas @@ -18,7 +18,8 @@ uses type // please make sure we have under 32 options // (improves code efficiency a lot!) - TOption = (optNone, + TOption = ( // **keep binary compatible** + optNone, optObjCheck, optFieldCheck, optRangeCheck, optBoundsCheck, optOverflowCheck, optNilCheck, optAssert, optLineDir, @@ -29,28 +30,23 @@ type optLineTrace, // line tracing support (includes stack tracing) optEndb, // embedded debugger optByRef, // use pass by ref for records (for interfacing with C) - optCheckpoints // check for checkpoints (used for debugging) + optCheckpoints, // check for checkpoints (used for debugging) + optProfiler // profiler turned on ); TOptions = set of TOption; TGlobalOption = (gloptNone, optForceFullMake, optBoehmGC, optRefcGC, optDeadCodeElim, optListCmd, optCompileOnly, optNoLinking, optSafeCode, // only allow safe code - // a new comment line optCDebug, // turn on debugging information - optGenDynLib, - optGenGuiApp, - optVerbose, // be verbose + optGenDynLib, // generate a dynamic library + optGenGuiApp, // generate a GUI application optGenScript, // generate a script file to compile the *.c files optGenMapping, // generate a mapping file optRun, // run the compiled project - optCompileSys, // compile system files - - optMergeOutput, // generate only one C output file + optSymbolFiles, // use symbol files for speeding up compilation optSkipConfigFile, // skip the general config file - optSkipProjConfigFile, // skip the project's config file - optAstCache, - optCFileCache + optSkipProjConfigFile // skip the project's config file ); TGlobalOptions = set of TGlobalOption; @@ -70,7 +66,8 @@ type cmdParse, // parse a single file (for debugging) cmdScan, // scan a single file (for debugging) cmdDebugTrans, // debug a transformation pass - cmdRst2html // convert a reStructuredText file to HTML + cmdRst2html, // convert a reStructuredText file to HTML + cmdInteractive // start interactive session ); TStringSeq = array of string; @@ -83,12 +80,12 @@ const 'optBoundsCheck', 'optOverflowCheck', 'optNilCheck', 'optAssert', 'optLineDir', 'optWarns', 'optHints', 'optOptimizeSpeed', 'optOptimizeSize', 'optStackTrace', 'optLineTrace', 'optEmdb', - 'optByRef', 'optCheckpoints' + 'optByRef', 'optCheckpoints', 'optProfiler' ); var gOptions: TOptions = {@set}[optObjCheck, optFieldCheck, optRangeCheck, optBoundsCheck, optOverflowCheck, - optAssert, optWarns, optHints, optLineDir, + optAssert, optWarns, optHints, optStackTrace, optLineTrace]; gGlobalOptions: TGlobalOptions = {@set}[optRefcGC]; @@ -100,35 +97,40 @@ var gCmd: TCommands = cmdNone; // the command - debugState: int; // a global switch used for better debugging... - // not used for any program logic - + gVerbosity: int; // how verbose the compiler is function FindFile(const f: string): string; const - genSubDir = 'rod_gen'; + genSubDir = 'nimcache'; NimExt = 'nim'; RodExt = 'rod'; HtmlExt = 'html'; + IniExt = 'ini'; + TmplExt = 'tmpl'; + DocConfig = 'nimdoc.cfg'; function completeGeneratedFilePath(const f: string; createSubDir: bool = true): string; function toGeneratedFile(const path, ext: string): string; -// converts "/home/a/mymodule.nim", "rod" to "/home/a/rod_gen/mymodule.rod" +// converts "/home/a/mymodule.nim", "rod" to "/home/a/nimcache/mymodule.rod" function getPrefixDir: string; // gets the application directory +function getFileTrunk(const filename: string): string; + // additional configuration variables: var gConfigVars: PStringTable; libpath: string = ''; + projectPath: string = ''; gKeepComments: boolean = true; // whether the parser needs to keep comments - gImplicitMods: TStringSeq = {@ignore} nil {@emit []}; + gImplicitMods: TStringSeq = {@ignore} nil {@emit @[]}; // modules that are to be implicitly imported +function existsConfigVar(const key: string): bool; function getConfigVar(const key: string): string; procedure setConfigVar(const key, val: string); @@ -140,6 +142,11 @@ function binaryStrSearch(const x: array of string; const y: string): int; implementation +function existsConfigVar(const key: string): bool; +begin + result := hasKey(gConfigVars, key) +end; + function getConfigVar(const key: string): string; begin result := strtabs.get(gConfigVars, key); @@ -173,12 +180,37 @@ begin SplitPath(appdir, result, bin); end; +function getFileTrunk(const filename: string): string; +var + f, e, dir: string; +begin + splitPath(filename, dir, f); + splitFilename(f, result, e); +end; + +function shortenDir(const dir: string): string; +var + prefix: string; +begin + // returns the interesting part of a dir + prefix := getPrefixDir() +{&} dirSep; + if startsWith(dir, prefix) then begin + result := ncopy(dir, length(prefix) + strStart); exit + end; + prefix := getCurrentDir() +{&} dirSep; + if startsWith(dir, prefix) then begin + result := ncopy(dir, length(prefix) + strStart); exit + end; + result := dir +end; + function toGeneratedFile(const path, ext: string): string; var head, tail: string; begin splitPath(path, head, tail); - result := joinPath([head, genSubDir, changeFileExt(tail, ext)]) + result := joinPath([projectPath, genSubDir, shortenDir(head), + changeFileExt(tail, ext)]) end; function completeGeneratedFilePath(const f: string; @@ -187,13 +219,13 @@ var head, tail, subdir: string; begin splitPath(f, head, tail); - subdir := joinPath(head, genSubDir); + subdir := joinPath([projectPath, genSubDir, shortenDir(head)]); if createSubDir then createDir(subdir); result := joinPath(subdir, tail) end; -function FindFile(const f: string): string; +function rawFindFile(const f: string): string; var it: PStrEntry; begin @@ -209,6 +241,13 @@ begin end end; +function FindFile(const f: string): string; +begin + result := rawFindFile(f); + if length(result) = 0 then + result := rawFindFile(toLower(f)); +end; + function binaryStrSearch(const x: array of string; const y: string): int; var a, b, mid, c: int; diff --git a/nim/parsecfg.pas b/nim/parsecfg.pas index 1f049536d..a99da6852 100644 --- a/nim/parsecfg.pas +++ b/nim/parsecfg.pas @@ -9,15 +9,15 @@ unit parsecfg; // A HIGH-PERFORMANCE configuration file parser; -// the Nimrod version of this file will become part -// of the standard library. +// the Nimrod version of this file is part of the +// standard library. interface {$include 'config.inc'} uses - charsets, nsystem, sysutils, hashes, strutils, lexbase; + nsystem, charsets, llstream, sysutils, hashes, strutils, lexbase; type TCfgEventKind = ( @@ -25,7 +25,7 @@ type cfgSectionStart, // a ``[section]`` has been parsed cfgKeyValuePair, // a ``key=value`` pair has been detected cfgOption, // a ``--key=value`` command line option - cfgError // an error ocurred during parsing; msg contains the + cfgError // an error ocurred during parsing; msg contains the // error message ); TCfgEvent = {@ignore} record @@ -36,7 +36,8 @@ type end; {@emit object(NObject) case kind: TCfgEventKind of - cfgSection: (section: string); + cfgEof: (); + cfgSectionStart: (section: string); cfgKeyValuePair, cfgOption: (key, value: string); cfgError: (msg: string); end;} @@ -44,9 +45,9 @@ type tkSymbol, tkEquals, tkColon, tkBracketLe, tkBracketRi, tkDashDash ); - TToken = record // a token + TToken = record // a token kind: TTokKind; // the type of the token - literal: string; // the parsed (string) literal + literal: string; // the parsed (string) literal end; TParserState = (startState, commaState); TCfgParser = object(TBaseLexer) @@ -55,8 +56,8 @@ type filename: string; end; -function Open(var c: TCfgParser; const filename: string): bool; -procedure OpenFromBuffer(var c: TCfgParser; const buf: string); +procedure Open(var c: TCfgParser; const filename: string; + inputStream: PLLStream); procedure Close(var c: TCfgParser); function next(var c: TCfgParser): TCfgEvent; @@ -65,6 +66,8 @@ function getColumn(const c: TCfgParser): int; function getLine(const c: TCfgParser): int; function getFilename(const c: TCfgParser): string; +function errorStr(const c: TCfgParser; const msg: string): string; + implementation const @@ -73,35 +76,23 @@ const // ---------------------------------------------------------------------------- procedure rawGetTok(var c: TCfgParser; var tok: TToken); forward; -function open(var c: TCfgParser; const filename: string): bool; +procedure open(var c: TCfgParser; const filename: string; + inputStream: PLLStream); begin {@ignore} - FillChar(c, sizeof(c), 0); // work around Delphi/fpc bug + FillChar(c, sizeof(c), 0); {@emit} - result := initBaseLexer(c, filename); + openBaseLexer(c, inputStream); c.filename := filename; c.state := startState; c.tok.kind := tkInvalid; c.tok.literal := ''; - if result then rawGetTok(c, c.tok); -end; - -procedure openFromBuffer(var c: TCfgParser; const buf: string); -begin -{@ignore} - FillChar(c, sizeof(c), 0); // work around Delphi/fpc bug -{@emit} - initBaseLexerFromBuffer(c, buf); - c.filename := 'buffer'; - c.state := startState; - c.tok.kind := tkInvalid; - c.tok.literal := ''; rawGetTok(c, c.tok); end; procedure close(var c: TCfgParser); begin - deinitBaseLexer(c); + closeBaseLexer(c); end; function getColumn(const c: TCfgParser): int; @@ -285,7 +276,7 @@ begin repeat case buf[pos] of ' ': Inc(pos); - Tabulator: inc(pos); + Tabulator: inc(pos); '#', ';': while not (buf[pos] in [CR, LF, lexbase.EndOfFile]) do inc(pos); CR, LF: pos := HandleCRLF(c, pos); else break // EndOfFile also leaves the loop @@ -321,7 +312,7 @@ begin Inc(c.bufPos); getString(c, tok, true); end - else + else getSymbol(c, tok); end; '[': begin @@ -343,7 +334,7 @@ end; function errorStr(const c: TCfgParser; const msg: string): string; begin result := format('$1($2, $3) Error: $4', [ - c.filename, toString(getLine(c)), toString(getColumn(c)), + c.filename, toString(getLine(c)), toString(getColumn(c)), msg ]); end; @@ -355,6 +346,20 @@ begin result.key := c.tok.literal; result.value := ''; rawGetTok(c, c.tok); + while c.tok.literal = '.'+'' do begin + addChar(result.key, '.'); + rawGetTok(c, c.tok); + if c.tok.kind = tkSymbol then begin + result.key := result.key +{&} c.tok.literal; + rawGetTok(c, c.tok); + end + else begin + result.kind := cfgError; + result.msg := errorStr(c, 'symbol expected, but found: ' + + c.tok.literal); + break + end + end; if c.tok.kind in [tkEquals, tkColon] then begin rawGetTok(c, c.tok); if c.tok.kind = tkSymbol then begin @@ -362,7 +367,7 @@ begin end else begin result.kind := cfgError; - result.msg := errorStr(c, 'symbol expected, but found: ' + result.msg := errorStr(c, 'symbol expected, but found: ' + c.tok.literal); end; rawGetTok(c, c.tok); @@ -400,10 +405,10 @@ begin if c.tok.kind = tkBracketRi then rawGetTok(c, c.tok) else begin result.kind := cfgError; - result.msg := errorStr(c, ''']'' expected, but found: ' + c.tok.literal); + result.msg := errorStr(c, ''']'' expected, but found: ' + c.tok.literal); end end; - tkInvalid, tkEquals, tkColon: begin + tkInvalid, tkBracketRi, tkEquals, tkColon: begin result.kind := cfgError; result.msg := errorStr(c, 'invalid token: ' + c.tok.literal); rawGetTok(c, c.tok); diff --git a/nim/paslex.pas b/nim/paslex.pas index c7aa6e19a..678f3af1a 100644 --- a/nim/paslex.pas +++ b/nim/paslex.pas @@ -34,15 +34,18 @@ type TPasTokKind = (pxInvalid, pxEof, // keywords: //[[[cog - //keywords = eval(file("data/pas_keyw.yml").read()) + //from string import capitalize + //keywords = eval(open("data/pas_keyw.yml").read()) //idents = "" //strings = "" //i = 1 //for k in keywords: - // idents += "px" + k.capitalize() + ", " - // strings += "'" + k + "', " - // if i % 4 == 0: idents += "\n"; strings += "\n" - // i += 1 + // idents = idents + "px" + capitalize(k) + ", " + // strings = strings + "'" + k + "', " + // if i % 4 == 0: + // idents = idents + "\n" + // strings = strings + "\n" + // i = i + 1 //cog.out(idents) //]]] pxAnd, pxArray, pxAs, pxAsm, @@ -164,7 +167,7 @@ begin case tok.ident.id of //[[[cog //for k in keywords: - // m = k.capitalize() + // m = capitalize(k) // cog.outl("ord(w%s):%s tok.xkind := px%s;" % (m, ' '*(18-len(m)), m)) //]]] ord(wAnd): tok.xkind := pxAnd; diff --git a/nim/pasparse.pas b/nim/pasparse.pas index 357918029..d0353fc86 100644 --- a/nim/pasparse.pas +++ b/nim/pasparse.pas @@ -18,7 +18,7 @@ unit pasparse; interface uses - nsystem, nos, charsets, scanner, paslex, idents, wordrecg, strutils, + nsystem, nos, llstream, charsets, scanner, paslex, idents, wordrecg, strutils, ast, astalgo, msgs, options; type @@ -62,7 +62,7 @@ const ('len', 'length'), ('setlength', 'setlen') ); - nimReplacements: array [1..29] of TReplaceTuple = ( + nimReplacements: array [1..30] of TReplaceTuple = ( ('nimread', 'read'), ('nimwrite', 'write'), ('nimclosefile', 'closeFile'), @@ -88,6 +88,7 @@ const ('leu', '`<=%`'), ('shlu', '`shl`'), ('shru', '`shr`'), + ('assigned', 'not isNil'), ('eintoverflow', 'EOverflow'), ('format', '`%`'), @@ -108,7 +109,8 @@ const function ParseUnit(var p: TPasParser): PNode; -function openPasParser(var p: TPasParser; const filename: string): TResult; +procedure openPasParser(var p: TPasParser; const filename: string; + inputStream: PLLStream); procedure closePasParser(var p: TPasParser); procedure exSymbol(var n: PNode); @@ -117,14 +119,15 @@ procedure fixRecordDef(var n: PNode); implementation -function OpenPasParser(var p: TPasParser; const filename: string): TResult; +procedure OpenPasParser(var p: TPasParser; const filename: string; + inputStream: PLLStream); var i: int; begin {@ignore} FillChar(p, sizeof(p), 0); {@emit} - result := OpenLexer(p.lex, filename); + OpenLexer(p.lex, filename, inputStream); initIdTable(p.repl); for i := low(stdReplacements) to high(stdReplacements) do IdTablePut(p.repl, getIdent(stdReplacements[i][0]), @@ -191,8 +194,7 @@ end; function newNodeP(kind: TNodeKind; const p: TPasParser): PNode; begin - result := newNode(kind); - result.info := getLineInfo(p.lex); + result := newNodeI(kind, getLineInfo(p.lex)); end; function newIntNodeP(kind: TNodeKind; const intVal: BiggestInt; @@ -236,9 +238,10 @@ end; function parseExpr(var p: TPasParser): PNode; forward; function parseStmt(var p: TPasParser): PNode; forward; -function parseTypeDesc(var p: TPasParser): PNode; forward; +function parseTypeDesc(var p: TPasParser; + definition: PNode=nil): PNode; forward; -function parseEmit(var p: TPasParser): PNode; +function parseEmit(var p: TPasParser; definition: PNode): PNode; var a: PNode; begin @@ -258,12 +261,12 @@ begin end end end; - conTypeDesc: result := parseTypeDesc(p); + conTypeDesc: result := parseTypeDesc(p, definition); end; eat(p, pxCurlyDirRi); end; -function parseCommand(var p: TPasParser): PNode; +function parseCommand(var p: TPasParser; definition: PNode=nil): PNode; var a: PNode; begin @@ -294,7 +297,7 @@ begin end end else if p.tok.ident.id = getIdent('emit').id then begin - result := parseEmit(p); + result := parseEmit(p, definition); end else if p.tok.ident.id = getIdent('ignore').id then begin getTok(p); eat(p, pxCurlyDirRi); @@ -304,12 +307,11 @@ begin pxCommand: begin getTok(p); if p.tok.ident.id = getIdent('emit').id then begin - result := parseEmit(p); + result := parseEmit(p, definition); break end else begin - while (p.tok.xkind <> pxCurlyDirRi) - and (p.tok.xkind <> pxEof) do + while (p.tok.xkind <> pxCurlyDirRi) and (p.tok.xkind <> pxEof) do getTok(p); eat(p, pxCurlyDirRi); end; @@ -326,6 +328,10 @@ begin result := newNodeP(nkTupleTy, p); getTok(p); eat(p, pxCurlyDirRi); end + else if p.tok.ident.id = getIdent('acyclic').id then begin + result := newIdentNodeP(p.tok.ident, p); + getTok(p); eat(p, pxCurlyDirRi); + end else begin parMessage(p, errUnknownDirective, pasTokToStr(p.tok)); while true do begin @@ -445,8 +451,7 @@ begin skipCom(p, result); if p.tok.xkind = pxSymbol then begin a := result; - result := newNode(nkQualified); - result.info := a.info; + result := newNodeI(nkQualified, a.info); addSon(result, a); addSon(result, createIdentNodeP(p.tok.ident, p)); getTok(p); @@ -583,8 +588,15 @@ begin end else if p.tok.xkind = pxAt then begin result := newNodeP(nkAddr, p); + a := newIdentNodeP(getIdent(pasTokToStr(p.tok)), p); getTok(p); - addSon(result, primary(p)); + if p.tok.xkind = pxBracketLe then begin + result := newNodeP(nkPrefix, p); + addSon(result, a); + addSon(result, identOrLiteral(p)); + end + else + addSon(result, primary(p)); exit end; result := identOrLiteral(p); @@ -737,8 +749,7 @@ begin getTok(p); skipCom(p, a); b := parseExpr(p); - result := newNode(nkAsgn); - result.info := info; + result := newNodeI(nkAsgn, info); addSon(result, a); addSon(result, b); end @@ -837,7 +848,7 @@ end; function parseStmtList(var p: TPasParser): PNode; begin result := newNodeP(nkStmtList, p); - while true do begin + while true do begin case p.tok.xkind of pxEof: break; pxCurlyDirLe, pxStarDirLe: begin @@ -847,7 +858,7 @@ begin end; addSon(result, parseStmt(p)) end; - if sonsLen(result) = 1 then result := result.sons[0]; + if sonsLen(result) = 1 then result := result.sons[0]; end; procedure parseIfDirAux(var p: TPasParser; result: PNode); @@ -1278,7 +1289,6 @@ begin addSon(e, parseExpr(p)); addSon(result, e); opt(p, pxSemicolon); - if (p.tok.xkind = pxSymbol) and (p.tok.ident.id = getIdent('name').id) then begin e := newNodeP(nkExprColonExpr, p); @@ -1286,7 +1296,9 @@ begin addSon(e, newIdentNodeP(getIdent('importc'), p)); addSon(e, parseExpr(p)); addSon(result, e); - end; + end + else + addSon(result, newIdentNodeP(getIdent('importc'), p)); opt(p, pxSemicolon); end else begin @@ -1453,7 +1465,8 @@ begin end; eat(p, pxParRi); opt(p, pxSemicolon); - skipCom(p, lastSon(c)); + if sonsLen(c) > 0 then skipCom(p, lastSon(c)) + else addSon(c, newNodeP(nkNilLit, p)); addSon(b, c); addSon(result, b); if b.kind = nkElse then break; @@ -1491,8 +1504,7 @@ begin nkPostfix: begin end; // already an export marker nkPragmaExpr: exSymbol(n.sons[0]); nkIdent, nkAccQuoted: begin - a := newNode(nkPostFix); - a.info := n.info; + a := newNodeI(nkPostFix, n.info); addSon(a, newIdentNode(getIdent('*'+''), n.info)); addSon(a, n); n := a @@ -1521,12 +1533,32 @@ begin nkIdentDefs: begin for i := 0 to sonsLen(n)-3 do exSymbol(n.sons[i]) end; + nkNilLit: begin end; //nkIdent: exSymbol(n); else internalError(n.info, 'fixRecordDef(): ' + nodekindtostr[n.kind]); end end; -procedure parseRecordBody(var p: TPasParser; result: PNode); +procedure addPragmaToIdent(var ident: PNode; pragma: PNode); +var + e, pragmasNode: PNode; +begin + if ident.kind <> nkPragmaExpr then begin + pragmasNode := newNodeI(nkPragma, ident.info); + e := newNodeI(nkPragmaExpr, ident.info); + addSon(e, ident); + addSon(e, pragmasNode); + ident := e; + end + else begin + pragmasNode := ident.sons[1]; + if pragmasNode.kind <> nkPragma then + InternalError(ident.info, 'addPragmaToIdent'); + end; + addSon(pragmasNode, pragma); +end; + +procedure parseRecordBody(var p: TPasParser; result, definition: PNode); var a: PNode; begin @@ -1535,11 +1567,32 @@ begin if result.kind <> nkTupleTy then fixRecordDef(a); addSon(result, a); eat(p, pxEnd); + case p.tok.xkind of + pxSymbol: begin + if (p.tok.ident.id = getIdent('acyclic').id) then begin + if definition <> nil then + addPragmaToIdent(definition.sons[0], newIdentNodeP(p.tok.ident, p)) + else + InternalError(result.info, 'anonymous record is not supported'); + getTok(p); + end + else + InternalError(result.info, 'parseRecordBody'); + end; + pxCommand: begin + if definition <> nil then + addPragmaToIdent(definition.sons[0], parseCommand(p)) + else + InternalError(result.info, 'anonymous record is not supported'); + end; + else begin end + end; opt(p, pxSemicolon); - skipCom(p, result); + skipCom(p, result); end; -function parseRecordOrObject(var p: TPasParser; kind: TNodeKind): PNode; +function parseRecordOrObject(var p: TPasParser; kind: TNodeKind; + definition: PNode): PNode; var a: PNode; begin @@ -1554,10 +1607,10 @@ begin eat(p, pxParRi); end else addSon(result, nil); - parseRecordBody(p, result); + parseRecordBody(p, result, definition); end; -function parseTypeDesc(var p: TPasParser): PNode; +function parseTypeDesc(var p: TPasParser; definition: PNode=nil): PNode; var oldcontext: TPasContext; a, r: PNode; @@ -1567,15 +1620,15 @@ begin p.context := conTypeDesc; if p.tok.xkind = pxPacked then getTok(p); case p.tok.xkind of - pxCommand: result := parseCommand(p); + pxCommand: result := parseCommand(p, definition); pxProcedure, pxFunction: result := parseRoutineType(p); pxRecord: begin getTok(p); if p.tok.xkind = pxCommand then begin result := parseCommand(p); - if result.kind <> nkTupleTy then + if result.kind <> nkTupleTy then InternalError(result.info, 'parseTypeDesc'); - parseRecordBody(p, result); + parseRecordBody(p, result, definition); a := lastSon(result); // embed nkRecList directly into nkTupleTy for i := 0 to sonsLen(a)-1 do @@ -1583,15 +1636,18 @@ begin else addSon(result, a.sons[i]); end else begin - result := newNodeP(nkReturnToken, p); - // we use nkReturnToken to signal that this object should be marked as - // final + result := newNodeP(nkObjectTy, p); addSon(result, nil); addSon(result, nil); - parseRecordBody(p, result); + parseRecordBody(p, result, definition); + if definition <> nil then + addPragmaToIdent(definition.sons[0], + newIdentNodeP(getIdent('final'), p)) + else + InternalError(result.info, 'anonymous record is not supported'); end; end; - pxObject: result := parseRecordOrObject(p, nkObjectTy); + pxObject: result := parseRecordOrObject(p, nkObjectTy, definition); pxParLe: result := parseEnum(p); pxArray: begin result := newNodeP(nkBracketExpr, p); @@ -1622,8 +1678,10 @@ begin getTok(p); if p.tok.xkind = pxCommand then result := parseCommand(p) + else if gCmd = cmdBoot then + result := newNodeP(nkRefTy, p) else - result := newNodeP(nkRefTy, p); + result := newNodeP(nkPtrTy, p); addSon(result, parseTypeDesc(p)) end; pxType: begin @@ -1650,28 +1708,15 @@ end; function parseTypeDef(var p: TPasParser): PNode; var - a, e, pragmasNode: PNode; + a: PNode; begin result := newNodeP(nkTypeDef, p); addSon(result, identVis(p)); addSon(result, nil); // generic params if p.tok.xkind = pxEquals then begin getTok(p); skipCom(p, result); - a := parseTypeDesc(p); + a := parseTypeDesc(p, result); addSon(result, a); - if a.kind = nkReturnToken then begin // a `final` object? - a.kind := nkObjectTy; - if result.sons[0].kind <> nkPragmaExpr then begin - e := newNodeP(nkPragmaExpr, p); - pragmasNode := newNodeP(nkPragma, p); - addSon(e, result.sons[0]); - addSon(e, pragmasNode); - result.sons[0] := e; - end - else - pragmasNode := result.sons[1]; - addSon(pragmasNode, newIdentNodeP(getIdent('final'), p)); - end end else addSon(result, nil); diff --git a/nim/platform.pas b/nim/platform.pas index 896d7b4a2..1c021db86 100644 --- a/nim/platform.pas +++ b/nim/platform.pas @@ -12,8 +12,7 @@ unit platform; // and operating systems. // Note: Unfortunately if an OS or CPU is listed here this does not mean that // Nimrod has been tested on this platform or that the RTL has been ported. -// Feel free to test for your exentric platform! (Windows on I386 and Linux -// on I386 have been tested, though.) +// Feel free to test for your exentric platform! interface @@ -24,7 +23,6 @@ uses type TSystemOS = ( - // This enumeration is stored in rod files, so append new OSes at the end! // Also add OS for in initialization section and alias conditionals to // condsyms (end of module). osNone, @@ -39,6 +37,7 @@ type osNetbsd, osFreebsd, osOpenbsd, + osAix, osPalmos, osQnx, osAmiga, @@ -46,7 +45,8 @@ type osNetware, osMacos, osMacosx, - osEcmaScript + osEcmaScript, + osNimrodVM ); type TInfoOSProp = ( @@ -251,6 +251,22 @@ const props: {@set}[ospNeedsPIC, ospPosix]; ), ( + name: 'AIX'; + parDir: '..'; + dllExt: '.so'; + altDirSep: '/'+''; + dllPrefix: 'lib'; + objExt: '.o'; + newLine: #10+''; + pathSep: ':'+''; + dirSep: '/'+''; + scriptExt: '.sh'; + curDir: '.'+''; + exeExt: ''; + extSep: '.'+''; + props: {@set}[ospNeedsPIC, ospPosix]; + ), + ( name: 'PalmOS'; parDir: '..'; dllExt: '.so'; @@ -377,11 +393,26 @@ const exeExt: ''; extSep: '.'+''; props: {@set}[]; + ), + ( + name: 'NimrodVM'; + parDir: '..'; + dllExt: '.so'; + altDirSep: '/'+''; + dllPrefix: 'lib'; + objExt: '.o'; + newLine: #10+''; + pathSep: ':'+''; + dirSep: '/'+''; + scriptExt: '.sh'; + curDir: '.'+''; + exeExt: ''; + extSep: '.'+''; + props: {@set}[]; ) ); type TSystemCPU = ( - // This enumeration is stored in rod files, so append new CPUs at the end! // Also add CPU for in initialization section and alias conditionals to // condsyms (end of module). cpuNone, @@ -395,7 +426,8 @@ type cpuAmd64, cpuMips, cpuArm, - cpuEcmaScript + cpuEcmaScript, + cpuNimrodVM ); type TEndian = (littleEndian, bigEndian); @@ -485,6 +517,13 @@ const endian: bigEndian; floatSize: 64; bit: 32; + ), + ( + name: 'nimrodvm'; + intSize: 32; + endian: bigEndian; + floatSize: 64; + bit: 32; ) ); diff --git a/nim/pnimsyn.pas b/nim/pnimsyn.pas index 27841229e..2cb34e708 100644 --- a/nim/pnimsyn.pas +++ b/nim/pnimsyn.pas @@ -6,7 +6,6 @@ // See the file "copying.txt", included in this // distribution, for details about the copyright. // - unit pnimsyn; // This module implements the parser of the standard Nimrod representation. @@ -21,15 +20,14 @@ unit pnimsyn; interface uses - nsystem, scanner, idents, strutils, ast, msgs; + nsystem, llstream, scanner, idents, strutils, ast, msgs; function ParseFile(const filename: string): PNode; type TParser = record // a TParser object represents a module that // is being parsed - lex: PLexer; // we need a stack of lexers because - // of support for the `include` command + lex: PLexer; // the lexer that is used for parsing tok: PToken; // the current token end; @@ -38,22 +36,26 @@ function ParseModule(var p: TParser): PNode; function parseExpr(var p: TParser): PNode; function parseStmt(var p: TParser): PNode; -function openParser(var p: TParser; const filename: string): TResult; -procedure bufferParser(var p: TParser; const buffer: string); - // the same as `openParser`, but does use a buffer and does not read from - // a file +procedure openParser(var p: TParser; const filename: string; + inputstream: PLLStream); procedure closeParser(var p: TParser); +function parseTopLevelStmt(var p: TParser): PNode; +// implements an iterator. Returns the next top-level statement or nil if end +// of stream. + implementation function ParseFile(const filename: string): PNode; var p: TParser; + f: TBinaryFile; begin - if OpenParser(p, filename) = failure then begin + if not OpenFile(f, filename) then begin rawMessage(errCannotOpenFile, filename); exit end; + OpenParser(p, filename, LLStreamOpen(f)); result := ParseModule(p); CloseParser(p); end; @@ -73,16 +75,17 @@ begin {@emit} end; -procedure bufferParser(var p: TParser; const buffer: string); +procedure getTok(var p: TParser); begin - initParser(p); - bufferLexer(p.lex^, buffer); + rawGetTok(p.lex^, p.tok^); end; -function OpenParser(var p: TParser; const filename: string): TResult; +procedure OpenParser(var p: TParser; const filename: string; + inputStream: PLLStream); begin initParser(p); - result := OpenLexer(p.lex^, filename); + OpenLexer(p.lex^, filename, inputstream); + getTok(p); // read the first token end; procedure CloseParser(var p: TParser); @@ -95,12 +98,6 @@ end; // ---------------- parser helpers -------------------------------------------- -procedure getTok(var p: TParser); -begin - rawGetTok(p.lex^, p.tok^); - //printTok(p.tok); // DEBUG -end; - procedure skipComment(var p: TParser; node: PNode); begin if p.tok.tokType = tkComment then begin @@ -177,8 +174,7 @@ end; function newNodeP(kind: TNodeKind; const p: TParser): PNode; begin - result := newNode(kind); - result.info := getLineInfo(p.lex^); + result := newNodeI(kind, getLineInfo(p.lex^)); end; function newIntNodeP(kind: TNodeKind; const intVal: BiggestInt; @@ -261,22 +257,22 @@ begin getTok(p); eat(p, tkDotDot); if (p.tok.tokType = tkOpr) and (p.tok.ident.s = '$'+'') then begin - s := s + '$'+''; - getTok(p); + addChar(s, '$'); + getTok(p); end; end else if p.tok.tokType = tkDotDot then begin s := s + '..'; getTok(p); if (p.tok.tokType = tkOpr) and (p.tok.ident.s = '$'+'') then begin - s := s + '$'+''; + addChar(s, '$'); getTok(p); end; end; eat(p, tkBracketRi); - s := s + ']'+''; + addChar(s, ']'); if p.tok.tokType = tkEquals then begin - s := s + '='; getTok(p); + addChar(s, '='); getTok(p); end; addSon(result, newIdentNodeP(getIdent(s), p)); end; @@ -485,8 +481,7 @@ begin getTok(p); optInd(p, result); a := result; - result := newNode(nkQualified); - result.info := a.info; + result := newNodeI(nkQualified, a.info); addSon(result, a); addSon(result, parseSymbol(p)); end; @@ -809,8 +804,7 @@ begin getTok(p); optInd(p, result); b := parseExpr(p); - result := newNode(nkAsgn); - result.info := a.info; + result := newNodeI(nkAsgn, a.info); addSon(result, a); addSon(result, b); end @@ -1449,6 +1443,12 @@ begin end end; +function newCommentStmt(var p: TParser): PNode; +begin + result := newNodeP(nkCommentStmt, p); + result.info.line := result.info.line - int16(1); +end; + type TDefParser = function (var p: TParser): PNode; @@ -1475,7 +1475,7 @@ begin tkDed: begin getTok(p); break end; tkEof: break; // BUGFIX tkComment: begin - a := newNodeP(nkCommentStmt, p); + a := newCommentStmt(p); skipComment(p, a); addSon(result, a); end; @@ -1618,7 +1618,7 @@ begin while true do begin case p.tok.tokType of tkSad: getTok(p); - tkCase, tkWhen, tkSymbol, tkAccent: begin + tkCase, tkWhen, tkSymbol, tkAccent, tkNil: begin addSon(result, parseRecordPart(p)); end; tkDed: begin getTok(p); break end; @@ -1636,6 +1636,10 @@ begin result := parseIdentColonEquals(p, true); skipComment(p, result); end; + tkNil: begin + result := newNodeP(nkNilLit, p); + getTok(p); + end; else result := nil end end; @@ -1681,13 +1685,13 @@ begin end else addSon(result, nil); - indAndComment(p, result); // XXX: special extension! + indAndComment(p, result); // special extension! end; function parseVariable(var p: TParser): PNode; begin result := parseIdentColonEquals(p, true); - indAndComment(p, result); // XXX: special extension! + indAndComment(p, result); // special extension! end; function simpleStmt(var p: TParser): PNode; @@ -1703,13 +1707,11 @@ begin tkImport: result := parseImportStmt(p); tkFrom: result := parseFromStmt(p); tkInclude: result := parseIncludeStmt(p); - tkComment: begin - result := newNodeP(nkCommentStmt, p); - end; + tkComment: result := newCommentStmt(p); //tkSad, tkInd, tkDed: assert(false); else result := parseExprStmt(p) end; - skipComment(p, result); + skipComment(p, result); end; function complexOrSimpleStmt(var p: TParser): PNode; @@ -1770,7 +1772,6 @@ end; function parseModule(var p: TParser): PNode; begin result := newNodeP(nkStmtList, p); - getTok(p); // read first token while true do begin case p.tok.tokType of tkSad: getTok(p); @@ -1781,4 +1782,23 @@ begin end end; +function parseTopLevelStmt(var p: TParser): PNode; +begin + result := nil; + while true do begin + case p.tok.tokType of + tkSad: getTok(p); + tkDed, tkInd: begin + parMessage(p, errInvalidIndentation); + break; + end; + tkEof: break; + else begin + result := complexOrSimpleStmt(p); + break + end + end + end +end; + end. diff --git a/nim/pragmas.pas b/nim/pragmas.pas index c3a6c42d2..372d8d4a4 100644 --- a/nim/pragmas.pas +++ b/nim/pragmas.pas @@ -6,9 +6,34 @@ // See the file "copying.txt", included in this // distribution, for details about the copyright. // +unit pragmas; // This module implements semantic checking for pragmas +interface + +{$include 'config.inc'} + +uses + nsystem, nos, platform, condsyms, ast, astalgo, idents, semdata, msgs, + rnimsyn, wordrecg, ropes, options, strutils, lists, extccomp, nmath, + magicsys; + +procedure pragmaProc(c: PContext; s: PSym; n: PNode); +procedure pragmaMacro(c: PContext; s: PSym; n: PNode); +procedure pragmaIterator(c: PContext; s: PSym; n: PNode); +procedure pragmaStmt(c: PContext; s: PSym; n: PNode); +procedure pragmaLambda(c: PContext; s: PSym; n: PNode); +procedure pragmaType(c: PContext; s: PSym; n: PNode); +procedure pragmaField(c: PContext; s: PSym; n: PNode); +procedure pragmaVar(c: PContext; s: PSym; n: PNode); +procedure pragmaConst(c: PContext; s: PSym; n: PNode); +procedure pragmaProcType(c: PContext; s: PSym; n: PNode); + +function pragmaAsm(c: PContext; n: PNode): char; + +implementation + procedure invalidPragma(n: PNode); begin liMessage(n.info, errInvalidPragmaX, renderTree(n, {@set}[renderNoComments])); @@ -25,7 +50,7 @@ begin it := n.sons[i]; if (it.kind = nkExprColonExpr) and (it.sons[0].kind = nkIdent) then begin case whichKeyword(it.sons[0].ident) of - wAsmQuote: begin + wSubsChar: begin if it.sons[1].kind = nkCharLit then result := chr(int(it.sons[1].intVal)) else invalidPragma(it) @@ -51,14 +76,12 @@ procedure MakeExternImport(s: PSym; const extname: string); begin s.loc.r := toRope(extname); Include(s.flags, sfImportc); - Include(s.flags, sfNoStatic); Exclude(s.flags, sfForward); end; procedure MakeExternExport(s: PSym; const extname: string); begin s.loc.r := toRope(extname); - Include(s.flags, sfNoStatic); Include(s.flags, sfExportc); end; @@ -69,7 +92,7 @@ begin result := '' end else begin - n.sons[1] := semConstExpr(c, n.sons[1]); + n.sons[1] := c.semConstExpr(c, n.sons[1]); case n.sons[1].kind of nkStrLit, nkRStrLit, nkTripleStrLit: result := n.sons[1].strVal; else begin @@ -87,7 +110,7 @@ begin result := 0 end else begin - n.sons[1] := semConstExpr(c, n.sons[1]); + n.sons[1] := c.semConstExpr(c, n.sons[1]); case n.sons[1].kind of nkIntLit..nkInt64Lit: result := int(n.sons[1].intVal); else begin @@ -114,7 +137,10 @@ var begin if not (sfSystemModule in c.module.flags) then liMessage(n.info, errMagicOnlyInSystem); - v := expectStrLit(c, n); + if n.kind <> nkExprColonExpr then + liMessage(n.info, errStringLiteralExpected); + if n.sons[1].kind = nkIdent then v := n.sons[1].ident.s + else v := expectStrLit(c, n); Include(s.flags, sfImportc); // magics don't need an implementation, so we // treat them as imported, instead of modifing a lot of working code Include(s.loc.Flags, lfNoDecl); // magics don't need to be declared! @@ -260,6 +286,7 @@ begin wStacktrace: OnOff(c, n, {@set}[optStackTrace]); wLinetrace: OnOff(c, n, {@set}[optLineTrace]); wDebugger: OnOff(c, n, {@set}[optEndb]); + wProfiler: OnOff(c, n, {@set}[optProfiler]); wByRef: OnOff(c, n, {@set}[optByRef]); wDynLib: processDynLib(c, n, nil); // ------------------------------------------------------- @@ -323,16 +350,20 @@ end; procedure processDefine(c: PContext; n: PNode); begin - if (n.kind = nkExprColonExpr) and (n.sons[1].kind = nkIdent) then - DefineSymbol(n.sons[1].ident.s) + if (n.kind = nkExprColonExpr) and (n.sons[1].kind = nkIdent) then begin + DefineSymbol(n.sons[1].ident.s); + liMessage(n.info, warnDeprecated, 'define'); + end else invalidPragma(n) end; procedure processUndef(c: PContext; n: PNode); begin - if (n.kind = nkExprColonExpr) and (n.sons[1].kind = nkIdent) then - UndefSymbol(n.sons[1].ident.s) + if (n.kind = nkExprColonExpr) and (n.sons[1].kind = nkIdent) then begin + UndefSymbol(n.sons[1].ident.s); + liMessage(n.info, warnDeprecated, 'undef'); + end else invalidPragma(n) end; @@ -366,9 +397,8 @@ begin case feature of linkNormal: extccomp.addFileToLink(found); linkSys: begin - if not (optCompileSys in gGlobalOptions) then - extccomp.addFileToLink(joinPath(libpath, - completeCFilePath(found, false))); + extccomp.addFileToLink(joinPath(libpath, + completeCFilePath(found, false))); end else internalError(n.info, 'processCommonLink'); end @@ -423,6 +453,7 @@ begin makeExternImport(sym, getOptionalStr(c, it, sym.name.s)); end; wAlign: begin + if sym.typ = nil then invalidPragma(it); sym.typ.align := expectIntLit(c, it); if not IsPowerOfTwo(sym.typ.align) and (sym.typ.align <> 0) then liMessage(it.info, errPowerOfTwoExpected); @@ -434,8 +465,17 @@ begin end; wVolatile: begin noVal(it); Include(sym.flags, sfVolatile); end; wRegister: begin noVal(it); include(sym.flags, sfRegister); end; + wThreadVar: begin noVal(it); include(sym.flags, sfThreadVar); end; wMagic: processMagic(c, it, sym); - wNostatic: begin noVal(it); include(sym.flags, sfNoStatic); end; + wCompileTime: begin + noVal(it); + include(sym.flags, sfCompileTime); + include(sym.loc.Flags, lfNoDecl); + end; + wMerge: begin + noval(it); + include(sym.flags, sfMerge); + end; wHeader: begin lib := getLib(c, libHeader, expectStrLit(c, it)); addToLib(lib, sym); @@ -453,7 +493,7 @@ begin makeExternExport(sym, sym.name.s); include(sym.flags, sfCompilerProc); include(sym.flags, sfUsed); // suppress all those stupid warnings - StrTableAdd(magicsys.compilerprocs, sym); + registerCompilerProc(sym); end; wCppMethod: begin makeExternImport(sym, getOptionalStr(c, it, sym.name.s)); @@ -465,12 +505,19 @@ begin end; wVarargs: begin noVal(it); + if sym.typ = nil then invalidPragma(it); include(sym.typ.flags, tfVarargs); end; wFinal: begin noVal(it); + if sym.typ = nil then invalidPragma(it); include(sym.typ.flags, tfFinal); end; + wAcyclic: begin + noVal(it); + if sym.typ = nil then invalidPragma(it); + include(sym.typ.flags, tfAcyclic); + end; wTypeCheck: begin noVal(it); include(sym.flags, sfTypeCheck); @@ -507,11 +554,12 @@ begin wChecks, wObjChecks, wFieldChecks, wRangechecks, wBoundchecks, wOverflowchecks, wNilchecks, wAssertions, wWarnings, wHints, wLinedir, wStacktrace, - wLinetrace, wOptimization, wByRef, wCallConv, wDebugger: + wLinetrace, wOptimization, wByRef, wCallConv, wDebugger, wProfiler: processOption(c, it); // calling conventions (boring...): firstCallConv..lastCallConv: begin assert(sym <> nil); + if sym.typ = nil then invalidPragma(it); sym.typ.callConv := wordToCallConv(k) end else invalidPragma(it); @@ -538,15 +586,15 @@ end; procedure pragmaProc(c: PContext; s: PSym; n: PNode); begin pragma(c, s, n, {@set}[FirstCallConv..LastCallConv, - wImportc, wExportc, wNostatic, wNodecl, wMagic, wNosideEffect, - wNoreturn, wDynLib, wHeader, wReturnsNew, wCompilerProc, wPure, - wCppMethod, wDeprecated, wVarargs]); + wImportc, wExportc, wNodecl, wMagic, wNosideEffect, + wNoreturn, wDynLib, wHeader, wCompilerProc, wPure, + wCppMethod, wDeprecated, wVarargs, wCompileTime, wMerge]); end; procedure pragmaMacro(c: PContext; s: PSym; n: PNode); begin pragma(c, s, n, {@set}[FirstCallConv..LastCallConv, - wImportc, wExportc, wNostatic, wNodecl, wMagic, wNosideEffect, + wImportc, wExportc, wNodecl, wMagic, wNosideEffect, wCompilerProc, wDeprecated, wTypeCheck]); end; @@ -570,13 +618,13 @@ end; procedure pragmaLambda(c: PContext; s: PSym; n: PNode); begin pragma(c, s, n, {@set}[FirstCallConv..LastCallConv, - wImportc, wExportc, wNostatic, wNodecl, wNosideEffect, - wNoreturn, wDynLib, wHeader, wReturnsNew, wPure, wDeprecated]); + wImportc, wExportc, wNodecl, wNosideEffect, + wNoreturn, wDynLib, wHeader, wPure, wDeprecated]); end; procedure pragmaType(c: PContext; s: PSym; n: PNode); begin - pragma(c, s, n, {@set}[wImportc, wExportc, wDeprecated, wMagic, + pragma(c, s, n, {@set}[wImportc, wExportc, wDeprecated, wMagic, wAcyclic, wNodecl, wPure, wHeader, wCompilerProc, wFinal]); end; @@ -587,9 +635,9 @@ end; procedure pragmaVar(c: PContext; s: PSym; n: PNode); begin - pragma(c, s, n, {@set}[wImportc, wExportc, wVolatile, wRegister, - wNodecl, wMagic, wNostatic, wHeader, - wDeprecated, wCompilerProc, wDynLib]); + pragma(c, s, n, {@set}[wImportc, wExportc, wVolatile, wRegister, wThreadVar, + wNodecl, wMagic, wHeader, wDeprecated, wCompilerProc, + wDynLib]); end; procedure pragmaConst(c: PContext; s: PSym; n: PNode); @@ -602,3 +650,5 @@ procedure pragmaProcType(c: PContext; s: PSym; n: PNode); begin pragma(c, s, n, [FirstCallConv..LastCallConv, wVarargs]); end; + +end. diff --git a/nim/procfind.pas b/nim/procfind.pas index f7a78c8b9..9c4786e53 100644 --- a/nim/procfind.pas +++ b/nim/procfind.pas @@ -6,10 +6,24 @@ // See the file "copying.txt", included in this // distribution, for details about the copyright. // +unit procfind; // This module implements the searching for procs and iterators. // This is needed for proper handling of forward declarations. +interface + +{$include 'config.inc'} + +uses + nsystem, ast, astalgo, msgs, semdata, types; + +function SearchForProc(c: PContext; fn: PSym; tos: int): PSym; +// Searchs for the fn in the symbol table. If the parameter lists are exactly +// the same the sym in the symbol table is returned, else nil. + +implementation + function equalGenericParams(procA, procB: PNode): Boolean; var a, b: PSym; @@ -21,8 +35,10 @@ begin if sonsLen(procA) <> sonsLen(procB) then exit; for i := 0 to sonsLen(procA)-1 do begin - assert(procA.sons[i].kind = nkSym); - assert(procB.sons[i].kind = nkSym); + if procA.sons[i].kind <> nkSym then + InternalError(procA.info, 'equalGenericParams'); + if procB.sons[i].kind <> nkSym then + InternalError(procB.info, 'equalGenericParams'); a := procA.sons[i].sym; b := procB.sons[i].sym; if (a.name.id <> b.name.id) or not sameType(a.typ, b.typ) then exit; @@ -31,8 +47,6 @@ begin end; function SearchForProc(c: PContext; fn: PSym; tos: int): PSym; -// Searchs for the fn in the symbol table. If the parameter lists are exactly -// the same the sym in the symbol table is returned, else nil. var it: TIdentIter; begin @@ -54,3 +68,5 @@ begin result := NextIdentIter(it, c.tab.stack[tos]) end end; + +end. diff --git a/nim/rnimsyn.pas b/nim/rnimsyn.pas index b4ba928fb..6b8e3b3cb 100644 --- a/nim/rnimsyn.pas +++ b/nim/rnimsyn.pas @@ -71,9 +71,9 @@ begin g.comStack := nil; g.tokens := nil; {@emit - g.comStack := [];} + g.comStack := @[];} {@emit - g.tokens := [];} + g.tokens := @[];} g.indent := 0; g.lineLen := 0; g.pos := 0; @@ -1183,6 +1183,7 @@ begin gcoms(g); indentNL(g); gcommaAux(g, n, g.indent, 1); + gcoms(g); // BUGFIX: comment for the last enum field dedent(g); end; nkEnumFieldDef: begin diff --git a/nim/rodgen.pas b/nim/rodgen.pas deleted file mode 100644 index 8ef71dcb3..000000000 --- a/nim/rodgen.pas +++ /dev/null @@ -1,441 +0,0 @@ -// -// -// The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf -// -// See the file "copying.txt", included in this -// distribution, for details about the copyright. -// - -unit rodgen; - -// This module is responsible for loading and storing of rod -// files. -{ - Reading and writing binary files are really hard to debug. Therefore we use - a text-based format. It consists of: - - - a header - - a section that contains the lengths of the other sections - - a ident section that contains all PIdents - - an AST section that contains the module's AST - - The resulting file sizes are currently almost as small as the source files - (about 10%-30% increase). - - Long comments have the format: @<jump_info>#comment - Short comments: #comment -} - -interface - -{$include 'config.inc'} - -uses - sysutils, nsystem, nos, options, strutils, nversion, ast, astalgo, msgs, - platform, ropes, idents; - -type - TRodReaderFlag = (mrSkipComments, mrSkipProcBodies); - TRodReaderFlags = set of TRodReaderFlag; - -const - FileVersion = '04'; // modify this if the rod-format changes! - -procedure generateRod(module: PNode; const filename: string); -function readRod(const filename: string; const flags: TRodReaderFlags): PNode; - - -implementation - -// special characters: -// \ # ? ! $ @ #128..#255 - -type - TIntObj = object(NObject) - intVal: int; - end; - PIntObj = ^TIntObj; - - TRodGen = record - identTab: TTable; // maps PIdent to PIntObj - idents: PRope; - end; - -procedure toBase62Aux(var str: string; x: BiggestInt); -const - chars: string = - '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; -var - v, rem: biggestInt; - d: char; -begin - v := x; - rem := v mod 62; - if (rem < 0) then begin - str := str + '-'; - v := -(v div 62); - rem := -rem; - end - else - v := v div 62; - d := chars[int(rem)+strStart]; - if (v <> 0) then toBase62Aux(str, v); - addChar(str, d); -end; - -function toBase62(x: BiggestInt): PRope; -var - res: string; -begin - res := ''; - toBase62Aux(res, x); - result := toRope(res); -end; - -function fromBase62i(const s: string; index: int; out x: int): int; -var - i: int; - sign: int; -begin - i := index; - sign := -1; - if s[i] = '-' then begin - inc(i); - sign := 1 - end; - x := 0; - while i <= length(s)+strStart-1 do begin - case s[i] of - '0'..'9': x := x * 62 - (ord(s[i]) - ord('0')); - 'a'..'z': x := x * 62 - (ord(s[i]) - ord('a') + 10); - 'A'..'Z': x := x * 62 - (ord(s[i]) - ord('A') + 36); - else break; - end; - inc(i) - end; - x := x * sign; - result := i -end; - -function fromBase62b(const s: string; index: int; out x: BiggestInt): int; -var - i: int; - sign: biggestInt; -begin - i := index; - sign := -1; - if s[i] = '-' then begin - inc(i); - sign := 1 - end; - x := 0; - while i <= length(s)+strStart-1 do begin - case s[i] of - '0'..'9': x := x * 62 - (ord(s[i]) - ord('0')); - 'a'..'z': x := x * 62 - (ord(s[i]) - ord('a') + 10); - 'A'..'Z': x := x * 62 - (ord(s[i]) - ord('A') + 36); - else break; - end; - inc(i) - end; - x := x * sign; - result := i -end; - -function encode(const s: string): PRope; -var - i: int; - res: string; -begin - res := ''; - for i := strStart to length(s)+strStart-1 do begin - case s[i] of - '\', '?', '!', '@', '$', #128..#255, #0..#31: - res := res +{&} '\' +{&} toHex(ord(s[i]), 2) - else - addChar(res, s[i]) - end - end; - result := toRope(res); -end; - -function encodeIdent(var g: TRodGen; ident: PIdent): PRope; -var - n: PIntObj; -begin - n := PIntObj(TableGet(g.identTab, ident)); - if n = nil then begin - new(n); - {@ignore} - fillChar(n^, sizeof(n^), 0); - {@emit} - n.intVal := ropeLen(g.idents); - TablePut(g.identTab, ident, n); - - app(g.idents, encode(ident.s)); - app(g.idents, '$'+''); - end; - result := toBase62(n.intVal) -end; - -function encodeNode(var g: TRodGen; const fInfo: TLineInfo; n: PNode): PRope; -var - i, len: int; - com: PRope; -begin - if n = nil then begin // nil nodes have to be stored too! - result := toRope(#255+''); exit - end; - result := nil; - if n.comment <> snil then begin - com := encode(n.comment); - if ropeLen(com) >= 128 then - appf(result, '@$1$2', [toBase62(ropeLen(com)), com]) - else - result := com - // do not emit comments to the string table as this would only increase - // file size, because comments are likely to be unique! - end; - // Line information takes easily 50% or more of the filesize! Therefore we - // omit line information if it is the same as the father's line information: - if (finfo.line <> int(n.info.line)) then - appf(result, '?$1,$2', [toBase62(n.info.col), - toBase62(n.info.line)]) - else if (finfo.col <> int(n.info.col)) then - appf(result, '?$1', [toBase62(n.info.col)]); - // No need to output the file index, as this is the serialization of one - // file. - if n.flags <> {@set}[] then - appf(result, '$$$1', [toBase62({@cast}int(n.flags))]); - case n.kind of - nkCharLit..nkInt64Lit: - appf(result, '!$1', [toBase62(n.intVal)]); - nkFloatLit..nkFloat64Lit: - appf(result, '!$1', [toRopeF(n.floatVal)]); - nkStrLit..nkTripleStrLit: - appf(result, '!$1', [encode(n.strVal)]); - nkSym: assert(false); - nkIdent: - appf(result, '!$1', [encodeIdent(g, n.ident)]); - else begin - for i := 0 to sonsLen(n)-1 do - app(result, encodeNode(g, n.info, n.sons[i])); - end - end; - len := ropeLen(result); - result := ropef('$1$2$3', [toBase62(ord(n.kind)), toBase62(len), result]); -end; - -procedure generateRod(module: PNode; const filename: string); -var - g: TRodGen; - ast: PRope; - info: TLineInfo; -begin - initTable(g.identTab); - g.idents := nil; - info := newLineInfo(changeFileExt(filename, '.nim'), -1, -1); - ast := encodeNode(g, info, module); - - writeRope(ropef('AA02 $1 $2,$3 $4 $5', - [toRope(FileVersion), - toBase62(ropeLen(g.idents)), toBase62(ropeLen(ast)), - g.idents, ast]), filename); -end; - -// ----------------------- reader --------------------------------------------- - -type - TRodReader = record - s: string; // buffer of the whole Mo2 file - pos: int; // current position - identOff: int; // offset of start of first PIdent - identLen: int; // length of ident part - astOff: int; // offset of AST part - astLen: int; // length of AST part - flags: TRodReaderFlags; - end; - -procedure initRodReader(out r: TRodReader; const filename: string; - const flags: TRodReaderFlags); -var - i: int; - version: string; -begin - r.flags := flags; - r.pos := -1; // indicates an error - r.s := readFile(filename) {@ignore} + #0 {@emit}; - r.identOff := 0; - r.astOff := 0; - r.identLen := 0; - r.astLen := 0; - - // read header: - i := strStart; - if (r.s[i] = 'A') and (r.s[i+1] = 'A') - and (r.s[i+2] = '0') and (r.s[i+3] = '2') and (r.s[i+4] = ' ') then begin - // check version: - inc(i, 5); - version := ''; - while (r.s[i] <> ' ') and (r.s[i] <> #0) do begin - addChar(version, r.s[i]); - inc(i); - end; - if r.s[i] = ' ' then inc(i); - if version = FileVersion then begin - i := fromBase62i(r.s, i, r.identLen); - if r.s[i] = ',' then inc(i); - i := fromBase62i(r.s, i, r.astLen); - if r.s[i] = ' ' then inc(i); - r.identOff := i; - r.astOff := i+r.identLen+1; - assert(r.s[r.astOff-1] = ' '); - r.pos := r.astOff; // everything seems fine - end - end -end; - -procedure hexChar(c: char; var xi: int); -begin - case c of - '0'..'9': xi := (xi shl 4) or (ord(c) - ord('0')); - 'a'..'f': xi := (xi shl 4) or (ord(c) - ord('a') + 10); - 'A'..'F': xi := (xi shl 4) or (ord(c) - ord('A') + 10); - else begin end - end -end; - -function decode(const s: string; index: int; var d: string): int; -var - i, xi: int; -begin - i := index; - while true do begin - case s[i] of - '?', '$', '@', '!', #128..#255, #0: break; - '\': begin - inc(i, 3); xi := 0; - hexChar(s[i-2], xi); - hexChar(s[i-1], xi); - addChar(d, chr(xi)); - end; - else begin - addChar(d, s[i]); - inc(i); - end - end - end; - result := i; -end; - -function readNode(var r: TRodReader; const fatherInfo: TLineInfo; - skip: bool): PNode; -var - i, len, x, endpos: int; - kind: TNodeKind; - fl: string; -begin - result := nil; - i := r.pos; - if r.s[i] = #255 then begin - inc(r.pos); exit // nil node - end; - i := fromBase62i(r.s, i, x); - kind := TNodeKind(x); - assert((kind >= low(TNodeKind)) and (kind <= high(TNodeKind))); - inc(i); // skip kind - i := fromBase62i(r.s, i, len); - endpos := i+len-1; - if skip then - inc(i, len) - else begin - result := newNode(kind); - result.info := fatherInfo; - // comment: - if r.s[i] = '#' then begin - result.comment := ''; - i := decode(r.s, i, result.comment); - if mrSkipComments in r.flags then result.comment := snil; - end - else if r.s[i] = '@' then begin - inc(i); - i := fromBase62i(r.s, i, x); - if mrSkipComments in r.flags then - inc(i, x) - else begin - result.comment := ''; - i := decode(r.s, i, result.comment) - end - end; - // info: - if r.s[i] = '?' then begin - inc(i); - i := fromBase62i(r.s, i, x); - result.info.col := x; - if r.s[i] = ',' then begin - inc(i); - i := fromBase62i(r.s, i, x); - result.info.line := x - end - end; - // base: - if r.s[i] = '$' then begin - inc(i); - i := fromBase62i(r.s, i, x); - result.flags := {@cast}TNodeFlags(x); - end; - // atom: - if r.s[i] = '!' then begin - inc(i); - case kind of - nkCharLit..nkInt64Lit: - i := fromBase62b(r.s, i, result.intVal); - nkFloatLit..nkFloat64Lit: begin - fl := ''; - i := decode(r.s, i, fl); - result.floatVal := parseFloat(fl); - end; - nkStrLit..nkTripleStrLit: - i := decode(r.s, i, result.strVal); - nkSym: assert(false); - nkIdent: begin - i := fromBase62i(r.s, i, x); - fl := ''; - {@discard} decode(r.s, r.identOff+x, fl); - result.ident := getIdent(fl) - end - else assert(false); - end - end - else if r.s[i] >= #128 then begin - case kind of - nkCharLit..nkInt64Lit, nkFloatLit..nkFloat64Lit, - nkStrLit..nkTripleStrLit, nkSym, nkIdent: assert(false); - else begin end; - end; - r.pos := i; - // H3YYY - // 01234 - while r.pos <= endpos do - addSon(result, readNode(r, result.info, false)); - i := r.pos; - end - else assert(r.s[i] = #0); - end; - r.pos := i; -end; - -function readRod(const filename: string; const flags: TRodReaderFlags): PNode; -var - r: TRodReader; - info: TLineInfo; -begin - result := nil; - initRodReader(r, filename, flags); - info := newLineInfo(changeFileExt(filename, '.nim'), -1, -1); - if r.pos > 0 then - result := readNode(r, info, false); -end; - -end. diff --git a/nim/ropes.pas b/nim/ropes.pas index 0e4b4981b..e82f1e96d 100644 --- a/nim/ropes.pas +++ b/nim/ropes.pas @@ -14,7 +14,7 @@ unit ropes; efficiently; especially concatenation is done in O(1) instead of O(N). Ropes make use a lazy evaluation: They are essentially concatenation trees that are only flattened when converting to a native Nimrod - string or when written to disk. The empty string is represented by a + string or when written to disk. The empty string is represented with a nil pointer. A little picture makes everything clear: @@ -57,10 +57,6 @@ unit ropes; To cache them they are inserted in another tree, a splay tree for best performance. But for the caching tree we use the leafs' left and right pointers. - - Experiments show that for bootstrapping the whole compiler needs - ~1 MB less space because of this optimization. For bigger programs - this is likely to increase even further. } interface @@ -71,7 +67,7 @@ uses nsystem, msgs, strutils, platform, hashes, crc; const - CacheLeafs = True; + CacheLeafs = true; countCacheMisses = False; // see what our little optimization gives type @@ -85,7 +81,7 @@ type left, right: PRope; len: int; data: string; // != nil if a leaf - end; + end {@acyclic}; // the empty rope is represented by nil to safe space TRopeSeq = array of PRope; @@ -157,7 +153,7 @@ begin if hits+misses <> 0 then result := 'Misses: ' +{&} ToString(misses) +{&} ' total: ' +{&} toString(hits+misses) +{&} - ' quot: ' +{&} toStringF(misses / (hits+misses)) + ' quot: ' +{&} toStringF(toFloat(misses) / toFloat(hits+misses)) else result := '' end; @@ -376,7 +372,7 @@ procedure InitStack(var stack: TRopeSeq); begin {@ignore} setLength(stack, 0); - {@emit stack := [];} + {@emit stack := @[];} end; procedure push(var stack: TRopeSeq; r: PRope); @@ -439,6 +435,8 @@ begin if head <> nil then newWriteRopeRec(f, head); nimCloseFile(f); end + else + rawMessage(errCannotOpenFile, filename); end; procedure recRopeToStr(var result: string; var resultLen: int; p: PRope); @@ -519,7 +517,9 @@ begin start := i; while (i <= len + StrStart - 1) do if (frmt[i] <> '$') then inc(i) else break; - if i-1 >= start then app(result, ncopy(frmt, start, i-1)); + if i-1 >= start then begin + app(result, ncopy(frmt, start, i-1)); + end end; assert(RopeInvariant(result)); end; @@ -588,7 +588,7 @@ function newCrcFromRopeAux(r: PRope; startVal: TCrc32): TCrc32; var stack: TRopeSeq; it: PRope; - i: int; + L, i: int; begin initStack(stack); push(stack, r); @@ -600,8 +600,12 @@ begin it := it.left; end; assert(it.data <> snil); - for i := strStart to length(it.data)+strStart-1 do + i := strStart; + L := length(it.data)+strStart; + while i < L do begin result := updateCrc32(it.data[i], result); + inc(i); + end end end; @@ -616,7 +620,7 @@ var c: TCrc32; begin c := crcFromFile(filename); - if int(c) <> crcFromRope(r) then begin + if c <> crcFromRope(r) then begin writeRope(r, filename); result := true end diff --git a/nim/rst.pas b/nim/rst.pas index 54958aff2..b5e5846b1 100644 --- a/nim/rst.pas +++ b/nim/rst.pas @@ -8,7 +8,7 @@ // unit rst; -// This module implements a *reStructuredText* parser. Currently, only a small +// This module implements a *reStructuredText* parser. Currently, only a // subset is provided. Later, there will be additions. interface @@ -126,7 +126,7 @@ type // the document or the section level: int; // valid for some node kinds sons: TRstNodeSeq; // the node's sons - end; + end {@acyclic}; function rstParse(const text: string; // the text to be parsed @@ -360,7 +360,7 @@ begin {@ignore} fillChar(result^, sizeof(result^), 0); {@emit - result.sons := []; + result.sons := @[]; } result.kind := kind; end; @@ -407,9 +407,9 @@ begin fillChar(result^, sizeof(result^), 0); {@emit} {@emit - result.subs := [];} + result.subs := @[];} {@emit - result.refs := [];} + result.refs := @[];} end; function tokInfo(const p: TRstParser; const tok: TToken): TLineInfo; @@ -456,9 +456,9 @@ begin p.indentStack := nil; pushInd(p, 0); {@emit - p.indentStack := [0];} + p.indentStack := @[0];} {@emit - p.tok := [];} + p.tok := @[];} p.idx := 0; p.filename := ''; p.hasToc := false; @@ -1535,9 +1535,9 @@ begin cols := nil; row := nil; {@emit - cols := [];} + cols := @[];} {@emit - row := [];} + row := @[];} a := nil; c := p.tok[p.idx].symbol[strStart]; while true do begin @@ -1873,13 +1873,6 @@ type TDirFlags = set of TDirFlag; TSectionParser = function (var p: TRstParser): PRstNode; -{@emit -function assigned(contentParser: TSectionParser): bool; -begin - result := contentParser <> nil; -end; -} - function parseDirective(var p: TRstParser; flags: TDirFlags; contentParser: TSectionParser): PRstNode; var diff --git a/nim/scanner.pas b/nim/scanner.pas index b9a61f95d..98bb54c07 100644 --- a/nim/scanner.pas +++ b/nim/scanner.pas @@ -24,7 +24,7 @@ interface uses charsets, nsystem, sysutils, hashes, options, msgs, strutils, platform, idents, - lexbase, wordrecg; + lexbase, llstream, wordrecg; const MaxLineLength = 80; // lines longer than this lead to a warning @@ -40,15 +40,18 @@ type tkSymbol, // keywords: //[[[cog - //keywords = (file("data/keywords.txt").read()).split() + //from string import split, capitalize + //keywords = split(open("data/keywords.txt").read()) //idents = "" //strings = "" //i = 1 //for k in keywords: - // idents += "tk" + k.capitalize() + ", " - // strings += "'" + k + "', " - // if i % 4 == 0: idents += "\n"; strings += "\n" - // i += 1 + // idents = idents + "tk" + capitalize(k) + ", " + // strings = strings + "'" + k + "', " + // if i % 4 == 0: + // idents = idents + "\n" + // strings = strings + "\n" + // i = i + 1 //cog.out(idents) //]]] tkAddr, tkAnd, tkAs, tkAsm, @@ -156,11 +159,14 @@ type // needs so much look-ahead end; +var + gLinesCompiled: int; // all lines that have been compiled + procedure pushInd(var L: TLexer; indent: int); function isKeyword(kind: TTokType): boolean; -function openLexer(out lex: TLexer; const filename: string): TResult; -procedure bufferLexer(out lex: TLexer; const buf: string); +procedure openLexer(out lex: TLexer; const filename: string; + inputstream: PLLStream); procedure rawGetTok(var L: TLexer; var tok: TToken); // reads in the next token into tok and skips it @@ -194,8 +200,10 @@ var begin len := length(L.indentStack); setLength(L.indentStack, len+1); - assert(indent > L.indentStack[len-1]); - L.indentstack[len] := indent; + if (indent > L.indentStack[len-1]) then + L.indentstack[len] := indent + else + InternalError('pushInd'); //writeln('push indent ', indent); end; @@ -222,7 +230,7 @@ begin else if (tok.ident <> nil) then result := tok.ident.s else begin - assert(false); + InternalError('tokToStr'); result := '' end end @@ -251,40 +259,25 @@ begin L.ident := dummyIdent; // this prevents many bugs! end; -function openLexer(out lex: TLexer; const filename: string): TResult; +procedure openLexer(out lex: TLexer; const filename: string; + inputstream: PLLStream); begin {@ignore} - FillChar(lex, sizeof(lex), 0); // work around Delphi/fpc bug + FillChar(lex, sizeof(lex), 0); {@emit} - if initBaseLexer(lex, filename) then - result := Success - else - result := Failure; + openBaseLexer(lex, inputstream); {@ignore} setLength(lex.indentStack, 1); lex.indentStack[0] := 0; -{@emit lex.indentStack := [0]; } +{@emit lex.indentStack := @[0]; } lex.filename := filename; lex.indentAhead := -1; end; -procedure bufferLexer(out lex: TLexer; const buf: string); -begin -{@ignore} - FillChar(lex, sizeof(lex), 0); // work around Delphi/fpc bug -{@emit} - initBaseLexerFromBuffer(lex, buf); -{@ignore} - setLength(lex.indentStack, 1); - lex.indentStack[0] := 0; -{@emit lex.indentStack := [0]; } - lex.filename := 'buffer'; - lex.indentAhead := -1; -end; - procedure closeLexer(var lex: TLexer); begin - deinitBaseLexer(lex); + inc(gLinesCompiled, lex.LineNumber); + closeBaseLexer(lex); end; function getColumn(const L: TLexer): int; @@ -493,7 +486,7 @@ begin end end end; - else assert(false); + else InternalError(getLineInfo(L), 'getNumber'); end; // now look at the optional type suffix: case result.tokType of @@ -505,7 +498,7 @@ begin // XXX: Test this on big endian machine! tkFloat64Lit: result.fNumber := ({@cast}PFloat64(addr(xi)))^; - else assert(false); + else InternalError(getLineInfo(L), 'getNumber'); end end else if isFloatLiteral(result.literal) diff --git a/nim/sem.pas b/nim/sem.pas index d57af7be6..59bf29be5 100644 --- a/nim/sem.pas +++ b/nim/sem.pas @@ -8,7 +8,7 @@ // unit sem; -// This module implements the semantic checking. +// This module implements the semantic checking pass. interface @@ -17,206 +17,20 @@ interface uses sysutils, nsystem, charsets, strutils, lists, options, scanner, ast, astalgo, trees, treetab, wordrecg, - ropes, msgs, platform, nos, condsyms, idents, rnimsyn, types, - extccomp, nmath, magicsys, nversion, nimsets, pnimsyn, ntime, backends; + ropes, msgs, nos, condsyms, idents, rnimsyn, types, platform, + nmath, magicsys, pnimsyn, nversion, nimsets, + semdata, evals, semfold, importer, procfind, lookups, rodread, + pragmas, passes; + +//var +// point: array [0..3] of int; -const - genPrefix = '::'; // prefix for generated names - -type - TOptionEntry = object(lists.TListEntry) - // entries to put on a stack for pragma parsing - options: TOptions; - defaultCC: TCallingConvention; - dynlib: PLib; - Notes: TNoteKinds; - end; - POptionEntry = ^TOptionEntry; - - TProcCon = record // procedure context; also used for top-level - // statements - owner: PSym; // the symbol this context belongs to - resultSym: PSym; // the result symbol (if we are in a proc) - nestedLoopCounter: int; // whether we are in a loop or not - nestedBlockCounter: int; // whether we are in a block or not - end; - PProcCon = ^TProcCon; - - PTransCon = ^TTransCon; - TTransCon = record // part of TContext; stackable - mapping: TIdNodeTable; // mapping from symbols to nodes - owner: PSym; // current owner - forStmt: PNode; // current for stmt - next: PTransCon; - params: TNodeSeq; // parameters passed to the proc - end; - - PContext = ^TContext; - TContext = object(NObject) // a context represents a module - module: PSym; // the module sym belonging to the context - tab: TSymTab; // each module has its own symbol table - AmbigiousSymbols: TStrTable; // contains all ambigious symbols (we cannot - // store this info in the syms themselves!) - generics: PNode; // a list of the things to compile; list of - // nkExprEqExpr nodes which contain the generic - // symbol and the instantiated symbol - converters: TSymSeq; // sequence of converters - optionStack: TLinkedList; - libs: TLinkedList; // all libs used by this module - b: PBackend; - p: PProcCon; // procedure context - transCon: PTransCon; // top of a TransCon stack - lastException: PNode; // last exception - importModule: function (const filename: string; backend: PBackend): PSym; - includeFile: function (const filename: string): PNode; - end; - -function newContext(const nimfile: string): PContext; -function newProcCon(owner: PSym): PProcCon; - -function semModule(c: PContext; n: PNode): PNode; - // Does the semantic pass for node n. The new node is returned and - // n shall not be used after this call! - -procedure importAllSymbols(c: PContext; fromMod: PSym); +function semPass(): TPass; implementation -function newTransCon(): PTransCon; -begin - new(result); -{@ignore} - fillChar(result^, sizeof(result^), 0); -{@emit} - initIdNodeTable(result.mapping); -{@emit result.params := [];} -end; - -procedure pushTransCon(c: PContext; t: PTransCon); -begin - t.next := c.transCon; - c.transCon := t; -end; - -procedure popTransCon(c: PContext); -begin - assert(c.transCon <> nil); - c.transCon := c.transCon.next; -end; - -function lastOptionEntry(c: PContext): POptionEntry; -begin - result := POptionEntry(c.optionStack.tail); -end; - -function newProcCon(owner: PSym): PProcCon; -begin - new(result); -{@ignore} - fillChar(result^, sizeof(result^), 0); -{@emit} - result.owner := owner; -end; - -function newOptionEntry(): POptionEntry; -begin - new(result); -{@ignore} - fillChar(result^, sizeof(result^), 0); -{@emit} - result.options := gOptions; - result.defaultCC := ccDefault; - result.dynlib := nil; - result.notes := gNotes; -end; - -function newContext(const nimfile: string): PContext; -begin - new(result); -{@ignore} - fillChar(result^, sizeof(result^), 0); -{@emit} - InitSymTab(result.tab); - initStrTable(result.AmbigiousSymbols); - initLinkedList(result.optionStack); - initLinkedList(result.libs); - append(result.optionStack, newOptionEntry()); - result.module := nil; - result.generics := newNode(nkStmtList); -{@emit result.converters := [];} -end; - -procedure addConverter(c: PContext; conv: PSym); -var - i, L: int; -begin - L := length(c.converters); - for i := 0 to L-1 do - if c.converters[i].id = conv.id then exit; - setLength(c.converters, L+1); - c.converters[L] := conv; -end; - -// -------------------- embedded debugger ------------------------------------ - -procedure embeddedDbg(c: PContext; n: PNode); -begin - if optVerbose in gGlobalOptions then liMessage(n.info, hintProcessing); - //{@discard} inCheckpoint(n.info) -end; - -// --------------------------------------------------------------------------- - -function newLib(kind: TLibKind): PLib; -begin - new(result); -{@ignore} - fillChar(result^, sizeof(result^), 0); -{@emit} - result.kind := kind; - initObjectSet(result.syms) -end; - -procedure addToLib(lib: PLib; sym: PSym); -begin - ObjectSetIncl(lib.syms, sym); - assert(sym.annex = nil); - sym.annex := lib -end; - function semp(c: PContext; n: PNode): PNode; forward; -var - gOwners: array of PSym; // owner stack (used for initializing the - // owner field of syms) - // the documentation comment always gets - // assigned to the current owner - // BUGFIX: global array is needed! -{@emit gOwners := []; } - -function getCurrOwner(c: PContext): PSym; -begin - result := gOwners[high(gOwners)]; -end; - -procedure PushOwner(c: PContext; owner: PSym); -var - len: int; -begin - len := length(gOwners); - setLength(gOwners, len+1); - gOwners[len] := owner; -end; - -procedure PopOwner(c: PContext); -var - len: int; -begin - len := length(gOwners); - assert(len > 0); - setLength(gOwners, len - 1); -end; - function considerAcc(n: PNode): PIdent; var x: PNode; @@ -235,57 +49,16 @@ end; function newSymS(const kind: TSymKind; n: PNode; c: PContext): PSym; begin - result := newSym(kind, considerAcc(n), getCurrOwner(c)); + result := newSym(kind, considerAcc(n), getCurrOwner()); result.info := n.info; end; -function newTypeS(const kind: TTypeKind; c: PContext): PType; -begin - result := newType(kind, getCurrOwner(c)) -end; - -procedure fillTypeS(dest: PType; const kind: TTypeKind; c: PContext); -begin - dest.kind := kind; - dest.owner := getCurrOwner(c); - dest.size := -1; -end; - -function makeRangeType(c: PContext; first, last: biggestInt): PType; -var - n: PNode; -begin - n := newNode(nkRange); - addSon(n, newIntNode(nkIntLit, first)); - addSon(n, newIntNode(nkIntLit, last)); - result := newTypeS(tyRange, c); - result.n := n; - addSon(result, getSysType(tyInt)); // basetype of range -end; - -function makePtrType(c: PContext; baseType: PType): PType; -begin - assert(baseType <> nil); - result := newTypeS(tyPtr, c); - addSon(result, baseType); -end; - -function makeVarType(c: PContext; baseType: PType): PType; -begin - assert(baseType <> nil); - result := newTypeS(tyVar, c); - addSon(result, baseType); -end; - -{$include 'lookup.pas'} - function semIdentVis(c: PContext; kind: TSymKind; n: PNode; const allowed: TSymFlags): PSym; forward; // identifier with visability function semIdentWithPragma(c: PContext; kind: TSymKind; n: PNode; const allowed: TSymFlags): PSym; forward; -function semStmt(c: PContext; n: PNode): PNode; forward; function semStmtScope(c: PContext; n: PNode): PNode; forward; type @@ -298,24 +71,49 @@ function semExprWithType(c: PContext; n: PNode; flags: TExprFlags = {@set}[]): PNode; forward; function semLambda(c: PContext; n: PNode): PNode; forward; function semTypeNode(c: PContext; n: PNode; prev: PType): PType; forward; +function semStmt(c: PContext; n: PNode): PNode; forward; -function semConstExpr(c: PContext; n: PNode): PNode; forward; - // evaluates the const - -function getConstExpr(c: PContext; n: PNode): PNode; forward; - // evaluates the constant expression or returns nil if it is no constant - // expression - -function eval(c: PContext; n: PNode): PNode; forward; -// eval never returns nil! This simplifies the code a lot and -// makes it faster too. +function semConstExpr(c: PContext; n: PNode): PNode; +var + e: PNode; +begin + e := semExprWithType(c, n); + if e = nil then begin + liMessage(n.info, errConstExprExpected); + result := nil; exit + end; + result := getConstExpr(c.module, e); + if result = nil then begin + //writeln(output, renderTree(n)); + liMessage(n.info, errConstExprExpected); + end +end; +function semMacroExpr(c: PContext; n: PNode; sym: PSym): PNode; +var + p: PEvalContext; + s: PStackFrame; +begin + p := newEvalContext(c.module, ''); + s := newStackFrame(); + s.call := n; + setLength(s.params, 2); + s.params[0] := newNodeIT(nkNilLit, n.info, sym.typ.sons[0]); + s.params[1] := n; + pushStackFrame(p, s); + {@discard} eval(p, sym.ast.sons[codePos]); + result := s.params[0]; + popStackFrame(p); + if cyclicTree(result) then liMessage(n.info, errCyclicTree); + result := semStmt(c, result); + // now, that was easy ... + // and we get more flexibility than in any other programming language +end; {$include 'semtempl.pas'} -{$include 'instgen.pas'} +{$include 'seminst.pas'} {$include 'sigmatch.pas'} -{$include 'pragmas.pas'} procedure CheckBool(t: PNode); begin @@ -323,26 +121,6 @@ begin liMessage(t.Info, errExprMustBeBool); end; -procedure illFormedAst(n: PNode); -begin - liMessage(n.info, errIllFormedAstX, renderTree(n, {@set}[renderNoComments])); -end; - -function getSon(n: PNode; indx: int): PNode; -begin - if (n <> nil) and (indx < sonsLen(n)) then result := n.sons[indx] - else begin illFormedAst(n); result := nil end; -end; - -procedure checkSonsLen(n: PNode; len: int); -begin - if (n = nil) or (sonsLen(n) <> len) then illFormedAst(n); -end; - -procedure checkMinSonsLen(n: PNode; len: int); -begin - if (n = nil) or (sonsLen(n) < len) then illFormedAst(n); -end; procedure typeMismatch(n: PNode; formal, actual: PType); begin @@ -353,10 +131,7 @@ end; {$include 'semtypes.pas'} {$include 'semexprs.pas'} -{$include 'transf.pas'} {$include 'semstmts.pas'} -{$include 'semfold.pas'} -{$include 'eval.pas'} function semp(c: PContext; n: PNode): PNode; begin @@ -367,32 +142,80 @@ procedure addCodeForGenerics(c: PContext; n: PNode); var i: int; prc: PSym; + it: PNode; begin for i := 0 to sonsLen(c.generics)-1 do begin - assert(c.generics.sons[i].sons[1].kind = nkSym); - prc := c.generics.sons[i].sons[1].sym; - if (prc.kind in [skProc, skConverter]) and (prc.magic = mNone) then begin + it := c.generics.sons[i].sons[1]; + if it.kind <> nkSym then InternalError('addCodeForGenerics'); + prc := it.sym; + if (prc.kind in [skProc, skConverter]) and (prc.magic = mNone) then addSon(n, prc.ast); - end - end + end; end; -function semModule(c: PContext; n: PNode): PNode; +function myOpen(module: PSym; const filename: string): PPassContext; +var + c: PContext; begin - assert(c.p = nil); + c := newContext(module, filename); + if (c.p <> nil) then InternalError(module.info, 'sem.myOpen'); + c.semConstExpr := semConstExpr; c.p := newProcCon(nil); - pushOwner(c, c.module); - result := semStmtScope(c, n); - if eAfterModule in c.b.eventMask then begin - addCodeForGenerics(c, result); - result := transform(c, result); - c.b.afterModuleEvent(c.b, result); + pushOwner(c.module); + openScope(c.tab); // scope for imported symbols + SymTabAdd(c.tab, module); // a module knows itself + if sfSystemModule in module.flags then begin + magicsys.SystemModule := module; // set global variable! + InitSystem(c.tab); // currently does nothing + end + else begin + SymTabAdd(c.tab, magicsys.SystemModule); // import the "System" identifier + importAllSymbols(c, magicsys.SystemModule); end; - popOwner(c); + openScope(c.tab); // scope for the module's symbols + result := c +end; + +function myOpenCached(module: PSym; const filename: string; + rd: PRodReader): PPassContext; +var + c: PContext; +begin + c := PContext(myOpen(module, filename)); + c.fromCache := true; + result := c +end; + +function myProcess(context: PPassContext; n: PNode): PNode; +var + c: PContext; +begin + result := nil; + c := PContext(context); + result := semStmt(c, n); +end; + +function myClose(context: PPassContext; n: PNode): PNode; +var + c: PContext; +begin + c := PContext(context); + closeScope(c.tab); // close module's scope + rawCloseScope(c.tab); // imported symbols; don't check for unused ones! + if n = nil then result := newNode(nkStmtList) + else result := n; + addCodeForGenerics(c, result); + popOwner(); c.p := nil; end; -initialization - new(emptyNode); - emptyNode.kind := nkEmpty; +function semPass(): TPass; +begin + initPass(result); + result.open := myOpen; + result.openCached := myOpenCached; + result.close := myClose; + result.process := myProcess; +end; + end. diff --git a/nim/semexprs.pas b/nim/semexprs.pas index 699998a94..26e63c845 100644 --- a/nim/semexprs.pas +++ b/nim/semexprs.pas @@ -19,7 +19,8 @@ var d: PNode; begin result := semExpr(c, n, flags); - if result.typ = nil then + if result = nil then InternalError('semExprWithType'); + if (result.typ = nil) then liMessage(n.info, errExprXHasNoType, renderTree(result, {@set}[renderNoComments])); if result.typ.kind = tyVar then begin @@ -175,6 +176,7 @@ begin while (b <> nil) and (b.id <> a.id) do b := b.sons[0]; if b = nil then liMessage(n.info, errXcanNeverBeOfThisSubtype, typeToString(a)); + n.typ := getSysType(tyBool); end else liMessage(n.info, errIsExpectsTwoArguments); @@ -266,13 +268,11 @@ var typ: PType; i: int; begin - result := newNode(nkBracket); - result.info := n.info; + result := newNodeI(nkBracket, n.info); result.typ := newTypeS(tyArrayConstr, c); addSon(result.typ, nil); // index type if sonsLen(n) = 0 then - // empty array - addSon(result.typ, nil) // needs an empty basetype! + addSon(result.typ, newTypeS(tyEmpty, c)) // needs an empty basetype! else begin addSon(result, semExprWithType(c, n.sons[0])); typ := skipVar(result.sons[0].typ); @@ -282,13 +282,13 @@ begin end; addSon(result.typ, typ) end; - result.typ.sons[0] := makeRangeType(c, 0, sonsLen(result)-1); + result.typ.sons[0] := makeRangeType(c, 0, sonsLen(result)-1, n.info); end; const ConstAbstractTypes = {@set}[tyNil, tyChar, tyInt..tyInt64, tyFloat..tyFloat128, - tyArrayConstr, tyTuple, tyEmptySet, tySet]; + tyArrayConstr, tyTuple, tySet]; procedure fixAbstractType(c: PContext; n: PNode); var @@ -304,17 +304,15 @@ begin it.sons[1] := semArrayConstr(c, it.sons[1]); if skipVarGeneric(it.typ).kind = tyOpenArray then begin s := skipVarGeneric(it.sons[1].typ); - if (s.kind = tyArrayConstr) and (s.sons[1] = nil) then begin - s := copyType(s, getCurrOwner(c)); - s.id := getID(); + if (s.kind = tyArrayConstr) and (s.sons[1].kind = tyEmpty) then begin + s := copyType(s, getCurrOwner(), false); skipVarGeneric(s).sons[1] := elemType(skipVarGeneric(it.typ)); it.sons[1].typ := s; end end else if skipVarGeneric(it.sons[1].typ).kind in [tyNil, tyArrayConstr, - tyTuple, tyEmptySet, tySet] then begin + tyTuple, tySet] then begin s := skipVarGeneric(it.typ); - if s.kind = tyEmptySet then InternalError(it.info, 'fixAbstractType'); changeType(it.sons[1], s); n.sons[i] := it.sons[1]; end @@ -323,7 +321,7 @@ begin // an implicitely constructed array (passed to an open array): n.sons[i] := semArrayConstr(c, it); end; - else if (it.typ = nil) or (it.typ.kind = tyEmptySet) then + else if (it.typ = nil) then InternalError(it.info, 'fixAbstractType: ' + renderTree(it)); end end @@ -357,8 +355,9 @@ begin end; nkHiddenStdConv, nkHiddenSubConv, nkConv: begin // Object and tuple conversions are still addressable, so we skip them - if skipPtrsGeneric(n.sons[1].typ).kind in [tyOpenArray, - tyTuple, tyObject] then + //if skipPtrsGeneric(n.sons[1].typ).kind in [tyOpenArray, + // tyTuple, tyObject] then + if skipPtrsGeneric(n.typ).kind in [tyOpenArray, tyTuple, tyObject] then result := isAssignable(n.sons[1]) end; nkHiddenDeref, nkDerefExpr: result := true; @@ -377,7 +376,9 @@ begin else begin result := newNodeIT(nkHiddenAddr, n.info, makeVarType(c, n.typ)); addSon(result, n); - if not isAssignable(n) then liMessage(n.info, errVarForOutParamNeeded); + if not isAssignable(n) then begin + liMessage(n.info, errVarForOutParamNeeded); + end end end; @@ -414,10 +415,11 @@ end; procedure analyseIfAddressTakenInCall(c: PContext; n: PNode); const - FakeVarParams = {@set}[mNew, mNewFinalize, mInc, mDec, mIncl, + FakeVarParams = {@set}[mNew, mNewFinalize, mInc, ast.mDec, mIncl, mExcl, mSetLengthStr, mSetLengthSeq, mAppendStrCh, mAppendStrStr, mSwap, - mAppendSeqElem, mAppendSeqSeq]; + mAppendSeqElem, mAppendSeqSeq, + mNewSeq]; var i: int; t: PType; @@ -430,29 +432,6 @@ begin if (i < sonsLen(t)) and (skipGeneric(t.sons[i]).kind = tyVar) then n.sons[i] := analyseIfAddressTaken(c, n.sons[i]); end; -(* -function lastPassOverArg(c: PContext; n: PNode; fakeVar: bool): PNode; -// this pass does various things: -// - it checks whether an address has been taken (needed for the ECMAScript -// code generator) -// - it changes the type of the argument (if it is not a concrete type) -begin - -end; - -procedure lastPassOverCall(c: PContext; n: PNode); -var - i: int; - fakeVar: bool; -begin - checkMinSonsLen(n, 1); - t := n.sons[0].typ; - fakeVar := (n.sons[0].kind = nkSym) - and (n.sons[0].sym.magic in FakeVarParams); - for i := 1 to sonsLen(n)-1 do begin - n.sons[i] := lastPassOverArg(c, n); - end -end;*) function semIndirectOp(c: PContext; n: PNode): PNode; var @@ -500,6 +479,7 @@ begin end else begin result := overloadedCallOpr(c, n); + if result = nil then result := semDirectCall(c, n); if result = nil then liMessage(n.info, errExprCannotBeCalled); end; fixAbstractType(c, result); @@ -508,6 +488,7 @@ end; function semDirectOp(c: PContext; n: PNode): PNode; begin + // this seems to be a hotspot in the compiler! semOpAux(c, n); result := semDirectCall(c, n); if result = nil then begin @@ -564,7 +545,7 @@ var ident: PIdent; begin case n.kind of - nkIdent: result := SymtabGet(c.Tab, n.ident); + nkIdent: result := SymtabGet(c.Tab, n.ident); // no need for stub loading nkDotExpr, nkQualified: begin checkSonsLen(n, 2); result := nil; @@ -615,6 +596,7 @@ begin end; function semMagic(c: PContext; n: PNode; s: PSym): PNode; +// this is a hotspot in the compiler! begin result := n; case s.magic of // magics that need special treatment @@ -632,7 +614,7 @@ begin result.typ := n.sons[1].typ; end; mInc: result := semIncSucc(c, setMs(n, s), 'inc'); - mDec: result := semIncSucc(c, setMs(n, s), 'dec'); + ast.mDec: result := semIncSucc(c, setMs(n, s), 'dec'); mOrd: result := semOrd(c, setMs(n, s)); else result := semDirectOp(c, n); end; @@ -683,8 +665,7 @@ begin end; function lookupInRecordAndBuildCheck(c: PContext; n, r: PNode; - field: PIdent; - var check: PNode): PSym; + field: PIdent; var check: PNode): PSym; // transform in a node that contains the runtime check for the // field, if it is in a case-part... var @@ -856,10 +837,10 @@ begin // allow things like "".replace(...) // --> replace("", ...) f := SymTabGet(c.tab, i); + if (f <> nil) and (f.kind = skStub) then loadStub(f); if (f <> nil) and (f.kind in [skProc, skIterator]) then begin - result := newNode(nkDotCall); + result := newNodeI(nkDotCall, n.info); // This special node kind is to merge with the call handler in `semExpr`. - result.info := n.info; addSon(result, newIdentNode(i, n.info)); addSon(result, copyTree(n.sons[0])); end @@ -961,7 +942,7 @@ begin nkElseExpr: begin checkSonsLen(it, 1); it.sons[0] := semExprWithType(c, it.sons[0]); - assert(typ <> nil); + if (typ = nil) then InternalError(it.info, 'semIfExpr'); it.sons[0] := fitNode(c, typ, it.sons[0]); end; else illFormedAst(n); @@ -976,10 +957,10 @@ var i: int; m: PNode; begin - result := newNode(nkCurly); - result.info := n.info; - if sonsLen(n) = 0 then - result.typ := newTypeS(tyEmptySet, c) + result := newNodeI(nkCurly, n.info); + result.typ := newTypeS(tySet, c); + if sonsLen(n) = 0 then + addSon(result.typ, newTypeS(tyEmpty, c)) else begin // only semantic checking for all elements, later type checking: typ := nil; @@ -996,20 +977,17 @@ begin if typ = nil then typ := skipVar(n.sons[i].typ) end end; - - result.typ := newTypeS(tySet, c); if not isOrdinalType(typ) then begin liMessage(n.info, errOrdinalTypeExpected); exit end; if lengthOrd(typ) > MaxSetElements then - typ := makeRangeType(c, 0, MaxSetElements-1); + typ := makeRangeType(c, 0, MaxSetElements-1, n.info); addSon(result.typ, typ); for i := 0 to sonsLen(n)-1 do begin if n.sons[i].kind = nkRange then begin - m := newNode(nkRange); - m.info := n.sons[i].info; + m := newNodeI(nkRange, n.sons[i].info); addSon(m, fitNode(c, typ, n.sons[i].sons[0])); addSon(m, fitNode(c, typ, n.sons[i].sons[1])); end @@ -1037,7 +1015,7 @@ begin for i := 0 to len-1 do begin if result = paTupleFields then begin if (n.sons[i].kind <> nkExprColonExpr) - or (n.sons[i].sons[0].kind <> nkIdent) then begin + or not (n.sons[i].sons[0].kind in [nkSym, nkIdent]) then begin liMessage(n.sons[i].info, errNamedExprExpected); result := paNone; exit end @@ -1060,16 +1038,18 @@ var id: PIdent; f: PSym; begin - result := newNode(nkPar); - result.info := n.info; + result := newNodeI(nkPar, n.info); typ := newTypeS(tyTuple, c); - typ.n := newNode(nkRecList); // nkIdentDefs + typ.n := newNodeI(nkRecList, n.info); // nkIdentDefs IntSetInit(ids); for i := 0 to sonsLen(n)-1 do begin if (n.sons[i].kind <> nkExprColonExpr) - or (n.sons[i].sons[0].kind <> nkIdent) then + or not (n.sons[i].sons[0].kind in [nkSym, nkIdent]) then illFormedAst(n.sons[i]); - id := n.sons[i].sons[0].ident; + if n.sons[i].sons[0].kind = nkIdent then + id := n.sons[i].sons[0].ident + else + id := n.sons[i].sons[0].sym.name; if IntSetContainsOrIncl(ids, id.id) then liMessage(n.sons[i].info, errFieldInitTwice, id.s); n.sons[i].sons[1] := semExprWithType(c, n.sons[i].sons[1]); @@ -1141,28 +1121,26 @@ begin result := semFieldAccess(c, n, flags); end; -function semMacroExpr(c: PContext; n: PNode; sym: PSym): PNode; forward; - function semExpr(c: PContext; n: PNode; flags: TExprFlags = {@set}[]): PNode; var s: PSym; begin result := n; if n = nil then exit; + if nfSem in n.flags then exit; case n.kind of // atoms: nkIdent: begin - // lookup the symbol: - s := SymtabGet(c.Tab, n.ident); - if s <> nil then result := semSym(c, n, s, flags) - else liMessage(n.info, errUndeclaredIdentifier, n.ident.s); + s := lookUp(c, n); + result := semSym(c, n, s, flags); end; nkSym: begin s := n.sym; include(s.flags, sfUsed); if (s.kind = skType) and not (efAllowType in flags) then liMessage(n.info, errATypeHasNoValue); - if s.magic <> mNone then + if (s.magic <> mNone) and + (s.kind in [skProc, skIterator, skConverter]) then liMessage(n.info, errInvalidContextForBuiltinX, s.name.s); end; nkEmpty, nkNone: begin end; @@ -1304,5 +1282,6 @@ begin renderTree(n, {@set}[renderNoComments])); result := nil end - end + end; + include(result.flags, nfSem); end; diff --git a/nim/semfold.pas b/nim/semfold.pas index 00d84f836..9c27c3a16 100644 --- a/nim/semfold.pas +++ b/nim/semfold.pas @@ -6,10 +6,37 @@ // See the file "copying.txt", included in this // distribution, for details about the copyright. // +unit semfold; // this module folds constants; used by semantic checking phase // and evaluation phase +interface + +{$include 'config.inc'} + +uses + sysutils, nsystem, charsets, strutils, + lists, options, ast, astalgo, trees, treetab, nimsets, ntime, nversion, + platform, nmath, msgs, nos, condsyms, idents, rnimsyn, types; + +function getConstExpr(module: PSym; n: PNode): PNode; + // evaluates the constant expression or returns nil if it is no constant + // expression + +function evalOp(m: TMagic; n, a, b: PNode): PNode; +function leValueConv(a, b: PNode): Boolean; + +function newIntNodeT(const intVal: BiggestInt; n: PNode): PNode; +function newFloatNodeT(const floatVal: BiggestFloat; n: PNode): PNode; +function newStrNodeT(const strVal: string; n: PNode): PNode; +function getInt(a: PNode): biggestInt; +function getFloat(a: PNode): biggestFloat; +function getStr(a: PNode): string; +function getStrOrChar(a: PNode): string; + +implementation + function newIntNodeT(const intVal: BiggestInt; n: PNode): PNode; begin if skipVarGenericRange(n.typ).kind = tyChar then @@ -194,14 +221,22 @@ begin result := nimsets.symdiffSets(a, b); result.info := n.info; end; - mInSet: result := newIntNodeT(Ord(inSet(a, b)), n); mConStrStr: result := newStrNodeT(getStrOrChar(a)+{&}getStrOrChar(b), n); - mRepr: result := newStrNodeT(renderTree(a, {@set}[renderNoComments]), n); + mInSet: result := newIntNodeT(Ord(inSet(a, b)), n); + mRepr: begin + // BUGFIX: we cannot eval mRepr here. But this means that it is not + // available for interpretation. I don't know how to fix this. + //result := newStrNodeT(renderTree(a, {@set}[renderNoComments]), n); + end; mIntToStr, mInt64ToStr, mBoolToStr, mCharToStr: result := newStrNodeT(toString(getOrdValue(a)), n); mFloatToStr: result := newStrNodeT(toStringF(getFloat(a)), n); mCStrToStr: result := newStrNodeT(getStrOrChar(a), n); mStrToStr: result := a; + mArrToSeq: begin + result := copyTree(a); + result.typ := n.typ; + end; mExit, mInc, ast.mDec, mAssert, mSwap, mAppendStrCh, mAppendStrStr, mAppendSeqElem, mAppendSeqSeq, mSetLengthStr, mSetLengthSeq, mNLen..mNError: begin end; @@ -209,7 +244,7 @@ begin end end; -function getConstIfExpr(c: PContext; n: PNode): PNode; +function getConstIfExpr(c: PSym; n: PNode): PNode; var i: int; it, e: PNode; @@ -236,7 +271,7 @@ begin end end; -function partialAndExpr(c: PContext; n: PNode): PNode; +function partialAndExpr(c: PSym; n: PNode): PNode; // partial evaluation var a, b: PNode; @@ -245,19 +280,17 @@ begin a := getConstExpr(c, n.sons[1]); b := getConstExpr(c, n.sons[2]); if a <> nil then begin - assert(a.kind in [nkIntLit..nkInt64Lit]); - if a.intVal = 0 then result := a + if getInt(a) = 0 then result := a else if b <> nil then result := b else result := n.sons[2] end else if b <> nil then begin - assert(b.kind in [nkIntLit..nkInt64Lit]); - if b.intVal = 0 then result := b + if getInt(b) = 0 then result := b else result := n.sons[1] end end; -function partialOrExpr(c: PContext; n: PNode): PNode; +function partialOrExpr(c: PSym; n: PNode): PNode; // partial evaluation var a, b: PNode; @@ -266,14 +299,12 @@ begin a := getConstExpr(c, n.sons[1]); b := getConstExpr(c, n.sons[2]); if a <> nil then begin - assert(a.kind in [nkIntLit..nkInt64Lit]); - if a.intVal <> 0 then result := a + if getInt(a) <> 0 then result := a else if b <> nil then result := b else result := n.sons[2] end else if b <> nil then begin - assert(b.kind in [nkIntLit..nkInt64Lit]); - if b.intVal <> 0 then result := b + if getInt(b) <> 0 then result := b else result := n.sons[1] end end; @@ -298,7 +329,7 @@ begin end end; -function getConstExpr(c: PContext; n: PNode): PNode; +function getConstExpr(module: PSym; n: PNode): PNode; var s: PSym; a, b: PNode; @@ -312,6 +343,8 @@ begin result := newIntNodeT(s.position, n) else if (s.kind = skConst) then begin case s.magic of + mIsMainModule: + result := newIntNodeT(ord(sfMainModule in module.flags), n); mCompileDate: result := newStrNodeT(ntime.getDateStr(), n); mCompileTime: result := newStrNodeT(ntime.getClockStr(), n); mNimrodVersion: result := newStrNodeT(VersionAsString, n); @@ -327,7 +360,7 @@ begin end end; nkCharLit..nkNilLit: result := copyNode(n); - nkIfExpr: result := getConstIfExpr(c, n); + nkIfExpr: result := getConstIfExpr(module, n); nkCall: begin if (n.sons[0].kind <> nkSym) then exit; s := n.sons[0].sym; @@ -356,10 +389,10 @@ begin result := newIntNodeT(lastOrd(skipVarGeneric(n.sons[1].typ)), n); end; else begin - a := getConstExpr(c, n.sons[1]); + a := getConstExpr(module, n.sons[1]); if a = nil then exit; if sonsLen(n) > 2 then begin - b := getConstExpr(c, n.sons[2]); + b := getConstExpr(module, n.sons[2]); if b = nil then exit end else b := nil; @@ -372,7 +405,7 @@ begin end end; nkAddr: begin - a := getConstExpr(c, n.sons[0]); + a := getConstExpr(module, n.sons[0]); if a <> nil then begin result := n; n.sons[0] := a @@ -381,16 +414,16 @@ begin nkBracket: begin result := copyTree(n); for i := 0 to sonsLen(n)-1 do begin - a := getConstExpr(c, n.sons[i]); + a := getConstExpr(module, n.sons[i]); if a = nil then begin result := nil; exit end; result.sons[i] := a; end; include(result.flags, nfAllConst); end; nkRange: begin - a := getConstExpr(c, n.sons[0]); + a := getConstExpr(module, n.sons[0]); if a = nil then exit; - b := getConstExpr(c, n.sons[1]); + b := getConstExpr(module, n.sons[1]); if b = nil then exit; result := copyNode(n); addSon(result, a); @@ -399,7 +432,7 @@ begin nkCurly: begin result := copyTree(n); for i := 0 to sonsLen(n)-1 do begin - a := getConstExpr(c, n.sons[i]); + a := getConstExpr(module, n.sons[i]); if a = nil then begin result := nil; exit end; result.sons[i] := a; end; @@ -409,14 +442,14 @@ begin result := copyTree(n); if (sonsLen(n) > 0) and (n.sons[0].kind = nkExprColonExpr) then begin for i := 0 to sonsLen(n)-1 do begin - a := getConstExpr(c, n.sons[i].sons[1]); + a := getConstExpr(module, n.sons[i].sons[1]); if a = nil then begin result := nil; exit end; result.sons[i].sons[1] := a; end end else begin for i := 0 to sonsLen(n)-1 do begin - a := getConstExpr(c, n.sons[i]); + a := getConstExpr(module, n.sons[i]); if a = nil then begin result := nil; exit end; result.sons[i] := a; end @@ -424,7 +457,7 @@ begin include(result.flags, nfAllConst); end; nkChckRangeF, nkChckRange64, nkChckRange: begin - a := getConstExpr(c, n.sons[0]); + a := getConstExpr(module, n.sons[0]); if a = nil then exit; if leValueConv(n.sons[1], a) and leValueConv(a, n.sons[2]) then begin result := a; // a <= x and x <= b @@ -436,13 +469,13 @@ begin [typeToString(n.sons[0].typ), typeToString(n.typ)])); end; nkStringToCString, nkCStringToString: begin - a := getConstExpr(c, n.sons[0]); + a := getConstExpr(module, n.sons[0]); if a = nil then exit; result := a; result.typ := n.typ; end; nkHiddenStdConv, nkHiddenSubConv, nkConv, nkCast: begin - a := getConstExpr(c, n.sons[1]); + a := getConstExpr(module, n.sons[1]); if a = nil then exit; case skipRange(n.typ).kind of tyInt..tyInt64: begin @@ -478,18 +511,4 @@ begin end end; -function semConstExpr(c: PContext; n: PNode): PNode; -var - e: PNode; -begin - e := semExprWithType(c, n); - if e = nil then begin - liMessage(n.info, errConstExprExpected); - result := nil; exit - end; - result := getConstExpr(c, e); - if result = nil then begin - //writeln(output, renderTree(n)); - liMessage(n.info, errConstExprExpected); - end -end; +end. diff --git a/nim/semstmts.pas b/nim/semstmts.pas index 4d8372a19..7d6403db4 100644 --- a/nim/semstmts.pas +++ b/nim/semstmts.pas @@ -9,6 +9,11 @@ // this module does the semantic checking of statements +function isTopLevel(c: PContext): bool; +begin + result := c.tab.tos <= 2 +end; + function semWhen(c: PContext; n: PNode): PNode; var i: int; @@ -23,7 +28,7 @@ begin checkSonsLen(it, 2); e := semConstExpr(c, it.sons[0]); checkBool(e); - assert(e.kind = nkIntLit); + if (e.kind <> nkIntLit) then InternalError(n.info, 'semWhen'); if (e.intVal <> 0) and (result = nil) then result := semStmt(c, it.sons[1]); // do not open a new scope! end; @@ -35,7 +40,11 @@ begin else illFormedAst(n) end end; - if result = nil then result := newNode(nkNilLit); + if result = nil then result := newNodeI(nkNilLit, n.info); + // The ``when`` statement implements the mechanism for platform dependant + // code. Thus we try to ensure here consistent ID distribution after the + // ``when`` statement. + IDsynchronizationPoint(200); end; function semIf(c: PContext; n: PNode): PNode; @@ -81,19 +90,15 @@ begin if n.sons[0] <> nil then begin if n.sons[0].kind = nkIdent then begin // lookup the symbol: - s := SymtabGet(c.Tab, n.sons[0].ident); - if s <> nil then begin - if (s.kind = skLabel) and (s.owner.id = c.p.owner.id) then begin - x := newSymNode(s); - x.info := n.info; - include(s.flags, sfUsed); - n.sons[0] := x - end - else - liMessage(n.info, errInvalidControlFlowX, s.name.s) + s := lookUp(c, n.sons[0]); + if (s.kind = skLabel) and (s.owner.id = c.p.owner.id) then begin + x := newSymNode(s); + x.info := n.info; + include(s.flags, sfUsed); + n.sons[0] := x end else - liMessage(n.info, errUndeclaredIdentifier, n.sons[0].ident.s); + liMessage(n.info, errInvalidControlFlowX, s.name.s) end else illFormedAst(n) end @@ -155,8 +160,10 @@ begin sub := ncopy(str, b+1, c-1); if sub <> '' then begin e := SymtabGet(con.tab, getIdent(sub)); - if e <> nil then + if e <> nil then begin + if e.kind = skStub then loadStub(e); addSon(result, newSymNode(e)) + end else addSon(result, newStrNode(nkStrLit, sub)); end; @@ -314,8 +321,7 @@ begin // check for type compatibility: restype := c.p.owner.typ.sons[0]; if (restype <> nil) then begin - a := newNode(nkAsgn); - a.info := n.sons[0].info; + a := newNodeI(nkAsgn, n.sons[0].info); n.sons[0] := fitNode(c, restype, n.sons[0]); // optimize away ``return result``, because it would be transferred @@ -325,7 +331,7 @@ begin n.sons[0] := nil; end else begin - assert(c.p.resultSym <> nil); + if (c.p.resultSym = nil) then InternalError(n.info, 'semReturn'); addSon(a, semExprWithType(c, newSymNode(c.p.resultSym))); addSon(a, n.sons[0]); n.sons[0] := a; @@ -350,7 +356,7 @@ begin restype := c.p.owner.typ.sons[0]; if (restype <> nil) then begin n.sons[0] := fitNode(c, restype, n.sons[0]); - assert(n.sons[0].typ <> nil); + if (n.sons[0].typ = nil) then InternalError(n.info, 'semYield'); end else liMessage(n.info, errCannotReturnExpr); @@ -388,8 +394,9 @@ begin typ := nil; if a.sons[len-1] <> nil then begin def := semExprWithType(c, a.sons[len-1]); + // BUGFIX: ``fitNode`` is needed here! // check type compability between def.typ and typ: - if (typ <> nil) then def := fitRemoveHiddenConv(c, typ, def) + if (typ <> nil) then def := fitNode(c, typ, def) else typ := def.typ; end else @@ -405,8 +412,7 @@ begin if v.flags * [sfStar, sfMinus] <> {@set}[] then include(v.flags, sfInInterface); addInterfaceDecl(c, v); - b := newNode(nkIdentDefs); - b.info := a.info; + b := newNodeI(nkIdentDefs, a.info); addSon(b, newSymNode(v)); addSon(b, nil); // no type description addSon(b, copyTree(def)); @@ -449,8 +455,7 @@ begin if v.flags * [sfStar, sfMinus] <> {@set}[] then include(v.flags, sfInInterface); addInterfaceDecl(c, v); - b := newNode(nkConstDef); - b.info := a.info; + b := newNodeI(nkConstDef, a.info); addSon(b, newSymNode(v)); addSon(b, nil); // no type description addSon(b, copyTree(def)); @@ -548,7 +553,7 @@ begin if typ.kind = tyRef then typ := typ.sons[0]; if (typ.kind <> tyObject) then liMessage(a.sons[j].info, errExprCannotBeRaised); - a.sons[j] := newNode(nkType); + a.sons[j] := newNodeI(nkType, a.sons[j].info); a.sons[j].typ := typ; if IntSetContainsOrIncl(check, typ.id) then liMessage(a.sons[j].info, errExceptionAlreadyHandled); @@ -566,7 +571,8 @@ var i: int; s: PSym; begin - assert(n.kind = nkGenericParams); + if n.kind <> nkGenericParams then + InternalError(n.info, 'semGenericParamList'); for i := 0 to sonsLen(n)-1 do begin if n.sons[i].kind = nkDefaultTypeParam then begin internalError(n.sons[i].info, 'semGenericParamList() to implement'); @@ -583,6 +589,21 @@ begin end end; +procedure addGenericParamListToScope(c: PContext; n: PNode); +var + i: int; + s: PSym; +begin + if n.kind <> nkGenericParams then + InternalError(n.info, 'addGenericParamListToScope'); + for i := 0 to sonsLen(n)-1 do begin + if n.sons[i].kind <> nkSym then + InternalError(n.sons[i].info, 'addGenericParamListToScope'); + s := n.sons[i].sym; + addDecl(c, s); + end +end; + function resolveGenericParams(c: PContext; n: PNode): PNode; begin result := n; @@ -630,35 +651,60 @@ begin s := a.sons[0].sym; if (s.magic = mNone) and (a.sons[2] = nil) then liMessage(a.info, errTypeXNeedsImplementation, s.name.s); + if s.magic <> mNone then processMagicType(c, s); if a.sons[1] <> nil then begin // we have a generic type declaration here, so we don't process the // type's body: openScope(c.tab); - pushOwner(c, s); + pushOwner(s); s.typ.kind := tyGeneric; semGenericParamList(c, a.sons[1]); // process the type body for symbol lookup of generic params // we can use the same algorithm as for template parameters: a.sons[2] := resolveTemplateParams(c, a.sons[2]); s.ast := a; - assert(s.typ.containerID = 0); + if s.typ.containerID <> 0 then + InternalError(a.info, 'semTypeSection: containerID'); s.typ.containerID := getID(); - popOwner(c); + popOwner(); closeScope(c.tab); end - else begin + else if a.sons[2] <> nil then begin // process the type's body: - pushOwner(c, s); + pushOwner(s); t := semTypeNode(c, a.sons[2], s.typ); - if (t <> s.typ) then internalError(a.info, 'semTypeSection()'); + if (t <> s.typ) and (s.typ <> nil) then + internalError(a.info, 'semTypeSection()'); s.typ := t; s.ast := a; - popOwner(c); - // compute the type's size and check for illegal recursions: - if computeSize(s.typ) < 0 then - liMessage(s.info, errIllegalRecursionInTypeX, s.name.s); + popOwner(); + if (tfAcyclic in t.flags) and (t.kind <> tyObject) then + liMessage(s.info, errInvalidPragmaX, 'acyclic'); end; end; + // unfortunately we need another pass over the section for checking of + // illegal recursions and type aliases: + for i := 0 to sonsLen(n)-1 do begin + a := n.sons[i]; + if a.kind = nkCommentStmt then continue; + if (a.sons[0].kind <> nkSym) then IllFormedAst(a); + s := a.sons[0].sym; + // compute the type's size and check for illegal recursions: + if a.sons[1] = nil then begin + if (a.sons[2] <> nil) + and (a.sons[2].kind in [nkSym, nkIdent, nkAccQuoted]) then begin + // type aliases are hard: + //MessageOut('for type ' + typeToString(s.typ)); + t := semTypeNode(c, a.sons[2], nil); + if t.kind in [tyObject, tyEnum] then begin + assignType(s.typ, t); + s.typ.id := t.id; // same id + end + end; + if computeSize(s.typ) < 0 then + liMessage(s.info, errIllegalRecursionInTypeX, s.name.s); + end + end end; procedure semParamList(c: PContext; n: PNode; s: PSym); @@ -691,7 +737,7 @@ begin include(s.flags, sfGlobal); if sfStar in s.flags then include(s.flags, sfInInterface); s.ast := n; - pushOwner(c, s); + pushOwner(s); if n.sons[genericParamsPos] <> nil then begin // we have a generic type declaration here, so we don't process the // type's body: @@ -721,24 +767,23 @@ begin else liMessage(n.info, errIteratorNeedsImplementation); closeScope(c.tab); - popOwner(c); + popOwner(); c.p := oldP; // add it here, so that recursive iterators are impossible: addInterfaceOverloadableSymAt(c, s, c.tab.tos-1); //writeln(renderTree(n.sons[codePos], {@set}[renderIds])); end; -{$include 'procfind.pas'} - procedure addResult(c: PContext; t: PType; const info: TLineInfo); var s: PSym; begin if t <> nil then begin - s := newSym(skVar, getIdent('result'), getCurrOwner(c)); + s := newSym(skVar, getIdent('result'), getCurrOwner()); s.info := info; s.typ := t; Include(s.flags, sfResult); + Include(s.flags, sfUsed); addDecl(c, s); c.p.resultSym := s; end @@ -756,16 +801,16 @@ var begin result := n; checkSonsLen(n, codePos+1); - s := newSym(skProc, getIdent(genPrefix + 'anonymous'), getCurrOwner(c)); + s := newSym(skProc, getIdent(':anonymous'), getCurrOwner()); s.info := n.info; oldP := c.p; // restore later s.ast := n; n.sons[namePos] := newSymNode(s); - pushOwner(c, s); + pushOwner(s); openScope(c.tab); - assert(n.sons[genericParamsPos] = nil); + if (n.sons[genericParamsPos] <> nil) then InternalError(n.info, 'semLambda'); // process parameters: if n.sons[paramsPos] <> nil then begin semParamList(c, n.sons[ParamsPos], s); @@ -790,13 +835,10 @@ begin n.sons[codePos] := semStmtScope(c, n.sons[codePos]); addResultNode(c, n); end - else begin + else liMessage(n.info, errImplOfXexpected, s.name.s); - if not (sfImportc in s.flags) then - Include(s.flags, sfForward); - end; closeScope(c.tab); // close scope for parameters - popOwner(c); + popOwner(); c.p := oldP; // restore end; @@ -818,7 +860,7 @@ begin if sfStar in s.flags then include(s.flags, sfInInterface); s.ast := n; - pushOwner(c, s); + pushOwner(s); openScope(c.tab); if n.sons[genericParamsPos] <> nil then semGenericParamList(c, n.sons[genericParamsPos]); @@ -855,21 +897,24 @@ begin if not (sfForward in proto.flags) then liMessage(n.info, errAttemptToRedefineX, proto.name.s); exclude(proto.flags, sfForward); + closeScope(c.tab); // close scope with wrong parameter symbols + openScope(c.tab); // open scope for old (correct) parameter symbols + if proto.ast.sons[genericParamsPos] <> nil then + addGenericParamListToScope(c, proto.ast.sons[genericParamsPos]); + addParams(c, proto.typ.n); proto.info := s.info; // more accurate line information - s.typ.callConv := proto.typ.callConv; - s.typ.flags := proto.typ.flags; - - proto.typ := s.typ; + s.typ := proto.typ; s := proto; - proto.ast := n; // needed for code generation - assert(n.sons[namePos].kind = nkSym); + n.sons[genericParamsPos] := proto.ast.sons[genericParamsPos]; + n.sons[paramsPos] := proto.ast.sons[paramsPos]; + if (n.sons[namePos].kind <> nkSym) then InternalError(n.info, 'semProcAux'); n.sons[namePos].sym := proto; - popOwner(c); - pushOwner(c, s); + proto.ast := n; // needed for code generation + popOwner(); + pushOwner(s); end; s.options := gOptions; - //writeln(s.name.s, ' ', ropeToStr(optionsToStr(s.options))); if n.sons[codePos] <> nil then begin if sfImportc in s.flags then liMessage(n.sons[codePos].info, errImportedProcCannotHaveImpl); @@ -881,7 +926,7 @@ begin end else begin n.sons[codePos] := resolveGenericParams(c, n.sons[codePos]); - end + end; end else begin if proto <> nil then @@ -889,7 +934,7 @@ begin if not (sfImportc in s.flags) then Include(s.flags, sfForward); end; closeScope(c.tab); // close scope for parameters - popOwner(c); + popOwner(); c.p := oldP; // restore end; @@ -898,11 +943,6 @@ begin result := semProcAux(c, n, skProc); end; -function isTopLevel(c: PContext): bool; -begin - result := c.tab.tos <= 2 -end; - function semConverterDef(c: PContext; n: PNode): PNode; var t: PType; @@ -938,7 +978,31 @@ begin liMessage(n.info, errXRequiresOneArgument, 'macro'); end; -{$include 'importer.pas'} +function evalInclude(c: PContext; n: PNode): PNode; +var + i: int; + x: PNode; + f, name, ext: string; +begin + result := newNodeI(nkStmtList, n.info); + addSon(result, n); // the rodwriter needs include information! + for i := 0 to sonsLen(n)-1 do begin + f := getModuleFile(n.sons[i]); + SplitFilename(f, name, ext); + if cmpIgnoreCase(ext, '.'+TmplExt) = 0 then + x := gIncludeTmplFile(f) + else + x := gIncludeFile(f); + x := semStmt(c, x); + addSon(result, x); + end; +end; + +function semCommand(c: PContext; n: PNode): PNode; +begin + result := semExpr(c, n); + if result.typ <> nil then liMessage(n.info, errDiscardValue); +end; function SemStmt(c: PContext; n: PNode): PNode; const @@ -950,13 +1014,11 @@ var begin result := n; if n = nil then exit; - embeddedDbg(c, n); + if nfSem in n.flags then exit; case n.kind of nkAsgn: result := semAsgn(c, n); - nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand: begin - result := semExpr(c, n); - if result.typ <> nil then liMessage(n.info, errDiscardValue); - end; + nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand: + result := semCommand(c, n); nkEmpty, nkCommentStmt, nkNilLit: begin end; nkBlockStmt: result := semBlock(c, n); nkStmtList: begin @@ -969,24 +1031,25 @@ begin nkPragma, nkCommentStmt, nkNilLit, nkEmpty: begin end; else liMessage(n.sons[j].info, errStmtInvalidAfterReturn); end - end; - end; + end + end end; nkRaiseStmt: result := semRaise(c, n); - nkVarSection: result := SemVar(c, n); - nkConstSection: result := SemConst(c, n); + nkVarSection: result := semVar(c, n); + nkConstSection: result := semConst(c, n); nkTypeSection: result := SemTypeSection(c, n); nkIfStmt: result := SemIf(c, n); nkWhenStmt: result := semWhen(c, n); nkDiscardStmt: result := semDiscard(c, n); nkWhileStmt: result := semWhile(c, n); nkTryStmt: result := semTry(c, n); - nkBreakStmt, nkContinueStmt: result := semBreakOrContinue(c, n); + nkBreakStmt, nkContinueStmt: + result := semBreakOrContinue(c, n); nkForStmt: result := semFor(c, n); nkCaseStmt: result := semCase(c, n); nkReturnStmt: result := semReturn(c, n); nkAsmStmt: result := semAsm(c, n); - nkYieldStmt: result := SemYield(c, n); + nkYieldStmt: result := semYield(c, n); nkPragma: pragmaStmt(c, c.p.owner, n); nkIteratorDef: result := semIterator(c, n); nkProcDef: result := semProc(c, n); @@ -1011,6 +1074,7 @@ begin else liMessage(n.info, errStmtExpected); end; if result = nil then InternalError(n.info, 'SemStmt: result = nil'); + include(result.flags, nfSem); end; function semStmtScope(c: PContext; n: PNode): PNode; diff --git a/nim/semtempl.pas b/nim/semtempl.pas index b861949c9..c07a7bd13 100644 --- a/nim/semtempl.pas +++ b/nim/semtempl.pas @@ -83,7 +83,7 @@ begin liMessage(n.info, errTemplateInstantiationTooNested); // replace each param by the corresponding node: r := sym.ast.sons[paramsPos].sons[0]; - assert(r.kind = nkIdent); + if (r.kind <> nkIdent) then InternalError(r.info, 'evalTemplate'); result := evalTemplateAux(c, sym.ast.sons[codePos], n, sym); if r.ident.id = ord(wExpr) then result := semExpr(c, result) else result := semStmt(c, result); @@ -172,7 +172,7 @@ begin s := semIdentVis(c, skTemplate, n.sons[0], {@set}[]); if sfStar in s.flags then include(s.flags, sfInInterface); // check parameter list: - pushOwner(c, s); + pushOwner(s); openScope(c.tab); params := n.sons[paramsPos]; counter := 0; @@ -191,6 +191,7 @@ begin end; end; params.sons[0] := semTemplateParamKind(c, params, params.sons[0]); + n.sons[namePos] := newSymNode(s); // check that no pragmas exist: if n.sons[pragmasPos] <> nil then @@ -205,7 +206,7 @@ begin // only parameters are resolved, no type checking is performed closeScope(c.tab); - popOwner(c); + popOwner(); s.ast := n; result := n; diff --git a/nim/semtypes.pas b/nim/semtypes.pas index e0a3f59b9..00cb019f8 100644 --- a/nim/semtypes.pas +++ b/nim/semtypes.pas @@ -17,12 +17,11 @@ end; function newOrPrevType(kind: TTypeKind; prev: PType; c: PContext): PType; begin - assert((prev = nil) or (prev.Kind = tyForward)); if prev = nil then result := newTypeS(kind, c) else begin result := prev; - result.kind := kind + if result.kind = tyForward then result.kind := kind end end; @@ -37,7 +36,7 @@ begin counter := 0; base := nil; result := newOrPrevType(tyEnum, prev, c); - result.n := newNode(nkEnumTy); + result.n := newNodeI(nkEnumTy, n.info); checkMinSonsLen(n, 1); if n.sons[0] <> nil then begin base := semTypeNode(c, n.sons[0].sons[0], nil); @@ -69,6 +68,7 @@ begin e.position := int(counter); if (result.sym <> nil) and (sfInInterface in result.sym.flags) then begin include(e.flags, sfUsed); // BUGFIX + include(e.flags, sfInInterface); // BUGFIX StrTableAdd(c.module.tab, e); // BUGFIX end; addSon(result.n, newSymNode(e)); @@ -142,11 +142,12 @@ function semRangeAux(c: PContext; n: PNode; prev: PType): PType; var a, b: PNode; begin - assert(n.kind = nkRange); + if (n.kind <> nkRange) then InternalError(n.info, 'semRangeAux'); checkSonsLen(n, 2); result := newOrPrevType(tyRange, prev, c); - result.n := copyTree(n); - result.n := newNode(nkRange); + result.n := newNodeI(nkRange, n.info); + if (n.sons[0] = nil) or (n.sons[1] = nil) then + liMessage(n.Info, errRangeIsEmpty); a := semConstExpr(c, n.sons[0]); b := semConstExpr(c, n.sons[1]); if not sameType(a.typ, b.typ) then @@ -278,12 +279,13 @@ var elem: PType; inst: PNode; begin - if (s.typ = nil) or (s.typ.kind <> tyGeneric) then + if (s.typ = nil) or (s.typ.kind <> tyGeneric) then liMessage(n.info, errCannotInstantiateX, s.name.s); - result := newOrPrevType(tyGenericInst, prev, c); - result.containerID := s.typ.containerID; + result := newOrPrevType(tyGenericInst, prev, c); // new ID... + result.containerID := s.typ.containerID; // ... but the same containerID result.sym := s; - assert(s.typ.containerID <> 0); + if (s.typ.containerID = 0) then + InternalError(n.info, 'semGeneric'); for i := 1 to sonsLen(n)-1 do begin elem := semTypeNode(c, n.sons[i], nil); if elem.kind = tyGenericParam then result.kind := tyGeneric; @@ -355,8 +357,10 @@ var begin for i := 1 to branchIndex-1 do for j := 0 to sonsLen(t.sons[i])-2 do - if overlap(t.sons[i].sons[j], ex) then + if overlap(t.sons[i].sons[j], ex) then begin + //MessageOut(renderTree(t)); liMessage(ex.info, errDuplicateCaseLabel); + end end; procedure semBranchExpr(c: PContext; t: PNode; var ex: PNode); @@ -380,8 +384,10 @@ begin checkSonsLen(b, 2); semBranchExpr(c, t, b.sons[0]); semBranchExpr(c, t, b.sons[1]); - if emptyRange(b.sons[0], b.sons[1]) then + if emptyRange(b.sons[0], b.sons[1]) then begin + //MessageOut(renderTree(t)); liMessage(b.info, errRangeIsEmpty); + end; covered := covered + getOrdValue(b.sons[1]) - getOrdValue(b.sons[0]) + 1; end else begin @@ -444,8 +450,7 @@ begin addSon(father, a); end; -procedure semRecordNodeAux(c: PContext; n: PNode; - var check: TIntSet; +procedure semRecordNodeAux(c: PContext; n: PNode; var check: TIntSet; var pos: int; father: PNode; rectype: PSym); var i, len: int; @@ -465,7 +470,8 @@ begin checkSonsLen(it, 2); e := semConstExpr(c, it.sons[0]); checkBool(e); - assert(e.kind = nkIntLit); + if (e.kind <> nkIntLit) then + InternalError(e.info, 'semRecordNodeAux'); if (e.intVal <> 0) and (branch = nil) then branch := it.sons[1] end; @@ -482,6 +488,10 @@ begin nkRecCase: begin semRecordCase(c, n, check, pos, father, rectype); end; + nkNilLit: begin + if father.kind <> nkRecList then + addSon(father, newNodeI(nkRecList, n.info)); + end; nkRecList: begin // attempt to keep the nesting at a sane level: if father.kind = nkRecList then a := father @@ -495,8 +505,10 @@ begin nkIdentDefs: begin checkMinSonsLen(n, 3); len := sonsLen(n); - if (father.kind <> nkRecList) and (len >= 4) then a := newNode(nkRecList) - else a := nil; + if (father.kind <> nkRecList) and (len >= 4) then + a := newNodeI(nkRecList, n.info) + else + a := nil; if n.sons[len-1] <> nil then liMessage(n.sons[len-1].info, errInitHereNotAllowed); if n.sons[len-2] = nil then @@ -531,7 +543,8 @@ var begin case n.kind of nkRecCase: begin - assert(n.sons[0].kind = nkSym); + if (n.sons[0].kind <> nkSym) then + InternalError(n.info, 'addInheritedFieldsAux'); addInheritedFieldsAux(c, check, pos, n.sons[0]); for i := 1 to sonsLen(n)-1 do begin case n.sons[i].kind of @@ -589,9 +602,9 @@ begin else InternalError(n.info, 'semObjectNode'); addSon(result, base); - result.n := newNode(nkRecList); + result.n := newNodeI(nkRecList, n.info); semRecordNodeAux(c, n.sons[2], check, pos, result.n, result.sym); - if (tfFinal in result.flags) and (base <> nil) then + if (base <> nil) and (tfFinal in base.flags) then liMessage(n.sons[1].info, errInheritanceOnlyWithNonFinalObjects); end; @@ -606,14 +619,14 @@ begin checkMinSonsLen(n, 1); result := newOrPrevType(tyProc, prev, c); result.callConv := lastOptionEntry(c).defaultCC; - result.n := newNode(nkFormalParams); + result.n := newNodeI(nkFormalParams, n.info); if n.sons[0] = nil then begin addSon(result, nil); // return type - addSon(result.n, newNode(nkType)); // BUGFIX: nkType-Node must be present! + addSon(result.n, newNodeI(nkType, n.info)); // BUGFIX: nkType must exist! end else begin addSon(result, semTypeNode(c, n.sons[0], nil)); // return type - res := newNode(nkType); + res := newNodeI(nkType, n.info); res.typ := result.sons[0]; addSon(result.n, res); end; @@ -655,13 +668,45 @@ begin end end; +function semStmtListType(c: PContext; n: PNode; prev: PType): PType; +var + len, i: int; +begin + checkMinSonsLen(n, 1); + len := sonsLen(n); + for i := 0 to len-2 do begin + n.sons[i] := semStmt(c, n.sons[i]); + end; + if len > 0 then begin + result := semTypeNode(c, n.sons[len-1], prev); + n.typ := result; + n.sons[len-1].typ := result + end + else + result := nil; +end; + +function semBlockType(c: PContext; n: PNode; prev: PType): PType; +begin + Inc(c.p.nestedBlockCounter); + checkSonsLen(n, 2); + openScope(c.tab); + if n.sons[0] <> nil then begin + addDecl(c, newSymS(skLabel, n.sons[0], c)) + end; + result := semStmtListType(c, n.sons[1], prev); + n.sons[1].typ := result; + n.typ := result; + closeScope(c.tab); + Dec(c.p.nestedBlockCounter); +end; + function semTypeNode(c: PContext; n: PNode; prev: PType): PType; var s: PSym; begin result := nil; if n = nil then exit; - embeddedDbg(c, n); case n.kind of nkTypeOfExpr: begin result := semExprWithType(c, n, {@set}[efAllowType]).typ; @@ -686,6 +731,7 @@ begin result := s.typ else begin assignType(prev, s.typ); + prev.id := s.typ.id; result := prev; end end; @@ -717,7 +763,56 @@ begin end; nkEnumTy: result := semEnum(c, n, prev); nkType: result := n.typ; + nkStmtListType: result := semStmtListType(c, n, prev); + nkBlockType: result := semBlockType(c, n, prev); else liMessage(n.info, errTypeExpected); //internalError(n.info, 'semTypeNode(' +{&} nodeKindToStr[n.kind] +{&} ')'); end end; + +procedure setMagicType(m: PSym; kind: TTypeKind; size: int); +begin + m.typ.kind := kind; + m.typ.align := size; + m.typ.size := size; + //m.typ.sym := nil; +end; + +procedure processMagicType(c: PContext; m: PSym); +begin + case m.magic of + mInt: setMagicType(m, tyInt, intSize); + mInt8: setMagicType(m, tyInt8, 1); + mInt16: setMagicType(m, tyInt16, 2); + mInt32: setMagicType(m, tyInt32, 4); + mInt64: setMagicType(m, tyInt64, 8); + mFloat: setMagicType(m, tyFloat, floatSize); + mFloat32: setMagicType(m, tyFloat32, 4); + mFloat64: setMagicType(m, tyFloat64, 8); + mBool: setMagicType(m, tyBool, 1); + mChar: setMagicType(m, tyChar, 1); + mString: begin + setMagicType(m, tyString, ptrSize); + addSon(m.typ, getSysType(tyChar)); + end; + mCstring: begin + setMagicType(m, tyCString, ptrSize); + addSon(m.typ, getSysType(tyChar)); + end; + mPointer: setMagicType(m, tyPointer, ptrSize); + mAnyEnum: setMagicType(m, tyAnyEnum, 1); + mEmptySet: begin + setMagicType(m, tySet, 1); + addSon(m.typ, newTypeS(tyEmpty, c)); + end; + mIntSetBaseType: begin + setMagicType(m, tyRange, intSize); + //intSetBaseType := m.typ; + exit + end; + mNil: setMagicType(m, tyNil, ptrSize); + mArray, mOpenArray, mRange, mSet, mSeq: exit; + else liMessage(m.info, errTypeExpected); + end; + //registerSysType(m.typ); +end; diff --git a/nim/sigmatch.pas b/nim/sigmatch.pas index 6257d5178..96001ed90 100644 --- a/nim/sigmatch.pas +++ b/nim/sigmatch.pas @@ -15,6 +15,7 @@ type TCandidate = record exactMatches: int; subtypeMatches: int; + intConvMatches: int; // conversions to int are not as expensive convMatches: int; genericMatches: int; state: TCandidateState; @@ -25,7 +26,8 @@ type baseTypeMatch: bool; // needed for conversions from T to openarray[T] // for example end; - TTypeRelation = (isNone, isConvertible, isSubtype, isGeneric, isEqual); + TTypeRelation = (isNone, isConvertible, isIntConv, isSubtype, + isGeneric, isEqual); // order is important! procedure initCandidate(out c: TCandidate; callee: PType); @@ -33,6 +35,7 @@ begin c.exactMatches := 0; c.subtypeMatches := 0; c.convMatches := 0; + c.intConvMatches := 0; c.genericMatches := 0; c.state := csEmpty; c.callee := callee; @@ -51,6 +54,8 @@ begin if result <> 0 then exit; result := a.subtypeMatches - b.subtypeMatches; if result <> 0 then exit; + result := a.intConvMatches - b.intConvMatches; + if result <> 0 then exit; result := a.convMatches - b.convMatches; end; @@ -59,6 +64,7 @@ begin Writeln(output, 'exact matches: ' + toString(c.exactMatches)); Writeln(output, 'subtype matches: ' + toString(c.subtypeMatches)); Writeln(output, 'conv matches: ' + toString(c.convMatches)); + Writeln(output, 'intconv matches: ' + toString(c.intConvMatches)); Writeln(output, 'generic matches: ' + toString(c.genericMatches)); end; @@ -77,7 +83,7 @@ begin result := result +{&} typeToString(n.sons[i].typ); if i <> sonsLen(n)-1 then result := result + ', '; end; - result := result + ')'; + addChar(result, ')'); candidates := ''; sym := initOverloadIter(o, c, n.sons[0]); while sym <> nil do begin @@ -101,8 +107,8 @@ begin addSon(result, t.sons[0]); // XXX: t.owner is wrong for ID! addSon(result, t.sons[1]); // XXX: semantic checking for the type? end; - tyEmptySet, tyNil: result := nil; // what should it be? - else result := t + tyNil: result := nil; // what should it be? + else result := t // Note: empty is valid here end end; @@ -116,7 +122,26 @@ begin k := skipRange(a).kind; if k = f.kind then result := isSubtype - else if (k >= min) and (k <= max) or (k = tyInt) then + else if (f.kind = tyInt) and (k in [tyInt..tyInt32]) then + result := isIntConv + else if (k >= min) and (k <= max) then + result := isConvertible + else + result := isNone + end +end; + +function handleFloatRange(f, a: PType): TTypeRelation; +var + k: TTypeKind; +begin + if a.kind = f.kind then + result := isEqual + else begin + k := skipRange(a).kind; + if k = f.kind then + result := isSubtype + else if (k >= tyFloat) and (k <= tyFloat128) then result := isConvertible else result := isNone @@ -201,14 +226,14 @@ begin // is a subtype of f? result := isConvertible // a convertible to f end; tyInt: result := handleRange(f, a, tyInt8, tyInt32); - tyInt8: result := handleRange(f, a, tyInt, tyInt64); - tyInt16: result := handleRange(f, a, tyInt, tyInt64); - tyInt32: result := handleRange(f, a, tyInt, tyInt64); + tyInt8: result := handleRange(f, a, tyInt8, tyInt8); + tyInt16: result := handleRange(f, a, tyInt8, tyInt16); + tyInt32: result := handleRange(f, a, tyInt, tyInt32); tyInt64: result := handleRange(f, a, tyInt, tyInt64); - tyFloat: result := handleRange(f, a, tyFloat, tyFloat128); - tyFloat32: result := handleRange(f, a, tyFloat, tyFloat128); - tyFloat64: result := handleRange(f, a, tyFloat, tyFloat128); - tyFloat128: result := handleRange(f, a, tyFloat, tyFloat128); + tyFloat: result := handleFloatRange(f, a); + tyFloat32: result := handleFloatRange(f, a); + tyFloat64: result := handleFloatRange(f, a); + tyFloat128: result := handleFloatRange(f, a); tyVar: begin if (a.kind = f.kind) then @@ -226,13 +251,14 @@ begin // is a subtype of f? end; tyArrayConstr: begin result := typeRel(mapping, f.sons[1], a.sons[1]); - if result < isGeneric then result := isNone + if result < isGeneric then + result := isNone else begin if (result <> isGeneric) and (lengthOrd(f) <> lengthOrd(a)) then result := isNone else if f.sons[0].kind in GenericTypes then result := minRel(result, typeRel(mapping, f.sons[0], a.sons[0])); - end; + end end; else begin end end @@ -244,16 +270,24 @@ begin // is a subtype of f? if result < isGeneric then result := isNone end; tyArrayConstr: begin - if (a.sons[1] = nil) then + if (f.sons[0].kind <> tyGenericParam) and + (a.sons[1].kind = tyEmpty) then result := isSubtype // [] is allowed here else if typeRel(mapping, base(f), a.sons[1]) >= isGeneric then result := isSubtype; end; - tyArray: - if typeRel(mapping, base(f), a.sons[1]) >= isGeneric then - result := isConvertible; + tyArray: begin + if (f.sons[0].kind <> tyGenericParam) and + (a.sons[1].kind = tyEmpty) then + result := isSubtype + else if typeRel(mapping, base(f), a.sons[1]) >= isGeneric then + result := isConvertible + end; tySequence: begin - if typeRel(mapping, base(f), a.sons[0]) >= isGeneric then + if (f.sons[0].kind <> tyGenericParam) and + (a.sons[0].kind = tyEmpty) then + result := isConvertible + else if typeRel(mapping, base(f), a.sons[0]) >= isGeneric then result := isConvertible; end else begin end @@ -262,21 +296,20 @@ begin // is a subtype of f? tySequence: begin case a.Kind of tyNil: result := isSubtype; - tyArrayConstr: begin - if (a.sons[1] = nil) then // [] is allowed here - result := isConvertible - else if typeRel(mapping, f.sons[0], a.sons[1]) >= isGeneric then - result := isConvertible - end; tySequence: begin - result := typeRel(mapping, f.sons[0], a.sons[0]); - if result < isGeneric then result := isNone + if (f.sons[0].kind <> tyGenericParam) and + (a.sons[0].kind = tyEmpty) then + result := isSubtype + else begin + result := typeRel(mapping, f.sons[0], a.sons[0]); + if result < isGeneric then result := isNone + end end; else begin end end end; tyForward: InternalError('forward type in typeRel()'); - tyNil, tyEmptySet: begin + tyNil: begin if a.kind = f.kind then result := isEqual end; tyTuple: begin @@ -289,15 +322,14 @@ begin // is a subtype of f? end end; tySet: begin - case a.kind of - tyEmptySet: begin - result := isSubtype; - end; - tySet: begin - result := typeRel(mapping, base(f), base(a)); + if a.kind = tySet then begin + if (f.sons[0].kind <> tyGenericParam) and + (a.sons[0].kind = tyEmpty) then + result := isSubtype + else begin + result := typeRel(mapping, f.sons[0], a.sons[0]); if result <= isConvertible then result := isNone // BUGFIX! - end; - else begin end + end end end; tyPtr: begin @@ -338,7 +370,7 @@ begin // is a subtype of f? // allow ``f.son`` as subtype of ``a.son``! result := isConvertible; end - else if m < isGeneric then begin + else if m < isSubtype then begin result := isNone; exit end else result := minRel(m, result) @@ -393,6 +425,9 @@ begin // is a subtype of f? end end; + tyEmpty: begin + if a.kind = tyEmpty then result := isEqual; + end; tyAnyEnum: begin case a.kind of tyRange: result := typeRel(mapping, f, base(a)); @@ -445,6 +480,8 @@ begin // is a subtype of f? end end end + else if a.kind = tyEmpty then + result := isGeneric else begin result := typeRel(mapping, x, a); // check if it fits end @@ -520,6 +557,10 @@ begin inc(m.convMatches); result := implicitConv(nkHiddenStdConv, f, copyTree(arg), m, c); end; + isIntConv: begin + inc(m.intConvMatches); + result := implicitConv(nkHiddenStdConv, f, copyTree(arg), m, c); + end; isSubtype: begin inc(m.subtypeMatches); result := implicitConv(nkHiddenSubConv, f, copyTree(arg), m, c); @@ -587,9 +628,8 @@ begin f := 1; a := 1; m.state := csMatch; // until proven otherwise - m.call := newNode(nkCall); + m.call := newNodeI(nkCall, n.info); m.call.typ := base(m.callee); // may be nil - m.call.info := n.info; formalLen := sonsLen(m.callee.n); addSon(m.call, copyTree(n.sons[0])); IntSetInit(marker); diff --git a/nim/strtabs.pas b/nim/strtabs.pas index 1df147f08..295c46faa 100644 --- a/nim/strtabs.pas +++ b/nim/strtabs.pas @@ -79,12 +79,11 @@ begin new(result); result.mode := mode; result.counter := 0; -{@emit - result.data := []; } - setLength(result.data, startSize); {@ignore} + setLength(result.data, startSize); fillChar(result.data[0], length(result.data)*sizeof(result.data[0]), 0); -{@emit} +{@emit + newSeq(result.data, startSize); } i := 0; while i < high(keyValuePairs) do begin put(result, keyValuePairs[i], keyValuePairs[i+1]); @@ -184,11 +183,12 @@ var n: TKeyValuePairSeq; i: int; begin +{@ignore} n := emptySeq; setLength(n, length(t.data) * growthFactor); -{@ignore} fillChar(n[0], length(n)*sizeof(n[0]), 0); -{@emit} +{@emit + newSeq(n, length(t.data) * growthFactor); } for i := 0 to high(t.data) do if not isNil(t.data[i].key) then RawInsert(t, n, t.data[i].key, t.data[i].val); diff --git a/nim/strutils.pas b/nim/strutils.pas index d70fdd8c3..3d8f0424b 100644 --- a/nim/strutils.pas +++ b/nim/strutils.pas @@ -639,6 +639,28 @@ begin inc(code); end; end; + + if (s[code] = 'N') or (s[code] = 'n') then begin + inc(code); + if (s[code] = 'A') or (s[code] = 'a') then begin + inc(code); + if (s[code] = 'N') or (s[code] = 'n') then begin + if code = length(s) then begin result:= NaN; exit end; + end + end; + raise EInvalidValue.create('invalid float: ' + s) + end; + if (s[code] = 'I') or (s[code] = 'i') then begin + inc(code); + if (s[code] = 'N') or (s[code] = 'n') then begin + inc(code); + if (s[code] = 'F') or (s[code] = 'f') then begin + if code = length(s) then begin result:= Inf*sign; exit end; + end + end; + raise EInvalidValue.create('invalid float: ' + s) + end; + while (code <= Length(s)) and (s[code] in ['0'..'9']) do begin { Read int part } flags := flags or 1; @@ -662,7 +684,7 @@ begin end; { Again, read int and fractional part } if flags = 0 then - raise EInvalidValue.create(''); + raise EInvalidValue.create('invalid float: ' + s); { Exponent ? } if (length(s) >= code) and (upcase(s[code]) = 'E') then begin inc(code); @@ -692,7 +714,7 @@ begin result := result / hd; { Not all characters are read ? } if checkEnd and (length(s) >= code) then - raise EInvalidValue.create(''); + raise EInvalidValue.create('invalid float: ' + s); { evaluate sign } result := result * sign; end; diff --git a/nim/transf.pas b/nim/transf.pas index 97ad31540..fb59eeef2 100644 --- a/nim/transf.pas +++ b/nim/transf.pas @@ -6,29 +6,81 @@ // See the file "copying.txt", included in this // distribution, for details about the copyright. // +unit transf; // This module implements the transformator. It transforms the syntax tree // to ease the work of the code generators. Does some transformations: // // * inlines iterators -// * looks up constants +// * inlines constants +// * performes contant folding -// ------------ helpers ----------------------------------------------------- +interface -var - gTmpId: int; +{$include 'config.inc'} + +uses + sysutils, nsystem, charsets, strutils, + lists, options, ast, astalgo, trees, treetab, + msgs, nos, idents, rnimsyn, types, passes, semfold; + +const + genPrefix = ':tmp'; // prefix for generated names + +function transfPass(): TPass; + +implementation + +type + PTransCon = ^TTransCon; + TTransCon = record // part of TContext; stackable + mapping: TIdNodeTable; // mapping from symbols to nodes + owner: PSym; // current owner + forStmt: PNode; // current for stmt + next: PTransCon; // for stacking + end; + + TTransfContext = object(passes.TPassContext) + module: PSym; + transCon: PTransCon; // top of a TransCon stack + end; + PTransf = ^TTransfContext; -function newTemp(c: PContext; typ: PType; const info: TLineInfo): PSym; +function newTransCon(): PTransCon; begin - inc(gTmpId); - result := newSym(skTemp, getIdent(genPrefix +{&} ToString(gTmpId)), - c.transCon.owner); + new(result); +{@ignore} + fillChar(result^, sizeof(result^), 0); +{@emit} + initIdNodeTable(result.mapping); +end; + +procedure pushTransCon(c: PTransf; t: PTransCon); +begin + t.next := c.transCon; + c.transCon := t; +end; + +procedure popTransCon(c: PTransf); +begin + if (c.transCon = nil) then InternalError('popTransCon'); + c.transCon := c.transCon.next; +end; + +// ------------ helpers ----------------------------------------------------- + +function newTemp(c: PTransf; typ: PType; const info: TLineInfo): PSym; +begin + result := newSym(skTemp, getIdent(genPrefix), getCurrOwner()); result.info := info; result.typ := skipGeneric(typ); + include(result.flags, sfFromGeneric); end; // -------------------------------------------------------------------------- +function transform(c: PTransf; n: PNode): PNode; forward; + (* Transforming iterators into non-inlined versions is pretty hard, but @@ -79,17 +131,14 @@ More efficient, but not implementable: label1: inc(c.i) *) - -function transform(c: PContext; n: PNode): PNode; forward; - -function newAsgnStmt(c: PContext; le, ri: PNode): PNode; +function newAsgnStmt(c: PTransf; le, ri: PNode): PNode; begin result := newNodeI(nkAsgn, ri.info); addSon(result, le); addSon(result, ri); end; -function transformSym(c: PContext; n: PNode): PNode; +function transformSym(c: PTransf; n: PNode): PNode; var tc: PTransCon; begin @@ -107,7 +156,7 @@ begin case n.sym.kind of skConst, skEnumField: begin // BUGFIX: skEnumField was missing if not (skipGeneric(n.sym.typ).kind in ConstantDataTypes) then begin - result := getConstExpr(c, n); + result := getConstExpr(c.module, n); if result = nil then InternalError(n.info, 'transformSym: const'); end end @@ -115,7 +164,7 @@ begin end end; -procedure transformContinueAux(c: PContext; n: PNode; labl: PSym; +procedure transformContinueAux(c: PTransf; n: PNode; labl: PSym; var counter: int); var i: int; @@ -135,7 +184,7 @@ begin end end; -function transformContinue(c: PContext; n: PNode): PNode; +function transformContinue(c: PTransf; n: PNode): PNode; // we transform the continue statement into a block statement var i, counter: int; @@ -146,9 +195,8 @@ begin for i := 0 to sonsLen(n)-1 do result.sons[i] := transform(c, n.sons[i]); counter := 0; - inc(gTmpId); - labl := newSym(skLabel, getIdent(genPrefix +{&} ToString(gTmpId)), - getCurrOwner(c)); + labl := newSym(skLabel, nil, getCurrOwner()); + labl.name := getIdent(genPrefix +{&} ToString(labl.id)); labl.info := result.info; transformContinueAux(c, result, labl, counter); if counter > 0 then begin @@ -170,7 +218,7 @@ begin end end; -function transformYield(c: PContext; n: PNode): PNode; +function transformYield(c: PTransf; n: PNode): PNode; var e: PNode; i: int; @@ -198,7 +246,7 @@ begin addSon(result, transform(c, lastSon(c.transCon.forStmt))); end; -function inlineIter(c: PContext; n: PNode): PNode; +function inlineIter(c: PTransf; n: PNode): PNode; var i: int; it: PNode; @@ -219,9 +267,11 @@ begin if (it.kind <> nkIdentDefs) or (it.sons[0].kind <> nkSym) then InternalError(it.info, 'inlineIter'); newVar := copySym(it.sons[0].sym); - newVar.owner := getCurrOwner(c); - IdNodeTablePut(c.transCon.mapping, it.sons[0].sym, - newSymNode(newVar)); + include(newVar.flags, sfFromGeneric); + // fixes a strange bug for rodgen: + //include(it.sons[0].sym.flags, sfFromGeneric); + newVar.owner := getCurrOwner(); + IdNodeTablePut(c.transCon.mapping, it.sons[0].sym, newSymNode(newVar)); it.sons[0] := newSymNode(newVar); it.sons[2] := transform(c, it.sons[2]); end @@ -245,7 +295,7 @@ begin addSon(father, vpart); end; -function transformAddrDeref(c: PContext; n: PNode; a, b: TNodeKind): PNode; +function transformAddrDeref(c: PTransf; n: PNode; a, b: TNodeKind): PNode; var m: PNode; begin @@ -281,7 +331,7 @@ begin result := n; end; -function transformConv(c: PContext; n: PNode): PNode; +function transformConv(c: PTransf; n: PNode): PNode; var source, dest: PType; diff: int; @@ -370,7 +420,7 @@ begin end; end; -function transformFor(c: PContext; n: PNode): PNode; +function transformFor(c: PTransf; n: PNode): PNode; // generate access statements for the parameters (unless they are constant) // put mapping from formal parameters to actual parameters var @@ -379,7 +429,7 @@ var newC: PTransCon; temp, formal: PSym; begin - assert(n.kind = nkForStmt); + if (n.kind <> nkForStmt) then InternalError(n.info, 'transformFor'); result := newNodeI(nkStmtList, n.info); len := sonsLen(n); n.sons[len-1] := transformContinue(c, n.sons[len-1]); @@ -388,15 +438,16 @@ begin addSon(result, v); newC := newTransCon(); call := n.sons[len-2]; - assert(call.kind = nkCall); - assert(call.sons[0].kind = nkSym); + if (call.kind <> nkCall) or (call.sons[0].kind <> nkSym) then + InternalError(call.info, 'transformFor'); newC.owner := call.sons[0].sym; newC.forStmt := n; - assert(newC.owner.kind = skIterator); + if (newC.owner.kind <> skIterator) then + InternalError(call.info, 'transformFor'); // generate access statements for the parameters (unless they are constant) pushTransCon(c, newC); for i := 1 to sonsLen(call)-1 do begin - e := getConstExpr(c, call.sons[i]); + e := getConstExpr(c.module, call.sons[i]); formal := skipGeneric(newC.owner.typ).n.sons[i].sym; if e <> nil then IdNodeTablePut(newC.mapping, formal, e) @@ -414,7 +465,9 @@ begin end end; body := newC.owner.ast.sons[codePos]; + pushInfoContext(n.info); addSon(result, inlineIter(c, body)); + popInfoContext(); popTransCon(c); end; @@ -427,7 +480,7 @@ begin result := mNone end; -procedure gatherVars(c: PContext; n: PNode; var marked: TIntSet; +procedure gatherVars(c: PTransf; n: PNode; var marked: TIntSet; owner: PSym; container: PNode); // gather used vars for closure generation var @@ -542,7 +595,7 @@ begin result.typ := y.typ; end; -function transformLambda(c: PContext; n: PNode): PNode; +function transformLambda(c: PTransf; n: PNode): PNode; var marked: TIntSet; closure: PNode; @@ -553,7 +606,8 @@ var begin result := n; IntSetInit(marked); - assert(n.sons[namePos].kind = nkSym); + if (n.sons[namePos].kind <> nkSym) then + InternalError(n.info, 'transformLambda'); s := n.sons[namePos].sym; closure := newNodeI(nkRecList, n.sons[codePos].info); gatherVars(c, n.sons[codePos], marked, s, closure); @@ -582,7 +636,7 @@ begin // the outer routine! end; -function transformCase(c: PContext; n: PNode): PNode; +function transformCase(c: PTransf; n: PNode): PNode; // removes `elif` branches of a case stmt var len, i, j: int; @@ -593,7 +647,8 @@ begin if n.sons[i].kind = nkElse then dec(i); if n.sons[i].kind = nkElifBranch then begin while n.sons[i].kind = nkElifBranch do dec(i); - assert(n.sons[i].kind = nkOfBranch); + if (n.sons[i].kind <> nkOfBranch) then + InternalError(n.sons[i].info, 'transformCase'); ifs := newNodeI(nkIfStmt, n.sons[i+1].info); for j := i+1 to len-1 do addSon(ifs, n.sons[j]); setLength(n.sons, i+2); @@ -603,7 +658,7 @@ begin for j := 0 to sonsLen(n)-1 do result.sons[j] := transform(c, n.sons[j]); end; -function transformArrayAccess(c: PContext; n: PNode): PNode; +function transformArrayAccess(c: PTransf; n: PNode): PNode; var i: int; begin @@ -614,16 +669,85 @@ begin result.sons[i] := transform(c, result.sons[i]); end; -function transform(c: PContext; n: PNode): PNode; +function getMergeOp(n: PNode): PSym; +begin + result := nil; + case n.kind of + nkCall, nkHiddenCallConv, nkCommand, nkInfix, nkPrefix, nkPostfix: begin + if (n.sons[0].Kind = nkSym) and (n.sons[0].sym.kind = skProc) + and (sfMerge in n.sons[0].sym.flags) then + result := n.sons[0].sym; + end + else begin end + end +end; + +procedure flattenTreeAux(d, a: PNode; op: PSym); +var + i: int; + op2: PSym; +begin + op2 := getMergeOp(a); + if (op2 <> nil) and ((op2.id = op.id) + or (op.magic <> mNone) and (op2.magic = op.magic)) then + for i := 1 to sonsLen(a)-1 do + flattenTreeAux(d, a.sons[i], op) + else + // a is a "leaf", so add it: + addSon(d, copyTree(a)) +end; + +function flattenTree(root: PNode): PNode; +var + op: PSym; +begin + op := getMergeOp(root); + if op <> nil then begin + result := copyNode(root); + addSon(result, copyTree(root.sons[0])); + flattenTreeAux(result, root, op) + end + else + result := root +end; + +function transformCall(c: PTransf; n: PNode): PNode; +var + i, j: int; + m, a: PNode; + op: PSym; +begin + result := flattenTree(n); + for i := 0 to sonsLen(result)-1 do + result.sons[i] := transform(c, result.sons[i]); + op := getMergeOp(result); + if (op <> nil) and (op.magic <> mNone) and (sonsLen(result) >= 3) then begin + m := result; + result := newNodeIT(nkCall, m.info, m.typ); + addSon(result, copyTree(m.sons[0])); + j := 1; + while j < sonsLen(m) do begin + a := m.sons[j]; + inc(j); + if isConstExpr(a) then + while (j < sonsLen(m)) and isConstExpr(m.sons[j]) do begin + a := evalOp(op.magic, m, a, m.sons[j]); + inc(j) + end; + addSon(result, a); + end; + if sonsLen(result) = 2 then + result := result.sons[1]; + end; +end; + +function transform(c: PTransf; n: PNode): PNode; var i: int; cnst: PNode; begin result := n; if n = nil then exit; - //result := getConstExpr(c, n); // try to evaluate the expressions - //if result <> nil then exit; - //result := n; // reset the result node case n.kind of nkSym: begin result := transformSym(c, n); @@ -636,28 +760,60 @@ begin nkLambda: result := transformLambda(c, n); nkForStmt: result := transformFor(c, n); nkCaseStmt: result := transformCase(c, n); - nkProcDef, nkIteratorDef: begin + nkProcDef, nkIteratorDef, nkMacroDef: begin if n.sons[genericParamsPos] = nil then n.sons[codePos] := transform(c, n.sons[codePos]); end; nkWhileStmt: begin - assert(sonsLen(n) = 2); + if (sonsLen(n) <> 2) then InternalError(n.info, 'transform'); n.sons[0] := transform(c, n.sons[0]); n.sons[1] := transformContinue(c, n.sons[1]); end; + nkCall, nkHiddenCallConv, nkCommand, nkInfix, nkPrefix, nkPostfix: + result := transformCall(c, result); nkAddr, nkHiddenAddr: result := transformAddrDeref(c, n, nkDerefExpr, nkHiddenDeref); nkDerefExpr, nkHiddenDeref: result := transformAddrDeref(c, n, nkAddr, nkHiddenAddr); nkHiddenStdConv, nkHiddenSubConv, nkConv: result := transformConv(c, n); - nkCommentStmt, nkTemplateDef, nkMacroDef: exit; + nkCommentStmt, nkTemplateDef: exit; nkConstSection: exit; // do not replace ``const c = 3`` with ``const 3 = 3`` else begin for i := 0 to sonsLen(n)-1 do result.sons[i] := transform(c, n.sons[i]); end end; - cnst := getConstExpr(c, result); + cnst := getConstExpr(c.module, result); if cnst <> nil then result := cnst; // do not miss an optimization end; + +function processTransf(context: PPassContext; n: PNode): PNode; +var + c: PTransf; +begin + c := PTransf(context); + result := transform(c, n); +end; + +function openTransf(module: PSym; const filename: string): PPassContext; +var + n: PTransf; +begin + new(n); +{@ignore} + fillChar(n^, sizeof(n^), 0); +{@emit} + n.module := module; + result := n; +end; + +function transfPass(): TPass; +begin + initPass(result); + result.open := openTransf; + result.process := processTransf; + result.close := processTransf; // we need to process generics too! +end; + +end. diff --git a/nim/trees.pas b/nim/trees.pas index a50b8f6cb..d271bfae8 100644 --- a/nim/trees.pas +++ b/nim/trees.pas @@ -70,7 +70,7 @@ function cyclicTree(n: PNode): boolean; var s: PNode; begin - s := newNode(nkEmpty); + s := newNodeI(nkEmpty, n.info); result := cyclicTreeAux(n, s); end; @@ -113,8 +113,8 @@ begin end else if (a <> nil) and (b <> nil) and (a.kind = b.kind) then begin if a.flags <> b.flags then exit; - if a.info.line <> int(b.info.line) then exit; - if a.info.col <> int(b.info.col) then exit; + if a.info.line <> b.info.line then exit; + if a.info.col <> b.info.col then exit; //if a.info.fileIndex <> b.info.fileIndex then exit; case a.kind of nkSym: // don't go nuts here: same symbol as string is enough: @@ -147,7 +147,7 @@ begin if not (op.kind in [nkCall, nkGenericCall, nkHiddenCallConv]) then result := nil else begin - assert(sonsLen(op) > 0); + if (sonsLen(op) <= 0) then InternalError(op.info, 'getOpSym'); case op.sons[0].Kind of nkSym, nkQualified: result := op.sons[0].sym; else result := nil @@ -160,8 +160,7 @@ begin case op.kind of nkCall, nkHiddenCallConv: begin case op.sons[0].Kind of - nkSym, nkQualified: begin - assert(op.sons[0].sym <> nil); // BUGFIX + nkSym: begin result := op.sons[0].sym.magic; end; else result := mNone @@ -183,7 +182,8 @@ end; function isConstExpr(n: PNode): Boolean; begin result := (n.kind in [nkCharLit..nkInt64Lit, nkStrLit..nkTripleStrLit, - nkFloatLit..nkFloat64Lit]) or (nfAllConst in n.flags) + nkFloatLit..nkFloat64Lit, nkNilLit]) + or (nfAllConst in n.flags) end; procedure flattenTreeAux(d, a: PNode; op: TMagic); diff --git a/nim/treetab.pas b/nim/treetab.pas index 5a9dbdb2a..dbd7b5276 100644 --- a/nim/treetab.pas +++ b/nim/treetab.pas @@ -17,8 +17,10 @@ interface uses nsystem, hashes, ast, astalgo, types; -function NodeTableGet(const t: TNodeTable; key: PNode): PNode; -procedure NodeTablePut(var t: TNodeTable; key, val: PNode); +function NodeTableGet(const t: TNodeTable; key: PNode): int; +procedure NodeTablePut(var t: TNodeTable; key: PNode; val: int); + +function NodeTableTestOrSet(var t: TNodeTable; key: PNode; val: int): int; implementation @@ -29,7 +31,7 @@ begin result := 0; if n = nil then exit; result := ord(n.kind); - case n.kind of + case n.kind of nkEmpty, nkNilLit, nkType: begin end; nkIdent: result := concHash(result, n.ident.h); nkSym: result := concHash(result, n.sym.name.h); @@ -44,7 +46,7 @@ begin nkStrLit..nkTripleStrLit: result := concHash(result, GetHashStr(n.strVal)); else begin - for i := 0 to sonsLen(n)-1 do + for i := 0 to sonsLen(n)-1 do result := concHash(result, hashTree(n.sons[i])); end end @@ -95,17 +97,17 @@ begin result := -1 end; -function NodeTableGet(const t: TNodeTable; key: PNode): PNode; +function NodeTableGet(const t: TNodeTable; key: PNode): int; var index: int; begin index := NodeTableRawGet(t, hashTree(key), key); if index >= 0 then result := t.data[index].val - else result := nil + else result := low(int) end; procedure NodeTableRawInsert(var data: TNodePairSeq; k: THash; - key, val: PNode); + key: PNode; val: int); var h: THash; begin @@ -117,7 +119,7 @@ begin data[h].val := val; end; -procedure NodeTablePut(var t: TNodeTable; key, val: PNode); +procedure NodeTablePut(var t: TNodeTable; key: PNode; val: int); var index, i: int; n: TNodePairSeq; @@ -131,10 +133,44 @@ begin end else begin if mustRehash(length(t.data), t.counter) then begin + {@ignore} setLength(n, length(t.data) * growthFactor); + fillChar(n[0], length(n)*sizeof(n[0]), 0); + {@emit + newSeq(n, length(t.data) * growthFactor); } + for i := 0 to high(t.data) do + if t.data[i].key <> nil then + NodeTableRawInsert(n, t.data[i].h, t.data[i].key, t.data[i].val); + {@ignore} + t.data := n; + {@emit + swap(t.data, n); + } + end; + NodeTableRawInsert(t.data, k, key, val); + inc(t.counter) + end; +end; + +function NodeTableTestOrSet(var t: TNodeTable; key: PNode; val: int): int; +var + index, i: int; + n: TNodePairSeq; + k: THash; +begin + k := hashTree(key); + index := NodeTableRawGet(t, k, key); + if index >= 0 then begin + assert(t.data[index].key <> nil); + result := t.data[index].val + end + else begin + if mustRehash(length(t.data), t.counter) then begin {@ignore} + setLength(n, length(t.data) * growthFactor); fillChar(n[0], length(n)*sizeof(n[0]), 0); - {@emit} + {@emit + newSeq(n, length(t.data) * growthFactor); } for i := 0 to high(t.data) do if t.data[i].key <> nil then NodeTableRawInsert(n, t.data[i].h, t.data[i].key, t.data[i].val); @@ -145,6 +181,7 @@ begin } end; NodeTableRawInsert(t.data, k, key, val); + result := val; inc(t.counter) end; end; diff --git a/nim/types.pas b/nim/types.pas index c63913baa..bc42f2169 100644 --- a/nim/types.pas +++ b/nim/types.pas @@ -77,8 +77,10 @@ function skipPtrsGeneric(t: PType): PType; function elemType(t: PType): PType; function containsObject(t: PType): bool; + function containsGarbageCollectedRef(typ: PType): Boolean; function containsHiddenPointer(typ: PType): Boolean; +function canFormAcycle(typ: PType): boolean; function isCompatibleToCString(a: PType): bool; @@ -100,6 +102,19 @@ function inheritanceDiff(a, b: PType): int; function InvalidGenericInst(f: PType): bool; // for debugging + +type + TTypeFieldResult = ( + frNone, // type has no object type field + frHeader, // type has an object type field only in the header + frEmbedded // type has an object type field somewhere embedded + ); + +function analyseObjectWithTypeField(t: PType): TTypeFieldResult; +// this does a complex analysis whether a call to ``objectInit`` needs to be +// made or intializing of the type field suffices or if there is no type field +// at all in this type. + implementation function InvalidGenericInst(f: PType): bool; @@ -392,6 +407,54 @@ begin result := searchTypeFor(t, isObjectPredicate); end; +function isObjectWithTypeFieldPredicate(t: PType): bool; +begin + result := (t.kind = tyObject) and (t.sons[0] = nil) + and not (sfPure in t.sym.flags) + and not (tfFinal in t.flags); +end; + +function analyseObjectWithTypeFieldAux(t: PType; + var marker: TIntSet): TTypeFieldResult; +var + res: TTypeFieldResult; + i: int; +begin + result := frNone; + if t = nil then exit; + case t.kind of + tyObject: begin + if (t.n <> nil) then + if searchTypeNodeForAux(t.n, isObjectWithTypeFieldPredicate, marker) then begin + result := frEmbedded; exit + end; + for i := 0 to sonsLen(t)-1 do begin + res := analyseObjectWithTypeFieldAux(t.sons[i], marker); + if res = frEmbedded then begin result := frEmbedded; exit end; + if res = frHeader then result := frHeader; + end; + if result = frNone then + if isObjectWithTypeFieldPredicate(t) then result := frHeader + end; + tyGenericInst: result := analyseObjectWithTypeFieldAux(lastSon(t), marker); + tyArray, tyArrayConstr, tyTuple: begin + for i := 0 to sonsLen(t)-1 do begin + res := analyseObjectWithTypeFieldAux(t.sons[i], marker); + if res <> frNone then begin result := frEmbedded; exit end; + end + end + else begin end + end +end; + +function analyseObjectWithTypeField(t: PType): TTypeFieldResult; +var + marker: TIntSet; +begin + IntSetInit(marker); + result := analyseObjectWithTypeFieldAux(t, marker); +end; + function isGBCRef(t: PType): bool; begin result := t.kind in [tyRef, tySequence, tyString]; @@ -416,6 +479,61 @@ begin result := searchTypeFor(typ, isHiddenPointer); end; +function canFormAcycleAux(var marker: TIntSet; t: PType; + startId: int): bool; forward; + +function canFormAcycleNode(var marker: TIntSet; n: PNode; startId: int): bool; +var + i: int; +begin + result := false; + if n <> nil then begin + result := canFormAcycleAux(marker, n.typ, startId); + if not result then + case n.kind of + nkNone..nkNilLit: begin end; + else begin + for i := 0 to sonsLen(n)-1 do begin + result := canFormAcycleNode(marker, n.sons[i], startId); + if result then exit + end + end + end + end +end; + +function canFormAcycleAux(var marker: TIntSet; t: PType; startId: int): bool; +var + i: int; +begin + result := false; + if t = nil then exit; + if tfAcyclic in t.flags then exit; + case skipGeneric(t).kind of + tyTuple, tyObject, tyRef, tySequence, tyArray, tyArrayConstr, + tyOpenArray: begin + if not IntSetContainsOrIncl(marker, t.id) then begin + for i := 0 to sonsLen(t)-1 do begin + result := canFormAcycleAux(marker, t.sons[i], startId); + if result then exit + end; + if t.n <> nil then result := canFormAcycleNode(marker, t.n, startId) + end + else + result := t.id = startId; + end + else begin end + end +end; + +function canFormAcycle(typ: PType): boolean; +var + marker: TIntSet; +begin + IntSetInit(marker); + result := canFormAcycleAux(marker, typ, typ.id); +end; + function mutateTypeAux(var marker: TIntSet; t: PType; iter: TTypeMutator; closure: PObject): PType; forward; @@ -476,7 +594,7 @@ end; function TypeToString(typ: PType; prefer: TPreferedDesc = preferName): string; const typeToStr: array [TTypeKind] of string = ( - 'None', 'bool', 'Char', '{}', 'Array Constructor [$1]', 'nil', + 'None', 'bool', 'Char', 'empty', 'Array Constructor [$1]', 'nil', 'Generic', 'GenericInst', 'GenericParam', 'enum', 'anyenum', 'array[$1, $2]', 'object', 'tuple', 'set[$1]', 'range[$1]', @@ -770,12 +888,16 @@ var i: int; a, b: PType; begin + if x = y then begin result := true; exit end; a := skipGeneric(x); b := skipGeneric(y); assert(a <> nil); assert(b <> nil); if a.kind <> b.kind then begin result := false; exit end; case a.Kind of + tyEmpty, tyChar, tyBool, tyNil, tyPointer, tyString, tyCString, + tyInt..tyFloat128: + result := true; tyEnum, tyForward, tyObject: result := (a.id = b.id); tyTuple: @@ -802,17 +924,10 @@ begin and SameValue(a.n.sons[0], b.n.sons[0]) and SameValue(a.n.sons[1], b.n.sons[1]) end; - tyChar, tyBool, tyNil, tyPointer, tyString, tyCString, tyInt..tyFloat128: - result := true; - else begin - InternalError('sameType(' +{&} typeKindToStr[a.kind] +{&} ', ' - +{&} typeKindToStr[b.kind] +{&} ')'); - result := false - end + tyNone, tyAnyEnum: result := false; end end; - function align(address, alignment: biggestInt): biggestInt; begin result := address + (alignment-1) and not (alignment-1); diff --git a/nim/wordrecg.pas b/nim/wordrecg.pas index 2849c1d05..309b2f7c1 100644 --- a/nim/wordrecg.pas +++ b/nim/wordrecg.pas @@ -25,15 +25,18 @@ type TSpecialWord = (wInvalid, // these are mapped to Nimrod keywords: //[[[cog - //keywords = (file("data/keywords.txt").read()).split() + //from string import split, capitalize + //keywords = split(open("data/keywords.txt").read()) //idents = "" //strings = "" //i = 1 //for k in keywords: - // idents += "w" + k.capitalize() + ", " - // strings += "'" + k + "', " - // if i % 4 == 0: idents += "\n"; strings += "\n" - // i += 1 + // idents = idents + "w" + capitalize(k) + ", " + // strings = strings + "'" + k + "', " + // if i % 4 == 0: + // idents = idents + "\n" + // strings = strings + "\n" + // i = i + 1 //cog.out(idents) //]]] wAddr, wAnd, wAs, wAsm, @@ -57,34 +60,34 @@ type wColon, wEquals, wDot, wDotDot, wHat, wStar, wMinus, // pragmas and command line options: - wMagic, wTypeCheck, wFinal, wPostfix, + wMagic, wTypeCheck, wFinal, wProfiler, wObjChecks, wImportc, wExportc, wAlign, wNodecl, wPure, wVolatile, wRegister, wNostatic, wHeader, wNosideeffect, wNoreturn, - wLib, wDynlib, wReturnsnew, wCompilerproc, wCppmethod, wFatal, + wMerge, wLib, wDynlib, wCompilerproc, wCppmethod, wFatal, wError, wWarning, wHint, wLine, wPush, wPop, wDefine, wUndef, wLinedir, wStacktrace, wLinetrace, wPragma, wLink, wCompile, wLinksys, wFixupsystem, wDeprecated, wVarargs, wByref, wCallconv, wBreakpoint, wDebugger, wNimcall, wStdcall, - wCdecl, wSafecall, wSyscall, wInline, wFastcall, wClosure, + wCdecl, wSafecall, wSyscall, wInline, wNoInline, wFastcall, wClosure, wNoconv, wOn, wOff, wChecks, wRangechecks, wBoundchecks, wOverflowchecks, wNilchecks, wAssertions, wWarnings, wW, wHints, wOptimization, wSpeed, wSize, wNone, wPath, wP, wD, wU, wDebuginfo, wCompileonly, wNolinking, wForcebuild, - wF, wDeadelim, wSafecode, wSyntaxcheck, wY, + wF, wDeadelim, wSafecode, wCompileTime, wGc, wRefc, wBoehm, wA, wOpt, wO, wApp, wConsole, wGui, wPassc, wT, wPassl, wL, wListcmd, wGendoc, wGenmapping, wOs, wCpu, wGenerate, wG, wC, wCpp, - wYaml, wRun, wR, wVerbose, wV, wHelp, - wH, wCompilesys, wFieldChecks, wX, wVersion, wAdvanced, wMergeoutput, + wYaml, wRun, wR, wVerbosity, wV, wHelp, + wH, wSymbolFiles, wFieldChecks, wX, wVersion, wAdvanced, wSkipcfg, wSkipProjCfg, wCc, wGenscript, wCheckPoint, wCheckPoints, wMaxErr, wExpr, wStmt, wTypeDesc, - wAsmQuote, wAstCache, wCFileCache, wIndex, + wSubsChar, wAstCache, wAcyclic, wIndex, // commands: wCompileToC, wCompileToCpp, wCompileToEcmaScript, wPretty, wDoc, wPas, wGenDepend, wListDef, wCheck, wParse, wScan, wBoot, wDebugTrans, - wRst2html, + wRst2html, wI, // special for the preprocessor of configuration files: wWrite, wPutEnv, wPrependEnv, wAppendEnv, // additional Pascal keywords: @@ -131,34 +134,33 @@ const ':'+'', '='+'', '.'+'', '..', '^'+'', '*'+'', '-'+'', // pragmas and command line options: - 'magic', 'typecheck', 'final', 'postfix', + 'magic', 'typecheck', 'final', 'profiler', 'objchecks', 'importc', 'exportc', 'align', 'nodecl', 'pure', 'volatile', 'register', 'nostatic', 'header', 'nosideeffect', 'noreturn', - 'lib', 'dynlib', 'returnsnew', 'compilerproc', 'cppmethod', 'fatal', + 'merge', 'lib', 'dynlib', 'compilerproc', 'cppmethod', 'fatal', 'error', 'warning', 'hint', 'line', 'push', 'pop', 'define', 'undef', 'linedir', 'stacktrace', 'linetrace', 'pragma', 'link', 'compile', 'linksys', 'fixupsystem', 'deprecated', 'varargs', 'byref', 'callconv', 'breakpoint', 'debugger', 'nimcall', 'stdcall', - 'cdecl', 'safecall', 'syscall', 'inline', 'fastcall', 'closure', + 'cdecl', 'safecall', 'syscall', 'inline', 'noinline', 'fastcall', 'closure', 'noconv', 'on', 'off', 'checks', 'rangechecks', 'boundchecks', 'overflowchecks', 'nilchecks', 'assertions', 'warnings', 'w'+'', 'hints', 'optimization', 'speed', 'size', 'none', 'path', 'p'+'', 'd'+'', 'u'+'', 'debuginfo', 'compileonly', 'nolinking', 'forcebuild', - 'f'+'', 'deadelim', 'safecode', 'syntaxcheck', 'y'+'', + 'f'+'', 'deadelim', 'safecode', 'compiletime', 'gc', 'refc', 'boehm', 'a'+'', 'opt', 'o'+'', 'app', 'console', 'gui', 'passc', 't'+'', 'passl', 'l'+'', 'listcmd', 'gendoc', 'genmapping', 'os', 'cpu', 'generate', 'g'+'', 'c'+'', 'cpp', - 'yaml', 'run', 'r'+'', 'verbose', 'v'+'', 'help', - 'h'+'', 'compilesys', 'fieldchecks', 'x'+'', 'version', 'advanced', - 'mergeoutput', + 'yaml', 'run', 'r'+'', 'verbosity', 'v'+'', 'help', + 'h'+'', 'symbolfiles', 'fieldchecks', 'x'+'', 'version', 'advanced', 'skipcfg', 'skipprojcfg', 'cc', 'genscript', 'checkpoint', 'checkpoints', 'maxerr', 'expr', 'stmt', 'typedesc', - 'asmquote', 'astcache', 'cfilecache', 'index', + 'subschar', 'astcache', 'acyclic', 'index', // commands: 'compiletoc', 'compiletocpp', 'compiletoecmascript', 'pretty', 'doc', 'pas', 'gendepend', 'listdef', 'check', 'parse', - 'scan', 'boot', 'debugtrans', 'rst2html', + 'scan', 'boot', 'debugtrans', 'rst2html', 'i'+'', // special for the preprocessor of configuration files: 'write', 'putenv', 'prependenv', 'appendenv', diff --git a/tests/gcbench.nim b/tests/gcbench.nim index 4c94fe360..72daad210 100644 --- a/tests/gcbench.nim +++ b/tests/gcbench.nim @@ -148,8 +148,7 @@ proc main() = # Create long-lived array, filling half of it echo(" Creating a long-lived array of " & $kArraySize & " doubles") - myarray = [] - setlength(myarray, kArraySize) + newSeq(myarray, kArraySize) for i in 0..kArraySize div 2 -1: myarray[i] = 1.0 / toFloat(i) diff --git a/tests/gctest.nim b/tests/gctest.nim index 60845033c..2f8b97b38 100644 --- a/tests/gctest.nim +++ b/tests/gctest.nim @@ -38,13 +38,13 @@ proc newCaseNode(data: string): PCaseNode = result.data = data else: result.kind = nkWhole - result.unused = ["", "abc", "abdc"] + result.unused = @["", "abc", "abdc"] flip = 1 - flip proc newCaseNode(a, b: PCaseNode): PCaseNode = new(result) result.kind = nkList - result.sons = [a, b] + result.sons = @[a, b] proc caseTree(lvl: int = 0): PCaseNode = if lvl == 3: result = newCaseNode("data item") @@ -53,6 +53,7 @@ proc caseTree(lvl: int = 0): PCaseNode = proc finalizeBNode(n: TBNode) = writeln(stdout, n.data) proc finalizeNode(n: PNode) = assert(n != nil) + write(stdout, "finalizing: ") if isNil(n.data): writeln(stdout, "nil!") else: writeln(stdout, n.data) @@ -101,17 +102,17 @@ proc unsureNew(result: var PNode) = new(result, finalizeNode) result.data = $id new(result.le, finalizeNode) - result.le.data = $id & ".1" + result.le.data = $id & ".a" new(result.ri, finalizeNode) - result.ri.data = $id & ".2" + result.ri.data = $id & ".b" inc(id) proc setSons(n: var TBNode) = - n.sons = [] # free memory of the sons - n.t.data = [] + n.sons = @[] # free memory of the sons + n.t.data = @[] var m: seq[string] - m = [] + m = @[] setLen(m, len(n.t.data) * 2) for i in 0..high(m): m[i] = "..." @@ -120,16 +121,17 @@ proc setSons(n: var TBNode) = proc buildBTree(father: var TBNode) = father.data = "father" father.other = nil - father.sons = [] + father.sons = @[] for i in 1..10: + write(stdout, "next iteration!\n") var n: TBNode n.other = returnTree() n.data = "B node: " & $i - if i mod 1 == 0: n.sons = [] # nil and [] need to be handled correctly! + if i mod 2 == 0: n.sons = @[] # nil and [] need to be handled correctly! add father.sons, n father.t.counter = 0 father.t.max = 3 - father.t.data = ["ha", "lets", "stress", "it"] + father.t.data = @["ha", "lets", "stress", "it"] setSons(father) proc main() = @@ -148,7 +150,7 @@ proc main() = t2 = buildTree() printTree(t2) write(stdout, "now test sequences of strings:") - var s: seq[string] = [] + var s: seq[string] = @[] for i in 1..100: add s, "hohoho" # test reallocation writeln(stdout, s[89]) @@ -157,15 +159,22 @@ proc main() = #main() #GC_disable() -writeln(stdout, repr(caseTree())) - var father: TBNode -buildBTree(father) -write(stdout, repr(father)) + s: string +s = "" +s = "" +writeln(stdout, repr(caseTree())) +father.t.data = @["ha", "lets", "stress", "it"] +father.t.data = @["ha", "lets", "stress", "it"] var t = buildTree() write(stdout, repr(t^)) +buildBTree(father) +write(stdout, repr(father)) write(stdout, "starting main...\n") main() write(stdout, "finished\n") +GC_fullCollect() +GC_fullCollect() +write(stdout, GC_getStatistics()) diff --git a/tests/mambsym1.nim b/tests/mambsym1.nim index 1f7b43b02..cf8ac5242 100644 --- a/tests/mambsym1.nim +++ b/tests/mambsym1.nim @@ -2,6 +2,7 @@ import mambsym2 # import TExport type TExport* = enum x, y, z + TOtherEnum* = enum mDec, mInc, mAssign proc ha() = var diff --git a/tests/mambsym2.nim b/tests/mambsym2.nim index a30009f36..eac8de6ba 100644 --- a/tests/mambsym2.nim +++ b/tests/mambsym2.nim @@ -1,2 +1,3 @@ type - TExport* = enum x, y, z # exactly the same type! + TExport* = enum a, b, c + diff --git a/tests/tambsym.nim b/tests/tambsym.nim index e2032e563..7708930df 100644 --- a/tests/tambsym.nim +++ b/tests/tambsym.nim @@ -4,3 +4,5 @@ import mambsym1, mambsym2 var v: TExport #ERROR_MSG ambigious identifier + +v = y diff --git a/tests/tarray.nim b/tests/tarray.nim index 5eca2cfa1..252cbd991 100644 --- a/tests/tarray.nim +++ b/tests/tarray.nim @@ -7,14 +7,14 @@ type proc sum(a: TMyarray): int = result = 0 var i = 0 - while i < length(a): + while i < len(a): inc(result, a[i]) inc(i) proc sum(a: openarray[int]): int = result = 0 var i = 0 - while i < length(a): + while i < len(a): inc(result, a[i]) inc(i) diff --git a/tests/tarrindx.nim b/tests/tarrindx.nim index caacff22b..13919cc2c 100644 --- a/tests/tarrindx.nim +++ b/tests/tarrindx.nim @@ -6,8 +6,8 @@ proc putEnv(key, val: string) = # documentation) var env: ptr array[0..500000, char] - env = alloc(length(key) + length(val) + 2) - for i in 0..length(key)-1: env[i] = key[i] - env[length(key)] = '=' - for i in 0..length(val)-1: - env[length(key)+1+i] = val[i] + env = cast[ptr array[0..500000, char]](alloc(len(key) + len(val) + 2)) + for i in 0..len(key)-1: env[i] = key[i] + env[len(key)] = '=' + for i in 0..len(val)-1: + env[len(key)+1+i] = val[i] diff --git a/tests/tassign.nim b/tests/tassign.nim index d5f846502..f51c20783 100644 --- a/tests/tassign.nim +++ b/tests/tassign.nim @@ -14,14 +14,14 @@ proc test() = a.x = 1 a.y = 2 a.s = "Hallo!" - a.seq = ["abc", "def", "ghi", "jkl"] - a.arr = [] + a.seq = @["abc", "def", "ghi", "jkl"] + a.arr = @[] setLen(a.arr, 4) - a.arr[0] = [] - a.arr[1] = [] + a.arr[0] = @[] + a.arr[1] = @[] b = a # perform a deep copy here! - b.seq = ["xyz", "huch", "was", "soll"] + b.seq = @["xyz", "huch", "was", "soll"] writeln(stdout, len(a.seq)) writeln(stdout, a.seq[3]) writeln(stdout, len(b.seq)) diff --git a/tests/tblock1.nim b/tests/tblock1.nim index 729bfd3e7..0bea7ae7f 100644 --- a/tests/tblock1.nim +++ b/tests/tblock1.nim @@ -3,9 +3,8 @@ proc main = block endLess: - break endLess write(stdout, "Muaahh!\N") - + break endLess break ha #ERROR diff --git a/tests/tconstr1.nim b/tests/tconstr1.nim index 994e55b86..488170350 100644 --- a/tests/tconstr1.nim +++ b/tests/tconstr1.nim @@ -5,23 +5,19 @@ type s: string, x, y: int, z: float, - chars: set[Char] - ] + chars: set[Char]] proc testSem = var things: array [0..1, TComplexRecord] = [ - (chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45, z: 0.0), - (chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45, z: 1.0) - ] + (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}), + (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a', 'b', 'c'})] write(stdout, things[0].x) const - things: array [0..] of TComplexRecord = [ - (chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45, z: 0.0), - (chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45) #ERROR - ] + things: array [0..1, TComplexRecord] = [ + (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}), + (s: "hi", x: 69, y: 45, z: 1.0)] #ERROR otherThings = [ # the same - (chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45, z: 0.0), - (chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45) - ] + (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}), + (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})] diff --git a/tests/tconstr2.nim b/tests/tconstr2.nim index 4c27bd833..7687a416c 100644 --- a/tests/tconstr2.nim +++ b/tests/tconstr2.nim @@ -5,16 +5,15 @@ type s: string, x, y: int, z: float, - chars: set[char], - ] + chars: set[char]] const - things: array [0.., TComplexRecord] = [ - (chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45, z: 0.0), - (chars: {'a', 'b', 'c'}, s: "hi", x: 69, z: 0.3, y: 45)] + things: array [0..1, TComplexRecord] = [ + (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}), + (s: "hi", x: 69, y: 45, z: 1.0, chars: {})] otherThings = [ # the same - (chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45, z: 0.0), - (z: 0.0, chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45)] + (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}), + (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})] write(stdout, things[0].x) #OUT 69 diff --git a/tests/tforwty2.nim b/tests/tforwty2.nim index 32f86f135..5d15e112a 100644 --- a/tests/tforwty2.nim +++ b/tests/tforwty2.nim @@ -3,28 +3,20 @@ {.push dynlib: "SDL.dll", callconv: cdecl.} -when defined(windows): - type - PSDL_semaphore = ptr TSDL_semaphore - TSDL_semaphore {.final.} = object - id: uint32 - count: UInt32 - -elif defined(linux): - type - PSDL_semaphore = ptr TSDL_semaphore - TSDL_semaphore {.final.} = object - sem: Pointer #PSem_t; - when not defined(USE_NAMED_SEMAPHORES): - sem_data: int - when defined(BROKEN_SEMGETVALUE): - # This is a little hack for MacOS X - - # It's not thread-safe, but it's better than nothing - sem_value: cint +type + PSDL_semaphore = ptr TSDL_semaphore + TSDL_semaphore {.final.} = object + sem: Pointer #PSem_t; + when not defined(USE_NAMED_SEMAPHORES): + sem_data: int + when defined(BROKEN_SEMGETVALUE): + # This is a little hack for MacOS X - + # It's not thread-safe, but it's better than nothing + sem_value: cint type PSDL_Sem = ptr TSDL_Sem TSDL_Sem = TSDL_Semaphore -proc SDL_CreateSemaphore(initial_value: UInt32): PSDL_Sem - {.import: "SDL_CreateSemaphore".} +proc SDL_CreateSemaphore(initial_value: Int32): PSDL_Sem {. + importc: "SDL_CreateSemaphore".} diff --git a/tests/thallo.nim b/tests/thallo.nim index b804dba1e..47d56724b 100644 --- a/tests/thallo.nim +++ b/tests/thallo.nim @@ -42,7 +42,7 @@ var `name` = readLine(stdin) echo("Hi " & thallo.name & "!\n") debug(name) -var testseq: seq[string] = [ "a", "b", "c", "d"] +var testseq: seq[string] = @[ "a", "b", "c", "d", "e"] echo(repr(testseq)) var dummy = "hallo" diff --git a/tests/tillrec.nim b/tests/tillrec.nim index eba04a96a..21ce19889 100644 --- a/tests/tillrec.nim +++ b/tests/tillrec.nim @@ -5,8 +5,6 @@ type x: int kids: seq[TLegal] - TIllegal {.final.} = object + TIllegal {.final.} = object #ERROR_MSG illegal recursion in type 'TIllegal' y: Int x: array[0..3, TIllegal] - #ERROR_MSG illegal recursion in type 'TIllegal' - diff --git a/tests/tinvwhen.nim b/tests/tinvwhen.nim index aa528a22e..8dc8cbf50 100644 --- a/tests/tinvwhen.nim +++ b/tests/tinvwhen.nim @@ -1,8 +1,8 @@ # This was parsed even though it should not! -proc chdir(path: CString): cint {.import: "chdir", header: "dirHeader".} +proc chdir(path: CString): cint {.importc: "chdir", header: "dirHeader".} proc getcwd(buf: CString, buflen: cint): CString - when defined(unix): {.import: "getcwd", header: "<unistd.h>".} #ERROR - elif defined(windows): {.import: "getcwd", header: "<direct.h>"} + when defined(unix): {.importc: "getcwd", header: "<unistd.h>".} #ERROR_MSG invalid indentation + elif defined(windows): {.importc: "getcwd", header: "<direct.h>"} else: {.error: "os library not ported to your OS. Please help!".} diff --git a/tests/titer.nim b/tests/titer.nim index 536e2f60d..3f71ba8d9 100644 --- a/tests/titer.nim +++ b/tests/titer.nim @@ -1,15 +1,13 @@ # Test the new iterators -iterator xrange(fromm, to: int, step = 1): (a: int) = - a = fromm +iterator xrange(fromm, to: int, step = 1): int = + var a = fromm while a <= to: yield a inc(a, step) -iterator interval[T](a, b: T): (x: T) - -iterator interval[T](a, b: T): (x: T) = - x = a +iterator interval[T](a, b: T): T = + var x = a while x <= b: yield x inc(x) diff --git a/tests/tlastmod.nim b/tests/tlastmod.nim index b84147c62..75b047fc8 100644 --- a/tests/tlastmod.nim +++ b/tests/tlastmod.nim @@ -1,16 +1,18 @@ # test the new LastModificationTime() proc import - os, times + os, times, strutils proc main() = var a, b: TTime a = getLastModificationTime(ParamStr(1)) b = getLastModificationTime(ParamStr(2)) + writeln(stdout, $a) + writeln(stdout, $b) if a < b: - Write(stdout, "b is newer than a\n") + Write(stdout, "$2 is newer than $1\n" % [ParamStr(1), ParamStr(2)]) else: - Write(stdout, "a is newer than b\n") + Write(stdout, "$1 is newer than $2\n" % [ParamStr(1), ParamStr(2)]) main() diff --git a/tests/tmath.nim b/tests/tmath.nim index 5a10cafb3..6a1dae54d 100644 --- a/tests/tmath.nim +++ b/tests/tmath.nim @@ -1,6 +1,6 @@ # tests for the interpreter -proc loops(a: out int) = +proc loops(a: var int) = nil #var # b: int @@ -81,9 +81,5 @@ proc main() = of "Rumpf": write(stdout, "Du bist in der Familie meines Meisters!\n") else: write(stdout, "ich kenne dich nicht!\n") write(stdout, "Du heisst " & s & "\n") -# [[ -proc main2() = - main() main() -#]] diff --git a/tests/tnoop.nim b/tests/tnoop.nim index 3a19579ab..6fe53da1c 100644 --- a/tests/tnoop.nim +++ b/tests/tnoop.nim @@ -3,4 +3,4 @@ var a: int -a() #ERROR +a() #ERROR_MSG expression cannot be called diff --git a/tests/tobject2.nim b/tests/tobject2.nim index e8e932422..8f69a6bac 100644 --- a/tests/tobject2.nim +++ b/tests/tobject2.nim @@ -7,7 +7,7 @@ type TPoint3d = object of TPoint2d z: int # added a field -proc getPoint(var p: TPoint2d) = +proc getPoint( p: var TPoint2d) = {.breakpoint.} writeln(stdout, p.x) diff --git a/tests/tobjects.nim b/tests/tobjects.nim index 633c9d6af..8305e2838 100644 --- a/tests/tobjects.nim +++ b/tests/tobjects.nim @@ -2,13 +2,14 @@ type TBase = object x, y: int + TSubclassKind = enum ka, kb, kc, kd, ke, kf TSubclass = object of TBase - c: int - case c - of 0, 1, 2, 3: + case c: TSubclassKind + of ka, kb, kc, kd: a, b: int - of 4: + of ke: d, e, f: char + else: nil n: bool var @@ -21,25 +22,21 @@ var case i of 500..999: write(stdout, "ha!\n") -of 1000..3000, 12: write(stdout, "ganz schön groß\n") +of 1000..3000, 12: write(stdout, "ganz schön groß\n") of 1, 2, 3: write(stdout, "1 2 oder 3\n") else: write(stdout, "sollte nicht passieren\n") -case r -of 0.0, 0.125..0.4444: write(stdout, "kleiner als 0.5\n") -else: write(stdout, "weiß nicht\n") - case readLine(stdin) of "Rumpf": write(stdout, "Hallo Meister!\n") of "Andreas": write(stdout, "Hallo Meister!\n") else: write(stdout, "Nicht mein Meister!\n") global = global + 1 -write(stdout, "Hallo wie heißt du? \n") +write(stdout, "Hallo wie heißt du? \n") s = readLine(stdin) i = 0 -while i < length(s): +while i < len(s): if s[i] == 'c': write(stdout, "'c' in deinem Namen gefunden\n") i = i + 1 -write(stdout, "Du heißt " & s) +write(stdout, "Du heißt " & s) diff --git a/tests/toptions.nim b/tests/toptions.nim index 2d15dd348..95bb5cfbc 100644 --- a/tests/toptions.nim +++ b/tests/toptions.nim @@ -2,13 +2,6 @@ # Used command line arguments: # -m -q -o bootstrap\options.mor options.pas # -# -# The Morpork Compiler -# (c) Copyright 2004 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# type # please make sure we have under 32 options (improves code efficiency!) @@ -26,4 +19,4 @@ var gOptions: TOptionset = {optRefcGC, optRangeCheck, optBoundsCheck, optOverflowCheck, optAssert, optWarns, optHints, optLineDir, optStackTrace} compilerArgs: int - gExitcode: uint8 + gExitcode: int8 diff --git a/tests/toverl.nim b/tests/toverl.nim index 1a571ce12..94f251cac 100644 --- a/tests/toverl.nim +++ b/tests/toverl.nim @@ -1,7 +1,6 @@ # Test for overloading type - TNone {.export: "_NONE", final.} = object + TNone {.exportc: "_NONE", final.} = object -proc - TNone(a, b: int) = nil #ERROR_MSG attempt to redefine 'TNone' +proc TNone(a, b: int) = nil #ERROR_MSG attempt to redefine 'TNone' diff --git a/tests/toverlop.nim b/tests/toverlop.nim index 037da24ee..f11275644 100644 --- a/tests/toverlop.nim +++ b/tests/toverlop.nim @@ -1,6 +1,6 @@ # Test operator overloading -proc % (a, b: int): int = +proc `%` (a, b: int): int = return a mod b var x, y: int diff --git a/tests/toverwr.nim b/tests/toverwr.nim index c3652d168..f2b42df15 100644 --- a/tests/toverwr.nim +++ b/tests/toverwr.nim @@ -1,6 +1,6 @@ # Test the overloading resolution in connection with a qualifier -proc write(t: tTextFile, s: string) = +proc write(t: TFile, s: string) = nil # a nop system.write(stdout, "hallo") diff --git a/tests/tparscfg.nim b/tests/tparscfg.nim index 33347285c..618ecadd6 100644 --- a/tests/tparscfg.nim +++ b/tests/tparscfg.nim @@ -1,11 +1,11 @@ import - os, parsecfg, strutils + os, parsecfg, strutils, streams -var - p: TCfgParser - -if open(p, paramStr(1)): +var f = newFileStream(paramStr(1), fmRead) +if f != nil: + var p: TCfgParser + open(p, f, paramStr(1)) while true: var e = next(p) case e.kind diff --git a/tests/tprintf.nim b/tests/tprintf.nim index 65427d463..14687a937 100644 --- a/tests/tprintf.nim +++ b/tests/tprintf.nim @@ -1,6 +1,6 @@ # Test a printf proc -proc printf(file: TTextFile, args: openarray[string]) = +proc printf(file: TFile, args: openarray[string]) = var i = 0 while i < args.len: write(file, args[i]) diff --git a/tests/tradix.nim b/tests/tradix.nim index 208f9ae9d..e7ca210e4 100644 --- a/tests/tradix.nim +++ b/tests/tradix.nim @@ -31,7 +31,7 @@ proc searchInner(r: PRadixNode, a: int): PRadixNode = case r.kind of rnLinear: var x = cast[ptr TRadixNodeLinear](r) - for i in 0..x.len-1: + for i in 0..ze(x.len)-1: if ze(x.keys[i]) == a: return x.vals[i] of rnFull: var x = cast[ptr TRadixNodeFull](r) @@ -59,7 +59,7 @@ proc searchLeaf(r: PRadixNode, a: int): bool = return testBit(x.b[a /% BitsPerUnit], a) of rnLeafLinear: var x = cast[ptr TRadixNodeLeafLinear](r) - for i in 0..x.len-1: + for i in 0..ze(x.len)-1: if ze(x.keys[i]) == a: return true else: assert(false) @@ -103,7 +103,7 @@ proc addLeaf(r: var PRadixNode, a: int): bool = # a linear node: var x = cast[ptr TRadixNodeLinear](alloc(sizeof(TRadixNodeLinear))) x.kind = rnLeafLinear - x.len = 1 + x.len = 1'i8 x.keys[0] = toU8(a) r = x return false # not already in set @@ -123,7 +123,7 @@ proc addLeaf(r: var PRadixNode, a: int): bool = # transform into a full node: var y = cast[ptr TRadixNodeLeafBits](alloc0(sizeof(TRadixNodeLeafBits))) y.kind = rnLeafBits - for i in 0..x.len-1: + for i in 0..ze(x.len)-1: var u = ze(x.keys[i]) setBit(y.b[u /% BitsPerUnit], u) setBit(y.b[a /% BitsPerUnit], a) @@ -139,7 +139,7 @@ proc addInner(r: var PRadixNode, a: int, d: int): bool = # a linear node: var x = cast[ptr TRadixNodeLinear](alloc(sizeof(TRadixNodeLinear))) x.kind = rnLinear - x.len = 1 + x.len = 1'i8 x.keys[0] = toU8(k) r = x return addInner(x.vals[0], a, d-8) diff --git a/tests/treadln.nim b/tests/treadln.nim index 473eb1eaa..7703d5a56 100644 --- a/tests/treadln.nim +++ b/tests/treadln.nim @@ -2,7 +2,7 @@ # Macintosh, Unix or Windows text format. var - inp: tTextFile + inp: TFile line: string if openFile(inp, "readme.txt"): diff --git a/tests/tregex.nim b/tests/tregex.nim index 48798aa4f..aa32ca847 100644 --- a/tests/tregex.nim +++ b/tests/tregex.nim @@ -4,7 +4,7 @@ import regexprs -if "Username" =~ "[A-Za-z]+": +if "Username".match("[A-Za-z]+"): echo("Yes!") else: echo("Bug!") diff --git a/tests/trepr.nim b/tests/trepr.nim index ec3731332..4a56842f6 100644 --- a/tests/trepr.nim +++ b/tests/trepr.nim @@ -1,12 +1,13 @@ # test the new "repr" built-in proc type + TEnum = enum + en1, en2, en3, en4, en5, en6 + TPoint {.final.} = object x, y, z: int s: array [0..1, string] - - TEnum = enum - en1, en2, en3, en4, en5, en6 + e: TEnum var p: TPoint @@ -18,14 +19,14 @@ p.y = 13 p.z = 45 p.s[0] = "abc" p.s[1] = "xyz" +p.e = en6 new(q) q^ = p -s = [q, q, q, q] +s = @[q, q, q, q] writeln(stdout, repr(p)) writeln(stdout, repr(q)) writeln(stdout, repr(s)) -writeln(stdout, repr(nil)) writeln(stdout, repr(en4)) diff --git a/tests/tseqcon.nim b/tests/tseqcon.nim index f5d0346ae..935da86b5 100644 --- a/tests/tseqcon.nim +++ b/tests/tseqcon.nim @@ -1,4 +1,7 @@ -# Test the &= operator for sequences and strings +# Test the add proc for sequences and strings + +const + nestedFixed = true type TRec {.final.} = object @@ -8,36 +11,35 @@ type TRecSeq = seq[TRec] proc test() = - var seq, b: seq[string] - seq = [] - add(seq, "Hi") - add(seq, "there, ") - add(seq, "what's your name?") + var s, b: seq[string] + s = @[] + add(s, "Hi") + add(s, "there, ") + add(s, "what's your name?") - b = seq # deep copying here! + b = s # deep copying here! b[0][1] = 'a' - for i in 0 .. length(seq)-1: - write(stdout, seq[i]) - for i in 0 .. length(b)-1: + for i in 0 .. len(s)-1: + write(stdout, s[i]) + for i in 0 .. len(b)-1: write(stdout, b[i]) -when defined(nestedFixed): +when nestedFixed: proc nested() = var - seq: seq[seq[string]] + s: seq[seq[string]] for i in 0..10_000: # test if the garbage collector # now works with sequences - seq = [ - ["A", "B", "C", "D"], - ["E", "F", "G", "H"], - ["I", "J", "K", "L"], - ["M", "N", "O", "P"] - ] + s = @[ + @["A", "B", "C", "D"], + @["E", "F", "G", "H"], + @["I", "J", "K", "L"], + @["M", "N", "O", "P"]] test() -when defined(nestedFixed): +when nestedFixed: nested() #OUT Hithere, what's your name?Hathere, what's your name? diff --git a/tests/tstatret.nim b/tests/tstatret.nim index e5403d98b..ac93ac532 100644 --- a/tests/tstatret.nim +++ b/tests/tstatret.nim @@ -1,5 +1,5 @@ # no statement after return proc main() = return - nil #ERROR + echo("huch?") #ERROR_MSG statement not allowed after diff --git a/tests/tstmtexp.nim b/tests/tstmtexp.nim index f50cce01b..f4d83e83f 100644 --- a/tests/tstmtexp.nim +++ b/tests/tstmtexp.nim @@ -1,3 +1,3 @@ # Test 3 -true #ERROR_MSG statement has no effect +1+4 #ERROR_MSG value returned by statement has to be discarded diff --git a/tests/tstrdesc.nim b/tests/tstrdesc.nim index d25579ee2..1c2e85b4b 100644 --- a/tests/tstrdesc.nim +++ b/tests/tstrdesc.nim @@ -9,6 +9,6 @@ type data: array [0..0, char] # for the '\0' character var - emptyString {.export: "emptyString".}: TStringDesc + emptyString {.exportc: "emptyString".}: TStringDesc diff --git a/tests/tstrdist.nim b/tests/tstrdist.nim index 482e363ef..3e1939e73 100644 --- a/tests/tstrdist.nim +++ b/tests/tstrdist.nim @@ -1,26 +1,26 @@ -# compute the edit distance between two strings - -proc editDistance(a, b: string): int = - var c: seq[int] = [] - var - n = a.len - m = b.len - setLength(c, (n+1)*(m+1)) - for i in 0..n: - c[i*n] = i # [i,0] - for j in 0..m: - c[j] = j # [0,j] - - for i in 1..n: - for j in 1..m: - var x = c[(i-1)*n + j]+1 - var y = c[i*n + j-1]+1 - var z: int - if a[i-1] == b[j-1]: - z = c[(i-1)*n + j-1] - else: - z = c[(i-1)*n + j-1]+1 - c[(i-1)*n + (j-1)] = min(x,min(y,z)) - return c[n*m] - -write(stdout, editDistance("abc", "abd")) +# compute the edit distance between two strings + +proc editDistance(a, b: string): int = + var + c: seq[int] + n = a.len + m = b.len + newSeq(c, (n+1)*(m+1)) + for i in 0..n: + c[i*n] = i # [i,0] + for j in 0..m: + c[j] = j # [0,j] + + for i in 1..n: + for j in 1..m: + var x = c[(i-1)*n + j]+1 + var y = c[i*n + j-1]+1 + var z: int + if a[i-1] == b[j-1]: + z = c[(i-1)*n + j-1] + else: + z = c[(i-1)*n + j-1]+1 + c[(i-1)*n + (j-1)] = min(x,min(y,z)) + return c[n*m] + +write(stdout, editDistance("abc", "abd")) diff --git a/tests/tstrset.nim b/tests/tstrset.nim index 76900bf63..e19ccee4d 100644 --- a/tests/tstrset.nim +++ b/tests/tstrset.nim @@ -2,7 +2,7 @@ type TRadixNodeKind = enum rnLinear, rnFull, rnLeaf - PRadixNode = ptr TRadixNode + PRadixNode = ref TRadixNode TRadixNode = object kind: TRadixNodeKind TRadixNodeLinear = object of TRadixNode @@ -24,7 +24,7 @@ proc search(r: PRadixNode, s: string): PRadixNode = case r.kind of rnLinear: var x = PRadixNodeLinear(r) - for j in 0..x.len-1: + for j in 0..ze(x.len)-1: if x.keys[j] == s[i]: if s[i] == '\0': return r r = x.vals[j] @@ -56,21 +56,19 @@ proc testOrincl*(r: var PRadixNode, s: string): bool = proc incl*(r: var PRadixNode, s: string) = discard testOrIncl(r, s) proc excl*(r: var PRadixNode, s: string) = - x = search(r, s) + var x = search(r, s) if x == nil: return case x.kind of rnLeaf: PRadixNodeLeaf(x).s = "" of rnFull: PRadixNodeFull(x).b['\0'] = nil of rnLinear: var x = PRadixNodeLinear(x) - for i in 0..x.len-1: + for i in 0..ze(x.len)-1: if x.keys[i] == '\0': - swap(x.keys[i], x.keys[x.len-1]) + swap(x.keys[i], x.keys[ze(x.len)-1]) dec(x.len) break var root: PRadixNode - - diff --git a/tests/tstrutil.nim b/tests/tstrutil.nim index 985656f2f..0468dfa0c 100644 --- a/tests/tstrutil.nim +++ b/tests/tstrutil.nim @@ -11,6 +11,14 @@ proc main() = for p in split("/home/a1:xyz:/usr/bin", {':'}): write(stdout, p) - + +assert(editDistance("prefix__hallo_suffix", "prefix__hallo_suffix") == 0) +assert(editDistance("prefix__hallo_suffix", "prefix__hallo_suffi1") == 1) +assert(editDistance("prefix__hallo_suffix", "prefix__HALLO_suffix") == 5) +assert(editDistance("prefix__hallo_suffix", "prefix__ha_suffix") == 3) +assert(editDistance("prefix__hallo_suffix", "prefix") == 14) +assert(editDistance("prefix__hallo_suffix", "suffix") == 14) +assert(editDistance("prefix__hallo_suffix", "prefix__hao_suffix") == 2) + main() #OUT ha/home/a1xyz/usr/bin diff --git a/tests/ttime.nim b/tests/ttime.nim index 783032bc9..bad818816 100644 --- a/tests/ttime.nim +++ b/tests/ttime.nim @@ -3,4 +3,4 @@ import times -write(stdout, TimeToString(getTime()) ) +write(stdout, $getTime()) diff --git a/tests/tvardecl.nim b/tests/tvardecl.nim index 48473ff9d..496601e3a 100644 --- a/tests/tvardecl.nim +++ b/tests/tvardecl.nim @@ -3,4 +3,7 @@ var x = 0 s = "Hallo" - a, b: int = 0 #ERROR + a, b: int = 4 + +write(stdout, a) +write(stdout, b) #OUT 44 diff --git a/tests/tvarnums.nim b/tests/tvarnums.nim index f57eeef41..5079e0e16 100644 --- a/tests/tvarnums.nim +++ b/tests/tvarnums.nim @@ -6,7 +6,7 @@ import type TBuffer = array [0..10, int8] -proc toVarNum(x: int32, b: out TBuffer) = +proc toVarNum(x: int32, b: var TBuffer) = # encoding: first bit indicates end of number (0 if at end) # second bit of the first byte denotes the sign (1 --> negative) var a = x @@ -18,15 +18,15 @@ proc toVarNum(x: int32, b: out TBuffer) = # anyway a = abs(x) # first 6 bits: - b[0] = toU8(ord(a >% 63) shl 7 or (ord(x < 0) shl 6) or (a and 63)) - a = a shr 6 # skip first 6 bits + b[0] = toU8(ord(a >% 63'i32) shl 7 or (ord(x < 0'i32) shl 6) or (int(a) and 63)) + a = a shr 6'i32 # skip first 6 bits var i = 1 - while a != 0: - b[i] = toU8(ord(a >% 127) shl 7 or (a and 127)) + while a != 0'i32: + b[i] = toU8(ord(a >% 127'i32) shl 7 or (int(a) and 127)) inc(i) - a = a shr 7 + a = a shr 7'i32 -proc toVarNum64(x: int64, b: out TBuffer) = +proc toVarNum64(x: int64, b: var TBuffer) = # encoding: first bit indicates end of number (0 if at end) # second bit of the first byte denotes the sign (1 --> negative) var a = x @@ -38,20 +38,20 @@ proc toVarNum64(x: int64, b: out TBuffer) = # anyway a = abs(x) # first 6 bits: - b[0] = toU8(ord(a >% 63) shl 7 or (ord(x < 0) shl 6) or int(a and 63)) + b[0] = toU8(ord(a >% 63'i64) shl 7 or (ord(x < 0'i64) shl 6) or int(a and 63)) a = a shr 6 # skip first 6 bits var i = 1 - while a != 0: - b[i] = toU8(ord(a >% 127) shl 7 or int(a and 127)) + while a != 0'i64: + b[i] = toU8(ord(a >% 127'i64) shl 7 or int(a and 127)) inc(i) a = a shr 7 proc toNum64(b: TBuffer): int64 = # treat first byte different: - result = ze(b[0]) and 63 + result = ze64(b[0]) and 63 var i = 0 - Shift: int64 = 6 + Shift = 6'i64 while (ze(b[i]) and 128) != 0: inc(i) result = result or ((ze64(b[i]) and 127) shl Shift) @@ -69,17 +69,17 @@ proc toNum(b: TBuffer): int32 = Shift = 6 while (ze(b[i]) and 128) != 0: inc(i) - result = result or ((ze(b[i]) and 127) shl Shift) + result = result or int32((ze(b[i]) and 127) shl Shift) inc(Shift, 7) if (ze(b[0]) and (1 shl 6)) != 0: # sign bit set? - result = not result +% 1 + result = not int(result) +% 1 # this is the same as ``- result`` # but gives no overflow error for low(int) proc toBinary(x: int64): string = result = newString(64) for i in 0..63: - result[63-i] = chr((int32(x shr i) and 1) + ord('0')) + result[63-i] = chr((int(x shr i) and 1) + ord('0')) proc t64(i: int64) = var @@ -133,4 +133,4 @@ tm(100_000) tm(low(int32)) tm(high(int32)) -writeln(stdout, "Success!") +writeln(stdout, "Success!") #OUT Success! diff --git a/tests/typredef.nim b/tests/typredef.nim index 2dd5e0446..a77d91f40 100644 --- a/tests/typredef.nim +++ b/tests/typredef.nim @@ -1,2 +1,3 @@ type - Uint8 = Uint8 + Uint8 = Uint8 #ERROR_MSG illegal recursion in type 'Uint8' + diff --git a/todo.txt b/todo.txt index dd7228356..149f9bc30 100644 --- a/todo.txt +++ b/todo.txt @@ -5,53 +5,63 @@ RST --- - footnotes; prefix :i: whitespace before :i:, _reference, `reference`__ __ anonymous: www.nimrod.org -- don't generate <p></p> if it is not allowed by the HTML standard; switch to - <br /> for those parts; this is pretty easy to fix Bugs ---- -- BUG: bootstrapping does not work with LCC, PCC -- BUG: aliasing of object types does not work properly (easy?) -- BUG: lookup rules for overloadable symbols are wrong +- BUG: sigmatch for ``len`` matches the open array too often... *sigh* +- BUG: + for j in 0 .. a.len + b.len - 1: nil + where a and b are open arrays does not compile + +- BUG: ["sh", "-c", someProcWithOpenArray(openArr)] produces wrong C code +- BUG: bootstrapping does not work with Borland C - BUG: addr/deref does not work when interpreting - BUG: Check that pure procs only consist of asm statements (and comments) -- ``repr`` for ECMAScript target; other known bugs for the ECMAScript target +- BUG: tlastmod returns wrong results on BSD (Linux, MacOS X: works) +- BUG: the parser allows empty statements/object case branches +- BUG: when optmizing cgen.c with Visual C++, GCC, LLVM (O3), it breaks. +- BUG: ``-cc:bcc`` command line option does not error +- BUG: symbol files still do not work High priority ------------- + +- documentation: var types, ``[]`` overloading, ``cast`` and type convertions, + ``if`` expresssions, (anonymous) procs - implement two-phase lookup for generics (this is hard...): This is useful - for macros too! -- replace ``seq = []; setLen(seq, x)`` by - built-in ``newSeq[T](s: var seq[T], len: int)`` - or ``repeat[T](len: int, initVal: T): seq[T]`` -- ``is`` operator is missing -- implement closures for the C code generator; ECMAScript already has it + for macros too! Alternative: Explicit early name binding. Both is hard to + implement +- implement closures for the C code generator +- get rid of ``nkHiddenStdConv`` in several places: this mechanism caused more + bugs than it ever solved! + + +Library +------- +- xml, html, url, cgi, fastcgi: implement from scratch +- unicode library +- socket library (does SDL for us?) +- osproc for Windows +- bignums +- python Low priority ------------ +- use `` notation for identifier concatenation? +- Visual C++: emit ``default: __assume(0);`` for optimization - ``nkTempAsgn``-node as optimization -- better code generation for const data -- make set optimizations part of the transformation (--> all backends profit - from it) - macros: ``typecheck`` pragma; this is really a good idea! This allows transformations based on types! - make callconv a set -- pasparse.nim: fixVarSection() loses its comment! - partial generic instantation is missing - commas are not optional any longer as this may lead to bugs (which?) - get code generation for C++ exception handling right! -- implement the simple and cheap to implement module cache (default: disabled!) - find a way for easy constructors and destructors; though constructors are flawed... destructors are not, however! - multiple dispatch -- LIB: stream implementation - the compiler should use it too! -- stress testing of ECMAScript code generator -- rewrite sigmatch or fix it; generics and macros are somehow dumb. Who needs - generics if the power of macros lie at our feet? -- replace appropriate asserts by internal errors! Changelog @@ -188,41 +198,146 @@ Changelog appropriately - parseopt, hashes, strtabs and parsecfg in the Standard library - introduced splitting for long entries in TOC +- implemented profiling support +- removed cfilecache switch (-f does the same) +- implemented acyclic pragma (even for the Pascal parser) +- implemented thread local variables +- improved cycle detection in types module +- huge optimization of GC +- added ``c`` and ``cc`` short commands +- zlib binding added +- SDL binding added +- Xlib binding added +- OpenGL binding added +- ODBC binding added +- Lua binding added +- BUGFIX: ``len`` for cstring now works as expected +- changed type names in the Cairo binding +- implemented ``noinline`` calling convention +- BUGFIX in sigmatch concerning compability of proc types +- BUGFIX: some C compiler optimzed the ``setjmp`` call in the GC away + with horrible consequences! +- BUGFIX: $vars work in the C compiler path again +- ``compileTime`` pragma +- ``nkStmtListType`` node for macros +- removed ``nostatic`` pragma +- separate compilation! +- BUGFIX: aliasing of object types now works properly +- BUGFIX: ccgtypes: generation for var-types was not correct +- BUGFIX: debugger now works again +- nil for variant objects +- BUGFIX: posix module was broken for Mac OS X, because it lacks realtime + support +- BUGFIX: docgen now replaces ``"`` by ``"e;`` +- BUGFIX: ccgexprs: passToOpenArray +- BUGFIX: regexprs module compiles again +- BUGFIX: Bug in ``isAssignable`` need to check dest type, not source type +- BUGFIX: ccgtypes: isInvalidReturnType +- streams module +- BUGFIX: rawReadLine should not return nil for EOF +- BUGFIX: ``lookup`` did not check for ambigious identifiers +- BUGFIX: ``isMainModule`` is not ambigious any longer +- overloading resolution now takes place in a few more cases; see + tests/tambsym2 for an example +- implemented ``is`` operator +- improved error messages if an OS request failes +- BUGFIX: ``extractFilename``, ``extractDir`` +- implemented ``newSeq``, compiler already uses it +- changed integer conversion handling; breaks code compability again! (For the + last time, I promise) +- now all magics are kept in the system module +- ported to FreeBSD +- the ``koch.py`` script now should be more portable to 1.5.2 Python +- BUGFIX: lookup: `opr` now supported +- changed the installation scheme +- improved the ID mechanism; too difficult to explain here +- BUGFIX: ``--cc`` now resets compile and link options +- Finally found the bug that keeps Visual C++ from compiling a working + executable with its optimizer: index checks for strings and sequences + need to be turned on, otherwise it breaks. This has probably to do + with C aliasing rules. +- BUGFIX: aliasing rules for strings and sequence should now be respected; + they both inherit from ``TGenericSeq`` now. This still does not fix + the serious Visual C bug. +- BUGFIX: inheritance from final objects is forbidden, not the other way + round +- ccgexprs: special cases for string ``==`` +- ccgstmts: ``while true`` generates less C code +- C code generator: Merged constant data, otherwise too much code is + generated +- C code generator: fixed a long-standing bug in ``genObjectInit``. +- extccomp: C optimization can be disabled for certain files. +- BUGFIX: cgen: result sometimes not initialized (?) +- ``define`` and ``undef`` pragmas are now deprecated +- ``isMainModule`` now in system module and works via compiler magic +- implemented simple and powerful template engine; built into the Nimrod + compiler +- BUGFIX: tuple constructor did not always work +- BUGFIX: wrong C code generated for ``openarray[array[]]`` +- now much more efficient C code is generated for constant expressions +- BUGFIX: sometimes the C generator generated conflicting names +- optimization of string concatenations +- BUGFIX: docgen: last enum field may lose its comment +- the compiler now uses streams internally +- changed the style of the generated documentation +- BUGFIX: rodgen: stacks would not be properly processed +- cggexprs: string literals for field checks are reused +- ccgtypes: typeNameOrLiteral takes care of magics +- ccgtypes: support for incremental compilation +- The C code generator now uses the ast.gid for ID generation. This is needed + for proper incremental compilation. +- ccgtypes: new change for incremental compilation +- polished templ system +- BUGFIX: walkFiles does not error if no matching files found +- BUGFIX: ``os.copyFile`` +- reworked integer conversions +- added ``GC_ref`` and ``GC_unref`` procs +- implemented `zipfiles` module +- BUGFIX: ``$`` now generates efficient code +- BUGFIX: C's ``sizeof`` returns an unsigned, the generated code now casts +- BUGFIX: trectype never worked, now at the least the compiler does not crash +- BUGFIX: times module returned a newline for the `$` operator +- sequences now need to be constructed with ``@[]`` +- changed the ``rod_gen`` to the ``nimcache`` mechanism, so the compiler does + not need to have write access to its directory +- BUGFIX: createDir now works for sub directories +- changed configuration file handling, so that UNIX-like installations are + possible +- BUGFIX: ``ParseFloat`` now supports ``inf`` and ``nan`` +- the type information code is now smaller (helps GCC's compile times!) +- BUGFIX: constant evaluation for mRepr is not possible +- refactored the semantic phase into separate modules +- BUGFIX: wrong indexing in ``genSetConstr`` +- used a node flag to avoid multiple transformation passes over the same tree: + this flag is cleared when copying nodes +- special case for ``sameType`` +- changed order for optimization of ``semMagic`` +- optimized ``semexprs.genCall`` +- implemented a new passes manager which saves a lot of memory +- OPT: GC now MUCH faster, still room for improvement though +- OPT: ``system.objectInit`` is now only called iff strictly necessary +- OPT: the write barrier can now be inlined by GCC +- OPT: Nimrod version of ``addSon`` optimized +- parsecfg, lexbase now use streams +- the config file now supports ``ccname.exe`` and ``ccname.linkerExe`` + configuration for changing the GGC version +- BUGFIX: typo for ``succ`` code generation without checks +- fixed many bugs in ``os`` module for Windows +- bug in ``semVar`` removed standard convertions +- BUGFIX: ``setLen`` for sequences may lead to memory leaks For the next versions ===================== -- separate compilation! - multi-processor support - tuple assignment -- more Parser/Renderer combinations - IDE -- better support for GDB -- support for Boehm's GC -- support for dynamic libraries - - -Documentation to be written -=========================== -- document generics -- document (anonymous) procs - - -Implementation details -====================== - -- {a} can lead to an memory overwrite if a is not in range of - set basetype? - -Optimizations -============= - -- optimization of GC: types that cannot be involved in cycles should - not be stored in the AT; this does not work because the AT is needed - for stack checking! -- better: generational GC for cycles -- optimize range checks away (and out of bounds checks!) +- better support for GDB? +- support for generation of dynamic libraries +- better code generator: skip ropes datastructure, it uses too much memory +- make set optimizations part of the transformation (--> all backends profit + from it), but this really needs a more abstract code generator Further ideas/nice to have @@ -232,30 +347,7 @@ Further ideas/nice to have - CLR code generator; better use XYZ? --> Version 1.2? - provide an interactive shell: if the user wants his commands to be executed, the command should end with # -- multi-threaded programming -- support for Boehm's GC - add the built-in 'finalize' - implement packed arrays (bit arrays)/ packed records - implement tables (implement as library? - no! Builtin because of constructor syntax is nice to have) -- each compilation unit (proc, top-level-statement, etc.) - needs the options stored with them (for procs already done) - - -Planned libraries -================= - -- generic algorithm library (trees, tables, etc.) -- An Unicode library (UTF8) -- Binding for Opengl library (should be easy) -- Binding for Sockets library (which one?) -- XML parser; cgi module; fast cgi module -- a good/extensive math library -- neuronal network library; genetic algorithms -- HTML parser -- URL library -- mySQL, sqlite interface -- extensive platform independant AdvancedOS library -- code generator for SQL-Schemes? ("Hibernate" done right) -- mathematical expression parser (with lookup table for identifiers) -- YAML parser (use generic AST for this) diff --git a/whiteutils.py b/whiteutils.py index 38469858b..e203e7e08 100644 --- a/whiteutils.py +++ b/whiteutils.py @@ -1,26 +1,28 @@ """ Indentation utilities for Cog. http://nedbatchelder.com/code/cog - + Copyright 2004-2005, Ned Batchelder. """ # $Id: whiteutils.py 110 2005-08-27 22:35:20Z ned $ +# modified to run with Python1.5.2 by Andreas Rumpf import re, types +from string import strip, split, replace, join def whitePrefix(strings): """ Determine the whitespace prefix common to all non-blank lines in the argument list. """ # Remove all blank lines from the list - strings = filter(lambda s: s.strip() != '', strings) - + strings = filter(lambda s: strip(s) != '', strings) + if not strings: return '' # Find initial whitespace chunk in the first line. # This is the best prefix we can hope for. prefix = re.match(r'\s*', strings[0]).group(0) - + # Loop over the other strings, keeping only as much of # the prefix as matches each string. for s in strings: @@ -35,17 +37,17 @@ def reindentBlock(lines, newIndent=''): Remove any common whitespace indentation. Re-indent using newIndent, and return it as a single string. """ - if isinstance(lines, types.StringTypes): - lines = lines.split('\n') + if type(lines) == type(""): + lines = split(lines, '\n') oldIndent = whitePrefix(lines) outLines = [] for l in lines: if oldIndent: - l = l.replace(oldIndent, '', 1) + l = replace(l, oldIndent, '', 1) if l and newIndent: l = newIndent + l outLines.append(l) - return '\n'.join(outLines) + return join(outLines, '\n') def commonPrefix(strings): """ Find the longest string that is a prefix of all the strings. |