home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1989-09-14 | 7.0 KB | [TEXT/MACA] |
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: BrainFile.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, Tue Mar 7 18:53:31 1989, modified Wed Apr 19 10:59:47 1989, creator MacWrite, type ASCII, 6998 bytes "BrainFile.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 | [MACA] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0b 42 72 61 69 6e 46 | 69 6c 65 2e 63 00 00 00 |..BrainF|ile.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 4d 41 43 | 41 00 00 00 00 00 00 00 |.TEXTMAC|A.......|
|00000050| 00 00 00 00 00 1b 56 00 | 00 00 00 a0 3a 1b fb a0 |......V.|....:...|
|00000060| 72 4f 63 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |rOc.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000080| 2f 2a 42 72 61 69 6e 46 | 69 6c 65 2e 63 20 20 20 |/*BrainF|ile.c |
|00000090| 20 43 6f 72 65 20 72 6f | 75 74 69 6e 65 73 20 66 | Core ro|utines f|
|000000a0| 6f 72 20 72 65 61 64 69 | 6e 67 20 69 6e 20 61 20 |or readi|ng in a |
|000000b0| 6e 65 75 72 61 6c 20 4e | 65 74 77 6f 72 6b 2e 0d |neural N|etwork..|
|000000c0| 0d 20 20 20 20 20 54 68 | 69 73 20 66 69 6c 65 20 |. Th|is file |
|000000d0| 69 73 20 43 6f 70 79 72 | 69 67 68 74 20 31 39 38 |is Copyr|ight 198|
|000000e0| 39 20 62 79 20 50 69 65 | 72 63 65 20 54 2e 20 57 |9 by Pie|rce T. W|
|000000f0| 65 74 74 65 72 20 49 49 | 49 0d 09 20 0d 09 20 50 |etter II|I.. .. P|
|00000100| 65 72 6d 69 73 73 69 6f | 6e 20 67 72 61 6e 74 65 |ermissio|n grante|
|00000110| 64 20 66 6f 72 20 61 6c | 6c 20 6e 6f 6e 2d 63 6f |d for al|l non-co|
|00000120| 6d 6d 65 72 63 69 61 6c | 20 75 73 65 73 20 6f 66 |mmercial| uses of|
|00000130| 20 74 68 69 73 20 63 6f | 64 65 2e 20 46 6f 72 20 | this co|de. For |
|00000140| 63 6f 6d 6d 65 72 63 69 | 61 6c 20 75 73 65 73 20 |commerci|al uses |
|00000150| 6f 66 20 74 68 69 73 20 | 63 6f 64 65 0d 09 20 63 |of this |code.. c|
|00000160| 6f 6e 74 61 63 74 20 6d | 65 20 61 74 20 0d 09 20 |ontact m|e at .. |
|00000170| 0d 09 20 20 20 20 20 50 | 69 65 72 63 65 20 54 2e |.. P|ierce T.|
|00000180| 20 57 65 74 74 65 72 20 | 49 49 49 0d 09 09 20 34 | Wetter |III... 4|
|00000190| 35 20 56 69 73 74 61 20 | 4c 61 67 6f 20 44 72 2e |5 Vista |Lago Dr.|
|000001a0| 0d 09 09 20 53 69 6d 69 | 20 56 61 6c 6c 65 79 2c |... Simi| Valley,|
|000001b0| 20 43 41 20 39 33 30 36 | 35 0d 09 09 20 0d 09 09 | CA 9306|5... ...|
|000001c0| 20 6f 72 0d 09 09 20 0d | 09 09 20 77 65 74 74 65 | or... .|.. wette|
|000001d0| 72 40 63 73 76 61 78 2e | 63 61 6c 74 65 63 68 2e |r@csvax.|caltech.|
|000001e0| 65 64 75 09 09 6f 72 20 | 70 77 65 74 74 65 72 40 |edu..or |pwetter@|
|000001f0| 63 61 6c 74 65 63 68 2e | 62 69 74 6e 65 74 0d 09 |caltech.|bitnet..|
|00000200| 09 20 0d 2a 2f 0d 0d 23 | 69 6e 63 6c 75 64 65 20 |. .*/..#|include |
|00000210| 3c 46 69 6c 65 4d 67 72 | 2e 68 3e 0d 23 69 6e 63 |<FileMgr|.h>.#inc|
|00000220| 6c 75 64 65 20 22 4e 65 | 74 4c 69 62 2e 68 22 0d |lude "Ne|tLib.h".|
|00000230| 23 69 6e 63 6c 75 64 65 | 20 22 42 72 61 69 6e 2e |#include| "Brain.|
|00000240| 68 22 0d 23 69 6e 63 6c | 75 64 65 20 22 53 74 64 |h".#incl|ude "Std|
|00000250| 46 69 6c 65 50 6b 67 2e | 68 22 0d 0d 0d 2f 2a 20 |FilePkg.|h".../* |
|00000260| 20 20 42 72 61 69 6e 2e | 68 20 63 61 6e 20 62 65 | Brain.|h can be|
|00000270| 20 65 6c 69 6d 69 6e 61 | 74 65 64 20 69 66 20 79 | elimina|ted if y|
|00000280| 6f 75 20 75 73 65 20 74 | 68 65 20 66 6f 6c 6c 6f |ou use t|he follo|
|00000290| 77 69 6e 67 20 64 65 63 | 2e 0d 0d 74 79 70 65 64 |wing dec|...typed|
|000002a0| 65 66 20 73 74 72 75 63 | 74 20 5f 70 61 74 74 65 |ef struc|t _patte|
|000002b0| 72 6e 6c 69 73 74 7b 0d | 09 09 09 09 73 74 72 75 |rnlist{.|....stru|
|000002c0| 63 74 20 5f 70 61 74 74 | 65 72 6e 6c 69 73 74 20 |ct _patt|ernlist |
|000002d0| 2a 6e 65 78 74 2c 2a 62 | 65 66 6f 72 65 3b 0d 09 |*next,*b|efore;..|
|000002e0| 09 09 09 64 6f 75 62 6c | 65 20 2a 69 6e 70 75 74 |...doubl|e *input|
|000002f0| 73 3b 0d 09 09 09 09 64 | 6f 75 62 6c 65 20 2a 6f |s;.....d|ouble *o|
|00000300| 75 74 70 75 74 73 3b 0d | 09 09 09 09 7d 20 70 61 |utputs;.|....} pa|
|00000310| 74 6c 69 73 74 2c 2a 70 | 61 74 6c 69 73 74 70 74 |tlist,*p|atlistpt|
|00000320| 72 3b 0d 09 09 09 09 0d | 2a 2f 0d 0d 23 64 65 66 |r;......|*/..#def|
|00000330| 69 6e 65 20 6e 69 6c 20 | 30 4c 0d 0d 65 78 74 65 |ine nil |0L..exte|
|00000340| 72 6e 20 6d 69 6e 64 20 | 2a 6d 79 6d 69 6e 64 3b |rn mind |*mymind;|
|00000350| 0d 65 78 74 65 72 6e 20 | 70 61 74 6c 69 73 74 70 |.extern |patlistp|
|00000360| 74 72 20 70 61 74 74 65 | 72 6e 73 3b 0d 73 74 61 |tr patte|rns;.sta|
|00000370| 74 69 63 20 73 68 6f 72 | 74 20 66 65 72 72 6f 72 |tic shor|t ferror|
|00000380| 3d 30 2c 4f 70 65 6e 46 | 69 6c 65 28 29 3b 0d 65 |=0,OpenF|ile();.e|
|00000390| 78 74 65 72 6e 20 64 6f | 75 62 6c 65 20 6d 61 78 |xtern do|uble max|
|000003a0| 65 72 72 3b 0d 0d 64 6f | 75 62 6c 65 20 52 65 61 |err;..do|uble Rea|
|000003b0| 64 46 6c 6f 61 74 28 29 | 2c 61 74 6f 66 28 29 3b |dFloat()|,atof();|
|000003c0| 0d 73 68 6f 72 74 20 52 | 65 61 64 49 6e 74 28 29 |.short R|eadInt()|
|000003d0| 3b 0d 6c 6f 6e 67 20 61 | 74 6f 6c 28 29 3b 0d 0d |;.long a|tol();..|
|000003e0| 73 68 6f 72 74 20 47 65 | 74 4e 65 74 28 29 0d 7b |short Ge|tNet().{|
|000003f0| 0d 73 68 6f 72 74 20 6e | 69 2c 6e 68 2c 6e 6f 3b |.short n|i,nh,no;|
|00000400| 0d 64 6f 75 62 6c 65 20 | 6d 6f 6d 65 6e 74 2c 6c |.double |moment,l|
|00000410| 72 61 74 65 3b 0d 73 68 | 6f 72 74 20 66 69 6c 65 |rate;.sh|ort file|
|00000420| 72 65 66 2c 69 2c 6a 3b | 0d 0d 09 66 69 6c 65 72 |ref,i,j;|...filer|
|00000430| 65 66 3d 4f 70 65 6e 46 | 69 6c 65 28 74 72 75 65 |ef=OpenF|ile(true|
|00000440| 29 3b 0d 09 69 66 20 28 | 66 65 72 72 6f 72 29 20 |);..if (|ferror) |
|00000450| 72 65 74 75 72 6e 28 66 | 61 6c 73 65 29 3b 0d 09 |return(f|alse);..|
|00000460| 6e 69 3d 52 65 61 64 49 | 6e 74 28 66 69 6c 65 72 |ni=ReadI|nt(filer|
|00000470| 65 66 29 3b 0d 09 69 66 | 20 28 66 65 72 72 6f 72 |ef);..if| (ferror|
|00000480| 29 20 72 65 74 75 72 6e | 28 66 61 6c 73 65 29 3b |) return|(false);|
|00000490| 0d 09 6e 68 3d 52 65 61 | 64 49 6e 74 28 66 69 6c |..nh=Rea|dInt(fil|
|000004a0| 65 72 65 66 29 3b 0d 09 | 69 66 20 28 66 65 72 72 |eref);..|if (ferr|
|000004b0| 6f 72 29 20 72 65 74 75 | 72 6e 28 66 61 6c 73 65 |or) retu|rn(false|
|000004c0| 29 3b 0d 09 6e 6f 3d 52 | 65 61 64 49 6e 74 28 66 |);..no=R|eadInt(f|
|000004d0| 69 6c 65 72 65 66 29 3b | 0d 09 69 66 20 28 66 65 |ileref);|..if (fe|
|000004e0| 72 72 6f 72 29 20 72 65 | 74 75 72 6e 28 66 61 6c |rror) re|turn(fal|
|000004f0| 73 65 29 3b 0d 09 6d 6f | 6d 65 6e 74 3d 52 65 61 |se);..mo|ment=Rea|
|00000500| 64 46 6c 6f 61 74 28 66 | 69 6c 65 72 65 66 29 3b |dFloat(f|ileref);|
|00000510| 0d 09 69 66 20 28 66 65 | 72 72 6f 72 29 20 72 65 |..if (fe|rror) re|
|00000520| 74 75 72 6e 28 66 61 6c | 73 65 29 3b 0d 09 6c 72 |turn(fal|se);..lr|
|00000530| 61 74 65 3d 52 65 61 64 | 46 6c 6f 61 74 28 66 69 |ate=Read|Float(fi|
|00000540| 6c 65 72 65 66 29 3b 0d | 09 69 66 20 28 66 65 72 |leref);.|.if (fer|
|00000550| 72 6f 72 29 20 72 65 74 | 75 72 6e 28 66 61 6c 73 |ror) ret|urn(fals|
|00000560| 65 29 3b 0d 09 6d 61 78 | 65 72 72 3d 52 65 61 64 |e);..max|err=Read|
|00000570| 46 6c 6f 61 74 28 66 69 | 6c 65 72 65 66 29 3b 0d |Float(fi|leref);.|
|00000580| 09 69 66 20 28 66 65 72 | 72 6f 72 29 20 72 65 74 |.if (fer|ror) ret|
|00000590| 75 72 6e 28 66 61 6c 73 | 65 29 3b 0d 09 69 66 20 |urn(fals|e);..if |
|000005a0| 28 21 6d 79 6d 69 6e 64 | 29 20 0d 09 7b 0d 09 09 |(!mymind|) ..{...|
|000005b0| 69 6e 69 74 6d 69 6e 64 | 28 6e 69 2c 6e 68 2c 6e |initmind|(ni,nh,n|
|000005c0| 6f 2c 6d 6f 6d 65 6e 74 | 2c 6c 72 61 74 65 2c 26 |o,moment|,lrate,&|
|000005d0| 6d 79 6d 69 6e 64 29 3b | 0d 09 7d 0d 09 65 6c 73 |mymind);|..}..els|
|000005e0| 65 0d 09 7b 0d 09 09 6d | 79 6d 69 6e 64 2d 3e 6d |e..{...m|ymind->m|
|000005f0| 6f 6d 65 6e 74 75 6d 3d | 6d 6f 6d 65 6e 74 3b 0d |omentum=|moment;.|
|00000600| 09 09 6d 79 6d 69 6e 64 | 2d 3e 6c 65 61 72 6e 72 |..mymind|->learnr|
|00000610| 61 74 65 3d 6c 72 61 74 | 65 3b 0d 09 09 69 66 20 |ate=lrat|e;...if |
|00000620| 28 28 6e 69 20 21 3d 20 | 6d 79 6d 69 6e 64 2d 3e |((ni != |mymind->|
|00000630| 6e 69 6e 29 20 7c 7c 20 | 28 6e 68 20 21 3d 20 6d |nin) || |(nh != m|
|00000640| 79 6d 69 6e 64 2d 3e 6e | 68 69 64 64 65 6e 29 20 |ymind->n|hidden) |
|00000650| 7c 7c 20 28 6e 6f 20 21 | 3d 20 6d 79 6d 69 6e 64 ||| (no !|= mymind|
|00000660| 2d 3e 6e 6f 75 74 29 29 | 0d 09 09 7b 0d 09 09 09 |->nout))|...{....|
|00000670| 72 65 74 75 72 6e 28 66 | 61 6c 73 65 29 3b 0d 09 |return(f|alse);..|
|00000680| 09 7d 0d 09 7d 0d 09 66 | 6f 72 20 28 69 3d 30 3b |.}..}..f|or (i=0;|
|00000690| 69 3c 6d 79 6d 69 6e 64 | 2d 3e 6e 69 6e 3b 69 2b |i<mymind|->nin;i+|
|000006a0| 2b 29 0d 09 7b 0d 09 09 | 6d 79 6d 69 6e 64 2d 3e |+)..{...|mymind->|
|000006b0| 69 6e 62 69 61 73 5b 69 | 5d 3d 52 65 61 64 46 6c |inbias[i|]=ReadFl|
|000006c0| 6f 61 74 28 66 69 6c 65 | 72 65 66 29 3b 0d 09 69 |oat(file|ref);..i|
|000006d0| 66 20 28 66 65 72 72 6f | 72 29 20 72 65 74 75 72 |f (ferro|r) retur|
|000006e0| 6e 28 66 61 6c 73 65 29 | 3b 0d 09 09 66 6f 72 20 |n(false)|;...for |
|000006f0| 28 6a 3d 30 3b 6a 3c 6d | 79 6d 69 6e 64 2d 3e 6e |(j=0;j<m|ymind->n|
|00000700| 68 69 64 64 65 6e 3b 6a | 2b 2b 29 0d 09 09 7b 0d |hidden;j|++)...{.|
|00000710| 09 09 09 6d 79 6d 69 6e | 64 2d 3e 69 6e 77 65 69 |...mymin|d->inwei|
|00000720| 67 68 74 73 5b 6a 5d 5b | 69 5d 3d 52 65 61 64 46 |ghts[j][|i]=ReadF|
|00000730| 6c 6f 61 74 28 66 69 6c | 65 72 65 66 29 3b 0d 09 |loat(fil|eref);..|
|00000740| 69 66 20 28 66 65 72 72 | 6f 72 29 20 72 65 74 75 |if (ferr|or) retu|
|00000750| 72 6e 28 66 61 6c 73 65 | 29 3b 0d 09 09 7d 0d 09 |rn(false|);...}..|
|00000760| 7d 0d 09 66 6f 72 28 69 | 3d 30 3b 69 3c 6d 79 6d |}..for(i|=0;i<mym|
|00000770| 69 6e 64 2d 3e 6e 68 69 | 64 64 65 6e 3b 69 2b 2b |ind->nhi|dden;i++|
|00000780| 29 0d 09 7b 0d 09 09 6d | 79 6d 69 6e 64 2d 3e 68 |)..{...m|ymind->h|
|00000790| 69 64 64 65 6e 62 69 61 | 73 5b 69 5d 3d 52 65 61 |iddenbia|s[i]=Rea|
|000007a0| 64 46 6c 6f 61 74 28 66 | 69 6c 65 72 65 66 29 3b |dFloat(f|ileref);|
|000007b0| 0d 09 69 66 20 28 66 65 | 72 72 6f 72 29 20 72 65 |..if (fe|rror) re|
|000007c0| 74 75 72 6e 28 66 61 6c | 73 65 29 3b 0d 09 09 66 |turn(fal|se);...f|
|000007d0| 6f 72 20 28 6a 3d 30 3b | 6a 3c 6d 79 6d 69 6e 64 |or (j=0;|j<mymind|
|000007e0| 2d 3e 6e 6f 75 74 3b 6a | 2b 2b 29 0d 09 09 7b 0d |->nout;j|++)...{.|
|000007f0| 09 09 09 6d 79 6d 69 6e | 64 2d 3e 68 69 64 64 65 |...mymin|d->hidde|
|00000800| 6e 77 65 69 67 68 74 73 | 5b 6a 5d 5b 69 5d 3d 52 |nweights|[j][i]=R|
|00000810| 65 61 64 46 6c 6f 61 74 | 28 66 69 6c 65 72 65 66 |eadFloat|(fileref|
|00000820| 29 3b 0d 09 69 66 20 28 | 66 65 72 72 6f 72 29 20 |);..if (|ferror) |
|00000830| 72 65 74 75 72 6e 28 66 | 61 6c 73 65 29 3b 0d 09 |return(f|alse);..|
|00000840| 09 7d 0d 09 7d 0d 09 66 | 6f 72 28 69 3d 30 3b 69 |.}..}..f|or(i=0;i|
|00000850| 3c 6d 79 6d 69 6e 64 2d | 3e 6e 6f 75 74 3b 69 2b |<mymind-|>nout;i+|
|00000860| 2b 29 0d 09 7b 0d 09 09 | 6d 79 6d 69 6e 64 2d 3e |+)..{...|mymind->|
|00000870| 6f 75 74 62 69 61 73 5b | 69 5d 3d 52 65 61 64 46 |outbias[|i]=ReadF|
|00000880| 6c 6f 61 74 28 66 69 6c | 65 72 65 66 29 3b 0d 09 |loat(fil|eref);..|
|00000890| 69 66 20 28 66 65 72 72 | 6f 72 29 20 72 65 74 75 |if (ferr|or) retu|
|000008a0| 72 6e 28 66 61 6c 73 65 | 29 3b 0d 09 7d 0d 09 43 |rn(false|);..}..C|
|000008b0| 6c 6f 73 65 46 69 6c 65 | 28 66 69 6c 65 72 65 66 |loseFile|(fileref|
|000008c0| 29 3b 0d 09 0d 72 65 74 | 75 72 6e 20 28 74 72 75 |);...ret|urn (tru|
|000008d0| 65 29 3b 0d 7d 0d 0d 73 | 68 6f 72 74 20 53 61 76 |e);.}..s|hort Sav|
|000008e0| 65 4e 65 74 28 29 0d 7b | 0d 63 68 61 72 20 62 75 |eNet().{|.char bu|
|000008f0| 66 5b 32 35 36 5d 3b 0d | 73 68 6f 72 74 20 66 69 |f[256];.|short fi|
|00000900| 6c 65 72 65 66 2c 69 2c | 6a 3b 0d 0d 09 66 69 6c |leref,i,|j;...fil|
|00000910| 65 72 65 66 3d 4f 70 65 | 6e 46 69 6c 65 28 66 61 |eref=Ope|nFile(fa|
|00000920| 6c 73 65 29 3b 0d 09 69 | 66 20 28 66 65 72 72 6f |lse);..i|f (ferro|
|00000930| 72 29 20 72 65 74 75 72 | 6e 28 66 61 6c 73 65 29 |r) retur|n(false)|
|00000940| 3b 0d 09 73 70 72 69 6e | 74 66 28 62 75 66 2c 22 |;..sprin|tf(buf,"|
|00000950| 25 64 5c 72 22 2c 6d 79 | 6d 69 6e 64 2d 3e 6e 69 |%d\r",my|mind->ni|
|00000960| 6e 29 3b 0d 09 57 72 69 | 74 65 53 74 72 69 6e 67 |n);..Wri|teString|
|00000970| 28 62 75 66 2c 66 69 6c | 65 72 65 66 29 3b 0d 09 |(buf,fil|eref);..|
|00000980| 69 66 20 28 66 65 72 72 | 6f 72 29 20 72 65 74 75 |if (ferr|or) retu|
|00000990| 72 6e 28 66 61 6c 73 65 | 29 3b 0d 09 73 70 72 69 |rn(false|);..spri|
|000009a0| 6e 74 66 28 62 75 66 2c | 22 25 64 5c 72 22 2c 6d |ntf(buf,|"%d\r",m|
|000009b0| 79 6d 69 6e 64 2d 3e 6e | 68 69 64 64 65 6e 29 3b |ymind->n|hidden);|
|000009c0| 0d 09 57 72 69 74 65 53 | 74 72 69 6e 67 28 62 75 |..WriteS|tring(bu|
|000009d0| 66 2c 66 69 6c 65 72 65 | 66 29 3b 0d 09 69 66 20 |f,filere|f);..if |
|000009e0| 28 66 65 72 72 6f 72 29 | 20 72 65 74 75 72 6e 28 |(ferror)| return(|
|000009f0| 66 61 6c 73 65 29 3b 0d | 09 73 70 72 69 6e 74 66 |false);.|.sprintf|
|00000a00| 28 62 75 66 2c 22 25 64 | 5c 72 22 2c 6d 79 6d 69 |(buf,"%d|\r",mymi|
|00000a10| 6e 64 2d 3e 6e 6f 75 74 | 29 3b 0d 09 57 72 69 74 |nd->nout|);..Writ|
|00000a20| 65 53 74 72 69 6e 67 28 | 62 75 66 2c 66 69 6c 65 |eString(|buf,file|
|00000a30| 72 65 66 29 3b 0d 09 69 | 66 20 28 66 65 72 72 6f |ref);..i|f (ferro|
|00000a40| 72 29 20 72 65 74 75 72 | 6e 28 66 61 6c 73 65 29 |r) retur|n(false)|
|00000a50| 3b 0d 09 73 70 72 69 6e | 74 66 28 62 75 66 2c 22 |;..sprin|tf(buf,"|
|00000a60| 25 67 5c 72 22 2c 6d 79 | 6d 69 6e 64 2d 3e 6d 6f |%g\r",my|mind->mo|
|00000a70| 6d 65 6e 74 75 6d 29 3b | 0d 09 57 72 69 74 65 53 |mentum);|..WriteS|
|00000a80| 74 72 69 6e 67 28 62 75 | 66 2c 66 69 6c 65 72 65 |tring(bu|f,filere|
|00000a90| 66 29 3b 0d 09 69 66 20 | 28 66 65 72 72 6f 72 29 |f);..if |(ferror)|
|00000aa0| 20 72 65 74 75 72 6e 28 | 66 61 6c 73 65 29 3b 0d | return(|false);.|
|00000ab0| 09 73 70 72 69 6e 74 66 | 28 62 75 66 2c 22 25 67 |.sprintf|(buf,"%g|
|00000ac0| 5c 72 22 2c 6d 79 6d 69 | 6e 64 2d 3e 6c 65 61 72 |\r",mymi|nd->lear|
|00000ad0| 6e 72 61 74 65 29 3b 0d | 09 57 72 69 74 65 53 74 |nrate);.|.WriteSt|
|00000ae0| 72 69 6e 67 28 62 75 66 | 2c 66 69 6c 65 72 65 66 |ring(buf|,fileref|
|00000af0| 29 3b 0d 09 69 66 20 28 | 66 65 72 72 6f 72 29 20 |);..if (|ferror) |
|00000b00| 72 65 74 75 72 6e 28 66 | 61 6c 73 65 29 3b 0d 09 |return(f|alse);..|
|00000b10| 73 70 72 69 6e 74 66 28 | 62 75 66 2c 22 25 67 5c |sprintf(|buf,"%g\|
|00000b20| 72 22 2c 6d 61 78 65 72 | 72 29 3b 0d 09 57 72 69 |r",maxer|r);..Wri|
|00000b30| 74 65 53 74 72 69 6e 67 | 28 62 75 66 2c 66 69 6c |teString|(buf,fil|
|00000b40| 65 72 65 66 29 3b 0d 09 | 69 66 20 28 66 65 72 72 |eref);..|if (ferr|
|00000b50| 6f 72 29 20 72 65 74 75 | 72 6e 28 66 61 6c 73 65 |or) retu|rn(false|
|00000b60| 29 3b 0d 09 66 6f 72 20 | 28 69 3d 30 3b 69 3c 6d |);..for |(i=0;i<m|
|00000b70| 79 6d 69 6e 64 2d 3e 6e | 69 6e 3b 69 2b 2b 29 0d |ymind->n|in;i++).|
|00000b80| 09 7b 0d 09 09 73 70 72 | 69 6e 74 66 28 62 75 66 |.{...spr|intf(buf|
|00000b90| 2c 22 25 67 5c 72 22 2c | 6d 79 6d 69 6e 64 2d 3e |,"%g\r",|mymind->|
|00000ba0| 69 6e 62 69 61 73 5b 69 | 5d 29 3b 0d 09 09 57 72 |inbias[i|]);...Wr|
|00000bb0| 69 74 65 53 74 72 69 6e | 67 28 62 75 66 2c 66 69 |iteStrin|g(buf,fi|
|00000bc0| 6c 65 72 65 66 29 3b 0d | 09 69 66 20 28 66 65 72 |leref);.|.if (fer|
|00000bd0| 72 6f 72 29 20 72 65 74 | 75 72 6e 28 66 61 6c 73 |ror) ret|urn(fals|
|00000be0| 65 29 3b 0d 09 09 66 6f | 72 28 6a 3d 30 3b 6a 3c |e);...fo|r(j=0;j<|
|00000bf0| 6d 79 6d 69 6e 64 2d 3e | 6e 68 69 64 64 65 6e 3b |mymind->|nhidden;|
|00000c00| 6a 2b 2b 29 0d 09 09 7b | 0d 09 09 09 73 70 72 69 |j++)...{|....spri|
|00000c10| 6e 74 66 28 62 75 66 2c | 22 25 67 5c 72 22 2c 6d |ntf(buf,|"%g\r",m|
|00000c20| 79 6d 69 6e 64 2d 3e 69 | 6e 77 65 69 67 68 74 73 |ymind->i|nweights|
|00000c30| 5b 6a 5d 5b 69 5d 29 3b | 0d 09 09 09 57 72 69 74 |[j][i]);|....Writ|
|00000c40| 65 53 74 72 69 6e 67 28 | 62 75 66 2c 66 69 6c 65 |eString(|buf,file|
|00000c50| 72 65 66 29 3b 0d 09 69 | 66 20 28 66 65 72 72 6f |ref);..i|f (ferro|
|00000c60| 72 29 20 72 65 74 75 72 | 6e 28 66 61 6c 73 65 29 |r) retur|n(false)|
|00000c70| 3b 0d 09 09 7d 0d 09 7d | 0d 09 66 6f 72 20 28 69 |;...}..}|..for (i|
|00000c80| 3d 30 3b 69 3c 6d 79 6d | 69 6e 64 2d 3e 6e 68 69 |=0;i<mym|ind->nhi|
|00000c90| 64 64 65 6e 3b 69 2b 2b | 29 0d 09 7b 0d 09 09 73 |dden;i++|)..{...s|
|00000ca0| 70 72 69 6e 74 66 28 62 | 75 66 2c 22 25 67 5c 72 |printf(b|uf,"%g\r|
|00000cb0| 22 2c 6d 79 6d 69 6e 64 | 2d 3e 68 69 64 64 65 6e |",mymind|->hidden|
|00000cc0| 62 69 61 73 5b 69 5d 29 | 3b 0d 09 09 57 72 69 74 |bias[i])|;...Writ|
|00000cd0| 65 53 74 72 69 6e 67 28 | 62 75 66 2c 66 69 6c 65 |eString(|buf,file|
|00000ce0| 72 65 66 29 3b 0d 09 69 | 66 20 28 66 65 72 72 6f |ref);..i|f (ferro|
|00000cf0| 72 29 20 72 65 74 75 72 | 6e 28 66 61 6c 73 65 29 |r) retur|n(false)|
|00000d00| 3b 0d 09 09 66 6f 72 28 | 6a 3d 30 3b 6a 3c 6d 79 |;...for(|j=0;j<my|
|00000d10| 6d 69 6e 64 2d 3e 6e 6f | 75 74 3b 6a 2b 2b 29 0d |mind->no|ut;j++).|
|00000d20| 09 09 7b 0d 09 09 09 73 | 70 72 69 6e 74 66 28 62 |..{....s|printf(b|
|00000d30| 75 66 2c 22 25 67 5c 72 | 22 2c 6d 79 6d 69 6e 64 |uf,"%g\r|",mymind|
|00000d40| 2d 3e 68 69 64 64 65 6e | 77 65 69 67 68 74 73 5b |->hidden|weights[|
|00000d50| 6a 5d 5b 69 5d 29 3b 0d | 09 09 09 57 72 69 74 65 |j][i]);.|...Write|
|00000d60| 53 74 72 69 6e 67 28 62 | 75 66 2c 66 69 6c 65 72 |String(b|uf,filer|
|00000d70| 65 66 29 3b 0d 09 69 66 | 20 28 66 65 72 72 6f 72 |ef);..if| (ferror|
|00000d80| 29 20 72 65 74 75 72 6e | 28 66 61 6c 73 65 29 3b |) return|(false);|
|00000d90| 0d 09 09 7d 0d 09 7d 0d | 09 66 6f 72 20 28 69 3d |...}..}.|.for (i=|
|00000da0| 30 3b 69 3c 6d 79 6d 69 | 6e 64 2d 3e 6e 6f 75 74 |0;i<mymi|nd->nout|
|00000db0| 3b 69 2b 2b 29 0d 09 7b | 0d 09 09 73 70 72 69 6e |;i++)..{|...sprin|
|00000dc0| 74 66 28 62 75 66 2c 22 | 25 67 5c 72 22 2c 6d 79 |tf(buf,"|%g\r",my|
|00000dd0| 6d 69 6e 64 2d 3e 6f 75 | 74 62 69 61 73 5b 69 5d |mind->ou|tbias[i]|
|00000de0| 29 3b 0d 09 09 57 72 69 | 74 65 53 74 72 69 6e 67 |);...Wri|teString|
|00000df0| 28 62 75 66 2c 66 69 6c | 65 72 65 66 29 3b 0d 09 |(buf,fil|eref);..|
|00000e00| 69 66 20 28 66 65 72 72 | 6f 72 29 20 72 65 74 75 |if (ferr|or) retu|
|00000e10| 72 6e 28 66 61 6c 73 65 | 29 3b 0d 09 7d 0d 09 43 |rn(false|);..}..C|
|00000e20| 6c 6f 73 65 46 69 6c 65 | 28 66 69 6c 65 72 65 66 |loseFile|(fileref|
|00000e30| 29 3b 0d 0d 72 65 74 75 | 72 6e 20 28 74 72 75 65 |);..retu|rn (true|
|00000e40| 29 3b 0d 7d 0d 0d 0d 73 | 68 6f 72 74 20 53 61 76 |);.}...s|hort Sav|
|00000e50| 65 50 61 74 28 29 0d 7b | 0d 70 61 74 6c 69 73 74 |ePat().{|.patlist|
|00000e60| 70 74 72 20 63 70 61 74 | 3b 0d 73 68 6f 72 74 20 |ptr cpat|;.short |
|00000e70| 63 6f 75 6e 74 2c 66 69 | 6c 65 72 65 66 2c 69 3b |count,fi|leref,i;|
|00000e80| 0d 63 68 61 72 20 62 75 | 66 5b 32 35 36 5d 3b 0d |.char bu|f[256];.|
|00000e90| 09 0d 09 66 69 6c 65 72 | 65 66 3d 4f 70 65 6e 46 |...filer|ef=OpenF|
|00000ea0| 69 6c 65 28 66 61 6c 73 | 65 29 3b 0d 09 69 66 20 |ile(fals|e);..if |
|00000eb0| 28 66 65 72 72 6f 72 29 | 20 72 65 74 75 72 6e 28 |(ferror)| return(|
|00000ec0| 66 61 6c 73 65 29 3b 0d | 09 63 6f 75 6e 74 3d 30 |false);.|.count=0|
|00000ed0| 3b 0d 09 66 6f 72 28 63 | 70 61 74 3d 70 61 74 74 |;..for(c|pat=patt|
|00000ee0| 65 72 6e 73 3b 63 70 61 | 74 3b 63 70 61 74 3d 63 |erns;cpa|t;cpat=c|
|00000ef0| 70 61 74 2d 3e 6e 65 78 | 74 29 0d 09 7b 0d 09 09 |pat->nex|t)..{...|
|00000f00| 63 6f 75 6e 74 2b 2b 3b | 0d 09 7d 0d 09 73 70 72 |count++;|..}..spr|
|00000f10| 69 6e 74 66 28 62 75 66 | 2c 22 25 64 5c 72 22 2c |intf(buf|,"%d\r",|
|00000f20| 63 6f 75 6e 74 29 3b 0d | 09 57 72 69 74 65 53 74 |count);.|.WriteSt|
|00000f30| 72 69 6e 67 28 62 75 66 | 2c 66 69 6c 65 72 65 66 |ring(buf|,fileref|
|00000f40| 29 3b 0d 09 69 66 20 28 | 66 65 72 72 6f 72 29 20 |);..if (|ferror) |
|00000f50| 72 65 74 75 72 6e 28 66 | 61 6c 73 65 29 3b 0d 09 |return(f|alse);..|
|00000f60| 66 6f 72 28 63 70 61 74 | 3d 70 61 74 74 65 72 6e |for(cpat|=pattern|
|00000f70| 73 3b 63 70 61 74 3b 63 | 70 61 74 3d 63 70 61 74 |s;cpat;c|pat=cpat|
|00000f80| 2d 3e 6e 65 78 74 29 0d | 09 7b 0d 09 09 66 6f 72 |->next).|.{...for|
|00000f90| 28 69 3d 30 3b 69 3c 6d | 79 6d 69 6e 64 2d 3e 6e |(i=0;i<m|ymind->n|
|00000fa0| 69 6e 3b 69 2b 2b 29 0d | 09 09 7b 0d 09 09 09 73 |in;i++).|..{....s|
|00000fb0| 70 72 69 6e 74 66 28 62 | 75 66 2c 22 25 67 5c 72 |printf(b|uf,"%g\r|
|00000fc0| 22 2c 63 70 61 74 2d 3e | 69 6e 70 75 74 73 5b 69 |",cpat->|inputs[i|
|00000fd0| 5d 29 3b 0d 09 09 09 57 | 72 69 74 65 53 74 72 69 |]);....W|riteStri|
|00000fe0| 6e 67 28 62 75 66 2c 66 | 69 6c 65 72 65 66 29 3b |ng(buf,f|ileref);|
|00000ff0| 0d 09 69 66 20 28 66 65 | 72 72 6f 72 29 20 72 65 |..if (fe|rror) re|
|00001000| 74 75 72 6e 28 66 61 6c | 73 65 29 3b 0d 09 09 7d |turn(fal|se);...}|
|00001010| 0d 09 09 66 6f 72 28 69 | 3d 30 3b 69 3c 6d 79 6d |...for(i|=0;i<mym|
|00001020| 69 6e 64 2d 3e 6e 6f 75 | 74 3b 69 2b 2b 29 0d 09 |ind->nou|t;i++)..|
|00001030| 09 7b 0d 09 09 09 73 70 | 72 69 6e 74 66 28 62 75 |.{....sp|rintf(bu|
|00001040| 66 2c 22 25 67 5c 72 22 | 2c 63 70 61 74 2d 3e 6f |f,"%g\r"|,cpat->o|
|00001050| 75 74 70 75 74 73 5b 69 | 5d 29 3b 0d 09 09 09 57 |utputs[i|]);....W|
|00001060| 72 69 74 65 53 74 72 69 | 6e 67 28 62 75 66 2c 66 |riteStri|ng(buf,f|
|00001070| 69 6c 65 72 65 66 29 3b | 0d 09 69 66 20 28 66 65 |ileref);|..if (fe|
|00001080| 72 72 6f 72 29 20 72 65 | 74 75 72 6e 28 66 61 6c |rror) re|turn(fal|
|00001090| 73 65 29 3b 0d 09 09 7d | 0d 09 7d 09 0d 09 43 6c |se);...}|..}...Cl|
|000010a0| 6f 73 65 46 69 6c 65 28 | 66 69 6c 65 72 65 66 29 |oseFile(|fileref)|
|000010b0| 3b 0d 0d 72 65 74 75 72 | 6e 20 28 74 72 75 65 29 |;..retur|n (true)|
|000010c0| 3b 0d 7d 0d 0d 73 68 6f | 72 74 20 47 65 74 50 61 |;.}..sho|rt GetPa|
|000010d0| 74 28 29 0d 7b 0d 73 68 | 6f 72 74 20 63 6f 75 6e |t().{.sh|ort coun|
|000010e0| 74 2c 66 69 6c 65 72 65 | 66 2c 69 2c 6a 3b 0d 70 |t,filere|f,i,j;.p|
|000010f0| 61 74 6c 69 73 74 70 74 | 72 20 6f 70 61 74 2c 4e |atlistpt|r opat,N|
|00001100| 65 77 50 61 74 74 65 72 | 6e 28 29 3b 0d 09 0d 09 |ewPatter|n();....|
|00001110| 66 69 6c 65 72 65 66 3d | 4f 70 65 6e 46 69 6c 65 |fileref=|OpenFile|
|00001120| 28 74 72 75 65 29 3b 0d | 09 69 66 20 28 66 65 72 |(true);.|.if (fer|
|00001130| 72 6f 72 29 20 72 65 74 | 75 72 6e 28 66 61 6c 73 |ror) ret|urn(fals|
|00001140| 65 29 3b 0d 09 63 6f 75 | 6e 74 3d 52 65 61 64 49 |e);..cou|nt=ReadI|
|00001150| 6e 74 28 66 69 6c 65 72 | 65 66 29 3b 0d 09 69 66 |nt(filer|ef);..if|
|00001160| 20 28 66 65 72 72 6f 72 | 29 20 72 65 74 75 72 6e | (ferror|) return|
|00001170| 28 66 61 6c 73 65 29 3b | 0d 09 66 6f 72 20 28 6a |(false);|..for (j|
|00001180| 3d 30 3b 6a 3c 63 6f 75 | 6e 74 3b 6a 2b 2b 29 0d |=0;j<cou|nt;j++).|
|00001190| 09 7b 0d 09 09 6f 70 61 | 74 3d 70 61 74 74 65 72 |.{...opa|t=patter|
|000011a0| 6e 73 3b 0d 09 09 70 61 | 74 74 65 72 6e 73 3d 4e |ns;...pa|tterns=N|
|000011b0| 65 77 50 61 74 74 65 72 | 6e 28 29 3b 0d 09 09 66 |ewPatter|n();...f|
|000011c0| 6f 72 28 69 3d 30 3b 69 | 3c 6d 79 6d 69 6e 64 2d |or(i=0;i|<mymind-|
|000011d0| 3e 6e 69 6e 3b 69 2b 2b | 29 0d 09 09 7b 0d 09 09 |>nin;i++|)...{...|
|000011e0| 09 70 61 74 74 65 72 6e | 73 2d 3e 69 6e 70 75 74 |.pattern|s->input|
|000011f0| 73 5b 69 5d 3d 52 65 61 | 64 46 6c 6f 61 74 28 66 |s[i]=Rea|dFloat(f|
|00001200| 69 6c 65 72 65 66 29 3b | 0d 09 69 66 20 28 66 65 |ileref);|..if (fe|
|00001210| 72 72 6f 72 29 20 72 65 | 74 75 72 6e 28 66 61 6c |rror) re|turn(fal|
|00001220| 73 65 29 3b 0d 09 09 7d | 0d 09 09 66 6f 72 28 69 |se);...}|...for(i|
|00001230| 3d 30 3b 69 3c 6d 79 6d | 69 6e 64 2d 3e 6e 6f 75 |=0;i<mym|ind->nou|
|00001240| 74 3b 69 2b 2b 29 0d 09 | 09 7b 0d 09 09 09 70 61 |t;i++)..|.{....pa|
|00001250| 74 74 65 72 6e 73 2d 3e | 6f 75 74 70 75 74 73 5b |tterns->|outputs[|
|00001260| 69 5d 3d 52 65 61 64 46 | 6c 6f 61 74 28 66 69 6c |i]=ReadF|loat(fil|
|00001270| 65 72 65 66 29 3b 0d 09 | 69 66 20 28 66 65 72 72 |eref);..|if (ferr|
|00001280| 6f 72 29 20 72 65 74 75 | 72 6e 28 66 61 6c 73 65 |or) retu|rn(false|
|00001290| 29 3b 0d 09 09 7d 0d 09 | 09 70 61 74 74 65 72 6e |);...}..|.pattern|
|000012a0| 73 2d 3e 6e 65 78 74 3d | 6f 70 61 74 3b 0d 09 09 |s->next=|opat;...|
|000012b0| 6f 70 61 74 2d 3e 62 65 | 66 6f 72 65 3d 70 61 74 |opat->be|fore=pat|
|000012c0| 74 65 72 6e 73 3b 0d 09 | 7d 0d 09 43 6c 6f 73 65 |terns;..|}..Close|
|000012d0| 46 69 6c 65 28 66 69 6c | 65 72 65 66 29 3b 0d 72 |File(fil|eref);.r|
|000012e0| 65 74 75 72 6e 20 28 74 | 72 75 65 29 3b 0d 7d 0d |eturn (t|rue);.}.|
|000012f0| 0d 73 68 6f 72 74 20 47 | 65 6e 50 61 74 28 29 0d |.short G|enPat().|
|00001300| 7b 0d 0d 72 65 74 75 72 | 6e 20 28 74 72 75 65 29 |{..retur|n (true)|
|00001310| 3b 0d 7d 0d 0d 64 6f 75 | 62 6c 65 20 52 65 61 64 |;.}..dou|ble Read|
|00001320| 46 6c 6f 61 74 28 66 69 | 6c 65 72 65 66 29 0d 73 |Float(fi|leref).s|
|00001330| 68 6f 72 74 20 66 69 6c | 65 72 65 66 3b 20 0d 7b |hort fil|eref; .{|
|00001340| 0d 63 68 61 72 20 62 75 | 66 5b 32 35 36 5d 3b 0d |.char bu|f[256];.|
|00001350| 73 68 6f 72 74 20 69 3b | 0d 6c 6f 6e 67 20 63 6f |short i;|.long co|
|00001360| 75 6e 74 3d 31 3b 0d 09 | 0d 09 69 66 20 28 21 66 |unt=1;..|..if (!f|
|00001370| 65 72 72 6f 72 29 20 0d | 09 7b 0d 09 09 66 6f 72 |error) .|.{...for|
|00001380| 20 28 69 3d 30 3b 69 3c | 32 35 36 3b 69 2b 2b 29 | (i=0;i<|256;i++)|
|00001390| 0d 09 09 7b 0d 09 09 09 | 66 65 72 72 6f 72 3d 46 |...{....|ferror=F|
|000013a0| 53 52 65 61 64 28 66 69 | 6c 65 72 65 66 2c 26 63 |SRead(fi|leref,&c|
|000013b0| 6f 75 6e 74 2c 26 62 75 | 66 5b 69 5d 29 3b 0d 09 |ount,&bu|f[i]);..|
|000013c0| 09 09 69 66 20 28 62 75 | 66 5b 69 5d 3d 3d 27 5c |..if (bu|f[i]=='\|
|000013d0| 72 27 29 20 62 72 65 61 | 6b 3b 0d 09 09 09 69 66 |r') brea|k;....if|
|000013e0| 20 28 66 65 72 72 6f 72 | 29 20 62 72 65 61 6b 3b | (ferror|) break;|
|000013f0| 0d 09 09 7d 0d 09 09 62 | 75 66 5b 69 5d 3d 30 3b |...}...b|uf[i]=0;|
|00001400| 0d 09 7d 0d 09 69 66 20 | 28 21 66 65 72 72 6f 72 |..}..if |(!ferror|
|00001410| 29 20 72 65 74 75 72 6e | 20 28 61 74 6f 66 28 62 |) return| (atof(b|
|00001420| 75 66 29 29 3b 0d 0d 7d | 0d 0d 73 68 6f 72 74 20 |uf));..}|..short |
|00001430| 52 65 61 64 49 6e 74 28 | 66 69 6c 65 72 65 66 29 |ReadInt(|fileref)|
|00001440| 0d 73 68 6f 72 74 20 66 | 69 6c 65 72 65 66 3b 20 |.short f|ileref; |
|00001450| 0d 7b 0d 63 68 61 72 20 | 62 75 66 5b 32 35 36 5d |.{.char |buf[256]|
|00001460| 3b 0d 73 68 6f 72 74 20 | 69 3b 0d 6c 6f 6e 67 20 |;.short |i;.long |
|00001470| 63 6f 75 6e 74 3d 31 2c | 72 65 73 75 6c 74 3b 0d |count=1,|result;.|
|00001480| 09 0d 09 69 66 20 28 21 | 66 65 72 72 6f 72 29 0d |...if (!|ferror).|
|00001490| 09 7b 0d 09 09 66 6f 72 | 20 28 69 3d 30 3b 69 3c |.{...for| (i=0;i<|
|000014a0| 32 35 36 3b 69 2b 2b 29 | 0d 09 09 7b 0d 09 09 09 |256;i++)|...{....|
|000014b0| 66 65 72 72 6f 72 3d 46 | 53 52 65 61 64 28 66 69 |ferror=F|SRead(fi|
|000014c0| 6c 65 72 65 66 2c 26 63 | 6f 75 6e 74 2c 26 62 75 |leref,&c|ount,&bu|
|000014d0| 66 5b 69 5d 29 3b 0d 09 | 09 09 69 66 20 28 62 75 |f[i]);..|..if (bu|
|000014e0| 66 5b 69 5d 3d 3d 27 5c | 72 27 29 20 62 72 65 61 |f[i]=='\|r') brea|
|000014f0| 6b 3b 0d 09 09 09 69 66 | 20 28 66 65 72 72 6f 72 |k;....if| (ferror|
|00001500| 29 20 62 72 65 61 6b 3b | 0d 09 09 7d 0d 09 09 72 |) break;|...}...r|
|00001510| 65 73 75 6c 74 3d 61 74 | 6f 6c 28 62 75 66 29 3b |esult=at|ol(buf);|
|00001520| 0d 09 7d 0d 09 69 66 20 | 28 21 66 65 72 72 6f 72 |..}..if |(!ferror|
|00001530| 29 20 72 65 74 75 72 6e | 20 28 28 73 68 6f 72 74 |) return| ((short|
|00001540| 29 20 72 65 73 75 6c 74 | 29 3b 0d 0d 7d 0d 0d 57 |) result|);..}..W|
|00001550| 72 69 74 65 53 74 72 69 | 6e 67 28 62 75 66 2c 66 |riteStri|ng(buf,f|
|00001560| 69 6c 65 72 65 66 29 0d | 63 68 61 72 20 2a 62 75 |ileref).|char *bu|
|00001570| 66 3b 0d 73 68 6f 72 74 | 20 66 69 6c 65 72 65 66 |f;.short| fileref|
|00001580| 3b 20 0d 7b 0d 6c 6f 6e | 67 20 63 6f 75 6e 74 2c |; .{.lon|g count,|
|00001590| 6f 63 6f 75 6e 74 2c 6e | 63 6f 75 6e 74 3b 0d 0d |ocount,n|count;..|
|000015a0| 09 69 66 20 28 21 66 65 | 72 72 6f 72 29 0d 09 7b |.if (!fe|rror)..{|
|000015b0| 0d 09 09 6f 63 6f 75 6e | 74 3d 63 6f 75 6e 74 3d |...ocoun|t=count=|
|000015c0| 73 74 72 6c 65 6e 28 62 | 75 66 29 3b 0d 09 09 66 |strlen(b|uf);...f|
|000015d0| 65 72 72 6f 72 3d 46 53 | 57 72 69 74 65 28 66 69 |error=FS|Write(fi|
|000015e0| 6c 65 72 65 66 2c 26 63 | 6f 75 6e 74 2c 62 75 66 |leref,&c|ount,buf|
|000015f0| 29 3b 0d 09 09 69 66 20 | 28 63 6f 75 6e 74 21 3d |);...if |(count!=|
|00001600| 6f 63 6f 75 6e 74 29 0d | 09 09 7b 0d 09 09 09 6f |ocount).|..{....o|
|00001610| 63 6f 75 6e 74 20 2d 3d | 63 6f 75 6e 74 3b 0d 09 |count -=|count;..|
|00001620| 09 09 6e 63 6f 75 6e 74 | 3d 6f 63 6f 75 6e 74 3b |..ncount|=ocount;|
|00001630| 0d 09 09 09 66 65 72 72 | 6f 72 3d 41 6c 6c 6f 63 |....ferr|or=Alloc|
|00001640| 61 74 65 28 66 69 6c 65 | 72 65 66 2c 26 6e 63 6f |ate(file|ref,&nco|
|00001650| 75 6e 74 29 3b 0d 09 09 | 09 66 65 72 72 6f 72 3d |unt);...|.ferror=|
|00001660| 46 53 57 72 69 74 65 28 | 66 69 6c 65 72 65 66 2c |FSWrite(|fileref,|
|00001670| 26 6f 63 6f 75 6e 74 2c | 62 75 66 2b 63 6f 75 6e |&ocount,|buf+coun|
|00001680| 74 29 3b 0d 09 09 7d 0d | 09 7d 0d 0d 7d 0d 0d 46 |t);...}.|.}..}..F|
|00001690| 69 6c 65 45 72 72 6f 72 | 28 29 0d 7b 0d 0d 09 73 |ileError|().{...s|
|000016a0| 77 69 74 63 68 20 28 66 | 65 72 72 6f 72 29 0d 09 |witch (f|error)..|
|000016b0| 7b 0d 09 09 63 61 73 65 | 20 6e 6f 45 72 72 3a 20 |{...case| noErr: |
|000016c0| 62 72 65 61 6b 3b 0d 09 | 09 64 65 66 61 75 6c 74 |break;..|.default|
|000016d0| 3a 20 53 79 73 42 65 65 | 70 28 36 30 29 3b 0d 09 |: SysBee|p(60);..|
|000016e0| 09 20 20 20 20 20 20 20 | 20 20 62 72 65 61 6b 3b |. | break;|
|000016f0| 0d 09 7d 0d 7d 0d 0d 65 | 78 74 65 72 6e 20 50 6f |..}.}..e|xtern Po|
|00001700| 69 6e 74 09 64 6c 6f 67 | 57 68 65 72 65 3b 0d 0d |int.dlog|Where;..|
|00001710| 73 68 6f 72 74 20 4f 70 | 65 6e 46 69 6c 65 28 72 |short Op|enFile(r|
|00001720| 65 61 64 29 0d 42 6f 6f | 6c 65 61 6e 20 72 65 61 |ead).Boo|lean rea|
|00001730| 64 3b 0d 7b 0d 73 68 6f | 72 74 20 66 3b 0d 46 49 |d;.{.sho|rt f;.FI|
|00001740| 6e 66 6f 09 66 6e 64 72 | 49 6e 66 6f 3b 09 2f 2a |nfo.fndr|Info;./*|
|00001750| 20 66 69 6e 64 65 72 20 | 69 6e 66 6f 20 2a 2f 0d | finder |info */.|
|00001760| 53 46 52 65 70 6c 79 09 | 74 6d 70 46 69 6c 65 3b |SFReply.|tmpFile;|
|00001770| 0d 48 61 6e 64 6c 65 09 | 68 54 65 78 74 3b 0d 6c |.Handle.|hText;.l|
|00001780| 6f 6e 67 09 63 6f 75 6e | 74 3b 0d 4f 53 45 72 72 |ong.coun|t;.OSErr|
|00001790| 09 72 65 73 75 6c 74 3b | 0d 42 6f 6f 6c 65 61 6e |.result;|.Boolean|
|000017a0| 09 68 61 76 65 4e 65 77 | 46 69 6c 65 20 3d 20 66 |.haveNew|File = f|
|000017b0| 61 6c 73 65 3b 0d 4f 53 | 54 79 70 65 09 09 74 79 |alse;.OS|Type..ty|
|000017c0| 70 65 20 3d 20 27 54 45 | 58 54 27 3b 0d 0d 0d 09 |pe = 'TE|XT';....|
|000017d0| 66 65 72 72 6f 72 3d 30 | 3b 0d 09 0d 09 2f 2a 20 |ferror=0|;..../* |
|000017e0| 47 65 74 46 69 6c 65 2f | 50 75 74 46 69 6c 65 20 |GetFile/|PutFile |
|000017f0| 6c 6f 63 61 74 69 6f 6e | 20 2a 2f 0d 0d 09 70 53 |location| */...pS|
|00001800| 74 72 43 6f 70 79 28 20 | 22 5c 70 4e 65 75 72 61 |trCopy( |"\pNeura|
|00001810| 6c 2e 6f 75 74 70 75 74 | 22 2c 74 6d 70 46 69 6c |l.output|",tmpFil|
|00001820| 65 2e 66 4e 61 6d 65 29 | 3b 09 09 09 09 09 2f 2a |e.fName)|;...../*|
|00001830| 20 69 6e 69 74 69 61 6c | 69 7a 65 20 64 65 66 61 | initial|ize defa|
|00001840| 75 6c 74 20 6e 61 6d 65 | 20 2a 2f 0d 09 69 66 20 |ult name| */..if |
|00001850| 28 72 65 61 64 29 0d 09 | 7b 0d 09 09 53 46 47 65 |(read)..|{...SFGe|
|00001860| 74 46 69 6c 65 20 28 64 | 6c 6f 67 57 68 65 72 65 |tFile (d|logWhere|
|00001870| 2c 20 22 5c 70 43 68 6f | 6f 73 65 20 66 69 6c 65 |, "\pCho|ose file|
|00001880| 3a 22 2c 6e 69 6c 2c 31 | 2c 26 74 79 70 65 2c 0d |:",nil,1|,&type,.|
|00001890| 09 09 09 09 09 30 4c 2c | 20 26 74 6d 70 46 69 6c |.....0L,| &tmpFil|
|000018a0| 65 29 3b 0d 09 7d 0d 09 | 65 6c 73 65 20 0d 09 7b |e);..}..|else ..{|
|000018b0| 0d 09 09 53 46 50 75 74 | 46 69 6c 65 20 28 64 6c |...SFPut|File (dl|
|000018c0| 6f 67 57 68 65 72 65 2c | 20 22 5c 70 53 61 76 65 |ogWhere,| "\pSave|
|000018d0| 20 66 69 6c 65 20 61 73 | 3a 22 2c 20 74 6d 70 46 | file as|:", tmpF|
|000018e0| 69 6c 65 2e 66 4e 61 6d | 65 2c 0d 09 09 09 09 09 |ile.fNam|e,......|
|000018f0| 30 4c 2c 20 26 74 6d 70 | 46 69 6c 65 29 3b 0d 09 |0L, &tmp|File);..|
|00001900| 7d 09 0d 09 69 66 20 28 | 21 74 6d 70 46 69 6c 65 |}...if (|!tmpFile|
|00001910| 2e 67 6f 6f 64 29 0d 09 | 09 72 65 74 75 72 6e 20 |.good)..|.return |
|00001920| 28 30 29 3b 0d 09 65 6c | 73 65 0d 09 7b 0d 09 09 |(0);..el|se..{...|
|00001930| 68 61 76 65 4e 65 77 46 | 69 6c 65 20 3d 20 74 72 |haveNewF|ile = tr|
|00001940| 75 65 3b 0d 09 09 69 66 | 20 28 47 65 74 46 49 6e |ue;...if| (GetFIn|
|00001950| 66 6f 20 28 74 6d 70 46 | 69 6c 65 2e 66 4e 61 6d |fo (tmpF|ile.fNam|
|00001960| 65 2c 20 74 6d 70 46 69 | 6c 65 2e 76 52 65 66 4e |e, tmpFi|le.vRefN|
|00001970| 75 6d 2c 20 26 66 6e 64 | 72 49 6e 66 6f 29 0d 09 |um, &fnd|rInfo)..|
|00001980| 09 09 09 3d 3d 20 6e 6f | 45 72 72 29 20 2f 2a 20 |...== no|Err) /* |
|00001990| 65 78 69 73 74 73 20 2a | 2f 0d 09 09 7b 0d 09 09 |exists *|/...{...|
|000019a0| 09 69 66 20 28 66 6e 64 | 72 49 6e 66 6f 2e 66 64 |.if (fnd|rInfo.fd|
|000019b0| 54 79 70 65 20 21 3d 20 | 27 54 45 58 54 27 29 0d |Type != |'TEXT').|
|000019c0| 09 09 09 7b 0d 09 09 09 | 09 45 72 72 4d 65 73 67 |...{....|.ErrMesg|
|000019d0| 20 28 22 5c 70 4e 6f 74 | 20 61 20 54 45 58 54 20 | ("\pNot| a TEXT |
|000019e0| 46 69 6c 65 22 29 3b 0d | 09 09 09 09 72 65 74 75 |File");.|....retu|
|000019f0| 72 6e 20 28 30 29 3b 0d | 09 09 09 7d 0d 09 09 7d |rn (0);.|...}...}|
|00001a00| 0d 09 09 65 6c 73 65 09 | 2f 2a 20 64 6f 65 73 6e |...else.|/* doesn|
|00001a10| 27 74 20 65 78 69 73 74 | 2e 20 20 63 72 65 61 74 |'t exist|. creat|
|00001a20| 65 20 69 74 2e 20 2a 2f | 0d 09 09 7b 0d 09 09 09 |e it. */|...{....|
|00001a30| 69 66 20 28 43 72 65 61 | 74 65 20 28 74 6d 70 46 |if (Crea|te (tmpF|
|00001a40| 69 6c 65 2e 66 4e 61 6d | 65 2c 20 74 6d 70 46 69 |ile.fNam|e, tmpFi|
|00001a50| 6c 65 2e 76 52 65 66 4e | 75 6d 2c 0d 09 09 09 09 |le.vRefN|um,.....|
|00001a60| 09 09 27 4d 50 53 20 27 | 2c 20 27 54 45 58 54 27 |..'MPS '|, 'TEXT'|
|00001a70| 29 20 21 3d 20 6e 6f 45 | 72 72 29 0d 09 09 09 7b |) != noE|rr)....{|
|00001a80| 0d 09 09 09 09 45 72 72 | 4d 65 73 67 20 28 22 5c |.....Err|Mesg ("\|
|00001a90| 70 43 61 6e 27 74 20 43 | 72 65 61 74 65 22 29 3b |pCan't C|reate");|
|00001aa0| 0d 09 09 09 09 72 65 74 | 75 72 6e 20 28 30 29 3b |.....ret|urn (0);|
|00001ab0| 0d 09 09 09 7d 0d 09 09 | 7d 0d 09 7d 0d 09 0d 09 |....}...|}..}....|
|00001ac0| 69 66 20 28 66 65 72 72 | 6f 72 3d 46 53 4f 70 65 |if (ferr|or=FSOpe|
|00001ad0| 6e 20 28 74 6d 70 46 69 | 6c 65 2e 66 4e 61 6d 65 |n (tmpFi|le.fName|
|00001ae0| 2c 20 74 6d 70 46 69 6c | 65 2e 76 52 65 66 4e 75 |, tmpFil|e.vRefNu|
|00001af0| 6d 2c 20 26 66 29 20 21 | 3d 20 6e 6f 45 72 72 29 |m, &f) !|= noErr)|
|00001b00| 0d 09 09 45 72 72 4d 65 | 73 67 20 28 22 5c 70 43 |...ErrMe|sg ("\pC|
|00001b10| 61 6e 27 74 20 4f 70 65 | 6e 22 29 3b 0d 09 65 6c |an't Ope|n");..el|
|00001b20| 73 65 0d 09 7b 0d 09 09 | 28 76 6f 69 64 29 20 53 |se..{...|(void) S|
|00001b30| 65 74 46 50 6f 73 20 28 | 66 2c 20 66 73 46 72 6f |etFPos (|f, fsFro|
|00001b40| 6d 53 74 61 72 74 2c 20 | 30 4c 29 3b 0d 09 7d 0d |mStart, |0L);..}.|
|00001b50| 09 72 65 74 75 72 6e 20 | 28 66 29 3b 0d 7d 0d 0d |.return |(f);.}..|
|00001b60| 43 6c 6f 73 65 46 69 6c | 65 28 66 29 0d 73 68 6f |CloseFil|e(f).sho|
|00001b70| 72 74 20 66 3b 0d 7b 0d | 6c 6f 6e 67 20 63 6f 75 |rt f;.{.|long cou|
|00001b80| 6e 74 3b 0d 09 09 28 76 | 6f 69 64 29 20 47 65 74 |nt;...(v|oid) Get|
|00001b90| 46 50 6f 73 20 28 66 2c | 20 26 63 6f 75 6e 74 29 |FPos (f,| &count)|
|00001ba0| 3b 0d 09 09 28 76 6f 69 | 64 29 20 53 65 74 45 4f |;...(voi|d) SetEO|
|00001bb0| 46 20 28 66 2c 20 63 6f | 75 6e 74 29 3b 0d 09 09 |F (f, co|unt);...|
|00001bc0| 28 76 6f 69 64 29 20 46 | 53 43 6c 6f 73 65 20 28 |(void) F|SClose (|
|00001bd0| 66 29 3b 0d 7d 09 00 00 | 00 00 00 00 00 00 00 00 |f);.}...|........|
|00001be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+