diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 1ab3e28b..ac3036ff 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -293,6 +293,7 @@ C++: - .inl - .tcc - .tpp + - .ipp C-ObjDump: type: data @@ -819,6 +820,9 @@ Groovy: color: "#e69f56" extensions: - .groovy + - .grt + - .gtpl + - .gvy interpreters: - groovy @@ -907,7 +911,7 @@ Haskell: Haxe: type: programming ace_mode: haxe - color: "#346d51" + color: "#f7941e" extensions: - .hx - .hxsl @@ -1059,6 +1063,7 @@ JavaScript: - ._js - .bones - .es6 + - .frag - .jake - .jsfl - .jsm @@ -1250,6 +1255,7 @@ Markdown: - .md - .markdown - .mkd + - .mkdn - .mkdown - .ron @@ -1707,6 +1713,8 @@ R: extensions: - .r - .R + - .Rd + - .rd - .rsx filenames: - .Rprofile @@ -1851,6 +1859,13 @@ Rust: extensions: - .rs +SAS: + type: programming + color: "#1E90FF" + lexer: Text only + extensions: + - .sas + SCSS: type: markup group: CSS @@ -2209,6 +2224,7 @@ XML: - .clixml - .cproject - .csproj + - .ct - .dita - .ditamap - .ditaval diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index dfabe80e..20d9ded3 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -61,7 +61,8 @@ ".cpp", ".h", ".hpp", - ".inl" + ".inl", + ".ipp" ], "Ceylon": [ ".ceylon" @@ -166,6 +167,7 @@ ], "GLSL": [ ".fp", + ".frag", ".glsl" ], "Gnuplot": [ @@ -183,6 +185,9 @@ ], "Groovy": [ ".gradle", + ".grt", + ".gtpl", + ".gvy", ".script!" ], "Groovy Server Pages": [ @@ -226,6 +231,7 @@ ".java" ], "JavaScript": [ + ".frag", ".js", ".script!" ], @@ -445,6 +451,7 @@ ], "R": [ ".R", + ".Rd", ".r", ".rsx", ".script!" @@ -485,6 +492,9 @@ "Rust": [ ".rs" ], + "SAS": [ + ".sas" + ], "Sass": [ ".sass", ".scss" @@ -702,8 +712,8 @@ ".gemrc" ] }, - "tokens_total": 607168, - "languages_total": 739, + "tokens_total": 609975, + "languages_total": 750, "tokens": { "ABAP": { "*/**": 1, @@ -9853,23 +9863,23 @@ "C++": { "class": 40, "Bar": 2, - "{": 629, + "{": 726, "protected": 4, "char": 127, "*name": 6, - ";": 2564, + ";": 2783, "public": 33, - "void": 226, + "void": 241, "hello": 2, - "(": 2853, - ")": 2855, - "}": 629, - "//": 292, + "(": 3102, + ")": 3105, + "}": 726, + "//": 315, "///": 843, "mainpage": 1, "C": 6, "library": 14, - "for": 98, + "for": 105, "Broadcom": 3, "BCM": 14, "as": 28, @@ -9918,7 +9928,7 @@ "SPI": 44, "I2C": 29, "accessing": 2, - "system": 9, + "system": 13, "timers.": 1, "Pin": 65, "event": 3, @@ -9929,13 +9939,13 @@ "interrupts": 1, "are": 36, "not": 29, - "+": 70, + "+": 80, "compatible": 1, "installs": 1, "header": 7, "file": 31, "non": 2, - "-": 360, + "-": 438, "shared": 2, "any": 23, "Linux": 2, @@ -9953,7 +9963,7 @@ "of": 215, "package": 1, "that": 36, - "this": 55, + "this": 57, "documentation": 3, "refers": 1, "be": 35, @@ -10027,7 +10037,7 @@ "determined": 1, "suspect": 1, "an": 23, - "interrupt": 1, + "interrupt": 3, "handler": 1, "hitting": 1, "hard": 1, @@ -10105,7 +10115,7 @@ "Ennnnnn": 1, "available": 6, "nnnnnn.": 1, - "base": 6, + "base": 8, "registers": 12, "following": 2, "externals": 1, @@ -10177,7 +10187,7 @@ "SPI.": 1, "While": 1, "able": 2, - "state": 22, + "state": 33, "through": 4, "bcm2835_spi_gpio_write": 1, "bcm2835_spi_end": 4, @@ -10198,7 +10208,7 @@ "referred": 1, "I": 4, "//en.wikipedia.org/wiki/I": 1, - "%": 6, + "%": 7, "C2": 1, "B2C": 1, "V2": 2, @@ -10211,7 +10221,7 @@ "user": 3, "i.e.": 1, "they": 2, - "run": 1, + "run": 2, "Such": 1, "part": 1, "kernel": 4, @@ -10219,7 +10229,7 @@ "subject": 1, "paging": 1, "swapping": 2, - "while": 13, + "while": 17, "does": 4, "things": 1, "besides": 1, @@ -10239,7 +10249,7 @@ "guarantee": 1, "bcm2835_delay": 5, "bcm2835_delayMicroseconds": 6, - "return": 221, + "return": 240, "exactly": 2, "requested.": 1, "fact": 2, @@ -10264,11 +10274,11 @@ "reports": 1, "prevent": 4, "fragment": 2, - "struct": 12, + "struct": 13, "sched_param": 1, "sp": 4, "memset": 3, - "&": 161, + "&": 203, "sizeof": 15, "sp.sched_priority": 1, "sched_get_priority_max": 1, @@ -10276,7 +10286,7 @@ "sched_setscheduler": 1, "mlockall": 1, "MCL_CURRENT": 1, - "|": 19, + "|": 40, "MCL_FUTURE": 1, "Open": 2, "Source": 2, @@ -10284,7 +10294,7 @@ "GPL": 2, "appropriate": 7, "option": 1, - "if": 316, + "if": 359, "want": 5, "share": 2, "source": 12, @@ -10395,7 +10405,7 @@ "need": 6, "link": 3, "version.": 1, - "s": 24, + "s": 26, "doc": 1, "Also": 1, "added": 2, @@ -10429,7 +10439,7 @@ "compiles": 1, "even": 2, "CLOCK_MONOTONIC_RAW": 1, - "CLOCK_MONOTONIC": 1, + "CLOCK_MONOTONIC": 3, "instead.": 1, "errors": 1, "divider": 15, @@ -10477,7 +10487,7 @@ "olly.": 1, "Patch": 2, "Dootson": 2, - "close": 3, + "close": 7, "/dev/mem": 4, "granted.": 1, "susceptible": 1, @@ -10504,7 +10514,7 @@ "completing.": 1, "Patched": 1, "p": 6, - "[": 276, + "[": 293, "atched": 1, "his": 1, "submitted": 1, @@ -10533,10 +10543,10 @@ "DIRECTLY": 1, "USE": 1, "LISTS": 1, - "#ifndef": 28, + "#ifndef": 29, "BCM2835_H": 3, - "#define": 342, - "#include": 121, + "#define": 343, + "#include": 129, "": 2, "defgroup": 7, "constants": 1, @@ -10546,16 +10556,16 @@ "here": 1, "@": 14, "HIGH": 12, - "true": 41, + "true": 49, "volts": 2, "pin.": 21, - "false": 45, + "false": 48, "Speed": 1, "core": 1, "clock": 21, "core_clk": 1, "BCM2835_CORE_CLK_HZ": 1, - "<": 250, + "<": 255, "Base": 17, "Address": 10, "BCM2835_PERI_BASE": 9, @@ -10580,7 +10590,7 @@ "bcm2835_init": 11, "extern": 72, "volatile": 13, - "uint32_t": 37, + "uint32_t": 39, "*bcm2835_st": 1, "*bcm2835_gpio": 1, "*bcm2835_pwm": 1, @@ -10594,7 +10604,7 @@ "page": 5, "BCM2835_PAGE_SIZE": 1, "*1024": 2, - "block": 4, + "block": 7, "BCM2835_BLOCK_SIZE": 1, "offsets": 2, "BCM2835_GPIO_BASE.": 1, @@ -10969,10 +10979,10 @@ "BCM2835_BSC_C_READ": 1, "BCM2835_BSC_S_CLKT": 1, "stretch": 1, - "timeout": 1, + "timeout": 5, "BCM2835_BSC_S_ERR": 1, "ACK": 1, - "error": 2, + "error": 8, "BCM2835_BSC_S_RXF": 1, "BCM2835_BSC_S_TXE": 1, "TXE": 1, @@ -11003,7 +11013,7 @@ "BCM2835_I2C_REASON_ERROR_CLKT": 1, "BCM2835_I2C_REASON_ERROR_DATA": 1, "sent": 1, - "/": 15, + "/": 16, "BCM2835_ST_CS": 1, "Control/Status": 1, "BCM2835_ST_CLO": 1, @@ -11044,7 +11054,7 @@ "BCM2835_PWM0_SERIAL": 1, "BCM2835_PWM0_ENABLE": 1, "x": 86, - "#endif": 98, + "#endif": 110, "#ifdef": 19, "__cplusplus": 12, "init": 2, @@ -11062,7 +11072,7 @@ "bcm2835_set_debug": 2, "fails": 1, "returning": 1, - "result": 2, + "result": 8, "crashes": 1, "failures.": 1, "Prints": 1, @@ -11071,12 +11081,12 @@ "case": 34, "errors.": 1, "successful": 2, - "else": 50, - "int": 192, + "else": 58, + "int": 218, "Close": 1, "deallocating": 1, "allocated": 2, - "closing": 1, + "closing": 3, "Sets": 24, "debug": 6, "prevents": 1, @@ -11092,7 +11102,7 @@ "operation.": 2, "Call": 2, "param": 72, - "]": 275, + "]": 292, "level.": 3, "uint8_t": 43, "lowlevel": 2, @@ -11166,7 +11176,7 @@ "Tests": 1, "detected": 7, "requested": 1, - "flag": 1, + "flag": 3, "bcm2835_gpio_set_eds": 2, "status": 1, "th": 1, @@ -11268,7 +11278,7 @@ "Forces": 2, "ALT0": 2, "funcitons": 1, - "complete": 2, + "complete": 3, "End": 2, "returned": 5, "INPUT": 2, @@ -11320,7 +11330,7 @@ "placed": 1, "rbuf.": 1, "rbuf": 3, - "long": 14, + "long": 15, "tbuf": 4, "Buffer": 10, "send.": 5, @@ -11364,8 +11374,8 @@ "course": 2, "nothing": 1, "driver": 1, - "const": 170, - "*": 177, + "const": 172, + "*": 183, "receive.": 2, "received.": 2, "Allows": 2, @@ -11411,8 +11421,8 @@ "": 4, "": 4, "": 2, - "namespace": 32, - "std": 52, + "namespace": 38, + "std": 53, "DEFAULT_DELIMITER": 1, "CsvStreamer": 5, "private": 16, @@ -11460,7 +11470,7 @@ "leading/trailing": 1, "spaces": 3, "trimmed": 1, - "bool": 105, + "bool": 111, "Like": 1, "specify": 1, "trim": 2, @@ -11477,7 +11487,7 @@ "": 1, "": 1, "": 2, - "static": 262, + "static": 263, "Env": 13, "*env_instance": 1, "NULL": 109, @@ -11509,6 +11519,202 @@ "": 1, "Q_OBJECT": 1, "*instance": 1, + "BOOST_ASIO_DETAIL_IMPL_EPOLL_REACTOR_IPP": 3, + "#if": 63, + "defined": 49, + "_MSC_VER": 7, + "&&": 29, + "": 1, + "BOOST_ASIO_HAS_EPOLL": 2, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "BOOST_ASIO_HAS_TIMERFD": 19, + "": 1, + "boost": 18, + "asio": 14, + "detail": 5, + "epoll_reactor": 40, + "io_service": 6, + "service_base": 1, + "": 1, + "io_service_": 1, + "use_service": 1, + "": 1, + "mutex_": 13, + "interrupter_": 5, + "epoll_fd_": 20, + "do_epoll_create": 3, + "timer_fd_": 21, + "do_timerfd_create": 3, + "shutdown_": 10, + "epoll_event": 10, + "ev": 21, + "ev.events": 13, + "EPOLLIN": 8, + "EPOLLERR": 8, + "EPOLLET": 5, + "ev.data.ptr": 10, + "epoll_ctl": 12, + "EPOLL_CTL_ADD": 7, + "interrupter_.read_descriptor": 3, + "interrupter_.interrupt": 2, + "shutdown_service": 1, + "mutex": 16, + "scoped_lock": 16, + "lock": 5, + "lock.unlock": 1, + "op_queue": 6, + "": 6, + "ops": 10, + "descriptor_state*": 6, + "registered_descriptors_.first": 2, + "i": 106, + "max_ops": 6, + "ops.push": 5, + "op_queue_": 12, + "registered_descriptors_.free": 2, + "timer_queues_.get_all_timers": 1, + "io_service_.abandon_operations": 1, + "fork_service": 1, + "fork_event": 1, + "fork_ev": 2, + "fork_child": 1, + "interrupter_.recreate": 1, + "update_timeout": 2, + "descriptors_lock": 3, + "registered_descriptors_mutex_": 3, + "next_": 3, + "registered_events_": 8, + "descriptor_": 5, + "error_code": 4, + "ec": 6, + "errno": 10, + "get_system_category": 3, + "throw_error": 2, + "init_task": 1, + "io_service_.init_task": 1, + "register_descriptor": 1, + "socket_type": 7, + "descriptor": 15, + "per_descriptor_data": 8, + "descriptor_data": 60, + "allocate_descriptor_state": 3, + "descriptor_lock": 7, + "reactor_": 7, + "EPOLLHUP": 3, + "EPOLLPRI": 3, + "register_internal_descriptor": 1, + "op_type": 8, + "reactor_op*": 5, + "op": 28, + ".push": 2, + "move_descriptor": 1, + "target_descriptor_data": 2, + "source_descriptor_data": 3, + "start_op": 1, + "is_continuation": 5, + "allow_speculative": 2, + "ec_": 4, + "bad_descriptor": 1, + "post_immediate_completion": 2, + ".empty": 5, + "read_op": 1, + "||": 19, + "except_op": 1, + "perform": 2, + "descriptor_lock.unlock": 4, + "io_service_.post_immediate_completion": 2, + "write_op": 2, + "EPOLLOUT": 4, + "EPOLL_CTL_MOD": 3, + "io_service_.work_started": 2, + "cancel_ops": 1, + ".front": 3, + "operation_aborted": 2, + ".pop": 3, + "io_service_.post_deferred_completions": 3, + "deregister_descriptor": 1, + "EPOLL_CTL_DEL": 2, + "free_descriptor_state": 3, + "deregister_internal_descriptor": 1, + "get_timeout": 5, + "events": 8, + "num_events": 2, + "epoll_wait": 1, + "check_timers": 6, + "#else": 35, + "void*": 2, + "ptr": 6, + ".data.ptr": 1, + "static_cast": 14, + "": 2, + "set_ready_events": 1, + ".events": 1, + "common_lock": 1, + "timer_queues_.get_ready_timers": 1, + "itimerspec": 5, + "new_timeout": 6, + "old_timeout": 4, + "flags": 4, + "timerfd_settime": 2, + "EPOLL_CLOEXEC": 4, + "fd": 15, + "epoll_create1": 1, + "EINVAL": 4, + "ENOSYS": 1, + "epoll_create": 1, + "epoll_size": 1, + "fcntl": 2, + "F_SETFD": 2, + "FD_CLOEXEC": 2, + "timerfd_create": 2, + "TFD_CLOEXEC": 1, + "registered_descriptors_.alloc": 1, + "do_add_timer_queue": 1, + "timer_queue_base": 2, + "queue": 4, + "timer_queues_.insert": 1, + "do_remove_timer_queue": 1, + "timer_queues_.erase": 1, + "timer_queues_.wait_duration_msec": 1, + "ts": 1, + "ts.it_interval.tv_sec": 1, + "ts.it_interval.tv_nsec": 1, + "usec": 5, + "timer_queues_.wait_duration_usec": 1, + "ts.it_value.tv_sec": 1, + "ts.it_value.tv_nsec": 1, + "TFD_TIMER_ABSTIME": 1, + "perform_io_cleanup_on_block_exit": 4, + "explicit": 5, + "epoll_reactor*": 2, + "r": 38, + "first_op_": 3, + "ops_.empty": 1, + "ops_": 2, + "operation*": 4, + "descriptor_state": 5, + "operation": 2, + "do_complete": 2, + "perform_io": 2, + "mutex_.lock": 1, + "io_cleanup": 1, + "adopt_lock": 1, + "j": 10, + "io_cleanup.ops_.push": 1, + "break": 35, + "io_cleanup.first_op_": 2, + "io_cleanup.ops_.front": 1, + "io_cleanup.ops_.pop": 1, + "io_service_impl*": 1, + "owner": 3, + "size_t": 6, + "bytes_transferred": 2, + "": 1, + "": 1, "Field": 2, "Free": 1, "Black": 1, @@ -11622,7 +11828,6 @@ "*rr": 1, "*zero": 1, "n": 28, - "i": 83, "BN_CTX_start": 1, "BN_CTX_get": 8, "EC_GROUP_get_order": 1, @@ -11630,7 +11835,6 @@ "BN_mul_word": 1, "BN_add": 1, "ecsig": 3, - "r": 36, "EC_GROUP_get_curve_GFp": 1, "BN_cmp": 1, "R": 6, @@ -11688,13 +11892,11 @@ "nBitsR": 3, "BN_num_bits": 2, "nBitsS": 3, - "&&": 24, "nRecId": 4, "<4;>": 1, "keyRec": 5, "1": 4, "GetPubKey": 5, - "break": 34, "BN_bn2bin": 2, "/8": 2, "ECDSA_SIG_free": 2, @@ -11722,7 +11924,6 @@ "": 1, "": 1, "runtime_error": 2, - "explicit": 4, "str": 2, "CKeyID": 5, "uint160": 8, @@ -11741,7 +11942,6 @@ "vchPubKey.begin": 1, "vchPubKey.end": 1, "vchPubKey.size": 3, - "||": 17, "IsCompressed": 2, "Raw": 1, "secure_allocator": 2, @@ -11764,7 +11964,6 @@ "//#define": 1, "DEBUG": 5, "dout": 2, - "#else": 31, "cerr": 1, "libcanister": 2, "//the": 8, @@ -11871,7 +12070,6 @@ "getFile": 1, "otherwise": 1, "overwrites": 1, - "operation": 1, "succeeded": 2, "writeFile": 2, "//get": 1, @@ -11894,7 +12092,6 @@ "dFlush": 1, "Q_OS_LINUX": 2, "": 1, - "#if": 52, "QT_VERSION": 1, "QT_VERSION_CHECK": 1, "#error": 9, @@ -11956,7 +12153,6 @@ "sse": 1, "cvttss2si": 2, "OG_ASM_MSVC": 4, - "defined": 23, "OG_FTOI_USE_SSE": 2, "SysInfo": 2, "cpu.general.SSE": 2, @@ -11974,7 +12170,6 @@ "cast": 7, "why": 3, "did": 3, - "static_cast": 11, "": 3, "FtoiFast": 2, "Ftol": 1, @@ -12052,7 +12247,6 @@ "edx": 2, "fstp": 2, "dword": 2, - "ptr": 2, "asm": 1, "Deg2Rad": 1, "DEG_TO_RAD": 1, @@ -12191,7 +12385,6 @@ "OnShutdown": 1, "StaticDescriptorInitializer_protocol_2dbuffer_2eproto": 2, "static_descriptor_initializer_protocol_2dbuffer_2eproto_": 1, - "_MSC_VER": 3, "kNameFieldNumber": 2, "Message": 7, "SharedCtor": 4, @@ -12204,7 +12397,6 @@ "SetCachedSize": 2, "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN": 2, "GOOGLE_SAFE_CONCURRENT_WRITES_END": 2, - "descriptor": 2, "*default_instance_": 1, "Person*": 7, "xffu": 3, @@ -12240,7 +12432,6 @@ "SERIALIZE": 2, "WriteString": 1, "unknown_fields": 7, - ".empty": 3, "SerializeUnknownFields": 1, "uint8*": 4, "SerializeWithCachedSizesToArray": 2, @@ -12295,7 +12486,6 @@ "UnknownFieldSet*": 1, "GetCachedSize": 1, "clear_name": 2, - "size_t": 5, "release_name": 2, "set_allocated_name": 2, "set_has_name": 7, @@ -12726,7 +12916,6 @@ "c0_": 64, "d": 8, "HexValue": 2, - "j": 4, "PushBack": 8, "Advance": 44, "STATIC_ASSERT": 5, @@ -12747,7 +12936,6 @@ "BIT_NOT": 2, "Next": 3, "current_": 2, - "next_": 2, "has_multiline_comment_before_next_": 5, "token": 64, "": 1, @@ -13002,7 +13190,6 @@ "QtMsgType": 1, "dump_path": 1, "minidump_id": 1, - "void*": 1, "context": 8, "QVariant": 1, "coffee2js": 1, @@ -13075,7 +13262,6 @@ "FLAG_random_seed": 2, "val": 3, "ScopedLock": 1, - "lock": 1, "entropy_mutex.Pointer": 1, "random": 1, "random_base": 3, @@ -13184,7 +13370,6 @@ "PY_VERSION_HEX": 9, "METH_COEXIST": 1, "PyDict_CheckExact": 1, - "op": 6, "Py_TYPE": 4, "PyDict_Type": 1, "PyDict_Contains": 1, @@ -23363,14 +23548,14 @@ "////": 4, "High": 1, "quality": 2, - "(": 386, + "(": 435, "Some": 1, "browsers": 1, "may": 1, "freeze": 1, "or": 1, "crash": 1, - ")": 386, + ")": 435, "//#define": 10, "HIGHQUALITY": 2, "Medium": 1, @@ -23397,7 +23582,7 @@ "RAGGED_LEAVES": 5, "DETAILED_NOISE": 3, "LIGHT_AA": 3, - "//": 36, + "//": 38, "sample": 2, "SSAA": 2, "HEAVY_AA": 2, @@ -23407,12 +23592,12 @@ "Configurations": 1, "#ifdef": 14, "#endif": 14, - "const": 18, - "float": 103, + "const": 19, + "float": 105, "eps": 5, "e": 4, "-": 108, - ";": 353, + ";": 383, "PI": 3, "vec3": 165, "sunDir": 5, @@ -23431,13 +23616,13 @@ "tonemapping": 1, "mod289": 4, "x": 11, - "{": 61, + "{": 82, "return": 47, "floor": 8, "*": 115, "/": 24, - "}": 61, - "vec4": 72, + "}": 82, + "vec4": 73, "permute": 4, "x*34.0": 1, "+": 108, @@ -23638,7 +23823,7 @@ "shadow": 4, "taken": 1, "for": 7, - "int": 7, + "int": 8, "rayDir*t": 2, "res": 6, "res.x": 3, @@ -23741,8 +23926,8 @@ "iResolution.x/iResolution.y*0.5": 1, "rd.x": 1, "rd.y": 1, - "void": 5, - "main": 3, + "void": 31, + "main": 5, "gl_FragCoord.xy": 7, "*0.25": 4, "*0.5": 1, @@ -23754,7 +23939,38 @@ "col*exposure": 1, "x*": 2, ".5": 1, - "gl_FragColor": 2, + "gl_FragColor": 3, + "#version": 2, + "core": 1, + "cbar": 2, + "cfoo": 1, + "CB": 2, + "CD": 2, + "CA": 1, + "CC": 1, + "CBT": 5, + "CDT": 3, + "CAT": 1, + "CCT": 1, + "norA": 4, + "norB": 3, + "norC": 1, + "norD": 1, + "norE": 4, + "norF": 1, + "norG": 1, + "norH": 1, + "norI": 1, + "norcA": 2, + "norcB": 3, + "norcC": 2, + "norcD": 2, + "head": 1, + "of": 1, + "cycle": 2, + "norcE": 1, + "lead": 1, + "into": 1, "NUM_LIGHTS": 4, "AMBIENT": 2, "MAX_DIST": 3, @@ -23763,7 +23979,7 @@ "lightColor": 3, "[": 29, "]": 29, - "varying": 3, + "varying": 4, "fragmentNormal": 2, "cameraVector": 2, "lightVector": 4, @@ -23791,7 +24007,11 @@ "specularDot": 2, "sample.rgb": 1, "sample.a": 1, - "#version": 1, + "static": 1, + "char*": 1, + "SimpleFragmentShader": 1, + "STRINGIFY": 1, + "FrontColor": 2, "kCoeff": 2, "kCube": 2, "uShift": 3, @@ -24827,7 +25047,7 @@ "echoDirListViaAntBuilder": 1, "(": 7, ")": 7, - "{": 3, + "{": 9, "description": 1, "//Docs": 1, "http": 1, @@ -24855,7 +25075,7 @@ "ant.fileScanner": 1, "fileset": 1, "dir": 1, - "}": 3, + "}": 9, ".each": 1, "//Print": 1, "each": 1, @@ -24866,10 +25086,16 @@ "CWD": 1, "projectDir": 1, "removed.": 1, - "println": 2, + "println": 3, "it.toString": 1, "-": 1, - "SHEBANG#!groovy": 1 + "SHEBANG#!groovy": 2, + "html": 3, + "head": 2, + "component": 1, + "title": 2, + "body": 1, + "p": 1 }, "Groovy Server Pages": { "": 4, @@ -26472,15 +26698,15 @@ ".internalBuildGeneratedFileFrom": 1 }, "JavaScript": { - "function": 1210, - "(": 8513, - ")": 8521, - "{": 2736, - ";": 4052, + "function": 1212, + "(": 8518, + ")": 8526, + "{": 2738, + ";": 4056, "//": 410, "jshint": 1, "_": 9, - "var": 910, + "var": 911, "Modal": 2, "content": 5, "options": 56, @@ -26490,15 +26716,15 @@ ".delegate": 2, ".proxy": 1, "this.hide": 1, - "this": 577, - "}": 2712, + "this": 578, + "}": 2714, "Modal.prototype": 1, "constructor": 8, "toggle": 10, - "return": 944, - "[": 1459, + "return": 945, + "[": 1461, "this.isShown": 3, - "]": 1456, + "]": 1458, "show": 10, "that": 33, "e": 663, @@ -26526,7 +26752,7 @@ "hide": 8, "body": 22, "modal": 4, - "-": 705, + "-": 706, "open": 2, "fade": 4, "hidden": 12, @@ -27186,6 +27412,12 @@ "_results.push": 2, "math.cube": 2, ".slice": 6, + "window": 18, + "angular": 1, + "Array.prototype.last": 1, + "this.length": 41, + "app": 3, + "angular.module": 1, "A": 24, "w": 110, "ma": 3, @@ -27324,7 +27556,6 @@ "c.prototype": 1, "init": 7, "this.context": 17, - "this.length": 40, "s.body": 2, "this.selector": 16, "Ta.exec": 1, @@ -27885,7 +28116,6 @@ "scrollTo": 1, "CSS1Compat": 1, "client": 3, - "window": 16, "document": 26, "window.document": 2, "navigator": 3, @@ -29539,7 +29769,6 @@ "week": 1, "bK": 1, "about": 1, - "app": 2, "storage": 1, "extension": 1, "widget": 1, @@ -30718,6 +30947,7 @@ "js": 1, "classes.join": 1, "this.document": 1, + "window.angular": 1, "PEG.parser": 1, "quote": 3, "result0": 264, @@ -54467,20 +54697,20 @@ "R": { "df.residual.mira": 1, "<": 46, - "-": 51, + "-": 53, "function": 18, "(": 219, "object": 12, "...": 4, ")": 220, - "{": 46, + "{": 58, "fit": 2, "analyses": 1, "[": 23, "]": 24, "return": 8, "df.residual": 2, - "}": 46, + "}": 58, "df.residual.lme": 1, "fixDF": 1, "df.residual.mer": 1, @@ -54516,7 +54746,7 @@ "SHEBANG#!Rscript": 2, "#": 45, "MedianNorm": 2, - "data": 11, + "data": 13, "geomeans": 3, "<->": 1, "exp": 1, @@ -54554,7 +54784,7 @@ "outfile": 4, "sprintf": 2, "png": 2, - "h": 12, + "h": 13, "hist": 4, "plot": 7, "FALSE": 9, @@ -54566,7 +54796,7 @@ "main": 2, "xlab": 2, "ylab": 2, - "for": 3, + "for": 4, "i": 6, "in": 8, "lines": 6, @@ -54612,7 +54842,7 @@ "hello": 2, "print": 1, "module": 25, - "code": 19, + "code": 21, "available": 1, "via": 1, "the": 16, @@ -54634,17 +54864,17 @@ "is": 7, "optionally": 1, "attached": 2, - "to": 8, - "of": 1, + "to": 9, + "of": 2, "current": 2, "scope": 1, "defaults": 1, - ".": 5, + ".": 7, "However": 1, "interactive": 2, "invoked": 1, "directly": 1, - "from": 3, + "from": 5, "terminal": 1, "only": 1, "i.e.": 1, @@ -54652,12 +54882,12 @@ "within": 1, "modules": 4, "import.attach": 1, - "can": 2, - "be": 7, - "set": 1, + "can": 3, + "be": 8, + "set": 2, "or": 1, "depending": 1, - "on": 1, + "on": 2, "user": 1, "s": 2, "preference.": 1, @@ -54665,7 +54895,7 @@ "causes": 1, "emph": 3, "operators": 3, - "by": 1, + "by": 2, "default": 1, "path.": 1, "Not": 1, @@ -54674,14 +54904,14 @@ "therefore": 1, "drastically": 1, "limits": 1, - "a": 5, + "a": 6, "usefulness.": 1, "Modules": 1, - "are": 1, + "are": 4, "searched": 1, "options": 1, "priority.": 1, - "The": 2, + "The": 5, "directory": 1, "always": 1, "considered": 1, @@ -54744,7 +54974,7 @@ "exhibit_namespace": 3, "identical": 2, ".GlobalEnv": 2, - "name": 9, + "name": 10, "environmentName": 2, "parent.env": 4, "export_operators": 2, @@ -54757,7 +54987,7 @@ "parent": 9, ".BaseNamespaceEnv": 1, "paste": 3, - "source": 2, + "source": 3, "chdir": 1, "envir": 5, "cache_module": 1, @@ -54781,7 +55011,7 @@ "references": 1, "remain": 1, "unchanged": 1, - "and": 2, + "and": 5, "files": 1, "would": 1, "have": 1, @@ -54830,7 +55060,58 @@ "pts": 1, "spsample": 1, "polyg": 1, - "numpoints": 1 + "numpoints": 1, + "docType": 1, + "package": 5, + "scholar": 6, + "alias": 2, + "title": 1, + "reads": 1, + "url": 2, + "http": 2, + "//scholar.google.com": 1, + "Dates": 1, + "citation": 2, + "counts": 1, + "estimated": 1, + "determined": 1, + "automatically": 1, + "computer": 1, + "program.": 1, + "Use": 1, + "at": 2, + "your": 1, + "own": 1, + "risk.": 1, + "description": 1, + "provides": 1, + "functions": 3, + "extract": 1, + "Google": 2, + "Scholar.": 1, + "There": 1, + "also": 1, + "convenience": 1, + "comparing": 1, + "multiple": 1, + "scholars": 1, + "predicting": 1, + "index": 1, + "scores": 1, + "based": 1, + "past": 1, + "publication": 1, + "records.": 1, + "note": 1, + "A": 1, + "complementary": 1, + "Scholar": 1, + "found": 1, + "//biostat.jhsph.edu/": 1, + "jleek/code/googleCite.r": 1, + "was": 1, + "developed": 1, + "independently.": 1 }, "Racket": { ";": 3, @@ -57256,6 +57537,53 @@ "running_threads2": 2, "port2.recv": 1 }, + "SAS": { + "libname": 1, + "source": 1, + "data": 6, + "work.working_copy": 5, + ";": 22, + "set": 3, + "source.original_file.sas7bdat": 1, + "run": 6, + "if": 2, + "Purge": 1, + "then": 2, + "delete": 1, + "ImportantVariable": 1, + ".": 1, + "MissingFlag": 1, + "proc": 2, + "surveyselect": 1, + "work.data": 1, + "out": 2, + "work.boot": 2, + "method": 1, + "urs": 1, + "reps": 1, + "seed": 2, + "sampsize": 1, + "outhits": 1, + "samplingunit": 1, + "Site": 1, + "PROC": 1, + "MI": 1, + "work.bootmi": 2, + "nimpute": 1, + "round": 1, + "By": 2, + "Replicate": 2, + "VAR": 1, + "Variable1": 2, + "Variable2": 2, + "logistic": 1, + "descending": 1, + "_Imputation_": 1, + "model": 1, + "Outcome": 1, + "/": 1, + "risklimits": 1 + }, "Sass": { "blue": 7, "#3bbfce": 2, @@ -65501,7 +65829,7 @@ "Brightscript": 579, "C": 59053, "C#": 278, - "C++": 32475, + "C++": 34739, "Ceylon": 50, "Cirru": 244, "Clojure": 510, @@ -65530,11 +65858,11 @@ "Game Maker Language": 13310, "GAP": 9944, "GAS": 133, - "GLSL": 3766, + "GLSL": 4033, "Gnuplot": 1023, "Gosu": 410, "Grammatical Framework": 10607, - "Groovy": 69, + "Groovy": 93, "Groovy Server Pages": 91, "Haml": 4, "Handlebars": 69, @@ -65548,7 +65876,7 @@ "Ioke": 2, "Jade": 3, "Java": 8987, - "JavaScript": 76934, + "JavaScript": 76970, "JSON": 183, "JSON5": 57, "JSONiq": 151, @@ -65613,7 +65941,7 @@ "Protocol Buffer": 63, "PureScript": 1652, "Python": 5994, - "R": 1667, + "R": 1790, "Racket": 331, "Ragel in Ruby Host": 593, "RDoc": 279, @@ -65623,6 +65951,7 @@ "RobotFramework": 483, "Ruby": 3862, "Rust": 3566, + "SAS": 93, "Sass": 56, "Scala": 750, "Scaml": 4, @@ -65682,7 +66011,7 @@ "Brightscript": 1, "C": 29, "C#": 2, - "C++": 28, + "C++": 29, "Ceylon": 1, "Cirru": 9, "Clojure": 7, @@ -65711,11 +66040,11 @@ "Game Maker Language": 13, "GAP": 7, "GAS": 1, - "GLSL": 3, + "GLSL": 5, "Gnuplot": 6, "Gosu": 4, "Grammatical Framework": 41, - "Groovy": 2, + "Groovy": 5, "Groovy Server Pages": 4, "Haml": 1, "Handlebars": 2, @@ -65729,7 +66058,7 @@ "Ioke": 1, "Jade": 1, "Java": 6, - "JavaScript": 20, + "JavaScript": 22, "JSON": 4, "JSON5": 2, "JSONiq": 2, @@ -65794,7 +66123,7 @@ "Protocol Buffer": 1, "PureScript": 4, "Python": 9, - "R": 6, + "R": 7, "Racket": 2, "Ragel in Ruby Host": 3, "RDoc": 1, @@ -65804,6 +66133,7 @@ "RobotFramework": 3, "Ruby": 17, "Rust": 1, + "SAS": 2, "Sass": 2, "Scala": 4, "Scaml": 1, @@ -65845,5 +66175,5 @@ "YAML": 2, "Zephir": 2 }, - "md5": "dfced8ef9ddd9813d2982dc25a5468fa" + "md5": "ef1795e3585ee02f479767c6a071eb2f" } \ No newline at end of file diff --git a/samples/C++/epoll_reactor.ipp b/samples/C++/epoll_reactor.ipp new file mode 100644 index 00000000..5d592aff --- /dev/null +++ b/samples/C++/epoll_reactor.ipp @@ -0,0 +1,664 @@ +// +// detail/impl/epoll_reactor.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_DETAIL_IMPL_EPOLL_REACTOR_IPP +#define BOOST_ASIO_DETAIL_IMPL_EPOLL_REACTOR_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#if defined(BOOST_ASIO_HAS_EPOLL) + +#include +#include +#include +#include +#include + +#if defined(BOOST_ASIO_HAS_TIMERFD) +# include +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + +#include + +namespace boost { +namespace asio { +namespace detail { + +epoll_reactor::epoll_reactor(boost::asio::io_service& io_service) + : boost::asio::detail::service_base(io_service), + io_service_(use_service(io_service)), + mutex_(), + interrupter_(), + epoll_fd_(do_epoll_create()), + timer_fd_(do_timerfd_create()), + shutdown_(false) +{ + // Add the interrupter's descriptor to epoll. + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLET; + ev.data.ptr = &interrupter_; + epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, interrupter_.read_descriptor(), &ev); + interrupter_.interrupt(); + + // Add the timer descriptor to epoll. + if (timer_fd_ != -1) + { + ev.events = EPOLLIN | EPOLLERR; + ev.data.ptr = &timer_fd_; + epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, timer_fd_, &ev); + } +} + +epoll_reactor::~epoll_reactor() +{ + if (epoll_fd_ != -1) + close(epoll_fd_); + if (timer_fd_ != -1) + close(timer_fd_); +} + +void epoll_reactor::shutdown_service() +{ + mutex::scoped_lock lock(mutex_); + shutdown_ = true; + lock.unlock(); + + op_queue ops; + + while (descriptor_state* state = registered_descriptors_.first()) + { + for (int i = 0; i < max_ops; ++i) + ops.push(state->op_queue_[i]); + state->shutdown_ = true; + registered_descriptors_.free(state); + } + + timer_queues_.get_all_timers(ops); + + io_service_.abandon_operations(ops); +} + +void epoll_reactor::fork_service(boost::asio::io_service::fork_event fork_ev) +{ + if (fork_ev == boost::asio::io_service::fork_child) + { + if (epoll_fd_ != -1) + ::close(epoll_fd_); + epoll_fd_ = -1; + epoll_fd_ = do_epoll_create(); + + if (timer_fd_ != -1) + ::close(timer_fd_); + timer_fd_ = -1; + timer_fd_ = do_timerfd_create(); + + interrupter_.recreate(); + + // Add the interrupter's descriptor to epoll. + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLET; + ev.data.ptr = &interrupter_; + epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, interrupter_.read_descriptor(), &ev); + interrupter_.interrupt(); + + // Add the timer descriptor to epoll. + if (timer_fd_ != -1) + { + ev.events = EPOLLIN | EPOLLERR; + ev.data.ptr = &timer_fd_; + epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, timer_fd_, &ev); + } + + update_timeout(); + + // Re-register all descriptors with epoll. + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + for (descriptor_state* state = registered_descriptors_.first(); + state != 0; state = state->next_) + { + ev.events = state->registered_events_; + ev.data.ptr = state; + int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, state->descriptor_, &ev); + if (result != 0) + { + boost::system::error_code ec(errno, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(ec, "epoll re-registration"); + } + } + } +} + +void epoll_reactor::init_task() +{ + io_service_.init_task(); +} + +int epoll_reactor::register_descriptor(socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data) +{ + descriptor_data = allocate_descriptor_state(); + + { + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + descriptor_data->reactor_ = this; + descriptor_data->descriptor_ = descriptor; + descriptor_data->shutdown_ = false; + } + + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET; + descriptor_data->registered_events_ = ev.events; + ev.data.ptr = descriptor_data; + int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); + if (result != 0) + return errno; + + return 0; +} + +int epoll_reactor::register_internal_descriptor( + int op_type, socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data, reactor_op* op) +{ + descriptor_data = allocate_descriptor_state(); + + { + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + descriptor_data->reactor_ = this; + descriptor_data->descriptor_ = descriptor; + descriptor_data->shutdown_ = false; + descriptor_data->op_queue_[op_type].push(op); + } + + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET; + descriptor_data->registered_events_ = ev.events; + ev.data.ptr = descriptor_data; + int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); + if (result != 0) + return errno; + + return 0; +} + +void epoll_reactor::move_descriptor(socket_type, + epoll_reactor::per_descriptor_data& target_descriptor_data, + epoll_reactor::per_descriptor_data& source_descriptor_data) +{ + target_descriptor_data = source_descriptor_data; + source_descriptor_data = 0; +} + +void epoll_reactor::start_op(int op_type, socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data, reactor_op* op, + bool is_continuation, bool allow_speculative) +{ + if (!descriptor_data) + { + op->ec_ = boost::asio::error::bad_descriptor; + post_immediate_completion(op, is_continuation); + return; + } + + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + if (descriptor_data->shutdown_) + { + post_immediate_completion(op, is_continuation); + return; + } + + if (descriptor_data->op_queue_[op_type].empty()) + { + if (allow_speculative + && (op_type != read_op + || descriptor_data->op_queue_[except_op].empty())) + { + if (op->perform()) + { + descriptor_lock.unlock(); + io_service_.post_immediate_completion(op, is_continuation); + return; + } + + if (op_type == write_op) + { + if ((descriptor_data->registered_events_ & EPOLLOUT) == 0) + { + epoll_event ev = { 0, { 0 } }; + ev.events = descriptor_data->registered_events_ | EPOLLOUT; + ev.data.ptr = descriptor_data; + if (epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev) == 0) + { + descriptor_data->registered_events_ |= ev.events; + } + else + { + op->ec_ = boost::system::error_code(errno, + boost::asio::error::get_system_category()); + io_service_.post_immediate_completion(op, is_continuation); + return; + } + } + } + } + else + { + if (op_type == write_op) + { + descriptor_data->registered_events_ |= EPOLLOUT; + } + + epoll_event ev = { 0, { 0 } }; + ev.events = descriptor_data->registered_events_; + ev.data.ptr = descriptor_data; + epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev); + } + } + + descriptor_data->op_queue_[op_type].push(op); + io_service_.work_started(); +} + +void epoll_reactor::cancel_ops(socket_type, + epoll_reactor::per_descriptor_data& descriptor_data) +{ + if (!descriptor_data) + return; + + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + op_queue ops; + for (int i = 0; i < max_ops; ++i) + { + while (reactor_op* op = descriptor_data->op_queue_[i].front()) + { + op->ec_ = boost::asio::error::operation_aborted; + descriptor_data->op_queue_[i].pop(); + ops.push(op); + } + } + + descriptor_lock.unlock(); + + io_service_.post_deferred_completions(ops); +} + +void epoll_reactor::deregister_descriptor(socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data, bool closing) +{ + if (!descriptor_data) + return; + + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + if (!descriptor_data->shutdown_) + { + if (closing) + { + // The descriptor will be automatically removed from the epoll set when + // it is closed. + } + else + { + epoll_event ev = { 0, { 0 } }; + epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev); + } + + op_queue ops; + for (int i = 0; i < max_ops; ++i) + { + while (reactor_op* op = descriptor_data->op_queue_[i].front()) + { + op->ec_ = boost::asio::error::operation_aborted; + descriptor_data->op_queue_[i].pop(); + ops.push(op); + } + } + + descriptor_data->descriptor_ = -1; + descriptor_data->shutdown_ = true; + + descriptor_lock.unlock(); + + free_descriptor_state(descriptor_data); + descriptor_data = 0; + + io_service_.post_deferred_completions(ops); + } +} + +void epoll_reactor::deregister_internal_descriptor(socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data) +{ + if (!descriptor_data) + return; + + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + if (!descriptor_data->shutdown_) + { + epoll_event ev = { 0, { 0 } }; + epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev); + + op_queue ops; + for (int i = 0; i < max_ops; ++i) + ops.push(descriptor_data->op_queue_[i]); + + descriptor_data->descriptor_ = -1; + descriptor_data->shutdown_ = true; + + descriptor_lock.unlock(); + + free_descriptor_state(descriptor_data); + descriptor_data = 0; + } +} + +void epoll_reactor::run(bool block, op_queue& ops) +{ + // This code relies on the fact that the task_io_service queues the reactor + // task behind all descriptor operations generated by this function. This + // means, that by the time we reach this point, any previously returned + // descriptor operations have already been dequeued. Therefore it is now safe + // for us to reuse and return them for the task_io_service to queue again. + + // Calculate a timeout only if timerfd is not used. + int timeout; + if (timer_fd_ != -1) + timeout = block ? -1 : 0; + else + { + mutex::scoped_lock lock(mutex_); + timeout = block ? get_timeout() : 0; + } + + // Block on the epoll descriptor. + epoll_event events[128]; + int num_events = epoll_wait(epoll_fd_, events, 128, timeout); + +#if defined(BOOST_ASIO_HAS_TIMERFD) + bool check_timers = (timer_fd_ == -1); +#else // defined(BOOST_ASIO_HAS_TIMERFD) + bool check_timers = true; +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + + // Dispatch the waiting events. + for (int i = 0; i < num_events; ++i) + { + void* ptr = events[i].data.ptr; + if (ptr == &interrupter_) + { + // No need to reset the interrupter since we're leaving the descriptor + // in a ready-to-read state and relying on edge-triggered notifications + // to make it so that we only get woken up when the descriptor's epoll + // registration is updated. + +#if defined(BOOST_ASIO_HAS_TIMERFD) + if (timer_fd_ == -1) + check_timers = true; +#else // defined(BOOST_ASIO_HAS_TIMERFD) + check_timers = true; +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + } +#if defined(BOOST_ASIO_HAS_TIMERFD) + else if (ptr == &timer_fd_) + { + check_timers = true; + } +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + else + { + // The descriptor operation doesn't count as work in and of itself, so we + // don't call work_started() here. This still allows the io_service to + // stop if the only remaining operations are descriptor operations. + descriptor_state* descriptor_data = static_cast(ptr); + descriptor_data->set_ready_events(events[i].events); + ops.push(descriptor_data); + } + } + + if (check_timers) + { + mutex::scoped_lock common_lock(mutex_); + timer_queues_.get_ready_timers(ops); + +#if defined(BOOST_ASIO_HAS_TIMERFD) + if (timer_fd_ != -1) + { + itimerspec new_timeout; + itimerspec old_timeout; + int flags = get_timeout(new_timeout); + timerfd_settime(timer_fd_, flags, &new_timeout, &old_timeout); + } +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + } +} + +void epoll_reactor::interrupt() +{ + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLET; + ev.data.ptr = &interrupter_; + epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, interrupter_.read_descriptor(), &ev); +} + +int epoll_reactor::do_epoll_create() +{ +#if defined(EPOLL_CLOEXEC) + int fd = epoll_create1(EPOLL_CLOEXEC); +#else // defined(EPOLL_CLOEXEC) + int fd = -1; + errno = EINVAL; +#endif // defined(EPOLL_CLOEXEC) + + if (fd == -1 && (errno == EINVAL || errno == ENOSYS)) + { + fd = epoll_create(epoll_size); + if (fd != -1) + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + } + + if (fd == -1) + { + boost::system::error_code ec(errno, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(ec, "epoll"); + } + + return fd; +} + +int epoll_reactor::do_timerfd_create() +{ +#if defined(BOOST_ASIO_HAS_TIMERFD) +# if defined(TFD_CLOEXEC) + int fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); +# else // defined(TFD_CLOEXEC) + int fd = -1; + errno = EINVAL; +# endif // defined(TFD_CLOEXEC) + + if (fd == -1 && errno == EINVAL) + { + fd = timerfd_create(CLOCK_MONOTONIC, 0); + if (fd != -1) + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + } + + return fd; +#else // defined(BOOST_ASIO_HAS_TIMERFD) + return -1; +#endif // defined(BOOST_ASIO_HAS_TIMERFD) +} + +epoll_reactor::descriptor_state* epoll_reactor::allocate_descriptor_state() +{ + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + return registered_descriptors_.alloc(); +} + +void epoll_reactor::free_descriptor_state(epoll_reactor::descriptor_state* s) +{ + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + registered_descriptors_.free(s); +} + +void epoll_reactor::do_add_timer_queue(timer_queue_base& queue) +{ + mutex::scoped_lock lock(mutex_); + timer_queues_.insert(&queue); +} + +void epoll_reactor::do_remove_timer_queue(timer_queue_base& queue) +{ + mutex::scoped_lock lock(mutex_); + timer_queues_.erase(&queue); +} + +void epoll_reactor::update_timeout() +{ +#if defined(BOOST_ASIO_HAS_TIMERFD) + if (timer_fd_ != -1) + { + itimerspec new_timeout; + itimerspec old_timeout; + int flags = get_timeout(new_timeout); + timerfd_settime(timer_fd_, flags, &new_timeout, &old_timeout); + return; + } +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + interrupt(); +} + +int epoll_reactor::get_timeout() +{ + // By default we will wait no longer than 5 minutes. This will ensure that + // any changes to the system clock are detected after no longer than this. + return timer_queues_.wait_duration_msec(5 * 60 * 1000); +} + +#if defined(BOOST_ASIO_HAS_TIMERFD) +int epoll_reactor::get_timeout(itimerspec& ts) +{ + ts.it_interval.tv_sec = 0; + ts.it_interval.tv_nsec = 0; + + long usec = timer_queues_.wait_duration_usec(5 * 60 * 1000 * 1000); + ts.it_value.tv_sec = usec / 1000000; + ts.it_value.tv_nsec = usec ? (usec % 1000000) * 1000 : 1; + + return usec ? 0 : TFD_TIMER_ABSTIME; +} +#endif // defined(BOOST_ASIO_HAS_TIMERFD) + +struct epoll_reactor::perform_io_cleanup_on_block_exit +{ + explicit perform_io_cleanup_on_block_exit(epoll_reactor* r) + : reactor_(r), first_op_(0) + { + } + + ~perform_io_cleanup_on_block_exit() + { + if (first_op_) + { + // Post the remaining completed operations for invocation. + if (!ops_.empty()) + reactor_->io_service_.post_deferred_completions(ops_); + + // A user-initiated operation has completed, but there's no need to + // explicitly call work_finished() here. Instead, we'll take advantage of + // the fact that the task_io_service will call work_finished() once we + // return. + } + else + { + // No user-initiated operations have completed, so we need to compensate + // for the work_finished() call that the task_io_service will make once + // this operation returns. + reactor_->io_service_.work_started(); + } + } + + epoll_reactor* reactor_; + op_queue ops_; + operation* first_op_; +}; + +epoll_reactor::descriptor_state::descriptor_state() + : operation(&epoll_reactor::descriptor_state::do_complete) +{ +} + +operation* epoll_reactor::descriptor_state::perform_io(uint32_t events) +{ + mutex_.lock(); + perform_io_cleanup_on_block_exit io_cleanup(reactor_); + mutex::scoped_lock descriptor_lock(mutex_, mutex::scoped_lock::adopt_lock); + + // Exception operations must be processed first to ensure that any + // out-of-band data is read before normal data. + static const int flag[max_ops] = { EPOLLIN, EPOLLOUT, EPOLLPRI }; + for (int j = max_ops - 1; j >= 0; --j) + { + if (events & (flag[j] | EPOLLERR | EPOLLHUP)) + { + while (reactor_op* op = op_queue_[j].front()) + { + if (op->perform()) + { + op_queue_[j].pop(); + io_cleanup.ops_.push(op); + } + else + break; + } + } + } + + // The first operation will be returned for completion now. The others will + // be posted for later by the io_cleanup object's destructor. + io_cleanup.first_op_ = io_cleanup.ops_.front(); + io_cleanup.ops_.pop(); + return io_cleanup.first_op_; +} + +void epoll_reactor::descriptor_state::do_complete( + io_service_impl* owner, operation* base, + const boost::system::error_code& ec, std::size_t bytes_transferred) +{ + if (owner) + { + descriptor_state* descriptor_data = static_cast(base); + uint32_t events = static_cast(bytes_transferred); + if (operation* op = descriptor_data->perform_io(events)) + { + op->complete(*owner, ec, 0); + } + } +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // defined(BOOST_ASIO_HAS_EPOLL) + +#endif // BOOST_ASIO_DETAIL_IMPL_EPOLL_REACTOR_IPP diff --git a/samples/GLSL/SimpleLighting.gl2.frag b/samples/GLSL/SimpleLighting.gl2.frag new file mode 100644 index 00000000..bb851f86 --- /dev/null +++ b/samples/GLSL/SimpleLighting.gl2.frag @@ -0,0 +1,9 @@ +static const char* SimpleFragmentShader = STRINGIFY( + +varying vec4 FrontColor; + +void main(void) +{ + gl_FragColor = FrontColor; +} +); diff --git a/samples/GLSL/recurse1.frag b/samples/GLSL/recurse1.frag new file mode 100644 index 00000000..66b4c3fe --- /dev/null +++ b/samples/GLSL/recurse1.frag @@ -0,0 +1,48 @@ +#version 330 core + +// cross-unit recursion + +void main() {} + +// two-level recursion + +float cbar(int); + +void cfoo(float) +{ + cbar(2); +} + +// four-level, out of order + +void CB(); +void CD(); +void CA() { CB(); } +void CC() { CD(); } + +// high degree + +void CBT(); +void CDT(); +void CAT() { CBT(); CBT(); CBT(); } +void CCT() { CDT(); CDT(); CBT(); } + +// not recursive + +void norA() {} +void norB() { norA(); } +void norC() { norA(); } +void norD() { norA(); } +void norE() { norB(); } +void norF() { norB(); } +void norG() { norE(); } +void norH() { norE(); } +void norI() { norE(); } + +// not recursive, but with a call leading into a cycle if ignoring direction + +void norcA() { } +void norcB() { norcA(); } +void norcC() { norcB(); } +void norcD() { norcC(); norcB(); } // head of cycle +void norcE() { norcD(); } // lead into cycle diff --git a/samples/Groovy/script.gvy b/samples/Groovy/script.gvy new file mode 100644 index 00000000..25ef2eab --- /dev/null +++ b/samples/Groovy/script.gvy @@ -0,0 +1,2 @@ +#!/usr/bin/env groovy +println "Hello World" diff --git a/samples/Groovy/template.grt b/samples/Groovy/template.grt new file mode 100644 index 00000000..59bb9c22 --- /dev/null +++ b/samples/Groovy/template.grt @@ -0,0 +1,9 @@ +html { + head { + component "bootstrap" + title "Bootstrap Template" + } + + html { + } +} diff --git a/samples/Groovy/template.gtpl b/samples/Groovy/template.gtpl new file mode 100644 index 00000000..f2e594d1 --- /dev/null +++ b/samples/Groovy/template.gtpl @@ -0,0 +1,9 @@ +html { + head { + title "Example Template" + } + + body { + p "This is a quick template example" + } +} diff --git a/samples/JavaScript/intro.js.frag b/samples/JavaScript/intro.js.frag new file mode 100644 index 00000000..a4e06b08 --- /dev/null +++ b/samples/JavaScript/intro.js.frag @@ -0,0 +1,7 @@ +(function(window, angular) { + +Array.prototype.last = function() { + return this[this.length-1]; +}; + +var app = angular.module('ConwayGameOfLife', []); diff --git a/samples/JavaScript/outro.js.frag b/samples/JavaScript/outro.js.frag new file mode 100644 index 00000000..8634f6ed --- /dev/null +++ b/samples/JavaScript/outro.js.frag @@ -0,0 +1,3 @@ + +})(window, window.angular); + diff --git a/samples/R/scholar.Rd b/samples/R/scholar.Rd new file mode 100644 index 00000000..8a593b38 --- /dev/null +++ b/samples/R/scholar.Rd @@ -0,0 +1,25 @@ +\docType{package} +\name{scholar} +\alias{scholar} +\alias{scholar-package} +\title{scholar} +\source{ + The package reads data from + \url{http://scholar.google.com}. Dates and citation + counts are estimated and are determined automatically by + a computer program. Use at your own risk. +} +\description{ + The \code{scholar} package provides functions to extract + citation data from Google Scholar. There are also + convenience functions for comparing multiple scholars and + predicting h-index scores based on past publication + records. +} +\note{ + A complementary set of Google Scholar functions can be + found at + \url{http://biostat.jhsph.edu/~jleek/code/googleCite.r}. + The \code{scholar} package was developed independently. +} + diff --git a/samples/SAS/data.sas b/samples/SAS/data.sas new file mode 100644 index 00000000..e4e9bb07 --- /dev/null +++ b/samples/SAS/data.sas @@ -0,0 +1,17 @@ +/* Example DATA step code for linguist */ + +libname source 'C:\path\to\file' + +data work.working_copy; + set source.original_file.sas7bdat; +run; + +data work.working_copy; + set work.working_copy; + if Purge = 1 then delete; +run; + +data work.working_copy; + set work.working_copy; + if ImportantVariable = . then MissingFlag = 1; +run; \ No newline at end of file diff --git a/samples/SAS/proc.sas b/samples/SAS/proc.sas new file mode 100644 index 00000000..80cc1676 --- /dev/null +++ b/samples/SAS/proc.sas @@ -0,0 +1,15 @@ +/* PROC examples for Linguist */ + +proc surveyselect data=work.data out=work.boot method=urs reps=20000 seed=2156 sampsize=28 outhits; + samplingunit Site; +run; + +PROC MI data=work.boot out=work.bootmi nimpute=30 seed=5686 round = 1; + By Replicate; + VAR Variable1 Variable2; +run; + +proc logistic data=work.bootmi descending; + By Replicate _Imputation_; + model Outcome = Variable1 Variable2 / risklimits; +run; \ No newline at end of file