From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.bugs Subject: bug#22873: 25.1.50; Feature Request -- Multiple Cursors (built-in support) Date: Tue, 01 Mar 2016 10:44:58 -0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by - "") Content-Type: multipart/mixed; boundary="Multipart_Tue_Mar__1_10:44:58_2016-1" X-Trace: ger.gmane.org 1456857984 24989 80.91.229.3 (1 Mar 2016 18:46:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Mar 2016 18:46:24 +0000 (UTC) To: 22873@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 01 19:46:13 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aapJC-00014w-Vt for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Mar 2016 19:46:11 +0100 Original-Received: from localhost ([::1]:51734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aapJC-0005LX-9R for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Mar 2016 13:46:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aapJ7-0005KI-7N for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2016 13:46:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aapJ4-00022n-Eg for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2016 13:46:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59555) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aapJ4-00022i-9W for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2016 13:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aapJ4-00039d-2K for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2016 13:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Keith David Bershatsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Mar 2016 18:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22873 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.145685791711961 (code B ref -1); Tue, 01 Mar 2016 18:46:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Mar 2016 18:45:17 +0000 Original-Received: from localhost ([127.0.0.1]:56682 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aapIL-00036q-0e for submit@debbugs.gnu.org; Tue, 01 Mar 2016 13:45:17 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54806) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aapIJ-00036O-Aa for submit@debbugs.gnu.org; Tue, 01 Mar 2016 13:45:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aapIC-0001w9-Rr for submit@debbugs.gnu.org; Tue, 01 Mar 2016 13:45:10 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aapIC-0001w4-OL for submit@debbugs.gnu.org; Tue, 01 Mar 2016 13:45:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aapIB-0005B6-GS for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2016 13:45:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aapI8-0001qr-4A for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2016 13:45:07 -0500 Original-Received: from cobb.liquidweb.com ([50.28.13.150]:33699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aapI7-0001pt-Nz for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2016 13:45:04 -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:To:From:Message-ID:Date; bh=Jc/2enNwnD+aKCt/JWi3djBpKqal2B+Ox+5o/lfi74A=; b=2uC6hWwzS8Gq0c3HPOPNa0S6Kl3FDN7u0yeraxvYObp6k3BrUtp4TZLJBViUVSuBaMNZTgnViDAo6RfiCI0UKfX8lxLOgmYjfFsJF4XF5TegEBR76GknoZKDRDGoTt7A; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:52000 helo=server.private.localhost) by cobb.liquidweb.com with esmtp (Exim 4.82) (envelope-from ) id 1aapI1-0005T6-9c for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2016 13:44:57 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cobb.liquidweb.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-Get-Message-Sender-Via: cobb.liquidweb.com: acl_c_relayhosts_text_entry: lawlist|lawlist.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:114271 Archived-At: --Multipart_Tue_Mar__1_10:44:58_2016-1 Content-Type: text/plain; charset=US-ASCII As a feature request, it would be appreciated if the Emacs development team could please consider adding built-in support for multiple cursors similar to the Lisp library that Magnar Sveen has written: https://github.com/magnars [Out of the box, Emacs does not presently support a left vertical bar fake cursor overlay.] The multiple cursors API should please be made available to the user so that fake cursors of any style can be drawn anywhere on the visible window. [Available styles include those defined in the variable `cursor-type'.] The API available to the user should support standard points for positions, instead of x/y/vpos/hpos. In other words, the API should make it easy for the user to specifying a list of points -- e.g., '(5 6 7 8 9 10). In that scenario, fake cursors would be drawn at positions 5, 6, 7, 8, 9 and 10. Perhaps a cons cell with the `cursor-type' for each specified point would be appropriate -- that way a user would not be limited to the buffer-local or default cursor style for all fake cursors. This feature request has the added benefit that the user can create a vertical line the entire length of the screen by using multiple fake bar cursors in addition to a stretch space glyph and an XPM image that is thin (e.g., one pixel wide) with a pixel height equal to the line height at any location where no character exists -- e.g., overlays using the 'after-string property. An example would be the fill-column-indicator library written by Alp Aker: https://github.com/alpaker/Fill-Column-Indicator In the context of the fill-column-indicator example, a user can draw a vertical line that extends through the left side of each character to form a solid line the entire length of the window from top to bottom. In my own personal setup, I would be drawing a solid vertical line that tracks the cursor position -- the line would run through the left side of any character along that resides on vertical column. The following draft proof concept patch contains a variety of things including a sample of this particular feature request for multiple cursors. The example has been tested on Emacs master branch for OSX and Windows operating systems. On OSX the fake cursors draw immediately, but on Windows it is necessary to press any key after calling `multiple-cursors-test' for the fake cursors to appear. The fake cursors are designed to disappear during the next command loop. The internal function `move_it_to' provides for a conveniently quick method to convert PT to the necessary x/y/vpos/hpos. NOTE: `posn-at-point` is painfully slow to obtain x/y/vpos/hpos -- so we certainly want to avoid using that function when converting the list of PT for fake cursors each command loop. The following test function called `multiple-cursors-test` works with the proof concept draft patch attached below, which admittedly needs a lot more work. I tested using the bar `cursor-type'. (defun multiple-cursors-test (&optional list) "Draw fake cursors at all POS defined in the `multiple-cursor-list'. The list contains integers representing the various positions. The default list is for positions 5, 6, 7, 8, 9 and 10." (interactive) (setq cursor-type 'bar) (setq multiple-cursors-list (if list list (list 5 6 7 8 9 10)))) (global-set-key [f1] 'multiple-cursors-test) --Multipart_Tue_Mar__1_10:44:58_2016-1 Content-Type: application/diff; type=patch Content-Disposition: attachment; filename="multiple_cursors.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy9idWZmZXIuYyBiL3NyYy9idWZmZXIuYwppbmRleCA5OGI2MWMzLi5k NWEyZmMwIDEwMDY0NAotLS0gYS9zcmMvYnVmZmVyLmMKKysrIGIvc3JjL2J1ZmZlci5jCkBAIC01 MDczLDYgKzUwNzMsMTAgQEAgaW5pdF9idWZmZXJfb25jZSAodm9pZCkKICAgWFNFVEZBU1RJTlQg KEJWQVIgKCZidWZmZXJfbG9jYWxfZmxhZ3MsIGRpc3BsYXlfdGFibGUpLCBpZHgpOyArK2lkeDsK ICAgWFNFVEZBU1RJTlQgKEJWQVIgKCZidWZmZXJfbG9jYWxfZmxhZ3MsIHN5bnRheF90YWJsZSks IGlkeCk7ICsraWR4OwogICBYU0VURkFTVElOVCAoQlZBUiAoJmJ1ZmZlcl9sb2NhbF9mbGFncywg Y2FjaGVfbG9uZ19zY2FucyksIGlkeCk7ICsraWR4OworICBYU0VURkFTVElOVCAoQlZBUiAoJmJ1 ZmZlcl9sb2NhbF9mbGFncywgcG9zbl9saXN0KSwgaWR4KTsgKytpZHg7CisgIFhTRVRGQVNUSU5U IChCVkFSICgmYnVmZmVyX2xvY2FsX2ZsYWdzLCB3aW5kb3dfc3RhcnRfZW5kX2hvb2spLCBp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93KTsKKyAgTGlzcF9PYmplY3QgYnVmOworICBzdHJ1Y3Qg YnVmZmVyICpiOworICBidWYgPSB3LT5jb250ZW50czsKKyAgQ0hFQ0tfQlVGRkVSIChidWYpOwor ICBiID0gWEJVRkZFUiAoYnVmKTsKKyAgc3RydWN0IGJ1ZmZlciAqb2xkX2J1ZmZlciA9IE5VTEw7 CisgIHZvaWQgKml0ZGF0YSA9IE5VTEw7CisgIGJvb2wgZnVsbHlfcCA9IGZhbHNlOworICBFTUFD U19JTlQgcG9zaW50ID0gUFQ7CisgIGludCB4LCB5LCBydG9wLCByYm90LCByb3doLCB2cG9zLCBz dGFydHBfaW50ZWdlciwgZW5kcCwgcGJvbF9zdGFydHAsIHBlb2xfZW5kcDsKKyAgc3RhcnRwX2lu dGVnZXIgPSBDSEFSUE9TIChzdGFydHApOworICBpZiAoYiAhPSBjdXJyZW50X2J1ZmZlcikKKyAg ICB7CisgICAgICBvbGRfYnVmZmVyID0gY3VycmVudF9idWZmZXI7CisgICAgICBzZXRfYnVmZmVy X2ludGVybmFsIChiKTsKKyAgICB9CisgIGlmICghTklMUCAoQlZBUiAoY3VycmVudF9idWZmZXIs IHdpbmRvd19zdGFydF9lbmRfaG9vaykpCisgICAgICAmJiB3LT53aW5kb3dfc3RhcnRfZW5kX2hv b2tfcGVuZGluZykKKyAgICB7CisgICAgICBpZiAoKHBvc2ludCA+PSBDSEFSUE9TIChzdGFydHAp ICYmIHBvc2ludCA8PSBCVUZfWlYgKGIpKQorICAgICAgICAgICYmIENIQVJQT1MgKHN0YXJ0cCkg Pj0gQlVGX0JFR1YgKGIpCisgICAgICAgICAgJiYgQ0hBUlBPUyAoc3RhcnRwKSA8PSBCVUZfWlYg KGIpCisgICAgICAgICAgJiYgcG9zX3Zpc2libGVfcCAodywgcG9zaW50LCAmeCwgJnksICZydG9w LCAmcmJvdCwgJnJvd2gsICZ2cG9zKSkKKyAgICAgICAgZnVsbHlfcCA9ICFydG9wICYmICFyYm90 OworICAgICAgaWYgKGZ1bGx5X3ApCisgICAgICAgIHsKKyAgICAgICAgICAvKiBDTElQX1RFWFRf UE9TX0ZST01fTUFSS0VSIChzdGFydHAsIHctPnN0YXJ0KTsgICovCisgICAgICAgICAgaXRkYXRh ID0gYmlkaV9zaGVsdmVfY2FjaGUgKCk7CisgICAgICAgICAgc3RhcnRfZGlzcGxheSAoJml0LCB3 LCBzdGFydHApOworICAgICAgICAgIG1vdmVfaXRfdmVydGljYWxseSAoJml0LCB3aW5kb3dfYm94 X2hlaWdodCAodykpOworICAgICAgICAgIGlmIChpdC5jdXJyZW50X3kgPCBpdC5sYXN0X3Zpc2li bGVfeSkKKyAgICAgICAgICAgIG1vdmVfaXRfcGFzdF9lb2wgKCZpdCk7CisgICAgICAgICAgZW5k cCA9IChJVF9DSEFSUE9TIChpdCkpOworICAgICAgICAgIGJpZGlfdW5zaGVsdmVfY2FjaGUgKGl0 ZGF0YSwgZmFsc2UpOworICAgICAgICAgIFNFVF9QVCAoc3RhcnRwX2ludGVnZXIpOworICAgICAg ICAgIHBib2xfc3RhcnRwID0gWElOVCAoRmxpbmVfYmVnaW5uaW5nX3Bvc2l0aW9uIChRbmlsKSk7 CisgICAgICAgICAgU0VUX1BUIChlbmRwKTsKKyAgICAgICAgICBwZW9sX2VuZHAgPSBYSU5UIChG bGluZV9lbmRfcG9zaXRpb24gKFFuaWwpKTsKKyAgICAgICAgICBTRVRfUFQgKHBvc2ludCk7Cisj aWZkZWYgR0xZUEhfREVCVUcKKyAgICAgICAgICAvKiBTZWUgdGhlIGRvYy1zdHJpbmcgZm9yIGBw b3MtdmlzaWJsZS1pbi13aW5kb3ctcCcuICAqLworICAgICAgICAgIGRlYnVnX21ldGhvZF9hZGQg KHcsICIlcyAtLSB4OiAlZCB8IHk6ICVkIHwgc3RhcnRwOiAlZCB8IGVuZHA6ICVkIHwgcGJvbF9z dGFydHA6ICVkIHwgcGVvbF9lbmRwOiAlZCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgc3RyaW5nLCB4LCB5LCBzdGFydHBfaW50ZWdlciwgZW5kcCwgcGJvbF9zdGFydHAsIHBlb2xf ZW5kcCk7CisjZW5kaWYKKyAgICAgICAgICAvKiAgUmVzZXQgdGhlIGZsYWcgX2JlZm9yZV8gY2Fs bGluZyBMaXNwLCBub3QgYWZ0ZXIsIHNvIHRoYXQKKyAgICAgICAgICAgICAgaWYgTGlzcCBkb2Vz IHNpZ25hbCBhbiBlcnJvciwgdGhlIGZsYWcgd2lsbCBiZSByZXNldCwgYW5kCisgICAgICAgICAg ICAgIHdvbid0IGNhdXNlIHRoZSBob29rIHRvIGJlIGNhbGxlZCBhZCBuYXVzZWFtLiAgKi8KKyAg ICAgICAgICB3LT53aW5kb3dfc3RhcnRfZW5kX2hvb2tfcGVuZGluZyA9IGZhbHNlOworICAgICAg ICAgIC8qICBXaGVuIGNhbGxpbmcgTGlzcCBmcm9tIHJlZGlzcGxheSwgYWx3YXlzIHVzZSBzYWZl X2NhbGwsIHRvIGJlCisgICAgICAgICAgICAgIHByb3RlY3RlZCBhZ2FpbnN0IGVycm9ycyBzaWdu YWxlZCBieSB0aGF0IExpc3AuICAqLworICAgICAgICAgIC8qIGZuLCBhcmcxLCBhcmcyLCBhcmcz LCBhcmc0LCBhcmc1LCBhcmc2LCBhcmc3ICAqLworICAgICAgICAgIHNhZmVfY2FsbCAoOCwKKyAg ICAgICAgICAgICAgUXJ1bl9ob29rX3dpdGhfYXJncywKKyAgICAgICAgICAgICAgUXdpbmRvd19z dGFydF9lbmRfaG9vaywKKyAgICAgICAgICAgICAgd2luZG93LAorICAgICAgICAgICAgICBtYWtl X251bWJlciAoc3RhcnRwX2ludGVnZXIpLAorICAgICAgICAgICAgICBtYWtlX251bWJlciAoZW5k cCksCisgICAgICAgICAgICAgIG1ha2VfbnVtYmVyIChwYm9sX3N0YXJ0cCksCisgICAgICAgICAg ICAgIG1ha2VfbnVtYmVyIChwZW9sX2VuZHApLAorICAgICAgICAgICAgICBmdWxseV9wID8gUXQg OiBRbmlsKTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgICAgeworI2lmZGVmIEdM WVBIX0RFQlVHCisgICAgICAgICAgICAvKiBTZWUgdGhlIGRvYy1zdHJpbmcgZm9yIGBwb3Mtdmlz aWJsZS1pbi13aW5kb3ctcCcuICAqLworICAgICAgICAgICAgZGVidWdfbWV0aG9kX2FkZCAodywg IiVzIC0tIHg6ICVkIHwgeTogJWQgfCBydG9wOiAlZCB8IHJib3QgJWQgfCByb3doOiAlZCB8IHZw b3M6ICVkIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZywgeCwgeSwg cnRvcCwgcmJvdCwgcm93aCwgdnBvcyk7CisjZW5kaWYKKyAgICAgICAgICB9CisgICAgfQorICBp ZiAob2xkX2J1ZmZlcikKKyAgICBzZXRfYnVmZmVyX2ludGVybmFsIChvbGRfYnVmZmVyKTsKK30K IAogLyogUGVyaGFwcyBpbiB0aGUgZnV0dXJlIGF2b2lkIHJlY2VudGVyaW5nIHdpbmRvd3MgaWYg aXQKICAgIGlzIG5vdCBuZWNlc3Nhcnk7IGN1cnJlbnRseSB0aGF0IGNhdXNlcyBzb21lIHByb2Js ZW1zLiAgKi8KQEAgLTEzNjczLDYgKzEzNzUwLDcgQEAgcmVkaXNwbGF5X2ludGVybmFsICh2b2lk KQogICAgICAgJiYgbWF0Y2hfcAogICAgICAgJiYgIXctPmZvcmNlX3N0YXJ0CiAgICAgICAmJiAh dy0+b3B0aW9uYWxfbmV3X3N0YXJ0CisgICAgICAmJiAhdy0+d2luZG93X3N0YXJ0X2VuZF9ob29r X2ZvcmNlCiAgICAgICAvKiBQb2ludCBtdXN0IGJlIG9uIHRoZSBsaW5lIHRoYXQgd2UgaGF2ZSBp bmZvIHJlY29yZGVkIGFib3V0LiAgKi8KICAgICAgICYmIFBUID49IENIQVJQT1MgKHRsYnVmcG9z KQogICAgICAgJiYgUFQgPD0gWiAtIENIQVJQT1MgKH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i0JICAgIHsKLQkgICAgICBpZiAod2luZG93X2Zyb3plbl9wICh3KSkK LQkJZGVidWdfbWV0aG9kX2FkZCAodywgInNldCBmb3JjZV9zdGFydCBmcm9tIGZyb3plbiB3aW5k b3cgc3RhcnQiKTsKLQkgICAgICBlbHNlCi0JCWRlYnVnX21ldGhvZF9hZGQgKHcsICJzZXQgZm9y Y2Vfc3RhcnQgZnJvbSBvcHRpb25hbF9uZXdfc3RhcnQiKTsKLQkgICAgfQorICAgIHsKKyAgICAg IGlmICh3aW5kb3dfZnJvemVuX3AgKHcpKQorICAgICAgICB7CisgICAgICAgIGRlYnVnX21ldGhv ZF9hZGQgKHcsICJzZXQgZm9yY2Vfc3RhcnQgZnJvbSBmcm96ZW4gd2luZG93IHN0YXJ0Iik7Cisg ICAgICB9CisgICAgICBlbHNlIGlmICh3LT5vcHRpb25hbF9uZXdfc3RhcnQpCisgICAgICAgIHsK KyAgICAgICAgZGVidWdfbWV0aG9kX2FkZCAodywgInNldCBmb3JjZV9zdGFydCBmcm9tIG9wdGlv bmFsX25ld19zdGFydCIpOworICAgICAgfQorICAgICAgZWxzZSBpZiAody0+d2luZG93X3N0YXJ0 X2VuZF9ob29rX2ZvcmNlKQorICAgICAgICB7CisgICAgICAgIGRlYnVnX21ldGhvZF9hZGQgKHcs ICJzZXQgZm9yY2Vfc3RhcnQgZnJvbSB3aW5kb3dfc3RhcnRfZW5kX2hvb2tfZm9yY2UiKTsKKyAg ICAgIH0KKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICBkZWJ1Z19tZXRob2RfYWRkICh3 LCAiVGhpcyBzaXR1YXRpb24gaXMgbm90IHlldCBjb250ZW1wbGF0ZWQuIik7CisgICAgICB9Cisg ICAgfQogI2VuZGlmCiAJfQorICAgICAgdy0+b3B0aW9uYWxfbmV3X3N0YXJ0ID0gZmFsc2U7Cisg ICAgICB3LT53aW5kb3dfc3RhcnRfZW5kX2hvb2tfZm9yY2UgPSBmYWxzZTsKICAgICB9Ci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W5nX2N1cnJlbnRfbWF0cml4IGluIHRo aXMgY2FzZQogCSBiZWNhdXNlIGl0IGNhbiBoYXZlIGNoYW5nZWQgdGhlIGJ1ZmZlci4gICovCiAg ICAgICB8fCAhTklMUCAoVndpbmRvd19zY3JvbGxfZnVuY3Rpb25zKQorICAgICAgfHwgIU5JTFAg KEJWQVIgKGN1cnJlbnRfYnVmZmVyLCB3aW5kb3dfc3RhcnRfZW5kX2hvb2spKQogICAgICAgfHwg IWp1c3RfdGhpc19vbmVfcAogICAgICAgfHwgTUlOSV9XSU5ET1dfUCAodykKICAgICAgIHx8ICEo dXNlZF9jdXJyZW50X21hdHJpeF9wCkBAIC0xNjg4OCw3ICsxNjk5NywxNyBAQCByZWRpc3BsYXlf d2luZG93IChMaXNwX09iamVjdCB3aW5kb3csIGJvb2wganVzdF90aGlzX29uZV9wKQogCSAgY2xl YXJfZ2x5cGhfbWF0cml4ICh3LT5kZXNpcmVkX21hdHJpeCk7CiAJICBpZiAoMSA9PSB0cnlfd2lu ZG93ICh3aW5kb3csIGl0LmN1cnJlbnQucG9zLAogCQkJICAgICAgIFRSWV9XSU5ET1dfQ0hFQ0tf TUFSR0lOUykpCi0JICAgIGdvdG8gZG9uZTsKKyAgICB7CisgICAgICBpZiAoIU5JTFAgKEJWQVIg KGN1cnJlbnRfYnVmZmVyLCB3aW5kb3dfc3RhcnRfZW5kX2hvb2spKQorICAgICAgICAgICYmIHct PndpbmRvd19zdGFydF9lbmRfaG9va19wZW5kaW5nKQorICAgICAgICB7CisgICAgICAgICAgcnVu X3dpbmRvd19zdGFydF9lbmRfaG9vayAod2luZG93LCBpdC5jdXJyZW50LnBvcywgaXQsICJyZWRp c3BsYXlfd2luZG93IChwb3N0LXJlY2VudGVyKSIpOworICAgICAgICAgIGNsZWFyX2dseXBoX21h dHJpeCAody0+ZGVzaXJlZF9tYXRyaXgpOworICAgICAgICAgIHRyeV93aW5kb3cgKHdpbmRvdywg aXQuY3VycmVudC5wb3MsIDApOworICAg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AgeworICAgICAgbGluZSA9IHctPmJh c2VfbGluZV9udW1iZXI7CisgICAgICBsaW5lcG9zID0gdy0+YmFzZV9saW5lX3BvczsKKyAgICAg IGxpbmVwb3NfYnl0ZSA9IGJ1Zl9jaGFycG9zX3RvX2J5dGVwb3MgKGIsIGxpbmVwb3MpOworICAg IH0KKyAgZWxzZQorICAgIHsKKyAgICAgIGxpbmUgPSAxOworICAgICAgbGluZXBvcyA9IEJVRl9C RUdWIChiKTsKKyAgICAgIGxpbmVwb3NfYnl0ZSA9IEJVRl9CRUdWX0JZVEUgKGIpOworICAgIH0K KyAgLyogQ291bnQgbGluZXMgZnJvbSBiYXNlIGxpbmUgdG8gd2luZG93IHN0YXJ0IHBvc2l0aW9u LiAgKi8KKyAgbmxpbmVzID0gZGlzcGxheV9jb3VudF9saW5lcyAobGluZXBvc19ieXRlLAorICAg ICAgICAgICAgICBzdGFydHBvc19ieXRlLAorICAgICAgICAgICAgICBzdGFydHBvcywgJmp1bmsp OworICB0b3BsaW5lID0gbmxpbmVzICsgbGluZTsKKyAgLyogRGV0ZXJtaW5lIGEgbmV3IGJhc2Ug bGluZSwgaWYgdGhlIG9sZCBvbmUgaXMgdG9vIGNsb3NlCisgICAgIG9yIHRvbyBmYXIgYXdheSwg b3IgaWYgd2UgZGlkIG5vdCBoYXZlIG9uZS4KKyAgICAgIlRvbyBjbG9zZSIgbWVhbnMgaXQncyBw bGF1c2libGUgYSBzY3JvbGwtZG93biB3b3VsZAorICAgICBnbyBiYWNrIHBhc3QgaXQuICAqLwor ICBpZiAoc3RhcnRwb3MgPT0gQlVGX0JFR1YgKGIpKQorICAgIHsKKyAgICAgIHctPmJhc2VfbGlu ZV9udW1iZXIgPSB0b3BsaW5lOworICAgICAgdy0+YmFzZV9saW5lX3BvcyA9IEJVRl9CRUdWIChi KTsKKyAgICB9CisgIGVsc2UgaWYgKG5saW5lcyA8IGhlaWdodCArIDI1IHx8IG5saW5lcyA+IGhl aWdodCAqIDMgKyA1MAorICAgICB8fCBsaW5lcG9zID09IEJVRl9CRUdWIChiKSkKKyAgICB7Cisg ICAgICBwdHJkaWZmX3QgbGltaXQgPSBCVUZfQkVHViAoYik7CisgICAgICBwdHJkaWZmX3QgbGlt aXRfYnl0ZSA9IEJVRl9CRUdWX0JZVEUgKGIpOworICAgICAgcHRyZGlmZl90IHBvc2l0aW9uOwor ICAgICAgcHRyZGlmZl90IGRpc3RhbmNlID0KKyAgICAgICAgKGhlaWdodCAqIDIgKyAzMCkgKiBs aW5lX251bWJlcl9kaXNwbGF5X2xpbWl0X3dpZHRoOworICAgICAgaWYgKHN0YXJ0cG9zIC0gZGlz dGFuY2UgPiBsaW1pdCkKKyAgICAgICAgeworICAgIGxpbWl0ID0gc3RhcnRwb3MgLSBkaXN0YW5j ZTsKKyAgICBsaW1pdF9ieXRlID0gQ0hBUl9UT19CWVRFIChsaW1pdCk7CisgICAgICAgIH0KKyAg ICAgIG5saW5lcyA9IGRpc3BsYXlfY291bnRfbGluZXMgKHN0YXJ0cG9zX2J5dGUsCisgICAgICAg ICAgICBsaW1pdF9ieXRlLAorICAgICAgICAgICAgLSAoaGVpZ2h0ICogMiArIDMwKSwKKyAgICAg ICAgICAgICZwb3NpdGlvbik7CisgICAgICAvKiBJZiB3ZSBjb3VsZG4ndCBmaW5kIHRoZSBsaW5l cyB3ZSB3YW50ZWQgd2l0aGluCisgICAgICAgICBsaW5lX251bWJlcl9kaXNwbGF5X2xpbWl0X3dp ZHRoIGNoYXJzIHBlciBsaW5lLAorICAgICAgICAgZ2l2ZSB1cCBvbiBsaW5lIG51bWJlcnMgZm9y IHRoaXMgd2luZG93LiAgKi8KKyAgICAgIGlmIChwb3NpdGlvbiA9PSBsaW1pdF9ieXRlICYmIGxp bWl0ID09IHN0YXJ0cG9zIC0gZGlzdGFuY2UpCisgICAgICAgIHsKKyAgICB3LT5iYXNlX2xpbmVf cG9zID0gLTE7CisgICAgdy0+YmFzZV9saW5lX251bWJlciA9IDA7CisgICAgZ290byBub192YWx1 ZTsKKyAgICAgICAgfQorICAgICAgdy0+YmFzZV9saW5lX251bWJlciA9IHRvcGxpbmUgLSBubGlu ZXM7CisgICAgICB3LT5iYXNlX2xpbmVfcG9zID0gQllURV9UT19DSEFSIChwb3NpdGlvbik7Cisg ICAgfQorICAvKiBOb3cgY291bnQgbGluZXMgZnJvbSB0aGUgc3RhcnQgcG9zIHRvIHBvaW50LiAg Ki8KKyAgbmxpbmVzID0gZGlzcGxheV9jb3VudF9saW5lcyAoc3RhcnRwb3NfYnl0ZSwgUFRfQllU RSwgUFQsICZqdW5rKTsKKyAgLyogTWFrZSB0aGUgc3RyaW5nIHRvIHNob3cuICAqLworICBwaW50 MnN0ciAoZGVjb2RlX21vZGVfc3BlY19idWYsIHdpZHRoLCB0b3BsaW5lICsgbmxpbmVzKTsKKyAg cmV0dXJuIGRlY29kZV9tb2RlX3NwZWNfYnVmOworICAgIG5vX3ZhbHVlOgorICAgICAgICB7Cisg ICAgY2hhciAqcCA9IGRlY29kZV9tb2RlX3NwZWNfYnVmOworICAgIGludCBwYWQgPSB3aWR0aCAt IDI7CisgICAgd2hpbGUgKHBhZC0tID4gMCkKKyAgICAgICpwKysgPSAnICc7CisgICAgKnArKyA9 ICc/JzsKKyAgICAqcCsrID0gJz8nOworICAgICpwID0gJ1wwJzsKKyAgICByZXR1cm4gZGVjb2Rl X21vZGVfc3BlY19idWY7CisgIH0KKyAgICAgIH0KKyAgICAgIGJyZWFrOworICAgIH0KKyAgaWYg KFNUUklOR1AgKG9iaikpCisgICAgeworICAgICAgKnN0cmluZyA9IG9iajsKKyAgICAgIHJldHVy biBTU0RBVEEgKG9iaik7CisgICAgfQorICBlbHNlCisgICAgcmV0dXJuICIiOworfQorCitERUZV TiAoImxpbmUtbnVtYmVyLWF0LXBvc2l0aW9uIiwgRmxpbmVfbnVtYmVyX2F0X3Bvc2l0aW9uLCBT bGluZV9udW1iZXJfYXRfcG9zaXRpb24sIDEsIDIsIDAsCisgICAgICAgZG9jOiAvKiBSZXR1cm4g bGluZSBudW1iZXIgYXQgcG9zaXRpb24uICAqLykKKyAgKExpc3BfT2JqZWN0IHdpbmRvdywgTGlz cF9PYmplY3QgcG9zKQoreworICBzdHJ1Y3Qgd2luZG93ICp3ID0gZGVjb2RlX2xpdmVfd2luZG93 ICh3aW5kb3cpOworICBMaXNwX09iamVjdCBidWYsIGZvb19zdHJpbmcsIHZhbHVlOworICBzdHJ1 Y3QgYnVmZmVyICpiOworICBidWYgPSB3LT5jb250ZW50czsKKyAgQ0hFQ0tfQlVGRkVSIChidWYp OworICBiID0gWEJVRkZFUiAoYnVmKTsKKyAgc3RydWN0IGJ1ZmZlciAqb2xkX2J1ZmZlciA9IE5V TEw7CisgIGNvbnN0IGNoYXIgKnNwZWM7CisgIEVNQUNTX0lOVCBvcG9pbnQsIHBvc2ludDsKKyAg aWYgKGIgIT0gY3VycmVudF9idWZmZXIpCisgICAgeworICAgICAgb2xkX2J1ZmZlciA9IGN1cnJl bnRfYnVmZmVyOworICAgICAgc2V0X2J1ZmZlcl9pbnRlcm5hbCAoYik7CisgICAgfQorICBpZiAo IU5JTFAgKHBvcykpCisgICAgeworICAgICAgb3BvaW50ID0gUFQ7CisgICAgICBwb3NpbnQgPSBY SU5UIChwb3MpOworICAgICAgU0VUX1BUIChwb3NpbnQpOworICAgIH0KKyAgc3BlYyA9IGludGVy bmFsX2xpbmVfbnVtYmVyX2F0X3Bvc2l0aW9uICh3LCAnbCcsIDAsICZmb29fc3RyaW5nKTsKKyAg aWYgKCFOSUxQIChwb3MpKQorICAgIFNFVF9QVCAob3BvaW50KTsKKyAgaWYgKG9sZF9idWZmZXIp CisgICAgc2V0X2J1ZmZlcl9pbnRlcm5hbCAob2xkX2J1ZmZlcik7CisgIHZhbHVlID0gYnVpbGRf c3RyaW5nIChzcGVjKTsKKyAgdmFsdWUgPSBGc3RyaW5nX3RvX251bWJlciAodmFsdWUsIG1ha2Vf bnVtYmVyICgxMCkpOworICByZXR1cm4gdmFsdWU7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OworICB3aGlsZSAoUXQpCisgICAgeworICAgICAgb2xkX3Bib2wgPSBYSU5UIChGbGluZV9iZWdp bm5pbmdfcG9zaXRpb24gKFFuaWwpKTsKKyAgICAgIG9sZF9wZW9sID0gWElOVCAoRmxpbmVfZW5k X3Bvc2l0aW9uIChRbmlsKSk7CisgICAgICBwYm92bCA9IFBUOworICAgICAgc3BlYyA9IGludGVy bmFsX2xpbmVfbnVtYmVyX2F0X3Bvc2l0aW9uICh3LCAnbCcsIDAsICZmb29fc3RyaW5nKTsKKyAg ICAgIGxpbmUgPSBidWlsZF9zdHJpbmcgKHNwZWMpOworICAgICAgbGluZSA9IEZzdHJpbmdfdG9f bnVtYmVyIChsaW5lLCBtYWtlX251bWJlciAoMTApKTsKKyAgICAgIEZ2ZXJ0aWNhbF9tb3Rpb24g KG1ha2VfbnVtYmVyICgxKSwgd2luZG93LCBRbmlsKTsKKyAgICAgIC8qIG15X3kgPSAoZnJhbWVf Y2hhcl9oZWlnaHQgKiBjb3VudGVyKSArIHdpbmRvd19oZWFkZXJfbGluZV9oZWlnaHQ7ICAqLwor ICAgICAgLyogbXlfeSA9IGZyYW1lX2NoYXJfaGVpZ2h0ICogY291bnRlcjsgICovCisgICAgICBu ZXdfcGJvbCA9IFhJTlQgKEZsaW5lX2JlZ2lubmluZ19wb3NpdGlvbiAoUW5pbCkpOworICAgICAg bmV3X3Blb2wgPSBYSU5UIChGbGluZV9lbmRfcG9zaXRpb24gKFFuaWwpKTsKKyAgICAgIGlmIChQ VCA9PSBlbmQgJiYgIShQVCA9PSBuZXdfcGJvbCkpCisgICAgICAgIHBlb3ZsID0gZW5kOworICAg ICAgICBlbHNlIGlmIChvbGRfcGJvbCA9PSBvbGRfcGVvbCkKKyAgICAgICAgICB7CisgICAgICAg ICAgICBwYm92bCA9IG9sZF9wYm9sOworICAgICAgICAgICAgcGVvdmwgPSBvbGRfcGVvbDsKKyAg ICAgICAgICB9CisgICAgICAgICAgZWxzZQorICAgICAgICAgICAgcGVvdmwgPSBQVCAtIDE7Cisg ICAgICBjb2xfZW92bCA9IHBlb3ZsIC0gcGJvdmw7CisgICAgICBwYm92bF9taW51c18xID0gcGJv dmwgLSAxOworICAgICAgcGVvdmxfcGx1c18xID0gcGVvdmwgKyAxOworICAgICAgaWYgKG9sZF9w Ym9sID09IG9sZF9wZW9sKQorICAgICAgICBwZmNpID0gb2xkX3Bib2w7CisgICAgICAgIGVsc2Ug aWYgKChwYm92bCArIHZjb2wpIDw9IHBlb3ZsKQorICAgICAgICAgIHBmY2kgPSBwYm92bCArIHZj b2w7CisgICAgICAgICAgZWxzZQorICAgICAgICAgICAgcGZjaSA9IHBlb3ZsOworICAgICAgaWYg KHBmY2kgPiAwICYmICEocGZjaSA+PSBtYXgpKQorICAgICAgICB7CisgICAgICAgICAgLyogdGVt cCA9IEZwb3NuX2F0X3BvaW50IChtYWtlX251bWJlciAocGZjaSksIHdpbmRvdyk7CisgICAgICAg ICAgeCA9IFhJTlQgKFhDQVIgKEZudGggKG1ha2VfbnVtYmVyICgyKSwgdGVtcCkpKTsKKyAgICAg ICAgICB5ID0gWElOVCAoWENEUiAoRm50aCAobWFrZV9udW1iZXIgKDIpLCB0ZW1wKSkpOworICAg ICAgICAgIGhwb3MgPSBYSU5UIChYQ0FSIChGbnRoIChtYWtlX251bWJlciAoNiksIHRlbXApKSk7 CisgICAgICAgICAgdnBvcyA9IFhJTlQgKFhDRFIgKEZudGggKG1ha2VfbnVtYmVyICg2KSwgdGVt cCkpKTsgICovCisgICAgICAgICAgcGZjaV9taW51c18xID0gcGZjaSAtIDE7CisgICAgICAgICAg cGZjaV9wbHVzXzEgPSBwZmNpICsgMTsKKyAgICAgICAgfQorICAgICAgaWYgKHBmY2kgPiAwICYm ICEocGZjaSA+PSBtYXgpKQorICAgICAgICBjaGFyX2F0X3BmY2kgPSAoRmNoYXJfYWZ0ZXIgKG1h a2VfbnVtYmVyIChwZmNpKSkpOworICAgICAgICBlbHNlCisgICAgICAgICAgY2hhcl9h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gRmNvbnMgKGJ1aWxkX3B1cmVfY19zdHJpbmcgKCJwZW92bCIpLCBt YWtlX251bWJlciAocGVvdmwpKSwKKyAgICAgICAgRmNvbnMgKGJ1aWxkX3B1cmVfY19zdHJpbmcg KCJjb2wtZW92bCIpLCBtYWtlX251bWJlciAoY29sX2VvdmwpKSwKKyAgICAgICAgRmNvbnMgKGJ1 aWxkX3B1cmVfY19zdHJpbmcgKCJwYm92bC0xIiksIG1ha2VfbnVtYmVyIChwYm92bF9taW51c18x KSksCisgICAgICAgIEZjb25zIChidWlsZF9wdXJlX2Nfc3RyaW5nICgicGVvdmwrMSIpLCBtYWtl X251bWJlciAocGVvdmxfcGx1c18xKSksCisgICAgICAgIEZjb25zIChidWlsZF9wdXJlX2Nfc3Ry aW5nICgicGZjaSIpLCBtYWtlX251bWJlciAocGZjaSkpLAorICAgICAgICBGY29ucyAoYnVpbGRf cHVyZV9jX3N0cmluZyAoInBmY2ktMSIpLCBtYWtlX251bWJlciAocGZjaV9taW51c18xKSksCisg ICAgICAgIEZjb25zIChidWlsZF9wdXJlX2Nfc3RyaW5nICgicGZjaSsxIiksIG1ha2VfbnVtYmVy IChwZmNpX3BsdXNfMSkpLAorICAgICAgICBGY29ucyAoYnVpbGRfcHVyZV9jX3N0cmluZyAoImNo YXItYXQtcGZjaSIpLCBjaGFyX2F0X3BmY2kpLAorICAgICAgICBGY29ucyAoYnVpbGRfcHVyZV9j X3N0cmluZyAoImNoYXItYmVmb3JlLXBmY2kiKSwgY2hhcl9iZWZvcmVfcGZjaSksCisgICAgICAg IEZjb25zIChidWlsZF9wdXJlX2Nfc3RyaW5nICgiY2hhci1hZnRlci1wZmNpIiksIGNoYXJfYWZ0 ZXJfcGZjaSksCisgICAgICAgIEZjb25zIChidWlsZF9wdXJlX2Nfc3RyaW5nICgiY2hhci1hdC1w ZW92bCIpLCBjaGFyX2F0X3Blb3ZsKSwKKyAgICAgICAgRmNvbnMgKGJ1aWxkX3B1cmVfY19zdHJp bmcgKC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HBvcyA+PSByb3ctPnVzZWRbVEVYVF9BUkVBXSkKKyAgICAgICAgaHBvcyA9 IHJvdy0+dXNlZFtURVhUX0FSRUFdIC0gMTsKKyAgICAgIHgxID0gZHJhd19nbHlwaHMgKHcsIHgs IHJvdywgVEVYVF9BUkVBLCBocG9zLCBocG9zICsgMSwKKyAgICAgIGhsLCAwKTsKKyAgICAgIGlm IChobCA9PSBEUkFXX0NVUlNPUikKKyAgICAgICAgdy0+cGh5c19jdXJzb3Jfd2lkdGggPSB4MSAt IHg7CisgICAgICAvKiBXaGVuIHdlIGVyYXNlIHRoZSBjdXJzb3IsIGFuZCBST1cgaXMgb3Zlcmxh cHBlZCBieSBvdGhlcgorICAgcm93cywgbWFrZSBzdXJlIHRoYXQgdGhlc2Ugb3ZlcmxhcHBpbmcg cGFydHMgb2Ygb3RoZXIgcm93cworICAgYXJlIHJlZHJhd24uICAqLworICAgICAgICBlbHNlIGlm IChobCA9PSBEUkFXX05PUk1BTF9URVhUICYmIHJvdy0+b3ZlcmxhcHBlZF9wKQorICAgICAgICAg IHsKKyAgICAgICAgICAgIHctPnBoeXNfY3Vyc29yX3dpZHRoID0geDEgLSB4OworICAgICAgICAg ICAgaWYgKHJvdyA+IHctPmN1cnJlbnRfbWF0cml4LT5yb3dzCisgICAgICAgICAgICAgICAgJiYg TUFUUklYX1JPV19PVkVSTEFQU19TVUNDX1AgKHJvdyAtIDEpKQorICAgICAgICAgICAgICB4X2Zp eF9vdmVybGFwcGluZ19hcmVhICh3LCByb3cgLSAxLCBURVhUX0FSRUEsCisgICAgICAgICAgICAg ICAgICAgIE9WRVJMQVBTX0VSQVNFRF9DVVJTT1IpOworICAgICAgICAgICAgaWYgKE1BVFJJWF9S T1dfQk9UVE9NX1kgKHJvdykgPCB3aW5kb3dfdGV4dF9ib3R0b21feSAodykKKyAgICAgICAgICAg ICAgICAmJiBNQVRSSVhfUk9XX09WRVJMQVBTX1BSRURfUCAocm93ICsgMSkpCisgICAgICAgICAg ICAgI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gKncpCit7CisgIGludCB4LCB5LCBo cG9zLCB2cG9zOworICBMaXNwX09iamVjdCB4X3lfaHBvc192cG9zX2xpc3QsIHZsaXN0LCB2YXJf cG9zLCBidWY7CisgIHN0cnVjdCB0ZXh0X3BvcyBzdGFydHA7CisgIHN0cnVjdCBidWZmZXIgKmI7 CisgIGJ1ZiA9IHctPmNvbnRlbnRzOworICBDSEVDS19CVUZGRVIgKGJ1Zik7CisgIGIgPSBYQlVG RkVSIChidWYpOworICBpZiAoIU5JTFAgKEJWQVIgKGN1cnJlbnRfYnVmZmVyLCBtdWx0aXBsZV9j dXJzb3JzX3ByZXZpb3VzX2xpc3QpKSkKKyAgICB7CisgICAgICBmb3IgKHZsaXN0ID0gQlZBUiAo Y3VycmVudF9idWZmZXIsIG11bHRpcGxlX2N1cnNvcnNfcHJldmlvdXNfbGlzdCk7CisgICAgICAg ICAgIENPTlNQICh2bGlzdCk7CisgICAgICAgICAgIHZsaXN0ID0gWENEUiAodmxpc3QpKQorICAg ICAgICB7CisgICAgICAgICAgdmFyX3BvcyA9IFhDQVIgKHZsaXN0KTsKKyAgICAgICAgICBTRVRf VEVYVF9QT1NfRlJPTV9NQVJLRVIgKHN0YXJ0cCwgdy0+c3RhcnQpOworICAgICAgICAgIGlmICh2 YXJfcG9zCisgICAgICAgICAgICAgICYmIChYSU5UICh2YXJfcG9zKSA+PSBDSEFSUE9TIChzdGFy dHApICYmIFhJTlQgKHZhcl9wb3MpIDw9IEJVRl9aViAoYikpCisgICAgICAgICAgICAgICYmIENI QVJQT1MgKHN0YXJ0cCkgPj0gQlVGX0JFR1YgKGIpCisgICAgICAgICAgICAgICYmIENIQVJQT1Mg KHN0YXJ0cCkgPD0gQlVGX1pWIChiKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgeF95 X2hwb3NfdnBvc19saXN0ID0gbXVsdGlwbGVfY3Vyc29yc194X3lfaHBvc192cG9zICh3LCB2YXJf cG9zKTsKKyAgICAgICAgICAgICAgeCA9IChGbnRoIChtYWtlX251bWJlciAoMCksIHhfeV9ocG9z X3Zwb3NfbGlzdCkpOworICAgICAgICAgICAgICB5ID0gKEZudGggKG1ha2VfbnVtYmVyICgxKSwg eF95X2hwb3NfdnBvc19saXN0KSk7CisgICAgICAgICAgICAgIGhwb3MgPSAoRm50aCAobWFrZV9u dW1iZXIgKDIpLCB4X3lfaHBvc192cG9zX2xpc3QpKTsKKyAgICAgICAgICAgICAgdnBvcyA9IChG bnRoIChtYWtlX251bWJlciAoMyksIHhfeV9ocG9zX3Zwb3NfbGlzdCkpOworICAgICAgICAgICAg ICBtdWx0aXBsZV9jdXJzb3JzX2VyYXNlICh3LCB4LCB5LCBocG9zLCB2cG9zKTsKKyAgICAgICAg ICAgIH0KKyAgICAgICAgfQorICAgICAgYnNldF9tdWx0aXBsZV9jdXJzb3JzX3ByZXZpb3VzX2xp c3QgKGN1cnJlbnRfYnVmZmVyLCBRbmlsKTsKKyAgICB9CisgIGlmICghTklMUCAoQlZBUiAoY3Vy cmVudF9idWZmZXIsIG11bHRpcGxlX2N1cnNvcnNfbGlzdCkpKQorICAgIHsKKyAgICAgIGZvciAo dmxpc3QgPSBCVkFSIChjdXJyZW50X2J1ZmZlciwgbXVsdGlwbGVfY3Vyc29yc19saXN0KTsKKyAg ICAgICAgICAgQ09OU1AgKHZsaXN0KTsKKyAgICAgICAgICAgdmxpc3QgPSBYQ0RSICh2bGlzdCkp CisgICAgICAgIHsKKyAgICAgICAgICB2YXJfcG9zID0gWENBUiAodmxpc3QpOworICAgICAgICAg IFNFVF9URVhUX1BPU19GUk9NX01BUktFUiAoc3RhcnRwLCB3LT5zdGFydCk7CisgICAgICAgICAg aWYgKHZhcl9wb3MKKyAgICAgICAgICAgICAgJiYgKFhJTlQgKHZhcl9wb3MpID49IENIQVJQT1Mg KHN0YXJ0cCkgJiYgWElOVCAodmFyX3BvcykgPD0gQlVGX1pWIChiKSkKKyAgICAgICAgICAgICAg JiYgQ0hBUlBPUyAoc3RhcnRwKSA+PSBCVUZfQkVHViAoYikKKyAgICAgICAgICAgICAgJiYgQ0hB UlBPUyAoc3RhcnRwKSA8PSBCVUZfWlYgKGIpKQorICAgICAgICAgICAgeworICAgICAgICAgICAg ICB4X3lfaHBvc192cG9zX2xpc3QgPSBtdWx0aXBsZV9jdXJzb3JzX3hfeV9ocG9zX3Zwb3MgKHcs IHZhcl9wb3MpOworICAgICAgICAgICAgICB4ID0gRm50aCAobWFrZV9udW1iZXIgKDApLCB4X3lf aHBvc192cG9zX2xpc3QpOworICAgICAgICAgICAgICB5ID0gRm50aCAobWFrZV9udW1iZXIgKDEp LCB4X3lfaHBvc192cG9zX2xpc3QpOworICAgICAgICAgICAgICBocG9zID0gRm50aCAobWFrZV9u dW1iZXIgKDIpLCB4X3lfaHBvc192cG9zX2xpc3QpOworICAgICAgICAgICAgICB2cG9zID0gRm50 aCAobWFrZV9udW1iZXIgKDMpLCB4X3lfaHBvc192cG9zX2xpc3QpOworICAgICAgICAgICAgICBt dWx0aXBsZV9jdXJzb3JzX3NldF9kaXNwbGF5ICh3LCAxLCB4LCB5LCBocG9zLCB2cG9zKTsKKyAg ICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgYnNldF9tdWx0aXBsZV9jdXJzb3JzX3ByZXZp b3VzX2xpc3QgKGN1cnJlbnRfYnVmZmVyLCBCVkFSIChjdXJyZW50X2J1ZmZlciwgbXVsdGlwbGVf Y3Vyc29yc19saXN0KSk7CisgICAgICBic2V0X211bHRpcGxlX2N1cnNvcnNfbGlzdCAoY3VycmVu dF9idWZmZXIsIFFuaWwpOworICAgIH0KK30KIAogLyogRGlzcGxheSBvciBjbGVhciBjdXJzb3Ig b2Ygd2luZG93IFcuICBJZiAhT04sIGNsZWFyIHRoZSBjdXJzb3IuCiAgICBJZiBPTiwgZGlzcGxh eSB0aGUgY3Vyc29yOyB3aGVyZSB0byBwdXQgdGhlIGN1cnNvciBpcyBzcGVjaWZpZWQgYnkKQEAg LTI4MzE3LDYgKzI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