From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.bugs Subject: bug#22873: Can we support multiple cursors? Date: Thu, 10 Aug 2017 17:00:33 -0700 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart_Thu_Aug_10_17:00:33_2017-1" X-Trace: blaine.gmane.org 1502409689 20541 195.159.176.226 (11 Aug 2017 00:01:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 11 Aug 2017 00:01:29 +0000 (UTC) Cc: John Wiegley , Marcin Borkowski , Richard Stallman To: 22873@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 11 02:01:21 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfxO6-0004R4-3w for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Aug 2017 02:01:15 +0200 Original-Received: from localhost ([::1]:33514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfxOA-00009F-Lq for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Aug 2017 20:01:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfxNz-00006w-1M for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2017 20:01:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfxNv-0005qq-0I for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2017 20:01:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46173) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dfxNu-0005pg-O1 for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2017 20:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dfxNu-0007yS-7g for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2017 20:01:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Keith David Bershatsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Aug 2017 00:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22873 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22873-submit@debbugs.gnu.org id=B22873.150240964130616 (code B ref 22873); Fri, 11 Aug 2017 00:01:02 +0000 Original-Received: (at 22873) by debbugs.gnu.org; 11 Aug 2017 00:00:41 +0000 Original-Received: from localhost ([127.0.0.1]:54854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfxNY-0007xk-QJ for submit@debbugs.gnu.org; Thu, 10 Aug 2017 20:00:41 -0400 Original-Received: from gateway24.websitewelcome.com ([192.185.51.110]:27971) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfxNU-0007xa-UG for 22873@debbugs.gnu.org; Thu, 10 Aug 2017 20:00:37 -0400 Original-Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 18B9528765 for <22873@debbugs.gnu.org>; Thu, 10 Aug 2017 19:00:36 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id fxMfd8on0dHTnfxMfdYE0U; Thu, 10 Aug 2017 18:59:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=40D+88mFpHwuhjTmvgBAICP2D+0ttqVpfeyCfXHugO4=; b=U+8ZOTpK63Y51rC4HOUyMSrG03 u8fYqNt4Zd3yCj76bq8CT/KCNHQT/SUSl5DgGvPu8L+ZDIQCUzvFgTSLRTKF/1IKJP6ay5FSULvQV yTcHRg0YW+sMOeLZ9f9lt2KCSIu4sfHNcgyL2/Rxx+1GRQElhpXGhwVfWqArni+IHkIx+6cmI6CiJ nurprZNXqXZzpjq9Xig/n5M2a8Wjly3qvDaZoJ4/8Rz65n5WMHVHcRjXIQyvqwrJ6vsCWPBRO3Fh9 aGtpi/pk8KFOTcY7LCy/v+cdl8n5FgLyTmLAJxboDZK+q+31NwGj2vGfADJLfjwbAMq8ReweUywcE ndHtcGjw==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:56498 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.87) (envelope-from ) id 1dfxNS-000jpJ-Lz; Thu, 10 Aug 2017 19:00:35 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Exim-ID: 1dfxNS-000jpJ-Lz X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:56498 X-Source-Auth: lawlist X-Email-Count: 5 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135632 Archived-At: --Multipart_Thu_Aug_10_17:00:33_2017-1 Content-Type: text/plain; charset=US-ASCII PATCH VERSION: 010 - This patch applies to commit a30e7e12ed8465e2565dd318d921bc87f52ce18e from 03/28/2016. [@lawlist is presently unable to use the current master branch for daily workflow due to certain unrelated bugs.] WHAT'S NEW: - `update_frame` runs too late in the redisplay cycle to reliably remove all fake cursors when cutting/pasting text in conjunction with the current command loop. If we erase the fake cursors at the outset of `redisplay_window`, removal occurs too early in the redisplay cycle and the user sees the cursors being removed before the current command finishes. The very end of `redisplay_window` is a little closer to being the "sweet spot" for initial fake cursor removal, which is where it now occurs. Fake cursors are presently only being drawn whenever `update_frame` is called. Removal of fake cursors is faster on OSX, and slower on Windows and X11. - Recordation of prior values at the end of `redisplay_window` has been simplified to just four (4) values (current/previous window-start/window-end). - `mc_erase` has been simplified to use the existing function `erase_phys_cursor`. - Miscellaneous bug fixes, including, but not limited to checks to ensure that coordinates (X, Y, HPOS, VPOS) are within bounds. - Improved comments and doc-strings. TODO: - Set up a user option similar to `cursor-in-non-selected-windows'. - Explore the idea of whether we need additional code to handle removing/redrawing fake cursors when windows change sizes / layouts. - `w->phys_cursor.vpos` of the real cursor is accurate as to VPOS irrespective of whether the `header-line-format' exists. `mc_x_y_hpos_vpos' may need to adopt a similar approach as to VPOS instead of checking the `header-line-format' and potentially adding a value of 1 immediately before calling `mc_erase' / `mc_draw'. - Fake cursors are being redrawn too often when mousing over text (underneath the real cursor) with mouse-face properties, and also when non-selected windows/frames have an ongoing process that require frequent redisplay updates. - Optimize drawing/erasing fake cursors. - Implement a way to properly calculate X, Y, HPOS, VPOS when overlays are present. The overlay after-string wreaks havoc when calculating coordinates. - Fix any bugs (there will surely be many). - Try and convince one or more real programmers to take over from here. ROAD MAP: - The first stage of development is the creation and removal of fake cursors, which are specified with: buffer point, cursor-style, and cursor color. - The second stage of development is the built-in C implementation of functionality similar to the multiple cursors library by Magnar Sveen. INSTALLATION: - STEP #1 (clone master branch): git clone -b master git://git.sv.gnu.org/emacs.git - STEP #2: cd over to the root of the `emacs` source directory cloned in the first step above. - STEP #3 (hard reset): git reset --hard a30e7e12ed8465e2565dd318d921bc87f52ce18e The following message is displayed in the terminal: "HEAD is now at a30e7e1 Mention the `M-q' changes" - STEP #4 (put the patch in place): Copy the latest patch to the root of the emacs source directory cloned in the first step above. - STEP #5 (apply the patch): git apply [latest-patch.diff] - STEP #6: ./autogen.sh - STEP #7: Configure the build for X, MS Windows, or OSX; e.g.,: ./configure --with-ns - STEP #8: make - STEP #9: make install - STEP #10: Launch the newly built Emacs, and copy the following function to the `*scratch*` buffer, and type `M-x mc-test`. (defun mc-test () "Draw fake cursors at all POS defined in the `mc-list'. Multiple fake cursors are supported by GUI versions of Emacs built for X, Windows and OSX. Popular forms of specifying colors such as \"red\" and \"#FF0000\" are now supported, as well as LSL color vectors such as [1.0 0.0 0.0]. For those users who choose the former familiar methods of specifying colors with strings, `mc_color_vector_calculate' will convert those strings to LSL color vectors. The color vectors are commonly referred to as LSL (The Linden Scripting Language). `nsterm.m' uses `NSColor', which works well with LSL. `w32term.c' uses `PALETTERGB' or `RGB', and the conversion from LSL is done internally by multiplying each element of the LSL color vector by 255. `xterm.c' uses `x_make_truecolor_pixel', which uses 16-bit RGB -- the conversion from LSL happens internally by multiplying each element of the LSL color vector by 65535." (interactive) (let ((buffer (get-buffer-create "*MC-TEST*"))) (with-current-buffer buffer (erase-buffer) (insert "This is a test!") (setq mc-list '((1 "hbar" "red") (2 "bar" "yellow") (3 "box" "#00FF00") (4 "hollow" "#0000FF") (5 ("hbar" 3) [1.0 0.0 1.0]) (6 ("bar" 3) [0.0 1.0 1.0])))) (select-window (display-buffer buffer)) ;;; The trigger in `keyboard.c` is not activated in this example, so we ;;; Force the multiple cursors to be drawn. (mc-draw-erase (selected-window)))) --Multipart_Thu_Aug_10_17:00:33_2017-1 Content-Type: application/diff; type=patch Content-Disposition: attachment; filename="multiple_cursors_010.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy9idWZmZXIuYyBiL3NyYy9idWZmZXIuYwppbmRleCA2MmIwYmM4Li41 Yjk0NjliIDEwMDY0NAotLS0gYS9zcmMvYnVmZmVyLmMKKysrIGIvc3JjL2J1ZmZlci5jCkBAIC01 MDU2LDYgKzUwNTYsMTYgQEAgaW5pdF9idWZmZXJfb25jZSAodm9pZCkKICAgYnNldF9sYXN0X3Nl bGVjdGVkX3dpbmRvdyAoJmJ1ZmZlcl9sb2NhbF9mbGFncywgbWFrZV9udW1iZXIgKDApKTsKIAog ICBpZHggPSAxOworCisKKy8qIDs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7 Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsgKi8KKy8qIG11bHRpcGxl IGN1cnNvcnMgKi8KKworICBYU0VURkFTVElOVCAoQlZBUiAoJmJ1ZmZlcl9sb2NhbF9mbGFncywg bWNfbGlzdCksIGlkeCk7ICsraWR4OworCisvKiA7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7 Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7ICovCisK KwogICBYU0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ozs7Ozs7 Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyAqLworLyog QkVHSU4gbXVsdGlwbGUgY3Vyc29ycyAqLworCisgICAgICBpZiAody0+bWMuZXJhc2UKKyAgICAg ICAgICAmJiAhTUlOSV9XSU5ET1dfUCAodykKKyAgICAgICAgICAmJiAoIU5JTFAgKHctPm1jX2Nh Y2hlKSAmJiAoRVEgKHctPmNvbnRlbnRzLCBYQ0FSIChGbnRoIChtYWtlX251bWJlciAoMiksIHct Pm1jX2NhY2hlKSkpKSkpCisgICAgICAgIG1jX2NhbGMgKHcsIDEpOworCisgICAgICBpZiAody0+ bWMuZHJhdworICAgICAgICAgICYmICFNSU5JX1dJTkRPV19QICh3KQorICAgICAgICAgICYmICFO SUxQIChCVkFSIChYQlVGRkVSICh3LT5jb250ZW50cyksIG1jX2xpc3QpKSkKKyAgICAgICAgLyog RHJhdyBmYWtlIGN1cnNvcnMgICovCisgICAgICAgIG1jX2NhbGMgKHcsIDApOworICAgICAgICAv KiBGaXJzdCBhdHRlbXB0IGF0IGRlYWxpbmcgd2l0aCBhIGByZWRpc3BsYXlfcHJlc2VydmVfZWNo b19hcmVhJyBzaXR1YXRpb24uICAqLworICAgICAgICBlbHNlIGlmICghdy0+bWMuZHJhdworICAg ICAgICAgICAgICAgICAmJiAhTklMUCAoQlZBUiAoWEJVRkZFUiAody0+Y29udGVudHMpLCBtY19s aXN0KSkKKyAgICAgICAgICAgICAgICAgJiYgIU5JTFAgKHctPm1jX2NhY2hlKQorICAgICAgICAg ICAgICAgICAmJiAoRVEgKHctPmNvbnRlbnRzLCBYQ0FSIChGbnRoIChtYWtlX251bWJlciAoMiks IHctPm1jX2NhY2hlKSkpKQorICAgICAgICAgICAgICAgICAmJiAhTUlOSV9XSU5ET1dfUCAodykp CisgICAgICAgICAgeworICAgICAgICAgICAgLyogUmVtb3ZlIGZha2UgY3Vyc29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gKHcsIDApOworICAgICAgICAvKiBGaXJzdCBhdHRl bXB0IGF0IGRlYWxpbmcgd2l0aCBhIGByZWRpc3BsYXlfcHJlc2VydmVfZWNob19hcmVhJyBzaXR1 YXRpb24uICAqLworICAgICAgICBlbHNlIGlmICghdy0+bWMuZHJhdworICAgICAgICAgICAgICAg ICAmJiAhTklMUCAoQlZBUiAoWEJVRkZFUiAody0+Y29udGVudHMpLCBtY19saXN0KSkKKyAgICAg ICAgICAgICAgICAgJiYgIU5JTFAgKHctPm1jX2NhY2hlKQorICAgICAgICAgICAgICAgICAmJiAo RVEgKHctPmNvbnRlbnRzLCBYQ0FSIChGbnRoIChtYWtlX251bWJlciAoMiksIHctPm1jX2NhY2hl KSkpKQorICAgICAgICAgICAgICAgICAmJiAhTUlOSV9XSU5ET1dfUCAodykpCisgICAgICAgICAg eworICAgICAgICAgICAgLyogUmVtb3ZlIGZha2UgY3Vyc29ycy4gICovCisgICAgICAgICAgICBt Y19jYWxjICh3LCAxKTsKKyAgICAgICAgICAgIC8qIERyYXcgZmFrZSBjdXJzb3JzICAqLworICAg ICAgICAgICAgbWNfY2FsYyAodywgMCk7CisgICAgICAgICAgfQorCisvKiBFTkQgbXVsdGlwbGUg Y3Vyc29ycyAqLworLyogOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7 Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyAqLworCisKICAgICAgIGlmIChj dXJzb3Jfb25fcCkKIAlkaXNwbGF5X2FuZF9zZXRfY3Vyc29yICh3LCB0cnVlLAogCQkJCXctPm91 dHB1dF9jdXJzb3IuaHBvcywgdy0+b3V0cHV0X2N1cnNvci52cG9zLApAQCAtOTM1LDEwICs5NjYs MjIgQEAgc3RhdGljIHZvaWQgdzMyX2RyYXdfYm94X3JlY3QgKHN0cnVjdCBnbHlwaF9zdHJpbmcg KiwgaW50L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jU1OworICAgICAgICAgIGlu dCBpbnRfYmx1ZSA9IGJsdWUgKiAyNTU7CisgICAgICAgICAgZi0+b3V0cHV0X2RhdGEudzMyLT5j dXJzb3JfcGl4ZWwgPSBQQUxFVFRFUkdCIChpbnRfcmVkLCBpbnRfZ3JlZW4sIGludF9ibHVlKTsK KyAgICAgICAgICB4X2RyYXdfaG9sbG93X2N1cnNvciAodywgZ2x5cGhfcm93KTsKKyAgICAgICAg ICBmLT5vdXRwdXRfZGF0YS53MzItPmN1cnNvcl9waXhlbCA9IG9yaWdfdmFsOworICAgICAgICB9 CisgICAgICAgIGVsc2UKKyAgICAgICAgICB4X2RyYXdfaG9sbG93X2N1cnNvciAodywgZ2x5cGhf cm93KTsKKyAgICAgIGJyZWFrOworICAgIH0KKyAgICBjYXNlIEZJTExFRF9CT1hfQ1VSU09SOgor ICAgIHsKKyAgICAgIC8qIFRPRE86ICBrZGIgdG8gY29uc2lkZXIgYWRkaW5nIHN1cHBvcnQgZm9y IG11bHRpcGxlIGN1cnNvciBmb3JlZ3JvdW5kCisgICAgICBjdXN0b21pemF0aW9uIG9mIGEgRklM TEVEX0JPWF9DVVJTT1IuICAqLworICAgICAgaWYgKHJlZCA+PSAwICYmIGJsdWUgPj0gMCAmJiBn cmVlbiA+PSAwKQorICAgICAgICAvKiBUZW1wb3JhcmlseSBoaWphY2sgYGYtPm91dHB1dF9kYXRh LnczMi0+Y3Vyc29yX2djJyBieSBib3Jyb3dpbmcgdGhlCisgICAgICAgIGZ1bmN0aW9uYWxpdHkg b2YgYHhfbWFrZV9nYycgaW4gdzMyZm5zLmMuICAqLworICAgICAgICB7CisgICAgICAgICAgYmxv Y2tfaW5wdXQgKCk7CisgICAgICAgICAgTGlzcF9PYmplY3Qgd2luZG93ID0gKHNlbGVjdGVkX3dp bmRvdyk7CisgICAgICAgICAgc3RydWN0IHdpbmRvdyAqdyA9IGRlY29kZV9saXZlX3dpbmRvdyAo d2luZG93KTsKKyAgICAgICAgICBzdHJ1Y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y5z ZXRfY3Vyc29yX2djID0gdHJ1ZTsKKyAgICAgICAgICBkcmF3X3BoeXNfY3Vyc29yX2dseXBoICh3 LCBnbHlwaF9yb3csIERSQVdfQ1VSU09SKTsKKyAgICAgICAgICB3LT5tYy5zZXRfY3Vyc29yX2dj ID0gZmFsc2U7CisgICAgICAgICAgZ2NfdmFsdWVzLmZvbnQgPSBGUkFNRV9GT05UIChmKTsKKyAg ICAgICAgICBnY192YWx1ZXMuZm9yZWdyb3VuZCA9IG9yaWdfdmFsX2E7CisgICAgICAgICAgZ2Nf dmFsdWVzLmJhY2tncm91bmQgPSBvcmlnX3ZhbF9iOworICAgICAgICAgIGYtPm91dHB1dF9kYXRh LnczMi0+Y3Vyc29yX2djCisgICAgICAgICAgICA9IFhDcmVhdGVHQyAoTlVMTCwgRlJBTUVfVzMy X1dJTkRPVyAoZiksIG1hc2ssICZnY192YWx1ZXMpOworICAgICAgICAgIHVuYmxvY2tfaW5wdXQg KCk7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICAgIGRyYXdfcGh5c19jdXJzb3Jf Z2x5cGggKHcsIGdseXBoX3JvdywgRFJBV19DVVJTT1IpOworICAgICAgYnJlYWs7CisgICAgfQor ICAgIGNhc2UgQkFSX0NVUlNPUjoKKyAgICB7CisgICAgICBpZiAocmVkID49IDAgJiYgYmx1ZSA+ PSAwICYmIGdyZWVuID49IDApCisgICAgICAgIC8qIFRlbXBvcmFyaWx5IGhpamFjayBgZi0+b3V0 cHV0X2RhdGEudzMyLT5jdXJzb3JfcGl4ZWwnLiAgKi8KKyAgICAgICAgeworICAgICAgICAgIHN0 cnVjdCBmcmFtZSAqZiA9IFhGUkFNRSAoV0lORE9XX0ZSQU1FICh3KSk7CisgICAgICAgICAgQ09M T1JSRUYgb3JpZ192YWwgPSBmLT5vdXRwdXRfZGF0YS53MzItPmN1cnNvcl9waXhlbDsKKyAgICAg ICAgICBpbnQgaW50X3JlZCA9IHJlZCAqIDI1NTsKKyAgICAgICAgICBpbnQgaW50X2dyZWVuID0g Z3JlZW4gKiAyNTU7CisgICAgICAgICAgaW50IGludF9ibHVlID0gYmx1ZSAqIDI1NTsKKyAgICAg ICAgICBmLT5vdXRwdXRfZGF0YS53MzItPmN1cnNvcl9waXhlbCA9IFBBTEVUVEVSR0IgKGludF9y ZWQsIGludF9ncmVlbiwgaW50X2JsdWUpOworICAgICAgICAgIHhfZHJhd19iYXJfY3Vyc29yICh3 LCBnbHlwaF9yb3csIGN1cnNvcl93aWR0aCwgQkFSX0NVUlNPUik7CisgICAgICAgICAgZi0+b3V0 cHV0X2RhdGEudzMyLT5jdXJzb3JfcGl4ZWwgPSBvcmlnX3ZhbDsKKyAgICAgICAgfQorICAgICAg ICBlbHNlCisgICAgICAgICAgeF9kcmF3X2Jhcl9jdXJzb3IgKHcsIGdseXBoX3JvdywgY3Vyc29y X3dpZHRoLCBCQVJfQ1VSU09SKTsKKyAgICAgIGJyZWFrOworICAgIH0KKyAgICBjYXNlIEhCQVJf Q1VSU09SOgorICAgIHsKKyAgICAgIGlmIChyZWQgPj0gMCAmJiBibHVlID49IDAgJiYgZ3JlZW4g Pj0gMCkKKyAgICAgICAgLyogVGVtcG9yYXJpbHkgaGlqYWNrIGBmLT5vdXRwdXRfZGF0YS53MzIt PmN1cnNvcl9waXhlbCcuICAqLworICAgICAgICB7CisgICAgICAgICAgc3RydWN0IGZyYW1lICpm ID0gWEZSQU1FIChXSU5ET1dfRlJBTUUgKHcpKTsKKyAgICAgICAgICBDT0xPUlJFRiBvcmlnX3Zh bCA9IGYtPm91dHB1dF9kYXRhLnczMi0+Y3Vyc29yX3BpeGVsOworICAgICAgICAgIGludCBpbnRf cmVkID0gcmVkICogMjU1OworICAgICAgICAgIGludCBpbnRfZ3JlZW4gPSBncmVlbiAqIDI1NTsK KyAgICAgICAgICBpbnQgaW50X2JsdWUgPSBibHVlICogMjU1OworICAgICAgICAgIGYtPm91dHB1 dF9kYXRhLnczMi0+Y3Vyc29yX3BpeGV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ICAoc2V0cSBtYy1saXN0ICcoKDEgImhi YXIiICJtYWdlbnRhIikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKDIgImJhciIgInB1 cnBsZSIpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgzICJib3giICIjMDBGRjAwIikK KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKDQgImhvbGxvdyIgIiMwMDAwRkYiKQorICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAoNSAoImhiYXIiIDMpIFsxLjAgMC4wIDEuMF0pCisg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICg2ICgiYmFyIiAzKSBbMC4wIDEuMCAxLjBdKSkp ICAqLworCisvKiBFWEFNUExFICMyOiAgKHNldHEgbWMtbGlzdCBuaWwpICAqLworCisvKiBUT0RP OgorCistICBTZXQgdXAgYSB1c2VyIG9wdGlvbiBzaW1pbGFyIHRvIGBjdXJzb3ItaW4tbm9uLXNl bGVjdGVkLXdpbmRvd3MnLgorCistICBFeHBsb3JlIHRoZSBpZGVhIG9mIHdoZXRoZXIgd2UgbmVl ZCBhZGRpdGlvbmFsIGNvZGUgdG8gaGFuZGxlIHJlbW92aW5nL3JlZHJhd2luZworICAgZmFrZSBj dXJzb3JzIHdoZW4gd2luZG93cyBjaGFuZ2Ugc2l6ZXMgLyBsYXlvdXRzLgorCistICBgdy0+cGh5 c19jdXJzb3IudnBvcycgb2YgdGhlIHJlYWwgY3Vyc29yIGlzIGFjY3VyYXRlIGFzIHRvIFZQT1Mg aXJyZXNwZWN0aXZlIG9mCisgICB3aGV0aGVyIHRoZSBgaGVhZGVyLWxpbmUtZm9ybWF0JyBleGlz dHMuICBgbWNfeF95X2hwb3NfdnBvcycgbWF5IG5lZWQgdG8gYWRvcHQKKyAgIGEgc2ltaWxhciBh cHByb2FjaCBhcyB0byBWUE9TIGluc3RlYWQgb2YgY2hlY2tpbmcgdGhlIGBoZWFkZXItbGluZS1m b3JtYXQnCisgICBhbmQgcG90ZW50aWFs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iAiIzAwRkYwMCIpCisgICAgICAgICAgICAg ICAgICAgICAgICAgICg0ICJob2xsb3ciICIjMDAwMEZGIikKKyAgICAgICAgICAgICAgICAgICAg ICAgICAgKDUgKCJoYmFyIiAzKSBbMS4wIDAuMCAxLjBdKQorICAgICAgICAgICAgICAgICAgICAg ICAgICAoNiAoImJhciIgMykgWzAuMCAxLjAgMS4wXSkpKSkKKyAgICAgICAgKHNlbGVjdC13aW5k b3cgKGRpc3BsYXktYnVmZmVyIGJ1ZmZlcikpCisgICAgICAgIDs7OyBUaGUgdHJpZ2dlciBpbiBg a2V5Ym9hcmQuY2AgaXMgbm90IGFjdGl2YXRlZCBpbiB0aGlzIGV4YW1wbGUsIHNvIHdlCisgICAg ICAgIDs7OyBmb3JjZSB0aGUgbXVsdGlwbGUgY3Vyc29ycyB0byBiZSBkcmF3bi4KKyAgICAgICAg KG1jLWRyYXctZXJhc2UgKHNlbGVjdGVkLXdpbmRvdykpKSkgICovCisKKy8qICAoZGVmdW4gbWMt Y3Vyc29yLW9uICgpCisgICAgIkZvciB0ZXN0aW5nIHB1cnBvc2VzIG9ubHksIGRyYXcgYSBmYWtl IGN1cnNvciBpbW1lZGlhdGVseSBiZWZvcmUgcG9pbnQuCisgICAgUGxlYXNlIHVzZSB0aGUgYG1j LWxpc3QnIGZvciByZWd1bGFyIHVzYWdlIG9mIG11bHRpcGxlIGZha2UgY3Vyc29ycy4iCisgICAg KGludGVyYWN0aXZlKQorICAgICAgKGxldCogKAorICAgICAgICAgICh3aW5kb3cgKHNlbGVjdGVk LXdpbmRvdykpCisgICAgICAgICAgKHBvc24gKHBvc24tYXQtcG9pbnQgKDEtIChwb2ludCkpKSkK KyAgICAgICAgICAobnRoLTIgKG50aCAyIHBvc24pKQorICAgICAgICAgICh4IChjYXIgbnRoLTIp KQorICAgICAgICAgICh5IChjZHIgbnRoLTIpKQorICAgICAgICAgIChudGgtNiAobnRoIDYgcG9z bikpCisgICAgICAgICAgKGhwb3MgKGNhciBudGgtNikpCisgICAgICAgICAgKHZwb3MgKGlmIGhl YWRlci1saW5lLWZvcm1hdAorICAgICAgICAgICAgICAgICAgKDErIChjZHIgbnRoLTYpKQorICAg ICAgICAgICAgICAgICAgKGNkciBudGgtNikpKQorICAgICAgICAgICh4LXktaHBvcy12cG9zIChs aXN0IHggeSBocG9zIHZwb3MpKQorICAgICAgICAgIChjdXJzb3ItdHlwZSAiYm94IikKKyAgICAg ICAgICAoY3Vyc29yLXdpZHRoIDEpCisgICAgICAgICAgKGNvbG9yLXZlY3RvciBbMS4wIDAuMCAx LjBdKSkKKyAgICAgICAgKG1jLWRyYXctZm4gd2luZG93IHgteS1ocG9zLXZwb3MgY3Vyc29yLXR5 cGUgY3Vyc29yLXdpZHRoIGNvbG9yLXZlY3RvcikpKSAgKi8KKworLyogIChkZWZ1biBtYy1jdXJz b3Itb2ZmICgpCisgICAgIkZvciB0ZXN0aW5nIHB1cnBvc2VzIG9ubHksIGVyYXNlIGEgZmFrZSBj dXJzb3IgaW1tZWRpYXRlbHkgYmVmb3JlIHBvaW50LgorICAgIFBsZWFzZSB1c2UgdGhlIGBtYy1s aXN0JyBmb3IgcmVndWxhciB1c2FnZSBvZiBtdWx0aXBsZSBmYWtlIGN1cnNvcnMuIgorICAgIChp bnRlcmFjdGl2ZSkKKyAgICAgIChsZXQqICgKKyAgICAgICAgICAod2luZG93IChzZWxlY3RlZC13 aW5kb3cpKQorICAgICAgICAgIChwb3NuIChwb3NuLWF0LXBvaW50ICgxLSAocG9pbnQpKSkpCisg ICAgICAgICAgKG50aC0yIChudGggMiBwb3NuKSkKKyAgICAgICAgICAoeCAoY2FyIG50aC0yKSkK KyAgICAgICAgICAoeSAoY2RyIG50aC0yKSkKKyAgICAgICAgICAobnRoLTYgKG50aCA2IHBvc24p KQorICAgICAgICAgIChocG9zIChjYXIgbnRoLTYpKQorICAgICAgICAgICh2cG9zIChpZiBoZWFk ZXItbGluZS1mb3JtYXQKKyAgICAgICAgICAgICAgICAgICgxKyAoY2RyIG50aC02KSkKKyAgICAg ICAgICAgICAgICAgIChjZHIgbnRoLTYpKSkKKyAgICAgICAgICAoeC15LWhwb3MtdnBvcyAobGlz dCB4IHkgaHBvcyB2cG9zKSkKKyAgICAgICAgICAoY3Vyc29yLXR5cGUgImJveCIpKQorICAgICAg ICAobWMtZXJhc2UtZm4gd2luZG93IHgteS1ocG9zLXZwb3MgY3Vyc29yLXR5cGUpKSkgICovCisK Ky8qICAoZGVmdW4gbWMteC15LWhwb3MtdnBvcyAoKQorICAgICJBdCB0aGUgY3VycmVudCBwb3Np dGlvbiwgZGVzY3JpYmUgdGhlIGNvb3JkaW5hdGVzIFgsIFksIEhQT1MsIFZQT1M7CisgICAgYW5k LCBkZXNjcmliZSB0aGUgb3ZlcmxheSBwcm9wZXJ0aWVzIFRZUEUsIERJU1BMQVkgYW5kIEFGVEVS LVNUUklORy4iCisgICAgKGludGVyYWN0aXZlKQorICAgICAgKGxldCogKAorICAgICAgICAgIChw b3NpbnQgKHBvaW50KSkKKyAgICAgICAgICAod2luIChzZWxlY3RlZC13aW5kb3cpKQorICAgICAg ICAgIChzdGFydCAod2luZG93LXN0YXJ0IHdpbikpCisgICAgICAgICAgKGVuZCAod2luZG93LWVu ZCB3aW4gdCkpCisgICAgICAgICAgKHJlc3VsdCAobWMteC15LWhwb3MtdnBvcy1mbiB3aW4gcG9z aW50IHN0YXJ0IGVuZCkpKQorICAgICAgICAobWVzc2FnZSAieC95L2hwb3MvdnBvczogICVzIiBy ZXN1bHQpKSkgICovCisKKy8qICAoZGVmdW4gbWMtcHJpbnQtY2FjaGUgKCkKKyAgICAiUHJpbnQg dGhlIGNhY2hlIGZvciBtdWx0aXBsZSBjdXJzb3JzLiIKKyAgICAoaW50ZXJhY3RpdmUpCisgICAg ICAobWVzc2FnZSAiJXMiIChtYy1jYWNoZS1mbikpKSAgKi8KKworLyogIChnbG9iYWwtc2V0LWtl eSBbZjFdICdtYy1jdXJzb3Itb24pCisgICAgKGdsb2JhbC1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 IGZhbHNlOworICBpZiAocG9zaW50ID49IHN0YXJ0CisgICAgICAmJiBwb3NpbnQgPD0gZW5kKQor ICAgIHsKKyAgICAgIG92ZXJsYXlzID0gRm92ZXJsYXlzX2luIChtYWtlX251bWJlciAocG9zaW50 KSwgKG1ha2VfbnVtYmVyIChwb3NpbnQgKyAxKSkpOworICAgICAgaWYgKCFOSUxQIChvdmVybGF5 cykpCisgICAgICAgIHsKKyAgICAgICAgICBmb3IgKG92X2xpc3QgPSBvdmVybGF5czsKKyAgICAg ICAgICAgICAgIENPTlNQIChvdl9saXN0KTsKKyAgICAgICAgICAgICAgIG92X2xpc3QgPSBYQ0RS IChvdl9saXN0KSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgb3YgPSBYQ0FSIChvdl9s aXN0KTsKKyAgICAgICAgICAgICAgb3ZfcXVlcnlfdHlwZSA9IEZvdmVybGF5X2dldCAob3YsIG92 X3R5cGUpOworICAgICAgICAgICAgICBvdl9xdWVyeV9kaXNwbGF5ID0gRm92ZXJsYXlfZ2V0IChv diwgUWRpc3BsYXkpOworICAgICAgICAgICAgICBvdl9xdWVyeV9hZnRlcl9zdHJpbmcgPSBGb3Zl cmxheV9nZXQgKG92LCBRYWZ0ZXJfc3RyaW5nKTsKKyAgICAgICAgICAgICAgaWYgKEVRIChvdl9x dWVyeV90eXBlLCBvdl9jb2xfZW92bCkpCisgICAgICAgICAgICAgICAgb3ZfZm91bmRfdHlwZV9j b2xlb3ZsID0gdHJ1ZTsKKyAgICAgICAgICAgICAgaWYgKEVRIChvdl9xdWVyeV90eXBlLCBvdl9y aWdodF9mcmluZ2UpKQorICAgICAgICAgICAgICAgIG92X2ZvdW5kX3R5cGVfcmlnaHRmcmluZ2Ug PSB0cnVlOworICAgICAgICAgICAgICBpZiAoIU5JTFAgKG92X3F1ZXJ5X2FmdGVyX3N0cmluZykp CisgICAgICAgICAgICAgICAgb3ZfZm91bmRfYWZ0ZXJzdHJpbmcgPSB0cnVlOworICAgICAgICAg ICAgfQorICAgICAgICB9CisgICAgICBTRVRfVEVYVF9QT1NfRlJPTV9NQVJLRVIgKHB0LCB3LT5z dGFydCk7CisgICAgICBzdGFydF9kaXNwbGF5ICgmaXQsIHcsIHB0KTsKKyAgICAgIG1vdmVfaXRf dG8gKCZpdCwgcG9zaW50LCAtMSwgLTEsIC0xLCBNT1ZFX1RPX1BPUyk7CisgICAgICB5ID0gaXQu Y3VycmVudF95OworICAgICAgdnBvcyA9IGl0LnZwb3M7CisgICAgICBpZiAob3ZfZm91bmRfdHlw ZV9jb2xlb3ZsKQorICAgICAgICB7CisgICAgICAgICAgVEVNUF9TRVRfUFRfQk9USCAoQ0hBUlBP UyAoaXQuY3VycmVudC5wb3MpLCBCWVRFUE9TIChpdC5jdXJyZW50LnBvcykpOworICAgICAgICAg IHBlb3ZsX2NvbCA9IGN1cnJlbnRfY29sdW1uICgpIC0gMTsKKyAgICAgICAgICBtb3ZlX2l0X2J5 X2xpbmVzICgmaXQsIC0xKTsKKyAgICAgICAgICBURU1QX1NFVF9QVF9CT1RIIChDSEFSUE9TIChp dC5jdXJyZW50LnBvcyksIEJZVEVQT1MgKGl0LmN1cnJlbnQucG9zKSk7CisgICAgICAgICAgcGJv dmxfY29sID0gY3VycmVudF9jb2x1bW4gKCk7CisgICAgICAgICAgY29sX2VvdmwgPSBwZW92bF9j b2wgLSBwYm92bF9jb2w7CisgICAgICAgICAgeCA9IGNvbF9lb3ZsICogZnJhbWVfY2hhcl93aWR0 aDsKKyAgICAgICAgICBocG9zID0gY29sX2Vvdmw7CisgICAgICAgICAgVEVNUF9TRVRfUFRfQk9U SCAob3BvaW50LCBvYnl0ZXBvcyk7CisgICAgICAgIH0KKyAgICAgICAgLyogU3BlY2lhbCBoYW5k bGluZyBmb3IgYGFmdGVyLXN0cmluZycgYW5kIGVvYiBzaXR1YXRpb25zLiAgKi8KKyAgICAgICAg ZWxzZSBpZiAob3ZfZm91bmRfYWZ0ZXJzdHJpbmcKKyAgICAgICAgICAgICAgICAgfHwgRkVUQ0hf QllURSAoSVRfQllURVBPUyAoaXQpKSA9PSAnXG4nCisgICAgICAgICAgICAgICAgIHx8IHBvc2lu dCA9PSBaVikKKyAgICAgICAgICB7CisgICAgICAgICAgICBURU1QX1NFVF9QVF9CT1RIIChDSEFS UE9TIChpdC5jdXJyZW50LnBvcyksIEJZVEVQT1MgKGl0LmN1cnJlbnQucG9zKSk7CisgICAgICAg ICAgICBwZW92bF9jb2wgPSBjdXJyZW50X2NvbHVtbiAoKTsKKyAgICAgICAgICAgIC8qIERWUE9T ID09IDAgbWVhbnMgbW92ZSB0byB0aGUgc3RhcnQgb2YgdGhlIHNjcmVlbiBsaW5lLiAgKi8KKyAg ICAgICAgICAgIG1vdmVfaXRfYnlfbGluZXMgKCZpdCwgMCk7CisgICAgICAgICAgICBURU1QX1NF VF9QVF9CT1RIIChDSEFSUE9TIChpdC5jdXJyZW50LnBvcyksIEJZVEVQT1MgKGl0LmN1cnJlbnQu cG9zKSk7CisgICAgICAgICAgICBwYm92bF9jb2wgPSBjdXJyZW50X2NvbHVtbiAoKTsKKyAgICAg ICAgICAgIGNvbF9lb3ZsID0gcGVvdmxfY29sIC0gcGJvdmxfY29sOworICAgICAgICAgICAgeCA9 IGNvbF9lb3ZsICogZnJhbWVfY2hhcl93aWR0aDsKKyAgICAgICAgICAgIGhwb3MgPSBjb2xfZW92 bDsKKyAgICAgICAgICAgIFRFTVBfU0VUX1BUX0JPVEggKG9wb2ludCwgb2J5dGVwb3MpOworICAg ICAgICAgIH0KKyAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIHgg PSBpdC5jdXJyZW50X3g7CisgICAgICAgICAgICAgIGhwb3MgPSBpdC5ocG9zOworICAgICAgICAg ICAgfQorICAgICAgYmlkaV91bnNoZWx2ZV9jYWNoZSAoaXRkYXRhLCBmYWxzZSk7CisgICAgfQor ICAgIC8qIGBtY194X3lfaHBvc192cG9zJyBzZXRzIGFsbCBvZiB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vcl94OworICAgICAgdy0+cGh5c19jdXJzb3IueSA9IHByaW9y X3k7CisgICAgfQorfQorCitpbnQKK21jX2xpc3BfdG9fY3Vyc29yX3R5cGUgKExpc3BfT2JqZWN0 IGFyZykKK3sKKyAgY2hhciAqc3RyOworICBpZiAoWFRZUEUgKGFyZykgPT0gTGlzcF9TdHJpbmcp CisgICAgc3RyID0gU1NEQVRBIChhcmcpOworICBlbHNlIGlmIChYVFlQRSAoYXJnKSA9PSBMaXNw X1N5bWJvbCkKKyAgICBzdHIgPSBTU0RBVEEgKFNZTUJPTF9OQU1FIChhcmcpKTsKKyAgZWxzZSBy ZXR1cm4gLTE7CisgIGlmICghc3RyY21wIChzdHIsICJib3giKSkKKyAgICByZXR1cm4gRklMTEVE X0JPWF9DVVJTT1I7CisgIGlmICghc3RyY21wIChzdHIsICJob2xsb3ciKSkKKyAgICByZXR1cm4g SE9MTE9XX0JPWF9DVVJTT1I7CisgIGlmICghc3RyY21wIChzdHIsICJoYmFyIikpCisgICAgcmV0 dXJuIEhCQVJfQ1VSU09SOworICBpZiAoIXN0cmNtcCAoc3RyLCAiYmFyIikpCisgICAgcmV0dXJu IEJBUl9DVVJTT1I7CisgIGlmICghc3RyY21wIChzdHIsICJubyIpKQorICAgIHJldHVybiBOT19D VVJTT1I7CisgIHJldHVybiAtMTsKK30KKworLyogSWYgUkVNT1ZFIGlzIDAsIHRoZW4gZHJhdyBm YWtlIGN1cnNvcnMuICBJZiBSRU1PVkUgaXMgMSwgdGhlbiBlcmFzZSBmYWtlIGN1cnNvcnMuICAq Lwordm9pZAorbWNfY2FsYyAoc3RydWN0IHdpbmRvdyAqdywgYm9vbCByZW1vdmUpCit7CisgIGlu dCB3aW5kb3dfdG90YWxfaGVpZ2h0ID0gd2luZG93X2JveF9oZWlnaHQgKHcpOworICBMaXNwX09i amVjdCBmcmFtZTsKKyAgRU1BQ1NfSU5UIGZyYW1lX2NoYXJfd2lkdGgsIGZyYW1lX2NoYXJfaGVp Z2h0LCB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UiAody0+bWNfY2FjaGUpKTsKKyAgICAg ICAgICAgQ09OU1AgKHZsaXN0KTsKKyAgICAgICAgICAgdmxpc3QgPSBYQ0RSICh2bGlzdCkpCisg ICAgICAgIHsKKyAgICAgICAgICBjdXJzb3Jfc3BlY19saXN0ID0gWENBUiAoWENBUiAodmxpc3Qp KTsKKyAgICAgICAgICBjdXJzb3Jfc3BlY190eXBlID0gRm50aCAobWFrZV9udW1iZXIgKDEpLCBj dXJzb3Jfc3BlY19saXN0KTsKKyAgICAgICAgICBpZiAoQ09OU1AgKGN1cnNvcl9zcGVjX3R5cGUp KQorICAgICAgICAgICAgY3Vyc29yX3R5cGUgPSBtY19saXNwX3RvX2N1cnNvcl90eXBlIChYQ0FS IChjdXJzb3Jfc3BlY190eXBlKSk7CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgIGN1 cnNvcl90eXBlID0gbWNfbGlzcF90b19jdXJzb3JfdHlwZSAoY3Vyc29yX3NwZWNfdHlwZSk7Cisg ICAgICAgICAgLyogYG1jX3hfeV9ocG9zX3Zwb3MnIHNldHMgYWxsIG9mIHRoZSBjb29yZGluYXRl cyB0byAtMSBpZiBQT1NJTlQgaXMgb3V0IG9mIGJvdW5kcy4KKyAgICAgICAgICAgICBAbGF3bGlz dCBoYXMgYWRkZWQgY29uZGl0aW9ucyB0byBgbWNfZXJhc2UnIHRoYXQgcmVxdWlyZSB0aGUgY29v cmRpbmF0ZXMgdG8gYmUgZ3JlYXRlciB0aGFuIG9yIGVxdWFsIHRvIDAuICAqLworICAgICAgICAg IHhfeV9ocG9zX3Zwb3MgPSBYQ0FSIChYQ0RSIChYQ0FSICh2bGlzdCkpKTsKKyAgICAgICAgICB4 ID0gWElOVCAoRm50aCAobWFrZV9udW1iZXIgKDApLCB4X3lfaHBvc192cG9zKSk7CisgICAgICAg ICAgeSA9IFhJTlQgKEZudGggKG1ha2VfbnVtYmVyICgxKSwgeF95X2hwb3NfdnBvcykpOworICAg ICAgICAgIGhwb3MgPSBYSU5UIChGbnRoIChtYWtlX251bWJlciAoMiksIHhfeV9ocG9zX3Zwb3Mp KTsKKyAgICAgICAgICB2cG9zID0gWElOVCAoRm50aCAobWFrZV9udW1iZXIgKDMpLCB4X3lfaHBv c192cG9zKSk7CisgICAgICAgICAgaWYgKHdpbmRvd19oZWFkZXJfbGluZV9oZWlnaHQgPiAwKQor ICAgICAgICAgICAgdnBvcyA9IHZwb3MgKyAxOworICAgICAgICAgIC8qIGBtY194X3lfaHBvc192 cG9zJyBzZXRzIGFsbCBvZiB0aGUgY29vcmRpbmF0ZXMgdG8gLTEgaWYgUE9TSU5UIGlzIG91dCBv ZiBib3VuZHMuCisgICAgICAgICAgICAgQGxhd2xpc3QgaGFzIGFkZGVkIGNvbmRpdGlvbnMgdG8g YG1jX2VyYXNlJyB0aGF0IHJlcXVpcmUgdGhlIGNvb3JkaW5hdGVzIHRvIGJlIGdyZWF0ZXIgdGhh biBvciBlcXVhbCB0byAwLgorICAgICAgICAgICAgIEFic2VudCB0aGVzZSBjb25kaXRpb25zLCBF bWFjcyBjcmFzaGVzIGFuZCBkZWJ1Z2dpbmcgdG8gZmluZCB0aGUgY3VscHJpdCBpcyBleHRyZW1l bHkgZWx1c2l2ZS4gICovCisgICAgICAgICAgaWYgKHggPj0gMAorICAgICAgICAgICAgICAmJiB5 ID49IDAKKyAgICAgICAgICAgICAgJiYgaHBvcyA+PSAwCisgICAgICAgICAgICAgICYmIHZwb3Mg Pj0gMCkKKyAgICAgICAgICAgIG1jX2VyYXNlICh3LCB4LCB5LCBocG9zLCB2cG9zLCBjdXJzb3Jf dHlwZSk7CisgICAgICAgIH0KKyAgICAgIGlmIChOSUxQIChCVkFSIChiLCBtY19saXN0KSkpCisg ICAgICAgIHdzZXRfbWNfY2FjaGUgKHcsIFFuaWwpOworICAgICAgdy0+bWMuZXJhc2UgPSBmYWxz ZTsKKyAgICB9CisgIC8qIElmIHRoZSBmaXJzdCBlbGVtZW50IG9mIHctPm1jX2NhY2hlIGlzIHRo ZSBzYW1lIGFzIHRoZSBsb2NhbCB2YXJpYWJsZSBtY19saXN0LAorICAgICBhbmQgdGhlIHByZXZp b3VzL2N1cnJlbnQgd2luZG93LXN0YXJ0L3dpbmRvdy1lbmQgYXJlIHRoZSBzYW1lIChlLmcuLCBu byBzY3JvbGxpbmcpLAorICAgICB0aGVuIHJlZHJhdyB0aGUgY3Vyc29ycyB1c2luZyB0aGUgY2Fj aGUuICBUaGlzIGF2b2lkcyByZWNhbGN1bGF0aW5nIGNvb3JkaW5hdGVzLiAqLworICBpZiAoIXJl bW92ZQorICAgICAgJiYgdyA9PSBzdworICAgICAgJiYgdy0+bWMuc3RhcnQKKyAgICAgICYmIHct Pm1jLmVuZAorICAgICAgJiYgdy0+bWMucHJldl9zdGFydAorICAgICAgJiYgdy0+bWMucHJldl9l bmQKKyAgICAgICYmIHctPm1jLnN0YXJ0ID09IHctPm1jLnByZXZfc3RhcnQKKyAgICAgICYmIHct Pm1jLmVuZCA9PSB3LT5tYy5wcmV2X2VuZAorICAgICAgJiYgIU5JTFAgKEJWQVIgKGIsIG1jX2xp c3QpKQorICAgICAgJiYgIU5JTFAgKHctPm1jX2NhY2hlKQorICAgICAgJiYgIU5JTFAgKEZlcXVh bCAoRm50aCAobWFrZV9udW1iZXIgKDApLCB3LT5tY19jYWNoZSksIEJWQVIgKGIsIG1jX2xpc3Qp KSkpCisgICAgeworI2lmZGVmIEdMWVBIX0RFQlVHCisgIGRlYnVnX21ldGhvZF9hZGQgKHcsICJt Y19jYWxjOiAgZHJhdyBjdXJzb3JzIHVzaW5nIGNhY2hlIHwgd2luZG93LWhlaWdodCAoJWQpIiwg d2luZG93X3RvdGFsX2hlaWdodCk7CisjZW5kaWYKKyAgICAgIGZvciAodmxpc3QgPSBYQ0FSIChY Q0RSICh3LT5tY19jYWNoZSkpOworICAgICAgICAgICBDT05TUCAodmxpc3QpOworICAgICAgICAg ICB2bGlzdCA9IFhDRFIgKHZsaXN0KSkKKyAgICAgICAg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AgICAgICAgICBncmVlbiA9IFhGTE9BVF9EQVRBIChBUkVGIChjdXJzb3JfY29s b3JfdmVjdG9yLCAxKSk7CisgICAgICAgICAgYmx1ZSA9IFhGTE9BVF9EQVRBIChBUkVGIChjdXJz b3JfY29sb3JfdmVjdG9yLCAyKSk7CisgICAgICAgICAgeF95X2hwb3NfdnBvcyA9IFhDQVIgKFhD RFIgKFhDQVIgKHZsaXN0KSkpOworICAgICAgICAgIHggPSBYSU5UIChGbnRoIChtYWtlX251bWJl ciAoMCksIHhfeV9ocG9zX3Zwb3MpKTsKKyAgICAgICAgICB5ID0gWElOVCAoRm50aCAobWFrZV9u dW1iZXIgKDEpLCB4X3lfaHBvc192cG9zKSk7CisgICAgICAgICAgaHBvcyA9IFhJTlQgKEZudGgg KG1ha2VfbnVtYmVyICgyKSwgeF95X2hwb3NfdnBvcykpOworICAgICAgICAgIHZwb3MgPSBYSU5U IChGbnRoIChtYWtlX251bWJlciAoMyksIHhfeV9ocG9zX3Zwb3MpKTsKKyAgICAgICAgICAvKiBQ cm92aWRlZCB0aGF0IFBPU0lOVCBpcyB3aXRoaW4gYm91bmRzLCB0aGUgY29vcmRpbmF0ZXMgWCwg WSwgSFBPUywgVlBPUworICAgICAgICAgIGBzaG91bGRgIGFsbCBiZSBncmVhdGVyIHRoYW4gb3Ig ZXF1YWwgdG8gMC4gICovCisgICAgICAgICAgaWYgKHctPm1jLnN0YXJ0CisgICAgICAgICAgICAg ICYmIHctPm1jLmVuZAorICAgICAgICAgICAgICAmJiBwb3NpbnQgPj0gdy0+bWMuc3RhcnQKKyAg ICAgICAgICAgICAgJiYgcG9zaW50IDw9IHctPm1jLmVuZCkKKyAgICAgICAgICAgIHsKKyAgICAg ICAgICAgICAgaWYgKHdpbmRvd19oZWFkZXJfbGluZV9oZWlnaHQgPiAwKQorICAgICAgICAgICAg ICAgIHZwb3MgPSB2cG9zICsgMTsKKyAgICAgICAgICAgICAgbWNfZHJhdyAodywgeCwgeSwgaHBv cywgdn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SICh2bGlzdCkpCisgICAgICAgICAgewor ICAgICAgICAgICAgY3Vyc29yX3NwZWNfbGlzdCA9IFhDQVIgKHZsaXN0KTsKKyAgICAgICAgICAg IHBvc2ludCA9IFhJTlQgKEZudGggKG1ha2VfbnVtYmVyICgwKSwgY3Vyc29yX3NwZWNfbGlzdCkp OworICAgICAgICAgICAgY3Vyc29yX3NwZWNfdHlwZSA9IEZudGggKG1ha2VfbnVtYmVyICgxKSwg Y3Vyc29yX3NwZWNfbGlzdCk7CisgICAgICAgICAgICBpZiAoQ09OU1AgKGN1cnNvcl9zcGVjX3R5 cGUpKQorICAgICAgICAgICAgICBjdXJzb3JfdHlwZSA9IG1jX2xpc3BfdG9fY3Vyc29yX3R5cGUg KFhDQVIgKGN1cnNvcl9zcGVjX3R5cGUpKTsKKyAgICAgICAgICAgICAgZWxzZQorICAgICAgICAg ICAgICAgIGN1cnNvcl90eXBlID0gbWNfbGlzcF90b19jdXJzb3JfdHlwZSAoY3Vyc29yX3NwZWNf dHlwZSk7CisgICAgICAgICAgICBpZiAoQ09OU1AgKGN1cnNvcl9zcGVjX3R5cGUpKQorICAgICAg ICAgICAgICBjdXJzb3Jfd2lkdGggPSBYSU5UIChYQ0FSIChYQ0RSIChjdXJzb3Jfc3BlY190eXBl KSkpOworICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgY3Vyc29yX3dpZHRoID0g MTsKKyAgICAgICAgICAgIGN1cnNvcl9jb2xvcl92ZWN0b3IgPSBGbnRoIChtYWtlX251bWJlciAo MiksIGN1cnNvcl9zcGVjX2xpc3QpOworICAgICAgICAgICAgaWYgKFNUUklOR1AgKGN1cnNvcl9j b2xvcl92ZWN0b3IpKQorICAgICAgICAgICAgICBjdXJzb3JfY29sb3JfdmVjdG9yID0gbWNfY29s b3JfdmVjdG9yX2NhbGN1bGF0ZSAodywgY3Vyc29yX2NvbG9yX3ZlY3Rvcik7CisgICAgICAgICAg ICByZWQgPSBYRkxPQVRfREFUQSAoQVJFRiAoY3Vyc29yX2NvbG9yX3ZlY3RvciwgMCkpOworICAg ICAgICAgICAgZ3JlZW4gPSBYRkxPQVRfREFUQSAoQVJFRiAoY3Vyc29yX2NvbG9yX3ZlY3Rvciwg MSkpOworICAgICAgICAgICAgYmx1ZSA9IFhGTE9BVF9EQVRBIChBUkVGIChjdXJzb3JfY29sb3Jf dmVjdG9yLCAyKSk7CisgICAgICAgICAgICB4X3lfaHBvc192cG9zID0gRm50aCAobWFrZV9udW1i ZXIgKDApLCBtY194X3lfaHBvc192cG9zICh3LCBwb3NpbnQsIHctPm1jLnN0YXJ0LCB3LT5tYy5l bmQpKTsKKyAgICAgICAgICAgIHRlbXAgPSBGY29ucyAoY3Vyc29yX3NwZWNfbGlzdCwgRmNvbnMg KHhfeV9ocG9zX3Zwb3MsIFFuaWwpKTsKKyAgICAgICAgICAgIHJlc3VsdCA9IEZjb25zICh0ZW1w LCByZXN1bHQpOworICAgICAgICAgICAgeCA9IFhJTlQgKEZudGggKG1ha2VfbnVtYmVyICgwKSwg eF95X2hwb3NfdnBvcykpOworICAgICAgICAgICAgeSA9IFhJTlQgKEZudGggKG1ha2VfbnVtYmVy ICgxKSwgeF95X2hwb3NfdnBvcykpOworICAgICAgICAgICAgaHBvcyA9IFhJTlQgKEZudGggKG1h a2VfbnVtYmVyICgyKSwgeF95X2hwb3NfdnBvcykpOworICAgICAgICAgICAgdnBvcyA9IFhJTlQg KEZudGggKG1ha2VfbnVtYmVyICgzKSwgeF95X2hwb3NfdnBvcykpOworICAgICAgICAgICAgLyog UHJvdmlkZWQgdGhhdCBQT1NJTlQgaXMgd2l0aGluIGJvdW5kcywgdGhlIGNvb3JkaW5hdGVzIFgs IFksIEhQT1MsIFZQT1MKKyAgICAgICAgICAgIGBzaG91bGRgIGFsbCBiZSBncmVhdGVyIHRoYW4g b3IgZXF1YWwgdG8gMC4gICovCisgICAgICAgICAgICBpZiAody0+bWMuc3RhcnQKKyAgICAgICAg ICAgICAgICAmJiB3LT5tYy5lbmQKKyAgICAgICAgICAgICAgICAmJiBwb3NpbnQgPj0gdy0+bWMu c3RhcnQKKyAgICAgICAgICAgICAgICAmJiBwb3NpbnQgPD0gdy0+bWMuZW5kKQorICAgICAgICAg ICAgICB7CisgICAgICAgICAgICAgICAgaWYgKHdpbmRvd19oZWFkZXJfbGluZV9oZWlnaHQgPiAw KQorICAgICAgICAgICAgICAgICAgdnBvcyA9IHZwb3MgKyAxOworICAgICAgICAgICAgICAgIG1j X2RyYXcgKHcsIHgsIHksIGhwb3MsIHZwb3MsIGN1cnNvcl90eXBlLCBjdXJzb3Jfd2lkdGgsIHJl ZCwgZ3JlZW4sIGJsdWUpOworICAgICAgICAgICAgICB9CisgICAgICAgICAgfQorLyogYHctPm1j X2NhY2hlJyBpcyBzZXQgZm9yIHRoZSB3aW5kb3csIG5vdCBidWZmZXIrd2luZG93IC0tIGkuZS4s IGFsbCBidWZmZXJzIGFwcGVhcmluZworaW4gdGhlIHNhbWUgd2luZG93IHZpYSBgc3dpdGNoLXRv LWJ1ZmZlcicgd2lsbCBoYXZlIGB3LT5tY19jYWNoZScuICBUaGlzIGJlaGF2aW9yCitpcyBjb25z aXN0ZW50IHdpdGggZnVuY3Rpb25zIHN1Y2ggYXMgYHNldC13aW5kb3ctZGlzcGxheS10YWJsZScu ICBXZSBkZWFsIHdpdGggdGhpcyBpbgorYG5zdGVybS5tJyAvIGB3MzJ0ZXJtLmMnIC8gYHh0ZXJt LmMnIGJ5IGNvbXBhcmluZyBgdy0+Y29udGVudHMnIHRvIHRoZSB2YWx1ZSBvZiB0aGUgYGJ1ZicK K3N0b3JlZCBpbiBgdy0+bWNfY2FjaGUnOiAgKEVRICh3LT5jb250ZW50cywgWENBUiAoRm50aCAo bWFrZV9udW1iZXIgKDIpLCB3LT5tY19jYWNoZSkpKSkgICovCisgICAgICAgIGlmICghTklMUCAo cmVzdWx0KSkKKyAgICAgICAgICB3c2V0X21jX2NhY2hlICh3LCBsaXN0biAoQ09OU1RZUEVf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s7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7 Ozs7Ozs7OzsgKi8KKy8qIEJFR0lOIG11bHRpcGxlIGN1cnNvcnMgKi8KKworICAgICAgaWYgKHct Pm1jLmVyYXNlCisgICAgICAgICAgJiYgIU1JTklfV0lORE9XX1AgKHcpCisgICAgICAgICAgJiYg KCFOSUxQICh3LT5tY19jYWNoZSkgJiYgKEVRICh3LT5jb250ZW50cywgWENBUiAoRm50aCAobWFr ZV9udW1iZXIgKDIpLCB3LT5tY19jYWNoZSkpKSkpKQorICAgICAgICBtY19jYWxjICh3LCAxKTsK KworICAgICAgaWYgKHctPm1jLmRyYXcKKyAgICAgICAgICAmJiAhTUlOSV9XSU5ET1dfUCAodykK KyAgICAgICAgICAmJiAhTklMUCAoQlZBUiAoWEJVRkZFUiAody0+Y29udGVudHMpLCBtY19saXN0 KSkpCisgICAgICAgIC8qIERyYXcgZmFrZSBjdXJzb3JzICAqLworICAgICAgICBtY19jYWxjICh3 LCAwKTsKKyAgICAgICAgLyogRmlyc3QgYXR0ZW1wdCBhdCBkZWFsaW5nIHdpdGggYSBgcmVkaXNw bGF5X3ByZXNlcnZlX2VjaG9fYXJlYScgc2l0dWF0aW9uLiAgKi8KKyAgICAgICAgZWxzZSBpZiAo IXctPm1jLmRyYXcKKyAgICAgICAgICAgICAgICAgJiYgIU5JTFAgKEJWQVIgKFhCVUZGRVIgKHct PmNvbnRlbnRzKSwgbWNfbGlzdCkpCisgICAgICAgICAgICAgICAgICYmICFOSUxQICh3LT5tY19j YWNoZSkKKyAgICAgICAgICAgICAgICAgJiYgKEVRICh3LT5jb250ZW50cywgWENBUiAoRm50aCAo bWFrZV9udW1iZXIgKDIpLCB3LT5tY19jYWNoZSkpKSkKKyAgICAgICAgICAgICAgICAgJiYgIU1J TklfV0lORE9XX1AgKHcpKQorICAgICAgICAgIHsKKyAgICAgICAgICAgI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A9IG9yaWdfdmFsOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgICB4 X2RyYXdfaG9sbG93X2N1cnNvciAodywgZ2x5cGhfcm93KTsKKyAgICAgIGJyZWFrOworICAgIH0K KyAgICBjYXNlIEZJTExFRF9CT1hfQ1VSU09SOgorICAgIHsKKyAgICAgICAvKiBUT0RPOiAga2Ri IHRvIGNvbnNpZGVyIGFkZGluZyBzdXBwb3J0IGZvciBtdWx0aXBsZSBjdXJzb3IgZm9yZWdyb3Vu ZAorICAgICAgIGN1c3RvbWl6YXRpb24gb2YgYSBGSUxMRURfQk9YX0NVUlNPUi4gICovCisgICAg ICBpZiAocmVkID49IDAgJiYgYmx1ZSA+PSAwICYmIGdyZWVuID49IDApCisgICAgICAgIC8qIFRl bXBvcmFyaWx5IGhpamFjayBgZi0+b3V0cHV0X2RhdGEueC0+Y3Vyc29yX2djJyBieSBib3Jyb3dp bmcgdGhlCisgICAgICAgIGZ1bmN0aW9uYWxpdHkgb2YgYHhfbWFrZV9nYycgaW4geGZucy5jLiAg Ki8KKyAgICAgICAgeworICAgICAgICAgIGJsb2NrX2lucHV0ICgpOworICAgICAgICAgIExpc3Bf T2JqZWN0IHdpbmRvdyA9IChzZWxlY3RlZF93aW5kb3cpOworICAgICAgICAgIHN0cnVjdCB3aW5k b3cgKncgPSBkZWNvZGVfbGl2ZV93aW5kb3cgKHdpbmRvdyk7CisgICAgICAgICAgc3RydWN0IGZy YW1lICpmID0gWEZSQU1FIChXSU5ET1dfRlJBTUUgKHcpKTsKKyAgICAgICAgICBzdHJ1Y3QgeF9k aXNwbGF5X2luZm8gKmRweWluZm8gPSBGUkFNRV9ESVNQTEFZX0lORk8gKGYpOworICAgICAgICAg IGludCBpbnRfcmVkID0gcmVkICogNjU1MzU7CisgICAgICAgICAgaW50IGludF9ncmVlbiA9IGdy ZWVuICogNjU1MzU7CisgICAgICAgICAgaW50IGludF9ibHVlID0gYmx1ZSAqIDY1NTM1OworICAg ICAgICA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IHRydWU7CisgICAgICAgICAgZHJhd19waHlz X2N1cnNvcl9nbHlwaCAodywgZ2x5cGhfcm93LCBEUkFXX0NVUlNPUik7CisgICAgICAgICAgdy0+ bWMuc2V0X2N1cnNvcl9nYyA9IGZhbHNlOworICAgICAgICAgIGdjX3ZhbHVlcy5saW5lX3dpZHRo ID0gMDsgIC8qIE1lYW5zIDEgdXNpbmcgZmFzdCBhbGdvcml0aG0uICAqLworICAgICAgICAgIGdj X3ZhbHVlcy5mb3JlZ3JvdW5kID0gb3JpZ192YWxfYTsKKyAgICAgICAgICBnY192YWx1ZXMuYmFj a2dyb3VuZCA9IG9yaWdfdmFsX2I7CisgICAgICAgICAgZ2NfdmFsdWVzLmZpbGxfc3R5bGUgPSBG aWxsT3BhcXVlU3RpcHBsZWQ7CisgICAgICAgICAgZi0+b3V0cHV0X2RhdGEueC0+Y3Vyc29yX2dj CisgICAgICAgICAgICA9IFhDcmVhdGVHQyAoRlJBTUVfWF9ESVNQTEFZIChmKSwgRlJBTUVfWF9X SU5ET1cgKGYpLCBtYXNrLCAmZ2NfdmFsdWVzKTsKKyAgICAgICAgICB1bmJsb2NrX2lucHV0ICgp OworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgICBkcmF3X3BoeXNfY3Vyc29yX2ds eXBoICh3LCBnbHlwaF9yb3csIERSQVdfQ1VSU09SKTsKKyAgICAgIGJyZWFrOworICAgIH0KKyAg ICBjYXNlIEJBUl9DVVJTT1I6CisgICAgeworICAgICAgaWYgKHJlZCA+PSAwICYmIGJsdWUgPj0g MCAmJiBncmVlbiA+PSAwKQorICAgICAgICAvKiBUZW1wb3JhcmlseSBoaWphY2sgYGYtPm91dHB1 dF9kYXRhLngtPmN1cnNvcl9waXhlbCcuICAqLworICAgICAgICB7CisgICAgICAgICAgc3RydWN0 IGZyYW1lICpmID0gWEZSQU1FIChXSU5ET1dfRlJBTUUgKHcpKTsKKyAgICAgICAgICBzdHJ1Y3Qg eF9kaXNwbGF5X2lu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