diff --git a/lib/linguist/language.rb b/lib/linguist/language.rb index 4b251834..6066b204 100644 --- a/lib/linguist/language.rb +++ b/lib/linguist/language.rb @@ -532,6 +532,7 @@ module Linguist if extnames = extensions[name] extnames.each do |extname| if !options['extensions'].include?(extname) + warn "#{name} has a sample with extension (#{extname}) that isn't explicitly defined in languages.yml" unless extname == '.script!' options['extensions'] << extname end end diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 5996fc8c..ff9e76f7 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -260,6 +260,7 @@ C: extensions: - .c - .cats + - .h - .w C#: @@ -288,6 +289,7 @@ C++: - .cc - .cxx - .H + - .h - .h++ - .hh - .hpp @@ -321,7 +323,7 @@ CLIPS: CMake: extensions: - .cmake - - .cmake.in + - .in filenames: - CMakeLists.txt @@ -346,6 +348,14 @@ Ceylon: extensions: - .ceylon +Chapel: + type: programming + color: "#8dc63f" + aliases: + - chpl + extensions: + - .chpl + ChucK: lexer: Java extensions: @@ -380,7 +390,7 @@ Clojure: - .cljscm - .cljx - .hic - - .cljs.hl + - .hl filenames: - riemann.config @@ -444,6 +454,7 @@ Coq: type: programming extensions: - .coq + - .v Cpp-ObjDump: type: data @@ -479,6 +490,12 @@ Cuda: - .cu - .cuh +Cycript: + type: programming + lexer: JavaScript + extensions: + - .cy + Cython: type: programming group: Python @@ -533,6 +550,7 @@ Dart: Diff: extensions: - .diff + - .patch Dogescript: type: programming @@ -617,6 +635,7 @@ Erlang: color: "#0faf8d" extensions: - .erl + - .escript - .hrl F#: @@ -692,6 +711,7 @@ Forth: extensions: - .fth - .4th + - .forth Frege: type: programming @@ -800,6 +820,9 @@ Gosu: color: "#82937f" extensions: - .gs + - .gst + - .gsx + - .vark Grace: type: programming @@ -835,6 +858,7 @@ Groovy: color: "#e69f56" extensions: - .groovy + - .gradle - .grt - .gtpl - .gvy @@ -857,7 +881,6 @@ HTML: extensions: - .html - .htm - - .html.hl - .st - .xhtml @@ -877,9 +900,7 @@ HTML+ERB: - erb extensions: - .erb - - .erb.deface - - .html.erb - - .html.erb.deface + - .deface HTML+PHP: type: markup @@ -897,17 +918,14 @@ Haml: type: markup extensions: - .haml - - .haml.deface - - .html.haml.deface + - .deface Handlebars: type: markup - lexer: Text only + lexer: Handlebars extensions: - .handlebars - .hbs - - .html.handlebars - - .html.hbs Harbour: type: programming @@ -945,6 +963,7 @@ IDL: color: "#e3592c" extensions: - .pro + - .dlm INI: type: data @@ -1019,6 +1038,7 @@ JSON: searchable: false extensions: - .json + - .lock - .sublime-keymap - .sublime-mousemap - .sublime-project @@ -1147,6 +1167,9 @@ Lasso: color: "#2584c3" extensions: - .lasso + - .las + - .lasso9 + - .ldml Latte: type: markup @@ -1225,6 +1248,14 @@ Logtalk: - .lgt - .logtalk +LookML: + type: programming + lexer: YAML + ace_mode: yaml + color: "#652B81" + extensions: + - .lookml + Lua: type: programming ace_mode: lua @@ -1232,6 +1263,7 @@ Lua: extensions: - .lua - .nse + - .pd_lua - .rbxs interpreters: - lua @@ -1377,6 +1409,7 @@ Myghty: NSIS: extensions: - .nsi + - .nsh Nemerle: type: programming @@ -1441,6 +1474,7 @@ OCaml: color: "#3be133" extensions: - .ml + - .eliom - .eliomi - .ml4 - .mli @@ -1461,6 +1495,7 @@ Objective-C: - objc extensions: - .m + - .h Objective-C++: type: programming @@ -1508,6 +1543,13 @@ OpenEdge ABL: - abl extensions: - .p + - .cls + +OpenSCAD: + type: programming + lexer: Text only + extensions: + - .scad Org: type: prose @@ -1546,6 +1588,7 @@ PHP: - .php - .aw - .ctp + - .module - .php3 - .php4 - .php5 @@ -1594,6 +1637,7 @@ Pascal: extensions: - .pas - .dfm + - .dpr - .lpr Perl: @@ -1603,12 +1647,15 @@ Perl: extensions: - .pl - .PL + - .cgi + - .fcgi - .perl - .ph - .plx - .pm - .pod - .psgi + - .t interpreters: - perl @@ -1817,6 +1864,7 @@ Racket: - .rkt - .rktd - .rktl + - .scrbl Ragel in Ruby Host: type: programming @@ -1886,7 +1934,10 @@ Ruby: - .god - .irbrc - .mspec + - .pluginspec - .podspec + - .rabl + - .rake - .rbuild - .rbw - .rbx @@ -1931,6 +1982,14 @@ SCSS: extensions: - .scss +SQF: + type: programming + color: "#FFCB1F" + lexer: C++ + extensions: + - .sqf + - .hqf + SQL: type: data ace_mode: sql @@ -1960,6 +2019,7 @@ Sass: group: CSS extensions: - .sass + - .scss Scala: type: programming @@ -1967,6 +2027,7 @@ Scala: color: "#7dd3b0" extensions: - .scala + - .sbt - .sc Scaml: @@ -1982,6 +2043,7 @@ Scheme: - .scm - .sld - .sls + - .sps - .ss interpreters: - guile @@ -1993,6 +2055,8 @@ Scilab: type: programming extensions: - .sci + - .sce + - .tst Self: type: programming @@ -2012,8 +2076,10 @@ Shell: - zsh extensions: - .sh + - .bash - .bats - .tmux + - .zsh interpreters: - bash - sh @@ -2080,6 +2146,7 @@ Standard ML: extensions: - .ML - .fun + - .sig - .sml Stata: @@ -2160,10 +2227,13 @@ TeX: extensions: - .tex - .aux + - .bbx - .bib + - .cbx - .cls - .dtx - .ins + - .lbx - .ltx - .mkii - .mkiv @@ -2280,6 +2350,7 @@ Visual Basic: extensions: - .vb - .bas + - .cls - .frm - .frx - .vba @@ -2308,6 +2379,7 @@ XML: - wsdl extensions: - .xml + - .ant - .axml - .ccxml - .clixml @@ -2321,6 +2393,7 @@ XML: - .fsproj - .glade - .grxml + - .ivy - .jelly - .kml - .launch diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index c78ed491..9588d42a 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -82,6 +82,9 @@ "Ceylon": [ ".ceylon" ], + "Chapel": [ + ".chpl" + ], "Cirru": [ ".cirru" ], @@ -92,7 +95,8 @@ ".cljs", ".cljscm", ".cljx", - ".hic" + ".hic", + ".hl" ], "CoffeeScript": [ ".coffee" @@ -118,6 +122,9 @@ ".cu", ".cuh" ], + "Cycript": [ + ".cy" + ], "DM": [ ".dm" ], @@ -209,7 +216,12 @@ ".html", ".st" ], + "HTML+ERB": [ + ".deface", + ".erb" + ], "Haml": [ + ".deface", ".haml" ], "Handlebars": [ @@ -310,6 +322,9 @@ "Logtalk": [ ".lgt" ], + "LookML": [ + ".lookml" + ], "Lua": [ ".pd_lua" ], @@ -403,6 +418,9 @@ ".cls", ".p" ], + "OpenSCAD": [ + ".scad" + ], "Org": [ ".org" ], @@ -435,6 +453,7 @@ ".dpr" ], "Perl": [ + ".cgi", ".fcgi", ".pl", ".pm", @@ -540,6 +559,10 @@ "SCSS": [ ".scss" ], + "SQF": [ + ".hqf", + ".sqf" + ], "SQL": [ ".prc", ".sql", @@ -634,7 +657,10 @@ ".tm" ], "TeX": [ - ".cls" + ".bbx", + ".cbx", + ".cls", + ".lbx" ], "Tea": [ ".tea" @@ -797,8 +823,8 @@ "exception.zep.php" ] }, - "tokens_total": 630435, - "languages_total": 869, + "tokens_total": 650933, + "languages_total": 889, "tokens": { "ABAP": { "*/**": 1, @@ -15140,6 +15166,798 @@ "<=>": 1, "other.name": 1 }, + "Chapel": { + "//": 150, + "use": 5, + "BlockDist": 2, + "CyclicDist": 1, + "BlockCycDist": 1, + "ReplicatedDist": 2, + ";": 516, + "DimensionalDist2D": 2, + "ReplicatedDim": 2, + "BlockCycDim": 1, + "config": 10, + "const": 59, + "n": 16, + "Space": 12, + "{": 122, + "}": 120, + "BlockSpace": 2, + "dmapped": 8, + "Block": 4, + "(": 626, + "boundingBox": 2, + ")": 626, + "var": 72, + "BA": 3, + "[": 920, + "]": 920, + "int": 21, + "forall": 43, + "ba": 4, + "in": 76, + "do": 62, + "here.id": 7, + "writeln": 53, + "MyLocaleView": 5, + "#numLocales": 1, + "MyLocales": 5, + "locale": 1, + "reshape": 2, + "Locales": 6, + "BlockSpace2": 2, + "targetLocales": 1, + "BA2": 3, + "CyclicSpace": 2, + "Cyclic": 1, + "startIdx": 2, + "Space.low": 5, + "CA": 3, + "ca": 2, + "BlkCycSpace": 2, + "BlockCyclic": 1, + "blocksize": 1, + "BCA": 3, + "bca": 2, + "ReplicatedSpace": 2, + "RA": 11, + "ra": 4, + "RA.numElements": 1, + "A": 13, + "i": 250, + "j": 25, + "i*100": 1, + "+": 334, + "on": 7, + "here": 3, + "LocaleSpace.high": 3, + "nl1": 2, + "nl2": 2, + "if": 98, + "numLocales": 5, + "then": 80, + "else": 16, + "numLocales/2": 1, + "#nl1": 2, + "#nl2": 1, + "#nl1*nl2": 1, + "DimReplicatedBlockcyclicSpace": 2, + "new": 7, + "BlockCyclicDim": 1, + "lowIdx": 1, + "blockSize": 1, + "DRBA": 3, + "for": 36, + "locId1": 2, + "drba": 2, + "Helper": 2, + "print": 5, + "to": 9, + "the": 10, + "console": 1, + "Time": 2, + "get": 3, + "timing": 6, + "routines": 1, + "benchmarking": 1, + "block": 1, + "-": 345, + "distributed": 1, + "arrays": 6, + "luleshInit": 1, + "initialization": 1, + "code": 1, + "data": 1, + "set": 4, + "param": 25, + "useBlockDist": 5, + "CHPL_COMM": 1, + "use3DRepresentation": 4, + "false": 4, + "useSparseMaterials": 3, + "true": 5, + "printWarnings": 3, + "&&": 9, + "luleshInit.filename": 1, + "halt": 5, + "initialEnergy": 2, + "e": 84, + "initial": 1, + "energy": 5, + "value": 1, + "showProgress": 3, + "time": 9, + "and": 4, + "dt": 14, + "values": 1, + "each": 1, + "step": 1, + "debug": 8, + "various": 1, + "info": 1, + "doTiming": 4, + "main": 3, + "timestep": 1, + "loop": 2, + "printCoords": 2, + "final": 1, + "computed": 1, + "coordinates": 2, + "XI_M": 2, + "XI_M_SYMM": 4, + "XI_M_FREE": 3, + "XI_P": 2, + "c": 7, + "XI_P_SYMM": 3, + "XI_P_FREE": 3, + "ETA_M": 2, + "ETA_M_SYMM": 4, + "ETA_M_FREE": 3, + "ETA_P": 2, + "c0": 1, + "ETA_P_SYMM": 3, + "ETA_P_FREE": 3, + "ZETA_M": 2, + "ZETA_M_SYMM": 4, + "ZETA_M_FREE": 3, + "ZETA_P": 2, + "xc00": 1, + "ZETA_P_SYMM": 3, + "ZETA_P_FREE": 3, + "numElems": 2, + "numNodes": 1, + "initProblemSize": 1, + "ElemSpace": 4, + "#elemsPerEdge": 3, + "#numElems": 1, + "NodeSpace": 4, + "#nodesPerEdge": 3, + "#numNodes": 1, + "Elems": 45, + "Nodes": 16, + "x": 111, + "y": 107, + "z": 107, + "real": 60, + "nodesPerElem": 6, + "elemToNode": 7, + "nodesPerElem*index": 1, + "lxim": 3, + "lxip": 3, + "letam": 3, + "letap": 3, + "lzetam": 3, + "lzetap": 3, + "index": 4, + "XSym": 4, + "YSym": 4, + "ZSym": 4, + "sparse": 3, + "subdomain": 3, + "u_cut": 5, + "hgcoef": 1, + "qstop": 2, + "monoq_max_slope": 7, + "monoq_limiter_mult": 7, + "e_cut": 3, + "p_cut": 6, + "ss4o3": 1, + "/3.0": 2, + "q_cut": 2, + "v_cut": 2, + "qlc_monoq": 2, + "qqc_monoq": 2, + "qqc": 1, + "qqc2": 1, + "*": 260, + "qqc**2": 1, + "eosvmax": 14, + "eosvmin": 9, + "pmin": 7, + "emin": 7, + "dvovmax": 1, + "refdens": 3, + "deltatimemultlb": 1, + "deltatimemultub": 1, + "dtmax": 1, + "stoptime": 3, + "maxcycles": 3, + "max": 2, + "dtfixed": 2, + "MatElems": 9, + "MatElemsType": 2, + "enumerateMatElems": 2, + "proc": 44, + "type": 1, + "return": 15, + "Elems.type": 1, + "iter": 3, + "yield": 3, + "elemBC": 16, + "p": 10, + "pressure": 1, + "q": 13, + "ql": 3, + "linear": 1, + "term": 2, + "qq": 3, + "quadratic": 1, + "v": 9, + "//relative": 1, + "volume": 21, + "vnew": 9, + "volo": 5, + "reference": 1, + "delv": 3, + "m_vnew": 1, + "m_v": 1, + "vdov": 4, + "derivative": 1, + "over": 2, + "arealg": 2, + "elem": 3, + "characteristic": 2, + "length": 2, + "ss": 2, + "elemMass": 4, + "mass": 12, + "xd": 8, + "yd": 8, + "zd": 8, + "velocities": 2, + "xdd": 3, + "ydd": 3, + "zdd": 3, + "acceleration": 1, + "fx": 8, + "fy": 8, + "fz": 8, + "atomic": 2, + "forces": 1, + "nodalMass": 3, + "current": 1, + "deltatime": 3, + "variable": 1, + "increment": 1, + "dtcourant": 1, + "e20": 2, + "courant": 1, + "constraint": 2, + "dthydro": 1, + "change": 2, + "cycle": 5, + "iteration": 1, + "count": 1, + "simulation": 1, + "initLulesh": 2, + "st": 4, + "getCurrentTime": 4, + "while": 4, + "<": 42, + "iterTime": 2, + "TimeIncrement": 2, + "LagrangeLeapFrog": 1, + "deprint": 3, + "format": 9, + "et": 3, + "/cycle": 1, + "outfile": 1, + "open": 1, + "iomode.cw": 1, + "writer": 1, + "outfile.writer": 1, + "fmtstr": 4, + "writer.writeln": 1, + "writer.close": 1, + "outfile.close": 1, + "initCoordinates": 1, + "initElemToNodeMapping": 1, + "initGreekVars": 1, + "initXSyms": 1, + "initYSyms": 1, + "initZSyms": 1, + "//calculated": 1, + "fly": 1, + "using": 1, + "elemToNodes": 3, + "initMasses": 2, + "octantCorner": 2, + "initBoundaryConditions": 2, + "massAccum": 3, + "eli": 18, + "x_local": 11, + "y_local": 11, + "z_local": 11, + "*real": 40, + "localizeNeighborNodes": 6, + "CalcElemVolume": 3, + "neighbor": 2, + ".add": 1, + ".read": 1, + "/": 26, + "surfaceNode": 8, + "mask": 16, + "<<": 2, + "&": 18, + "f": 4, + "|": 14, + "xf0": 4, + "xcc": 4, + "check": 3, + "loc": 4, + "maxloc": 1, + "reduce": 2, + "zip": 1, + "freeSurface": 3, + "initFreeSurface": 1, + "b": 4, + "inline": 5, + "ref": 19, + "noi": 4, + "TripleProduct": 4, + "x1": 1, + "y1": 1, + "z1": 1, + "x2": 1, + "y2": 1, + "z2": 1, + "x3": 1, + "y3": 1, + "z3": 1, + "x1*": 1, + "y2*z3": 1, + "z2*y3": 1, + "x2*": 1, + "z1*y3": 1, + "y1*z3": 1, + "x3*": 1, + "y1*z2": 1, + "z1*y2": 1, + "dx61": 2, + "dy61": 2, + "dz61": 2, + "dx70": 2, + "dy70": 2, + "dz70": 2, + "dx63": 2, + "dy63": 2, + "dz63": 2, + "dx20": 2, + "dy20": 2, + "dz20": 2, + "dx50": 2, + "dy50": 2, + "dz50": 2, + "dx64": 2, + "dy64": 2, + "dz64": 2, + "dx31": 2, + "dy31": 2, + "dz31": 2, + "dx72": 2, + "dy72": 2, + "dz72": 2, + "dx43": 2, + "dy43": 2, + "dz43": 2, + "dx57": 2, + "dy57": 2, + "dz57": 2, + "dx14": 2, + "dy14": 2, + "dz14": 2, + "dx25": 2, + "dy25": 2, + "dz25": 2, + "InitStressTermsForElems": 1, + "sigxx": 2, + "sigyy": 2, + "sigzz": 2, + "D": 9, + "CalcElemShapeFunctionDerivatives": 2, + "b_x": 18, + "b_y": 18, + "b_z": 18, + "fjxxi": 5, + ".125": 9, + "fjxet": 6, + "fjxze": 5, + "fjyxi": 5, + "fjyet": 6, + "fjyze": 5, + "fjzxi": 5, + "fjzet": 6, + "fjzze": 5, + "cjxxi": 5, + "cjxet": 6, + "cjxze": 5, + "cjyxi": 5, + "cjyet": 6, + "cjyze": 5, + "cjzxi": 5, + "cjzet": 6, + "cjzze": 5, + "CalcElemNodeNormals": 1, + "pfx": 15, + "pfy": 15, + "pfz": 15, + "ElemFaceNormal": 7, + "n1": 23, + "n2": 23, + "n3": 23, + "n4": 23, + "bisectX0": 3, + "bisectY0": 3, + "bisectZ0": 3, + "bisectX1": 3, + "bisectY1": 3, + "bisectZ1": 3, + "areaX": 5, + "areaY": 5, + "areaZ": 5, + "rx": 6, + "ry": 6, + "rz": 6, + "//results": 1, + "SumElemStressesToNodeForces": 1, + "stress_xx": 2, + "stress_yy": 2, + "stress_zz": 2, + "CalcElemVolumeDerivative": 1, + "VoluDer": 9, + "n0": 13, + "n5": 13, + "ox": 1, + "oy": 1, + "oz": 1, + "ox/12.0": 1, + "oy/12.0": 1, + "oz/12.0": 1, + "dvdx": 10, + "dvdy": 10, + "dvdz": 10, + "CalcElemFBHourglassForce": 1, + "hourgam": 7, + "coefficient": 4, + "hgfx": 2, + "hgfy": 2, + "hgfz": 2, + "hx": 3, + "hy": 3, + "hz": 3, + "shx": 3, + "shy": 3, + "shz": 3, + "CalcElemCharacteristicLength": 2, + "AreaFace": 7, + "p0": 7, + "p1": 7, + "p2": 7, + "p3": 7, + "gx": 5, + "gy": 5, + "gz": 5, + "area": 2, + "charLength": 2, + "sqrt": 10, + "CalcElemVelocityGradient": 2, + "xvel": 25, + "yvel": 25, + "zvel": 25, + "detJ": 5, + "d": 12, + "inv_detJ": 10, + "dyddx": 2, + "dxddy": 2, + "dzddx": 2, + "dxddz": 2, + "dzddy": 2, + "dyddz": 2, + "CalcPressureForElems": 4, + "p_new": 17, + "bvc": 15, + "pbvc": 14, + "e_old": 7, + "compression": 10, + "vnewc": 22, + "c1s": 3, + "abs": 8, + "//impossible": 1, + "targetdt": 1, + "//don": 1, + "t": 3, + "have": 2, + "negative": 2, + "determ": 1, + "can": 2, + "we": 1, + "be": 2, + "able": 1, + "write": 1, + "these": 1, + "as": 1, + "follows": 1, + "CalcVelocityForNodes": 1, + "local": 8, + "xdtmp": 4, + "ydtmp": 4, + "zdtmp": 4, + "CalcPositionForNodes": 1, + "ijk": 7, + "CalcLagrangeElements": 1, + "dxx": 6, + "dyy": 6, + "dzz": 6, + "CalcKinematicsForElems": 2, + "k": 20, + "vdovthird": 4, + "<=>": 7, + "0": 5, + "all": 1, + "elements": 3, + "8": 4, + "6": 1, + "nodal": 2, + "from": 2, + "global": 3, + "copy": 2, + "into": 3, + "xd_local": 4, + "yd_local": 4, + "zd_local": 4, + "dt2": 4, + "5": 1, + "wish": 1, + "this": 2, + "was": 1, + "too": 1, + "calculations": 1, + "relativeVolume": 3, + "1": 2, + "put": 1, + "velocity": 3, + "gradient": 3, + "quantities": 1, + "their": 1, + "2": 1, + "3": 1, + "sungeun": 1, + "Temporary": 1, + "array": 4, + "reused": 1, + "throughout": 1, + "delv_xi": 12, + "delv_eta": 12, + "delv_zeta": 12, + "position": 1, + "delx_xi": 7, + "delx_eta": 7, + "delx_zeta": 7, + "CalcQForElems": 1, + "MONOTONIC": 1, + "Q": 1, + "option": 1, + "Calculate": 1, + "gradients": 2, + "CalcMonotonicQGradientsForElems": 2, + "Transfer": 2, + "veloctiy": 1, + "first": 1, + "order": 1, + "problem": 1, + "commElements": 1, + "CommElements": 1, + "monoQ": 1, + "*/": 1, + "CalcMonotonicQForElems": 2, + "ApplyMaterialPropertiesForElems": 1, + "matelm": 2, + "vc": 6, + "exit": 1, + "EvalEOSForElems": 2, + "UpdateVolumesForElems": 1, + "tmpV": 4, + "ptiny": 9, + "xl": 26, + "yl": 26, + "zl": 26, + "xvl": 26, + "yvl": 26, + "zvl": 26, + "vol": 5, + "norm": 20, + "ax": 7, + "ay": 7, + "az": 7, + "dxv": 4, + "dyv": 4, + "dzv": 4, + "dxj": 1, + "dyj": 1, + "dzj": 1, + "dxi": 1, + "dyi": 1, + "dzi": 1, + "dxk": 1, + "dyk": 1, + "dzk": 1, + "dyi*dzj": 1, + "dzi*dyj": 1, + "dzi*dxj": 1, + "dxi*dzj": 1, + "dxi*dyj": 1, + "dyi*dxj": 1, + "ax*ax": 3, + "ay*ay": 3, + "az*az": 3, + "ax*dxv": 3, + "ay*dyv": 3, + "az*dzv": 3, + "dyj*dzk": 1, + "dzj*dyk": 1, + "dzj*dxk": 1, + "dxj*dzk": 1, + "dxj*dyk": 1, + "dyj*dxk": 1, + "dyk*dzi": 1, + "dzk*dyi": 1, + "dzk*dxi": 1, + "dxk*dzi": 1, + "dxk*dyi": 1, + "dyk*dxi": 1, + "//got": 1, + "rid": 1, + "of": 3, + "call": 1, + "through": 1, + "bcMask": 7, + "delvm": 27, + "delvp": 27, + "select": 6, + "when": 18, + "phixi": 10, + "phieta": 10, + "phizeta": 10, + "qlin": 4, + "qquad": 4, + "delvxxi": 4, + "delvxeta": 4, + "delvxzeta": 4, + "rho": 3, + "delvxxi**2": 1, + "phixi**2": 1, + "delvxeta**2": 1, + "phieta**2": 1, + "delvxzeta**2": 1, + "phizeta**2": 1, + "rho0": 8, + "delvc": 11, + "p_old": 8, + "q_old": 7, + "compHalfStep": 8, + "qq_old": 7, + "ql_old": 7, + "work": 5, + "e_new": 25, + "q_new": 11, + "vchalf": 2, + "CalcEnergyForElems": 2, + "CalcSoundSpeedForElems": 2, + "sixth": 2, + "pHalfStep": 5, + "vhalf": 1, + "ssc": 18, + "vhalf**2": 1, + "q_tilde": 4, + "**2": 6, + "enewc": 2, + "pnewc": 2, + "ssTmp": 4, + "elemToNodesTuple": 1, + "title": 2, + "string": 1, + "pi": 1, + "solarMass": 7, + "pi**2": 1, + "daysPerYear": 13, + "record": 1, + "body": 6, + "pos": 5, + "does": 1, + "not": 1, + "after": 1, + "it": 1, + "is": 1, + "up": 1, + "bodies": 8, + "numbodies": 5, + "bodies.numElements": 1, + "initSun": 2, + "writef": 2, + "advance": 2, + "b.v": 2, + "b.mass": 1, + ".v": 1, + "updateVelocities": 2, + "b1": 2, + "b2": 2, + "dpos": 4, + "b1.pos": 2, + "b2.pos": 2, + "mag": 3, + "sumOfSquares": 4, + "**3": 1, + "b1.v": 2, + "b2.mass": 2, + "b2.v": 1, + "b1.mass": 3, + "b.pos": 1, + "Random": 1, + "random": 1, + "number": 1, + "generation": 1, + "Timer": 2, + "class": 1, + "timer": 2, + "sort": 1, + "**15": 1, + "size": 1, + "sorted": 1, + "thresh": 6, + "recursive": 1, + "depth": 1, + "serialize": 1, + "verbose": 7, + "out": 1, + "many": 1, + "bool": 1, + "disable": 1, + "numbers": 1, + "fillRandom": 1, + "timer.start": 1, + "pqsort": 4, + "timer.stop": 1, + "timer.elapsed": 1, + "arr": 32, + "low": 12, + "arr.domain.low": 1, + "high": 14, + "arr.domain.high": 1, + "where": 2, + "arr.rank": 2, + "bubbleSort": 2, + "pivotVal": 9, + "findPivot": 2, + "pivotLoc": 3, + "partition": 2, + "serial": 1, + "cobegin": 1, + "mid": 7, + "ilo": 9, + "ihi": 6, + "low..high": 2 + }, "Cirru": { "print": 38, "array": 14, @@ -15178,77 +15996,247 @@ "container": 3 }, "Clojure": { - "(": 83, - "defn": 4, + "(": 258, + "defn": 14, "prime": 2, - "[": 41, + "[": 67, "n": 9, - "]": 41, - "not": 3, - "-": 14, - "any": 1, - "zero": 1, - "map": 2, - "#": 1, + "]": 67, + "not": 9, + "-": 70, + "any": 3, + "zero": 2, + "map": 3, + "#": 14, "rem": 2, - "%": 1, - ")": 84, + "%": 6, + ")": 259, "range": 3, - ";": 8, + ";": 353, "while": 3, "stops": 1, - "at": 1, - "the": 1, + "at": 2, + "the": 5, "first": 2, "collection": 1, "element": 1, "that": 1, "evaluates": 1, - "to": 1, - "false": 2, + "to": 2, + "false": 6, "like": 1, "take": 1, - "for": 2, - "x": 6, - "html": 1, - "head": 1, - "meta": 1, - "{": 8, - "charset": 1, - "}": 8, - "link": 1, - "rel": 1, - "href": 1, + "for": 4, + "x": 8, + "html": 2, + "head": 2, + "meta": 3, + "{": 17, + "charset": 2, + "}": 17, + "link": 2, + "rel": 2, + "href": 6, "script": 1, "src": 1, - "body": 1, + "body": 2, "div.nav": 1, - "p": 1, - "into": 2, + "p": 4, + "Copyright": 1, + "c": 1, + "Alan": 1, + "Dipert": 1, + "and": 8, + "Micha": 1, + "Niskin.": 1, + "All": 1, + "rights": 1, + "reserved.": 1, + "The": 1, + "use": 3, + "distribution": 1, + "terms": 2, + "this": 6, + "software": 2, + "are": 2, + "covered": 1, + "by": 4, + "Eclipse": 1, + "Public": 1, + "License": 1, + "http": 2, + "//opensource.org/licenses/eclipse": 1, + "php": 1, + "which": 2, + "can": 1, + "be": 2, + "found": 1, + "in": 4, + "file": 1, + "epl": 1, + "v10.html": 1, + "root": 1, + "of": 2, + "distribution.": 1, + "By": 1, + "using": 1, + "fashion": 1, + "you": 1, + "agreeing": 1, + "bound": 1, + "license.": 1, + "You": 1, + "must": 1, + "remove": 3, + "notice": 1, + "or": 2, + "other": 1, + "from": 1, + "software.": 1, + "page": 2, + "refer": 4, + "clojure": 1, + "exclude": 1, + "nth": 2, + "require": 2, + "tailrecursion.hoplon.reload": 1, + "reload": 2, + "all": 5, + "tailrecursion.hoplon.util": 1, + "name": 1, + "pluralize": 2, + "tailrecursion.hoplon.storage": 1, + "atom": 1, + "local": 3, + "storage": 2, + "utility": 1, + "functions": 2, + "declare": 1, + "route": 11, + "state": 15, + "editing": 13, + "def": 4, + "mapvi": 2, + "comp": 1, + "vec": 2, + "indexed": 1, + "dissocv": 2, + "v": 15, + "i": 20, + "let": 3, + "z": 4, + "dec": 1, + "count": 5, + "cond": 2, + "neg": 1, + "pop": 1, + "pos": 1, + "into": 3, + "subvec": 2, + "inc": 2, + "decorate": 2, + "todo": 10, + "done": 12, + "completed": 12, + "text": 14, + "assoc": 4, + "visible": 2, + "empty": 8, + "persisted": 1, + "cell": 12, + "AKA": 1, + "stem": 1, + "store": 1, + "cells": 2, + "defc": 6, + "loaded": 1, + "nil": 3, + "formula": 1, + "computed": 1, + "filter": 2, + "active": 5, + "plural": 1, + "item": 1, + "todos": 2, + "list": 1, + "transition": 1, + "t": 5, + "destroy": 3, + "swap": 6, + "clear": 2, + "&": 1, + "_": 4, + "new": 5, + "when": 3, + "conj": 1, + "mapv": 1, + "fn": 3, + "reset": 1, + "if": 3, + "lang": 1, + "equiv": 1, + "content": 1, + "title": 1, + "noscript": 1, + "div": 3, + "id": 20, + "section": 2, + "header": 1, + "h1": 1, + "form": 2, + "on": 11, + "submit": 2, + "do": 15, + "val": 4, + "value": 3, + "input": 4, + "type": 8, + "autofocus": 1, + "true": 5, + "placeholder": 1, + "blur": 2, + "toggle": 4, + "attr": 2, + "checked": 2, + "click": 4, + "label": 2, + "ul": 2, + "loop": 2, + "tpl": 1, + "reverse": 1, + "bind": 1, + "ids": 1, + "done#": 3, + "edit#": 3, + "bindings": 1, + "edit": 3, + "show": 2, + "li": 4, + "class": 8, + "dblclick": 1, + "@i": 6, + "button": 2, + "focus": 1, + "@edit": 2, + "change": 1, + "footer": 2, + "span": 2, + "strong": 1, + "a": 7, + "selected": 3, "array": 3, "aseq": 8, - "nil": 1, - "type": 2, - "let": 1, - "count": 3, - "a": 3, "make": 1, - "loop": 1, "seq": 1, - "i": 4, - "if": 1, "<": 1, - "do": 1, "aset": 1, "recur": 1, "next": 1, - "inc": 1, "defprotocol": 1, "ISound": 4, "sound": 5, "deftype": 2, "Cat": 1, - "_": 3, "Dog": 1, "extend": 1, "default": 1, @@ -15259,7 +16247,6 @@ "clj": 1, "ns": 2, "c2.svg": 2, - "use": 2, "c2.core": 2, "only": 4, "unify": 2, @@ -15273,39 +16260,30 @@ "cos": 2, "mean": 2, "cljs": 3, - "require": 1, "c2.dom": 1, "as": 1, "dom": 1, "Stub": 1, "float": 2, - "fn": 2, - "which": 1, "does": 1, "exist": 1, - "on": 1, "runtime": 1, - "def": 1, "identity": 1, "xy": 1, "coordinates": 7, - "cond": 1, - "and": 1, "vector": 1, "y": 1, "deftest": 1, "function": 1, "tests": 1, "is": 7, - "true": 2, "contains": 1, "foo": 6, "bar": 4, "select": 1, "keys": 2, "baz": 4, - "vals": 1, - "filter": 1 + "vals": 1 }, "CoffeeScript": { "CoffeeScript": 1, @@ -18279,6 +19257,122 @@ "cudaDeviceReset": 1, "return": 1 }, + "Cycript": { + "(": 12, + "function": 2, + "utils": 2, + ")": 12, + "{": 8, + "//": 4, + "Load": 1, + "C": 2, + "functions": 3, + "declared": 1, + "in": 2, + "utils.loadFuncs": 1, + "var": 6, + "shouldLoadCFuncs": 2, + "true": 2, + ";": 21, + "Expose": 2, + "the": 1, + "to": 4, + "cycript": 2, + "s": 2, + "global": 1, + "scope": 1, + "shouldExposeConsts": 2, + "defined": 1, + "here": 1, + "t": 1, + "be": 2, + "found": 2, + "with": 1, + "dlsym": 1, + "Failed": 1, + "load": 1, + "mach_vm_address_t": 1, + "string": 4, + "@encode": 2, + "infinite": 1, + "*": 1, + "length": 1, + "[": 8, + "object": 1, + "Struct": 1, + "]": 8, + "%": 8, + "@": 3, + "<%@:>": 1, + "0x": 1, + "+": 3, + "-": 2, + "printf": 1, + ".3s": 1, + "d": 2, + "c": 5, + "float": 1, + "f": 1, + "n": 1, + "foo": 2, + "barrrr": 1, + "Args": 1, + "needs": 1, + "an": 1, + "array": 1, + "number": 1, + "Function": 1, + "not": 1, + "foobar": 2, + "strdup": 2, + "pipe": 1, + "write": 1, + "close": 2, + "int": 1, + "a": 1, + "short": 1, + "b": 1, + "char": 1, + "uint64_t": 1, + "double": 1, + "e": 1, + "struct": 1, + "}": 9, + "return": 1, + "new": 1, + "Type": 1, + "typeStr": 1, + "Various": 1, + "constants": 1, + "utils.constants": 2, + "VM_PROT_NONE": 1, + "VM_PROT_READ": 1, + "VM_PROT_WRITE": 1, + "VM_PROT_EXECUTE": 1, + "VM_PROT_NO_CHANGE": 1, + "VM_PROT_COPY": 1, + "VM_PROT_WANTS_COPY": 1, + "VM_PROT_IS_MASK": 1, + "c.VM_PROT_DEFAULT": 1, + "c.VM_PROT_READ": 2, + "|": 3, + "c.VM_PROT_WRITE": 2, + "c.VM_PROT_ALL": 1, + "c.VM_PROT_EXECUTE": 1, + "if": 3, + "for": 2, + "k": 3, + "Cycript.all": 2, + "shouldExposeFuncs": 1, + "i": 4, + "<": 1, + "funcsToExpose.length": 1, + "name": 3, + "funcsToExpose": 1, + "utils.loadfuncs": 1, + "shouldExposeCFuncs": 1, + "exports": 1 + }, "DM": { "#define": 4, "PI": 6, @@ -26005,8 +27099,139 @@ "with": 1, "Doxygen": 1 }, + "HTML+ERB": { + "<%>": 12, + "if": 3, + "Spree": 4, + "Config": 4, + "enable_fishbowl": 1, + "
": 23, + "class=": 24, + "id=": 1, + "
": 1, + "": 1, + "align=": 1, + "<%=>": 12, + "t": 4, + "fishbowl_settings": 1, + "": 1, + "fishbowl_options": 1, + "each": 1, + "do": 2, + "key": 5, + "label_tag": 2, + "to_s": 2, + "gsub": 1, + "fishbowl_": 1, + "to_sym": 1, + "tag": 2, + "br": 2, + "text_field_tag": 1, + "preferences": 4, + "size": 1, + "class": 2, + "}": 3, + ")": 4, + "%": 2, + "
": 23, + "end": 5, + "hidden_field_tag": 1, + "fishbowl_always_fetch_current_inventory": 3, + "0": 1, + "check_box_tag": 1, + "1": 1, + "always_fetch_current_inventory": 1, + "location_groups": 2, + "empty": 1, + "fishbowl_location_group": 3, + "location_group": 1, + "select": 1, + "selected": 1, + "[": 2, + "]": 2, + "{": 1, + "": 1, + "": 1, + "provide": 1, + "title": 1, + "header": 2, + "present": 1, + "users": 3, + "user_presenter": 1, + "

": 1, + "

": 1, + "will_paginate": 2, + "Name": 1, + "Email": 1, + "Chords": 1, + "Keys": 1, + "Tunings": 1, + "Credits": 1, + "Prem": 1, + "Since": 1, + "No": 1, + "Users": 1, + "else": 1, + "render": 1 + }, "Haml": { - "%": 1, + "/": 1, + "replace": 1, + ".pull": 1, + "-": 16, + "right": 1, + ".btn": 2, + "group": 2, + "link_to": 4, + "page.url": 1, + "target": 1, + "title": 5, + "t": 5, + "(": 10, + ")": 10, + "class": 4, + "do": 4, + "%": 7, + "i.icon": 5, + "picture.row": 1, + "black": 1, + "refinery.edit_admin_page_path": 1, + "page.nested_url": 2, + "switch_locale": 1, + "page.translations.first.locale": 1, + "unless": 1, + "page.translated_to_default_locale": 1, + "scope": 4, + "edit.row": 1, + "blue": 1, + "if": 1, + "page.deletable": 1, + "refinery.admin_page_path": 1, + "methode": 1, + "delete": 1, + "data": 1, + "{": 1, + "confirm": 1, + "page_title_with_translations": 1, + "page": 1, + "}": 1, + "trash.row": 1, + "red": 1, + "else": 1, + "button.btn.btn": 1, + "xs.btn": 1, + "default.disabled": 1, + "trash": 1, + "refinery.new_admin_page_path": 1, + "parent_id": 1, + "page.id": 1, + "plus.row": 1, + "green": 1, "p": 1, "Hello": 1, "World": 1 @@ -35768,6 +36993,50 @@ "write": 1, "end_object.": 1 }, + "LookML": { + "-": 12, + "view": 1, + "comments": 1, + "fields": 1, + "dimension": 4, + "id": 2, + "primary_key": 1, + "true": 3, + "type": 6, + "int": 3, + "sql": 6, + "{": 6, + "TABLE": 6, + "}": 6, + ".id": 1, + "body": 1, + ".body": 1, + "dimension_group": 2, + "created": 1, + "time": 4, + "timeframes": 2, + "[": 2, + "date": 2, + "week": 2, + "month": 2, + "]": 2, + ".created_at": 1, + "headline_id": 1, + "hidden": 2, + ".headline_id": 1, + "updated": 1, + ".updated_at": 1, + "user_id": 1, + ".user_id": 1, + "measure": 1, + "count": 2, + "detail": 2, + "detail*": 1, + "sets": 1, + "headlines.id": 1, + "headlines.name": 1, + "users.id": 1 + }, "Lua": { "-": 60, "A": 1, @@ -49216,6 +50485,28 @@ "CHR": 2, "lcPostBase64Data.": 1 }, + "OpenSCAD": { + "fn": 1, + ";": 6, + "difference": 1, + "(": 11, + ")": 11, + "{": 2, + "union": 1, + "translate": 4, + "[": 5, + "]": 5, + "cube": 1, + "center": 3, + "true": 3, + "cylinder": 2, + "h": 2, + "r1": 1, + "r2": 1, + "sphere": 2, + "r": 3, + "}": 2 + }, "Org": { "#": 13, "+": 13, @@ -51104,35 +52395,35 @@ "package": 14, "App": 131, "Ack": 136, - ";": 1193, - "use": 83, - "warnings": 18, - "strict": 18, + ";": 1376, + "use": 88, + "warnings": 19, + "strict": 22, "File": 54, "Next": 27, "Plugin": 2, - "Basic": 10, + "Basic": 11, "head1": 36, "NAME": 6, - "-": 868, + "-": 1075, "A": 2, "container": 1, - "for": 83, + "for": 88, "functions": 2, - "the": 143, + "the": 153, "ack": 38, - "program": 6, + "program": 7, "VERSION": 15, "Version": 1, "cut": 28, "our": 34, "COPYRIGHT": 7, "BEGIN": 7, - "{": 1121, - "}": 1134, + "{": 1394, + "}": 1407, "fh": 28, "*STDOUT": 6, - "%": 78, + "%": 82, "types": 26, "type_wanted": 20, "mappings": 29, @@ -51143,8 +52434,8 @@ "is_cygwin": 6, "is_windows": 12, "Spec": 13, - "(": 925, - ")": 923, + "(": 1137, + ")": 1136, "Glob": 4, "Getopt": 6, "Long": 6, @@ -51157,11 +52448,11 @@ "_sgbak": 2, "_build": 2, "actionscript": 2, - "[": 159, + "[": 200, "qw": 35, - "as": 37, + "as": 40, "mxml": 2, - "]": 155, + "]": 196, "ada": 4, "adb": 2, "ads": 2, @@ -51175,7 +52466,7 @@ "Binary": 2, "files": 42, "defined": 54, - "by": 16, + "by": 19, "Perl": 9, "T": 2, "op": 2, @@ -51204,25 +52495,25 @@ "xsl": 2, "xslt": 2, "ent": 2, - "while": 31, - "my": 404, + "while": 33, + "my": 458, "type": 69, "exts": 6, "each": 14, - "if": 276, + "if": 322, "ref": 33, "ext": 14, - "@": 38, - "push": 30, - "_": 101, + "@": 54, + "push": 37, + "_": 104, "mk": 2, "mak": 2, - "not": 54, - "t": 18, - "p": 9, + "not": 56, + "t": 21, + "p": 10, "STDIN": 2, "O": 4, - "eq": 31, + "eq": 62, "/MSWin32/": 2, "quotemeta": 5, "catfile": 4, @@ -51230,37 +52521,37 @@ "If": 15, "you": 44, "want": 7, - "to": 95, + "to": 101, "know": 4, "about": 4, "F": 24, "": 13, "see": 5, - "file": 49, + "file": 57, "itself.": 3, "No": 4, - "user": 4, + "user": 5, "serviceable": 1, "parts": 1, "inside.": 1, - "is": 69, - "all": 23, - "that": 33, - "should": 6, + "is": 74, + "all": 28, + "that": 35, + "should": 8, "this.": 1, "FUNCTIONS": 1, "head2": 34, "read_ackrc": 4, "Reads": 1, "contents": 2, - "of": 64, + "of": 67, ".ackrc": 1, - "and": 85, + "and": 92, "returns": 4, "arguments.": 1, - "sub": 225, + "sub": 232, "@files": 12, - "ENV": 40, + "ENV": 41, "ACKRC": 2, "@dirs": 4, "HOME": 4, @@ -51269,55 +52560,55 @@ "grep": 17, "bsd_glob": 4, "GLOB_TILDE": 2, - "filename": 68, - "&&": 83, - "e": 20, - "open": 7, - "or": 49, + "filename": 72, + "&&": 84, + "e": 21, + "open": 10, + "or": 51, "die": 38, "@lines": 21, "/./": 2, - "/": 69, + "/": 82, "s*#/": 2, "<$fh>": 4, - "chomp": 3, - "close": 19, - "s/": 22, - "+": 120, + "chomp": 4, + "close": 22, + "s/": 28, + "+": 126, "//": 9, - "return": 157, + "return": 168, "get_command_line_options": 4, "Gets": 3, - "command": 14, - "line": 20, + "command": 16, + "line": 21, "arguments": 2, - "does": 10, + "does": 11, "specific": 2, "tweaking.": 1, "opt": 291, "pager": 19, "ACK_PAGER_COLOR": 7, - "||": 49, + "||": 52, "ACK_PAGER": 5, "getopt_specs": 6, "m": 17, "after_context": 16, "before_context": 18, - "shift": 165, + "shift": 170, "val": 26, "break": 14, - "c": 5, + "c": 6, "count": 23, "color": 38, "ACK_COLOR_MATCH": 5, "ACK_COLOR_FILENAME": 5, "ACK_COLOR_LINENO": 4, "column": 4, - "#": 99, + "#": 106, "ignore": 7, "this": 22, "option": 7, - "it": 28, + "it": 30, "handled": 2, "beforehand": 2, "f": 25, @@ -51327,14 +52618,14 @@ "heading": 18, "h": 6, "H": 6, - "i": 26, + "i": 27, "invert_file_match": 8, - "lines": 19, + "lines": 20, "l": 17, - "regex": 28, + "regex": 42, "n": 19, "o": 17, - "output": 36, + "output": 40, "undef": 17, "passthru": 9, "print0": 7, @@ -51343,15 +52634,15 @@ "smart_case": 3, "sort_files": 11, "u": 10, - "w": 4, + "w": 7, "remove_dir_sep": 7, "delete": 10, "print_version_statement": 2, - "exit": 16, + "exit": 19, "show_help": 3, - "@_": 43, + "@_": 45, "show_help_types": 2, - "require": 12, + "require": 13, "Pod": 4, "Usage": 4, "pod2usage": 2, @@ -51360,22 +52651,22 @@ "dummy": 2, "wanted": 4, "no//": 2, - "must": 5, - "be": 36, + "must": 7, + "be": 39, "later": 2, - "exists": 19, - "else": 53, + "exists": 31, + "else": 71, "qq": 18, "Unknown": 2, "unshift": 4, "@ARGV": 12, - "split": 13, + "split": 15, "ACK_OPTIONS": 5, "def_types_from_ARGV": 5, "filetypes_supported": 5, "parser": 12, "Parser": 4, - "new": 55, + "new": 56, "configure": 4, "getoptions": 4, "to_screen": 10, @@ -51385,27 +52676,27 @@ "Console": 2, "ANSI": 3, "key": 20, - "value": 12, + "value": 14, "<": 15, - "join": 5, + "join": 7, "map": 10, "@ret": 10, - "from": 19, + "from": 20, "warn": 22, "..": 7, "uniq": 4, "@uniq": 2, - "sort": 8, - "a": 85, + "sort": 9, + "a": 88, "<=>": 2, "b": 6, - "keys": 15, + "keys": 19, "numerical": 2, "occurs": 2, "only": 11, "once": 4, "Go": 1, - "through": 6, + "through": 10, "look": 2, "I": 68, "<--type-set>": 1, @@ -51413,14 +52704,14 @@ "bar": 3, "<--type-add>": 1, "xml=": 1, - ".": 125, + ".": 166, "Remove": 1, "them": 5, "add": 9, "supported": 1, "filetypes": 8, "i.e.": 2, - "into": 6, + "into": 8, "etc.": 3, "@typedef": 8, "td": 6, @@ -51428,12 +52719,12 @@ "Builtin": 4, "cannot": 4, "changed.": 4, - "ne": 9, + "ne": 11, "delete_type": 5, "Type": 2, - "exist": 4, + "exist": 5, "creating": 3, - "with": 26, + "with": 28, "...": 2, "unless": 39, "@exts": 8, @@ -51461,9 +52752,9 @@ "directory": 8, "any": 4, "ones": 1, - "we": 7, + "we": 9, "ignore.": 1, - "path": 28, + "path": 29, "This": 27, "removes": 1, "trailing": 1, @@ -51496,16 +52787,16 @@ "constant": 2, "TEXT": 16, "basename": 9, - ".*": 2, + ".*": 5, "is_searchable": 8, "lc_basename": 8, "lc": 5, - "r": 14, + "r": 18, "B": 76, "header": 17, "SHEBANG#!#!": 2, "ruby": 3, - "|": 28, + "|": 31, "lua": 2, "erl": 2, "hp": 2, @@ -51528,15 +52819,15 @@ "U": 2, "y": 8, "tr/": 2, - "x": 7, + "x": 12, "w/": 3, "nOo_/": 2, "_thpppt": 3, "_get_thpppt": 3, - "print": 35, + "print": 46, "_bar": 3, "<<": 10, - "&": 22, + "&": 27, "*I": 2, "g": 7, "#.": 6, @@ -51545,15 +52836,15 @@ "#I": 6, "#7": 4, "results.": 2, - "on": 25, - "when": 18, - "used": 12, + "on": 27, + "when": 19, + "used": 13, "interactively": 6, "no": 22, "Print": 6, "between": 4, "results": 8, - "different": 2, + "different": 3, "files.": 6, "group": 2, "Same": 8, @@ -51567,7 +52858,7 @@ "Windows": 4, "colour": 2, "COLOR": 6, - "match": 21, + "match": 24, "lineno": 2, "Set": 3, "filenames": 7, @@ -51593,7 +52884,7 @@ "invert": 2, "Print/search": 2, "handle": 3, - "do": 12, + "do": 16, "g/": 2, "G.": 2, "show": 3, @@ -51601,15 +52892,15 @@ "which": 7, "has.": 2, "inclusion/exclusion": 2, - "All": 4, + "All": 5, "searched": 5, "Ignores": 2, ".svn": 3, - "other": 5, + "other": 6, "ignored": 6, "directories": 9, "unrestricted": 2, - "name": 44, + "name": 60, "Add/Remove": 2, "dirs": 2, "R": 2, @@ -51639,12 +52930,12 @@ "res": 59, "next_text": 8, "has_lines": 4, - "scalar": 2, - "m/": 4, + "scalar": 3, + "m/": 12, "regex/": 9, "next": 9, "print_match_or_context": 13, - "elsif": 10, + "elsif": 26, "last": 17, "max": 12, "nmatches": 61, @@ -51658,7 +52949,7 @@ "match_start": 5, "match_end": 3, "Prints": 4, - "out": 2, + "out": 3, "context": 1, "around": 5, "match.": 3, @@ -51699,7 +52990,7 @@ "print_count0": 2, "filetypes_supported_set": 9, "True/False": 1, - "are": 25, + "are": 26, "print_files": 4, "iter": 23, "returned": 3, @@ -51711,10 +53002,10 @@ "<$ors>": 1, "<\"\\n\">": 1, "defines": 2, - "what": 14, + "what": 15, "filename.": 1, "print_files_with_matches": 4, - "where": 3, + "where": 4, "was": 2, "repo": 18, "Repository": 11, @@ -51741,7 +53032,7 @@ "EXPAND_FILENAMES_SCOPE": 4, "argv": 12, "attr": 6, - "foreach": 4, + "foreach": 13, "pattern": 10, "@results": 14, "didn": 2, @@ -51749,7 +53040,7 @@ "tried": 2, "load": 2, "GetAttributes": 2, - "end": 9, + "end": 10, "attributes": 4, "got": 2, "get_starting_points": 4, @@ -51757,7 +53048,7 @@ "@what": 14, "reslash": 4, "Assume": 2, - "current": 5, + "current": 6, "start_point": 4, "_match": 8, "target": 6, @@ -51772,7 +53063,7 @@ "is_interesting": 4, "descend_filter": 11, "error_handler": 5, - "msg": 4, + "msg": 5, "follow_symlinks": 6, "set_up_pager": 3, "Unable": 2, @@ -51785,7 +53076,7 @@ "code.": 2, "otherwise": 2, "handed": 1, - "in": 36, + "in": 40, "argument.": 1, "rc": 11, "LICENSE": 3, @@ -51802,6 +53093,236 @@ "License": 2, "v2.0.": 2, "End": 3, + "SHEBANG#!perl": 6, + "##": 79, + "configuration": 3, + "options": 8, + "BASE_DIR": 1, + "CONFIG_FILE": 2, + "Config": 1, + "location": 5, + "DEBUG_LOG_FILE": 2, + "Specify": 2, + "create": 4, + "log": 4, + "writable": 2, + "nagios": 3, + "DEBUGLEVEL": 3, + "Nothing": 1, + "Errors": 1, + "Warnings": 1, + "Debug": 1, + "DEBUGOUTPUT": 8, + "STDERR": 5, + "STDOUT": 1, + "cgi": 4, + "Global": 1, + "vars": 1, + "DEBUG_TIMESTAMP": 5, + "Find": 1, + "how": 2, + "run": 3, + "ARGV": 5, + "test": 1, + "errors": 4, + "console": 1, + "read_config": 4, + "abort": 23, + "parse": 3, + "performance": 2, + "data": 5, + "started": 1, + "parse_perfdata": 2, + "CGI": 10, + "script": 1, + "web": 9, + "browser": 1, + "run_as_cgi": 2, + "some": 2, + "help": 3, + "info": 1, + "logfile": 1, + "write": 5, + "blank": 2, + "wrote": 1, + "anything...": 1, + "debug": 39, + "Program": 1, + "called": 5, + "graph_name": 18, + "param": 10, + "graph_iteration": 6, + "config": 67, + "display": 2, + "index": 2, + "graphs": 3, + "display_htmltemplate": 3, + "graph": 4, + "Display": 3, + "HTML": 6, + "page": 1, + "generate": 1, + "call": 4, + "rrdtool_cmdline": 11, + ".join": 5, + "expand": 1, + "variables": 1, + "rrdarchive": 1, + "f/": 1, + "rrdarchive/g": 1, + "t_start": 4, + "t_start/g": 1, + "t_end": 4, + "e/": 1, + "t_end/g": 1, + "t_descr": 3, + "d/": 1, + "t_descr/g": 1, + "Call": 1, + "rrdtool": 3, + "probably": 1, + "fixed": 1, + "better": 1, + "way": 3, + "like": 14, + "exec": 1, + "template": 3, + "variable": 3, + "substitution": 1, + "stuff": 1, + "": 1, + "big": 2, + "regex..": 1, + "/my": 1, + "varname": 8, + "date": 3, + "time": 6, + "localtime": 2, + "code": 10, + "return_html": 4, + "gn": 2, + "return_html.": 2, + "escape": 1, + "slash": 1, + "since": 2, + "were": 2, + "inside": 1, + "an": 17, + "displaying": 1, + "actual": 1, + "images": 1, + "iteration_id": 2, + "unknown": 1, + "/eig": 1, + "thought": 1, + "would": 6, + "never": 2, + "Process": 1, + "incoming": 1, + "check": 3, + "plugin": 1, + "insert": 1, + "values": 7, + "rrd": 3, + "archives": 2, + "rrd_updates": 13, + "Provide": 1, + "more": 3, + "symbolic": 1, + "names": 3, + "same": 4, + "macros": 1, + "LASTCHECK": 1, + "HOSTNAME": 2, + "SERVICEDESCR": 2, + "SERVICESTATE": 1, + "OUTPUT": 2, + "PERFDATA": 2, + "host_and_descr_found": 3, + "Loop": 4, + "host_regexes": 1, + "host_regex": 5, + "service_description_regexes": 1, + "service_regex": 4, + "host_regex/i": 1, + "service_regex/i": 1, + "InsertValue": 1, + "host": 1, + "service_description": 1, + "insert_value": 10, + "regexes": 4, + "output/perfdata": 1, + "regex_string": 1, + "regex_string/": 2, + "Insert": 1, + "RRD": 3, + "calling": 1, + "may": 4, + "several": 1, + "archive": 9, + "rrdarchive_filename": 3, + "Create": 1, + "Archive": 1, + "according": 1, + "rrdarchive_filename.": 3, + "rrdtool_cmdline.": 1, + "Check": 1, + "wheter": 1, + "Assemle": 1, + "result": 3, + "Read": 1, + "CONFIG": 2, + "line_counter": 2, + "": 1, + "@args": 11, + "shellwords": 1, + "orig_confline": 1, + "args": 37, + "uc": 1, + "INSERTVALUE": 1, + "rrd_filename": 2, + "rrdcreatetemplate": 4, + "hostname_regex": 4, + "servicedescr_regex": 4, + "regex_template": 3, + "verify": 3, + "hostname": 2, + "service": 1, + "description": 2, + "s*": 1, + "#/": 1, + "comment": 1, + "row": 1, + "nuthin": 1, + "RRDToolPath": 1, + "PlotTemplate": 1, + "htmltemplate": 2, + "parameters..": 2, + "@params": 7, + "GraphTimeTemplate": 1, + "time_template": 2, + "@t_descr": 2, + "workaround": 1, + "string": 6, + "RRDCreateTemplate": 1, + "ValueRegexTemplate": 1, + "template_name": 3, + "@regexes": 2, + "perfdata": 1, + "regex_what": 2, + "dsa_name": 2, + "RRDARCHIVEPATH": 1, + "HTMLTemplatePath": 1, + "GraphIndexTemplate": 1, + "GRAPH": 1, + "rrdfilename": 1, + "graphtimetemplate": 1, + "plottemplate": 1, + "Write": 1, + "output/logging": 1, + "level": 3, + "timestamp": 1, + "msg.": 2, "SHEBANG#!#! perl": 4, "examples/benchmarks/fib.pl": 1, "Fibonacci": 2, @@ -51816,7 +53337,6 @@ "SEE": 4, "ALSO": 4, "": 1, - "SHEBANG#!perl": 5, "MAIN": 1, "main": 3, "env_is_usable": 3, @@ -51835,9 +53355,7 @@ "Resource": 5, "file_matching": 2, "check_regex": 2, - "like": 13, "finder": 1, - "options": 7, "FILE...": 1, "DIRECTORY...": 1, "designed": 1, @@ -51854,7 +53372,6 @@ "By": 2, "prints": 2, "also": 7, - "would": 5, "actually": 1, "let": 1, "take": 5, @@ -51868,7 +53385,6 @@ "symlinks": 1, "than": 5, "whatever": 1, - "were": 1, "specified": 3, "line.": 4, "default.": 2, @@ -51896,7 +53412,6 @@ "groups": 1, "with.": 1, "interactively.": 1, - "result": 1, "per": 1, "grep.": 2, "redirected.": 1, @@ -51910,14 +53425,12 @@ "searched.": 1, "<--help>": 1, "short": 1, - "help": 2, "statement.": 1, "<--ignore-case>": 1, "Ignore": 3, "case": 3, "strings.": 1, "applies": 3, - "regexes": 3, "<-g>": 5, "<-G>": 3, "options.": 4, @@ -51927,7 +53440,6 @@ "directories.": 2, "mason": 1, "users": 4, - "may": 3, "wish": 1, "include": 1, "<--ignore-dir=data>": 1, @@ -51974,7 +53486,6 @@ "": 2, "equivalent": 2, "specifying": 1, - "Specify": 1, "explicitly.": 1, "helpful": 2, "don": 2, @@ -52053,7 +53564,6 @@ "associates": 1, "Works": 1, "<--thpppt>": 1, - "Display": 1, "important": 1, "Bill": 1, "Cat": 1, @@ -52064,12 +53574,11 @@ "<--thpppppt>": 1, "important.": 1, "make": 3, - "perl": 8, + "perl": 9, "php": 2, "python": 1, "looks": 2, "location.": 1, - "variable": 1, "specifies": 1, "placed": 1, "front": 1, @@ -52123,7 +53632,6 @@ "both": 1, "understands": 1, "sequences.": 1, - "never": 1, "back": 4, "ACK": 2, "OTHER": 1, @@ -52148,7 +53656,6 @@ "Jackson": 1, "put": 1, "together": 2, - "an": 16, "": 1, "extension": 1, "": 1, @@ -52161,11 +53668,9 @@ "Code": 1, "greater": 1, "normal": 1, - "code": 8, "<$?=256>": 1, "": 1, "backticks.": 1, - "errors": 1, "used.": 1, "at": 4, "least": 1, @@ -52186,10 +53691,7 @@ "too.": 1, "there.": 1, "working": 1, - "big": 1, "codesets": 1, - "more": 2, - "create": 3, "tree": 2, "ideal": 1, "sending": 1, @@ -52208,7 +53710,6 @@ "": 1, "took": 1, "access": 2, - "log": 3, "scanned": 1, "twice.": 1, "aa.bb.cc.dd": 1, @@ -52254,7 +53755,6 @@ "metadata": 1, "wastes": 1, "lot": 1, - "time": 3, "those": 2, "well": 2, "returning": 1, @@ -52267,7 +53767,6 @@ "has": 3, "perfectly": 1, "good": 2, - "way": 2, "using": 5, "<-p>": 1, "<-n>": 1, @@ -52283,7 +53782,6 @@ "<.xyz>": 1, "already": 2, "program/package": 1, - "called": 4, "ack.": 2, "Yes": 1, "know.": 1, @@ -52383,7 +53881,6 @@ "seek": 4, "readline": 1, "nexted": 3, - "CGI": 6, "Fast": 3, "XML": 2, "Hash": 11, @@ -52403,21 +53900,18 @@ "Request": 11, "*STDERR": 1, "int": 2, - "ARGV": 2, "conv": 2, "use_attr": 1, "indent": 1, "xml_decl": 1, "tmpl_path": 2, "tmpl": 5, - "data": 3, "nick": 1, "parent": 5, "third_party": 1, "artist_name": 2, "venue": 2, "event": 2, - "date": 2, "zA": 1, "Z0": 1, "Content": 2, @@ -52439,7 +53933,6 @@ "": 3, "specification": 3, "interface": 1, - "web": 8, "servers": 2, "based": 2, "applications": 2, @@ -52447,7 +53940,6 @@ "supports": 1, "writing": 1, "portable": 1, - "run": 1, "various": 2, "methods": 4, "standalone": 1, @@ -52471,7 +53963,6 @@ "": 1, "root": 1, "application.": 1, - "write": 2, "own": 4, ".psgi": 7, "Writing": 2, @@ -52505,7 +53996,6 @@ "setting": 2, "wrapped": 1, "": 1, - "some": 1, "engine": 1, "fixes": 1, "uniform": 1, @@ -52517,7 +54007,6 @@ "override": 1, "providing": 2, "none": 1, - "call": 2, "MyApp": 1, "Thus": 1, "functionality": 1, @@ -52538,7 +54027,6 @@ "Catalyst.pm": 1, "library": 2, "software.": 1, - "same": 2, "Plack": 25, "_001": 1, "HTTP": 16, @@ -52606,13 +54094,11 @@ "query": 4, "flatten": 3, "uploads": 5, - "hostname": 1, "url_scheme": 1, "params": 1, "query_params": 1, "body_params": 1, "cookie": 6, - "param": 8, "get_all": 2, "upload": 13, "raw_uri": 1, @@ -52668,7 +54154,6 @@ "": 1, "provide": 1, "higher": 1, - "level": 1, "top": 1, "PSGI.": 1, "METHODS": 2, @@ -52682,9 +54167,7 @@ "noted": 1, "": 1, "passing": 1, - "values": 5, "accessor": 1, - "debug": 1, "set.": 1, "": 2, "request.": 1, @@ -52712,7 +54195,6 @@ "allow": 1, "modifying": 1, "@values": 1, - "@params": 1, "convenient": 1, "@fields": 1, "Creates": 2, @@ -52739,7 +54221,6 @@ "scalars": 1, "references": 1, "ARRAY": 1, - "parse": 1, "twice": 1, "efficiency.": 1, "DISPATCHING": 1, @@ -52751,7 +54232,6 @@ "": 1, "virtual": 1, "regardless": 1, - "how": 1, "mounted.": 1, "hosted": 1, "scripts": 1, @@ -52762,7 +54242,6 @@ "subclass": 1, "define": 1, "uri_for": 2, - "args": 3, "So": 1, "say": 1, "link": 1, @@ -52774,7 +54253,6 @@ "Cookie": 2, "handling": 1, "simplified": 1, - "string": 5, "encoding": 2, "decoding": 1, "totally": 1, @@ -52801,7 +54279,6 @@ "Accessor": 1, "status": 17, "Scalar": 2, - "location": 4, "redirect": 1, "url": 2, "clone": 1, @@ -52814,7 +54291,6 @@ "//g": 1, "CR": 1, "LF": 1, - "since": 1, "char": 1, "invalid": 1, "header_field_names": 1, @@ -52885,7 +54361,6 @@ "responsible": 1, "properly": 1, "": 1, - "names": 1, "their": 1, "corresponding": 1, "": 2, @@ -52902,7 +54377,11 @@ "formats": 1, "<+3M>": 1, "reference.": 1, - "AUTHOR": 1 + "AUTHOR": 1, + "Test": 2, + "Base": 1, + "__DATA__": 1, + "Strict": 1 }, "Perl6": { "token": 6, @@ -60538,6 +62017,55 @@ "padding": 1, "/": 2 }, + "SQF": { + "private": 2, + "[": 4, + "]": 4, + ";": 32, + "AGM_Core_remoteFnc": 2, + "_this": 4, + "_arguments": 6, + "select": 4, + "_function": 6, + "call": 6, + "compile": 1, + "(": 12, + ")": 12, + "_unit": 6, + "if": 7, + "isNil": 1, + "then": 6, + "{": 16, + "}": 16, + "typeName": 1, + "exitWith": 1, + "switch": 1, + "do": 1, + "case": 4, + "isServer": 3, + "else": 4, + "publicVariableServer": 3, + "set": 1, + "publicVariable": 1, + "isDedicated": 1, + "local": 1, + "_id": 2, + "owner": 1, + "publicVariableClient": 1, + "#include": 1, + "": 1, + "#define": 4, + "SET": 1, + "VAR": 5, + "VALUE": 2, + "#VAR": 1, + "CONV": 1, + "ARRAY": 2, + "POOL": 2, + "find": 1, + "ALL_HITPOINTS_MAN": 1, + "ALL_HITPOINTS_VEH": 1 + }, "SQL": { "IF": 13, "EXISTS": 12, @@ -65009,11 +66537,668 @@ "XDG_RUNTIME_DIR": 1 }, "TeX": { - "%": 135, + "ProvidesFile": 3, + "{": 1765, + "authortitle.cbx": 1, + "}": 1771, + "[": 96, + "abx@cbxid": 1, + "]": 95, + "ExecuteBibliographyOptions": 1, + "uniquename": 1, + "uniquelist": 1, + "autocite": 1, + "footnote": 2, + "renewcommand*": 1, + "iffinalcitedelim": 1, + "iflastcitekey": 1, + "newbool": 1, + "cbx": 7, + "parens": 8, + "newbibmacro*": 6, + "cite": 16, + "%": 321, + "iffieldundef": 22, + "shorthand": 8, + "ifnameundef": 2, + "labelname": 4, + "printnames": 2, + "setunit": 2, + "nametitledelim": 1, + "usebibmacro": 38, + "title": 4, + "citetitle": 4, + "textcite": 6, + "global": 4, + "booltrue": 1, + "addspace": 2, + "bibopenparen": 2, + "ifnumequal": 1, + "value": 1, + "citecount": 1, + "prenote": 8, + "printtext": 6, + "bibhyperref": 2, + "printfield": 9, + "labeltitle": 1, + "postnote": 11, + "ifbool": 3, + "bibcloseparen": 3, + "postnotedelim": 1, + "DeclareCiteCommand": 6, + "citeindex": 8, + "multicitedelim": 7, + "DeclareCiteCommand*": 2, + "parencite": 2, + "mkbibparens": 3, + "footcite": 1, + "mkbibfootnote": 2, + "footcitetext": 1, + "mkbibfootnotetext": 1, + "smartcite": 1, + "iffootnote": 1, + "boolfalse": 2, + "iffirstcitekey": 1, + "setcounter": 6, + "textcitetotal": 2, + "stepcounter": 1, + "textcitedelim": 1, + "DeclareMultiCiteCommand": 1, + "textcites": 1, + "endinput": 3, + "english.lbx": 1, + "abx@lbxid": 1, + "DeclareRedundantLanguages": 1, + "english": 2, + "american": 2, + "british": 1, + "canadian": 1, + "australian": 1, + "newzealand": 1, + "USenglish": 1, + "UKenglish": 1, + "DeclareBibliographyExtras": 1, + "protected": 16, + "def": 32, + "bibrangedash": 2, + "textendash": 1, + "penalty": 2, + "hyphenpenalty": 1, + "breakable": 1, + "dash": 1, + "bibdatedash": 9, + "finalandcomma": 109, + "addcomma": 1, + "finalandsemicolon": 1, + "addsemicolon": 1, + "mkbibordinal#1": 1, + "begingroup": 2, + "@tempcnta0#1": 1, + "relax": 6, + "number": 3, + "@tempcnta": 7, + "@whilenum": 2, + "do": 2, + "advance": 3, + "-": 15, + "ifnum": 4, + "fi": 17, + "ifcase": 1, + "th": 2, + "or": 4, + "st": 1, + "nd": 1, + "rd": 1, + "else": 10, + "endgroup": 2, + "mkbibmascord": 1, + "mkbibordinal": 3, + "mkbibfemord": 1, + "mkbibneutord": 1, + "mkbibdatelong#1#2#3": 1, + "#2": 21, + "mkbibmonth": 1, + "thefield": 8, + "#3": 14, + "#1": 50, + "space": 10, + "nobreakspace": 1, + "stripzeros": 2, + "iffieldbibstring": 2, + "bibstring": 2, + "mkbibdateshort#1#2#3": 1, + "mkdatezeros": 3, + "/": 4, + "savecommand": 4, + "mkbibrangecomp": 3, + "mkbibrangecompextra": 3, + "mkbibrangeterse": 3, + "mkbibrangeterseextra": 3, + "lbx@us@mkbibrangetrunc@long": 1, + "long": 2, + "lbx@us@mkbibrangetrunc@short": 1, + "short": 2, + "lbx@us@mkbibrangetruncextra@long": 1, + "lbx@us@mkbibrangetruncextra@short": 1, + "UndeclareBibliographyExtras": 1, + "restorecommand": 4, + "DeclareBibliographyStrings": 1, + "bibliography": 1, + "Bibliography": 2, + "references": 2, + "References": 3, + "shorthands": 1, + "List": 1, + "of": 24, + "Abbreviations": 2, + "editor": 25, + "ed": 21, + "adddot": 257, + "editors": 25, + "eds": 7, + "compiler": 2, + "comp": 4, + "compilers": 2, + "redactor": 2, + "red": 4, + "redactors": 2, + "reviser": 2, + "rev": 5, + "revisers": 2, + "founder": 2, + "found": 3, + "founders": 2, + "continuator": 1, + "continued": 3, + "cont": 3, + "FIXME": 5, + "unsure": 5, + "continuators": 1, + "collaborator": 2, + "collab": 3, + "collaborators": 2, + "translator": 16, + "trans": 51, + "translators": 16, + "commentator": 11, + "comm": 31, + "commentators": 11, + "annotator": 11, + "annot": 34, + "annotators": 11, + "commentary": 9, + "annotations": 11, + "introduction": 30, + "intro": 2, + "foreword": 30, + "forew": 20, + "afterword": 30, + "afterw": 20, + "editortr": 1, + "and": 200, + "adddotspace": 57, + "editorstr": 1, + "editorco": 1, + "editorsco": 1, + "editoran": 1, + "editorsan": 1, + "editorin": 1, + "introd": 18, + "editorsin": 1, + "editorfo": 1, + "editorsfo": 1, + "editoraf": 1, + "editorsaf": 1, + "editortrco": 1, + "ed.": 28, + "addabbrvspace": 52, + "editorstrco": 1, + "eds.": 17, + "editortran": 1, + "editorstran": 1, + "editortrin": 1, + "editorstrin": 1, + "editortrfo": 1, + "editorstrfo": 1, + "editortraf": 1, + "editorstraf": 1, + "editorcoin": 1, + "editorscoin": 1, + "editorcofo": 1, + "editorscofo": 1, + "editorcoaf": 1, + "editorscoaf": 1, + "editoranin": 1, + "editorsanin": 1, + "editoranfo": 1, + "editorsanfo": 1, + "editoranaf": 1, + "editorsanaf": 1, + "editortrcoin": 1, + "trans.": 24, + "editorstrcoin": 1, + "editortrcofo": 1, + "editorstrcofo": 1, + "editortrcoaf": 1, + "editorstrcoaf": 1, + "editortranin": 1, + "editorstranin": 1, + "editortranfo": 1, + "editorstranfo": 1, + "editortranaf": 1, + "editorstranaf": 1, + "translatorco": 1, + "translatorsco": 1, + "translatoran": 1, + "translatorsan": 1, + "translatorin": 1, + "translation": 19, + "translatorsin": 1, + "translatorfo": 1, + "translatorsfo": 1, + "translatoraf": 1, + "translatorsaf": 1, + "translatorcoin": 1, + "translatorscoin": 1, + "translatorcofo": 1, + "translatorscofo": 1, + "translatorcoaf": 1, + "translatorscoaf": 1, + "translatoranin": 1, + "translatorsanin": 1, + "translatoranfo": 1, + "translatorsanfo": 1, + "translatoranaf": 1, + "translatorsanaf": 1, + "byauthor": 1, + "by": 103, + "byeditor": 1, + "edited": 24, + "bycompiler": 1, + "compiled": 1, + "byredactor": 1, + "redacted": 1, + "byreviser": 1, + "revised": 1, + "byreviewer": 1, + "reviewed": 1, + "byfounder": 1, + "founded": 1, + "bycontinuator": 1, + "bycollaborator": 1, + "in": 37, + "collaboration": 1, + "with": 71, + "bytranslator": 1, + "translated": 26, + "lbx@lfromlang": 24, + "lbx@sfromlang": 24, + "bycommentator": 1, + "commented": 13, + "byannotator": 1, + "annotated": 13, + "withcommentator": 1, + "a": 24, + "comment": 2, + "withannotator": 1, + "annots": 1, + "withintroduction": 1, + "an": 40, + "withforeword": 1, + "withafterword": 1, + "byeditortr": 1, + "byeditorco": 1, + "byeditoran": 1, + "byeditorin": 1, + "introd.": 9, + "byeditorfo": 1, + "forew.": 9, + "byeditoraf": 1, + "afterw.": 9, + "byeditortrco": 1, + "byeditortran": 1, + "byeditortrin": 1, + "byeditortrfo": 1, + "byeditortraf": 1, + "byeditorcoin": 1, + "comm.": 9, + "byeditorcofo": 1, + "byeditorcoaf": 1, + "byeditoranin": 1, + "annot.": 6, + "byeditoranfo": 1, + "byeditoranaf": 1, + "byeditortrcoin": 1, + "byeditortrcofo": 1, + "byeditortrcoaf": 1, + "byeditortranin": 1, + "byeditortranfo": 1, + "byeditortranaf": 1, + "bytranslatorco": 1, + "bytranslatoran": 1, + "bytranslatorin": 1, + "bytranslatorfo": 1, + "bytranslatoraf": 1, + "bytranslatorcoin": 1, + "bytranslatorcofo": 1, + "bytranslatorcoaf": 1, + "bytranslatoranin": 1, + "bytranslatoranfo": 1, + "bytranslatoranaf": 1, + "andothers": 1, + "et": 4, + "al": 4, + "andmore": 1, + "volume": 3, + "vol": 2, + "volumes": 2, + "vols": 1, + "involumes": 1, + "jourvol": 1, + "jourser": 1, + "series": 3, + "ser": 3, + "book": 5, + "part": 3, + "issue": 3, + "newseries": 1, + "new": 3, + "oldseries": 1, + "old": 2, + "edition": 2, + "reprint": 3, + "repr": 3, + "reprintof": 1, + "reprintas": 1, + "reprinted": 2, + "as": 10, + "rpt": 1, + "reprintfrom": 1, + "from": 53, + "reviewof": 1, + "review": 1, + "translationof": 1, + "translationas": 1, + "translationfrom": 1, + "origpubas": 1, + "originally": 2, + "published": 4, + "orig": 2, + "pub": 2, + "origpubin": 1, + "astitle": 1, + "bypublisher": 1, + "page": 7, + "p": 2, + "pages": 5, + "pp": 2, + "column": 2, + "col": 1, + "columns": 2, + "cols": 1, + "line": 4, + "l": 1, + "lines": 2, + "ll": 1, + "nodate": 1, + "no": 2, + "date": 1, + "n": 6, + "d": 2, + "verse": 2, + "v": 1, + "verses": 2, + "vv": 1, + "section": 4, + "S": 3, + "sections": 2, + "paragraph": 2, + "par": 8, + "paragraphs": 2, + "inseries": 1, + "ofseries": 1, + "chapter": 11, + "chap": 2, + "mathesis": 1, + "Master": 1, + "s": 1, + "thesis": 6, + "MA": 1, + "phdthesis": 1, + "PhD": 2, + "candthesis": 1, + "Candidate": 1, + "Cand": 1, + "resreport": 1, + "research": 2, + "report": 2, + "rep": 2, + "techreport": 1, + "technical": 1, + "tech": 1, + "software": 3, + "computer": 1, + "datacd": 1, + "CD": 4, + "ROM": 2, + "audiocd": 1, + "audio": 2, + "version": 3, + "url": 3, + "address": 2, + "urlfrom": 1, + "available": 2, + "urlseen": 1, + "visited": 2, + "on": 8, + "inpreparation": 1, + "preparation": 2, + "submitted": 3, + "forthcoming": 3, + "inpress": 1, + "press": 2, + "prepublished": 1, + "pre": 2, + "citedas": 1, + "henceforth": 2, + "cited": 4, + "thiscite": 1, + "especially": 1, + "esp": 1, + "seenote": 1, + "see": 7, + "note": 1, + "quotedin": 1, + "quoted": 1, + "qtd": 1, + "idem": 7, + "idemsm": 1, + "idemsf": 1, + "eadem": 4, + "idemsn": 1, + "idempm": 1, + "eidem": 4, + "idempf": 1, + "eaedem": 2, + "idempn": 1, + "idempp": 1, + "ibidem": 2, + "ibid": 1, + "opcit": 1, + "op": 2, + "cit": 6, + "loccit": 1, + "loc": 2, + "confer": 1, + "cf": 2, + "sequens": 1, + "sq": 2, + "sequentes": 1, + "sqq": 2, + "passim": 2, + "pass": 1, + "seealso": 1, + "also": 2, + "backrefpage": 1, + "backrefpages": 1, + "january": 1, + "January": 1, + "Jan": 1, + "february": 1, + "February": 1, + "Feb": 1, + "march": 1, + "March": 1, + "Mar": 1, + "april": 1, + "April": 1, + "Apr": 1, + "may": 1, + "May": 2, + "june": 1, + "June": 2, + "july": 1, + "July": 2, + "august": 1, + "August": 1, + "Aug": 1, + "september": 1, + "September": 1, + "Sept": 1, + "october": 1, + "October": 1, + "Oct": 1, + "november": 1, + "November": 1, + "Nov": 1, + "december": 1, + "December": 1, + "Dec": 1, + "langamerican": 1, + "American": 4, + "langbrazilian": 1, + "Brazilian": 4, + "langcatalan": 1, + "Catalan": 4, + "langcroatian": 1, + "Croatian": 4, + "langczech": 1, + "Czech": 4, + "langdanish": 1, + "Danish": 4, + "langdutch": 1, + "Dutch": 4, + "langenglish": 1, + "English": 4, + "langfinnish": 1, + "Finnish": 4, + "langfrench": 1, + "French": 8, + "langgerman": 1, + "German": 8, + "langgreek": 1, + "Greek": 4, + "langitalian": 1, + "Italian": 4, + "langlatin": 1, + "Latin": 4, + "langnorwegian": 1, + "Norwegian": 4, + "langpolish": 1, + "Polish": 4, + "langportuguese": 1, + "Portuguese": 4, + "langrussian": 1, + "Russian": 4, + "langslovene": 1, + "Slovene": 4, + "langspanish": 1, + "Spanish": 4, + "langswedish": 1, + "Swedish": 4, + "fromamerican": 1, + "the": 61, + "frombrazilian": 1, + "fromcatalan": 1, + "fromcroatian": 1, + "fromczech": 1, + "fromdanish": 1, + "fromdutch": 1, + "fromenglish": 1, + "fromfinnish": 1, + "fromfrench": 1, + "fromgerman": 1, + "fromgreek": 1, + "fromitalian": 1, + "fromlatin": 1, + "fromnorwegian": 1, + "frompolish": 1, + "fromportuguese": 1, + "fromrussian": 1, + "fromslovene": 1, + "fromspanish": 1, + "fromswedish": 1, + "countryde": 1, + "Germany": 1, + "DE": 1, + "countryeu": 1, + "European": 6, + "Union": 2, + "EU": 1, + "countryep": 1, + "EP": 1, + "countryfr": 1, + "France": 1, + "FR": 1, + "countryuk": 1, + "United": 2, + "Kingdom": 1, + "GB": 1, + "countryus": 1, + "States": 1, + "America": 1, + "US": 1, + "patent": 13, + "pat": 12, + "patentde": 1, + "patenteu": 1, + "patentfr": 1, + "patentuk": 1, + "British": 4, + "patentus": 1, + "U.S": 4, + "patreq": 1, + "request": 6, + "req": 6, + "patreqde": 1, + "patreqeu": 1, + "patreqfr": 1, + "patrequk": 1, + "patrequs": 1, + "file": 3, + "library": 3, + "abstract": 4, + "annotation": 1, + "gdef": 10, + "lbx@us@mkbibrangetrunc@long#1#2": 1, + "#2year": 14, + "#2date": 4, + "iffieldsequal": 8, + "#2endyear": 22, + "csuse": 16, + "mkbibdate#1": 16, + "#2month": 10, + "#2day": 8, + "iffieldequalstr": 4, + "mbox": 4, + "#2endmonth": 8, + "#2endday": 8, + "lbx@us@mkbibrangetrunc@short#1#2": 1, + "lbx@us@mkbibrangetruncextra@long#1#2": 1, + "extrayear": 6, + "lbx@us@mkbibrangetruncextra@short#1#2": 1, "ProvidesClass": 2, - "{": 463, "problemset": 1, - "}": 469, "DeclareOption*": 2, "PassOptionsToClass": 2, "final": 2, @@ -65025,15 +67210,11 @@ "expand": 1, "@expand": 3, "ProcessOptions": 2, - "relax": 3, "LoadClass": 2, - "[": 81, "pt": 5, "letterpaper": 1, - "]": 80, "RequirePackage": 20, "top": 1, - "in": 20, "bottom": 1, "left": 15, "right": 16, @@ -65058,7 +67239,6 @@ "inserting": 3, "images.": 1, "enumerate": 2, - "the": 19, "mathtools": 2, "Required.": 7, "Loads": 1, @@ -65070,7 +67250,6 @@ "booktabs": 1, "esdiff": 1, "derivatives": 4, - "and": 5, "partial": 2, "Optional.": 1, "shortintertext.": 1, @@ -65078,28 +67257,23 @@ "customizing": 1, "headers/footers.": 1, "lastpage": 1, - "page": 4, "count": 1, "header/footer.": 1, "xcolor": 1, "setting": 3, "color": 3, - "of": 14, "hyperlinks": 2, "obeyFinal": 1, "Disable": 1, "todos": 1, - "by": 1, "option": 1, "class": 1, "@todoclr": 2, "linecolor": 1, - "red": 1, "todonotes": 1, "keeping": 1, "track": 1, "to": 16, - "-": 9, "dos.": 1, "colorlinks": 1, "true": 1, @@ -65110,12 +67284,8 @@ "hyperref": 1, "following": 2, "urls": 2, - "references": 1, - "a": 2, "document.": 1, - "url": 2, "Enables": 1, - "with": 5, "tag": 1, "all": 2, "hypcap": 1, @@ -65130,18 +67300,14 @@ "parskip": 1, "ex": 2, "Sets": 1, - "space": 8, "between": 1, "paragraphs.": 2, "parindent": 2, "Indent": 1, "first": 1, - "line": 2, - "new": 1, "let": 11, "VERBATIM": 2, "verbatim": 2, - "def": 18, "verbatim@font": 1, "small": 8, "ttfamily": 1, @@ -65159,7 +67325,6 @@ "bf": 4, "figure": 2, "subtable": 1, - "parens": 1, "subfigure": 1, "TRUE": 1, "FALSE": 1, @@ -65172,11 +67337,8 @@ "pagenumbering": 1, "arabic": 2, "shortname": 2, - "#1": 40, "authorname": 2, - "#2": 17, "coursename": 3, - "#3": 8, "assignment": 3, "#4": 4, "duedate": 2, @@ -65210,7 +67372,6 @@ "environment": 1, "problem": 1, "addtocounter": 2, - "setcounter": 5, "equation": 1, "noindent": 2, ".": 3, @@ -65225,23 +67386,16 @@ "hfill": 3, "rule": 1, "mm": 2, - "ifnum": 3, "pagebreak": 2, - "fi": 15, "show": 1, "solutions.": 1, "vspace": 2, "em": 8, "Solution.": 1, "ifnum#1": 2, - "else": 9, - "chap": 1, - "section": 2, "Sum": 3, - "n": 4, "ensuremath": 15, "sum_": 2, - "from": 5, "infsum": 2, "infty": 2, "Infinite": 1, @@ -65250,7 +67404,6 @@ "x": 4, "int_": 1, "mathrm": 1, - "d": 1, "Integrate": 1, "respect": 1, "Lim": 2, @@ -65261,7 +67414,6 @@ "infinity": 1, "f": 1, "Frac": 1, - "/": 1, "_": 1, "Slanted": 1, "fraction": 1, @@ -65318,7 +67470,6 @@ "into": 2, "mtxt": 1, "insterting": 1, - "on": 2, "either": 1, "side.": 1, "Option": 1, @@ -65359,7 +67510,6 @@ "Thesis": 5, "Class": 4, "CurrentOption": 1, - "book": 2, "AtBeginDocument": 1, "fancyhead": 5, "LE": 1, @@ -65388,7 +67538,6 @@ "This": 2, "RIGHT": 2, "side": 2, - "pages": 2, "italic": 1, "use": 1, "lowercase": 1, @@ -65402,7 +67551,6 @@ "same": 1, "thing": 1, "LEFT": 2, - "or": 1, "scshape": 2, "will": 2, "And": 1, @@ -65415,12 +67563,10 @@ "renewenvironment": 2, "addcontentsline": 5, "toc": 5, - "chapter": 9, "bibname": 2, "things": 1, "psych": 1, "majors": 1, - "comment": 1, "out": 1, "oldtheindex": 2, "theindex": 2, @@ -65430,7 +67576,6 @@ "RToldchapter": 1, "if@openright": 1, "RTcleardoublepage": 3, - "global": 2, "@topnum": 1, "z@": 2, "@afterindentfalse": 1, @@ -65475,7 +67620,6 @@ "headsep": 3, ".6in": 1, "division#1": 1, - "gdef": 6, "@division": 3, "@latex@warning@no@line": 3, "No": 3, @@ -65503,7 +67647,6 @@ "contentsname": 1, "Table": 1, "Contents": 1, - "References": 1, "l@chapter": 1, "c@tocdepth": 1, "addpenalty": 1, @@ -65511,13 +67654,11 @@ "vskip": 4, "@plus": 1, "@tempdima": 2, - "begingroup": 1, "rightskip": 1, "@pnumwidth": 3, "parfillskip": 1, "leavevmode": 1, "bfseries": 3, - "advance": 1, "leftskip": 2, "hskip": 1, "nobreak": 2, @@ -65529,11 +67670,7 @@ "mu": 2, "hb@xt@": 1, "hss": 1, - "par": 6, - "penalty": 1, - "endgroup": 1, "newenvironment": 1, - "abstract": 1, "@restonecoltrue": 1, "onecolumn": 1, "@restonecolfalse": 1, @@ -65560,7 +67697,6 @@ "maketitle": 1, "titlepage": 2, "footnoterule": 1, - "footnote": 1, "thanks": 1, "baselineskip": 2, "setbox0": 2, @@ -65595,7 +67731,11 @@ "approved": 1, "major": 1, "sign": 1, - "makebox": 6 + "makebox": 6, + "verbose.bbx": 1, + "abx@bbxid": 1, + "RequireBibliographyStyle": 1, + "authortitle": 1 }, "Tea": { "<%>": 1, @@ -69761,8 +71901,9 @@ "COBOL": 90, "CSS": 43867, "Ceylon": 50, + "Chapel": 9607, "Cirru": 244, - "Clojure": 510, + "Clojure": 1899, "CoffeeScript": 2951, "Common Lisp": 2186, "Component Pascal": 825, @@ -69770,6 +71911,7 @@ "Creole": 134, "Crystal": 1506, "Cuda": 290, + "Cycript": 251, "DM": 169, "Dart": 74, "Diff": 16, @@ -69794,7 +71936,8 @@ "Groovy": 93, "Groovy Server Pages": 91, "HTML": 413, - "Haml": 4, + "HTML+ERB": 213, + "Haml": 121, "Handlebars": 69, "Haskell": 302, "Hy": 155, @@ -69825,6 +71968,7 @@ "LiveScript": 123, "Logos": 93, "Logtalk": 36, + "LookML": 99, "Lua": 724, "M": 23615, "MTML": 93, @@ -69854,6 +71998,7 @@ "Opa": 28, "OpenCL": 144, "OpenEdge ABL": 762, + "OpenSCAD": 67, "Org": 358, "Ox": 1006, "Oxygene": 157, @@ -69863,7 +72008,7 @@ "Parrot Assembly": 6, "Parrot Internal Representation": 5, "Pascal": 30, - "Perl": 17979, + "Perl": 20690, "Perl6": 372, "Pike": 1835, "Pod": 658, @@ -69889,6 +72034,7 @@ "Rust": 3566, "SAS": 93, "SCSS": 39, + "SQF": 196, "SQL": 1485, "STON": 100, "Sass": 56, @@ -69912,7 +72058,7 @@ "SystemVerilog": 541, "TXL": 213, "Tcl": 1133, - "TeX": 2701, + "TeX": 8549, "Tea": 3, "Turing": 44, "TypeScript": 109, @@ -69961,8 +72107,9 @@ "COBOL": 4, "CSS": 2, "Ceylon": 1, + "Chapel": 5, "Cirru": 9, - "Clojure": 7, + "Clojure": 8, "CoffeeScript": 9, "Common Lisp": 3, "Component Pascal": 2, @@ -69970,6 +72117,7 @@ "Creole": 1, "Crystal": 3, "Cuda": 2, + "Cycript": 1, "DM": 1, "Dart": 1, "Diff": 1, @@ -69994,7 +72142,8 @@ "Groovy": 5, "Groovy Server Pages": 4, "HTML": 2, - "Haml": 1, + "HTML+ERB": 2, + "Haml": 2, "Handlebars": 2, "Haskell": 3, "Hy": 2, @@ -70025,6 +72174,7 @@ "LiveScript": 1, "Logos": 1, "Logtalk": 1, + "LookML": 1, "Lua": 3, "M": 29, "MTML": 1, @@ -70054,6 +72204,7 @@ "Opa": 2, "OpenCL": 2, "OpenEdge ABL": 5, + "OpenSCAD": 2, "Org": 1, "Ox": 3, "Oxygene": 1, @@ -70063,7 +72214,7 @@ "Parrot Assembly": 1, "Parrot Internal Representation": 1, "Pascal": 1, - "Perl": 15, + "Perl": 17, "Perl6": 3, "Pike": 2, "Pod": 1, @@ -70089,6 +72240,7 @@ "Rust": 1, "SAS": 2, "SCSS": 1, + "SQF": 2, "SQL": 5, "STON": 7, "Sass": 2, @@ -70112,7 +72264,7 @@ "SystemVerilog": 4, "TXL": 1, "Tcl": 2, - "TeX": 2, + "TeX": 5, "Tea": 1, "Turing": 1, "TypeScript": 3, @@ -70137,5 +72289,5 @@ "fish": 3, "wisp": 1 }, - "md5": "1edee1d2c454fb877027ae980cd163ef" + "md5": "3b349c5b6b0d9369054035bf0a734463" } \ No newline at end of file diff --git a/lib/linguist/vendor.yml b/lib/linguist/vendor.yml index 1da5b60c..13f705c6 100644 --- a/lib/linguist/vendor.yml +++ b/lib/linguist/vendor.yml @@ -36,6 +36,10 @@ # Bootstrap minified css and js - (^|/)bootstrap([^.]*)(\.min)?\.(js|css)$ +# Font Awesome +- font-awesome.min.css +- font-awesome.css + # Foundation css - foundation.min.css - foundation.css @@ -47,6 +51,10 @@ - (^|/)[Bb]ourbon/.*\.css$ - (^|/)[Bb]ourbon/.*\.scss$ +# Animate.css +- animate.css +- animate.min.css + # Vendored dependencies - thirdparty/ - vendors?/ @@ -116,6 +124,10 @@ - (^|/)modernizr\-\d\.\d+(\.\d+)?(\.min)?\.js$ - (^|/)modernizr\.custom\.\d+\.js$ +# Knockout +- (^|/)knockout-(\d+\.){3}(debug\.)?js$ +- knockout-min.js + ## Python ## # django diff --git a/lib/linguist/version.rb b/lib/linguist/version.rb index 217ac4f3..05d68a15 100644 --- a/lib/linguist/version.rb +++ b/lib/linguist/version.rb @@ -1,3 +1,3 @@ module Linguist - VERSION = "3.1.0" + VERSION = "3.1.1" end diff --git a/samples/Chapel/distributions.chpl b/samples/Chapel/distributions.chpl new file mode 100644 index 00000000..a3e5f81d --- /dev/null +++ b/samples/Chapel/distributions.chpl @@ -0,0 +1,304 @@ +// +// Distributions Primer +// +// This primer demonstrates uses of some of Chapel's standard +// distributions. To use these distributions in a Chapel program, +// the respective module must be used: +// +use BlockDist, CyclicDist, BlockCycDist, ReplicatedDist; +use DimensionalDist2D, ReplicatedDim, BlockCycDim; + +// +// For each distribution, we'll create a distributed domain and array +// and then initialize it just to give a brief flavor of how the +// distribution maps across locales. Running this example on 6 +// locales does a nice job of illustrating the distribution +// characteristics. +// +// All of these distributions support options to map to a different +// virtual locale grid than the one used by default (a +// multidimensional factoring of the built-in Locales array), as well +// as to control the amount of parallelism used in data parallel +// loops. See the Standard Distributions chapter of the language spec +// for more details. +// + +// +// Make the program size configurable from the command line. +// +config const n = 8; + +// +// Declare a 2-dimensional domain Space that we will later use to +// initialize the distributed domains. +// +const Space = {1..n, 1..n}; + +// +// The Block distribution distributes a bounding box from +// n-dimensional space across the target locale array viewed as an +// n-dimensional virtual locale grid. The bounding box is blocked +// into roughly equal portions across the locales. Note that domains +// declared over a Block distribution can also store indices outside +// of the bounding box; the bounding box is merely used to compute +// the blocking of space. +// +// In this example, we declare a 2-dimensional Block-distributed +// domain BlockSpace and a Block-distributed array BA declared over +// the domain. +// +const BlockSpace = Space dmapped Block(boundingBox=Space); +var BA: [BlockSpace] int; + +// +// To illustrate how the index set is distributed across locales, +// we'll use a forall loop to initialize each array element to the +// locale ID that stores that index/element/iteration. +// +forall ba in BA do + ba = here.id; + +// +// Output the Block-distributed array to visually see how the elements +// are partitioned across the locales. +// +writeln("Block Array Index Map"); +writeln(BA); +writeln(); + +// +// Most of Chapel's standard distributions support an optional +// targetLocales argument that permits you to pass in your own +// array of locales to be targeted. In general, the targetLocales +// argument should match the rank of the distribution. So for +// example, to map a Block to a [numLocales x 1] view of the +// locale set, one could do something like this: + +// +// We start by creating our own array of the locale values. Here +// we use the standard array reshape function for convenience, +// but more generally, this array could be accessed/assigned like any +// other. +// + +var MyLocaleView = {0..#numLocales, 1..1}; +var MyLocales: [MyLocaleView] locale = reshape(Locales, MyLocaleView); + +// +// Then we'll declare a distributed domain/array that targets +// this view of the locales: +// + +const BlockSpace2 = Space dmapped Block(boundingBox=Space, + targetLocales=MyLocales); +var BA2: [BlockSpace2] int; + +// +// Then we'll do a similar computation as before to verify where +// everything ended up: +// +forall ba in BA2 do + ba = here.id; + +writeln("Block Array Index Map"); +writeln(BA2); +writeln(); + + + +// +// Next, we'll perform a similar computation for the Cyclic distribution. +// Cyclic distributions start at a designated n-dimensional index and +// distribute the n-dimensional space across an n-dimensional array +// of locales in a round-robin fashion (in each dimension). As with +// the Block distribution, domains may be declared using the +// distribution who have lower indices that the starting index; that +// value should just be considered a parameterization of how the +// distribution is defined. +// +const CyclicSpace = Space dmapped Cyclic(startIdx=Space.low); +var CA: [CyclicSpace] int; + +forall ca in CA do + ca = here.id; + +writeln("Cyclic Array Index Map"); +writeln(CA); +writeln(); + + +// +// Next, we'll declare a Block-Cyclic distribution. These +// distributions also deal out indices in a round-robin fashion, +// but rather than dealing out singleton indices, they deal out blocks +// of indices. Thus, the BlockCyclic distribution is parameterized +// by a starting index (as with Cyclic) and a block size (per +// dimension) specifying how large the chunks to be dealt out are. +// +const BlkCycSpace = Space dmapped BlockCyclic(startIdx=Space.low, + blocksize=(2, 3)); +var BCA: [BlkCycSpace] int; + +forall bca in BCA do + bca = here.id; + +writeln("Block-Cyclic Array Index Map"); +writeln(BCA); +writeln(); + + +// +// The ReplicatedDist distribution is different: each of the +// original domain's indices - and the corresponding array elements - +// is replicated onto each locale. (Note: consistency among these +// array replicands is NOT maintained automatically.) +// +// This replication is observable in some cases but not others, +// as shown below. Note: this behavior may change in the future. +// +const ReplicatedSpace = Space dmapped ReplicatedDist(); +var RA: [ReplicatedSpace] int; + +// The replication is observable - this visits each replicand. +forall ra in RA do + ra = here.id; + +writeln("Replicated Array Index Map, ", RA.numElements, " elements total"); +writeln(RA); +writeln(); + +// +// The replication is observable when the replicated array is +// on the left-hand side. If the right-hand side is not replicated, +// it is copied into each replicand. +// We illustrate this using a non-distributed array. +// +var A: [Space] int = [(i,j) in Space] i*100 + j; +RA = A; +writeln("Replicated Array after being array-assigned into"); +writeln(RA); +writeln(); + +// +// Analogously, each replicand will be visited and +// other participated expressions will be computed on each locale +// (a) when the replicated array is assigned a scalar: +// RA = 5; +// (b) when it appears first in a zippered forall loop: +// forall (ra, a) in zip(RA, A) do ...; +// (c) when it appears in a for loop: +// for ra in RA do ...; +// +// Zippering (RA,A) or (A,RA) in a 'for' loop will generate +// an error due to their different number of elements. + +// Let RA store the Index Map again, for the examples below. +forall ra in RA do + ra = here.id; + +// +// Only the local replicand is accessed - replication is NOT observable +// and consistency is NOT maintained - when: +// (a) the replicated array is indexed - an individual element is read... +// +on Locales(0) do + writeln("on ", here, ": ", RA(Space.low)); +on Locales(LocaleSpace.high) do + writeln("on ", here, ": ", RA(Space.low)); +writeln(); + +// ...or an individual element is written; +on Locales(LocaleSpace.high) do + RA(Space.low) = 7777; + +writeln("Replicated Array after being indexed into"); +writeln(RA); +writeln(); + +// +// (b) the replicated array is on the right-hand side of an assignment... +// +on Locales(LocaleSpace.high) do + A = RA + 4; +writeln("Non-Replicated Array after assignment from Replicated Array + 4"); +writeln(A); +writeln(); + +// +// (c) ...or, generally, the replicated array or domain participates +// in a zippered forall loop, but not in the first position. +// The loop could look like: +// +// forall (a, (i,j), ra) in (A, ReplicatedSpace, RA) do ...; +// + + +// +// The DimensionalDist2D distribution lets us build a 2D distribution +// as a composition of specifiers for individual dimensions. +// Under such a "dimensional" distribution each dimension is handled +// independently of the other. +// +// The dimension specifiers are similar to the corresponding multi-dimensional +// distributions in constructor arguments and index-to-locale mapping rules. +// However, instead of an array of locales, a specifier constructor +// accepts just the number of locales that the indices in the corresponding +// dimension will be distributed across. +// +// The DimensionalDist2D constructor requires: +// * an [0..nl1-1, 0..nl2-1] array of locales, where +// nl1 and nl2 are the number of locales in each dimension, and +// * two dimension specifiers, created for nl1 and nl2 locale counts, resp. +// +// Presently, the following dimension specifiers are available +// (shown here with their constructor arguments): +// +// * ReplicatedDim(numLocales) +// * BlockDim(numLocales, boundingBoxLow, boundingBoxHigh) +// * BlockCyclicDim(lowIdx, blockSize, numLocales) +// + +// +// The following example creates a dimensional distribution that +// replicates over 2 locales (when available) in the first dimemsion +// and distributes using block-cyclic distribution in the second dimension. +// The example computes nl1 and nl2 and reshapes MyLocales correspondingly. +// + +var (nl1, nl2) = if numLocales == 1 then (1, 1) else (2, numLocales/2); +MyLocaleView = {0..#nl1, 0..#nl2}; +MyLocales = reshape(Locales[0..#nl1*nl2], MyLocaleView); + +const DimReplicatedBlockcyclicSpace = Space + dmapped DimensionalDist2D(MyLocales, + new ReplicatedDim(numLocales = nl1), + new BlockCyclicDim(numLocales = nl2, + lowIdx = 1, blockSize = 2)); + +var DRBA: [DimReplicatedBlockcyclicSpace] int; + +// The ReplicatedDim specifier always accesses the local replicand. +// (This differs from how the ReplicatedDist distribution works.) +// +// This example visits each replicand. The behavior is the same +// regardless of the second index into MyLocales below. + +for locId1 in 0..#nl1 do on MyLocales[locId1, 0] { + + forall drba in DRBA do + drba = here.id; + + writeln("Dimensional2D(Replicated,BlockCyclic) Array Index Map", + " from ", here); + + // Technicality: 'writeln(DRBA)' would read DRBA always on Locale 0. + // Since we want to see what DRBA contains on the current locale, + // we use 'Helper' that is mapped using the default distribution. + // 'Helper = DRBA' captures the view of DRBA on the current locale, + // which we then print out. + + const Helper: [Space] int = DRBA; + writeln(Helper); + writeln(); + +} diff --git a/samples/Chapel/hello.chpl b/samples/Chapel/hello.chpl new file mode 100644 index 00000000..cc98e786 --- /dev/null +++ b/samples/Chapel/hello.chpl @@ -0,0 +1 @@ +writeln("Hello, world!"); // print 'Hello, world!' to the console diff --git a/samples/Chapel/lulesh.chpl b/samples/Chapel/lulesh.chpl new file mode 100644 index 00000000..d6480d26 --- /dev/null +++ b/samples/Chapel/lulesh.chpl @@ -0,0 +1,1692 @@ +/* + Derived from the DARPA/Livermore Unstructured Lagrangian Explicit + Shock Hydrodynamics (LULESH) + https://computation.llnl.gov/casc/ShockHydro/ + + Original port to Chapel by Brandon Holt (8/2011). Further + improvements for the sake of performance and/or generality made by + Sung-Eun Choi (12/2011, 11/2012), Jeff Keasler (3/2012), and Brad + Chamberlain (3-4,9-11/2012, 2/2013). + + + Notes on the Initial Implementation + ----------------------------------- + + This implementation was designed to mirror the overall structure of + the C++ Lulesh but use Chapel constructs where they can help make + the code more readable, easier to maintain, or more + 'elegant'. Function names are preserved for the most part, with some + additional helper functions, and original comments from the C++ code + are interspersed approximately where they belong to give an idea of + how the two codes line up. One major difference for this Chapel + version is the use of a number of module-level variables and + constants. + + + Status: + + This code remains a work-in-progress as we gain further experience + with it. Proposed improvements are noted in the README in this + directory and (in some cases) in TODO comments in the code. + + */ + + + +use Time, // to get timing routines for benchmarking + BlockDist; // for block-distributed arrays + +use luleshInit; // initialization code for data set + +/* The configuration parameters for lulesh. These can be set on the + compiler command line using -s=. For example, + + chpl -suseBlockDist=true + + useBlockDist : says whether or not to block-distribute the arrays. + The default is based on the value of CHPL_COMM, as + an indication of whether this is a single- or multi- + locale execution. + + use3DRepresentation : indicates whether the element node arrays + should be stored using a 3D representation + (limiting the execution to cube inputs) or + the more general 1D representation (supporting + arbitrary data sets). + + useSparseMaterials : indicates whether sparse domains/arrays should be + used to represent the materials. Sparse domains + are more realistic in that they permit an arbitrary + subset of the problem space to store a material. + Dense domains are sufficient for LULESH since there's + an assumption that the material spans all cells. + + printWarnings : prints performance-oriented warnings to prevent + surprises. +*/ + +config param useBlockDist = (CHPL_COMM != "none"), + use3DRepresentation = false, + useSparseMaterials = true, + printWarnings = true; + + +// +// Sanity check to ensure that input files aren't used with the 3D +// representation +// +if (use3DRepresentation && (luleshInit.filename != "")) then + halt("The 3D representation does not support reading input from files"); + + +/* Configuration constants: Override defaults on executable's command-line */ + +config const initialEnergy = 3.948746e+7; // initial energy value + + +config const showProgress = false, // print time and dt values on each step + debug = false, // print various debug info + doTiming = true, // time the main timestep loop + printCoords = true; // print the final computed coordinates + + +/* Compile-time constants */ + +param XI_M = 0x003, + XI_M_SYMM = 0x001, + XI_M_FREE = 0x002, + + XI_P = 0x00c, + XI_P_SYMM = 0x004, + XI_P_FREE = 0x008, + + ETA_M = 0x030, + ETA_M_SYMM = 0x010, + ETA_M_FREE = 0x020, + + ETA_P = 0x0c0, + ETA_P_SYMM = 0x040, + ETA_P_FREE = 0x080, + + ZETA_M = 0x300, + ZETA_M_SYMM = 0x100, + ZETA_M_FREE = 0x200, + + ZETA_P = 0xc00, + ZETA_P_SYMM = 0x400, + ZETA_P_FREE = 0x800; + + +/* Set up the problem size */ + +const (numElems, numNodes) = initProblemSize(); + + +/* Declare abstract problem domains */ + +const ElemSpace = if use3DRepresentation + then {0..#elemsPerEdge, 0..#elemsPerEdge, 0..#elemsPerEdge} + else {0..#numElems}, + NodeSpace = if use3DRepresentation + then {0..#nodesPerEdge, 0..#nodesPerEdge, 0..#nodesPerEdge} + else {0..#numNodes}; + + +/* Declare the (potentially distributed) problem domains */ + +const Elems = if useBlockDist then ElemSpace dmapped Block(ElemSpace) + else ElemSpace, + Nodes = if useBlockDist then NodeSpace dmapped Block(NodeSpace) + else NodeSpace; + + +/* The coordinates */ + +var x, y, z: [Nodes] real; + + +/* The number of nodes per element. In a rank-independent version, + this could be written 2**rank */ + +param nodesPerElem = 8; + + +// We could name this, but chose not to since it doesn't add that much clarity +// +// const elemNeighbors = 1..nodesPerElem; + + +/* The element-to-node mapping */ + +var elemToNode: [Elems] nodesPerElem*index(Nodes); + + +/* the Greek variables */ + +var lxim, lxip, letam, letap, lzetam, lzetap: [Elems] index(Elems); + + +/* the X, Y, Z Symmetry values */ + +var XSym, YSym, ZSym: sparse subdomain(Nodes); + + + +/* Constants */ + +const u_cut = 1.0e-7, /* velocity tolerance */ + hgcoef = 3.0, /* hourglass control */ + qstop = 1.0e+12, /* excessive q indicator */ + monoq_max_slope = 1.0, + monoq_limiter_mult = 2.0, + e_cut = 1.0e-7, /* energy tolerance */ + p_cut = 1.0e-7, /* pressure tolerance */ + ss4o3 = 4.0/3.0, + q_cut = 1.0e-7, /* q tolerance */ + v_cut = 1.0e-10, /* relative volume tolerance */ + qlc_monoq = 0.5, /* linear term coef for q */ + qqc_monoq = 2.0/3.0, /* quadratic term coef for q */ + qqc = 2.0, + qqc2 = 64.0 * qqc**2, + eosvmax = 1.0e+9, + eosvmin = 1.0e-9, + pmin = 0.0, /* pressure floor */ + emin = -1.0e+15, /* energy floor */ + dvovmax = 0.1, /* maximum allowable volume change */ + refdens = 1.0, /* reference density */ + + deltatimemultlb = 1.1, + deltatimemultub = 1.2, + dtmax = 1.0e-2; /* maximum allowable time increment */ + + +config const stoptime = 1.0e-2, /* end time for simulation */ + maxcycles = max(int), /* max number of cycles to simulate */ + dtfixed = -1.0e-7; /* fixed time increment */ + + +/* The list of material elements */ + +const MatElems: MatElemsType = if useSparseMaterials then enumerateMatElems() + else Elems; + + +proc MatElemsType type { + if useSparseMaterials { + if (printWarnings && useBlockDist && numLocales > 1) then + writeln("WARNING: The LULESH Material Elements (MatElems) are not yet\n", + " distributed, so result in excessive memory use on,\n", + " and communication with, locale 0\n"); + return sparse subdomain(Elems); + } else + return Elems.type; +} + +iter enumerateMatElems() { + if (printWarnings && useBlockDist && numLocales > 1) then + writeln("WARNING: generation of matrix elements is serial and\n", + " unlikely to scale"); + for i in Elems do + yield i; +} + + +/* Element fields */ + +var elemBC: [Elems] int, + + e: [Elems] real, // energy + p: [Elems] real, // pressure + + q: [Elems] real, // q + ql: [Elems] real, // linear term for q + qq: [Elems] real, // quadratic term for q + + v: [Elems] real = 1.0, //relative volume + vnew: [Elems] real, + + volo: [Elems] real, // reference volume + delv: [Elems] real, // m_vnew - m_v + vdov: [Elems] real, // volume derivative over volume + + arealg: [Elems] real, // elem characteristic length + + ss: [Elems] real, // "sound speed" + + elemMass: [Elems] real; // mass + + +/* Nodal fields */ + +var xd, yd, zd: [Nodes] real, // velocities + + xdd, ydd, zdd: [Nodes] real, // acceleration + + fx, fy, fz: [Nodes] atomic real, // forces + + nodalMass: [Nodes] real; // mass + + +/* Parameters */ + +var time = 0.0, // current time + deltatime = 1.0e-7, // variable time increment + dtcourant = 1.0e20, // courant constraint + dthydro = 1.0e20, // volume change constraint + + cycle = 0; // iteration count for simulation + + +proc main() { + if debug then writeln("Lulesh -- Problem Size = ", numElems); + + initLulesh(); + + var st: real; + if doTiming then st = getCurrentTime(); + while (time < stoptime && cycle < maxcycles) { + const iterTime = if showProgress then getCurrentTime() else 0.0; + + TimeIncrement(); + + LagrangeLeapFrog(); + + if debug { + // deprint("[[ Forces ]]", fx, fy, fz); + deprint("[[ Positions ]]", x, y, z); + deprint("[[ p, e, q ]]", p, e, q); + } + if showProgress then + writeln("time = ", format("%e", time), ", dt=", format("%e", deltatime), + if doTiming then ", elapsed = " + (getCurrentTime()-iterTime) + else ""); + } + if (cycle == maxcycles) { + writeln("Stopped early due to reaching maxnumsteps"); + } + if doTiming { + const et = getCurrentTime(); + writeln("Total Time: ", et-st); + writeln("Time/Cycle: ", (et-st)/cycle); + } + writeln("Number of cycles: ", cycle); + + if printCoords { + var outfile = open("coords.out", iomode.cw); + var writer = outfile.writer(); + var fmtstr = if debug then "%1.9e" else "%1.4e"; + for i in Nodes { + writer.writeln(format(fmtstr, x[i]), " ", + format(fmtstr, y[i]), " ", + format(fmtstr, z[i])); + } + writer.close(); + outfile.close(); + } +} + + +/* Initialization functions */ + +proc initLulesh() { + // initialize the coordinates + initCoordinates(x,y,z); + + // initialize the element to node mapping + initElemToNodeMapping(elemToNode); + + // initialize the greek symbols + initGreekVars(lxim, lxip, letam, letap, lzetam, lzetap); + + // initialize the symmetry plane locations + initXSyms(XSym); + initYSyms(YSym); + initZSyms(ZSym); + + /* embed hexehedral elements in nodal point lattice */ + //calculated on the fly using: elemToNodes(i: index(Elems)): index(Nodes) + + // initialize the masses + initMasses(); + + // initialize the boundary conditions + const octantCorner = initBoundaryConditions(); + + // deposit the energy for Sedov Problem + e[octantCorner] = initialEnergy; +} + + +proc initMasses() { + // This is a temporary array used to accumulate masses in parallel + // without losing updates by using 'atomic' variables + var massAccum: [Nodes] atomic real; + + forall eli in Elems { + var x_local, y_local, z_local: 8*real; + localizeNeighborNodes(eli, x, x_local, y, y_local, z, z_local); + + const volume = CalcElemVolume(x_local, y_local, z_local); + volo[eli] = volume; + elemMass[eli] = volume; + + for neighbor in elemToNodes[eli] do + massAccum[neighbor].add(volume); + } + + // When we're done, copy the accumulated masses into nodalMass, at + // which point the massAccum array can go away (and will at the + // procedure's return + + forall i in Nodes do + nodalMass[i] = massAccum[i].read() / 8.0; + + if debug { + writeln("ElemMass:"); + for mass in elemMass do writeln(mass); + + writeln("NodalMass:"); + for mass in nodalMass do writeln(mass); + } +} + + +proc initBoundaryConditions() { + var surfaceNode: [Nodes] int; + + forall n in XSym do + surfaceNode[n] = 1; + forall n in YSym do + surfaceNode[n] = 1; + forall n in ZSym do + surfaceNode[n] = 1; + + forall e in Elems do { + var mask: int; + for i in 1..nodesPerElem do + mask += surfaceNode[elemToNode[e][i]] << (i-1); + + // TODO: make an inlined function for this little idiom? (and below) + + if ((mask & 0x0f) == 0x0f) then elemBC[e] |= ZETA_M_SYMM; + if ((mask & 0xf0) == 0xf0) then elemBC[e] |= ZETA_P_SYMM; + if ((mask & 0x33) == 0x33) then elemBC[e] |= ETA_M_SYMM; + if ((mask & 0xcc) == 0xcc) then elemBC[e] |= ETA_P_SYMM; + if ((mask & 0x99) == 0x99) then elemBC[e] |= XI_M_SYMM; + if ((mask & 0x66) == 0x66) then elemBC[e] |= XI_P_SYMM; + } + + + // + // We find the octant corner by looking for the element with + // all three SYMM flags set, which will have the largest + // integral value. Thus, we can use a maxloc to identify it. + // + const (check, loc) = maxloc reduce zip(elemBC, Elems); + + if debug then writeln("Found the octant corner at: ", loc); + + if (check != (XI_M_SYMM | ETA_M_SYMM | ZETA_M_SYMM)) then + halt("maxloc got a value of ", check, " at loc ", loc); + + // TODO: This is an example of an array that, in a distributed + // memory code, would typically be completely local and only storing + // the local nodes owned by the locale -- noting that some nodes + // are logically owned by multiple locales and therefore would + // redundantly be stored in both locales' surfaceNode arrays -- it's + // essentially local scratchspace that does not need to be communicated + // or kept coherent across locales. + // + + surfaceNode = 0; + + /* the free surfaces */ + + var freeSurface: sparse subdomain(Nodes); + + // initialize the free surface + initFreeSurface(freeSurface); + + forall n in freeSurface do + surfaceNode[n] = 1; + + forall e in Elems do { + var mask: int; + for i in 1..nodesPerElem do + mask += surfaceNode[elemToNode[e][i]] << (i-1); + + if ((mask & 0x0f) == 0x0f) then elemBC[e] |= ZETA_M_FREE; + if ((mask & 0xf0) == 0xf0) then elemBC[e] |= ZETA_P_FREE; + if ((mask & 0x33) == 0x33) then elemBC[e] |= ETA_M_FREE; + if ((mask & 0xcc) == 0xcc) then elemBC[e] |= ETA_P_FREE; + if ((mask & 0x99) == 0x99) then elemBC[e] |= XI_M_FREE; + if ((mask & 0x66) == 0x66) then elemBC[e] |= XI_P_FREE; + } + + if debug { + writeln("elemBC:"); + for b in elemBC do writeln(b); + } + + return loc; +} + + +/* Helper functions */ + +inline proc localizeNeighborNodes(eli: index(Elems), + x: [] real, ref x_local: 8*real, + y: [] real, ref y_local: 8*real, + z: [] real, ref z_local: 8*real) { + + for param i in 1..nodesPerElem { + const noi = elemToNode[eli][i]; + + x_local[i] = x[noi]; + y_local[i] = y[noi]; + z_local[i] = z[noi]; + } +} + +inline proc TripleProduct(x1, y1, z1, x2, y2, z2, x3, y3, z3) { + return x1*(y2*z3 - z2*y3) + x2*(z1*y3 - y1*z3) + x3*(y1*z2 - z1*y2); +} + + +proc CalcElemVolume(x, y, z) { + const dx61 = x[7] - x[2], + dy61 = y[7] - y[2], + dz61 = z[7] - z[2], + + dx70 = x[8] - x[1], + dy70 = y[8] - y[1], + dz70 = z[8] - z[1], + + dx63 = x[7] - x[4], + dy63 = y[7] - y[4], + dz63 = z[7] - z[4], + + dx20 = x[3] - x[1], + dy20 = y[3] - y[1], + dz20 = z[3] - z[1], + + dx50 = x[6] - x[1], + dy50 = y[6] - y[1], + dz50 = z[6] - z[1], + + dx64 = x[7] - x[5], + dy64 = y[7] - y[5], + dz64 = z[7] - z[5], + + dx31 = x[4] - x[2], + dy31 = y[4] - y[2], + dz31 = z[4] - z[2], + + dx72 = x[8] - x[3], + dy72 = y[8] - y[3], + dz72 = z[8] - z[3], + + dx43 = x[5] - x[4], + dy43 = y[5] - y[4], + dz43 = z[5] - z[4], + + dx57 = x[6] - x[8], + dy57 = y[6] - y[8], + dz57 = z[6] - z[8], + + dx14 = x[2] - x[5], + dy14 = y[2] - y[5], + dz14 = z[2] - z[5], + + dx25 = x[3] - x[6], + dy25 = y[3] - y[6], + dz25 = z[3] - z[6]; + + const volume = TripleProduct(dx31 + dx72, dx63, dx20, + dy31 + dy72, dy63, dy20, + dz31 + dz72, dz63, dz20) + + TripleProduct(dx43 + dx57, dx64, dx70, + dy43 + dy57, dy64, dy70, + dz43 + dz57, dz64, dz70) + + TripleProduct(dx14 + dx25, dx61, dx50, + dy14 + dy25, dy61, dy50, + dz14 + dz25, dz61, dz50); + + return volume / 12.0; +} + +proc InitStressTermsForElems(p, q, sigxx, sigyy, sigzz: [?D] real) { + forall i in D { + sigxx[i] = -p[i] - q[i]; + sigyy[i] = -p[i] - q[i]; + sigzz[i] = -p[i] - q[i]; + } +} + + +proc CalcElemShapeFunctionDerivatives(x: 8*real, y: 8*real, z: 8*real, + ref b_x: 8*real, + ref b_y: 8*real, + ref b_z: 8*real, + ref volume: real) { + + const fjxxi = .125 * ((x[7]-x[1]) + (x[6]-x[4]) - (x[8]-x[2]) - (x[5]-x[3])), + fjxet = .125 * ((x[7]-x[1]) - (x[6]-x[4]) + (x[8]-x[2]) - (x[5]-x[3])), + fjxze = .125 * ((x[7]-x[1]) + (x[6]-x[4]) + (x[8]-x[2]) + (x[5]-x[3])), + + fjyxi = .125 * ((y[7]-y[1]) + (y[6]-y[4]) - (y[8]-y[2]) - (y[5]-y[3])), + fjyet = .125 * ((y[7]-y[1]) - (y[6]-y[4]) + (y[8]-y[2]) - (y[5]-y[3])), + fjyze = .125 * ((y[7]-y[1]) + (y[6]-y[4]) + (y[8]-y[2]) + (y[5]-y[3])), + + fjzxi = .125 * ((z[7]-z[1]) + (z[6]-z[4]) - (z[8]-z[2]) - (z[5]-z[3])), + fjzet = .125 * ((z[7]-z[1]) - (z[6]-z[4]) + (z[8]-z[2]) - (z[5]-z[3])), + fjzze = .125 * ((z[7]-z[1]) + (z[6]-z[4]) + (z[8]-z[2]) + (z[5]-z[3])); + + /* compute cofactors */ + const cjxxi = (fjyet * fjzze) - (fjzet * fjyze), + cjxet = - (fjyxi * fjzze) + (fjzxi * fjyze), + cjxze = (fjyxi * fjzet) - (fjzxi * fjyet), + + cjyxi = - (fjxet * fjzze) + (fjzet * fjxze), + cjyet = (fjxxi * fjzze) - (fjzxi * fjxze), + cjyze = - (fjxxi * fjzet) + (fjzxi * fjxet), + + cjzxi = (fjxet * fjyze) - (fjyet * fjxze), + cjzet = - (fjxxi * fjyze) + (fjyxi * fjxze), + cjzze = (fjxxi * fjyet) - (fjyxi * fjxet); + + /* calculate partials : + this need only be done for l = 0,1,2,3 since , by symmetry , + (6,7,4,5) = - (0,1,2,3) . + */ + b_x[1] = - cjxxi - cjxet - cjxze; + b_x[2] = cjxxi - cjxet - cjxze; + b_x[3] = cjxxi + cjxet - cjxze; + b_x[4] = - cjxxi + cjxet - cjxze; + b_x[5] = -b_x[3]; + b_x[6] = -b_x[4]; + b_x[7] = -b_x[1]; + b_x[8] = -b_x[2]; + + b_y[1] = - cjyxi - cjyet - cjyze; + b_y[2] = cjyxi - cjyet - cjyze; + b_y[3] = cjyxi + cjyet - cjyze; + b_y[4] = - cjyxi + cjyet - cjyze; + b_y[5] = -b_y[3]; + b_y[6] = -b_y[4]; + b_y[7] = -b_y[1]; + b_y[8] = -b_y[2]; + + b_z[1] = - cjzxi - cjzet - cjzze; + b_z[2] = cjzxi - cjzet - cjzze; + b_z[3] = cjzxi + cjzet - cjzze; + b_z[4] = - cjzxi + cjzet - cjzze; + b_z[5] = -b_z[3]; + b_z[6] = -b_z[4]; + b_z[7] = -b_z[1]; + b_z[8] = -b_z[2]; + + /* calculate jacobian determinant (volume) */ + volume = 8.0 * ( fjxet * cjxet + fjyet * cjyet + fjzet * cjzet); +} + + +proc CalcElemNodeNormals(ref pfx: 8*real, ref pfy: 8*real, ref pfz: 8*real, + x: 8*real, y: 8*real, z: 8*real) { + + proc ElemFaceNormal(param n1, param n2, param n3, param n4) { + const bisectX0 = 0.5 * (x[n4] + x[n3] - x[n2] - x[n1]), + bisectY0 = 0.5 * (y[n4] + y[n3] - y[n2] - y[n1]), + bisectZ0 = 0.5 * (z[n4] + z[n3] - z[n2] - z[n1]), + bisectX1 = 0.5 * (x[n3] + x[n2] - x[n4] - x[n1]), + bisectY1 = 0.5 * (y[n3] + y[n2] - y[n4] - y[n1]), + bisectZ1 = 0.5 * (z[n3] + z[n2] - z[n4] - z[n1]), + areaX = 0.25 * (bisectY0 * bisectZ1 - bisectZ0 * bisectY1), + areaY = 0.25 * (bisectZ0 * bisectX1 - bisectX0 * bisectZ1), + areaZ = 0.25 * (bisectX0 * bisectY1 - bisectY0 * bisectX1); + + var rx, ry, rz: 8*real; //results + + (rx[n1], rx[n2], rx[n3], rx[n4]) = (areaX, areaX, areaX, areaX); + (ry[n1], ry[n2], ry[n3], ry[n4]) = (areaY, areaY, areaY, areaY); + (rz[n1], rz[n2], rz[n3], rz[n4]) = (areaZ, areaZ, areaZ, areaZ); + + return (rx, ry, rz); + } + + // calculate total normal from each face (faces are made up of + // combinations of nodes) + + (pfx, pfy, pfz) = ElemFaceNormal(1,2,3,4) + ElemFaceNormal(1,5,6,2) + + ElemFaceNormal(2,6,7,3) + ElemFaceNormal(3,7,8,4) + + ElemFaceNormal(4,8,5,1) + ElemFaceNormal(5,8,7,6); +} + + +proc SumElemStressesToNodeForces(b_x: 8*real, b_y: 8*real, b_z: 8*real, + stress_xx:real, + stress_yy:real, + stress_zz: real, + ref fx: 8*real, + ref fy: 8*real, + ref fz: 8*real) { + for param i in 1..8 { + fx[i] = -(stress_xx * b_x[i]); + fy[i] = -(stress_yy * b_y[i]); + fz[i] = -(stress_zz * b_z[i]); + } +} + +proc CalcElemVolumeDerivative(x: 8*real, y: 8*real, z: 8*real) { + + proc VoluDer(param n0, param n1, param n2, param n3, param n4, param n5) { + const ox = (y[n1] + y[n2]) * (z[n0] + z[n1]) + - (y[n0] + y[n1]) * (z[n1] + z[n2]) + + (y[n0] + y[n4]) * (z[n3] + z[n4]) + - (y[n3] + y[n4]) * (z[n0] + z[n4]) + - (y[n2] + y[n5]) * (z[n3] + z[n5]) + + (y[n3] + y[n5]) * (z[n2] + z[n5]), + oy = - (x[n1] + x[n2]) * (z[n0] + z[n1]) + + (x[n0] + x[n1]) * (z[n1] + z[n2]) + - (x[n0] + x[n4]) * (z[n3] + z[n4]) + + (x[n3] + x[n4]) * (z[n0] + z[n4]) + + (x[n2] + x[n5]) * (z[n3] + z[n5]) + - (x[n3] + x[n5]) * (z[n2] + z[n5]), + oz = - (y[n1] + y[n2]) * (x[n0] + x[n1]) + + (y[n0] + y[n1]) * (x[n1] + x[n2]) + - (y[n0] + y[n4]) * (x[n3] + x[n4]) + + (y[n3] + y[n4]) * (x[n0] + x[n4]) + + (y[n2] + y[n5]) * (x[n3] + x[n5]) + - (y[n3] + y[n5]) * (x[n2] + x[n5]); + + return (ox/12.0, oy/12.0, oz/12.0); + } + + var dvdx, dvdy, dvdz: 8*real; + + (dvdx[1], dvdy[1], dvdz[1]) = VoluDer(2,3,4,5,6,8); + (dvdx[4], dvdy[4], dvdz[4]) = VoluDer(1,2,3,8,5,7); + (dvdx[3], dvdy[3], dvdz[3]) = VoluDer(4,1,2,7,8,6); + (dvdx[2], dvdy[2], dvdz[2]) = VoluDer(3,4,1,6,7,5); + (dvdx[5], dvdy[5], dvdz[5]) = VoluDer(8,7,6,1,4,2); + (dvdx[6], dvdy[6], dvdz[6]) = VoluDer(5,8,7,2,1,3); + (dvdx[7], dvdy[7], dvdz[7]) = VoluDer(6,5,8,3,2,4); + (dvdx[8], dvdy[8], dvdz[8]) = VoluDer(7,6,5,4,3,1); + + return (dvdx, dvdy, dvdz); +} + +inline proc CalcElemFBHourglassForce(xd: 8*real, yd: 8*real, zd: 8*real, + hourgam: 8*(4*real), + coefficient: real, + ref hgfx: 8*real, + ref hgfy: 8*real, + ref hgfz: 8*real) { + var hx, hy, hz: 4*real; + + // reduction + for param i in 1..4 { + for param j in 1..8 { + hx[i] += hourgam[j][i] * xd[j]; + hy[i] += hourgam[j][i] * yd[j]; + hz[i] += hourgam[j][i] * zd[j]; + } + } + + for param i in 1..8 { + var shx, shy, shz: real; + for param j in 1..4 { + shx += hourgam[i][j] * hx[j]; + shy += hourgam[i][j] * hy[j]; + shz += hourgam[i][j] * hz[j]; + } + hgfx[i] = coefficient * shx; + hgfy[i] = coefficient * shy; + hgfz[i] = coefficient * shz; + } +} + + +proc CalcElemCharacteristicLength(x, y, z, volume) { + proc AreaFace(param p0, param p1, param p2, param p3) { + const fx = (x[p2] - x[p0]) - (x[p3] - x[p1]), + fy = (y[p2] - y[p0]) - (y[p3] - y[p1]), + fz = (z[p2] - z[p0]) - (z[p3] - z[p1]), + gx = (x[p2] - x[p0]) + (x[p3] - x[p1]), + gy = (y[p2] - y[p0]) + (y[p3] - y[p1]), + gz = (z[p2] - z[p0]) + (z[p3] - z[p1]), + area = (fx * fx + fy * fy + fz * fz) * + (gx * gx + gy * gy + gz * gz) - + (fx * gx + fy * gy + fz * gz) * + (fx * gx + fy * gy + fz * gz); + + return area ; + } + + const charLength = max(AreaFace(1, 2, 3, 4), + AreaFace(5, 6, 7, 8), + AreaFace(1, 2, 6, 5), + AreaFace(2, 3, 7, 6), + AreaFace(3, 4, 8, 7), + AreaFace(4, 1, 5, 8)); + + return 4.0 * volume / sqrt(charLength); +} + + +proc CalcElemVelocityGradient(xvel, yvel, zvel, pfx, pfy, pfz, + detJ, ref d: 6*real) { + const inv_detJ = 1.0 / detJ; + + d[1] = inv_detJ * ( pfx[1] * (xvel[1]-xvel[7]) + + pfx[2] * (xvel[2]-xvel[8]) + + pfx[3] * (xvel[3]-xvel[5]) + + pfx[4] * (xvel[4]-xvel[6]) ); + d[2] = inv_detJ * ( pfy[1] * (yvel[1]-yvel[7]) + + pfy[2] * (yvel[2]-yvel[8]) + + pfy[3] * (yvel[3]-yvel[5]) + + pfy[4] * (yvel[4]-yvel[6]) ); + d[3] = inv_detJ * ( pfz[1] * (zvel[1]-zvel[7]) + + pfz[2] * (zvel[2]-zvel[8]) + + pfz[3] * (zvel[3]-zvel[5]) + + pfz[4] * (zvel[4]-zvel[6]) ); + + const dyddx = inv_detJ * ( pfx[1] * (yvel[1]-yvel[7]) + + pfx[2] * (yvel[2]-yvel[8]) + + pfx[3] * (yvel[3]-yvel[5]) + + pfx[4] * (yvel[4]-yvel[6]) ), + + dxddy = inv_detJ * ( pfy[1] * (xvel[1]-xvel[7]) + + pfy[2] * (xvel[2]-xvel[8]) + + pfy[3] * (xvel[3]-xvel[5]) + + pfy[4] * (xvel[4]-xvel[6]) ), + + dzddx = inv_detJ * ( pfx[1] * (zvel[1]-zvel[7]) + + pfx[2] * (zvel[2]-zvel[8]) + + pfx[3] * (zvel[3]-zvel[5]) + + pfx[4] * (zvel[4]-zvel[6]) ), + + dxddz = inv_detJ * ( pfz[1] * (xvel[1]-xvel[7]) + + pfz[2] * (xvel[2]-xvel[8]) + + pfz[3] * (xvel[3]-xvel[5]) + + pfz[4] * (xvel[4]-xvel[6]) ), + + dzddy = inv_detJ * ( pfy[1] * (zvel[1]-zvel[7]) + + pfy[2] * (zvel[2]-zvel[8]) + + pfy[3] * (zvel[3]-zvel[5]) + + pfy[4] * (zvel[4]-zvel[6]) ), + + dyddz = inv_detJ * ( pfz[1] * (yvel[1]-yvel[7]) + + pfz[2] * (yvel[2]-yvel[8]) + + pfz[3] * (yvel[3]-yvel[5]) + + pfz[4] * (yvel[4]-yvel[6]) ); + + d[6] = 0.5 * ( dxddy + dyddx ); + d[5] = 0.5 * ( dxddz + dzddx ); + d[4] = 0.5 * ( dzddy + dyddz ); +} + + +proc CalcPressureForElems(p_new: [?D] real, bvc, pbvc, + e_old, compression, vnewc, + pmin: real, p_cut: real, eosvmax: real) { + + // + // TODO: Uncomment local once sparse domain is distributed + // + forall i in D /* do local */ { + const c1s = 2.0 / 3.0; + bvc[i] = c1s * (compression[i] + 1.0); + pbvc[i] = c1s; + } + + forall i in D { + p_new[i] = bvc[i] * e_old[i]; + + if abs(p_new[i]) < p_cut then p_new[i] = 0.0; + if vnewc[i] >= eosvmax then p_new[i] = 0.0; //impossible? + if p_new[i] < pmin then p_new[i] = pmin; + } +} + + +proc TimeIncrement() { + var targetdt = stoptime - time; + + if dtfixed <= 0.0 && cycle != 0 { //don't do this the first cycle + var olddt = deltatime, + newdt = 1.0e20; + + if dtcourant < newdt then newdt = dtcourant / 2.0; + if dthydro < newdt then newdt = 2.0/3.0 * dthydro; + + const ratio = newdt / olddt; + if ratio >= 1.0 { + if ratio < deltatimemultlb then newdt = olddt; + else if ratio > deltatimemultub then newdt = olddt * deltatimemultub; + } + if newdt > dtmax then newdt = dtmax; + + deltatime = newdt; + } + + /* TRY TO PREVENT VERY SMALL SCALING ON THE NEXT CYCLE */ + if targetdt > deltatime && targetdt < (4.0/3.0 * deltatime) { + targetdt = 2.0/3.0 * deltatime; + } + if targetdt < deltatime then deltatime = targetdt; + + time += deltatime; + cycle += 1; +} + +inline proc LagrangeLeapFrog() { + /* calculate nodal forces, accelerations, velocities, positions, with + * applied boundary conditions and slide surface considerations */ + LagrangeNodal(); + + /* calculate element quantities (i.e. velocity gradient & q), and update + * material states */ + LagrangeElements(); + + CalcTimeConstraintsForElems(); +} + + +inline proc LagrangeNodal() { + CalcForceForNodes(); + + CalcAccelerationForNodes(); + + ApplyAccelerationBoundaryConditionsForNodes(); + + CalcVelocityForNodes(deltatime, u_cut); + + CalcPositionForNodes(deltatime); +} + + +inline proc LagrangeElements() { + CalcLagrangeElements(); + + /* Calculate Q. (Monotonic q option requires communication) */ + CalcQForElems(); + + ApplyMaterialPropertiesForElems(); + + UpdateVolumesForElems(); +} + + +inline proc CalcTimeConstraintsForElems() { + /* evaluate time constraint */ + CalcCourantConstraintForElems(); + + /* check hydro constraint */ + CalcHydroConstraintForElems(); +} + + +inline proc computeDTF(indx) { + const myvdov = vdov[indx]; + + if myvdov == 0.0 then + return max(real); + + const myarealg = arealg[indx]; + var dtf = ss[indx]**2; + if myvdov < 0.0 then + dtf += qqc2 * myarealg**2 * myvdov**2; + dtf = sqrt(dtf); + dtf = myarealg / dtf; + + return dtf; +} + + +proc CalcCourantConstraintForElems() { + const val = min reduce [indx in MatElems] computeDTF(indx); + + if (val != max(real)) then + dtcourant = val; +} + + +inline proc calcDtHydroTmp(indx) { + const myvdov = vdov[indx]; + if (myvdov == 0.0) then + return max(real); + else + return dvovmax / (abs(myvdov)+1.0e-20); +} + + +proc CalcHydroConstraintForElems() { + const val = min reduce [indx in MatElems] calcDtHydroTmp(indx); + + if (val != max(real)) then + dthydro = val; +} + + +/* calculate nodal forces, accelerations, velocities, positions, with + * applied boundary conditions and slide surface considerations */ + +proc CalcForceForNodes() { + //zero out all forces + forall x in fx do x.write(0); + forall y in fy do y.write(0); + forall z in fz do z.write(0); + + /* Calcforce calls partial, force, hourq */ + CalcVolumeForceForElems(); + + /* Calculate Nodal Forces at domain boundaries */ + // this was commented out in C++ code, so left out here +} + +proc CalcVolumeForceForElems() { + var sigxx, sigyy, sigzz, determ: [Elems] real; + + /* Sum contributions to total stress tensor */ + InitStressTermsForElems(p, q, sigxx, sigyy, sigzz); + + /* call elemlib stress integration loop to produce nodal forces from + material stresses. */ + IntegrateStressForElems(sigxx, sigyy, sigzz, determ); + + /* check for negative element volume */ + forall e in Elems { + if determ[e] <= 0.0 then + halt("can't have negative volume (determ[", e, "]=", determ[e], ")"); + } + + CalcHourglassControlForElems(determ); +} + + +proc IntegrateStressForElems(sigxx, sigyy, sigzz, determ) { + forall k in Elems { + var b_x, b_y, b_z: 8*real; + var x_local, y_local, z_local: 8*real; + localizeNeighborNodes(k, x, x_local, y, y_local, z, z_local); + + var fx_local, fy_local, fz_local: 8*real; + + local { + /* Volume calculation involves extra work for numerical consistency. */ + CalcElemShapeFunctionDerivatives(x_local, y_local, z_local, + b_x, b_y, b_z, determ[k]); + + CalcElemNodeNormals(b_x, b_y, b_z, x_local, y_local, z_local); + + SumElemStressesToNodeForces(b_x, b_y, b_z, sigxx[k], sigyy[k], sigzz[k], + fx_local, fy_local, fz_local); + } + + for (noi, t) in elemToNodesTuple(k) { + fx[noi].add(fx_local[t]); + fy[noi].add(fy_local[t]); + fz[noi].add(fz_local[t]); + } + } +} + + +proc CalcHourglassControlForElems(determ) { + var dvdx, dvdy, dvdz, x8n, y8n, z8n: [Elems] 8*real; + + forall eli in Elems { + /* Collect domain nodes to elem nodes */ + var x1, y1, z1: 8*real; + localizeNeighborNodes(eli, x, x1, y, y1, z, z1); + var pfx, pfy, pfz: 8*real; + + local { + /* load into temporary storage for FB Hour Glass control */ + (dvdx[eli], dvdy[eli], dvdz[eli]) = CalcElemVolumeDerivative(x1, y1, z1); + } + + x8n[eli] = x1; + y8n[eli] = y1; + z8n[eli] = z1; + + determ[eli] = volo[eli] * v[eli]; + } + + /* Do a check for negative volumes */ + forall e in Elems { + if v[e] <= 0.0 then + halt("can't have negative (or zero) volume. (in Hourglass, v[", e, "]=", v[e], ")"); + } + + if hgcoef > 0.0 { + CalcFBHourglassForceForElems(determ, x8n, y8n, z8n, dvdx, dvdy, dvdz); + } +} + + +const gammaCoef: 4*(8*real) = // WAS: [1..4, 1..8] real = + (( 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0), + ( 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0), + ( 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0), + (-1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0)); + +/* Calculates the Flanagan-Belytschko anti-hourglass force. */ +proc CalcFBHourglassForceForElems(determ, x8n, y8n, z8n, dvdx, dvdy, dvdz) { + + /* compute the hourglass modes */ + forall eli in Elems { + var hourgam: 8*(4*real); + const volinv = 1.0 / determ[eli]; + var ss1, mass1, volume13: real; + var hgfx, hgfy, hgfz: 8*real; + var coefficient: real; + + var xd1, yd1, zd1: 8*real; + localizeNeighborNodes(eli, xd, xd1, yd, yd1, zd, zd1); + + /* TODO: Can we enable this local block? */ + // local { + for param i in 1..4 { + var hourmodx, hourmody, hourmodz: real; + // reduction + for param j in 1..8 { + hourmodx += x8n[eli][j] * gammaCoef[i][j]; + hourmody += y8n[eli][j] * gammaCoef[i][j]; + hourmodz += z8n[eli][j] * gammaCoef[i][j]; + } + + for param j in 1..8 { + hourgam[j][i] = gammaCoef[i][j] - volinv * + (dvdx[eli][j] * hourmodx + + dvdy[eli][j] * hourmody + + dvdz[eli][j] * hourmodz); + } + } + + /* compute forces */ + /* store forces into h arrays (force arrays) */ + ss1 = ss[eli]; + mass1 = elemMass[eli]; + volume13 = cbrt(determ[eli]); + + coefficient = - hgcoef * 0.01 * ss1 * mass1 / volume13; + + CalcElemFBHourglassForce(xd1, yd1, zd1, hourgam, coefficient, + hgfx, hgfy, hgfz); + // } // end local + + for (noi,i) in elemToNodesTuple(eli) { + fx[noi].add(hgfx[i]); + fy[noi].add(hgfy[i]); + fz[noi].add(hgfz[i]); + } + } +} + + +proc CalcAccelerationForNodes() { + forall noi in Nodes do local { + xdd[noi] = fx[noi].read() / nodalMass[noi]; + ydd[noi] = fy[noi].read() / nodalMass[noi]; + zdd[noi] = fz[noi].read() / nodalMass[noi]; + } +} + + +proc ApplyAccelerationBoundaryConditionsForNodes() { + // TODO: Shouldn't we be able to write these as follows? + // + // xdd[XSym] = 0.0; + // ydd[YSym] = 0.0; + // zdd[ZSym] = 0.0; + + forall x in XSym do xdd[x] = 0.0; + forall y in YSym do ydd[y] = 0.0; + forall z in ZSym do zdd[z] = 0.0; +} + + +proc CalcVelocityForNodes(dt: real, u_cut: real) { + forall i in Nodes do local { + var xdtmp = xd[i] + xdd[i] * dt, + ydtmp = yd[i] + ydd[i] * dt, + zdtmp = zd[i] + zdd[i] * dt; + if abs(xdtmp) < u_cut then xdtmp = 0.0; + if abs(ydtmp) < u_cut then ydtmp = 0.0; + if abs(zdtmp) < u_cut then zdtmp = 0.0; + xd[i] = xdtmp; + yd[i] = ydtmp; + zd[i] = zdtmp; + } +} + + +proc CalcPositionForNodes(dt: real) { + forall ijk in Nodes { + x[ijk] += xd[ijk] * dt; + y[ijk] += yd[ijk] * dt; + z[ijk] += zd[ijk] * dt; + } +} + +// sungeun: Temporary array reused throughout +proc CalcLagrangeElements() { + var dxx, dyy, dzz: [Elems] real; + + CalcKinematicsForElems(dxx, dyy, dzz, deltatime); + + // element loop to do some stuff not included in the elemlib function. + forall k in Elems do local { + vdov[k] = dxx[k] + dyy[k] + dzz[k]; + var vdovthird = vdov[k] / 3.0; + dxx[k] -= vdovthird; + dyy[k] -= vdovthird; + dzz[k] -= vdovthird; + } + + // See if any volumes are negative, and take appropriate action. + forall e in Elems { + if vnew[e] <= 0.0 then + halt("can't have negative volume (vnew[", e, "]=", vnew[e], ")"); + } +} + + +proc CalcKinematicsForElems(dxx, dyy, dzz, const dt: real) { + // loop over all elements + forall k in Elems { + var b_x, b_y, b_z: 8*real, + d: 6*real, + detJ: real; + + //get nodal coordinates from global arrays and copy into local arrays + var x_local, y_local, z_local: 8*real; + localizeNeighborNodes(k, x, x_local, y, y_local, z, z_local); + + //get nodal velocities from global arrays and copy into local arrays + var xd_local, yd_local, zd_local: 8*real; + localizeNeighborNodes(k, xd, xd_local, yd, yd_local, zd, zd_local); + var dt2 = 0.5 * dt; //wish this was local, too... + + local { + //volume calculations + const volume = CalcElemVolume(x_local, y_local, z_local); + const relativeVolume = volume / volo[k]; + vnew[k] = relativeVolume; + delv[k] = relativeVolume - v[k]; + + //set characteristic length + arealg[k] = CalcElemCharacteristicLength(x_local, y_local, z_local, + volume); + + for param i in 1..8 { + x_local[i] -= dt2 * xd_local[i]; + y_local[i] -= dt2 * yd_local[i]; + z_local[i] -= dt2 * zd_local[i]; + } + + CalcElemShapeFunctionDerivatives(x_local, y_local, z_local, + b_x, b_y, b_z, detJ); + + CalcElemVelocityGradient(xd_local, yd_local, zd_local, b_x, b_y, b_z, + detJ, d); + + } + + // put velocity gradient quantities into their global arrays. + dxx[k] = d[1]; + dyy[k] = d[2]; + dzz[k] = d[3]; + } +} + + +// sungeun: Temporary array reused throughout +/* velocity gradient */ +var delv_xi, delv_eta, delv_zeta: [Elems] real; +/* position gradient */ +var delx_xi, delx_eta, delx_zeta: [Elems] real; + +proc CalcQForElems() { + // MONOTONIC Q option + + /* Calculate velocity gradients */ + CalcMonotonicQGradientsForElems(delv_xi, delv_eta, delv_zeta, + delx_xi, delx_eta, delx_zeta); + + /* Transfer veloctiy gradients in the first order elements */ + /* problem->commElements->Transfer(CommElements::monoQ) ; */ + CalcMonotonicQForElems(delv_xi, delv_eta, delv_zeta, + delx_xi, delx_eta, delx_zeta); + + /* Don't allow excessive artificial viscosity */ + forall e in Elems { + if q[e] > qstop then + halt("Excessive artificial viscosity! (q[", e, "]=", q[e], ")"); + } +} + + +// sungeun: Temporary array reused throughout +var vnewc: [MatElems] real; + +/* Expose all of the variables needed for material evaluation */ +proc ApplyMaterialPropertiesForElems() { + + forall i in MatElems do vnewc[i] = vnew[i]; + + if eosvmin != 0.0 then + [c in vnewc] if c < eosvmin then c = eosvmin; + + if eosvmax != 0.0 then + [c in vnewc] if c > eosvmax then c = eosvmax; + + + // old comment: The following loop should compute min/max reductions; + // currently, race-y + + forall matelm in MatElems { + var vc = v[matelm]; + if eosvmin != 0.0 && vc < eosvmin then vc = eosvmin; + if eosvmax != 0.0 && vc > eosvmax then vc = eosvmax; + if vc <= 0.0 { + writeln("Volume error (in ApplyMaterialProperiesForElems)."); + exit(1); + } + } + + EvalEOSForElems(vnewc); +} + + +proc UpdateVolumesForElems() { + forall i in Elems do local { + var tmpV = vnew[i]; + if abs(tmpV-1.0) < v_cut then tmpV = 1.0; + v[i] = tmpV; + } +} + + +proc CalcMonotonicQGradientsForElems(delv_xi, delv_eta, delv_zeta, + delx_xi, delx_eta, delx_zeta) { + forall eli in Elems { + const ptiny = 1.0e-36; + var xl, yl, zl: 8*real; + localizeNeighborNodes(eli, x, xl, y, yl, z, zl); + var xvl, yvl, zvl: 8*real; + localizeNeighborNodes(eli, xd, xvl, yd, yvl, zd, zvl); + + local { + const vol = volo[eli] * vnew[eli], + norm = 1.0 / (vol + ptiny); + var ax, ay, az, dxv, dyv, dzv: real; + + const dxj = -0.25*((xl[1]+xl[2]+xl[6]+xl[5])-(xl[4]+xl[3]+xl[7]+xl[8])), + dyj = -0.25*((yl[1]+yl[2]+yl[6]+yl[5])-(yl[4]+yl[3]+yl[7]+yl[8])), + dzj = -0.25*((zl[1]+zl[2]+zl[6]+zl[5])-(zl[4]+zl[3]+zl[7]+zl[8])), + + dxi = 0.25*((xl[2]+xl[3]+xl[7]+xl[6])-(xl[1]+xl[4]+xl[8]+xl[5])), + dyi = 0.25*((yl[2]+yl[3]+yl[7]+yl[6])-(yl[1]+yl[4]+yl[8]+yl[5])), + dzi = 0.25*((zl[2]+zl[3]+zl[7]+zl[6])-(zl[1]+zl[4]+zl[8]+zl[5])), + + dxk = 0.25*((xl[5]+xl[6]+xl[7]+xl[8])-(xl[1]+xl[2]+xl[3]+xl[4])), + dyk = 0.25*((yl[5]+yl[6]+yl[7]+yl[8])-(yl[1]+yl[2]+yl[3]+yl[4])), + dzk = 0.25*((zl[5]+zl[6]+zl[7]+zl[8])-(zl[1]+zl[2]+zl[3]+zl[4])); + + /* find delvk and delxk ( i cross j ) */ + + ax = dyi*dzj - dzi*dyj; + ay = dzi*dxj - dxi*dzj; + az = dxi*dyj - dyi*dxj; + + delx_zeta[eli] = vol / sqrt(ax*ax + ay*ay + az*az + ptiny); + + ax *= norm; + ay *= norm; + az *= norm; + + dxv = 0.25*((xvl[5]+xvl[6]+xvl[7]+xvl[8])-(xvl[1]+xvl[2]+xvl[3]+xvl[4])); + dyv = 0.25*((yvl[5]+yvl[6]+yvl[7]+yvl[8])-(yvl[1]+yvl[2]+yvl[3]+yvl[4])); + dzv = 0.25*((zvl[5]+zvl[6]+zvl[7]+zvl[8])-(zvl[1]+zvl[2]+zvl[3]+zvl[4])); + + delv_zeta[eli] = ax*dxv + ay*dyv + az*dzv; + + /* find delxi and delvi ( j cross k ) */ + + ax = dyj*dzk - dzj*dyk; + ay = dzj*dxk - dxj*dzk; + az = dxj*dyk - dyj*dxk; + + delx_xi[eli] = vol / sqrt(ax*ax + ay*ay + az*az + ptiny) ; + + ax *= norm; + ay *= norm; + az *= norm; + + dxv = 0.25*((xvl[2]+xvl[3]+xvl[7]+xvl[6])-(xvl[1]+xvl[4]+xvl[8]+xvl[5])); + dyv = 0.25*((yvl[2]+yvl[3]+yvl[7]+yvl[6])-(yvl[1]+yvl[4]+yvl[8]+yvl[5])); + dzv = 0.25*((zvl[2]+zvl[3]+zvl[7]+zvl[6])-(zvl[1]+zvl[4]+zvl[8]+zvl[5])); + + delv_xi[eli] = ax*dxv + ay*dyv + az*dzv ; + + /* find delxj and delvj ( k cross i ) */ + + ax = dyk*dzi - dzk*dyi; + ay = dzk*dxi - dxk*dzi; + az = dxk*dyi - dyk*dxi; + + delx_eta[eli] = vol / sqrt(ax*ax + ay*ay + az*az + ptiny) ; + + ax *= norm; + ay *= norm; + az *= norm; + + dxv= -0.25*((xvl[1]+xvl[2]+xvl[6]+xvl[5])-(xvl[4]+xvl[3]+xvl[7]+xvl[8])); + dyv= -0.25*((yvl[1]+yvl[2]+yvl[6]+yvl[5])-(yvl[4]+yvl[3]+yvl[7]+yvl[8])); + dzv= -0.25*((zvl[1]+zvl[2]+zvl[6]+zvl[5])-(zvl[4]+zvl[3]+zvl[7]+zvl[8])); + + delv_eta[eli] = ax*dxv + ay*dyv + az*dzv ; + } /* local */ + } /* forall eli */ +} + + +proc CalcMonotonicQForElems(delv_xi, delv_eta, delv_zeta, + delx_xi, delx_eta, delx_zeta) { + //got rid of call through to "CalcMonotonicQRegionForElems" + + forall i in MatElems { + const ptiny = 1.0e-36; + const bcMask = elemBC[i]; + var norm, delvm, delvp: real; + + /* phixi */ + norm = 1.0 / (delv_xi[i] + ptiny); + + select bcMask & XI_M { + when 0 do delvm = delv_xi[lxim(i)]; + when XI_M_SYMM do delvm = delv_xi[i]; + when XI_M_FREE do delvm = 0.0; + } + select bcMask & XI_P { + when 0 do delvp = delv_xi[lxip(i)]; + when XI_P_SYMM do delvp = delv_xi[i]; + when XI_P_FREE do delvp = 0.0; + } + + delvm *= norm; + delvp *= norm; + + var phixi = 0.5 * (delvm + delvp); + + delvm *= monoq_limiter_mult; + delvp *= monoq_limiter_mult; + + if delvm < phixi then phixi = delvm; + if delvp < phixi then phixi = delvp; + if phixi < 0 then phixi = 0.0; + if phixi > monoq_max_slope then phixi = monoq_max_slope; + + /* phieta */ + norm = 1.0 / (delv_eta[i] + ptiny); + + select bcMask & ETA_M { + when 0 do delvm = delv_eta[letam[i]]; + when ETA_M_SYMM do delvm = delv_eta[i]; + when ETA_M_FREE do delvm = 0.0; + } + select bcMask & ETA_P { + when 0 do delvp = delv_eta[letap[i]]; + when ETA_P_SYMM do delvp = delv_eta[i]; + when ETA_P_FREE do delvp = 0.0; + } + + delvm = delvm * norm; + delvp = delvp * norm; + + var phieta = 0.5 * (delvm + delvp); + + delvm *= monoq_limiter_mult; + delvp *= monoq_limiter_mult; + + if delvm < phieta then phieta = delvm; + if delvp < phieta then phieta = delvp; + if phieta < 0.0 then phieta = 0.0; + if phieta > monoq_max_slope then phieta = monoq_max_slope; + + /* phizeta */ + norm = 1.0 / (delv_zeta[i] + ptiny); + + select bcMask & ZETA_M { + when 0 do delvm = delv_zeta[lzetam[i]]; + when ZETA_M_SYMM do delvm = delv_zeta[i]; + when ZETA_M_FREE do delvm = 0.0; + } + select bcMask & ZETA_P { + when 0 do delvp = delv_zeta[lzetap[i]]; + when ZETA_P_SYMM do delvp = delv_zeta[i]; + when ZETA_P_FREE do delvp = 0.0; + } + + delvm = delvm * norm; + delvp = delvp * norm; + + var phizeta = 0.5 * (delvm + delvp); + + delvm *= monoq_limiter_mult; + delvp *= monoq_limiter_mult; + + if delvm < phizeta then phizeta = delvm; + if delvp < phizeta then phizeta = delvp; + if phizeta < 0.0 then phizeta = 0.0; + if phizeta > monoq_max_slope then phizeta = monoq_max_slope; + + /* Remove length scale */ + var qlin, qquad: real; + if vdov[i] > 0.0 { + qlin = 0.0; + qquad = 0.0; + } else { + var delvxxi = delv_xi[i] * delx_xi[i], + delvxeta = delv_eta[i] * delx_eta[i], + delvxzeta = delv_zeta[i] * delx_zeta[i]; + + if delvxxi > 0.0 then delvxxi = 0.0; + if delvxeta > 0.0 then delvxeta = 0.0; + if delvxzeta > 0.0 then delvxzeta = 0.0; + + const rho = elemMass[i] / (volo[i] * vnew[i]); + + qlin = -qlc_monoq * rho * + ( delvxxi * (1.0 - phixi) + + delvxeta * (1.0 - phieta) + + delvxzeta * (1.0 - phizeta)); + + qquad = qqc_monoq * rho * + ( delvxxi**2 * (1.0 - phixi**2) + + delvxeta**2 * (1.0 - phieta**2) + + delvxzeta**2 * (1.0 - phizeta**2)); + } + qq[i] = qquad; + ql[i] = qlin; + + } +} + + +proc EvalEOSForElems(vnewc) { + const rho0 = refdens; + + var e_old, delvc, p_old, q_old, compression, compHalfStep, + qq_old, ql_old, work, p_new, e_new, q_new, bvc, pbvc: [Elems] real; + + /* compress data, minimal set */ + forall i in MatElems { + e_old[i] = e[i]; + delvc[i] = delv[i]; + p_old[i] = p[i]; + q_old[i] = q[i]; + qq_old[i] = qq[i]; + ql_old[i] = ql[i]; + } + + // + // TODO: Uncomment local once sparse domain is distributed + // + forall i in Elems /* do local */ { + compression[i] = 1.0 / vnewc[i] - 1.0; + const vchalf = vnewc[i] - delvc[i] * 0.5; + compHalfStep[i] = 1.0 / vchalf - 1.0; + } + + /* Check for v > eosvmax or v < eosvmin */ + // (note: I think this was already checked for in calling function!) + if eosvmin != 0.0 { + forall i in Elems { + if vnewc[i] <= eosvmin then compHalfStep[i] = compression[i]; + } + } + if eosvmax != 0.0 { + forall i in Elems { + if vnewc[i] >= eosvmax { + p_old[i] = 0.0; + compression[i] = 0.0; + compHalfStep[i] = 0.0; + } + } + } + + CalcEnergyForElems(p_new, e_new, q_new, bvc, pbvc, + p_old, e_old, q_old, compression, compHalfStep, + vnewc, work, delvc, qq_old, ql_old); + + forall i in MatElems { + p[i] = p_new[i]; + e[i] = e_new[i]; + q[i] = q_new[i]; + } + + CalcSoundSpeedForElems(vnewc, rho0, e_new, p_new, pbvc, bvc); +} + + +proc CalcEnergyForElems(p_new, e_new, q_new, bvc, pbvc, + p_old, e_old, q_old, compression, compHalfStep, + vnewc, work, delvc, qq_old, ql_old) { + // TODO: might need to move these consts into foralls or global + // Otherwise, they live on Locale0 and everyone else has to do + // remote reads. OR: Check if they're remote value forwarded. + const rho0 = refdens; + const sixth = 1.0 / 6.0; + + var pHalfStep: [MatElems] real; + + forall i in Elems { + e_new[i] = e_old[i] - 0.5 * delvc[i] * (p_old[i] + q_old[i]) + + 0.5 * work[i]; + if e_new[i] < emin then e_new[i] = emin; + } + + CalcPressureForElems(pHalfStep, bvc, pbvc, e_new, compHalfStep, + vnewc, pmin, p_cut, eosvmax); + + forall i in Elems { + const vhalf = 1.0 / (1.0 + compHalfStep[i]); + + if delvc[i] > 0.0 { + q_new[i] = 0.0; + } else { + var ssc = (pbvc[i] * e_new[i] + vhalf**2 * bvc[i] * pHalfStep[i]) / rho0; + if ssc <= 0.0 then ssc = 0.333333e-36; + else ssc = sqrt(ssc); + q_new[i] = ssc * ql_old[i] + qq_old[i]; + } + + e_new[i] += 0.5 * delvc[i] + * (3.0*(p_old[i] + q_old[i]) - 4.0*(pHalfStep[i] + q_new[i])); + } + forall i in Elems { + e_new[i] += 0.5 * work[i]; + if abs(e_new[i] < e_cut) then e_new[i] = 0.0; + if e_new[i] < emin then e_new[i] = emin; + } + + CalcPressureForElems(p_new, bvc, pbvc, e_new, compression, vnewc, pmin, + p_cut, eosvmax); + + forall i in Elems { + var q_tilde:real; + + if delvc[i] > 0.0 { + q_tilde = 0.0; + } else { + var ssc = (pbvc[i] * e_new[i] + vnewc[i]**2 * bvc[i] * p_new[i] ) / rho0; + if ssc <= 0.0 then ssc = 0.333333e-36; + else ssc = sqrt(ssc); + q_tilde = ssc * ql_old[i] + qq_old[i]; + } + + e_new[i] -= (7.0*(p_old[i] + q_old[i]) + - 8.0*(pHalfStep[i] + q_new[i]) + + (p_new[i] + q_tilde)) * delvc[i] * sixth; + if abs(e_new[i]) < e_cut then e_new[i] = 0.0; + if e_new[i] < emin then e_new[i] = emin; + } + + CalcPressureForElems(p_new, bvc, pbvc, e_new, compression, vnewc, pmin, + p_cut, eosvmax); + + + // + // TODO: Uncomment local once sparse domain is distributed + // + forall i in Elems /* do local */ { + if delvc[i] <= 0.0 { + var ssc = (pbvc[i] * e_new[i] + vnewc[i]**2 * bvc[i] * p_new[i] ) / rho0; + if ssc <= 0.0 then ssc = 0.333333e-36; + else ssc = sqrt(ssc); + q_new[i] = ssc * ql_old[i] + qq_old[i]; + if abs(q_new[i]) < q_cut then q_new[i] = 0.0; + } + } +} + + +proc CalcSoundSpeedForElems(vnewc, rho0:real, enewc, pnewc, pbvc, bvc) { + // TODO: Open question: If we had multiple materials, should (a) ss + // be zeroed and accumulated into, and (b) updated atomically to + // avoid losing updates? (Jeff will go back and think on this) + // + forall i in MatElems { + var ssTmp = (pbvc[i] * enewc[i] + vnewc[i]**2 * bvc[i] * pnewc[i]) / rho0; + if ssTmp <= 1.111111e-36 then ssTmp = 1.111111e-36; + ss[i] = sqrt(ssTmp); + } +} + + +iter elemToNodes(elem) { + for param i in 1..nodesPerElem do + yield elemToNode[elem][i]; +} + +iter elemToNodesTuple(e) { + for i in 1..nodesPerElem do + yield (elemToNode[e][i], i); +} + + +proc deprint(title:string, x:[?D] real, y:[D]real, z:[D]real) { + writeln(title); + for i in D { + writeln(format("%3d", i), ": ", + format("%3.4e", x[i]), " ", + format("%3.4e", y[i]), " ", + format("%3.4e", z[i])); + } +} + + diff --git a/samples/Chapel/nbody.chpl b/samples/Chapel/nbody.chpl new file mode 100644 index 00000000..f46e4f68 --- /dev/null +++ b/samples/Chapel/nbody.chpl @@ -0,0 +1,147 @@ +/* The Computer Language Benchmarks Game + http://benchmarksgame.alioth.debian.org/ + + contributed by Albert Sidelnik + modified by Brad Chamberlain +*/ + + +// +// The number of timesteps to simulate; may be set via the command-line +// +config const n = 10000; + +// +// Constants representing pi, the solar mass, and the number of days per year +// +const pi = 3.141592653589793, + solarMass = 4 * pi**2, + daysPerYear = 365.24; + +// +// a record representing one of the bodies in the solar system +// +record body { + var pos: 3*real; + var v: 3*real; + var mass: real; // does not change after it is set up +} + +// +// the array of bodies that we'll be simulating +// +var bodies = [/* sun */ + new body(mass = solarMass), + + /* jupiter */ + new body(pos = ( 4.84143144246472090e+00, + -1.16032004402742839e+00, + -1.03622044471123109e-01), + v = ( 1.66007664274403694e-03 * daysPerYear, + 7.69901118419740425e-03 * daysPerYear, + -6.90460016972063023e-05 * daysPerYear), + mass = 9.54791938424326609e-04 * solarMass), + + /* saturn */ + new body(pos = ( 8.34336671824457987e+00, + 4.12479856412430479e+00, + -4.03523417114321381e-01), + v = (-2.76742510726862411e-03 * daysPerYear, + 4.99852801234917238e-03 * daysPerYear, + 2.30417297573763929e-05 * daysPerYear), + mass = 2.85885980666130812e-04 * solarMass), + + /* uranus */ + new body(pos = ( 1.28943695621391310e+01, + -1.51111514016986312e+01, + -2.23307578892655734e-01), + v = ( 2.96460137564761618e-03 * daysPerYear, + 2.37847173959480950e-03 * daysPerYear, + -2.96589568540237556e-05 * daysPerYear), + mass = 4.36624404335156298e-05 * solarMass), + + /* neptune */ + new body(pos = ( 1.53796971148509165e+01, + -2.59193146099879641e+01, + 1.79258772950371181e-01), + v = ( 2.68067772490389322e-03 * daysPerYear, + 1.62824170038242295e-03 * daysPerYear, + -9.51592254519715870e-05 * daysPerYear), + mass = 5.15138902046611451e-05 * solarMass) + ]; + +// +// the number of bodies to be simulated +// +const numbodies = bodies.numElements; + +// +// The computation involves initializing the sun's velocity, +// writing the initial energy, advancing the system through 'n' +// timesteps, and writing the final energy. +// +proc main() { + initSun(); + + writef("%.9r\n", energy()); + for 1..n do + advance(0.01); + writef("%.9r\n", energy()); +} + +// +// compute the sun's initial velocity +// +proc initSun() { + const p = + reduce (for b in bodies do (b.v * b.mass)); + bodies[1].v = -p / solarMass; +} + +// +// advance the positions and velocities of all the bodies +// +proc advance(dt) { + for i in 1..numbodies { + for j in i+1..numbodies { + updateVelocities(bodies[i], bodies[j]); + + inline proc updateVelocities(ref b1, ref b2) { + const dpos = b1.pos - b2.pos, + mag = dt / sqrt(sumOfSquares(dpos))**3; + + b1.v -= dpos * b2.mass * mag; + b2.v += dpos * b1.mass * mag; + } + } + } + + for b in bodies do + b.pos += dt * b.v; +} + +// +// compute the energy of the bodies +// +proc energy() { + var e = 0.0; + + for i in 1..numbodies { + const b1 = bodies[i]; + + e += 0.5 * b1.mass * sumOfSquares(b1.v); + + for j in i+1..numbodies { + const b2 = bodies[j]; + + e -= (b1.mass * b2.mass) / sqrt(sumOfSquares(b1.pos - b2.pos)); + } + } + + return e; +} + +// +// a helper routine to compute the sum of squares of a 3-tuple's components +// +inline proc sumOfSquares(x) + return x(1)**2 + x(2)**2 + x(3)**2; diff --git a/samples/Chapel/quicksort.chpl b/samples/Chapel/quicksort.chpl new file mode 100644 index 00000000..33d9722c --- /dev/null +++ b/samples/Chapel/quicksort.chpl @@ -0,0 +1,145 @@ +// +// An example of a parallel quick sort implementation that uses +// "cobegin" to make each recursive call in parallel and "serial" to +// limit the number of threads. +// + +use Random, Time; // for random number generation and the Timer class + +var timer: Timer; // to time the sort + +config var n: int = 2**15; // the size of the array to be sorted +config var thresh: int = 1; // the recursive depth to serialize +config var verbose: int = 0; // print out this many elements in array +config var timing: bool = true; // set timing to false to disable timer + +var A: [1..n] real; // array of real numbers + +// +// initialize array with random numbers +// +fillRandom(A); + +// +// print out front of array if verbose flag is set +// +if verbose > 0 then + writeln("A[1..", verbose, "] = ", A[1..verbose]); + +// +// start timer, call parallel quick sort routine, stop timer +// +if timing then timer.start(); +pqsort(A, thresh); +if timing then timer.stop(); + +// +// report sort time +// +if timing then writeln("sorted in ", timer.elapsed(), " seconds"); + +// +// print out front of array if verbose flag is set +// values should now be in sorted order +// +if verbose > 0 then + writeln("A[1..", verbose, "] = ", A[1..verbose]); + +// +// verify that array is sorted or halt +// +for i in 2..n do + if A(i) < A(i-1) then + halt("A(", i-1, ") == ", A(i-1), " > A(", i, ") == ", A(i)); + +writeln("verification success"); + +// +// pqsort -- parallel quick sort +// +// arr: generic 1D array of values (real, int, ...) +// thresh: number of recursive calls to make before serializing +// low: lower bound of array to start sort at, defaults to whole array +// high: upper bound of array to stop sort at, defaults to whole array +// +proc pqsort(arr: [], + thresh: int, + low: int = arr.domain.low, + high: int = arr.domain.high) where arr.rank == 1 { + + // + // base case: arr[low..high] is small enough to bubble sort + // + if high - low < 8 { + bubbleSort(arr, low, high); + return; + } + + // + // determine pivot and partition arr[low..high] + // + const pivotVal = findPivot(); + const pivotLoc = partition(pivotVal); + + // + // make recursive calls to parallel quick sort each unsorted half of + // the array; if thresh is 0 or less, start executing conquer tasks + // serially + // + serial thresh <= 0 do cobegin { + pqsort(arr, thresh-1, low, pivotLoc-1); + pqsort(arr, thresh-1, pivotLoc+1, high); + } + + // + // findPivot -- helper routine to find pivot value using simple + // median-of-3 method, returns pivot value + // + proc findPivot() { + const mid = low + (high-low+1) / 2; + + if arr(mid) < arr(low) then arr(mid) <=> arr(low); + if arr(high) < arr(low) then arr(high) <=> arr(low); + if arr(high) < arr(mid) then arr(high) <=> arr(mid); + + const pivotVal = arr(mid); + arr(mid) = arr(high-1); + arr(high-1) = pivotVal; + + return pivotVal; + } + + // + // partition -- helper routine to partition array such that all + // values less than pivot are to its left and all + // values greater than pivot are to its right, returns + // pivot location + // + proc partition(pivotVal) { + var ilo = low, ihi = high-1; + while (ilo < ihi) { + do { ilo += 1; } while arr(ilo) < pivotVal; + do { ihi -= 1; } while pivotVal < arr(ihi); + if (ilo < ihi) { + arr(ilo) <=> arr(ihi); + } + } + arr(high-1) = arr(ilo); + arr(ilo) = pivotVal; + return ilo; + } +} + +// +// bubbleSort -- bubble sort for base case of quick sort +// +// arr: generic 1D array of values (real, int, ...) +// low: lower bound of array to start sort at +// high: upper bound of array to stop sort at +// +proc bubbleSort(arr: [], low: int, high: int) where arr.rank == 1 { + for i in low..high do + for j in low..high-1 do + if arr(j) > arr(j+1) then + arr(j) <=> arr(j+1); +} diff --git a/samples/Clojure/index.cljs.hl b/samples/Clojure/index.cljs.hl new file mode 100644 index 00000000..043df92b --- /dev/null +++ b/samples/Clojure/index.cljs.hl @@ -0,0 +1,146 @@ +;; Copyright (c) Alan Dipert and Micha Niskin. All rights reserved. +;; The use and distribution terms for this software are covered by the +;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) +;; which can be found in the file epl-v10.html at the root of this distribution. +;; By using this software in any fashion, you are agreeing to be bound by +;; the terms of this license. +;; You must not remove this notice, or any other, from this software. + +(page "index.html" + (:refer-clojure :exclude [nth]) + (:require + [tailrecursion.hoplon.reload :refer [reload-all]] + [tailrecursion.hoplon.util :refer [nth name pluralize]] + [tailrecursion.hoplon.storage-atom :refer [local-storage]])) + +;; utility functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(declare route state editing) + +(reload-all) + +(def mapvi (comp vec map-indexed)) + +(defn dissocv [v i] + (let [z (- (dec (count v)) i)] + (cond (neg? z) v + (zero? z) (pop v) + (pos? z) (into (subvec v 0 i) (subvec v (inc i)))))) + +(defn decorate [todo route editing i] + (let [{done? :completed text :text} todo] + (-> todo (assoc :editing (= editing i) + :visible (and (not (empty? text)) + (or (= "#/" route) + (and (= "#/active" route) (not done?)) + (and (= "#/completed" route) done?))))))) + +;; persisted state cell (AKA: stem cell) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(def state (-> (cell []) (local-storage ::store))) + +;; local state cells ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defc loaded? false) +(defc editing nil) +(def route (route-cell "#/")) + +;; formula cells (computed state) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defc= completed (filter :completed state)) +(defc= active (remove :completed state)) +(defc= plural-item (pluralize "item" (count active))) +(defc= todos (mapvi #(list %1 (decorate %2 route editing %1)) state)) + +;; state transition functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defn todo [t] {:completed false :text t}) +(defn destroy! [i] (swap! state dissocv i)) +(defn done! [i v] (swap! state assoc-in [i :completed] v)) +(defn clear-done! [& _] (swap! state #(vec (remove :completed %)))) +(defn new! [t] (when (not (empty? t)) (swap! state conj (todo t)))) +(defn all-done! [v] (swap! state #(mapv (fn [x] (assoc x :completed v)) %))) +(defn editing! [i v] (reset! editing (if v i nil))) +(defn text! [i v] (if (empty? v) (destroy! i) (swap! state assoc-in [i :text] v))) + +;; page ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(html :lang "en" + (head + (meta :charset "utf-8") + (meta :http-equiv "X-UA-Compatible" :content "IE=edge,chrome=1") + (link :rel "stylesheet" :href "base.css") + (title "Hoplon • TodoMVC")) + (body + (noscript + (div :id "noscript" + (p "JavaScript is required to view this page."))) + (div + (section :id "todoapp" + (header :id "header" + (h1 "todos") + (form :on-submit #(do (new! (val-id :new-todo)) + (do! (by-id :new-todo) :value "")) + (input + :id "new-todo" + :type "text" + :autofocus true + :placeholder "What needs to be done?" + :on-blur #(do! (by-id :new-todo) :value "")))) + (section + :id "main" + :do-toggle (cell= (not (and (empty? active) (empty? completed)))) + (input + :id "toggle-all" + :type "checkbox" + :do-attr (cell= {:checked (empty? active)}) + :on-click #(all-done! (val-id :toggle-all))) + (label :for "toggle-all" + "Mark all as complete") + (ul :id "todo-list" + (loop-tpl + :reverse true + :bind-ids [done# edit#] + :bindings [[i {edit? :editing done? :completed todo-text :text show? :visible}] todos] + (li + :do-class (cell= {:completed done? :editing edit?}) + :do-toggle show? + (div :class "view" :on-dblclick #(editing! @i true) + (input + :id done# + :type "checkbox" + :class "toggle" + :do-attr (cell= {:checked done?}) + :on-click #(done! @i (val-id done#))) + (label (text "~{todo-text}")) + (button + :type "submit" + :class "destroy" + :on-click #(destroy! @i))) + (form :on-submit #(editing! @i false) + (input + :id edit# + :type "text" + :class "edit" + :do-value todo-text + :do-focus edit? + :on-blur #(when @edit? (editing! @i false)) + :on-change #(when @edit? (text! @i (val-id edit#))))))))) + (footer + :id "footer" + :do-toggle (cell= (not (and (empty? active) (empty? completed)))) + (span :id "todo-count" + (strong (text "~(count active) ")) + (span (text "~{plural-item} left"))) + (ul :id "filters" + (li (a :href "#/" :do-class (cell= {:selected (= "#/" route)}) "All")) + (li (a :href "#/active" :do-class (cell= {:selected (= "#/active" route)}) "Active")) + (li (a :href "#/completed" :do-class (cell= {:selected (= "#/completed" route)}) "Completed"))) + (button + :type "submit" + :id "clear-completed" + :on-click #(clear-done!) + (text "Clear completed (~(count completed))")))) + (footer :id "info" + (p "Double-click to edit a todo") + (p "Part of " (a :href "http://github.com/tailrecursion/hoplon-demos/" "hoplon-demos")))))) diff --git a/samples/Cycript/utils.cy b/samples/Cycript/utils.cy new file mode 100644 index 00000000..72e677b7 --- /dev/null +++ b/samples/Cycript/utils.cy @@ -0,0 +1,580 @@ +(function(utils) { + // Load C functions declared in utils.loadFuncs + var shouldLoadCFuncs = true; + // Expose the C functions to cycript's global scope + var shouldExposeCFuncs = true; + // Expose C constants to cycript's global scope + var shouldExposeConsts = true; + // Expose functions defined here to cycript's global scope + var shouldExposeFuncs = true; + // Which functions to expose + var funcsToExpose = ["exec", "include", "sizeof", "logify", "apply", "str2voidPtr", "voidPtr2str", "double2voidPtr", "voidPtr2double", "isMemoryReadable", "isObject", "makeStruct"]; + + // C functions that utils.loadFuncs loads + var CFuncsDeclarations = [ + // + "void *calloc(size_t num, size_t size)", + // + "char *strcpy(char *restrict dst, const char *restrict src)", + "char *strdup(const char *s1)", + "void* memset(void* dest, int ch, size_t count)", + // + "FILE *fopen(const char *, const char *)", + "int fclose(FILE *)", + "size_t fread(void *restrict, size_t, size_t, FILE *restrict)", + "size_t fwrite(const void *restrict, size_t, size_t, FILE *restrict)", + // + "mach_port_t mach_task_self()", + "kern_return_t task_for_pid(mach_port_name_t target_tport, int pid, mach_port_name_t *tn)", + "kern_return_t mach_vm_protect(vm_map_t target_task, mach_vm_address_t address, mach_vm_size_t size, boolean_t set_maximum, vm_prot_t new_protection)", + "kern_return_t mach_vm_write(vm_map_t target_task, mach_vm_address_t address, vm_offset_t data, mach_msg_type_number_t dataCnt)", + "kern_return_t mach_vm_read(vm_map_t target_task, mach_vm_address_t address, mach_vm_size_t size, vm_offset_t *data, mach_msg_type_number_t *dataCnt)", + ]; + + /* + Replacement for eval that can handle @encode etc. + + Usage: + cy# utils.exec("@encode(void *(int, char))") + @encode(void*(int,char)) + */ + utils.exec = function(str) { + var mkdir = @encode(int (const char *, int))(dlsym(RTLD_DEFAULT, "mkdir")); + var tempnam = @encode(char *(const char *, const char *))(dlsym(RTLD_DEFAULT, "tempnam")); + var fopen = @encode(void *(const char *, const char *))(dlsym(RTLD_DEFAULT, "fopen")); + var fclose = @encode(int (void *))(dlsym(RTLD_DEFAULT, "fclose")); + var fwrite = @encode(int (const char *, int, int, void *))(dlsym(RTLD_DEFAULT, "fwrite")); + var symlink = @encode(int (const char *, const char *))(dlsym(RTLD_DEFAULT, "symlink")); + var unlink = @encode(int (const char *))(dlsym(RTLD_DEFAULT, "unlink")); + var getenv = @encode(const char *(const char *))(dlsym(RTLD_DEFAULT, "getenv")); + var setenv = @encode(int (const char *, const char *, int))(dlsym(RTLD_DEFAULT, "setenv")); + + var libdir = "/usr/lib/cycript0.9"; + var dir = libdir + "/tmp"; + + mkdir(dir, 0777); + + // This is needed because tempnam seems to ignore the first argument on i386 + var old_tmpdir = getenv("TMPDIR"); + setenv("TMPDIR", dir, 1); + + // No freeing :( + var f = tempnam(dir, "exec-"); + setenv("TMPDIR", old_tmpdir, 1); + if(!f) { + return false; + } + + symlink(f, f + ".cy"); + + str = "exports.result = " + str; + + var handle = fopen(f, "w"); + fwrite(str, str.length, 1, handle); + fclose(handle); + + var r; + var except = null; + try { + r = require(f.replace(libdir + "/", "")); + } catch(e) { + except = e; + } + + unlink(f + ".cy"); + unlink(f); + + if(except !== null) { + throw except; + } + + return r.result; + }; + + /* + Applies known typedefs + Used in utils.include and utils.makeStruct + + Usage: + cy# utils.applyTypedefs("mach_vm_address_t") + "uint64_t" + */ + utils.applyTypedefs = function(str) { + var typedefs = { + "struct": "", + "restrict": "", + "FILE": "void", + "size_t": "uint64_t", + "uintptr_t": "unsigned long", + "kern_return_t": "int", + "mach_port_t": "unsigned int", + "mach_port_name_t": "unsigned int", + "vm_offset_t": "unsigned long", + "vm_size_t": "unsigned long", + "mach_vm_address_t": "uint64_t", + "mach_vm_offset_t": "uint64_t", + "mach_vm_size_t": "uint64_t", + "vm_map_offset_t": "uint64_t", + "vm_map_address_t": "uint64_t", + "vm_map_size_t": "uint64_t", + "mach_port_context_t": "uint64_t", + "vm_map_t": "unsigned int", + "boolean_t": "unsigned int", + "vm_prot_t": "int", + "mach_msg_type_number_t": "unsigned int", + "cpu_type_t": "int", + "cpu_subtype_t": "int", + "cpu_threadtype_t": "int", + }; + + for(var k in typedefs) { + str = str.replace(new RegExp("(\\s|\\*|,|\\(|^)" + k + "(\\s|\\*|,|\\)|$)", "g"), "$1" + typedefs[k] + "$2"); + } + + return str; + }; + + /* + Parses a C function declaration and returns the function name and cycript type + If load is true, tries to load it into cycript using utils.exec + + Usage: + cy# var str = "void *calloc(size_t num, size_t size)"; + "void *calloc(size_t num, size_t size)" + cy# utils.include(str) + ["calloc","@encode(void *(uint64_t num, uint64_t size))(140735674376857)"] + cy# var ret = utils.include(str, true) + ["calloc",0x7fff93e0e299] + cy# ret[1].type + @encode(void*(unsigned long long int,unsigned long long int)) + cy# ret[1](100, 1) + 0x100444100 + */ + utils.include = function(str, load) { + var re = /^\s*([^(]*(?:\s+|\*))(\w*)\s*\(([^)]*)\)\s*;?\s*$/; + var match = re.exec(str); + if(!match) { + return -1; + } + var rType = utils.applyTypedefs(match[1]); + var name = match[2]; + var args = match[3]; + + var argsRe = /([^,]+)(?:,|$)/g; + var argsTypes = []; + while((match = argsRe.exec(args)) !== null) { + var type = utils.applyTypedefs(match[1]); + argsTypes.push(type); + } + + var encodeString = "@encode("; + encodeString += rType + "("; + encodeString += argsTypes.join(", ") + "))"; + + var fun = dlsym(RTLD_DEFAULT, name); + if(fun !== null) { + encodeString += "(" + fun + ")"; + if(load) { + return [name, utils.exec(encodeString)]; + } + } else if(load) { + throw "Function couldn't be found with dlsym!"; + } + + return [name, encodeString]; + }; + + /* + Loads the function declaration in the defs array using utils.exec and exposes to cycript's global scope + Is automatically called if shouldLoadCFuncs is true + */ + utils.funcs = {}; + utils.loadfuncs = function(expose) { + for(var i = 0; i < CFuncsDeclarations.length; i++) { + try { + var o = utils.include(CFuncsDeclarations[i], true); + utils.funcs[o[0]] = o[1]; + if(expose) { + Cycript.all[o[0]] = o[1]; + } + } catch(e) { + system.print("Failed to load function: " + i); + try { + system.print(utils.include(CFuncsDeclarations[i])); + } catch(e2) { + + } + } + } + }; + + /* + Calculates the size of a type like the C operator sizeof + + Usage: + cy# utils.sizeof(int) + 4 + cy# utils.sizeof(@encode(void *)) + 8 + cy# utils.sizeof("mach_vm_address_t") + 8 + */ + utils.sizeof = function(type) { + if(typeof type === "string") { + type = utils.applyTypedefs(type); + type = utils.exec("@encode(" + type + ")"); + } + + // (const) char * has "infinite" preceision + if(type.toString().slice(-1) === "*") { + return utils.sizeof(@encode(void *)); + } + + // float and double + if(type.toString() === @encode(float).toString()) { + return 4; + } else if (type.toString() === @encode(double).toString()) { + return 8; + } + + var typeInstance = type(0); + + if(typeInstance instanceof Object) { + // Arrays + if("length" in typeInstance) { + return typeInstance.length * utils.sizeof(typeInstance.type); + } + + // Structs + if(typeInstance.toString() === "[object Struct]") { + var typeStr = type.toString(); + var arrayTypeStr = "[2" + typeStr + "]"; + var arrayType = new Type(arrayTypeStr); + + var arrayInstance = new arrayType; + + return @encode(void *)(&(arrayInstance[1])) - @encode(void *)(&(arrayInstance[0])); + } + } + + for(var i = 0; i < 5; i++) { + var maxSigned = Math.pow(2, 8 * Math.pow(2, i) - 1) - 1; + if(i === 3) { + // Floating point fix ;^) + maxSigned /= 1000; + } + + // can't use !== or sizeof(void *) === 0.5 + if(type(maxSigned) != maxSigned) { + return Math.pow(2, i - 1); + } + } + }; + + /* + Logs a specific message sent to an instance of a class like logify.pl in theos + Requires Cydia Substrate (com.saurik.substrate.MS) and NSLog (org.cycript.NSLog) modules + Returns the old message returned by MS.hookMessage (Note: this is not just the old message!) + + Usage: + cy# var oldm = utils.logify(objc_getMetaClass(NSNumber), @selector(numberWithDouble:)) + ... + cy# var n = [NSNumber numberWithDouble:1.5] + 2014-07-28 02:26:39.805 cycript[71213:507] +[ numberWithDouble:1.5] + 2014-07-28 02:26:39.806 cycript[71213:507] = 1.5 + @1.5 + */ + utils.logify = function(cls, sel) { + @import com.saurik.substrate.MS; + @import org.cycript.NSLog; + + var oldm = {}; + + MS.hookMessage(cls, sel, function() { + var args = [].slice.call(arguments); + + var selFormat = sel.toString().replace(/:/g, ":%@ ").trim(); + var logFormat = "%@[<%@: 0x%@> " + selFormat + "]"; + + var standardArgs = [logFormat, class_isMetaClass(cls)? "+": "-", cls.toString(), (&this).valueOf().toString(16)]; + var logArgs = standardArgs.concat(args); + + NSLog.apply(null, logArgs); + + var r = oldm->apply(this, arguments); + + if(r !== undefined) { + NSLog(" = %@", r); + } + + return r; + }, oldm); + + return oldm; + }; + + /* + Calls a C function by providing its name and arguments + Doesn't support structs + Return value is always a void pointer + + Usage: + cy# utils.apply("printf", ["%s %.3s, %d -> %c, float: %f\n", "foo", "barrrr", 97, 97, 1.5]) + foo bar, 97 -> a, float: 1.500000 + 0x22 + */ + utils.apply = function(fun, args) { + if(!(args instanceof Array)) { + throw "Args needs to be an array!"; + } + + var argc = args.length; + var voidPtr = @encode(void *); + var argTypes = []; + for(var i = 0; i < argc; i++) { + var argType = voidPtr; + + var arg = args[i]; + if(typeof arg === "string") { + argType = @encode(char *); + } + if(typeof arg === "number" && arg % 1 !== 0) { + argType = @encode(double); + } + + argTypes.push(argType); + } + + var type = voidPtr.functionWith.apply(voidPtr, argTypes); + + if(typeof fun === "string") { + fun = dlsym(RTLD_DEFAULT, fun); + } + + if(!fun) { + throw "Function not found!"; + } + + return type(fun).apply(null, args); + }; + + /* + Converts a string (char *) to a void pointer (void *) + You can't cast to strings to void pointers and vice versa in cycript. Blame saurik. + + Usage: + cy# var voidPtr = utils.str2voidPtr("foobar") + 0x100331590 + cy# utils.voidPtr2str(voidPtr) + "foobar" + */ + utils.str2voidPtr = function(str) { + var strdup = @encode(void *(char *))(dlsym(RTLD_DEFAULT, "strdup")); + return strdup(str); + }; + + /* + The inverse function of str2voidPtr + */ + utils.voidPtr2str = function(voidPtr) { + var strdup = @encode(char *(void *))(dlsym(RTLD_DEFAULT, "strdup")); + return strdup(voidPtr); + }; + + /* + Converts a double into a void pointer + This can be used to view the binary representation of a floating point number + + Usage: + cy# var n = utils.double2voidPtr(-1.5) + 0xbff8000000000000 + cy# utils.voidPtr2double(n) + -1.5 + */ + utils.double2voidPtr = function(n) { + var doublePtr = new double; + *doublePtr = n; + + var voidPtrPtr = @encode(void **)(doublePtr); + + return *voidPtrPtr; + }; + + /* + The inverse function of double2voidPtr + */ + utils.voidPtr2double = function(voidPtr) { + var voidPtrPtr = new @encode(void **); + *voidPtrPtr = voidPtr; + + var doublePtr = @encode(double *)(voidPtrPtr); + + return *doublePtr; + }; + + /* + Determines in a safe way if a memory location is readable + + Usage: + cy# utils.isMemoryReadable(0) + false + cy# utils.isMemoryReadable(0x1337) + false + cy# utils.isMemoryReadable(NSObject) + true + cy# var a = malloc(100); utils.isMemoryReadable(a) + true + */ + utils.isMemoryReadable = function(ptr) { + if(typeof ptr === "string") { + return true; + } + + var fds = new @encode(int [2]); + utils.apply("pipe", [fds]); + var result = utils.apply("write", [fds[1], ptr, 1]) == 1; + + utils.apply("close", [fds[0]]); + utils.apply("close", [fds[1]]); + + return result; + }; + + /* + Determines in a safe way if the memory location contains an Objective-C object + + Usage: + cy# utils.isObject(0) + false + cy# utils.isObject(0x1337) + false + cy# utils.isObject(NSObject) + true + cy# utils.isObject(objc_getMetaClass(NSObject)) + true + cy# utils.isObject([new NSObject init]) + true + cy# var a = malloc(100); utils.isObject(a) + false + cy# *@encode(void **)(a) = NSObject; utils.isObject(a) + true + */ + utils.isObject = function(obj) { + obj = @encode(void *)(obj); + var lastObj = -1; + + function objc_isa_ptr(obj) { + // See http://www.sealiesoftware.com/blog/archive/2013/09/24/objc_explain_Non-pointer_isa.html + var objc_debug_isa_class_mask = 0x00000001fffffffa; + obj = (obj & 1)? (obj & objc_debug_isa_class_mask): obj; + + if((obj & (utils.sizeof(@encode(void *)) - 1)) != 0) { + return null; + } else { + return obj; + } + } + + function ptrValue(obj) { + return obj? obj.valueOf(): null; + } + + var foundMetaClass = false; + + for(obj = objc_isa_ptr(obj); utils.isMemoryReadable(obj); ) { + obj = *@encode(void **)(obj); + + if(ptrValue(obj) == ptrValue(lastObj)) { + foundMetaClass = true; + break; + } + + lastObj = obj; + } + + if(!foundMetaClass) { + return false; + } + + if(lastObj === -1 || lastObj === null) { + return false; + } + + var obj_class = objc_isa_ptr(@encode(void **)(obj)[1]); + + if(!utils.isMemoryReadable(obj_class)) { + return false; + } + + var metaclass = objc_isa_ptr(@encode(void **)(obj_class)[0]); + var superclass = objc_isa_ptr(@encode(void **)(obj_class)[1]); + + return ptrValue(obj) == ptrValue(metaclass) && superclass == null; + }; + + /* + Creates a cycript struct type from a C struct definition + + Usage: + cy# var foo = makeStruct("int a; short b; char c; uint64_t d; double e;", "foo"); + @encode(foo) + cy# var f = new foo + &{a:0,b:0,c:0,d:0,e:0} + cy# f->a = 100; f + &{a:100,b:0,c:0,d:0,e:0} + cy# *@encode(int *)(f) + 100 + */ + utils.makeStruct = function(str, name) { + var fieldRe = /(?:\s|\n)*([^;]+\s*(?:\s|\*))([^;]+)\s*;/g; + + if(!name) { + name = "struct" + Math.floor(Math.random() * 100000); + } + var typeStr = "{" + name + "="; + + while((match = fieldRe.exec(str)) !== null) { + var fieldType = utils.applyTypedefs(match[1]); + var fieldName = match[2]; + var encodedType = utils.exec("@encode(" + fieldType + ")").toString(); + + typeStr += '"' + fieldName + '"' + encodedType; + } + + typeStr += "}"; + + return new Type(typeStr); + }; + + // Various constants + utils.constants = { + VM_PROT_NONE: 0x0, + VM_PROT_READ: 0x1, + VM_PROT_WRITE: 0x2, + VM_PROT_EXECUTE: 0x4, + VM_PROT_NO_CHANGE: 0x8, + VM_PROT_COPY: 0x10, + VM_PROT_WANTS_COPY: 0x10, + VM_PROT_IS_MASK: 0x40, + }; + var c = utils.constants; + c.VM_PROT_DEFAULT = c.VM_PROT_READ | c.VM_PROT_WRITE; + c.VM_PROT_ALL = c.VM_PROT_READ | c.VM_PROT_WRITE | c.VM_PROT_EXECUTE; + + if(shouldExposeConsts) { + for(var k in c) { + Cycript.all[k] = c[k]; + } + } + + if(shouldExposeFuncs) { + for(var i = 0; i < funcsToExpose.length; i++) { + var name = funcsToExpose[i]; + Cycript.all[name] = utils[name]; + } + } + + if(shouldLoadCFuncs) { + utils.loadfuncs(shouldExposeCFuncs); + } +})(exports); diff --git a/samples/HTML+ERB/fishbowl.html.erb.deface b/samples/HTML+ERB/fishbowl.html.erb.deface new file mode 100644 index 00000000..43d60cec --- /dev/null +++ b/samples/HTML+ERB/fishbowl.html.erb.deface @@ -0,0 +1,31 @@ + +<% if Spree::Config[:enable_fishbowl] %> +
+
+
+ <%= t(:fishbowl_settings)%> + <% @fishbowl_options.each do |key| %> +
+ <%= label_tag(key, t(key.to_s.gsub('fishbowl_', '').to_sym) + ': ') + tag(:br) %> + <%= text_field_tag('preferences[' + key.to_s + ']', Spree::Config[key], { :size => 10, :class => 'fullwidth' }) %> +
+ <% end %> +
+ <%= hidden_field_tag 'preferences[fishbowl_always_fetch_current_inventory]', '0' %> + <%= check_box_tag('preferences[fishbowl_always_fetch_current_inventory]', "1", Spree::Config[:fishbowl_always_fetch_current_inventory]) %> + <%= t(:always_fetch_current_inventory) %> +
+ <% if !@location_groups.empty? %> +
+ <%= label_tag(:fishbowl_location_group, t(:location_group) + ': ') + tag(:br) %> + <%= select('preferences', 'fishbowl_location_group', @location_groups, { :selected => Spree::Config[:fishbowl_location_group]}, { :class => ['select2', 'fullwidth'] }) %> +
+ <% end %> +
+
+
+ + +<% end %> \ No newline at end of file diff --git a/samples/HTML+ERB/index.html.erb b/samples/HTML+ERB/index.html.erb new file mode 100644 index 00000000..f8888a4b --- /dev/null +++ b/samples/HTML+ERB/index.html.erb @@ -0,0 +1,39 @@ +<% provide(:title, @header) %> +<% present @users do |user_presenter| %> +
+

<%= @header %>

+
+ +
+
+ <%= will_paginate %> +
+
+
+
+
+
Name
+
Email
+
Chords
+
Keys
+
Tunings
+
Credits
+
Prem?
+
Since?
+
+ + <% if @users == [] %> +
+
No Users
+
+ <% else %> + <%= render @users %> + <% end %> +
+
+
+
+ <%= will_paginate %> +
+
+<% end %> \ No newline at end of file diff --git a/samples/Haml/buttons.html.haml.deface b/samples/Haml/buttons.html.haml.deface new file mode 100644 index 00000000..f338721a --- /dev/null +++ b/samples/Haml/buttons.html.haml.deface @@ -0,0 +1,29 @@ +/ + replace '.actions' + +.pull-right + .btn-group + = link_to page.url, target: "_blank", title: t('.view_live_html'), class: "tip btn btn-xs btn-default" do + %i.icon-picture.row-black + + = link_to refinery.edit_admin_page_path(page.nested_url, + switch_locale: (page.translations.first.locale unless page.translated_to_default_locale?)), + title: t('edit', :scope => 'refinery.admin.pages'), + class: "tip btn btn-xs btn-default" do + %i.icon-edit.row-blue + + + - if page.deletable? + = link_to refinery.admin_page_path(page.nested_url), + methode: :delete, + title: t('delete', :scope => 'refinery.admin.pages'), + class: "tip cancel confirm-delete btn btn-xs btn-default", + data: { confirm: t('message', scope: 'refinery.admin.delete', title: page_title_with_translations(page)) } do + %i.icon-trash.row-red + - else + %button.btn.btn-xs.btn-default.disabled + %i.icon-trash + + .btn-group + = link_to refinery.new_admin_page_path(:parent_id => page.id), title: t('new', :scope => 'refinery.admin.pages'), class: "tip btn btn-xs btn-default" do + %i.icon-plus.row-green diff --git a/samples/LookML/comments.view.lookml b/samples/LookML/comments.view.lookml new file mode 100644 index 00000000..ed2d29aa --- /dev/null +++ b/samples/LookML/comments.view.lookml @@ -0,0 +1,43 @@ +- view: comments + fields: + + - dimension: id + primary_key: true + type: int + sql: ${TABLE}.id + + - dimension: body + sql: ${TABLE}.body + + - dimension_group: created + type: time + timeframes: [time, date, week, month] + sql: ${TABLE}.created_at + + - dimension: headline_id + type: int + hidden: true + sql: ${TABLE}.headline_id + + - dimension_group: updated + type: time + timeframes: [time, date, week, month] + sql: ${TABLE}.updated_at + + - dimension: user_id + type: int + hidden: true + sql: ${TABLE}.user_id + + - measure: count + type: count + detail: detail* + + + # ----- Detail ------ + sets: + detail: + - id + - headlines.id + - headlines.name + - users.id diff --git a/samples/OpenSCAD/not_simple.scad b/samples/OpenSCAD/not_simple.scad new file mode 100644 index 00000000..dd4d1301 --- /dev/null +++ b/samples/OpenSCAD/not_simple.scad @@ -0,0 +1,13 @@ +// A more complicated 3D shape in OpenSCAD +$fn=32; + +difference() { + // main shape + union() { + translate( [ 0, 0, 2 ] ) cube( [ 15, 15, 4 ], center=true ); + translate( [ 0, 0, 13 ] ) cylinder( h=25, r1=5, r2=3, center=true ); + translate( [ 0, 0, 28 ] ) sphere( r=6 ); + } + // hole through center + translate( [ 0, 0, 17 ] ) cylinder( h=35, r=2, center=true ); +} diff --git a/samples/OpenSCAD/simple.scad b/samples/OpenSCAD/simple.scad new file mode 100644 index 00000000..b3e4da5d --- /dev/null +++ b/samples/OpenSCAD/simple.scad @@ -0,0 +1,3 @@ +// Simple sphere in OpenSCAD + +sphere( r=10 ); diff --git a/samples/Perl/example.cgi b/samples/Perl/example.cgi new file mode 100755 index 00000000..eac1ef92 --- /dev/null +++ b/samples/Perl/example.cgi @@ -0,0 +1,447 @@ +#!/usr/bin/perl + +# v1.0 +# nagiostat, program to insert performance-data from Nagios into RRD-archives +# Copyright (C) 2004 Carl Bingel / Svensk IT konsult AB +# +# 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. + +use strict; + +## Basic configuration options +my $BASE_DIR = "/usr/share/nagiostat"; +my $CONFIG_FILE = "/etc/nagios/nagiostat.conf"; ## Config-file location +my $DEBUG_LOG_FILE = "/var/spool/nagiostat/debug.log"; ## Specify where to create log-file and what filename (must be writable by nagios-user!) +my $DEBUGLEVEL = 1; ## 0=Nothing, 1=Errors, 2=Warnings, 3=Debug +my $DEBUGOUTPUT = 0; ## 0=file, 1=STDERR, 2=STDOUT (for cgi) + +require 'shellwords.pl'; + +## Global vars +my $DEBUG_TIMESTAMP=0; + +## Find out how program is run +if( $ARGV[0] eq "-t") { ## -t = test configuration-file + print STDERR "nagiostat: Testing configuration-file..\n"; + $DEBUGLEVEL=3; + $DEBUGOUTPUT=1; ## output errors to console and not file + my $c = &read_config(); + abort(); +} elsif( $ARGV[0] eq "-p") { ## -p = parse performance-data (when started by nagios) + &parse_perfdata(); +} else { + if( exists $ENV{'GATEWAY_INTERFACE'}) { ## we are run as a CGI-script! + $DEBUGOUTPUT=2; ## output errors to web-browser + &run_as_cgi(); + } else { ## print some help-info + print STDERR "nagiostat: usage: + -t Test configuration-file + -p Parse/import performance-data (used when called from nagios) +"; + } +} + +abort(); + +sub abort { + ## logfile: write blank if we wrote anything... + if( $DEBUG_TIMESTAMP!=0) { + debug( 1, ""); + } + exit; +} + +## +## Program is called as CGI +## +sub run_as_cgi { + use CGI; + my $cgi = new CGI; + + my $graph_name = $cgi->param( "graph_name"); + my $graph_iteration = $cgi->param( "graph_iteration"); + + if( $graph_iteration eq "") { + print "Content-type: text/html\nExpires: 0\n\n"; + } else { + print "Content-type: image/gif\nExpires: 0\n\n"; + } + + my $config = read_config(); + + if( $graph_name eq "") { + ## + ## display index of graphs + ## + display_htmltemplate( $config->{'htmltemplatepath'}."/".$config->{'graphindextemplate'}, $graph_name, $config); + } else { ## display graph + if( ! exists $config->{'graphs'}->{$graph_name}) { + debug( 1, "ERROR: Graph '$graph_name' does not exist!"); + exit; + } elsif( $graph_iteration eq "") { + ## + ## Display HTML-page with all the graphs + ## + if( ! -r $config->{'htmltemplatepath'}."/".$config->{'graphs'}->{$graph_name}->{'htmltemplate'}) { + debug( 1, "ERROR: HTML-template '".($config->{'htmltemplatepath'}."/".$config->{'graphs'}->{$graph_name}->{'htmltemplate'})."' is not readable by effective userid!"); + exit; + } + display_htmltemplate( $config->{'htmltemplatepath'}."/".$config->{'graphs'}->{$graph_name}->{'htmltemplate'}, $graph_name, $config); + } else { + ## + ## generate graph (call 'rrdtool graph') + ## + my $rrdtool_cmdline = $config->{'rrdtoolpath'}." graph - ".join( " ", @{$config->{'plottemplates'}->{ $config->{'graphs'}->{$graph_name}->{'plottemplate'} } }); + + ## expand variables + my $rrdarchive = $config->{'rrdarchivepath'}."/".$config->{'graphs'}->{$graph_name}->{'rrdfilename'}; + $rrdtool_cmdline =~ s/\$f/$rrdarchive/g; + my $t_start = $config->{'graphtimetemplates'}->{ $config->{'graphs'}->{$graph_name}->{'graphtimetemplate'} }->[$graph_iteration]->{'starttime'}; + $rrdtool_cmdline =~ s/\$s/$t_start/g; + my $t_end = $config->{'graphtimetemplates'}->{ $config->{'graphs'}->{$graph_name}->{'graphtimetemplate'} }->[$graph_iteration]->{'endtime'}; + $rrdtool_cmdline =~ s/\$e/$t_end/g; + my $t_descr = $config->{'graphtimetemplates'}->{ $config->{'graphs'}->{$graph_name}->{'graphtimetemplate'} }->[$graph_iteration]->{'description'}; + $rrdtool_cmdline =~ s/\$d/$t_descr/g; + + ## Call rrdtool (should probably be fixed to call it in a better way, like exec) + print `$rrdtool_cmdline`; + } + + } + +} + +## Display HTML template (and do variable-substitution and other stuff) +## +sub display_htmltemplate { + my( $filename, $graph_name, $config) = @_; + + if( -r $filename) { + open( HTML, $filename); + while( ) { + ## All is a big regex.. :-) + s/\$(\w+)/my $t=sub { + my $varname = $_[0]; + if( $varname eq "GRAPHNAME") { ## return the name of the graph + if( $config->{'graphs'}->{$graph_name}->{'title'} ne "") { + return( $config->{'graphs'}->{$graph_name}->{'title'}); + } else { + return( "Graph ".$graph_name); + } + } elsif( $varname eq "CURRENTTIME") { ## return current date-time + return( localtime()); + } elsif( $varname eq "GRAPHINDEX" || $varname eq "GRAPHINDEX_ONEROW") { ## return HTML-code for index of the different graphs + my $return_html; + foreach my $gn ( sort keys %{$config->{'graphs'}}) { + $return_html.=(($varname eq "GRAPHINDEX")?"
  • ":""). + "".($config->{'graphs'}->{$gn}->{'title'})."<\/A>". # must escape slash since were inside an regex! + (($varname eq "GRAPHINDEX_ONEROW")?"  ":""); + } + return( $return_html); + } elsif( $varname eq "GRAPH_AUTOGENERATE") { ## return HTML-code for displaying the actual graph-images + my $iteration_id=0; + my $return_html; + foreach my $time ( @{ $config->{'graphtimetemplates'}->{ $config->{'graphs'}->{$graph_name}->{'graphtimetemplate'} } }) { + $return_html.="

    ".($time->{'description'})."
    "; + $iteration_id++; + } + return( $return_html); + } else { ## unknown variable + return( "##UNKNOWN-VARIABLE##"); + } + }; &$t($1)/eig; ## i thought that regex would never end! + print; + } + close( HTML); + } else { + print "ERROR: HTML-template '$filename' does not exist or is not readable by effective userid."; + } + +} + +## +## Process incoming performance-data (parse output from check-plugin and insert values into rrd-archives) +## +sub parse_perfdata { + + $DEBUG_TIMESTAMP=0; + + my $config = read_config(); + + my $rrd_updates; + + ## Provide more symbolic names (same names as the macros in nagios configuration-file) + + my( $LASTCHECK, $HOSTNAME, $SERVICEDESCR, $SERVICESTATE, $OUTPUT, $PERFDATA) = split( /\|!!\|/, $ARGV[1]); + debug( 3, "**INCOMING PERFDATA:\n LASTCHECK=$LASTCHECK\n HOSTNAME=$HOSTNAME\n SERVICEDESCR=\"$SERVICEDESCR\"\n SERVICESTATE=\"$SERVICESTATE\"\n OUTPUT=\"$OUTPUT\"\n PERFDATA=\"$PERFDATA\""); + + my $host_and_descr_found; + ## Loop through all host_regexes + foreach my $host_regex ( keys %{$config->{'regexes'}}) { + ## Loop through all service_description_regexes + foreach my $service_regex ( keys %{$config->{'regexes'}->{$host_regex}}) { + if( ($HOSTNAME =~ m/$host_regex/i) && ($SERVICEDESCR =~ m/$service_regex/i) ) { ## match! + $host_and_descr_found=1; + ## Loop through all InsertValue-lines with same host and service_description match + foreach my $insert_value ( @{$config->{'regexes'}->{$host_regex}->{$service_regex}} ) { + ## Loop through all regexes that should match values in the output/perfdata + foreach my $regex ( @{ $config->{'valueregextemplates'}->{$insert_value->{'regextemplate'}} }) { + my $regex_string = $regex->{'regex'}; + if( $regex->{'regex_what'} eq "output") { ## do regex on "output" + if( $OUTPUT =~ m/$regex_string/) { + debug( 3, " +VALUE: ".$1); + push( @{$rrd_updates->{$insert_value->{'rrdarchive'}}->{'value'}}, $1); + push( @{$rrd_updates->{$insert_value->{'rrdarchive'}}->{'dsaname'}}, $regex->{'dsaname'}); + $rrd_updates->{$insert_value->{'rrdarchive'}}->{'rrdcreatetemplate'} = $insert_value->{'rrdcreatetemplate'}; #$config->{'regexes'}->{$host_regex}->{$service_regex}->[0]->{'rrdcreatetemplate'}; + } else { + debug( 2, "**WARNING: No match for value with regex on output '$regex_string'."); + } + } else { ## do regex on "perfdata" + if( $PERFDATA =~ m/$regex_string/) { + debug( 3, " +VALUE: ".$1); + push( @{$rrd_updates->{$insert_value->{'rrdarchive'}}->{'value'}}, $1); + push( @{$rrd_updates->{$insert_value->{'rrdarchive'}}->{'dsaname'}}, $regex->{'dsaname'}); + $rrd_updates->{$insert_value->{'rrdarchive'}}->{'rrdcreatetemplate'} = $insert_value->{'rrdcreatetemplate'}; #$config->{'regexes'}->{$host_regex}->{$service_regex}->[0]->{'rrdcreatetemplate'}; + } else { + debug( 2, "**WARNING: No match for value with regex on perfdata '$regex_string'."); + } + } + } + } + + } + } + } + + if( !$host_and_descr_found) { + debug( 2, "**WARNING: Hostname and description didn't match any of the regexes in the config-file."); + } else { + ## + ## Insert the value into the RRD by calling the rrdtool (may be several rrd-archives) + ## + foreach my $archive ( keys %{$rrd_updates}) { + debug( 3, " =INSERT into '$archive': ".join( ",", @{$rrd_updates->{$archive}->{'value'}} )." DSA-names=".join( ",", @{$rrd_updates->{$archive}->{'dsaname'}}) ); + + my $rrdarchive_filename = $config->{'rrdarchivepath'}."/".$archive; + + ## Create RRD-Archive (according to template) if it does not exist + if( ! -e $rrdarchive_filename) { + my $rrdtool_cmdline = $config->{'rrdtoolpath'}." create ".$rrdarchive_filename." ".(join( " ", @{$config->{'rrdcreatetemplates'}->{$rrd_updates->{$archive}->{'rrdcreatetemplate'}}})); + debug( 2, "**CREATING: $rrdarchive_filename, cmdline='".$rrdtool_cmdline."'."); + `$rrdtool_cmdline`; + } + + ## Check if rrd-archive is writable + if( ! -w $rrdarchive_filename) { ## check wheter RRD-archive exists + debug( 1, "!!ERROR: RRD-archive '".$rrdarchive_filename."' does not exist or is not writable by effective UID."); abort(); + } + + ## Assemle command-line for rrdtool + my $rrdtool_cmdline = $config->{'rrdtoolpath'}." update ".$rrdarchive_filename. + " --template ".join( ":", @{$rrd_updates->{$archive}->{'dsaname'}}). + " $LASTCHECK:".join( ":", @{$rrd_updates->{$archive}->{'value'}}); + debug( 3, " !RRDCMDLINE: ".$rrdtool_cmdline); + my $result = `$rrdtool_cmdline`; + if( $result ne "") { + debug( 1, "!!RESULT: $result"); + } + } + } + +} + + + + +## +## Read config-file and check for errors +## +sub read_config { + my $config; + open( CONFIG, $CONFIG_FILE); + my( $line_counter); + while( ) { + $line_counter++; + chomp; + my( @args) = &shellwords( $_); + my $orig_confline = $_; + $args[0] = uc( $args[0]); + + if( $args[0] eq "INSERTVALUE") { ## INSERTVALUE-command + shift @args; + my( $rrd_filename, $rrdcreatetemplate, $hostname_regex, $servicedescr_regex, $regex_template) = @args; + + if( ! exists $config->{'rrdcreatetemplates'}->{$rrdcreatetemplate}) { + debug( 1, "!!ERROR: RRDCreateTemplate '$rrdcreatetemplate' is not defined but refered to in line $line_counter."); abort(); + } + if( $hostname_regex !~ m/^\/(.*)\/$/) { ## verify hostname regex + debug( 1, "!!ERROR: Hostname regex should be enclosed in slashes, i.e. /HOSTNAME/ and optionally enclosed in quotes if needed. Conf-line $line_counter."); abort(); + } else { + $hostname_regex = $1; + } + if( $servicedescr_regex !~ m/^\/(.*)\/$/) { ## verify service description regex + debug( 1, "!!ERROR: Service-description regex should be enclosed in slashes, i.e. /SERVICEDESCR/ and optionally enclosed in quotes if needed. Config-line $line_counter."); + abort(); + } else { + $servicedescr_regex = $1; + } + if( ! exists $config->{'valueregextemplates'}->{$regex_template}) { ## verify value-regex-template exists + debug( 1, "!!ERROR: VALUEREGEXTEMPLATE '$regex_template' is not defined on line $line_counter."); abort(); + } + push( @{$config->{'regexes'}->{$hostname_regex}->{$servicedescr_regex}}, { + 'rrdarchive' => $rrd_filename, + 'rrdcreatetemplate' => $rrdcreatetemplate, + 'regextemplate' => $regex_template + } ); + } elsif( $args[0] =~ m/^(\s*)#/ || $args[0] eq "") { ## comment or blank row + ## do nuthin + } elsif( $args[0] eq "RRDTOOLPATH") { ## RRDToolPath args: path + $config->{'rrdtoolpath'} = $args[1]; + } elsif( $args[0] eq "PLOTTEMPLATE") { ## PlotTemplate args: name,htmltemplate,parameters.. + shift @args; + my( $name, @params) = @args; + if( $name eq "") { + debug( 1, "!!ERROR: PLOTTEMPLATE-name must be specified on line $line_counter."); abort(); + } + if( exists $config->{'plottemplates'}->{$name}) { + debug( 1, "!!ERROR: PLOTTTEMPLATE-names must be uniqe. Duplicate name found on line: $line_counter."); abort(); + } + $config->{'plottemplates'}->{$name} = [ @params]; + } elsif( $args[0] eq "GRAPHTIMETEMPLATE") { ## GraphTimeTemplate args: name,parameters.. + shift @args; + my( $name, @params) = @args; + if( $name eq "") { + debug( 1, "!!ERROR: GRAPHTIMETEMPLATE-name must be specified on line $line_counter."); abort(); + } + if( exists $config->{'graphtimetemplates'}->{$name}) { + debug( 1, "!!ERROR: GRAPHTIMETEMPLATE-names must be uniqe. Duplicate name found on line: $line_counter."); abort(); + } + foreach my $time_template (@params) { + my( $t_start, $t_end, @t_descr) = split( /:/, $time_template); + my $t_descr = join( ":", @t_descr); # workaround if ':' is used in description-string + if( $t_start eq "" || $t_end eq "") { + debug( 1, "!!ERROR: GRAPHTIMETEMPLATE, each time-definition should be defined as '::' on line $line_counter."); + } + push( @{$config->{'graphtimetemplates'}->{$name}}, { + 'starttime' => $t_start, + 'endtime' => $t_end, + 'description' => $t_descr + }); + } + } elsif( $args[0] eq "RRDCREATETEMPLATE") { ## RRDCreateTemplate + shift @args; + my( $name, @params) = @args; + if( $name eq "") { + debug( 1, "!!ERROR: RRDCREATETEMPLATE-name must be specified on line $line_counter."); abort(); + } + if( exists $config->{'rrdcreatetemplates'}->{$name}) { + debug( 1, "!!ERROR: RRDCREATETEMPLATE-names must be uniq. Duplicate name found on line: $line_counter."); abort(); + } + $config->{'rrdcreatetemplates'}->{$name} = [ @params]; + } elsif( $args[0] eq "VALUEREGEXTEMPLATE") { ## ValueRegexTemplate + shift @args; + my( $template_name, @regexes) = @args; + if( $template_name eq "") { + debug( 1, "!!ERROR: VALUEREGEXTEMPLATE-name must be specified on line $line_counter."); abort(); + } + foreach my $r (@regexes) { + if( $r !~ m/^(output|perfdata):(\w+):\/(.*)\/$/) { + debug( 1, "!!ERROR: Value-regex should be formatted as 'output:dsaname:/regex/' or 'perfdata:dsaname:/regex/' depending on in which field to extract the data. The value should be within parantheses in the regex. Config-line $line_counter."); + abort(); + } else { + my( $regex_what, $dsa_name, $regex) = ( $1, $2, $3); + push( @{$config->{'valueregextemplates'}->{$template_name}}, { + 'regex_what' => $regex_what, + 'regex' => $regex, + 'dsaname' => $dsa_name + } ); + } + } + } elsif( $args[0] eq "RRDARCHIVEPATH") { ## RRDARCHIVEPATH + $config->{'rrdarchivepath'} = $args[1]; + } elsif( $args[0] eq "HTMLTEMPLATEPATH") { ## HTMLTemplatePath + $config->{'htmltemplatepath'} = $args[1]; + } elsif( $args[0] eq "GRAPHINDEXTEMPLATE") { ## GraphIndexTemplate + $config->{'graphindextemplate'} = $args[1]; + } elsif( $args[0] eq "GRAPH") { ## GRAPH args: name,rrdfilename,rrdcreatetemplate,graphtimetemplate,plottemplate,htmltemplate + if( $args[1] eq "") { + debug( 1, "!!ERROR: GRAPH-name must be specified on line $line_counter."); abort(); + } + if( ! exists $config->{'graphtimetemplates'}->{$args[3]}) { + debug( 1, "!!ERROR: Unknown GRAPHTIMETEMPLATE on line $line_counter."); abort(); + } + if( ! exists $config->{'plottemplates'}->{$args[4]}) { + debug( 1, "!!ERROR: Unknown PLOTTEMPLATE on line $line_counter."); abort(); + } + if( exists $config->{'graphs'}->{$args[1]}) { + debug( 1, "!!ERROR: Graphnames must be uniqe. Duplicate name found on line: $line_counter."); + abort(); + } else { + $config->{'graphs'}->{$args[1]} = { + 'graphname' => $args[1], + 'rrdfilename' => $args[2], + 'graphtimetemplate' => $args[3], + 'plottemplate' => $args[4], + 'htmltemplate' => $args[5], + 'title' => $args[6] + }; + } + } else { + debug( 1, "!!ERROR: Unknown config-file directive on line $line_counter: '".$args[0]."'"); + } + } + close( CONFIG); + + if( ! -x $config->{'rrdtoolpath'}) { + debug( 1, "!!ERROR: RRDTOOLPATH does not point to executable rrdtool-binary."); + abort(); + } + if( ! -x $config->{'rrdarchivepath'}) { + debug( 1, "!!ERROR: RRDARCHIVEPATH, '".($config->{'rrdarchivepath'})."' is not readable by effective userid."); abort(); + } + if( ! -x $config->{'htmltemplatepath'}) { + debug( 1, "!!ERROR: HTMLTEMPLATEPATH, '".($config->{'htmltemplatepath'})."' is not readable by effective userid."); abort(); + } + + return( $config); +} + + +## +## Write debug-output/logging +## +sub debug { + my( $level, $msg) = @_; + if( $DEBUGLEVEL >= $level) { + + ## write timestamp + if( !$DEBUG_TIMESTAMP) { + $DEBUG_TIMESTAMP=1; + debug( 1, scalar localtime()); + } + + ## write to file or STDERR + if( $DEBUGOUTPUT == 0) { + open( DEBUGOUTPUT, ">>".$DEBUG_LOG_FILE); + print DEBUGOUTPUT $msg."\n"; + close( DEBUGOUTPUT); + } elsif( $DEBUGOUTPUT == 2) { + print "

    $msg
    "; + } else { + print STDERR $msg."\n"; + } + + } +} diff --git a/samples/Perl/strict.t b/samples/Perl/strict.t new file mode 100644 index 00000000..04cea2f8 --- /dev/null +++ b/samples/Perl/strict.t @@ -0,0 +1,11 @@ +use Test::Base; + +__DATA__ +=== Strict Test + +--- perl strict +my $x = 5; +--- strict +use strict; +use warnings; +my $x = 5; \ No newline at end of file diff --git a/samples/SQF/fn_remoteExecFnc.sqf b/samples/SQF/fn_remoteExecFnc.sqf new file mode 100644 index 00000000..f9cf08ca --- /dev/null +++ b/samples/SQF/fn_remoteExecFnc.sqf @@ -0,0 +1,68 @@ +/* + * Author: commy2 + * + * Execute a function on a remote machine in mp. + * + * Argument: + * 0: Function arguments (Array) + * 1: Function to execute, has to be defined on the remote machine first (String) + * 2: The function will be executed where this unit is local OR the mode were this function should be executed. (Object OR Number, optional default: 2) + * Mode 0: execute on this machine only + * Mode 1: execute on server + * Mode 2: execute on all clients + server + * Mode 3: execute on dedicated only + * + * Return value: + * Nothing + */ + +private ["_arguments", "_function", "_unit", "_id"]; + +AGM_Core_remoteFnc = _this; + +_arguments = _this select 0; +_function = call compile (_this select 1); +_unit = _this select 2; + +if (isNil "_unit") then { + _unit = 2; +}; + +if (typeName _unit == "SCALAR") exitWith { + switch (_unit) do { + case 0 : { + _arguments call _function; + }; + case 1 : { + if (isServer) then { + _arguments call _function; + } else { + publicVariableServer "AGM_Core_remoteFnc"; + }; + }; + case 2 : { + _arguments call _function; + + AGM_Core_remoteFnc set [2, 0]; + publicVariable "AGM_Core_remoteFnc"; + }; + case 3 : { + if (isDedicated) then { + _arguments call _function; + } else { + if (!isServer) then {publicVariableServer "AGM_Core_remoteFnc"}; + }; + }; + }; +}; + +if (local _unit) then { + _arguments call _function; +} else { + if (isServer) then { + _id = owner _unit; + _id publicVariableClient "AGM_Core_remoteFnc"; + } else { + publicVariableServer "AGM_Core_remoteFnc"; + }; +}; \ No newline at end of file diff --git a/samples/SQF/macros.hqf b/samples/SQF/macros.hqf new file mode 100644 index 00000000..6f53296c --- /dev/null +++ b/samples/SQF/macros.hqf @@ -0,0 +1,19 @@ +#include + +#define SET(VAR,VALUE) private #VAR; VAR = VALUE; +#define CONV(VAR,ARRAY,POOL) VAR = ARRAY select (POOL find VAR); + +#define ALL_HITPOINTS_MAN [ \ + "HitHead", "HitBody", \ + "HitLeftArm", "HitRightArm", \ + "HitLeftLeg","HitRightLeg" \ +] + +#define ALL_HITPOINTS_VEH [ \ + "HitBody", "HitHull", "HitEngine", "HitFuel", \ + "HitTurret", "HitGun", \ + "HitLTrack", "HitRTrack", \ + "HitLFWheel", "HitRFWheel", "HitLF2Wheel", "HitRF2Wheel", "HitLMWheel", "HitRMWheel", "HitLBWheel", "HitRBWheel", \ + "HitAvionics", "HitHRotor", "HitVRotor", \ + "HitRGlass", "HitLGlass", "HitGlass1", "HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6" \ +] diff --git a/samples/TeX/authortitle.cbx b/samples/TeX/authortitle.cbx new file mode 100644 index 00000000..0ba18e87 --- /dev/null +++ b/samples/TeX/authortitle.cbx @@ -0,0 +1,119 @@ +\ProvidesFile{authortitle.cbx} +[\abx@cbxid] + +\ExecuteBibliographyOptions{uniquename,uniquelist,autocite=footnote} + +\renewcommand*{\iffinalcitedelim}{\iflastcitekey} + +\newbool{cbx:parens} + +\newbibmacro*{cite}{% + \iffieldundef{shorthand} + {\ifnameundef{labelname} + {} + {\printnames{labelname}% + \setunit{\nametitledelim}}% + \usebibmacro{cite:title}}% + {\usebibmacro{cite:shorthand}}} + +\newbibmacro*{citetitle}{% + \iffieldundef{shorthand} + {\usebibmacro{cite:title}}% + {\usebibmacro{cite:shorthand}}} + +\newbibmacro*{textcite}{% + \ifnameundef{labelname} + {} + {\printnames{labelname}% + \setunit{% + \global\booltrue{cbx:parens}% + \addspace\bibopenparen}}% + \ifnumequal{\value{citecount}}{1} + {\usebibmacro{prenote}} + {}% + \iffieldundef{shorthand} + {\usebibmacro{cite:title}}% + {\usebibmacro{cite:shorthand}}} + +\newbibmacro*{cite:title}{% + \printtext[bibhyperref]{% + \printfield[citetitle]{labeltitle}}} + +\newbibmacro*{cite:shorthand}{% + \printtext[bibhyperref]{\printfield{shorthand}}} + +\newbibmacro*{textcite:postnote}{% + \iffieldundef{postnote} + {\ifbool{cbx:parens} + {\bibcloseparen} + {}} + {\ifbool{cbx:parens} + {\postnotedelim} + {\addspace\bibopenparen}% + \printfield{postnote}\bibcloseparen}} + +\DeclareCiteCommand{\cite} + {\usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{cite}} + {\multicitedelim} + {\usebibmacro{postnote}} + +\DeclareCiteCommand*{\cite} + {\usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{citetitle}} + {\multicitedelim} + {\usebibmacro{postnote}} + +\DeclareCiteCommand{\parencite}[\mkbibparens] + {\usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{cite}} + {\multicitedelim} + {\usebibmacro{postnote}} + +\DeclareCiteCommand*{\parencite}[\mkbibparens] + {\usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{citetitle}} + {\multicitedelim} + {\usebibmacro{postnote}} + +\DeclareCiteCommand{\footcite}[\mkbibfootnote] + {\usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{cite}} + {\multicitedelim} + {\usebibmacro{postnote}} + +\DeclareCiteCommand{\footcitetext}[\mkbibfootnotetext] + {\usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{cite}} + {\multicitedelim} + {\usebibmacro{postnote}} + +\DeclareCiteCommand{\smartcite}[\iffootnote\mkbibparens\mkbibfootnote] + {\usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{cite}} + {\multicitedelim} + {\usebibmacro{postnote}} + +\DeclareCiteCommand{\textcite} + {\boolfalse{cbx:parens}} + {\usebibmacro{citeindex}% + \iffirstcitekey + {\setcounter{textcitetotal}{1}} + {\stepcounter{textcitetotal}% + \textcitedelim}% + \usebibmacro{textcite}} + {\ifbool{cbx:parens} + {\bibcloseparen\global\boolfalse{cbx:parens}} + {}} + {\usebibmacro{textcite:postnote}} + +\DeclareMultiCiteCommand{\textcites}{\textcite}{} + +\endinput diff --git a/samples/TeX/english.lbx b/samples/TeX/english.lbx new file mode 100644 index 00000000..754cc293 --- /dev/null +++ b/samples/TeX/english.lbx @@ -0,0 +1,554 @@ +\ProvidesFile{english.lbx} +[\abx@lbxid] + +\DeclareRedundantLanguages{english,american}{english,american,british, +canadian,australian,newzealand,USenglish,UKenglish} + +\DeclareBibliographyExtras{% + \protected\def\bibrangedash{% + \textendash\penalty\hyphenpenalty}% breakable dash + \protected\def\bibdatedash{\bibrangedash}% + \def\finalandcomma{\addcomma}% + \def\finalandsemicolon{\addsemicolon}% + \protected\def\mkbibordinal#1{% + \begingroup + \@tempcnta0#1\relax\number\@tempcnta + \@whilenum\@tempcnta>100\do{\advance\@tempcnta-100\relax}% + \ifnum\@tempcnta>20 + \@whilenum\@tempcnta>9\do{\advance\@tempcnta-10\relax}% + \fi + \ifcase\@tempcnta th\or st\or nd\or rd\else th\fi + \endgroup}% + \protected\def\mkbibmascord{\mkbibordinal}% + \protected\def\mkbibfemord{\mkbibordinal}% + \protected\def\mkbibneutord{\mkbibordinal}% + \protected\def\mkbibdatelong#1#2#3{% + \iffieldundef{#2} + {} + {\mkbibmonth{\thefield{#2}}% + \iffieldundef{#3} + {\iffieldundef{#1}{}{\space}} + {\nobreakspace}}% + \iffieldundef{#3} + {} + {\stripzeros{\thefield{#3}}% + \iffieldundef{#1}{}{,\space}}% + \iffieldbibstring{#1} + {\bibstring{\thefield{#1}}} + {\stripzeros{\thefield{#1}}}}% + \protected\def\mkbibdateshort#1#2#3{% + \iffieldundef{#2} + {} + {\mkdatezeros{\thefield{#2}}% + \iffieldundef{#3} + {\iffieldundef{#1}{}{/}} + {/}}% + \iffieldundef{#3} + {} + {\mkdatezeros{\thefield{#3}}% + \iffieldundef{#1}{}{/}}% + \iffieldbibstring{#1} + {\bibstring{\thefield{#1}}} + {\mkdatezeros{\thefield{#1}}}}% + \savecommand\mkbibrangecomp + \savecommand\mkbibrangecompextra + \savecommand\mkbibrangeterse + \savecommand\mkbibrangeterseextra + \protected\def\mkbibrangecomp{% + \lbx@us@mkbibrangetrunc@long{long}}% + \protected\def\mkbibrangeterse{% + \lbx@us@mkbibrangetrunc@short{short}}% + \protected\def\mkbibrangecompextra{% + \lbx@us@mkbibrangetruncextra@long{long}}% + \protected\def\mkbibrangeterseextra{% + \lbx@us@mkbibrangetruncextra@short{short}}% +} + +\UndeclareBibliographyExtras{% + \restorecommand\mkbibrangecomp + \restorecommand\mkbibrangecompextra + \restorecommand\mkbibrangeterse + \restorecommand\mkbibrangeterseextra +} + +\DeclareBibliographyStrings{% + bibliography = {{Bibliography}{Bibliography}}, + references = {{References}{References}}, + shorthands = {{List of Abbreviations}{Abbreviations}}, + editor = {{editor}{ed\adddot}}, + editors = {{editors}{eds\adddot}}, + compiler = {{compiler}{comp\adddot}}, + compilers = {{compilers}{comp\adddot}}, + redactor = {{redactor}{red\adddot}}, + redactors = {{redactors}{red\adddot}}, + reviser = {{reviser}{rev\adddot}}, + revisers = {{revisers}{rev\adddot}}, + founder = {{founder}{found\adddot}}, + founders = {{founders}{found\adddot}}, + continuator = {{continued}{cont\adddot}},% FIXME: unsure + continuators = {{continued}{cont\adddot}},% FIXME: unsure + collaborator = {{collaborator}{collab\adddot}},% FIXME: unsure + collaborators = {{collaborators}{collab\adddot}},% FIXME: unsure + translator = {{translator}{trans\adddot}}, + translators = {{translators}{trans\adddot}}, + commentator = {{commentator}{comm\adddot}}, + commentators = {{commentators}{comm\adddot}}, + annotator = {{annotator}{annot\adddot}}, + annotators = {{annotators}{annot\adddot}}, + commentary = {{commentary}{comm\adddot}}, + annotations = {{annotations}{annot\adddot}}, + introduction = {{introduction}{intro\adddot}}, + foreword = {{foreword}{forew\adddot}}, + afterword = {{afterword}{afterw\adddot}}, + editortr = {{editor and translator}% + {ed\adddotspace and trans\adddot}}, + editorstr = {{editors and translators}% + {eds\adddotspace and trans\adddot}}, + editorco = {{editor and commentator}% + {ed\adddotspace and comm\adddot}}, + editorsco = {{editors and commentators}% + {eds\adddotspace and comm\adddot}}, + editoran = {{editor and annotator}% + {ed\adddotspace and annot\adddot}}, + editorsan = {{editors and annotators}% + {eds\adddotspace and annot\adddot}}, + editorin = {{editor and introduction}% + {ed\adddotspace and introd\adddot}}, + editorsin = {{editors and introduction}% + {eds\adddotspace and introd\adddot}}, + editorfo = {{editor and foreword}% + {ed\adddotspace and forew\adddot}}, + editorsfo = {{editors and foreword}% + {eds\adddotspace and forew\adddot}}, + editoraf = {{editor and afterword}% + {ed\adddotspace and afterw\adddot}}, + editorsaf = {{editors and afterword}% + {eds\adddotspace and afterw\adddot}}, + editortrco = {{editor, translator\finalandcomma\ and commentator}% + {ed.,\addabbrvspace trans\adddot\finalandcomma\ and comm\adddot}}, + editorstrco = {{editors, translators\finalandcomma\ and commentators}% + {eds.,\addabbrvspace trans\adddot\finalandcomma\ and comm\adddot}}, + editortran = {{editor, translator\finalandcomma\ and annotator}% + {ed.,\addabbrvspace trans\adddot\finalandcomma\ and annot\adddot}}, + editorstran = {{editors, translators\finalandcomma\ and annotators}% + {eds.,\addabbrvspace trans\adddot\finalandcomma\ and annot\adddot}}, + editortrin = {{editor, translator\finalandcomma\ and introduction}% + {ed.,\addabbrvspace trans\adddot\finalandcomma\ and introd\adddot}}, + editorstrin = {{editors, translators\finalandcomma\ and introduction}% + {eds.,\addabbrvspace trans\adddot\finalandcomma\ and introd\adddot}}, + editortrfo = {{editor, translator\finalandcomma\ and foreword}% + {ed.,\addabbrvspace trans\adddot\finalandcomma\ and forew\adddot}}, + editorstrfo = {{editors, translators\finalandcomma\ and foreword}% + {eds.,\addabbrvspace trans\adddot\finalandcomma\ and forew\adddot}}, + editortraf = {{editor, translator\finalandcomma\ and afterword}% + {ed.,\addabbrvspace trans\adddot\finalandcomma\ and afterw\adddot}}, + editorstraf = {{editors, translators\finalandcomma\ and afterword}% + {eds.,\addabbrvspace trans\adddot\finalandcomma\ and afterw\adddot}}, + editorcoin = {{editor, commentator\finalandcomma\ and introduction}% + {ed.,\addabbrvspace comm\adddot\finalandcomma\ and introd\adddot}}, + editorscoin = {{editors, commentators\finalandcomma\ and introduction}% + {eds.,\addabbrvspace comm\adddot\finalandcomma\ and introd\adddot}}, + editorcofo = {{editor, commentator\finalandcomma\ and foreword}% + {ed.,\addabbrvspace comm\adddot\finalandcomma\ and forew\adddot}}, + editorscofo = {{editors, commentators\finalandcomma\ and foreword}% + {eds.,\addabbrvspace comm\adddot\finalandcomma\ and forew\adddot}}, + editorcoaf = {{editor, commentator\finalandcomma\ and afterword}% + {ed.,\addabbrvspace comm\adddot\finalandcomma\ and afterw\adddot}}, + editorscoaf = {{editors, commentators\finalandcomma\ and afterword}% + {eds.,\addabbrvspace comm\adddot\finalandcomma\ and afterw\adddot}}, + editoranin = {{editor, annotator\finalandcomma\ and introduction}% + {ed.,\addabbrvspace annot\adddot\finalandcomma\ and introd\adddot}}, + editorsanin = {{editors, annotators\finalandcomma\ and introduction}% + {eds.,\addabbrvspace annot\adddot\finalandcomma\ and introd\adddot}}, + editoranfo = {{editor, annotator\finalandcomma\ and foreword}% + {ed.,\addabbrvspace annot\adddot\finalandcomma\ and forew\adddot}}, + editorsanfo = {{editors, annotators\finalandcomma\ and foreword}% + {eds.,\addabbrvspace annot\adddot\finalandcomma\ and forew\adddot}}, + editoranaf = {{editor, annotator\finalandcomma\ and afterword}% + {ed.,\addabbrvspace annot\adddot\finalandcomma\ and afterw\adddot}}, + editorsanaf = {{editors, annotators\finalandcomma\ and afterword}% + {eds.,\addabbrvspace annot\adddot\finalandcomma\ and afterw\adddot}}, + editortrcoin = {{editor, translator, commentator\finalandcomma\ and introduction}% + {ed.,\addabbrvspace trans., comm\adddot\finalandcomma\ and introd\adddot}}, + editorstrcoin = {{editors, translators, commentators\finalandcomma\ and introduction}% + {eds.,\addabbrvspace trans., comm\adddot\finalandcomma\ and introd\adddot}}, + editortrcofo = {{editor, translator, commentator\finalandcomma\ and foreword}% + {ed.,\addabbrvspace trans., comm\adddot\finalandcomma\ and forew\adddot}}, + editorstrcofo = {{editors, translators, commentators\finalandcomma\ and foreword}% + {eds.,\addabbrvspace trans., comm\adddot\finalandcomma\ and forew\adddot}}, + editortrcoaf = {{editor, translator, commentator\finalandcomma\ and afterword}% + {ed.,\addabbrvspace trans., comm\adddot\finalandcomma\ and afterw\adddot}}, + editorstrcoaf = {{editors, translators, commentators\finalandcomma\ and afterword}% + {eds.,\addabbrvspace trans., comm\adddot\finalandcomma\ and afterw\adddot}}, + editortranin = {{editor, translator, annotator\finalandcomma\ and introduction}% + {ed.,\addabbrvspace trans., annot\adddot\finalandcomma\ and introd\adddot}}, + editorstranin = {{editors, translators, annotators\finalandcomma\ and introduction}% + {eds.,\addabbrvspace trans., annot\adddot\finalandcomma\ and introd\adddot}}, + editortranfo = {{editor, translator, annotator\finalandcomma\ and foreword}% + {ed.,\addabbrvspace trans., annot\adddot\finalandcomma\ and forew\adddot}}, + editorstranfo = {{editors, translators, annotators\finalandcomma\ and foreword}% + {eds.,\addabbrvspace trans., annot\adddot\finalandcomma\ and forew\adddot}}, + editortranaf = {{editor, translator, annotator\finalandcomma\ and afterword}% + {ed.,\addabbrvspace trans., annot\adddot\finalandcomma\ and afterw\adddot}}, + editorstranaf = {{editors, translators, annotators\finalandcomma\ and afterword}% + {eds.,\addabbrvspace trans., annot\adddot\finalandcomma\ and afterw\adddot}}, + translatorco = {{translator and commentator}% + {trans\adddot\ and comm\adddot}}, + translatorsco = {{translators and commentators}% + {trans\adddot\ and comm\adddot}}, + translatoran = {{translator and annotator}% + {trans\adddot\ and annot\adddot}}, + translatorsan = {{translators and annotators}% + {trans\adddot\ and annot\adddot}}, + translatorin = {{translation and introduction}% + {trans\adddot\ and introd\adddot}}, + translatorsin = {{translation and introduction}% + {trans\adddot\ and introd\adddot}}, + translatorfo = {{translation and foreword}% + {trans\adddot\ and forew\adddot}}, + translatorsfo = {{translation and foreword}% + {trans\adddot\ and forew\adddot}}, + translatoraf = {{translation and afterword}% + {trans\adddot\ and afterw\adddot}}, + translatorsaf = {{translation and afterword}% + {trans\adddot\ and afterw\adddot}}, + translatorcoin = {{translation, commentary\finalandcomma\ and introduction}% + {trans., comm\adddot\finalandcomma\ and introd\adddot}}, + translatorscoin = {{translation, commentary\finalandcomma\ and introduction}% + {trans., comm\adddot\finalandcomma\ and introd\adddot}}, + translatorcofo = {{translation, commentary\finalandcomma\ and foreword}% + {trans., comm\adddot\finalandcomma\ and forew\adddot}}, + translatorscofo = {{translation, commentary\finalandcomma\ and foreword}% + {trans., comm\adddot\finalandcomma\ and forew\adddot}}, + translatorcoaf = {{translation, commentary\finalandcomma\ and afterword}% + {trans., comm\adddot\finalandcomma\ and afterw\adddot}}, + translatorscoaf = {{translation, commentary\finalandcomma\ and afterword}% + {trans., comm\adddot\finalandcomma\ and afterw\adddot}}, + translatoranin = {{translation, annotations\finalandcomma\ and introduction}% + {trans., annot\adddot\finalandcomma\ and introd\adddot}}, + translatorsanin = {{translation, annotations\finalandcomma\ and introduction}% + {trans., annot\adddot\finalandcomma\ and introd\adddot}}, + translatoranfo = {{translation, annotations\finalandcomma\ and foreword}% + {trans., annot\adddot\finalandcomma\ and forew\adddot}}, + translatorsanfo = {{translation, annotations\finalandcomma\ and foreword}% + {trans., annot\adddot\finalandcomma\ and forew\adddot}}, + translatoranaf = {{translation, annotations\finalandcomma\ and afterword}% + {trans., annot\adddot\finalandcomma\ and afterw\adddot}}, + translatorsanaf = {{translation, annotations\finalandcomma\ and afterword}% + {trans., annot\adddot\finalandcomma\ and afterw\adddot}}, + byauthor = {{by}{by}}, + byeditor = {{edited by}{ed\adddotspace by}}, + bycompiler = {{compiled by}{comp\adddotspace by}}, + byredactor = {{redacted by}{red\adddotspace by}}, + byreviser = {{revised by}{rev\adddotspace by}}, + byreviewer = {{reviewed by}{rev\adddotspace by}}, + byfounder = {{founded by}{found\adddotspace by}}, + bycontinuator = {{continued by}{cont\adddotspace by}}, + bycollaborator = {{in collaboration with}{in collab\adddotspace with}},% FIXME: unsure + bytranslator = {{translated \lbx@lfromlang\ by}{trans\adddot\ \lbx@sfromlang\ by}}, + bycommentator = {{commented by}{comm\adddot\ by}}, + byannotator = {{annotated by}{annot\adddot\ by}}, + withcommentator = {{with a commentary by}{with a comment\adddot\ by}}, + withannotator = {{with annotations by}{with annots\adddot\ by}}, + withintroduction = {{with an introduction by}{with an intro\adddot\ by}}, + withforeword = {{with a foreword by}{with a forew\adddot\ by}}, + withafterword = {{with an afterword by}{with an afterw\adddot\ by}}, + byeditortr = {{edited and translated \lbx@lfromlang\ by}% + {ed\adddotspace and trans\adddot\ \lbx@sfromlang\ by}}, + byeditorco = {{edited and commented by}% + {ed\adddotspace and comm\adddot\ by}}, + byeditoran = {{edited and annotated by}% + {ed\adddotspace and annot\adddot\ by}}, + byeditorin = {{edited, with an introduction, by}% + {ed.,\addabbrvspace with an introd., by}}, + byeditorfo = {{edited, with a foreword, by}% + {ed.,\addabbrvspace with a forew., by}}, + byeditoraf = {{edited, with an afterword, by}% + {ed.,\addabbrvspace with an afterw., by}}, + byeditortrco = {{edited, translated \lbx@lfromlang\finalandcomma\ and commented by}% + {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and comm\adddot\ by}}, + byeditortran = {{edited, translated \lbx@lfromlang\finalandcomma\ and annotated by}% + {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and annot\adddot\ by}}, + byeditortrin = {{edited and translated \lbx@lfromlang, with an introduction, by}% + {ed\adddotspace and trans\adddot\ \lbx@sfromlang, with an introd., by}}, + byeditortrfo = {{edited and translated \lbx@lfromlang, with a foreword, by}% + {ed\adddotspace and trans\adddot\ \lbx@sfromlang, with a forew., by}}, + byeditortraf = {{edited and translated \lbx@lfromlang, with an afterword, by}% + {ed\adddotspace and trans\adddot\ \lbx@sfromlang, with an afterw., by}}, + byeditorcoin = {{edited and commented, with an introduction, by}% + {ed\adddotspace and comm., with an introd., by}}, + byeditorcofo = {{edited and commented, with a foreword, by}% + {ed\adddotspace and comm., with a forew., by}}, + byeditorcoaf = {{edited and commented, with an afterword, by}% + {ed\adddotspace and comm., with an afterw., by}}, + byeditoranin = {{edited and annotated, with an introduction, by}% + {ed\adddotspace and annot., with an introd., by}}, + byeditoranfo = {{edited and annotated, with a foreword, by}% + {ed\adddotspace and annot., with a forew., by}}, + byeditoranaf = {{edited and annotated, with an afterword, by}% + {ed\adddotspace and annot., with an afterw., by}}, + byeditortrcoin = {{edited, translated \lbx@lfromlang\finalandcomma\ and commented, with an introduction, by}% + {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and comm., with an introd., by}}, + byeditortrcofo = {{edited, translated \lbx@lfromlang\finalandcomma\ and commented, with a foreword, by}% + {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and comm., with a forew., by}}, + byeditortrcoaf = {{edited, translated \lbx@lfromlang\finalandcomma\ and commented, with an afterword, by}% + {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and comm., with an afterw., by}}, + byeditortranin = {{edited, translated \lbx@lfromlang\finalandcomma\ and annotated, with an introduction, by}% + {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and annot, with an introd., by}}, + byeditortranfo = {{edited, translated \lbx@lfromlang\finalandcomma\ and annotated, with a foreword, by}% + {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and annot, with a forew., by}}, + byeditortranaf = {{edited, translated \lbx@lfromlang\finalandcomma\ and annotated, with an afterword, by}% + {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and annot, with an afterw., by}}, + bytranslatorco = {{translated \lbx@lfromlang\ and commented by}% + {trans\adddot\ \lbx@sfromlang\ and comm\adddot\ by}}, + bytranslatoran = {{translated \lbx@lfromlang\ and annotated by}% + {trans\adddot\ \lbx@sfromlang\ and annot\adddot\ by}}, + bytranslatorin = {{translated \lbx@lfromlang, with an introduction, by}% + {trans\adddot\ \lbx@sfromlang, with an introd., by}}, + bytranslatorfo = {{translated \lbx@lfromlang, with a foreword, by}% + {trans\adddot\ \lbx@sfromlang, with a forew., by}}, + bytranslatoraf = {{translated \lbx@lfromlang, with an afterword, by}% + {trans\adddot\ \lbx@sfromlang, with an afterw., by}}, + bytranslatorcoin = {{translated \lbx@lfromlang\ and commented, with an introduction, by}% + {trans\adddot\ \lbx@sfromlang\ and comm., with an introd., by}}, + bytranslatorcofo = {{translated \lbx@lfromlang\ and commented, with a foreword, by}% + {trans\adddot\ \lbx@sfromlang\ and comm., with a forew., by}}, + bytranslatorcoaf = {{translated \lbx@lfromlang\ and commented, with an afterword, by}% + {trans\adddot\ \lbx@sfromlang\ and comm., with an afterw., by}}, + bytranslatoranin = {{translated \lbx@lfromlang\ and annotated, with an introduction, by}% + {trans\adddot\ \lbx@sfromlang\ and annot., with an introd., by}}, + bytranslatoranfo = {{translated \lbx@lfromlang\ and annotated, with a foreword, by}% + {trans\adddot\ \lbx@sfromlang\ and annot., with a forew., by}}, + bytranslatoranaf = {{translated \lbx@lfromlang\ and annotated, with an afterword, by}% + {trans\adddot\ \lbx@sfromlang\ and annot., with an afterw., by}}, + and = {{and}{and}}, + andothers = {{et\addabbrvspace al\adddot}{et\addabbrvspace al\adddot}}, + andmore = {{et\addabbrvspace al\adddot}{et\addabbrvspace al\adddot}}, + volume = {{volume}{vol\adddot}}, + volumes = {{volumes}{vols\adddot}}, + involumes = {{in}{in}}, + jourvol = {{volume}{vol\adddot}}, + jourser = {{series}{ser\adddot}}, + book = {{book}{book}}, + part = {{part}{part}}, + issue = {{issue}{issue}}, + newseries = {{new series}{new ser\adddot}}, + oldseries = {{old series}{old ser\adddot}}, + edition = {{edition}{ed\adddot}}, + reprint = {{reprint}{repr\adddot}}, + reprintof = {{reprint of}{repr\adddotspace of}}, + reprintas = {{reprinted as}{rpt\adddotspace as}}, + reprintfrom = {{reprinted from}{repr\adddotspace from}}, + reviewof = {{review of}{rev\adddotspace of}}, + translationof = {{translation of}{trans\adddotspace of}}, + translationas = {{translated as}{trans\adddotspace as}}, + translationfrom = {{translated from}{trans\adddotspace from}}, + origpubas = {{originally published as}{orig\adddotspace pub\adddotspace as}}, + origpubin = {{originally published in}{orig\adddotspace pub\adddotspace in}}, + astitle = {{as}{as}}, + bypublisher = {{by}{by}}, + page = {{page}{p\adddot}}, + pages = {{pages}{pp\adddot}}, + column = {{column}{col\adddot}}, + columns = {{columns}{cols\adddot}}, + line = {{line}{l\adddot}}, + lines = {{lines}{ll\adddot}}, + nodate = {{no date}{n\adddot d\adddot}}, + verse = {{verse}{v\adddot}}, + verses = {{verses}{vv\adddot}}, + section = {{section}{\S}}, + sections = {{sections}{\S\S}}, + paragraph = {{paragraph}{par\adddot}}, + paragraphs = {{paragraphs}{par\adddot}}, + in = {{in}{in}}, + inseries = {{in}{in}}, + ofseries = {{of}{of}}, + number = {{number}{no\adddot}}, + chapter = {{chapter}{chap\adddot}}, + mathesis = {{Master's thesis}{MA\addabbrvspace thesis}}, + phdthesis = {{PhD\addabbrvspace thesis}{PhD\addabbrvspace thesis}}, + candthesis = {{Candidate thesis}{Cand\adddotspace thesis}}, + resreport = {{research report}{research rep\adddot}}, + techreport = {{technical report}{tech\adddotspace rep\adddot}}, + software = {{computer software}{comp\adddotspace software}}, + datacd = {{CD-ROM}{CD-ROM}}, + audiocd = {{audio CD}{audio CD}}, + version = {{version}{version}}, + url = {{address}{address}}, + urlfrom = {{available from}{available from}}, + urlseen = {{visited on}{visited on}}, + inpreparation = {{in preparation}{in preparation}}, + submitted = {{submitted}{submitted}}, + forthcoming = {{forthcoming}{forthcoming}}, + inpress = {{in press}{in press}}, + prepublished = {{pre-published}{pre-published}}, + citedas = {{henceforth cited as}{henceforth cited as}}, + thiscite = {{especially}{esp\adddot}}, + seenote = {{see note}{see n\adddot}}, + quotedin = {{quoted in}{qtd\adddotspace in}}, + idem = {{idem}{idem}}, + idemsm = {{idem}{idem}}, + idemsf = {{eadem}{eadem}}, + idemsn = {{idem}{idem}}, + idempm = {{eidem}{eidem}}, + idempf = {{eaedem}{eaedem}}, + idempn = {{eadem}{eadem}}, + idempp = {{eidem}{eidem}}, + ibidem = {{ibidem}{ibid\adddot}}, + opcit = {{op\adddotspace cit\adddot}{op\adddotspace cit\adddot}}, + loccit = {{loc\adddotspace cit\adddot}{loc\adddotspace cit\adddot}}, + confer = {{cf\adddot}{cf\adddot}}, + sequens = {{sq\adddot}{sq\adddot}}, + sequentes = {{sqq\adddot}{sqq\adddot}}, + passim = {{passim}{pass\adddot}}, + see = {{see}{see}}, + seealso = {{see also}{see also}}, + backrefpage = {{cited on page}{cit\adddotspace on p\adddot}}, + backrefpages = {{cited on pages}{cit\adddotspace on pp\adddot}}, + january = {{January}{Jan\adddot}}, + february = {{February}{Feb\adddot}}, + march = {{March}{Mar\adddot}}, + april = {{April}{Apr\adddot}}, + may = {{May}{May}}, + june = {{June}{June}}, + july = {{July}{July}}, + august = {{August}{Aug\adddot}}, + september = {{September}{Sept\adddot}}, + october = {{October}{Oct\adddot}}, + november = {{November}{Nov\adddot}}, + december = {{December}{Dec\adddot}}, + langamerican = {{American}{American}}, + langbrazilian = {{Brazilian}{Brazilian}}, + langcatalan = {{Catalan}{Catalan}}, + langcroatian = {{Croatian}{Croatian}}, + langczech = {{Czech}{Czech}}, + langdanish = {{Danish}{Danish}}, + langdutch = {{Dutch}{Dutch}}, + langenglish = {{English}{English}}, + langfinnish = {{Finnish}{Finnish}}, + langfrench = {{French}{French}}, + langgerman = {{German}{German}}, + langgreek = {{Greek}{Greek}}, + langitalian = {{Italian}{Italian}}, + langlatin = {{Latin}{Latin}}, + langnorwegian = {{Norwegian}{Norwegian}}, + langpolish = {{Polish}{Polish}}, + langportuguese = {{Portuguese}{Portuguese}}, + langrussian = {{Russian}{Russian}}, + langslovene = {{Slovene}{Slovene}}, + langspanish = {{Spanish}{Spanish}}, + langswedish = {{Swedish}{Swedish}}, + fromamerican = {{from the American}{from the American}}, + frombrazilian = {{from the Brazilian}{from the Brazilian}}, + fromcatalan = {{from the Catalan}{from the Catalan}}, + fromcroatian = {{from the Croatian}{from the Croatian}}, + fromczech = {{from the Czech}{from the Czech}}, + fromdanish = {{from the Danish}{from the Danish}}, + fromdutch = {{from the Dutch}{from the Dutch}}, + fromenglish = {{from the English}{from the English}}, + fromfinnish = {{from the Finnish}{from the Finnish}}, + fromfrench = {{from the French}{from the French}}, + fromgerman = {{from the German}{from the German}}, + fromgreek = {{from the Greek}{from the Greek}}, + fromitalian = {{from the Italian}{from the Italian}}, + fromlatin = {{from the Latin}{from the Latin}}, + fromnorwegian = {{from the Norwegian}{from the Norwegian}}, + frompolish = {{from the Polish}{from the Polish}}, + fromportuguese = {{from the Portuguese}{from the Portuguese}}, + fromrussian = {{from the Russian}{from the Russian}}, + fromslovene = {{from the Slovene}{from the Slovene}}, + fromspanish = {{from the Spanish}{from the Spanish}}, + fromswedish = {{from the Swedish}{from the Swedish}}, + countryde = {{Germany}{DE}}, + countryeu = {{European Union}{EU}}, + countryep = {{European Union}{EP}}, + countryfr = {{France}{FR}}, + countryuk = {{United Kingdom}{GB}}, + countryus = {{United States of America}{US}}, + patent = {{patent}{pat\adddot}}, + patentde = {{German patent}{German pat\adddot}}, + patenteu = {{European patent}{European pat\adddot}}, + patentfr = {{French patent}{French pat\adddot}}, + patentuk = {{British patent}{British pat\adddot}}, + patentus = {{U.S\adddotspace patent}{U.S\adddotspace pat\adddot}}, + patreq = {{patent request}{pat\adddot\ req\adddot}}, + patreqde = {{German patent request}{German pat\adddot\ req\adddot}}, + patreqeu = {{European patent request}{European pat\adddot\ req\adddot}}, + patreqfr = {{French patent request}{French pat\adddot\ req\adddot}}, + patrequk = {{British patent request}{British pat\adddot\ req\adddot}}, + patrequs = {{U.S\adddotspace patent request}{U.S\adddotspace pat\adddot\ req\adddot}}, + file = {{file}{file}}, + library = {{library}{library}}, + abstract = {{abstract}{abstract}}, + annotation = {{annotations}{annotations}}, +} + +\protected\gdef\lbx@us@mkbibrangetrunc@long#1#2{% + \iffieldundef{#2year} + {} + {\printtext[#2date]{% + \iffieldsequal{#2year}{#2endyear} + {\csuse{mkbibdate#1}{}{#2month}{#2day}} + {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}% + \iffieldundef{#2endyear} + {} + {\iffieldequalstr{#2endyear}{} + {\mbox{\bibdatedash}} + {\bibdatedash + \iffieldsequal{#2year}{#2endyear} + {\iffieldsequal{#2month}{#2endmonth} + {\csuse{mkbibdate#1}{#2endyear}{}{#2endday}} + {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}} + {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}}}}} + +\protected\gdef\lbx@us@mkbibrangetrunc@short#1#2{% + \iffieldundef{#2year} + {} + {\printtext[#2date]{% + \iffieldsequal{#2year}{#2endyear} + {\csuse{mkbibdate#1}{}{#2month}{#2day}} + {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}% + \iffieldundef{#2endyear} + {} + {\iffieldequalstr{#2endyear}{} + {\mbox{\bibdatedash}} + {\bibdatedash + \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}}}} + +\protected\gdef\lbx@us@mkbibrangetruncextra@long#1#2{% + \iffieldundef{#2year} + {} + {\printtext[#2date]{% + \iffieldsequal{#2year}{#2endyear} + {\csuse{mkbibdate#1}{}{#2month}{#2day}} + {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}% + \iffieldundef{#2endyear} + {\printfield{extrayear}} + {\iffieldequalstr{#2endyear}{} + {\printfield{extrayear}% + \mbox{\bibdatedash}} + {\bibdatedash + \iffieldsequal{#2year}{#2endyear} + {\iffieldsequal{#2month}{#2endmonth} + {\csuse{mkbibdate#1}{#2endyear}{}{#2endday}} + {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}} + {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}% + \printfield{extrayear}}}}}} + +\protected\gdef\lbx@us@mkbibrangetruncextra@short#1#2{% + \iffieldundef{#2year} + {} + {\printtext[#2date]{% + \iffieldsequal{#2year}{#2endyear} + {\csuse{mkbibdate#1}{}{#2month}{#2day}} + {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}% + \iffieldundef{#2endyear} + {\printfield{extrayear}} + {\iffieldequalstr{#2endyear}{} + {\printfield{extrayear}% + \mbox{\bibdatedash}} + {\bibdatedash + \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}% + \printfield{extrayear}}}}}} + +\endinput diff --git a/samples/TeX/verbose.bbx b/samples/TeX/verbose.bbx new file mode 100644 index 00000000..fdba2250 --- /dev/null +++ b/samples/TeX/verbose.bbx @@ -0,0 +1,6 @@ +\ProvidesFile{verbose.bbx} +[\abx@bbxid] + +\RequireBibliographyStyle{authortitle} + +\endinput diff --git a/test/test_blob.rb b/test/test_blob.rb index 54e10030..c0cbe3f3 100644 --- a/test/test_blob.rb +++ b/test/test_blob.rb @@ -393,6 +393,10 @@ class TestBlob < Test::Unit::TestCase # NuGet Packages assert blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js").vendored? + # Font Awesome + assert blob("some/asset/path/font-awesome.min.css").vendored? + assert blob("some/asset/path/font-awesome.css").vendored? + # Normalize assert blob("some/asset/path/normalize.css").vendored? diff --git a/test/test_language.rb b/test/test_language.rb index 7c81ceef..1f151eeb 100644 --- a/test/test_language.rb +++ b/test/test_language.rb @@ -17,6 +17,7 @@ class TestLanguage < Test::Unit::TestCase assert_equal Lexer['C'], Language['OpenCL'].lexer assert_equal Lexer['C'], Language['XS'].lexer assert_equal Lexer['C++'], Language['C++'].lexer + assert_equal Lexer['Chapel'], Language['Chapel'].lexer assert_equal Lexer['Coldfusion HTML'], Language['ColdFusion'].lexer assert_equal Lexer['Coq'], Language['Coq'].lexer assert_equal Lexer['FSharp'], Language['F#'].lexer @@ -71,6 +72,7 @@ class TestLanguage < Test::Unit::TestCase assert_equal Language['C'], Language.find_by_alias('c') assert_equal Language['C++'], Language.find_by_alias('c++') assert_equal Language['C++'], Language.find_by_alias('cpp') + assert_equal Language['Chapel'], Language.find_by_alias('chpl') assert_equal Language['CoffeeScript'], Language.find_by_alias('coffee') assert_equal Language['CoffeeScript'], Language.find_by_alias('coffee-script') assert_equal Language['ColdFusion'], Language.find_by_alias('cfm') @@ -255,6 +257,7 @@ class TestLanguage < Test::Unit::TestCase assert_equal [Language['Shell']], Language.find_by_filename('.zshrc') assert_equal [Language['Clojure']], Language.find_by_filename('riemann.config') assert_equal [Language['HTML+Django']], Language.find_by_filename('index.jinja') + assert_equal [Language['Chapel']], Language.find_by_filename('examples/hello.chpl') end def test_find_by_shebang diff --git a/test/test_samples.rb b/test/test_samples.rb index e0130282..3ee5b64d 100644 --- a/test/test_samples.rb +++ b/test/test_samples.rb @@ -35,15 +35,33 @@ class TestSamples < Test::Unit::TestCase assert_equal data['tokens_total'], data['language_tokens'].inject(0) { |n, (_, c)| n += c } assert_equal data['tokens_total'], data['tokens'].inject(0) { |n, (_, ts)| n += ts.inject(0) { |m, (_, c)| m += c } } end - + + # Check that there aren't samples with extensions that aren't explicitly defined in languages.yml + def test_parity + extensions = Samples::DATA['extnames'] + languages_yml = File.expand_path("../../lib/linguist/languages.yml", __FILE__) + languages = YAML.load_file(languages_yml) + + languages.each do |name, options| + options['extensions'] ||= [] + + if extnames = extensions[name] + extnames.each do |extname| + next if extname == '.script!' + assert options['extensions'].include?(extname), "#{name} has a sample with extension (#{extname}) that isn't explicitly defined in languages.yml" + end + end + end + end + # If a language extension isn't globally unique then make sure there are samples def test_presence Linguist::Language.all.each do |language| language.all_extensions.each do |extension| language_matches = Language.find_by_filename("foo#{extension}") - + # If there is more than one language match for a given extension - # then check that there are examples for that language with the extension + # then check that there are examples for that language with the extension if language_matches.length > 1 language_matches.each do |language| assert File.directory?("samples/#{language.name}"), "#{language.name} is missing a samples directory"