Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What can Emacs be? / Hackers Champloo 2019

What can Emacs be? / Hackers Champloo 2019

Wataru MIYAGUNI

June 29, 2019
Tweet

More Decks by Wataru MIYAGUNI

Other Decks in Technology

Transcript

  1. 5$1 ιέοτ ௨৴͕Մೳ w ͜ͷؔ਺Λ࢖ͬͯΈ·͢ w VSMSFUSJFWFTZODISPOPVTMZ63-  w ࢦఆͨ͠63-ʹ(&5ϦΫΤετΛૹΓɺϨεϙϯεΛऔಘ


    w ͓ࢼ͠8FCαʔϏε w JGDPOpHJP w ΞΫηε͖ͯͨ͠ਓ ͜ͷ৔߹ࣗ෼ࣗ਎ ͷ(MPCBM*1"EESFTTͱ͔ɺ 6TFS"HFOUͱ͔ࠃίʔυͱ͔Λදࣔͯ͘͠ΕΔ ศར ࢼ͠ʹ΍ͬͯΈ·͠ΐ͏
  2.  ඇ ಉظϓϩηεΛىಈͰ͖Δ ԿͰ΋ྫ w ιʔείʔυ੔ܗπʔϧΛىಈ͠ɺࠓ։͍͍ͯΔϑΝΠ ϧ៉ྷʹͯ͠΋Β͏ w HPGNU (P

     w SVGP 3VCZ  w ෳࡶͳ)551ϦΫΤετΛඞཁͱ͢Δ8FCαʔϏε͸ɺઐ ༻ͷΫϥΠΞϯτϥΠϒϥϦ͕͋Δ͸ͣͳͷͰɺϓϩηεىಈ͠ ͯͦͷ݁Ռ͚ͩΛ&NBDTͰνΣοΫ͢Δ
  3.  ඇ ಉظϓϩηεΛىಈͰ͖Δ ⏯ಉظϓϩηεͷىಈํ๏ ͍͔ͭ͋͘Δ  w DBMMQSPDFTT w ࢦఆͨ͠ίϚϯυΛ࣮ߦ

    w TIFMMDPNNBOE w ࢦఆͨ͠ίϚϯυΛγΣϧΛ௨࣮ͯ͠ߦ w ͭ·Γlczͱ͔lzͱ͔࢖͑Δʂ
  4. “ This document describes these protocols, as implemented in Apple

    TV software version 5.0, iOS 5.1 and iTunes 10.6. They are based on well-known standard networking protocols such as Multicast DNS, HTTP, RTSP, RTP or NTP, with custom extensions. “
  5. “ This document describes these protocols, as implemented in Apple

    TV software version 5.0, iOS 5.1 and iTunes 10.6. They are based on well-known standard networking protocols such as Multicast DNS, HTTP, RTSP, RTP or NTP, with custom extensions. “
  6. N%/4 NVMUJDBTU%/4 “ In computer networking, the multicast DNS (mDNS)

    protocol resolves host names to IP addresses within small networks that do not include a local name server. “ Ҿ༻ݩIUUQTFOXJLJQFEJBPSHXJLJ.VMUJDBTU@%/4
  7. N%/4 NVMUJDBTU%/4 (let ((process (make-network-process :name "mdns" :coding 'binary :buffer

    (current-buffer) :host "224.0.0.251" :service 5353 :type 'datagram)) (send-text (dns-write `((id ,(random 65000)) (opcode query) (queries (("_airplay._tcp.local" (type PTR)))))))) (process-send-string process send-text)) ࢀߟ: LAN ಺ͷ AppleTV ͷ IP ΞυϨεΛऔಘ͢Δ Emacs Lisp http://gongo.hatenablog.com/entry/2013/01/17/004306
  8.  BJSQMBZWJEFPQMBZ ʹϩʔΧϧϑΝΠϧύε͕౉͞ΕΔͱ
 BJSQMBZWJEFPTFSWFSFMΛ&NBDTͷEBFNPONPEFͰىಈ  TJNQMFIUUQEΛ࢖ͬͯɺͰࢦఆͨ͠ϑΝΠϧΛTFSWF͢ΔΑ͏ͳ
 8FCαʔόΛىಈ  ىಈͨ͠8FCαʔόͷ*1ΞυϨεͱϙʔτ൪߸Λ࢖͍ɺ
 BJSQMBZFM͕"JS1MBZػثʹʮl\JQBEES^\QPSU^zͰ഑৴ͯ͠ΔಈըΛ࠶ੜͯ͠ʯͱ


    1045ϦΫΤετΛૹΔ  ϦΫΤετΛड͚ͱͬͨ"JS1MBZػث͕BJSQMBZWJEFPTFSWFSʹΞΫηε͢Δ  BJSQMBZWJEFPTFSWFS͕͍͍ײ͡ʹσʔλΛฦͯ͋͛͠Δ  ࠶ੜΛఀࢭ͢ΔλΠϛϯάͰɺىಈͨ͠BJSQMBZWJEFPTFSWFS΋ఀࢭ͢Δ BJSQMBZFM BJSQMBZWJEFPTFSWFSFM ࣍ͷεϥΠυ͔ΒਤͰઆ໌͠·͢➡
  9. w $16 .04ͷΧελϜ൛ ͷ໋ྩηο τ͸ެ։͞Ε͍ͯΔ w IUUQPCFMJTLNFVLSFGFSFODFIUNM w ղઆهࣄ΍ςετ༻30.΋ଟ਺͋Δ w

    IUUQTXJLJOFTEFWDPNXJOEFYQIQ&NVMBUPS@UFTUT ϑΝϛίϯ/JOUFOEP&OUFSUBJONFOU4ZTUFN Ҏ߱/&4 
  10. ʮϓϩάϥϛϯάݴޠͰ/&4ͷΤϛϡϨʔλΛ࡞੒͢Δʯ͸ ࡢࠓ௝͘͠ͳ͍ίϯςϯπ Լه΋΄ΜͷҰྫ  w 3VCZ੡ w IUUQTHJUIVCDPNNBNFPQUDBSSPU w 1)1੡

    w IUUQTHJUIVCDPNIBTFHBXBUPNPLJQIQUFSNJOBMOFTFNVMBUPS w (P੡ w IUUQTHJUIVCDPNGPHMFNBOOFT ˡ೥લ ࢓༷͕͋ΔͳΒ࠶ݱͰ͖ΔΑͶ
  11. w Χηοτ w $16 w 116 w 3". w ίϯτϩʔϥ

    Χηοτ಺ͷ30.ʹࠁ·Ε͍ͯΔ ΩϟϥΫλʔ΍എܠσʔλΛಡΈࠐΉ ϑΥʔϚοτ͸ܾ·͍ͬͯΔ ʮɻɻɻɻɻʯ
  12. w Χηοτ w $16 w 116 w 3". w ίϯτϩʔϥ

    ʮɻɻɻɻɻɻʯ ໋ྩηοτΛݸ࣮ͣͭ૷͍ͯ͘͠ جຊతʹ࿦ཧԋࢉ͕Ͱ͖Ε͹ྑ͍
  13. w Χηοτ w $16 w 116 w 3". w ίϯτϩʔϥ

    ʮɻɻɻɻɻɻɻʯ ͬ͘͟Γݴ͑͹ը໘ʹ৭͚͍ͭͯ͘ɻ ೚ҙͷҐஔʹ೚ҙͷ৭Λ
  14. w Χηοτ w $16 w 116 w 3". w ίϯτϩʔϥ

    ʮɻɻɻɻɻɻɻɻʯ ϝϞϦۭؒΈ͍ͨͳ΋ͷͩ ༷ʑͳܭࢉ݁ՌΛอ؅Ͱ͖Ε͹0,
  15. w Χηοτ w $16 w 116 w 3". w ίϯτϩʔϥ

    ʮɻɻɻɻɻɻɻɻɻʯ "ͱ͔#ͱ͔ेࣈͱ͔ ͱʹ͔͘ೖྗ൑ఆͰ͖Ε͹ྑ͍ͷͩΖ͏
  16. * ϑΝΠϧͷϔομ৘ใΛऔಘ ** ☝ϔομ৘ใ͔Βɺ৭σʔλ΍
 ΩϟϥΫλʔύλʔϯͷҐஔΛಛఆ ***⛏͋ͱ͸ͻͨ͢ΒSFBE͍ͯ͘͠ (defconst nes/cartridge-ines-header-spec '((constant vec

    4 u8) (size-of-prg-rom u8) (size-of-chr-rom u8) (flags6 u8) (flags7 u8) (size-of-prg-ram u8) (flags9 u8) (flags10 u8) (zero-pad vec 5 u8))) (bindat-unpack nes/cartridge-ines-header-spec (encode-coding-string rom-data 'raw-text)) ΧηοτͷऔΓѻ͍
  17. ͷ໋ྩҰཡ $16ͷΤϛϡϨʔτ ද "%$ "/% "4- #$$ #$4 #&2 #*5

    #.* #/& #1- #3, #7$ #74 $-$ $-% $-* $-7 $.1 $19 $1: %&$ %&9 %&: &03 */$ */9 */: +.1 +43 -%" -%9 -%: -43 /01 03" 1)" 1)1 1-" 1-1 30- 303 35* 354 4#$ 4&$ 4&% 4&* 45" 459 45: 5"9 5": 549 59" 594 5:"
  18. ͷ໋ྩҰཡ ද "%$ "/% "4- #$$ #$4 #&2 #*5 #.*

    #/& #1- #3, #7$ #74 $-$ $-% $-* $-7 $.1 $19 $1: %&$ %&9 %&: &03 */$ */9 */: +.1 +43 -%" -%9 -%: -43 /01 03" 1)" 1)1 1-" 1-1 30- 303 35* 354 4#$ 4&$ 4&% 4&* 45" 459 45: 5"9 5": 549 59" 594 5:" ✍ͻͨ͢Βॻ͍͍͔ͯ͘͠Ͷ͑ $16ͷΤϛϡϨʔτ
  19. $16ͷΤϛϡϨʔτ (logand #b0101 #b1100) ;; AND => #b0100 (logior #b0101

    #b1100) ;; OR => #b1101 (logxor #b0101 #b1100) ;; XOR => #b1001 ;; Emacs Lisp ʹ͸ඪ४Ͱແ͔ͬͨͷͰࣗ࡞ (logbitp 0 #b1010) ;; => nil (logbitp 1 #b1010) ;; => t (logbitp 2 #b1010) ;; => nil FNBDTOFTͰΑ͘࢖ͬͨϏοτԋࢉؔ਺
  20. (defun nes/instruction-dex (c _address _mode) "Decrement X Register" (let* ((register

    (nes/cpu->register c)) (data (logand (1- (nes/cpu-register->idx-x register)) #xff))) (setf (nes/cpu-register->idx-x register) data) (nes/instruction--set-zero-and-negative-flags register data))) (defun nes/instruction-dey (c _address _mode) "Decrement Y Register" (let* ((register (nes/cpu->register c)) (data (logand (1- (nes/cpu-register->idx-y register)) #xff))) (setf (nes/cpu-register->idx-y register) data) (nes/instruction--set-zero-and-negative-flags register data))) (defun nes/instruction-adc (c addr-or-data mode) "Add with Carry" (let* ((register (nes/cpu->register c)) (data (if (eq mode :immediate) addr-or-data (nes/cpu-read c addr-or-data))) (acc (nes/cpu-register->acc register)) (result (+ acc data (if (nes/cpu-register->sr-carry register) 1 0)))) (nes/instruction--set-zero-and-negative-flags register result) (setf (nes/cpu-register->sr-carry register) (> result #xff)) (setf (nes/cpu-register->sr-overflow register) (and (not (nes--logbitp 7 (logxor acc data))) (nes--logbitp 7 (logxor acc result)))) (setf (nes/cpu-register->acc register) (logand result #xFF)))) ͻͨ͢ΒϏοτԋࢉ $16ͷΤϛϡϨʔτ
  21. ΩʔϘʔυͷΤϛϡϨʔτ ;; w Λԡ͢ͱ্ɺs Λԡ͢ͱԼ (defvar nes/keypad:up (kbd "w")) (defvar

    nes/keypad:down (kbd “s")) ;; CPU ʹରͯ͠ʮ্(4)͕ԡ͞Εͨͧʯͱ఻͑Δ key binding (define-key map nes/keypad:up (lambda () (interactive) (nes/keypad-check k 4))) ;; CPU ʹରͯ͠ʮԼ(5)͕ԡ͞Εͨͧʯͱ఻͑Δ key binding (define-key map nes/keypad:down (lambda () (interactive) (nes/keypad-check k 5)))
  22. ΤϛϡϨʔλʔ༻ͷ30.͕๛෋ w OFTUFTUOFT ඞਢڃ  w ༷ʑͳ$16໋ྩΛ࣮ߦ w ͜ΕΛύε͢Δ͜ͱ͔Β࢝·Δ w

    QBMFUUFOFT ͜͜Ͱࠞཚ͢Δ  w ΧϥʔύϨοτΈ͍ͨͳͷΛදࣔͯ͠ΈΔ༻ w ͜͜Ͱ่Ε͕ൃੜ్ͯ͠ํʹ͘ΕΔ IUUQTXJLJOFTEFWDPNXJOEFYQIQ&NVMBUPS@UFTUT
  23. ΤϛϡϨʔλʔ༻ͷ30.͕๛෋ w OFTUFTUOFT ඞਢڃ  w ༷ʑͳ$16໋ྩΛ࣮ߦ w ͜ΕΛύε͢Δ͜ͱ͔Β࢝·Δ w

    QBMFUUFOFT ͜͜Ͱࠞཚ͢Δ  w ΧϥʔύϨοτΈ͍ͨͳͷΛදࣔͯ͠ΈΔ༻ w ͜͜Ͱ่Ε͕ൃੜ్ͯ͠ํʹ͘ΕΔ IUUQTXJLJOFTEFWDPNXJOEFYQIQ&NVMBUPS@UFTUT
  24. ΤϛϡϨʔλʔ༻ͷ30.͕๛෋ w OFTUFTUOFT ඞਢڃ  w ༷ʑͳ$16໋ྩΛ࣮ߦ w ͜ΕΛύε͢Δ͜ͱ͔Β࢝·Δ w

    QBMFUUFOFT ͜͜Ͱࠞཚ͢Δ  w ΧϥʔύϨοτΈ͍ͨͳͷΛදࣔͯ͠ΈΔ༻ w ͜͜Ͱ่Ε͕ൃੜ్ͯ͠ํʹ͘ΕΔ IUUQTXJLJOFTEFWDPNXJOEFYQIQ&NVMBUPS@UFTUT
  25. w &NBDTͰಈ͘/&4ΤϛϡϨʔλΛ࡞͍ͬͯΔ࿩ w IUUQHPOHPIBUFOBCMPHDPNFOUSZ w .FSSZ$ISJTUNBTJO&NBDT w IUUQHPOHPIBUFOBCMPHDPNFOUSZ w &NBDTͷNPEFMJOFʹण͕࢘ྲྀΕΔ೔

    w IUUQHPOHPIBUFOBCMPHDPNFOUSZ w &NBDTͱ"QQMF57ͷՍ͚ڮͱͳΔBJSQMBZFM w IUUQHPOHPIBUFOBCMPHDPNFOUSZ ͓ΘΓ