home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1992-03-23 | 4.4 KB | [TEXT/AIFC] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
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, Mon Mar 23 00:09:15 1992, modified Mon Mar 23 00:09:15 1992, creator 'AIFC', type ASCII, 3905 bytes "polygon area.c" , at 0xfc1 380 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 |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [AIFC] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0e 70 6f 6c 79 67 6f | 6e 20 61 72 65 61 2e 63 |..polygo|n area.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 41 49 46 | 43 01 00 00 00 00 00 00 |.TEXTAIF|C.......|
|00000050| 00 00 00 00 00 0f 41 00 | 00 01 7c a5 f3 18 7b a5 |......A.|..|...{.|
|00000060| f3 18 7b 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..{.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 d4 7e 00 00 |........|.....~..|
|00000080| 2f 2a 0d 20 2a 20 50 6f | 6c 79 67 6f 6e 5f 61 72 |/*. * Po|lygon_ar|
|00000090| 65 61 2e 63 3a 20 54 68 | 69 6e 6b 20 43 20 46 6f |ea.c: Th|ink C Fo|
|000000a0| 72 65 69 67 6e 20 43 6f | 64 65 20 52 65 73 6f 75 |reign Co|de Resou|
|000000b0| 72 63 65 20 45 78 61 6d | 70 6c 65 2e 0d 20 2a 09 |rce Exam|ple.. *.|
|000000c0| 45 78 61 6d 70 6c 65 20 | 66 72 6f 6d 20 41 41 49 |Example |from AAI|
|000000d0| 53 20 50 72 6f 6c 6f 67 | 20 4d 61 6e 75 61 6c 2e |S Prolog| Manual.|
|000000e0| 0d 20 2a 09 43 61 6c 63 | 75 6c 61 74 65 73 20 74 |. *.Calc|ulates t|
|000000f0| 68 65 20 61 72 65 61 20 | 6f 66 20 61 20 70 6f 6c |he area |of a pol|
|00000100| 79 67 6f 6e 2e 0d 20 2a | 0d 20 2a 20 43 6f 70 79 |ygon.. *|. * Copy|
|00000110| 72 69 67 68 74 2c 20 a9 | 20 31 39 38 38 2c 20 31 |right, .| 1988, 1|
|00000120| 39 39 32 20 41 64 76 61 | 6e 63 65 64 20 41 2e 20 |992 Adva|nced A. |
|00000130| 49 2e 20 53 79 73 74 65 | 6d 73 2c 20 49 6e 63 2e |I. Syste|ms, Inc.|
|00000140| 0d 20 2a 20 41 6c 6c 20 | 72 69 67 68 74 73 20 72 |. * All |rights r|
|00000150| 65 73 65 72 76 65 64 2e | 0d 20 2a 20 54 68 69 73 |eserved.|. * This|
|00000160| 20 66 69 6c 65 20 6d 61 | 79 20 6e 6f 74 20 62 65 | file ma|y not be|
|00000170| 20 63 6f 70 69 65 64 20 | 6f 72 20 64 69 73 74 72 | copied |or distr|
|00000180| 69 62 75 74 65 64 20 77 | 69 74 68 6f 75 74 20 74 |ibuted w|ithout t|
|00000190| 68 65 20 0d 20 2a 20 77 | 72 69 74 74 65 6e 20 70 |he . * w|ritten p|
|000001a0| 65 72 6d 69 73 73 69 6f | 6e 20 6f 66 20 41 64 76 |ermissio|n of Adv|
|000001b0| 61 6e 63 65 64 20 41 2e | 20 49 2e 20 53 79 73 74 |anced A.| I. Syst|
|000001c0| 65 6d 73 2c 20 49 6e 63 | 2e 0d 20 2a 0d 20 2a 20 |ems, Inc|.. *. * |
|000001d0| 54 48 49 53 20 45 58 41 | 4d 50 4c 45 20 52 45 51 |THIS EXA|MPLE REQ|
|000001e0| 55 49 52 45 53 20 54 48 | 49 4e 4b 20 43 20 34 2e |UIRES TH|INK C 4.|
|000001f0| 30 20 6f 72 20 35 2e 30 | 20 49 4e 20 4f 52 44 45 |0 or 5.0| IN ORDE|
|00000200| 52 20 54 4f 20 42 45 20 | 55 53 45 44 2e 0d 20 2a |R TO BE |USED.. *|
|00000210| 20 41 53 20 50 41 52 54 | 20 4f 46 20 54 48 45 20 | AS PART| OF THE |
|00000220| 45 58 41 4d 50 4c 45 20 | 41 4e 44 20 49 4e 20 4f |EXAMPLE |AND IN O|
|00000230| 52 44 45 52 20 54 4f 20 | 46 41 4d 49 4c 49 41 52 |RDER TO |FAMILIAR|
|00000240| 49 5a 45 20 59 4f 55 20 | 57 49 54 48 0d 20 2a 20 |IZE YOU |WITH. * |
|00000250| 54 48 45 20 50 52 4f 4c | 4f 47 2f 43 20 43 4f 44 |THE PROL|OG/C COD|
|00000260| 45 20 52 45 53 4f 55 52 | 43 45 20 49 4e 54 45 52 |E RESOUR|CE INTER|
|00000270| 46 41 43 45 2c 20 57 45 | 20 4c 45 41 56 45 20 54 |FACE, WE| LEAVE T|
|00000280| 48 45 20 42 55 49 4c 44 | 49 4e 47 20 4f 46 0d 20 |HE BUILD|ING OF. |
|00000290| 2a 20 54 48 45 20 41 43 | 54 55 41 4c 20 43 4f 44 |* THE AC|TUAL COD|
|000002a0| 45 20 52 45 53 4f 55 52 | 43 45 20 54 4f 20 59 4f |E RESOUR|CE TO YO|
|000002b0| 55 2e 0d 20 2a 0d 20 2a | 20 41 20 63 6f 64 65 20 |U.. *. *| A code |
|000002c0| 72 65 73 6f 75 72 63 65 | 20 74 68 61 74 20 69 73 |resource| that is|
|000002d0| 20 61 6c 72 65 61 64 79 | 20 63 6f 6d 70 69 6c 65 | already| compile|
|000002e0| 64 20 61 6e 64 20 6c 6f | 61 64 65 64 20 69 6e 20 |d and lo|aded in |
|000002f0| 50 72 6f 6c 6f 67 20 69 | 73 0d 20 2a 20 70 72 6f |Prolog i|s. * pro|
|00000300| 76 69 64 65 64 20 69 6e | 20 74 68 65 20 45 6e 76 |vided in| the Env|
|00000310| 69 72 6f 6e 6d 65 6e 74 | 20 66 69 6c 65 20 69 6e |ironment| file in|
|00000320| 20 0d 20 2a 09 22 64 69 | 73 70 6c 61 79 20 6c 69 | . *."di|splay li|
|00000330| 73 74 20 63 6f 6d 70 61 | 72 65 2e 63 22 20 26 20 |st compa|re.c" & |
|00000340| 22 64 69 73 70 6c 61 79 | 20 6c 69 73 74 2e 63 6f |"display| list.co|
|00000350| 64 65 22 0d 20 2a 0d 20 | 2a 20 54 68 69 73 20 69 |de". *. |* This i|
|00000360| 73 20 74 6f 20 62 65 20 | 63 6f 6d 70 69 6c 65 64 |s to be |compiled|
|00000370| 20 62 79 20 74 68 65 20 | 54 68 69 6e 6b 20 43 20 | by the |Think C |
|00000380| 43 6f 6d 70 69 6c 65 72 | 20 34 2e 30 20 6f 72 20 |Compiler| 4.0 or |
|00000390| 35 2e 30 2e 0d 20 2a 0d | 20 2a 20 53 65 65 20 50 |5.0.. *.| * See P|
|000003a0| 61 67 65 73 20 33 32 31 | 2d 33 32 33 20 6f 66 20 |ages 321|-323 of |
|000003b0| 56 6f 6c 75 6d 65 20 32 | 20 6f 66 20 41 41 49 53 |Volume 2| of AAIS|
|000003c0| 20 50 72 6f 6c 6f 67 20 | 4d 61 6e 75 61 6c 2c 20 | Prolog |Manual, |
|000003d0| 56 65 72 73 69 6f 6e 20 | 33 2e 30 0d 20 2a 20 4f |Version |3.0. * O|
|000003e0| 72 20 73 65 65 20 70 61 | 67 65 73 20 31 38 38 2d |r see pa|ges 188-|
|000003f0| 31 39 30 20 6f 66 20 74 | 68 65 20 41 41 49 53 20 |190 of t|he AAIS |
|00000400| 50 72 6f 6c 6f 67 20 4d | 2d 32 2e 30 20 52 65 66 |Prolog M|-2.0 Ref|
|00000410| 65 72 65 6e 63 65 20 4d | 61 6e 75 61 6c 0d 20 2a |erence M|anual. *|
|00000420| 09 66 6f 72 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |.for inf|ormation|
|00000430| 20 6f 6e 20 68 6f 77 20 | 74 6f 20 75 73 65 20 74 | on how |to use t|
|00000440| 68 69 73 20 70 72 6f 67 | 72 61 6d 2e 0d 20 2a 20 |his prog|ram.. * |
|00000450| 54 68 65 72 65 20 69 73 | 20 61 6e 20 65 72 72 6f |There is| an erro|
|00000460| 72 20 6f 6e 20 50 61 67 | 65 20 33 32 33 20 6f 66 |r on Pag|e 323 of|
|00000470| 20 56 6f 6c 75 6d 65 20 | 32 3a 20 70 6f 6c 79 67 | Volume |2: polyg|
|00000480| 6f 6e 5f 61 72 65 61 5f | 63 6f 64 65 20 73 68 6f |on_area_|code sho|
|00000490| 75 6c 64 0d 20 2a 09 62 | 65 20 70 6f 6c 79 67 6f |uld. *.b|e polygo|
|000004a0| 6e 20 61 72 65 61 20 63 | 6f 64 65 2e 0d a5 a5 a5 |n area c|ode.....|
|000004b0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000004c0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000004d0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000004e0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000004f0| a5 a5 a5 a5 a5 a5 0d 54 | 6f 20 63 72 65 61 74 65 |.......T|o create|
|00000500| 20 74 68 65 20 63 6f 64 | 65 20 72 65 73 6f 75 72 | the cod|e resour|
|00000510| 63 65 20 69 6e 20 54 68 | 69 6e 6b 20 43 2c 20 77 |ce in Th|ink C, w|
|00000520| 65 20 64 6f 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |e do the| followi|
|00000530| 6e 67 3a 0d 0d 46 69 72 | 73 74 20 77 65 20 6f 70 |ng:..Fir|st we op|
|00000540| 65 6e 20 75 70 20 54 68 | 69 6e 6b 20 43 20 69 6e |en up Th|ink C in|
|00000550| 20 74 68 65 20 46 69 6e | 64 65 72 2e 0d 0d 53 65 | the Fin|der...Se|
|00000560| 6c 65 63 74 20 74 68 65 | 20 6e 65 77 20 70 72 6f |lect the| new pro|
|00000570| 6a 65 63 74 20 62 75 74 | 74 6f 6e 20 69 6e 20 74 |ject but|ton in t|
|00000580| 68 65 20 64 69 61 6c 6f | 67 20 62 6f 78 20 74 68 |he dialo|g box th|
|00000590| 61 74 20 77 61 73 20 70 | 72 65 73 65 6e 74 65 64 |at was p|resented|
|000005a0| 2e 0d 0d 57 65 20 74 79 | 70 65 20 74 68 65 20 6e |...We ty|pe the n|
|000005b0| 61 6d 65 20 70 6f 6c 79 | 67 6f 6e 20 61 73 20 74 |ame poly|gon as t|
|000005c0| 68 65 20 6e 61 6d 65 20 | 6f 66 20 6f 75 72 20 6e |he name |of our n|
|000005d0| 65 77 20 70 72 6f 6a 65 | 63 74 20 0d 61 6e 64 20 |ew proje|ct .and |
|000005e0| 73 65 6c 65 63 74 20 74 | 68 65 20 63 72 65 61 74 |select t|he creat|
|000005f0| 65 20 62 75 74 74 6f 6e | 2e 0d 0d 46 72 6f 6d 20 |e button|...From |
|00000600| 74 68 65 20 50 72 6f 6a | 65 63 74 20 6d 65 6e 75 |the Proj|ect menu|
|00000610| 2c 20 77 65 20 73 65 6c | 65 63 74 20 74 68 65 20 |, we sel|ect the |
|00000620| 53 65 74 20 50 72 6f 6a | 65 63 74 20 54 79 70 65 |Set Proj|ect Type|
|00000630| 20 63 6f 6d 6d 61 6e 64 | 2e 0d 0d 49 6e 20 74 68 | command|...In th|
|00000640| 65 20 64 69 61 6c 6f 67 | 20 70 72 65 73 65 6e 74 |e dialog| present|
|00000650| 65 64 2c 20 77 65 20 63 | 68 6f 6f 73 65 20 43 6f |ed, we c|hoose Co|
|00000660| 64 65 20 52 65 73 6f 75 | 72 63 65 2e 20 20 0d 57 |de Resou|rce. .W|
|00000670| 65 20 65 6e 74 65 72 20 | 6d 69 6e 6b 20 66 6f 72 |e enter |mink for|
|00000680| 20 74 68 65 20 74 79 70 | 65 2c 20 61 6e 64 20 31 | the typ|e, and 1|
|00000690| 39 39 31 20 66 6f 72 20 | 74 68 65 20 69 64 2c 20 |991 for |the id, |
|000006a0| 0d 61 6e 64 20 74 68 65 | 6e 20 73 65 6c 65 63 74 |.and the|n select|
|000006b0| 20 74 68 65 20 6f 6b 20 | 62 75 74 74 6f 6e 2e 0d | the ok |button..|
|000006c0| 0d 46 72 6f 6d 20 74 68 | 65 20 46 69 6c 65 20 6d |.From th|e File m|
|000006d0| 65 6e 75 2c 20 73 65 6c | 65 63 74 20 6f 70 65 6e |enu, sel|ect open|
|000006e0| 2e 2e 2e 20 20 0d 57 65 | 20 63 68 6f 6f 73 65 20 |... .We| choose |
|000006f0| 74 68 65 20 70 6f 6c 79 | 67 6f 6e 20 61 72 65 61 |the poly|gon area|
|00000700| 2e 63 20 66 69 6c 65 20 | 70 72 6f 76 69 64 65 64 |.c file |provided|
|00000710| 20 69 6e 20 74 68 65 20 | 45 78 61 6d 70 6c 65 73 | in the |Examples|
|00000720| 20 66 6f 6c 64 65 72 2e | 20 20 0d 54 68 65 20 73 | folder.| .The s|
|00000730| 6f 75 72 63 65 20 74 6f | 20 74 68 69 73 20 66 69 |ource to| this fi|
|00000740| 6c 65 20 69 73 20 61 6c | 73 6f 20 70 72 6f 76 69 |le is al|so provi|
|00000750| 64 65 64 20 62 65 6c 6f | 77 2e 0d 0d 4e 65 78 74 |ded belo|w...Next|
|00000760| 2c 20 77 65 20 73 65 6c | 65 63 74 20 74 68 65 20 |, we sel|ect the |
|00000770| 61 64 64 20 63 6f 6d 6d | 61 6e 64 20 66 72 6f 6d |add comm|and from|
|00000780| 20 74 68 65 20 53 6f 75 | 72 63 65 20 6d 65 6e 75 | the Sou|rce menu|
|00000790| 2e 0d 0d 4e 65 78 74 2c | 20 77 65 20 73 65 6c 65 |...Next,| we sele|
|000007a0| 63 74 20 42 75 69 6c 64 | 20 43 6f 64 65 20 52 65 |ct Build| Code Re|
|000007b0| 73 6f 75 72 63 65 20 66 | 72 6f 6d 20 74 68 65 20 |source f|rom the |
|000007c0| 50 72 6f 6a 65 63 74 20 | 6d 65 6e 75 2e 20 20 0d |Project |menu. .|
|000007d0| 57 65 20 63 6f 6e 66 69 | 72 6d 20 77 69 74 68 20 |We confi|rm with |
|000007e0| 74 68 65 20 79 65 73 20 | 62 75 74 74 6f 6e 20 69 |the yes |button i|
|000007f0| 6e 20 74 68 65 20 64 69 | 61 6c 6f 67 20 70 72 65 |n the di|alog pre|
|00000800| 73 65 6e 74 65 64 20 0d | 61 73 6b 69 6e 67 20 75 |sented .|asking u|
|00000810| 73 20 69 66 20 77 65 20 | 77 69 73 68 20 74 6f 20 |s if we |wish to |
|00000820| 62 72 69 6e 67 20 74 68 | 65 20 70 72 6f 6a 65 63 |bring th|e projec|
|00000830| 74 20 75 70 20 74 6f 20 | 64 61 74 65 2e 20 20 0d |t up to |date. .|
|00000840| 54 68 69 6e 6b 20 43 20 | 77 69 6c 6c 20 6e 65 78 |Think C |will nex|
|00000850| 74 20 63 6f 6d 70 69 6c | 65 20 74 68 65 20 66 69 |t compil|e the fi|
|00000860| 6c 65 2c 20 61 6e 64 20 | 74 68 65 6e 20 61 73 6b |le, and |then ask|
|00000870| 20 75 73 20 0d 77 68 65 | 72 65 20 74 6f 20 73 61 | us .whe|re to sa|
|00000880| 76 65 20 74 68 65 20 63 | 6f 64 65 20 72 65 73 6f |ve the c|ode reso|
|00000890| 75 72 63 65 2e 20 20 57 | 65 20 65 6e 74 65 72 20 |urce. W|e enter |
|000008a0| 74 68 65 20 66 69 6c 65 | 20 0d 6e 61 6d 65 20 70 |the file| .name p|
|000008b0| 6f 6c 79 67 6f 6e 20 61 | 72 65 61 20 63 6f 64 65 |olygon a|rea code|
|000008c0| 2c 20 61 6e 64 20 73 65 | 6c 65 63 74 20 74 68 65 |, and se|lect the|
|000008d0| 20 73 61 76 65 20 62 75 | 74 74 6f 6e 2e 0d 0d 57 | save bu|tton...W|
|000008e0| 65 20 68 61 76 65 20 66 | 69 6e 69 73 68 65 64 20 |e have f|inished |
|000008f0| 63 72 65 61 74 69 6e 67 | 20 6f 75 72 20 63 6f 64 |creating| our cod|
|00000900| 65 20 72 65 73 6f 75 72 | 63 65 2e 0d a5 a5 a5 a5 |e resour|ce......|
|00000910| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|00000920| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|00000930| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|00000940| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|00000950| a5 a5 a5 a5 a5 0d 41 66 | 74 65 72 77 61 72 64 73 |......Af|terwards|
|00000960| 2c 20 77 65 20 63 61 6e | 20 77 6f 72 6b 20 69 6e |, we can| work in|
|00000970| 20 41 41 49 53 20 50 72 | 6f 6c 6f 67 20 61 6e 64 | AAIS Pr|olog and|
|00000980| 20 0d 6c 6f 61 64 20 69 | 6e 20 6f 75 72 20 66 6f | .load i|n our fo|
|00000990| 72 65 69 67 6e 20 63 6f | 64 65 20 72 65 73 6f 75 |reign co|de resou|
|000009a0| 72 63 65 2e 20 20 0d 54 | 68 65 20 66 6f 6c 6c 6f |rce. .T|he follo|
|000009b0| 77 69 6e 67 20 69 6c 6c | 75 73 74 72 61 74 65 73 |wing ill|ustrates|
|000009c0| 20 6c 6f 61 64 69 6e 67 | 20 74 68 69 73 20 63 6f | loading| this co|
|000009d0| 64 65 20 72 65 73 6f 75 | 72 63 65 20 69 6e 74 6f |de resou|rce into|
|000009e0| 20 0d 41 41 49 53 20 50 | 72 6f 6c 6f 67 20 61 6e | .AAIS P|rolog an|
|000009f0| 64 20 65 78 65 63 75 74 | 69 6e 67 20 69 74 2e 20 |d execut|ing it. |
|00000a00| 20 0d 54 68 65 20 72 65 | 73 6f 75 72 63 65 20 74 | .The re|source t|
|00000a10| 79 70 65 20 60 6d 69 6e | 6b 60 20 69 73 20 65 6e |ype `min|k` is en|
|00000a20| 74 65 72 65 64 20 75 73 | 69 6e 67 20 62 61 63 6b |tered us|ing back|
|00000a30| 71 75 6f 74 65 73 2c 20 | 6e 6f 74 20 73 69 6e 67 |quotes, |not sing|
|00000a40| 6c 65 20 71 75 6f 74 65 | 73 2e 20 0d 49 74 20 69 |le quote|s. .It i|
|00000a50| 73 20 61 20 34 20 63 68 | 61 72 61 63 74 65 72 20 |s a 4 ch|aracter |
|00000a60| 63 6f 64 65 2c 20 77 68 | 69 63 68 20 69 73 20 61 |code, wh|ich is a|
|00000a70| 6c 73 6f 20 61 6e 20 69 | 6e 74 65 67 65 72 20 69 |lso an i|nteger i|
|00000a80| 6e 20 50 72 6f 6c 6f 67 | 2e 0d 0d 3f 2d 20 66 6f |n Prolog|...?- fo|
|00000a90| 72 65 69 67 6e 5f 63 6f | 64 65 5f 72 65 73 6f 75 |reign_co|de_resou|
|00000aa0| 72 63 65 28 27 70 6f 6c | 79 67 6f 6e 20 61 72 65 |rce('pol|ygon are|
|00000ab0| 61 20 63 6f 64 65 27 2c | 20 60 6d 69 6e 6b 60 2c |a code',| `mink`,|
|00000ac0| 20 31 39 39 31 2c 20 70 | 6f 6c 79 29 2e 0d 3f 2d | 1991, p|oly)..?-|
|00000ad0| 20 64 65 66 69 6e 65 5f | 66 6f 72 65 69 67 6e 28 | define_|foreign(|
|00000ae0| 70 6f 6c 79 5f 61 72 65 | 61 2c 20 70 6f 6c 79 2c |poly_are|a, poly,|
|00000af0| 20 30 2c 20 6c 6f 6e 67 | 2c 20 5b 70 6f 6c 79 67 | 0, long|, [polyg|
|00000b00| 6f 6e 5d 29 2e 0d 0d 53 | 6f 6d 65 20 74 65 73 74 |on])...S|ome test|
|00000b10| 20 63 61 73 65 73 3a 0d | 0d 3f 2d 20 70 6f 6c 79 | cases:.|.?- poly|
|00000b20| 5f 61 72 65 61 28 5b 5b | 31 30 2c 31 30 5d 2c 20 |_area([[|10,10], |
|00000b30| 5b 31 30 2c 32 30 5d 2c | 20 5b 32 30 2c 32 30 5d |[10,20],| [20,20]|
|00000b40| 2c 20 5b 32 30 2c 31 30 | 5d 5d 2c 20 58 29 2e 0d |, [20,10|]], X)..|
|00000b50| 3f 2d 20 70 6f 6c 79 5f | 61 72 65 61 28 5b 5b 31 |?- poly_|area([[1|
|00000b60| 30 2c 35 5d 2c 20 5b 32 | 30 2c 35 30 5d 2c 20 5b |0,5], [2|0,50], [|
|00000b70| 33 2c 32 30 5d 2c 20 5b | 32 30 2c 31 30 5d 5d 2c |3,20], [|20,10]],|
|00000b80| 20 58 29 2e 0d 0d 57 65 | 20 68 61 76 65 20 70 61 | X)...We| have pa|
|00000b90| 73 73 65 64 20 61 20 6c | 69 73 74 20 6f 66 20 63 |ssed a l|ist of c|
|00000ba0| 6f 6f 72 64 69 6e 61 74 | 65 20 70 61 69 72 73 2c |oordinat|e pairs,|
|00000bb0| 20 6e 6f 74 20 61 20 70 | 6f 6c 79 67 6f 6e 2e 20 | not a p|olygon. |
|00000bc0| 20 0d 50 72 6f 6c 6f 67 | 20 63 6f 6e 76 65 72 74 | .Prolog| convert|
|00000bd0| 65 64 20 74 68 69 73 20 | 75 73 69 6e 67 20 63 6f |ed this |using co|
|00000be0| 6e 76 65 72 74 20 74 6f | 20 61 20 70 6f 6c 79 67 |nvert to| a polyg|
|00000bf0| 6f 6e 20 61 6e 64 20 70 | 61 73 73 65 64 20 0d 74 |on and p|assed .t|
|00000c00| 68 65 20 70 6f 6c 79 67 | 6f 6e 20 74 6f 20 74 68 |he polyg|on to th|
|00000c10| 65 20 66 75 6e 63 74 69 | 6f 6e 2e 0d a5 a5 a5 a5 |e functi|on......|
|00000c20| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|00000c30| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|00000c40| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|00000c50| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|00000c60| a5 a5 a5 a5 a5 0d 20 2a | 2f 0d 23 69 6e 63 6c 75 |...... *|/.#inclu|
|00000c70| 64 65 20 3c 71 75 69 63 | 6b 64 72 61 77 2e 68 3e |de <quic|kdraw.h>|
|00000c80| 0d 2f 2a 0d 20 2a 20 46 | 6f 72 65 69 67 6e 20 43 |./*. * F|oreign C|
|00000c90| 6f 64 65 20 52 65 73 6f | 75 72 63 65 20 45 78 61 |ode Reso|urce Exa|
|00000ca0| 6d 70 6c 65 20 66 6f 72 | 20 41 41 49 53 20 50 72 |mple for| AAIS Pr|
|00000cb0| 6f 6c 6f 67 2e 0d 20 2a | 20 75 73 69 6e 67 20 54 |olog.. *| using T|
|00000cc0| 68 69 6e 6b 20 43 2e 0d | 20 2a 20 54 68 69 6e 6b |hink C..| * Think|
|00000cd0| 20 43 20 69 73 20 61 20 | 70 72 6f 64 75 63 74 20 | C is a |product |
|00000ce0| 6f 66 20 53 79 6d 61 6e | 74 65 63 20 43 6f 72 70 |of Syman|tec Corp|
|00000cf0| 2e 0d 20 2a 2f 0d 6c 6f | 6e 67 20 70 61 73 63 61 |.. */.lo|ng pasca|
|00000d00| 6c 0d 6d 61 69 6e 28 50 | 6f 6c 79 48 61 6e 64 6c |l.main(P|olyHandl|
|00000d10| 65 20 50 6f 6c 79 29 0d | 7b 0d 09 72 65 67 69 73 |e Poly).|{..regis|
|00000d20| 74 65 72 20 69 6e 74 20 | 69 3b 0d 09 6c 6f 6e 67 |ter int |i;..long|
|00000d30| 09 41 2c 53 3b 0d 09 0d | 09 2f 2a 20 46 69 72 73 |.A,S;...|./* Firs|
|00000d40| 74 20 77 65 20 63 61 6c | 63 75 6c 61 74 65 20 74 |t we cal|culate t|
|00000d50| 68 65 20 6e 75 6d 62 65 | 72 20 6f 66 20 70 6f 69 |he numbe|r of poi|
|00000d60| 6e 74 73 0d 09 20 2a 20 | 69 6e 20 74 68 65 20 70 |nts.. * |in the p|
|00000d70| 6f 6c 79 67 6f 6e 2e 0d | 09 20 2a 2f 0d 09 69 20 |olygon..|. */..i |
|00000d80| 3d 20 28 28 2a 50 6f 6c | 79 29 2d 3e 70 6f 6c 79 |= ((*Pol|y)->poly|
|00000d90| 53 69 7a 65 20 2d 20 73 | 69 7a 65 6f 66 28 52 65 |Size - s|izeof(Re|
|00000da0| 63 74 29 20 2d 20 73 69 | 7a 65 6f 66 28 69 6e 74 |ct) - si|zeof(int|
|00000db0| 29 29 0d 09 09 09 2f 28 | 73 69 7a 65 6f 66 28 50 |))..../(|sizeof(P|
|00000dc0| 6f 69 6e 74 29 29 3b 0d | 09 69 66 28 69 20 3c 20 |oint));.|.if(i < |
|00000dd0| 33 29 20 72 65 74 75 72 | 6e 20 30 3b 0d 09 69 2d |3) retur|n 0;..i-|
|00000de0| 2d 3b 09 2f 2a 20 43 20 | 61 72 72 61 79 73 20 72 |-;./* C |arrays r|
|00000df0| 75 6e 20 66 72 6f 6d 20 | 30 20 74 6f 20 6e 2d 31 |un from |0 to n-1|
|00000e00| 20 2a 2f 0d 09 53 20 3d | 20 28 2a 50 6f 6c 79 29 | */..S =| (*Poly)|
|00000e10| 2d 3e 70 6f 6c 79 50 6f | 69 6e 74 73 5b 30 5d 2e |->polyPo|ints[0].|
|00000e20| 68 20 2a 20 28 2a 50 6f | 6c 79 29 2d 3e 70 6f 6c |h * (*Po|ly)->pol|
|00000e30| 79 50 6f 69 6e 74 73 5b | 69 5d 2e 76 3b 0d 09 41 |yPoints[|i].v;..A|
|00000e40| 20 3d 20 28 2a 50 6f 6c | 79 29 2d 3e 70 6f 6c 79 | = (*Pol|y)->poly|
|00000e50| 50 6f 69 6e 74 73 5b 30 | 5d 2e 76 20 2a 20 28 2a |Points[0|].v * (*|
|00000e60| 50 6f 6c 79 29 2d 3e 70 | 6f 6c 79 50 6f 69 6e 74 |Poly)->p|olyPoint|
|00000e70| 73 5b 69 5d 2e 68 3b 0d | 09 64 6f 20 7b 0d 09 09 |s[i].h;.|.do {...|
|00000e80| 69 2d 2d 3b 0d 09 09 53 | 20 2b 3d 20 28 2a 50 6f |i--;...S| += (*Po|
|00000e90| 6c 79 29 2d 3e 70 6f 6c | 79 50 6f 69 6e 74 73 5b |ly)->pol|yPoints[|
|00000ea0| 69 2b 31 5d 2e 68 20 2a | 20 0d 09 09 09 09 28 2a |i+1].h *| .....(*|
|00000eb0| 50 6f 6c 79 29 2d 3e 70 | 6f 6c 79 50 6f 69 6e 74 |Poly)->p|olyPoint|
|00000ec0| 73 5b 69 5d 2e 76 3b 0d | 09 09 41 20 2b 3d 20 28 |s[i].v;.|..A += (|
|00000ed0| 2a 50 6f 6c 79 29 2d 3e | 70 6f 6c 79 50 6f 69 6e |*Poly)->|polyPoin|
|00000ee0| 74 73 5b 69 2b 31 5d 2e | 76 20 2a 0d 09 09 09 09 |ts[i+1].|v *.....|
|00000ef0| 28 2a 50 6f 6c 79 29 2d | 3e 70 6f 6c 79 50 6f 69 |(*Poly)-|>polyPoi|
|00000f00| 6e 74 73 5b 69 5d 2e 68 | 3b 0d 09 7d 20 77 68 69 |nts[i].h|;..} whi|
|00000f10| 6c 65 28 69 20 3e 20 30 | 29 3b 09 09 2f 2a 20 53 |le(i > 0|);../* S|
|00000f20| 74 6f 70 20 77 68 65 6e | 20 69 20 3d 20 30 20 2a |top when| i = 0 *|
|00000f30| 2f 0d 09 2f 2a 0d 09 20 | 2a 20 4e 6f 77 20 77 65 |/../*.. |* Now we|
|00000f40| 20 63 61 6c 63 75 6c 61 | 74 65 20 74 68 65 20 61 | calcula|te the a|
|00000f50| 72 65 61 20 6f 66 20 74 | 68 65 20 70 6f 6c 79 67 |rea of t|he polyg|
|00000f60| 6f 6e 20 61 6e 64 20 72 | 65 74 75 72 6e 20 69 74 |on and r|eturn it|
|00000f70| 2e 0d 09 20 2a 2f 0d 09 | 69 66 28 41 20 3c 20 53 |... */..|if(A < S|
|00000f80| 29 20 7b 0d 09 09 41 20 | 3d 20 28 53 20 2d 20 41 |) {...A |= (S - A|
|00000f90| 29 2f 32 3b 0d 09 7d 20 | 65 6c 73 65 20 7b 0d 09 |)/2;..} |else {..|
|00000fa0| 09 41 20 3d 20 28 41 20 | 2d 20 53 29 2f 32 3b 0d |.A = (A |- S)/2;.|
|00000fb0| 09 7d 0d 09 72 65 74 75 | 72 6e 28 41 29 3b 0d 7d |.}..retu|rn(A);.}|
|00000fc0| 0d 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ff0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001000| 00 00 01 00 00 00 01 22 | 00 00 00 22 00 00 00 5a |......."|..."...Z|
|00001010| 00 04 00 3a 26 f2 40 00 | 00 04 00 19 1b 3a 60 00 |...:&.@.|.....:`.|
|00001020| 00 02 00 19 1b 42 60 00 | 00 02 00 43 29 ea 48 00 |.....B`.|...C).H.|
|00001030| 0e 70 6f 6c 79 67 6f 6e | 20 61 72 65 61 2e 63 70 |.polygon| area.cp|
|00001040| 02 00 00 00 54 45 58 54 | 41 49 46 43 01 00 00 14 |....TEXT|AIFC....|
|00001050| 00 00 54 45 58 54 41 49 | 46 43 01 00 00 14 00 c0 |..TEXTAI|FC......|
|00001060| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001070| 00 00 a5 e3 92 6b 00 00 | 0f 41 00 00 01 7c 40 00 |.....k..|.A...|@.|
|00001080| 00 00 00 3a 27 0a 40 00 | 00 04 00 06 0d d2 40 00 |...:'.@.|......@.|
|00001090| 00 04 00 41 29 2a 40 00 | 00 04 00 37 25 ca 40 00 |...A)*@.|...7%.@.|
|000010a0| 00 04 00 1e 1d 92 60 00 | 00 02 00 37 25 d2 40 00 |......`.|...7%.@.|
|000010b0| 00 04 00 1e 1d 0a 48 00 | 00 00 00 1e 1d b2 60 00 |......H.|......`.|
|000010c0| 00 02 00 1e 1d ca 60 00 | 00 02 00 1e 1d 9a 48 00 |......`.|......H.|
|000010d0| 00 00 00 1e 1d a2 60 00 | 00 02 00 3b 27 42 60 00 |......`.|...;'B`.|
|000010e0| 00 02 00 3b 27 4a 60 00 | 00 02 00 1e 1d 0a 48 00 |...;'J`.|......H.|
|000010f0| 00 00 00 1e 1d b2 60 00 | 00 02 00 1e 1d ca 60 00 |......`.|......`.|
|00001100| 00 00 00 0a 00 09 06 4d | 6f 6e 61 63 6f 00 00 00 |.......M|onaco...|
|00001110| 00 08 00 46 00 14 01 76 | 01 f1 00 00 00 04 00 30 |...F...v|.......0|
|00001120| 00 08 00 00 01 00 00 00 | 01 22 00 00 00 22 00 00 |........|."..."..|
|00001130| 00 5a 00 1c f0 b0 08 d2 | 00 00 00 1c 00 5a 00 02 |.Z......|.....Z..|
|00001140| 45 46 4e 54 00 00 00 1a | 45 57 4e 44 00 00 00 26 |EFNT....|EWND...&|
|00001150| 45 54 41 42 00 00 00 32 | 03 eb ff ff 00 00 00 00 |ETAB...2|........|
|00001160| 00 1d 9a d0 01 00 ff ff | 00 00 00 0e 00 1d 9c d8 |........|........|
|00001170| 03 ec ff ff 00 00 00 1a | 00 1d 3f 74 00 00 00 00 |........|..?t....|
+--------+-------------------------+-------------------------+--------+--------+