home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 January / macpower199701.bin / AMUG / Programming_10 / Videotoolbox 96-08-22-c.sit / VideoToolbox / VideoToolboxSources / kbhit.c < prev    next >
MacBinary  |  1995-08-13  |  2.4 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: kbhit.c

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Sun Aug 13 19:56:22 1995, modified Sun Aug 13 19:56:22 1995, creator 'CWIE', type ASCII, 1593 bytes "kbhit.c" , at 0x6b9 532 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 07 6b 62 68 69 74 2e | 63 00 00 00 00 00 00 00 |..kbhit.|c.......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 06 39 00 | 00 02 14 ac 54 41 a6 ac |......9.|....TA..|
|00000060| 54 41 a6 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |TA......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 8b 2b 00 00 |........|.....+..|
|00000080| 2f 2a 0d 6b 62 68 69 74 | 2e 63 0d 6b 62 68 69 74 |/*.kbhit|.c.kbhit|
|00000090| 28 29 20 72 65 74 75 72 | 6e 73 20 31 20 69 66 20 |() retur|ns 1 if |
|000000a0| 61 20 6b 65 79 70 72 65 | 73 73 20 61 77 61 69 74 |a keypre|ss await|
|000000b0| 73 20 70 72 6f 63 65 73 | 73 69 6e 67 2c 20 30 20 |s proces|sing, 0 |
|000000c0| 6f 74 68 65 72 77 69 73 | 65 2e 0d 67 65 74 63 68 |otherwis|e..getch|
|000000d0| 61 72 55 6e 62 75 66 66 | 65 72 65 64 28 29 20 61 |arUnbuff|ered() a|
|000000e0| 6c 77 61 79 73 20 72 65 | 74 75 72 6e 73 20 69 6d |lways re|turns im|
|000000f0| 6d 65 64 69 61 74 65 6c | 79 2e 20 49 74 20 72 65 |mediatel|y. It re|
|00000100| 74 75 72 6e 73 20 76 61 | 6c 75 65 20 2d 31 20 69 |turns va|lue -1 i|
|00000110| 66 20 74 68 65 72 65 27 | 73 20 0d 6e 6f 20 63 68 |f there'|s .no ch|
|00000120| 61 72 61 63 74 65 72 20 | 74 6f 20 72 65 74 75 72 |aracter |to retur|
|00000130| 6e 2e 0d 0d 67 65 74 63 | 68 61 72 55 6e 62 75 66 |n...getc|harUnbuf|
|00000140| 66 65 72 65 64 28 29 20 | 69 73 20 75 73 65 64 20 |fered() |is used |
|00000150| 62 79 20 43 68 6f 6f 73 | 65 2e 63 0d 0d 36 2f 31 |by Choos|e.c..6/1|
|00000160| 33 2f 39 30 09 64 67 70 | 20 77 72 6f 74 65 20 6b |3/90.dgp| wrote k|
|00000170| 62 68 69 74 2c 20 62 61 | 73 65 64 20 6f 6e 20 73 |bhit, ba|sed on s|
|00000180| 75 67 67 65 73 74 69 6f | 6e 20 66 72 6f 6d 20 4d |uggestio|n from M|
|00000190| 69 63 68 61 65 6c 20 4b | 61 68 6c 20 61 6e 64 20 |ichael K|ahl and |
|000001a0| 61 6e 20 65 61 72 6c 69 | 65 72 20 76 65 72 73 69 |an earli|er versi|
|000001b0| 6f 6e 20 62 79 0d 09 09 | 45 76 61 6e 20 52 65 6c |on by...|Evan Rel|
|000001c0| 6b 69 6e 2e 0d 31 32 2f | 32 35 2f 39 33 20 64 67 |kin..12/|25/93 dg|
|000001d0| 70 20 63 6f 73 6d 65 74 | 69 63 20 65 64 69 74 69 |p cosmet|ic editi|
|000001e0| 6e 67 0d 38 2f 31 2f 39 | 34 20 64 67 70 20 61 64 |ng.8/1/9|4 dgp ad|
|000001f0| 64 65 64 20 73 75 70 70 | 6f 72 74 20 66 6f 72 20 |ded supp|ort for |
|00000200| 4d 65 74 72 6f 57 65 72 | 6b 73 20 43 6f 64 65 57 |MetroWer|ks CodeW|
|00000210| 61 72 72 69 6f 72 20 43 | 20 33 2e 35 2e 0d 31 30 |arrior C| 3.5..10|
|00000220| 2f 31 2f 39 34 20 64 67 | 70 20 75 70 64 61 74 65 |/1/94 dg|p update|
|00000230| 64 20 66 6f 72 20 4d 65 | 74 72 6f 57 65 72 6b 73 |d for Me|troWerks|
|00000240| 20 43 6f 64 65 57 61 72 | 72 69 6f 72 20 43 20 34 | CodeWar|rior C 4|
|00000250| 2e 35 2c 20 77 68 69 63 | 68 20 73 74 69 6c 6c 20 |.5, whic|h still |
|00000260| 64 6f 65 73 6e 27 74 20 | 73 75 70 70 6f 72 74 0d |doesn't |support.|
|00000270| 09 09 75 6e 62 75 66 66 | 65 72 65 64 20 69 6e 70 |..unbuff|ered inp|
|00000280| 75 74 20 66 72 6f 6d 20 | 74 68 65 20 63 6f 6e 73 |ut from |the cons|
|00000290| 6f 6c 65 2e 0d 31 30 2f | 38 2f 39 34 09 64 67 70 |ole..10/|8/94.dgp|
|000002a0| 20 44 69 73 63 6f 76 65 | 72 65 64 20 74 68 61 74 | Discove|red that|
|000002b0| 20 47 65 74 4e 65 78 74 | 45 76 65 6e 74 28 29 20 | GetNext|Event() |
|000002c0| 77 6f 72 6b 73 20 66 69 | 6e 65 20 66 6f 72 20 75 |works fi|ne for u|
|000002d0| 6e 62 75 66 66 65 72 65 | 64 20 69 6e 70 75 74 2e |nbuffere|d input.|
|000002e0| 0d 31 2f 37 2f 39 35 09 | 64 67 70 20 55 70 64 61 |.1/7/95.|dgp Upda|
|000002f0| 74 65 64 20 74 6f 20 74 | 61 6b 65 20 61 64 76 61 |ted to t|ake adva|
|00000300| 6e 74 61 67 65 20 6f 66 | 20 74 68 65 20 43 57 35 |ntage of| the CW5|
|00000310| 20 53 49 4f 55 58 20 63 | 6f 6e 73 6f 6c 65 27 73 | SIOUX c|onsole's|
|00000320| 20 6e 65 77 20 61 62 69 | 6c 69 74 79 20 74 6f 20 | new abi|lity to |
|00000330| 68 61 6e 64 6c 65 20 61 | 6e 20 65 76 65 6e 74 2e |handle a|n event.|
|00000340| 0d 36 2f 31 38 2f 39 35 | 20 64 67 70 20 63 68 61 |.6/18/95| dgp cha|
|00000350| 6e 67 65 64 20 61 62 6f | 72 74 28 29 20 74 6f 20 |nged abo|rt() to |
|00000360| 65 78 69 74 28 31 29 20 | 66 6f 72 20 62 65 74 74 |exit(1) |for bett|
|00000370| 65 72 20 63 6f 6d 70 61 | 74 69 62 69 6c 69 74 79 |er compa|tibility|
|00000380| 20 77 69 74 68 20 43 57 | 20 61 74 65 78 69 74 28 | with CW| atexit(|
|00000390| 29 2e 0d 2a 2f 0d 23 69 | 6e 63 6c 75 64 65 20 22 |)..*/.#i|nclude "|
|000003a0| 56 69 64 65 6f 54 6f 6f | 6c 62 6f 78 2e 68 22 0d |VideoToo|lbox.h".|
|000003b0| 0d 69 6e 74 20 6b 62 68 | 69 74 28 76 6f 69 64 29 |.int kbh|it(void)|
|000003c0| 0d 7b 0d 09 23 69 66 20 | 54 48 49 4e 4b 5f 43 0d |.{..#if |THINK_C.|
|000003d0| 09 09 69 6e 74 20 63 3b | 0d 09 0d 09 09 63 3d 67 |..int c;|.....c=g|
|000003e0| 65 74 63 68 61 72 55 6e | 62 75 66 66 65 72 65 64 |etcharUn|buffered|
|000003f0| 28 29 3b 0d 09 09 69 66 | 28 63 3d 3d 45 4f 46 29 |();...if|(c==EOF)|
|00000400| 72 65 74 75 72 6e 20 30 | 3b 0d 09 09 75 6e 67 65 |return 0|;...unge|
|00000410| 74 63 28 63 2c 73 74 64 | 69 6e 29 3b 0d 09 09 72 |tc(c,std|in);...r|
|00000420| 65 74 75 72 6e 20 31 3b | 0d 09 23 65 6c 73 65 0d |eturn 1;|..#else.|
|00000430| 09 09 45 76 65 6e 74 52 | 65 63 6f 72 64 20 65 76 |..EventR|ecord ev|
|00000440| 65 6e 74 3b 0d 09 09 0d | 09 09 72 65 74 75 72 6e |ent;....|..return|
|00000450| 20 45 76 65 6e 74 41 76 | 61 69 6c 28 6b 65 79 44 | EventAv|ail(keyD|
|00000460| 6f 77 6e 4d 61 73 6b 2c | 26 65 76 65 6e 74 29 3b |ownMask,|&event);|
|00000470| 0d 09 23 65 6e 64 69 66 | 0d 7d 0d 0d 69 6e 74 20 |..#endif|.}..int |
|00000480| 67 65 74 63 68 61 72 55 | 6e 62 75 66 66 65 72 65 |getcharU|nbuffere|
|00000490| 64 28 76 6f 69 64 29 0d | 7b 0d 09 69 6e 74 20 63 |d(void).|{..int c|
|000004a0| 3b 0d 0d 09 23 69 66 20 | 54 48 49 4e 4b 5f 43 0d |;...#if |THINK_C.|
|000004b0| 09 09 63 73 65 74 6d 6f | 64 65 28 43 5f 52 41 57 |..csetmo|de(C_RAW|
|000004c0| 2c 73 74 64 69 6e 29 3b | 09 09 2f 2a 20 75 6e 62 |,stdin);|../* unb|
|000004d0| 75 66 66 65 72 65 64 3a | 20 6e 6f 20 65 63 68 6f |uffered:| no echo|
|000004e0| 2c 20 6e 6f 20 65 64 69 | 74 69 6e 67 20 2a 2f 0d |, no edi|ting */.|
|000004f0| 09 09 63 3d 67 65 74 63 | 68 61 72 28 29 3b 0d 09 |..c=getc|har();..|
|00000500| 09 63 73 65 74 6d 6f 64 | 65 28 43 5f 45 43 48 4f |.csetmod|e(C_ECHO|
|00000510| 2c 73 74 64 69 6e 29 3b | 09 09 2f 2a 20 64 65 66 |,stdin);|../* def|
|00000520| 61 75 6c 74 20 6d 6f 64 | 65 3a 20 6c 69 6e 65 2d |ault mod|e: line-|
|00000530| 62 75 66 66 65 72 65 64 | 2c 20 65 63 68 6f 2c 20 |buffered|, echo, |
|00000540| 66 75 6c 6c 20 65 64 69 | 74 69 6e 67 20 2a 2f 0d |full edi|ting */.|
|00000550| 09 23 65 6c 73 65 0d 09 | 09 45 76 65 6e 74 52 65 |.#else..|.EventRe|
|00000560| 63 6f 72 64 20 65 76 65 | 6e 74 3b 0d 0d 09 09 77 |cord eve|nt;....w|
|00000570| 68 69 6c 65 28 21 47 65 | 74 4e 65 78 74 45 76 65 |hile(!Ge|tNextEve|
|00000580| 6e 74 28 6b 65 79 44 6f | 77 6e 4d 61 73 6b 2c 26 |nt(keyDo|wnMask,&|
|00000590| 65 76 65 6e 74 29 29 7b | 0d 09 09 09 23 69 66 20 |event)){|....#if |
|000005a0| 5f 5f 4d 57 45 52 4b 53 | 5f 5f 0d 09 09 09 09 2f |__MWERKS|__...../|
|000005b0| 2f 20 41 6c 6c 6f 77 20 | 74 68 65 20 63 6f 6e 73 |/ Allow |the cons|
|000005c0| 6f 6c 65 20 74 6f 20 72 | 65 73 70 6f 6e 64 20 74 |ole to r|espond t|
|000005d0| 6f 20 74 68 65 20 6d 6f | 75 73 65 2c 20 65 2e 67 |o the mo|use, e.g|
|000005e0| 2e 20 64 72 61 67 2c 20 | 7a 6f 6f 6d 2c 20 6f 72 |. drag, |zoom, or|
|000005f0| 20 72 65 73 69 7a 65 2e | 0d 09 09 09 09 69 66 28 | resize.|.....if(|
|00000600| 47 65 74 4e 65 78 74 45 | 76 65 6e 74 28 6d 44 6f |GetNextE|vent(mDo|
|00000610| 77 6e 4d 61 73 6b 7c 6d | 55 70 4d 61 73 6b 2c 26 |wnMask|m|UpMask,&|
|00000620| 65 76 65 6e 74 29 29 53 | 49 4f 55 58 48 61 6e 64 |event))S|IOUXHand|
|00000630| 6c 65 4f 6e 65 45 76 65 | 6e 74 28 26 65 76 65 6e |leOneEve|nt(&even|
|00000640| 74 29 3b 0d 09 09 09 23 | 65 6e 64 69 66 0d 09 09 |t);....#|endif...|
|00000650| 7d 0d 09 09 63 3d 65 76 | 65 6e 74 2e 6d 65 73 73 |}...c=ev|ent.mess|
|00000660| 61 67 65 26 63 68 61 72 | 43 6f 64 65 4d 61 73 6b |age&char|CodeMask|
|00000670| 3b 0d 09 09 69 66 28 63 | 3d 3d 27 2e 27 20 26 26 |;...if(c|=='.' &&|
|00000680| 20 28 65 76 65 6e 74 2e | 6d 6f 64 69 66 69 65 72 | (event.|modifier|
|00000690| 73 26 63 6d 64 4b 65 79 | 29 29 65 78 69 74 28 31 |s&cmdKey|))exit(1|
|000006a0| 29 3b 0d 09 23 65 6e 64 | 69 66 0d 09 72 65 74 75 |);..#end|if..retu|
|000006b0| 72 6e 20 63 3b 0d 7d 0d | 0d 00 00 00 00 00 00 00 |rn c;.}.|........|
|000006c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000700| 00 00 01 00 00 00 01 9a | 00 00 00 9a 00 00 00 7a |........|.......z|
|00000710| 61 69 6e 20 73 63 72 65 | 65 6e 20 56 42 4c 20 71 |ain scre|en VBL q|
|00000720| 75 65 75 65 2a 2f 0d 20 | 20 20 20 53 6c 6f 74 54 |ueue*/. | SlotT|
|00000730| 07 6b 62 68 69 74 2e 63 | 02 00 02 00 54 45 58 54 |.kbhit.c|....TEXT|
|00000740| 43 57 49 45 01 00 00 00 | 03 00 00 00 00 00 ad 7b |CWIE....|.......{|
|00000750| 02 00 54 45 58 54 43 57 | 49 45 01 00 00 00 03 00 |..TEXTCW|IE......|
|00000760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000770| 00 00 a2 1d de c5 00 00 | 06 39 00 00 02 14 61 62 |........|.9....ab|
|00000780| 6c 65 53 65 65 64 20 3d | 20 30 78 30 44 32 30 2c |leSeed =| 0x0D20,|
|00000790| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 5b | | /*[|
|000007a0| 47 4c 4f 42 41 4c 20 56 | 41 52 5d 20 20 28 6c 6f |GLOBAL V|AR] (lo|
|000007b0| 6e 67 29 20 73 65 65 64 | 20 76 61 6c 75 65 20 66 |ng) seed| value f|
|000007c0| 6f 72 20 63 6f 6c 6f 72 | 20 74 61 62 6c 65 20 49 |or color| table I|
|000007d0| 44 27 73 2a 2f 0d 20 20 | 20 20 53 52 73 72 63 54 |D's*/. | SRsrcT|
|000007e0| 62 6c 50 74 72 20 3d 20 | 30 78 30 44 32 34 20 20 |blPtr = |0x0D24 |
|000007f0| 20 20 20 20 20 20 20 20 | 20 20 2f 2a 5b 47 4c 4f | | /*[GLO|
|00000800| 00 00 00 0a 00 00 03 73 | ff ff 00 00 00 00 00 00 |.......s|........|
|00000810| 00 12 00 01 00 10 00 00 | 03 c9 00 25 00 e6 b9 6c |........|...%...l|
|00000820| 10 04 01 63 00 00 00 1e | 00 8e 00 16 01 ba 02 60 |...c....|.......`|
|00000830| 00 8e 00 16 01 ba 02 60 | 00 00 00 00 00 00 00 00 |.......`|........|
|00000840| 00 00 00 00 00 00 00 00 | 00 48 00 09 4d 6f 6e 61 |........|.H..Mona|
|00000850| 63 6f 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |co......|........|
|00000860| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 03 00 04 |........|........|
|00000870| 00 3e 00 04 01 8c 02 7c | 00 3e 00 04 01 8c 02 7c |.>.....||.>.....||
|00000880| ae 38 28 ec 00 00 00 00 | 00 00 06 39 00 00 03 c8 |.8(.....|...9....|
|00000890| 00 00 00 00 00 04 00 01 | 00 01 00 00 01 00 00 00 |........|........|
|000008a0| 01 9a 00 00 00 9a 00 00 | 00 7a 01 56 78 18 3b dc |........|.z.Vx.;.|
|000008b0| 00 00 00 1c 00 7a 00 03 | 4d 50 53 52 00 01 00 22 |.....z..|MPSR..."|
|000008c0| 42 4b 50 54 00 00 00 3a | 44 54 56 55 00 00 00 46 |BKPT...:|DTVU...F|
|000008d0| 4d 57 42 42 00 00 00 52 | 03 f0 ff ff 00 00 00 24 |MWBB...R|.......$|
|000008e0| 00 00 00 00 03 ed ff ff | 00 00 00 46 00 00 00 00 |........|...F....|
|000008f0| 42 1f ff ff 00 00 00 00 | 00 00 00 00 58 03 ff ff |B.......|....X...|
|00000900| 00 00 00 0e 00 00 00 00 | 03 f0 ff ff 00 00 00 92 |........|........|
|00000910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000920| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+