home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1989-09-14 | 5.9 KB | [TEXT/KAHL] |
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: plotcircle.c.bin
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| AMOS Picture Packer (image/amosPicturePacker)
| ext
| Supported |
1%
| dexvert
| Debian floppy split (archive/debianFloppySplit)
| ext
| Unsupported |
1%
| dexvert
| Sound Images sound sample (audio/soundImagesSoundSample)
| ext
| Unsupported |
1%
| dexvert
| DESI-III drawing (image/desiIIIDrawing)
| ext
| Unsupported |
1%
| dexvert
| MS-DOS PMODE extender executable (executable/msdosPMODEExtenderExecutable)
| ext
| Unsupported |
1%
| dexvert
| Alien Trilogytextures (other/alienTrilogyTextures)
| ext
| Unsupported |
1%
| dexvert
| APT cache data (other/aptCacheData)
| ext
| Unsupported |
1%
| dexvert
| CorelTRACE configuration (other/corelTRACEConfiguration)
| ext
| Unsupported |
1%
| dexvert
| Dreamcast Disc (other/dreamcastDisc)
| ext
| Unsupported |
1%
| dexvert
| EST flat binary (other/estFlatBinary)
| ext
| Unsupported |
1%
| dexvert
| Finale Enigma Binary Format (other/finaleEnigmaBinaryFormat)
| ext
| Unsupported |
1%
| dexvert
| Sega Genesis/Megadrive/32x ROM (other/genesisROM)
| ext
| Unsupported |
1%
| dexvert
| Myth: The Fallen Lords game archive (other/mythTheFallenLordsGameArchive)
| ext
| Unsupported |
1%
| dexvert
| Sound Images Sound Driver (other/soundImagesSoundDriver)
| ext
| Unsupported |
1%
| dexvert
| Symantec/Norton Config (other/symantecNortonConfig)
| ext
| Unsupported |
1%
| dexvert
| Vectrex ROM (other/vectrexROM)
| ext
| Unsupported |
1%
| dexvert
| BIS raP encoded format (other/bisraPEncoded)
| ext
| Unsupported |
1%
| dexvert
| Pascal Script binary (other/pascalScriptBinary)
| ext
| Unsupported |
1%
| dexvert
| 7th Level game data archive (other/seventhLevelGameDataArchive)
| ext
| Unsupported |
1%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Binary Text (image/binaryText)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary, Sun Feb 12 15:49:58 1989, modified Sun Mar 5 18:58:30 1989, creator Think C, type ASCII, 5818 bytes "plotcircle.c"
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 1
| default (weak)
| |
100%
| lsar
| MacBinary
| default
| |
100%
| gt2
| MAC Bilddatei
| default (weak)
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [KAHL] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 70 6c 6f 74 63 69 | 72 63 6c 65 2e 63 00 00 |..plotci|rcle.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 4b 41 48 | 4c 00 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 16 ba 00 | 00 00 00 a0 1b 9e 76 a0 |........|......v.|
|00000060| 37 7a 26 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |7z&.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000080| 23 69 6e 63 6c 75 64 65 | 20 3c 73 74 64 69 6f 2e |#include| <stdio.|
|00000090| 68 3e 0d 0d 0d 23 64 65 | 66 69 6e 65 09 49 5f 52 |h>...#de|fine.I_R|
|000000a0| 41 44 49 55 53 09 09 34 | 30 09 09 09 09 2f 2a 20 |ADIUS..4|0..../* |
|000000b0| 52 61 64 69 75 73 20 6f | 66 20 69 6e 6e 65 72 20 |Radius o|f inner |
|000000c0| 63 69 72 63 6c 65 20 2a | 2f 0d 23 64 65 66 69 6e |circle *|/.#defin|
|000000d0| 65 09 4f 5f 52 41 44 49 | 55 53 09 09 36 30 09 09 |e.O_RADI|US..60..|
|000000e0| 09 09 2f 2a 20 52 61 64 | 69 75 73 20 6f 66 20 6f |../* Rad|ius of o|
|000000f0| 75 74 65 72 20 63 69 72 | 63 6c 65 20 2a 2f 0d 23 |uter cir|cle */.#|
|00000100| 64 65 66 69 6e 65 09 43 | 5f 52 41 44 49 55 53 09 |define.C|_RADIUS.|
|00000110| 09 35 09 09 09 09 2f 2a | 20 52 61 64 69 75 73 20 |.5..../*| Radius |
|00000120| 6f 66 20 63 65 6e 74 65 | 72 20 72 61 64 69 75 73 |of cente|r radius|
|00000130| 20 2a 2f 0d 23 64 65 66 | 69 6e 65 09 43 45 4e 54 | */.#def|ine.CENT|
|00000140| 45 52 5f 58 09 09 30 0d | 23 64 65 66 69 6e 65 09 |ER_X..0.|#define.|
|00000150| 43 45 4e 54 45 52 5f 59 | 09 09 30 0d 23 64 65 66 |CENTER_Y|..0.#def|
|00000160| 69 6e 65 09 4d 41 58 5f | 50 54 53 09 09 09 31 30 |ine.MAX_|PTS...10|
|00000170| 30 30 0d 23 64 65 66 69 | 6e 65 09 58 5f 43 4f 4f |00.#defi|ne.X_COO|
|00000180| 52 44 09 09 09 31 0d 23 | 64 65 66 69 6e 65 09 59 |RD...1.#|define.Y|
|00000190| 5f 43 4f 4f 52 44 09 09 | 09 32 0d 23 64 65 66 69 |_COORD..|.2.#defi|
|000001a0| 6e 65 09 49 5f 50 4f 49 | 4e 54 53 09 09 31 0d 23 |ne.I_POI|NTS..1.#|
|000001b0| 64 65 66 69 6e 65 09 4f | 5f 50 4f 49 4e 54 53 09 |define.O|_POINTS.|
|000001c0| 09 32 0d 23 64 65 66 69 | 6e 65 09 43 5f 50 4f 49 |.2.#defi|ne.C_POI|
|000001d0| 4e 54 53 09 09 33 0d 0d | 0d 2f 2a 20 54 68 69 73 |NTS..3..|./* This|
|000001e0| 20 69 73 20 74 68 65 20 | 72 65 70 72 65 73 65 6e | is the |represen|
|000001f0| 74 61 74 69 6f 6e 20 6f | 66 20 61 20 70 6f 69 6e |tation o|f a poin|
|00000200| 74 2e 20 2a 2f 0d 73 74 | 72 75 63 74 09 78 79 5f |t. */.st|ruct.xy_|
|00000210| 70 74 20 7b 0d 09 69 6e | 74 09 09 78 3b 0d 09 69 |pt {..in|t..x;..i|
|00000220| 6e 74 09 09 79 3b 0d 7d | 20 70 74 5b 4d 41 58 5f |nt..y;.}| pt[MAX_|
|00000230| 50 54 53 5d 3b 0d 0d 2f | 2a 20 41 72 72 61 79 20 |PTS];../|* Array |
|00000240| 69 6e 64 65 78 20 69 6e | 74 6f 20 77 68 69 63 68 |index in|to which|
|00000250| 20 74 6f 20 67 65 6e 65 | 72 61 74 65 20 74 68 65 | to gene|rate the|
|00000260| 20 6e 65 78 74 20 70 6f | 69 6e 74 2e 20 2a 2f 0d | next po|int. */.|
|00000270| 69 6e 74 20 6e 75 6d 5f | 70 74 73 3b 0d 0d 0d 2f |int num_|pts;.../|
|00000280| 2a 20 46 69 6c 65 20 69 | 6e 74 6f 20 77 68 69 63 |* File i|nto whic|
|00000290| 68 20 74 68 65 20 64 61 | 74 61 20 69 73 20 77 72 |h the da|ta is wr|
|000002a0| 69 74 74 65 6e 2e 20 2a | 2f 0d 46 49 4c 45 09 2a |itten. *|/.FILE.*|
|000002b0| 66 70 3b 0d 0d 0d 2f 2a | 20 4c 6f 63 61 6c 20 46 |fp;.../*| Local F|
|000002c0| 75 6e 63 74 69 6f 6e 20 | 70 72 6f 74 6f 74 79 70 |unction |prototyp|
|000002d0| 65 73 2e 20 2a 2f 0d 76 | 6f 69 64 09 63 69 72 63 |es. */.v|oid.circ|
|000002e0| 6c 65 28 69 6e 74 20 78 | 63 2c 20 69 6e 74 20 79 |le(int x|c, int y|
|000002f0| 5f 63 65 6e 74 65 72 2c | 20 69 6e 74 20 72 61 64 |_center,| int rad|
|00000300| 69 75 73 29 3b 0d 69 6e | 74 09 09 73 6f 72 74 28 |ius);.in|t..sort(|
|00000310| 73 74 72 75 63 74 20 78 | 79 5f 70 74 20 2a 2c 20 |struct x|y_pt *, |
|00000320| 69 6e 74 2c 20 69 6e 74 | 29 3b 0d 69 6e 74 09 09 |int, int|);.int..|
|00000330| 63 6f 6d 70 61 72 65 28 | 73 74 72 75 63 74 20 78 |compare(|struct x|
|00000340| 79 5f 70 74 2c 20 73 74 | 72 75 63 74 20 78 79 5f |y_pt, st|ruct xy_|
|00000350| 70 74 2c 20 69 6e 74 29 | 3b 0d 69 6e 74 09 09 73 |pt, int)|;.int..s|
|00000360| 77 61 70 28 73 74 72 75 | 63 74 20 78 79 5f 70 74 |wap(stru|ct xy_pt|
|00000370| 20 2a 2c 20 73 74 72 75 | 63 74 20 78 79 5f 70 74 | *, stru|ct xy_pt|
|00000380| 20 2a 29 3b 0d 0d 0d 0d | 0d 0d 6d 61 69 6e 28 29 | *);....|..main()|
|00000390| 0d 7b 0d 09 69 66 20 28 | 28 66 70 20 3d 20 66 6f |.{..if (|(fp = fo|
|000003a0| 70 65 6e 28 22 63 69 72 | 63 6c 65 64 61 74 61 2e |pen("cir|cledata.|
|000003b0| 68 22 2c 20 22 77 22 29 | 29 20 21 3d 20 4e 55 4c |h", "w")|) != NUL|
|000003c0| 4c 29 20 7b 0d 09 09 2f | 2a 20 47 65 6e 65 72 61 |L) {.../|* Genera|
|000003d0| 74 65 20 74 68 65 20 73 | 65 74 20 6f 66 20 69 6e |te the s|et of in|
|000003e0| 74 65 72 69 6f 72 20 70 | 6f 69 6e 74 73 20 2a 2f |terior p|oints */|
|000003f0| 0d 09 09 63 69 72 63 6c | 65 28 43 45 4e 54 45 52 |...circl|e(CENTER|
|00000400| 5f 58 2c 20 43 45 4e 54 | 45 52 5f 59 2c 20 49 5f |_X, CENT|ER_Y, I_|
|00000410| 52 41 44 49 55 53 29 3b | 09 09 2f 2a 20 47 65 6e |RADIUS);|../* Gen|
|00000420| 65 72 61 74 65 20 74 68 | 65 20 70 6f 69 6e 74 73 |erate th|e points|
|00000430| 2e 20 2a 2f 0d 09 09 73 | 6f 72 74 70 6f 69 6e 74 |. */...s|ortpoint|
|00000440| 73 28 29 3b 09 09 09 09 | 09 09 09 09 2f 2a 20 53 |s();....|..../* S|
|00000450| 6f 72 74 20 74 68 65 20 | 70 6f 69 6e 74 73 20 62 |ort the |points b|
|00000460| 79 20 78 2c 79 20 2a 2f | 0d 09 09 65 6c 69 6d 69 |y x,y */|...elimi|
|00000470| 6e 61 74 65 5f 64 75 70 | 6c 69 63 61 74 65 73 28 |nate_dup|licates(|
|00000480| 29 3b 09 09 09 09 09 09 | 2f 2a 20 44 75 70 6c 69 |);......|/* Dupli|
|00000490| 63 61 74 65 20 70 6f 69 | 6e 74 73 20 61 72 65 6e |cate poi|nts aren|
|000004a0| 27 74 20 6e 65 65 64 65 | 64 20 2a 2f 0d 09 09 67 |'t neede|d */...g|
|000004b0| 65 6e 65 72 61 74 65 5f | 71 75 61 64 72 61 6e 74 |enerate_|quadrant|
|000004c0| 73 28 29 3b 09 09 09 09 | 09 09 2f 2a 20 46 6c 69 |s();....|../* Fli|
|000004d0| 70 20 71 75 61 64 72 61 | 6e 74 20 31 20 74 68 72 |p quadra|nt 1 thr|
|000004e0| 65 65 20 74 69 6d 65 73 | 2e 20 2a 2f 0d 09 09 64 |ee times|. */...d|
|000004f0| 75 6d 70 70 6f 69 6e 74 | 73 28 49 5f 50 4f 49 4e |umppoint|s(I_POIN|
|00000500| 54 53 29 3b 09 09 09 09 | 09 09 2f 2a 20 50 72 69 |TS);....|../* Pri|
|00000510| 6e 74 20 74 68 65 20 6c | 69 73 74 20 6f 66 20 70 |nt the l|ist of p|
|00000520| 6f 69 6e 74 73 2e 20 2a | 2f 0d 0d 09 09 2f 2a 20 |oints. *|/..../* |
|00000530| 47 65 6e 65 72 61 74 65 | 20 74 68 65 20 73 65 74 |Generate| the set|
|00000540| 20 6f 66 20 6f 75 74 65 | 72 20 70 6f 69 6e 74 73 | of oute|r points|
|00000550| 20 2a 2f 0d 09 09 63 69 | 72 63 6c 65 28 43 45 4e | */...ci|rcle(CEN|
|00000560| 54 45 52 5f 58 2c 20 43 | 45 4e 54 45 52 5f 59 2c |TER_X, C|ENTER_Y,|
|00000570| 20 4f 5f 52 41 44 49 55 | 53 29 3b 09 09 2f 2a 20 | O_RADIU|S);../* |
|00000580| 47 65 6e 65 72 61 74 65 | 20 74 68 65 20 70 6f 69 |Generate| the poi|
|00000590| 6e 74 73 2e 20 2a 2f 0d | 09 09 73 6f 72 74 70 6f |nts. */.|..sortpo|
|000005a0| 69 6e 74 73 28 29 3b 09 | 09 09 09 09 09 09 09 2f |ints();.|......./|
|000005b0| 2a 20 53 6f 72 74 20 74 | 68 65 20 70 6f 69 6e 74 |* Sort t|he point|
|000005c0| 73 20 62 79 20 78 2c 79 | 20 2a 2f 0d 09 09 65 6c |s by x,y| */...el|
|000005d0| 69 6d 69 6e 61 74 65 5f | 64 75 70 6c 69 63 61 74 |iminate_|duplicat|
|000005e0| 65 73 28 29 3b 09 09 09 | 09 09 09 2f 2a 20 44 75 |es();...|.../* Du|
|000005f0| 70 6c 69 63 61 74 65 20 | 70 6f 69 6e 74 73 20 61 |plicate |points a|
|00000600| 72 65 6e 27 74 20 6e 65 | 65 64 65 64 20 2a 2f 0d |ren't ne|eded */.|
|00000610| 09 09 67 65 6e 65 72 61 | 74 65 5f 71 75 61 64 72 |..genera|te_quadr|
|00000620| 61 6e 74 73 28 29 3b 09 | 09 09 09 09 09 2f 2a 20 |ants();.|...../* |
|00000630| 46 6c 69 70 20 71 75 61 | 64 72 61 6e 74 20 31 20 |Flip qua|drant 1 |
|00000640| 74 68 72 65 65 20 74 69 | 6d 65 73 2e 20 2a 2f 0d |three ti|mes. */.|
|00000650| 09 09 64 75 6d 70 70 6f | 69 6e 74 73 28 4f 5f 50 |..dumppo|ints(O_P|
|00000660| 4f 49 4e 54 53 29 3b 09 | 09 09 09 09 09 2f 2a 20 |OINTS);.|...../* |
|00000670| 50 72 69 6e 74 20 74 68 | 65 20 6c 69 73 74 20 6f |Print th|e list o|
|00000680| 66 20 70 6f 69 6e 74 73 | 2e 20 2a 2f 0d 0d 09 09 |f points|. */....|
|00000690| 2f 2a 20 47 65 6e 65 72 | 61 74 65 20 74 68 65 20 |/* Gener|ate the |
|000006a0| 73 65 74 20 6f 66 20 63 | 65 6e 74 65 72 20 70 6f |set of c|enter po|
|000006b0| 69 6e 74 73 20 2a 2f 0d | 09 09 63 69 72 63 6c 65 |ints */.|..circle|
|000006c0| 28 43 45 4e 54 45 52 5f | 58 2c 20 43 45 4e 54 45 |(CENTER_|X, CENTE|
|000006d0| 52 5f 59 2c 20 43 5f 52 | 41 44 49 55 53 29 3b 09 |R_Y, C_R|ADIUS);.|
|000006e0| 09 2f 2a 20 47 65 6e 65 | 72 61 74 65 20 74 68 65 |./* Gene|rate the|
|000006f0| 20 70 6f 69 6e 74 73 2e | 20 2a 2f 0d 09 09 73 6f | points.| */...so|
|00000700| 72 74 70 6f 69 6e 74 73 | 28 29 3b 09 09 09 09 09 |rtpoints|();.....|
|00000710| 09 09 09 2f 2a 20 53 6f | 72 74 20 74 68 65 20 70 |.../* So|rt the p|
|00000720| 6f 69 6e 74 73 20 62 79 | 20 78 2c 79 20 2a 2f 0d |oints by| x,y */.|
|00000730| 09 09 65 6c 69 6d 69 6e | 61 74 65 5f 64 75 70 6c |..elimin|ate_dupl|
|00000740| 69 63 61 74 65 73 28 29 | 3b 09 09 09 09 09 09 2f |icates()|;....../|
|00000750| 2a 20 44 75 70 6c 69 63 | 61 74 65 20 70 6f 69 6e |* Duplic|ate poin|
|00000760| 74 73 20 61 72 65 6e 27 | 74 20 6e 65 65 64 65 64 |ts aren'|t needed|
|00000770| 20 2a 2f 0d 09 09 67 65 | 6e 65 72 61 74 65 5f 71 | */...ge|nerate_q|
|00000780| 75 61 64 72 61 6e 74 73 | 28 29 3b 09 09 09 09 09 |uadrants|();.....|
|00000790| 09 2f 2a 20 46 6c 69 70 | 20 71 75 61 64 72 61 6e |./* Flip| quadran|
|000007a0| 74 20 31 20 74 68 72 65 | 65 20 74 69 6d 65 73 2e |t 1 thre|e times.|
|000007b0| 20 2a 2f 0d 09 09 64 75 | 6d 70 70 6f 69 6e 74 73 | */...du|mppoints|
|000007c0| 28 43 5f 50 4f 49 4e 54 | 53 29 3b 09 09 09 09 09 |(C_POINT|S);.....|
|000007d0| 09 2f 2a 20 50 72 69 6e | 74 20 74 68 65 20 6c 69 |./* Prin|t the li|
|000007e0| 73 74 20 6f 66 20 70 6f | 69 6e 74 73 2e 20 2a 2f |st of po|ints. */|
|000007f0| 0d 0d 09 09 66 63 6c 6f | 73 65 28 66 70 29 3b 0d |....fclo|se(fp);.|
|00000800| 09 7d 0d 7d 0d 0d 0d 0d | 76 6f 69 64 0d 63 69 72 |.}.}....|void.cir|
|00000810| 63 6c 65 28 78 5f 63 65 | 6e 74 65 72 2c 20 79 5f |cle(x_ce|nter, y_|
|00000820| 63 65 6e 74 65 72 2c 20 | 72 61 64 69 75 73 29 0d |center, |radius).|
|00000830| 09 69 6e 74 20 78 5f 63 | 65 6e 74 65 72 2c 20 79 |.int x_c|enter, y|
|00000840| 5f 63 65 6e 74 65 72 20 | 2c 72 61 64 69 75 73 3b |_center |,radius;|
|00000850| 0d 7b 0d 09 69 6e 74 20 | 09 78 2c 79 2c 64 3b 0d |.{..int |.x,y,d;.|
|00000860| 09 0d 09 6e 75 6d 5f 70 | 74 73 20 3d 20 30 3b 0d |...num_p|ts = 0;.|
|00000870| 09 79 20 3d 20 72 61 64 | 69 75 73 3b 0d 09 64 20 |.y = rad|ius;..d |
|00000880| 3d 20 33 20 2d 20 32 20 | 2a 20 72 61 64 69 75 73 |= 3 - 2 |* radius|
|00000890| 3b 0d 09 0d 09 0d 09 2f | 2a 20 55 73 65 20 78 2c |;....../|* Use x,|
|000008a0| 79 20 74 6f 20 63 6f 6e | 74 72 6f 6c 20 74 68 65 |y to con|trol the|
|000008b0| 20 70 6c 6f 74 74 69 6e | 67 20 6f 66 20 74 68 65 | plottin|g of the|
|000008c0| 20 66 69 72 73 74 20 6f | 63 74 61 6e 74 2e 20 2a | first o|ctant. *|
|000008d0| 2f 0d 09 66 6f 72 20 28 | 78 20 3d 20 30 3b 20 78 |/..for (|x = 0; x|
|000008e0| 20 3c 20 79 3b 29 20 7b | 0d 09 09 69 66 20 28 6e | < y;) {|...if (n|
|000008f0| 75 6d 5f 70 74 73 20 2b | 20 31 20 3e 3d 20 4d 41 |um_pts +| 1 >= MA|
|00000900| 58 5f 50 54 53 29 0d 09 | 09 09 72 65 74 75 72 6e |X_PTS)..|..return|
|00000910| 3b 0d 09 09 70 74 5b 6e | 75 6d 5f 70 74 73 5d 2e |;...pt[n|um_pts].|
|00000920| 78 20 20 20 3d 20 20 78 | 20 2b 20 78 5f 63 65 6e |x = x| + x_cen|
|00000930| 74 65 72 3b 0d 09 09 70 | 74 5b 6e 75 6d 5f 70 74 |ter;...p|t[num_pt|
|00000940| 73 2b 2b 5d 2e 79 20 3d | 20 2d 79 20 2b 20 79 5f |s++].y =| -y + y_|
|00000950| 63 65 6e 74 65 72 3b 0d | 09 09 70 74 5b 6e 75 6d |center;.|..pt[num|
|00000960| 5f 70 74 73 5d 2e 78 20 | 20 20 3d 20 20 79 20 2b |_pts].x | = y +|
|00000970| 20 78 5f 63 65 6e 74 65 | 72 3b 0d 09 09 70 74 5b | x_cente|r;...pt[|
|00000980| 6e 75 6d 5f 70 74 73 2b | 2b 5d 2e 79 20 3d 20 2d |num_pts+|+].y = -|
|00000990| 78 20 2b 20 79 5f 63 65 | 6e 74 65 72 3b 0d 09 09 |x + y_ce|nter;...|
|000009a0| 69 66 20 28 64 20 3c 20 | 30 29 0d 09 09 09 64 20 |if (d < |0)....d |
|000009b0| 2b 3d 20 34 20 2a 20 78 | 20 2b 20 36 3b 0d 09 09 |+= 4 * x| + 6;...|
|000009c0| 65 6c 73 65 20 7b 0d 09 | 09 09 64 20 2b 3d 20 34 |else {..|..d += 4|
|000009d0| 20 2a 20 28 78 20 2d 20 | 79 29 20 2b 20 31 30 3b | * (x - |y) + 10;|
|000009e0| 0d 09 09 09 2d 2d 79 3b | 0d 09 09 7d 0d 09 09 2b |....--y;|...}...+|
|000009f0| 2b 78 3b 0d 09 7d 0d 09 | 0d 09 2f 2a 20 49 66 20 |+x;..}..|../* If |
|00000a00| 77 65 20 68 61 70 70 65 | 6e 65 64 20 74 6f 20 6c |we happe|ned to l|
|00000a10| 61 6e 64 20 6f 6e 20 74 | 68 65 20 6c 61 73 74 20 |and on t|he last |
|00000a20| 70 6f 69 6e 74 2c 20 61 | 64 64 20 69 74 20 74 6f |point, a|dd it to|
|00000a30| 20 74 68 65 20 6c 69 73 | 74 20 2a 2f 0d 09 69 66 | the lis|t */..if|
|00000a40| 20 28 78 20 3d 3d 20 79 | 29 20 7b 0d 09 09 70 74 | (x == y|) {...pt|
|00000a50| 5b 6e 75 6d 5f 70 74 73 | 5d 2e 78 20 20 20 3d 20 |[num_pts|].x = |
|00000a60| 20 78 20 2b 20 78 5f 63 | 65 6e 74 65 72 3b 0d 09 | x + x_c|enter;..|
|00000a70| 09 70 74 5b 6e 75 6d 5f | 70 74 73 2b 2b 5d 2e 79 |.pt[num_|pts++].y|
|00000a80| 20 3d 20 2d 79 20 2b 20 | 79 5f 63 65 6e 74 65 72 | = -y + |y_center|
|00000a90| 3b 0d 09 7d 0d 09 09 0d | 09 66 70 72 69 6e 74 66 |;..}....|.fprintf|
|00000aa0| 28 66 70 2c 22 5c 6e 22 | 29 3b 0d 7d 0d 0d 0d 0d |(fp,"\n"|);.}....|
|00000ab0| 73 6f 72 74 70 6f 69 6e | 74 73 28 29 0d 7b 0d 09 |sortpoin|ts().{..|
|00000ac0| 73 6f 72 74 28 70 74 2c | 6e 75 6d 5f 70 74 73 2c |sort(pt,|num_pts,|
|00000ad0| 58 5f 43 4f 4f 52 44 29 | 3b 0d 09 73 6f 72 74 28 |X_COORD)|;..sort(|
|00000ae0| 70 74 2c 6e 75 6d 5f 70 | 74 73 2c 59 5f 43 4f 4f |pt,num_p|ts,Y_COO|
|00000af0| 52 44 29 3b 0d 7d 0d 0d | 0d 0d 65 6c 69 6d 69 6e |RD);.}..|..elimin|
|00000b00| 61 74 65 5f 64 75 70 6c | 69 63 61 74 65 73 28 29 |ate_dupl|icates()|
|00000b10| 0d 7b 0d 7d 0d 0d 0d 0d | 69 6e 74 0d 67 65 6e 65 |.{.}....|int.gene|
|00000b20| 72 61 74 65 5f 71 75 61 | 64 72 61 6e 74 73 28 29 |rate_qua|drants()|
|00000b30| 0d 7b 0d 09 69 6e 74 20 | 69 3b 0d 09 0d 09 2f 2a |.{..int |i;..../*|
|00000b40| 20 0d 09 20 2a 20 53 65 | 63 6f 6e 64 20 71 75 61 | .. * Se|cond qua|
|00000b50| 64 72 61 6e 74 20 73 61 | 6d 65 20 61 73 20 66 69 |drant sa|me as fi|
|00000b60| 72 73 74 20 77 69 74 68 | 20 61 20 70 6f 73 69 74 |rst with| a posit|
|00000b70| 69 76 65 20 79 20 63 6f | 6f 72 64 69 6e 61 74 65 |ive y co|ordinate|
|00000b80| 73 2e 0d 09 20 2a 20 4e | 6f 74 65 20 74 68 61 74 |s... * N|ote that|
|00000b90| 20 74 68 65 20 65 6e 64 | 20 70 6f 69 6e 74 73 20 | the end| points |
|00000ba0| 61 72 65 20 6e 6f 74 20 | 64 75 70 6c 69 63 61 74 |are not |duplicat|
|00000bb0| 65 64 2e 0d 09 20 2a 2f | 0d 09 66 6f 72 20 28 69 |ed... */|..for (i|
|00000bc0| 20 3d 20 6e 75 6d 5f 70 | 74 73 20 2d 20 31 3b 20 | = num_p|ts - 1; |
|00000bd0| 69 20 3e 3d 20 30 3b 20 | 2d 2d 69 29 20 7b 0d 09 |i >= 0; |--i) {..|
|00000be0| 09 70 74 5b 6e 75 6d 5f | 70 74 73 5d 2e 78 20 3d |.pt[num_|pts].x =|
|00000bf0| 20 20 70 74 5b 69 5d 2e | 78 3b 0d 09 09 70 74 5b | pt[i].|x;...pt[|
|00000c00| 6e 75 6d 5f 70 74 73 5d | 2e 79 20 3d 20 2d 70 74 |num_pts]|.y = -pt|
|00000c10| 5b 69 5d 2e 79 3b 0d 09 | 09 2b 2b 6e 75 6d 5f 70 |[i].y;..|.++num_p|
|00000c20| 74 73 3b 0d 09 7d 0d 09 | 0d 09 0d 09 2f 2a 20 33 |ts;..}..|..../* 3|
|00000c30| 72 64 20 26 20 34 74 68 | 20 71 75 61 64 72 61 6e |rd & 4th| quadran|
|00000c40| 74 73 20 73 61 6d 65 20 | 61 73 20 31 73 74 20 26 |ts same |as 1st &|
|00000c50| 20 32 6e 64 20 77 69 74 | 68 20 6e 65 67 61 74 69 | 2nd wit|h negati|
|00000c60| 76 65 20 78 20 63 6f 6f | 72 64 69 6e 61 74 65 73 |ve x coo|rdinates|
|00000c70| 20 2a 2f 0d 09 66 6f 72 | 20 28 69 20 3d 20 6e 75 | */..for| (i = nu|
|00000c80| 6d 5f 70 74 73 20 2d 20 | 31 3b 20 69 20 3e 3d 20 |m_pts - |1; i >= |
|00000c90| 30 3b 20 2d 2d 69 29 20 | 7b 0d 09 09 70 74 5b 6e |0; --i) |{...pt[n|
|00000ca0| 75 6d 5f 70 74 73 5d 2e | 78 20 3d 20 2d 70 74 5b |um_pts].|x = -pt[|
|00000cb0| 69 5d 2e 78 3b 0d 09 09 | 70 74 5b 6e 75 6d 5f 70 |i].x;...|pt[num_p|
|00000cc0| 74 73 5d 2e 79 20 3d 20 | 70 74 5b 69 5d 2e 79 3b |ts].y = |pt[i].y;|
|00000cd0| 0d 09 09 2b 2b 6e 75 6d | 5f 70 74 73 3b 0d 09 7d |...++num|_pts;..}|
|00000ce0| 0d 7d 0d 0d 0d 0d 69 6e | 74 0d 64 75 6d 70 70 6f |.}....in|t.dumppo|
|00000cf0| 69 6e 74 73 28 74 79 70 | 65 29 0d 09 69 6e 74 09 |ints(typ|e)..int.|
|00000d00| 09 74 79 70 65 3b 0d 7b | 0d 09 69 6e 74 20 69 3b |.type;.{|..int i;|
|00000d10| 0d 09 69 6e 74 20 63 6f | 6c 73 20 3d 20 30 3b 0d |..int co|ls = 0;.|
|00000d20| 09 0d 09 0d 09 2f 2a 20 | 50 72 69 6e 74 20 6f 75 |...../* |Print ou|
|00000d30| 74 20 74 68 65 20 74 69 | 74 6c 65 2e 20 2a 2f 0d |t the ti|tle. */.|
|00000d40| 09 66 70 72 69 6e 74 66 | 28 66 70 2c 20 22 2f 2a |.fprintf|(fp, "/*|
|00000d50| 5c 6e 22 29 3b 0d 09 66 | 70 72 69 6e 74 66 28 66 |\n");..f|printf(f|
|00000d60| 70 2c 20 22 20 2a 20 50 | 6f 69 6e 74 73 20 6f 66 |p, " * P|oints of|
|00000d70| 20 61 20 63 69 72 63 6c | 65 20 77 69 74 68 20 6f | a circl|e with o|
|00000d80| 72 69 67 69 6e 20 61 74 | 20 25 64 2c 25 64 20 22 |rigin at| %d,%d "|
|00000d90| 2c 20 43 45 4e 54 45 52 | 5f 58 2c 20 43 45 4e 54 |, CENTER|_X, CENT|
|00000da0| 45 52 5f 59 29 3b 0d 09 | 69 66 20 28 74 79 70 65 |ER_Y);..|if (type|
|00000db0| 20 3d 3d 20 49 5f 50 4f | 49 4e 54 53 29 20 7b 0d | == I_PO|INTS) {.|
|00000dc0| 09 09 66 70 72 69 6e 74 | 66 28 66 70 2c 20 22 20 |..fprint|f(fp, " |
|00000dd0| 2a 20 77 69 74 68 20 61 | 20 72 61 64 69 75 73 20 |* with a| radius |
|00000de0| 6f 66 3a 20 25 64 5c 6e | 22 2c 20 49 5f 52 41 44 |of: %d\n|", I_RAD|
|00000df0| 49 55 53 29 3b 0d 09 09 | 66 70 72 69 6e 74 66 28 |IUS);...|fprintf(|
|00000e00| 66 70 2c 20 22 20 2a 2f | 5c 6e 5c 6e 22 29 3b 0d |fp, " */|\n\n");.|
|00000e10| 09 09 66 70 72 69 6e 74 | 66 28 66 70 2c 22 23 64 |..fprint|f(fp,"#d|
|00000e20| 65 66 69 6e 65 5c 74 5c | 74 43 45 4e 54 45 52 5f |efine\t\|tCENTER_|
|00000e30| 58 5c 74 5c 74 5c 74 25 | 64 5c 6e 22 2c 20 43 45 |X\t\t\t%|d\n", CE|
|00000e40| 4e 54 45 52 5f 58 29 3b | 0d 09 09 66 70 72 69 6e |NTER_X);|...fprin|
|00000e50| 74 66 28 66 70 2c 22 23 | 64 65 66 69 6e 65 5c 74 |tf(fp,"#|define\t|
|00000e60| 5c 74 43 45 4e 54 45 52 | 5f 59 5c 74 5c 74 5c 74 |\tCENTER|_Y\t\t\t|
|00000e70| 25 64 5c 6e 5c 6e 22 2c | 20 43 45 4e 54 45 52 5f |%d\n\n",| CENTER_|
|00000e80| 59 29 3b 0d 09 09 66 70 | 72 69 6e 74 66 28 66 70 |Y);...fp|rintf(fp|
|00000e90| 2c 22 23 64 65 66 69 6e | 65 5c 74 5c 74 49 5f 52 |,"#defin|e\t\tI_R|
|00000ea0| 41 44 49 55 53 5c 74 5c | 74 5c 74 25 64 5c 6e 22 |ADIUS\t\|t\t%d\n"|
|00000eb0| 2c 20 49 5f 52 41 44 49 | 55 53 29 3b 0d 09 09 66 |, I_RADI|US);...f|
|00000ec0| 70 72 69 6e 74 66 28 66 | 70 2c 22 23 64 65 66 69 |printf(f|p,"#defi|
|00000ed0| 6e 65 5c 74 5c 74 4e 55 | 4d 5f 49 5f 50 4f 49 4e |ne\t\tNU|M_I_POIN|
|00000ee0| 54 53 5c 74 5c 74 25 64 | 5c 6e 5c 6e 22 2c 6e 75 |TS\t\t%d|\n\n",nu|
|00000ef0| 6d 5f 70 74 73 29 3b 0d | 09 7d 0d 09 65 6c 73 65 |m_pts);.|.}..else|
|00000f00| 20 69 66 20 28 74 79 70 | 65 20 3d 3d 20 4f 5f 50 | if (typ|e == O_P|
|00000f10| 4f 49 4e 54 53 29 20 7b | 0d 09 09 66 70 72 69 6e |OINTS) {|...fprin|
|00000f20| 74 66 28 66 70 2c 20 22 | 77 69 74 68 20 61 20 72 |tf(fp, "|with a r|
|00000f30| 61 64 69 75 73 20 6f 66 | 3a 20 25 64 5c 6e 22 2c |adius of|: %d\n",|
|00000f40| 20 4f 5f 52 41 44 49 55 | 53 29 3b 0d 09 09 66 70 | O_RADIU|S);...fp|
|00000f50| 72 69 6e 74 66 28 66 70 | 2c 20 22 20 2a 2f 5c 6e |rintf(fp|, " */\n|
|00000f60| 22 29 3b 0d 09 09 66 70 | 72 69 6e 74 66 28 66 70 |");...fp|rintf(fp|
|00000f70| 2c 22 23 64 65 66 69 6e | 65 5c 74 5c 74 4f 5f 52 |,"#defin|e\t\tO_R|
|00000f80| 41 44 49 55 53 5c 74 5c | 74 5c 74 25 64 5c 6e 22 |ADIUS\t\|t\t%d\n"|
|00000f90| 2c 20 4f 5f 52 41 44 49 | 55 53 29 3b 0d 09 09 66 |, O_RADI|US);...f|
|00000fa0| 70 72 69 6e 74 66 28 66 | 70 2c 22 23 64 65 66 69 |printf(f|p,"#defi|
|00000fb0| 6e 65 5c 74 5c 74 4e 55 | 4d 5f 4f 5f 50 4f 49 4e |ne\t\tNU|M_O_POIN|
|00000fc0| 54 53 5c 74 5c 74 25 64 | 5c 6e 5c 6e 22 2c 6e 75 |TS\t\t%d|\n\n",nu|
|00000fd0| 6d 5f 70 74 73 29 3b 0d | 09 7d 09 09 0d 09 65 6c |m_pts);.|.}....el|
|00000fe0| 73 65 20 7b 0d 09 09 66 | 70 72 69 6e 74 66 28 66 |se {...f|printf(f|
|00000ff0| 70 2c 20 22 77 69 74 68 | 20 61 20 72 61 64 69 75 |p, "with| a radiu|
|00001000| 73 20 6f 66 3a 20 25 64 | 5c 6e 22 2c 20 43 5f 52 |s of: %d|\n", C_R|
|00001010| 41 44 49 55 53 29 3b 0d | 09 09 66 70 72 69 6e 74 |ADIUS);.|..fprint|
|00001020| 66 28 66 70 2c 20 22 20 | 2a 2f 5c 6e 22 29 3b 0d |f(fp, " |*/\n");.|
|00001030| 09 09 66 70 72 69 6e 74 | 66 28 66 70 2c 22 23 64 |..fprint|f(fp,"#d|
|00001040| 65 66 69 6e 65 5c 74 5c | 74 43 5f 52 41 44 49 55 |efine\t\|tC_RADIU|
|00001050| 53 5c 74 5c 74 5c 74 25 | 64 5c 6e 22 2c 20 43 5f |S\t\t\t%|d\n", C_|
|00001060| 52 41 44 49 55 53 29 3b | 0d 09 09 66 70 72 69 6e |RADIUS);|...fprin|
|00001070| 74 66 28 66 70 2c 22 23 | 64 65 66 69 6e 65 5c 74 |tf(fp,"#|define\t|
|00001080| 5c 74 4e 55 4d 5f 43 5f | 50 4f 49 4e 54 53 5c 74 |\tNUM_C_|POINTS\t|
|00001090| 5c 74 25 64 5c 6e 5c 6e | 22 2c 6e 75 6d 5f 70 74 |\t%d\n\n|",num_pt|
|000010a0| 73 29 3b 0d 09 7d 09 09 | 0d 09 0d 09 0d 09 2f 2a |s);..}..|....../*|
|000010b0| 20 50 72 69 6e 74 20 74 | 68 65 20 73 74 72 75 63 | Print t|he struc|
|000010c0| 74 75 72 65 20 64 65 73 | 63 72 69 70 74 69 6f 6e |ture des|cription|
|000010d0| 20 77 65 20 61 72 65 20 | 61 62 6f 75 74 20 74 6f | we are |about to|
|000010e0| 20 64 65 66 69 6e 65 20 | 2a 2f 0d 09 69 66 20 28 | define |*/..if (|
|000010f0| 74 79 70 65 20 3d 3d 20 | 49 5f 50 4f 49 4e 54 53 |type == |I_POINTS|
|00001100| 29 20 7b 0d 09 09 66 70 | 72 69 6e 74 66 28 66 70 |) {...fp|rintf(fp|
|00001110| 2c 22 2f 2a 20 54 68 69 | 73 20 69 73 20 74 68 65 |,"/* Thi|s is the|
|00001120| 20 72 65 70 72 65 73 65 | 6e 74 61 74 69 6f 6e 20 | represe|ntation |
|00001130| 6f 66 20 61 20 70 6f 69 | 6e 74 2e 20 2a 2f 5c 6e |of a poi|nt. */\n|
|00001140| 22 29 3b 0d 09 09 66 70 | 72 69 6e 74 66 28 66 70 |");...fp|rintf(fp|
|00001150| 2c 22 73 74 72 75 63 74 | 09 78 79 5f 70 74 20 7b |,"struct|.xy_pt {|
|00001160| 5c 6e 22 29 3b 0d 09 09 | 66 70 72 69 6e 74 66 28 |\n");...|fprintf(|
|00001170| 66 70 2c 22 5c 74 69 6e | 74 09 78 3b 5c 6e 22 29 |fp,"\tin|t.x;\n")|
|00001180| 3b 0d 09 09 66 70 72 69 | 6e 74 66 28 66 70 2c 22 |;...fpri|ntf(fp,"|
|00001190| 5c 74 69 6e 74 09 79 3b | 5c 6e 22 29 3b 0d 09 09 |\tint.y;|\n");...|
|000011a0| 66 70 72 69 6e 74 66 28 | 66 70 2c 22 7d 3b 5c 6e |fprintf(|fp,"};\n|
|000011b0| 5c 6e 22 29 3b 0d 09 09 | 66 70 72 69 6e 74 66 28 |\n");...|fprintf(|
|000011c0| 66 70 2c 22 73 74 72 75 | 63 74 20 78 79 5f 70 74 |fp,"stru|ct xy_pt|
|000011d0| 20 69 5f 63 69 72 63 6c | 65 5f 70 6f 69 6e 74 73 | i_circl|e_points|
|000011e0| 5b 4e 55 4d 5f 49 5f 50 | 4f 49 4e 54 53 5d 20 3d |[NUM_I_P|OINTS] =|
|000011f0| 20 7b 5c 6e 5c 74 22 29 | 3b 0d 09 7d 0d 09 65 6c | {\n\t")|;..}..el|
|00001200| 73 65 20 69 66 20 28 74 | 79 70 65 20 3d 3d 20 4f |se if (t|ype == O|
|00001210| 5f 50 4f 49 4e 54 53 29 | 20 7b 0d 09 09 66 70 72 |_POINTS)| {...fpr|
|00001220| 69 6e 74 66 28 66 70 2c | 22 73 74 72 75 63 74 20 |intf(fp,|"struct |
|00001230| 78 79 5f 70 74 20 6f 5f | 63 69 72 63 6c 65 5f 70 |xy_pt o_|circle_p|
|00001240| 6f 69 6e 74 73 5b 4e 55 | 4d 5f 4f 5f 50 4f 49 4e |oints[NU|M_O_POIN|
|00001250| 54 53 5d 20 3d 20 7b 5c | 6e 5c 74 22 29 3b 0d 09 |TS] = {\|n\t");..|
|00001260| 7d 0d 09 65 6c 73 65 20 | 7b 0d 09 09 66 70 72 69 |}..else |{...fpri|
|00001270| 6e 74 66 28 66 70 2c 22 | 73 74 72 75 63 74 20 78 |ntf(fp,"|struct x|
|00001280| 79 5f 70 74 20 63 5f 63 | 69 72 63 6c 65 5f 70 6f |y_pt c_c|ircle_po|
|00001290| 69 6e 74 73 5b 4e 55 4d | 5f 43 5f 50 4f 49 4e 54 |ints[NUM|_C_POINT|
|000012a0| 53 5d 20 3d 20 7b 5c 6e | 5c 74 22 29 3b 0d 09 7d |S] = {\n|\t");..}|
|000012b0| 0d 09 0d 09 66 6f 72 20 | 28 69 20 3d 20 30 3b 20 |....for |(i = 0; |
|000012c0| 69 20 3c 20 6e 75 6d 5f | 70 74 73 3b 20 69 2b 2b |i < num_|pts; i++|
|000012d0| 29 20 7b 0d 09 09 66 70 | 72 69 6e 74 66 28 66 70 |) {...fp|rintf(fp|
|000012e0| 2c 22 7b 25 35 64 2c 25 | 35 64 7d 2c 5c 74 22 2c |,"{%5d,%|5d},\t",|
|000012f0| 20 70 74 5b 69 5d 2e 78 | 2c 20 70 74 5b 69 5d 2e | pt[i].x|, pt[i].|
|00001300| 79 29 3b 0d 09 09 2b 2b | 63 6f 6c 73 3b 0d 09 09 |y);...++|cols;...|
|00001310| 69 66 20 28 20 28 63 6f | 6c 73 20 25 20 35 29 20 |if ( (co|ls % 5) |
|00001320| 3d 3d 20 30 20 29 20 7b | 0d 09 09 09 66 70 72 69 |== 0 ) {|....fpri|
|00001330| 6e 74 66 28 66 70 2c 22 | 5c 6e 5c 74 22 29 3b 0d |ntf(fp,"|\n\t");.|
|00001340| 09 09 09 63 6f 6c 73 20 | 3d 20 30 3b 0d 09 09 7d |...cols |= 0;...}|
|00001350| 0d 09 7d 0d 09 0d 09 69 | 66 20 28 63 6f 6c 73 20 |..}....i|f (cols |
|00001360| 21 3d 20 30 29 0d 09 09 | 66 70 72 69 6e 74 66 28 |!= 0)...|fprintf(|
|00001370| 66 70 2c 22 5c 6e 22 29 | 3b 0d 09 09 0d 09 66 70 |fp,"\n")|;.....fp|
|00001380| 72 69 6e 74 66 28 66 70 | 2c 22 7d 3b 5c 6e 22 29 |rintf(fp|,"};\n")|
|00001390| 3b 0d 7d 0d 0d 0d 0d 0d | 73 6f 72 74 28 76 2c 20 |;.}.....|sort(v, |
|000013a0| 6e 2c 20 73 6f 72 74 5f | 66 69 65 6c 64 29 0d 09 |n, sort_|field)..|
|000013b0| 73 74 72 75 63 74 20 78 | 79 5f 70 74 20 76 5b 5d |struct x|y_pt v[]|
|000013c0| 3b 0d 09 69 6e 74 20 6e | 3b 0d 09 69 6e 74 20 73 |;..int n|;..int s|
|000013d0| 6f 72 74 5f 66 69 65 6c | 64 3b 0d 7b 0d 09 69 6e |ort_fiel|d;.{..in|
|000013e0| 74 20 67 61 70 2c 20 69 | 2c 20 6a 3b 0d 09 0d 09 |t gap, i|, j;....|
|000013f0| 66 6f 72 20 28 67 61 70 | 20 3d 20 6e 2f 32 3b 20 |for (gap| = n/2; |
|00001400| 67 61 70 20 3e 20 30 3b | 20 67 61 70 20 2f 3d 20 |gap > 0;| gap /= |
|00001410| 32 29 0d 09 09 66 6f 72 | 20 28 69 20 3d 20 67 61 |2)...for| (i = ga|
|00001420| 70 3b 20 69 20 3c 20 6e | 3b 20 69 2b 2b 29 0d 09 |p; i < n|; i++)..|
|00001430| 09 09 66 6f 72 20 28 6a | 20 3d 20 69 2d 67 61 70 |..for (j| = i-gap|
|00001440| 3b 20 6a 20 3e 3d 20 30 | 3b 20 6a 20 2d 3d 20 67 |; j >= 0|; j -= g|
|00001450| 61 70 29 20 7b 0d 09 09 | 09 09 69 66 20 28 63 6f |ap) {...|..if (co|
|00001460| 6d 70 61 72 65 28 76 5b | 6a 5d 2c 20 76 5b 6a 2b |mpare(v[|j], v[j+|
|00001470| 67 61 70 5d 2c 20 73 6f | 72 74 5f 66 69 65 6c 64 |gap], so|rt_field|
|00001480| 29 20 3c 3d 20 30 29 0d | 09 09 09 09 09 62 72 65 |) <= 0).|.....bre|
|00001490| 61 6b 3b 0d 09 09 09 09 | 73 77 61 70 28 26 76 5b |ak;.....|swap(&v[|
|000014a0| 6a 5d 2c 20 26 76 5b 6a | 2b 67 61 70 5d 29 3b 0d |j], &v[j|+gap]);.|
|000014b0| 09 09 09 7d 0d 7d 0d 0d | 0d 0d 69 6e 74 0d 63 6f |...}.}..|..int.co|
|000014c0| 6d 70 61 72 65 28 76 31 | 2c 20 76 32 2c 20 73 6f |mpare(v1|, v2, so|
|000014d0| 72 74 5f 66 69 65 6c 64 | 29 0d 09 73 74 72 75 63 |rt_field|)..struc|
|000014e0| 74 09 78 79 5f 70 74 20 | 76 31 2c 76 32 3b 0d 09 |t.xy_pt |v1,v2;..|
|000014f0| 69 6e 74 09 09 73 6f 72 | 74 5f 66 69 65 6c 64 3b |int..sor|t_field;|
|00001500| 0d 7b 0d 09 69 6e 74 09 | 74 65 6d 70 31 2c 74 65 |.{..int.|temp1,te|
|00001510| 6d 70 32 3b 09 0d 09 0d | 09 2f 2a 20 57 68 65 6e |mp2;....|./* When|
|00001520| 20 73 6f 72 74 69 6e 67 | 20 59 20 63 6f 6f 72 64 | sorting| Y coord|
|00001530| 69 6e 61 74 65 73 2c 20 | 64 6f 6e 27 74 20 73 77 |inates, |don't sw|
|00001540| 61 70 20 75 6e 6c 65 73 | 73 20 58 27 73 20 61 72 |ap unles|s X's ar|
|00001550| 65 20 65 71 75 61 6c 20 | 2a 2f 0d 09 69 66 20 28 |e equal |*/..if (|
|00001560| 20 28 73 6f 72 74 5f 66 | 69 65 6c 64 20 3d 3d 20 | (sort_f|ield == |
|00001570| 59 5f 43 4f 4f 52 44 29 | 20 26 26 20 28 76 31 2e |Y_COORD)| && (v1.|
|00001580| 78 20 21 3d 20 76 32 2e | 78 29 20 29 20 7b 0d 09 |x != v2.|x) ) {..|
|00001590| 09 72 65 74 75 72 6e 28 | 30 29 3b 0d 09 7d 0d 09 |.return(|0);..}..|
|000015a0| 0d 09 2f 2a 20 45 78 74 | 72 61 63 74 20 74 68 65 |../* Ext|ract the|
|000015b0| 20 61 70 70 72 6f 70 72 | 69 61 74 65 20 76 61 6c | appropr|iate val|
|000015c0| 75 65 73 20 74 6f 20 63 | 6f 6d 70 61 72 65 20 2a |ues to c|ompare *|
|000015d0| 2f 0d 09 69 66 20 28 73 | 6f 72 74 5f 66 69 65 6c |/..if (s|ort_fiel|
|000015e0| 64 20 3d 3d 20 58 5f 43 | 4f 4f 52 44 29 20 7b 0d |d == X_C|OORD) {.|
|000015f0| 09 09 74 65 6d 70 31 20 | 3d 20 76 31 2e 78 3b 0d |..temp1 |= v1.x;.|
|00001600| 09 09 74 65 6d 70 32 20 | 3d 20 76 32 2e 78 3b 0d |..temp2 |= v2.x;.|
|00001610| 09 7d 0d 09 65 6c 73 65 | 20 7b 0d 09 09 74 65 6d |.}..else| {...tem|
|00001620| 70 31 20 3d 20 76 31 2e | 79 3b 0d 09 09 74 65 6d |p1 = v1.|y;...tem|
|00001630| 70 32 20 3d 20 76 32 2e | 79 3b 0d 09 7d 0d 09 0d |p2 = v2.|y;..}...|
|00001640| 09 2f 2a 20 52 65 74 75 | 72 6e 20 74 68 65 20 63 |./* Retu|rn the c|
|00001650| 6f 6d 70 61 72 69 73 6f | 6e 20 6f 66 20 74 68 65 |ompariso|n of the|
|00001660| 20 74 77 6f 20 76 61 6c | 75 65 73 20 2a 2f 0d 09 | two val|ues */..|
|00001670| 69 66 20 28 74 65 6d 70 | 31 20 3c 20 74 65 6d 70 |if (temp|1 < temp|
|00001680| 32 29 0d 09 09 72 65 74 | 75 72 6e 28 2d 31 29 3b |2)...ret|urn(-1);|
|00001690| 0d 09 65 6c 73 65 20 69 | 66 20 28 74 65 6d 70 31 |..else i|f (temp1|
|000016a0| 20 3e 20 74 65 6d 70 32 | 29 0d 09 09 72 65 74 75 | > temp2|)...retu|
|000016b0| 72 6e 28 31 29 3b 0d 09 | 65 6c 73 65 0d 09 09 72 |rn(1);..|else...r|
|000016c0| 65 74 75 72 6e 28 30 29 | 3b 0d 7d 0d 0d 0d 0d 0d |eturn(0)|;.}.....|
|000016d0| 69 6e 74 0d 73 77 61 70 | 28 70 31 2c 20 70 32 29 |int.swap|(p1, p2)|
|000016e0| 0d 09 73 74 72 75 63 74 | 20 78 79 5f 70 74 20 2a |..struct| xy_pt *|
|000016f0| 70 31 2c 20 2a 70 32 3b | 0d 7b 0d 09 73 74 72 75 |p1, *p2;|.{..stru|
|00001700| 63 74 09 78 79 5f 70 74 | 09 74 65 6d 70 3b 0d 09 |ct.xy_pt|.temp;..|
|00001710| 0d 09 74 65 6d 70 20 3d | 20 2a 70 31 3b 0d 09 2a |..temp =| *p1;..*|
|00001720| 70 31 20 3d 20 2a 70 32 | 3b 0d 09 2a 70 32 20 3d |p1 = *p2|;..*p2 =|
|00001730| 20 74 65 6d 70 3b 0d 7d | 0d 0d 00 00 00 00 00 00 | temp;.}|........|
|00001740| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001750| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+