DELETED CONTRIBUTING.md Index: CONTRIBUTING.md ================================================================== --- CONTRIBUTING.md +++ CONTRIBUTING.md @@ -1,5 +0,0 @@ -This repository is a mirror of [pisc.junglecoder.com](https://pisc.junglecoder.com), so if you'd like to get the best view of the project, that's where you should be able to find it. -I recommend opening an issue, or emailing me based on my profile before opening a PR. - -Right now I'm focusing on more tests, some basic performance improvements, and building up to a high quality IRC/Slack/Discord chat-bot frame work, hopefully one that can trade punches with Hubot. Contributions that focus in theses areas are more than welcome. - ADDED Fibionacci.pisc Index: Fibionacci.pisc ================================================================== --- Fibionacci.pisc +++ Fibionacci.pisc @@ -0,0 +1,49 @@ + +/* +Even Fibonacci numbers under 4 million +*/ + +"std_lib.pisc" import + +: triplicate ( a -- a a a ) dup dup ; +: max_fib ( -- const ) 4000000 ; + +/* TODO: This isn't working? +: nth_fib ( a -- b ) + :n + + $n 0 = [ 0 ] when + $n 1 = [ 1 ] when + $n 1 > [ + $n [ 1 - nth_fib ] [ 2 - nth_fib ] bi + + ] when +; +*/ + +: loop_fib ( n -- fib sum ) + :n + 0 triplicate :sum :fib :a + 1 :b + $n [ + $a $b + :fib + $b :a + $fib :b + $fib even? [ $fib $sum + :sum ] when + ] times + $fib + $sum +; + +: nth_fib ( n -- b ) + :n + 0 1 $n nth_fib_do +; + +/* This is the tail-recursive version of fibionacci */ +: nth_fib_do ( a b n -- q ) + :n :b :a + $n 0 > + [ $b $a $b + $n 1 - nth_fib_do ] + [ $a ] + if +; ADDED FizzBuzz.pisc Index: FizzBuzz.pisc ================================================================== --- FizzBuzz.pisc +++ FizzBuzz.pisc @@ -0,0 +1,35 @@ +/* + Implementing fizzbuzz in PISC +*/ + + +/* Old version, very verbose +: divisible? ( a b -- bool ) mod zero? ; +: out-f ( a -- f ) print f ; +get-locals +0 :num + +100 [ + t :unprinted + $num inc :num + $num 15 divisible? [ "FizzBuzz" out-f :unprinted ] when + $num 5 divisible? $unprinted and [ "Buzz" out-f :unprinted ] when + $num 3 divisible? $unprinted and [ "Fizz" out-f :unprinted ] when + $unprinted [ $num print ] when + ] times +drop-locals +*/ + +"std_lib.pisc" import + +: inc ( a -- a` ) 1 + ; + +get-locals +0 !num /* Store 0 into num variable */ +100 [ + $num inc dup :num + [ 3 divisor? [ "Buzz" ] [ "" ] if ] + [ 5 divisor? [ "Fizz" ] [ "" ] if ] bi + concat dup len 0 = [ drop $num ] when print +] times +drop-locals Index: ImageSchema.sql ================================================================== --- ImageSchema.sql +++ ImageSchema.sql @@ -1,9 +1,7 @@ --- TODO: I don't think I'm going to use this, at least for the known future --- TODO: BoltDB seems like a better fit for now. +-- This is the schemda for a PISC image --- This was the schemda for a PISC image Create Table vocabulary ( vocab_id INTEGER PRIMARY KEY, vocab_name text NOT NULL, -- TODO: figure out dependency tracking @@ -28,5 +26,8 @@ ); Create Table kv_store ( ); +------------------------------------------------- +Search: /\*([^*]+)\*/ : ([\w-]+) (\( [^)]+\)) [^;]+; +Replace: :DOC \2 \3 \1 ; Index: README.md ================================================================== --- README.md +++ README.md @@ -1,23 +1,46 @@ # PISC Position Independent Source Code. A small, stack-based, concatenative language. ## About -PISC's source and documentation are hosted at [https://pisc.junglecoder.com/ ](https://pisc.junglecoder.com). -A quick starter can be found at [PISC in Y Minutes](https://pisc.junglecoder.com/home/apps/fossil/PISC.fossil/wiki?name=PISC+in+Y+Minutes) +This is currently a small side project to see how far a small stack-based scripting language can go in spare time. Inspired by Factor (80%), Forth (5%) and Python (5%) and Tcl (5%) (not 100% inspired yet.) +Plans are currently for an interperated language that uses a "arrays and hashtables" approach to data stucturing. + +## TODO: + +If you can understand what is going on, please submit a pull request to add something that I'm missing. I'm not trying to compete with [factor](http://factorcode.org) or [forth](http://www.forth.com/forth/) for performance/features, but I trying out their style of programming to see how it goes. Ports of this interpretor to the language of your choice are welcome as well. -## Building +With that in mind, things that I will be adding (or accepting PRs for) as [time](http://www.catb.org/jargon/html/C/copious-free-time.html) allows: -PISC requires go 1.9+ to build. Installation instructions [here](https://golang.org/doc/install) + - More tests for different combinators (if, loop, while) + - A standard library build from a minimal core (this is a lot of the things below) + - Stack shuffling combinators (see the ones in factor): + -- drop ( x -- ) + -- 2drop ( x y -- ) + -- 3drop ( x y z -- ) + -- nip ( x y -- y ) + -- 2nip ( x y z -- z ) + -- dup ( x -- x x ) + -- 2dup ( x y -- x y x y ) + -- 3dup ( x y z -- x y z ) + -- 2over ( x y z -- x y z x y ) + -- pick ( x y z -- x y z x ) + -- swap ( x y -- y x ) + - Add a way for modules to be added without a lot of major modifications in the core loop of the interp. + - Math words. A lot is needed here, and in double/int versions ( >, <, =, -, +, div, mod ) + - String manipulation words (concat, >upper, >lower, int>string, double>string, etc) + - Array and map manipulating words (ways to define them, literals, member access, so on.) + - A basic compliation step for reducing cache misses in the core loop (transforming words into constant lookup codes, so that word lookup isn't proportional to the number of words in the core loop) + - STDIN/STDOUT words. + - Regex facilties. + - File i/o words + - A plan for multiprocessing. (I want to pull from TCL on this one if I can) + - Combinators for quotations, like bi and tri. + - A plan for a module system. + - Syscalls + - shellout words. + - struct words (when this thing allows for partial compilation or some such thing.) + - Bindings to awesome libraries (SDL, Tk, ImageMagick) -Once go is installed, you'll (currently) need to run `git clone https://github.com/yumaikas/PISC-mirror "$GOPATH/src/pisc"` -Running `cd $GOPATH/src/pisc && go get -u && go build -o pisc` will fetch depenencies and get you a PISC executable. You can launch a REPL with `pisc -i` and play with it there. -## Playground - -PISC has a playground at https://pisc.junglecoder.com/playground/ - -## Flags - -Running `pisc help` will dump out current information about avaiable flags - +.pisc is the file extension for these files. ADDED SumsOf3And5.pisc Index: SumsOf3And5.pisc ================================================================== --- SumsOf3And5.pisc +++ SumsOf3And5.pisc @@ -0,0 +1,17 @@ +/* +Sums below 1000 of 3 and 5 +*/ + +"std_lib.pisc" import + +: inc ( a -- b ) 1 + ; + +get-locals +0 :n + /* Maybe we can keep this on the stack? */ +0 1000 [ /* Sum and loop count */ + dup inc :n + [ 5 divisor? ] [ 3 divisor? ] bi or [ $n + ] when +] times +print +drop-locals ADDED bathroom_stall.pisc Index: bathroom_stall.pisc ================================================================== --- bathroom_stall.pisc +++ bathroom_stall.pisc @@ -0,0 +1,35 @@ +/* +Solving this code golf problem http://codegolf.stackexchange.com/questions/89241/be-respectful-in-the-restroom +*/ + + +: respect ( stalls -- respectfulPostion ) + + :distances + :full + :empty + 0 :i + >string + [ + dup "1" str-eq [ [ $i vec-append ] $:full ] when + "0" str-eq [ [ $i vec-append ] $:empty ] when + [ 1 + ] $:i + ] each-char + 0 :i + $empty [ :eElem + 0 dup :dist :i + $full [ :fElem + [ $fElem $eElem - abs + ] $:dist + [ 1 + ] $:i + ] vec-each + $dist $i 0.0 + / $eElem 2vector [ swap vec-append ] $:distances + ] vec-each + 0 :maxDist + 0 :maxPos + + $distances dup print [ /* Pop the elements into vars */ + dup []0 :dist []1 :pos + $maxDist $dist < [ $pos :maxPos $dist :maxDist ] when + ] vec-each + $maxPos + ; DELETED bindata.go Index: bindata.go ================================================================== --- bindata.go +++ bindata.go @@ -1,536 +0,0 @@ -// Code generated by go-bindata. -// sources: -// stdlib/bools.pisc -// stdlib/debug.pisc -// stdlib/dicts.pisc -// stdlib/io.pisc -// stdlib/locals.pisc -// stdlib/loops.pisc -// stdlib/math.pisc -// stdlib/random.pisc -// stdlib/shell.pisc -// stdlib/std_lib.pisc -// stdlib/strings.pisc -// stdlib/symbols.pisc -// stdlib/vectors.pisc -// stdlib/with.pisc -// DO NOT EDIT! - -package pisc - -import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time" -) - -func bindataRead(data []byte, name string) ([]byte, error) { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -type asset struct { - bytes []byte - info os.FileInfo -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -func (fi bindataFileInfo) Name() string { - return fi.name -} -func (fi bindataFileInfo) Size() int64 { - return fi.size -} -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} -func (fi bindataFileInfo) IsDir() bool { - return false -} -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var _stdlibBoolsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd2\xd7\xe2\x4a\xca\xcf\xcf\x29\xd6\x2b\xc8\x2c\x4e\xe6\xd2\xd2\xe7\xe2\x52\x56\xf0\x54\x48\x2f\x4d\x2d\x2e\x56\x28\xc9\xc8\x2c\x56\xc8\x2c\x56\x48\xcd\x2d\x28\xa9\x54\xc8\xcb\x2f\xb7\xe7\xe2\x02\x04\x00\x00\xff\xff\xcb\x3e\x17\xc6\x30\x00\x00\x00") - -func stdlibBoolsPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibBoolsPisc, - "stdlib/bools.pisc", - ) -} - -func stdlibBoolsPisc() (*asset, error) { - bytes, err := stdlibBoolsPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/bools.pisc", size: 48, mode: os.FileMode(436), modTime: time.Unix(1511943077, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibDebugPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xcc\xb1\x0a\xc2\x30\x10\xc6\xf1\xbd\x4f\xf1\xd1\x49\x87\xbc\x40\x8b\x2e\xba\x3b\x38\x8a\x43\xb8\x9e\x26\x10\x72\xe1\x2e\x1a\x7d\x7b\x91\x2a\x74\xe8\xf6\xc1\x9f\xef\xd7\x0d\xc7\xd3\x01\x16\xa4\xb9\xa2\x7c\x8b\x2f\xd7\x44\x27\xc3\x06\xce\x61\x8b\x73\x90\x66\x68\x21\x52\xc0\xdc\x31\x77\xaf\x0c\x7a\xa8\x72\xae\xe9\x8d\x24\x7e\xe2\x09\x63\xb7\xe0\x92\x90\x4f\xab\xd0\xaf\x7c\x89\x98\xff\x0a\x8c\xa4\x30\xc6\x6e\x58\xbb\x5f\x00\x79\xb2\x62\x6f\x55\x63\xbe\xa3\xc7\x0e\x3d\xac\xf9\x02\xab\xea\x48\x32\xf9\xba\x9c\x39\x16\x14\x8d\xb9\xe2\x0a\xf6\x14\x66\x0f\x23\x3e\x01\x00\x00\xff\xff\xd4\x33\x23\xc6\xf1\x00\x00\x00") - -func stdlibDebugPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibDebugPisc, - "stdlib/debug.pisc", - ) -} - -func stdlibDebugPisc() (*asset, error) { - bytes, err := stdlibDebugPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/debug.pisc", size: 241, mode: os.FileMode(436), modTime: time.Unix(1500942096, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibDictsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x94\xcd\x6e\xdb\x3a\x10\x85\xf7\x7a\x8a\x03\x43\x17\xb8\x16\x4a\x69\x2f\x1b\xf1\xa6\xed\xba\x68\x97\x86\x17\x8c\x34\xb2\x88\xc8\xa4\x4a\x8e\x1c\xf8\xed\x0b\x52\x3f\x96\x65\xa5\x69\x36\x49\x86\x67\x66\xbe\x39\x1c\x31\x4b\xf0\x55\x15\xac\x8c\x96\x56\x91\x83\xd4\x25\xb8\x26\x65\xd1\xb1\x6a\x14\xfb\x58\x92\x45\x51\x8e\x52\x15\x2c\x54\x25\xe8\xd2\xf2\x4d\x38\x96\xc5\x1b\xfe\x47\x9a\x42\x88\x70\x76\xc0\x16\x21\xda\x2b\x0e\x38\x62\xef\xe3\x2f\x38\xe1\xbd\x26\x8d\xdd\xac\x88\x36\x2c\xfc\xdf\x0f\x15\xb0\x45\xd9\xb5\xe0\x5b\x4b\xa6\xc2\x66\xe2\xba\x6d\xe0\xd8\x0a\x4d\xbf\xd7\x8b\x92\x76\x9d\xa5\x50\xaf\xd7\x3f\x55\x5d\x41\x7f\x22\xf1\x95\xce\xc4\xc2\x58\x51\x52\x25\xbb\xc6\xc3\x85\x93\x37\xba\x61\x0c\x09\x81\xab\x6c\x3a\xc2\x16\xf9\x18\xcb\xbd\x20\xf7\xd2\x08\xc3\x4f\x1c\x12\xe3\x90\xe9\x1b\xd5\xd2\x89\x37\x0a\xa6\x2c\x8f\xce\xc4\x38\xf9\xf0\x50\xed\x04\x55\x45\xbb\x28\xca\x12\x7c\x27\x2e\x6a\x54\xd6\x5c\x30\x1b\x2e\xc9\x22\xe4\x3f\x7e\x7e\x83\x78\x99\x13\xf6\x64\xe3\xb4\xbe\xea\x6e\xd2\xad\x09\x07\x6f\x8e\xc1\xf3\xbc\xc4\x09\xa5\x6a\xef\xc9\x71\x89\x1e\xe2\x17\xb1\xdf\x88\x90\x5a\x19\x0b\x89\xb3\xba\x92\xee\x89\xb4\xf1\x44\xc1\x91\x2f\x78\xed\x18\x0d\xc9\x2b\x05\xfd\x8c\xd8\xe8\x10\xe9\x8d\x9f\xf0\xf7\x7b\x31\x62\x79\x9e\x01\x6d\x7e\x65\x6d\xe7\xea\x69\x8a\x55\xf5\x20\x74\x61\xda\x69\xdc\x78\x31\xee\x36\x5c\x6c\x63\x8a\x61\xec\xa5\x3b\x4b\xfd\x83\x35\xbd\x2f\x2b\x05\xdc\xbb\x6c\xef\x5d\xf7\x22\xbe\xf3\x59\x2d\x2f\xb4\xda\xd9\xcd\x3a\xef\xff\x31\x67\xb0\x61\xc8\x8a\x3f\x30\x22\xec\xde\xc6\x9f\xd6\xd2\xe1\x95\xfc\x15\x51\x6b\xa9\x90\x4c\x65\x8a\xce\x11\xe2\xab\xb4\x1e\xd4\xff\x52\xda\x31\xc9\x72\x03\xb2\xd6\x58\x64\x49\x18\xf6\xde\x39\x4c\x37\x21\x27\xd9\x44\x1d\xff\xf5\xde\x46\x8a\xcf\x31\x3e\xe4\x38\x3e\x18\x3f\xac\xe5\x67\x6c\x7e\x53\xc3\xaa\x4a\x0d\xd2\x6c\x6f\x60\x03\xb6\x1d\x85\x9d\x25\x59\xd4\xe8\xb4\x2a\x4c\x49\x28\x6a\x69\x65\xc1\xe4\x7b\x83\x6b\xe5\xfc\xeb\xa2\xf4\x79\xf6\x61\xfd\x37\x0c\x78\x78\xda\x88\xe7\xb7\xa6\x07\x3c\xf6\x0f\xc0\xf4\x5f\xff\x95\x07\x50\x5e\xf0\x9e\x02\x8e\xf0\x18\x83\x6c\xb6\xba\x87\xb5\x55\x3c\x8c\x7b\x3e\x3d\x23\x53\x46\xba\xd0\xa7\xe9\xfc\x05\x28\x64\xd3\x60\x17\xfd\x09\x00\x00\xff\xff\x7e\x91\x17\xc6\xe5\x05\x00\x00") - -func stdlibDictsPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibDictsPisc, - "stdlib/dicts.pisc", - ) -} - -func stdlibDictsPisc() (*asset, error) { - bytes, err := stdlibDictsPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/dicts.pisc", size: 1509, mode: os.FileMode(436), modTime: time.Unix(1512944015, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibIoPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x54\x41\x6f\xf3\x36\x0c\x3d\xd7\xbf\xe2\x01\x19\x90\xe6\x43\x9c\xef\x3a\xb4\xc0\x86\x21\x6d\x80\x5e\x96\x61\xeb\xb0\x4b\x81\x55\xb6\xe9\x58\x83\x22\x79\x12\xd5\xc0\xff\x7e\x20\x6d\x27\x59\xbb\x0e\xdf\x4d\x96\xc8\xf7\x1e\xc9\x47\x7f\xfd\x82\xe7\x8e\xf0\xb4\x87\xb3\x55\x34\xd1\x52\x42\x68\xf1\xcb\xd3\x6f\x5b\x7c\xf9\x5a\x14\xfa\x6e\x13\x9a\x50\xc3\x26\xbf\x64\xb4\x21\xc2\x20\xf5\x54\xdb\xd6\xd6\x38\x85\xd8\x48\xe4\xdd\xc3\x7e\x2b\x30\xb7\x28\x4b\xac\x50\x2c\xf0\x2b\x99\x86\x62\x2a\x8a\x6d\x8e\x91\x3c\xbb\x61\x3d\xe2\x76\x26\x21\x92\x69\xac\x3f\xc0\xf8\x06\xa7\x68\x59\xce\xa1\xfa\x8b\x6a\x4e\xe0\xce\x30\x4c\x24\x54\x21\xfb\x06\x1c\x90\x7d\x43\xd1\x0d\x12\x74\x08\xa8\x4c\xa2\x06\x55\x6e\x6d\x98\x73\x36\x78\x34\x75\xa7\xa8\x14\x95\x80\x3b\x42\x1b\x9c\x0b\x27\xc9\x6a\xb3\xaf\xd9\x06\x9f\xe0\x82\x69\xa8\x81\xf5\x1c\x60\x39\xa1\xb1\xfa\x60\xe2\x00\xf2\x2c\xf5\xdf\x15\xc5\x62\xa1\x50\x65\x35\x30\x8d\x15\xe9\x69\x55\x48\x4d\x09\x66\xfc\x6c\x63\x38\x2a\xcf\x44\x6b\x12\x8c\x17\xe4\x35\x12\xb1\x96\x74\x79\x4d\x78\xdc\xef\xa4\x16\x8e\x99\x60\x5b\x7d\x22\xdf\x48\xb7\x55\xab\x75\x04\xab\x8d\xa9\x3b\x6a\x2e\x1a\x62\xf6\x93\x06\x3d\x5d\x34\xfc\xfe\xbc\x2b\xbf\x1f\x2f\xdf\x29\xb9\x24\x3b\x3b\x27\x27\x8e\x57\xb9\x7a\xff\x2e\x6b\x0d\x8e\xf6\x78\x14\xd9\xcb\x97\xb8\xd4\xd1\x2c\x5f\xfc\x12\xa1\x3d\xab\x55\x64\x29\x44\x31\x1f\xf7\xbb\x1f\x15\x94\x73\xf4\xe9\x7f\x2b\x93\x91\x54\x44\x7e\xae\x6f\x8d\xd6\xb8\x44\x08\xdc\x51\x3c\xd9\x44\x45\x71\x5f\x8c\x26\x0a\x3d\xf9\x52\x92\xca\xa9\xaf\xb7\xe8\x0d\x77\x42\x38\x5a\x0a\x2b\xec\x04\x73\x6e\x6c\x67\xde\x08\x06\xaf\xb5\x0b\x89\x5e\x75\x8c\xc3\x68\xa2\xda\x78\x54\x84\xda\x38\x47\x6a\x24\x0d\x51\x55\x57\x96\x9a\x04\xfa\xc6\x11\x3e\x8a\x10\x77\xfe\x4b\xc4\x74\xb1\xc2\x1f\x7a\x48\x6a\xd5\x64\x8f\xbd\xa3\x28\xb4\x7e\x16\xb6\xc6\xe8\xc3\x41\x75\x04\xef\x86\x31\x57\xbb\x9f\x10\xa2\x0c\xc5\xfa\x43\xc2\x7d\x71\x33\xd2\xea\x7b\x39\x5e\xe3\x56\x87\xa6\xeb\xa4\x54\xfa\x29\x0e\xea\x08\x86\x59\xfb\x38\xab\x99\x75\x8f\x00\xd3\xd8\xbf\x39\x7d\x0d\xd3\xf7\xe4\x75\x23\x5f\xfc\x1c\x24\x33\x9c\x71\xa5\x15\xd2\x80\x1f\xce\xda\xe4\xe6\x67\x73\xa4\xc9\x5c\xdb\xe0\x99\x3c\x27\xac\x80\x9f\x90\xd9\x3a\xcb\xc3\x79\xef\xf4\xaf\x31\xef\x7c\x3a\x1a\xe7\x34\x3f\x8d\x7b\x38\xb5\x61\x83\x87\x00\x1f\x18\x59\x8c\xe1\xe1\x4c\x3c\xd0\x14\x77\x16\xd2\x47\xfb\xf6\x67\x9f\x39\x5d\xd7\x77\x75\x6b\xd3\xfb\xf1\xea\x1f\x2a\xcb\x2f\x43\x44\xf4\xd1\x7a\x5d\xcd\x37\xe3\xf2\x0c\x8c\x93\xe5\xae\x0c\x99\xfb\xcc\xf3\xa4\xff\xce\x81\x05\x7d\xb3\xc1\xaa\xb8\xb9\x93\xcf\xe2\xe6\x83\x2d\x9a\xdc\xe3\x3b\x0d\x15\x08\x6c\xd4\x60\x62\xe5\x05\x9e\xf7\x0f\xfb\x62\x81\x09\x7c\x6c\xb0\x70\xe0\x4c\x68\xfd\x27\x7c\xf8\x0f\xc2\x69\x19\x3e\x21\xfc\x27\x00\x00\xff\xff\xb2\x42\xc8\x50\xc8\x05\x00\x00") - -func stdlibIoPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibIoPisc, - "stdlib/io.pisc", - ) -} - -func stdlibIoPisc() (*asset, error) { - bytes, err := stdlibIoPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/io.pisc", size: 1480, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibLocalsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x92\x4f\x8b\xdb\x30\x10\xc5\xef\xfe\x14\x0f\xb2\x87\x75\x16\x27\x77\x07\x0a\x25\x0d\x65\xa1\xb4\x61\x73\x0c\xa1\x0c\xf2\x38\x11\x49\x24\x57\x1a\x67\xfb\xf1\x8b\xfe\x38\xeb\xac\x7b\xd0\x41\xcc\x9b\xdf\xbc\xf9\xb3\x9c\xe3\x87\x55\x74\xf1\xd0\x06\xdb\xd7\xdd\x1a\xf3\x65\x51\xd4\xdf\x7e\xad\xe1\x59\xaa\x4b\x88\xe1\x19\x37\xba\xc0\xd0\x95\x51\x55\x28\xb1\x63\x49\x3f\xb1\x31\x82\x55\x4e\x39\x8e\x52\x06\x79\x10\x94\xf8\xce\x02\x39\x71\xf8\xf5\x0c\xf2\xde\x2a\x4d\xc2\x0d\xde\xb5\x9c\x40\x48\x59\x29\x3a\xc5\x79\x3c\xa7\xca\xdb\xde\x07\xb5\x17\x52\x67\xb4\x2e\x94\x68\xad\x43\x16\x59\x23\x36\x56\xc9\xff\x24\x1b\x68\x8d\xb3\xdd\x67\x9c\xed\x40\x99\x63\xdb\x3b\xa6\x6d\xa7\x94\x3b\x86\x49\x9d\xee\x4d\xfe\xe9\xad\x60\x8f\x33\x6e\xa8\xb0\x58\xe0\x10\xb8\x29\x6f\xb1\x40\x09\xbc\xf5\x06\x14\x65\x24\xda\x9a\xe8\x36\x10\x72\xc3\xda\xc4\x4a\xaa\x77\x8e\x8d\x3c\xf4\xb5\xdb\x6c\xea\x98\xf8\xa5\xd1\x4a\x62\xfd\xe5\x1c\x6b\xdb\x69\x6e\xd0\x3a\x7b\x45\x4b\x4a\xac\x0b\x0b\xab\xa1\x4e\x64\x8e\x3c\x38\xba\x91\xfb\x99\xc7\x1f\x6d\xf8\x77\xea\xb0\xc7\x7e\xb4\xa0\x03\xce\xcc\x1d\x0e\x68\x74\x17\xdf\xc7\xba\x57\x28\x8a\x19\xbe\x8a\xf0\xb5\x13\x6d\x8e\x61\xcd\x99\x9f\x17\x55\xd4\xdb\xb7\x0d\x9e\xea\xff\xd4\x2b\x07\x69\xf2\x1b\x8f\x0b\x5b\xc7\xad\xfe\xcb\x3e\x78\x9d\xe1\xd5\x28\xc7\xd7\xd0\x2f\x99\x06\x0d\xe7\x5f\x81\x48\xad\xaa\xd1\xf1\x94\x31\x9c\x7c\x55\x37\x72\x58\x65\xd5\xcb\xcb\x83\x4a\x9b\x4f\xaa\x62\x16\x4f\x2e\x14\xf0\x2c\xd9\x75\x4a\x7d\x9a\x1c\xe7\xc7\x54\x06\x7c\x3d\xb9\xf9\xd1\x78\x8a\x2c\xfa\x1d\x54\x71\x39\x8f\xb8\xa6\xef\x46\xc8\x38\xfb\xa0\xaa\x82\x91\xd5\xbf\x00\x00\x00\xff\xff\xaa\x09\x9f\x67\x71\x03\x00\x00") - -func stdlibLocalsPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibLocalsPisc, - "stdlib/locals.pisc", - ) -} - -func stdlibLocalsPisc() (*asset, error) { - bytes, err := stdlibLocalsPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/locals.pisc", size: 881, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibLoopsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\xcb\x31\x0a\x02\x31\x10\x46\xe1\x7e\x4e\xf1\x97\xeb\xc2\x66\x7b\x53\xaa\x9d\xe0\x15\x46\xe2\x80\x81\x98\x44\x67\xa2\x1e\x5f\x42\xac\xb7\x7d\x7c\x6f\x9d\xe9\x5c\x4a\x55\x57\xa3\x06\x9a\x57\xa2\xfd\xf1\x72\x80\xc5\x87\x28\x26\x64\x3c\x5b\x31\x2c\x0b\x9c\xc3\x0e\xa7\xaf\x84\x66\x02\xee\x95\x91\xff\xce\x8f\xe9\x73\x8f\x49\x30\xa1\xbe\xe4\xb6\xf9\x0d\xc8\xdd\x31\x92\x5c\xdf\xa2\x60\x63\xf8\x5f\x00\x00\x00\xff\xff\x8a\xf6\x37\x23\x8e\x00\x00\x00") - -func stdlibLoopsPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibLoopsPisc, - "stdlib/loops.pisc", - ) -} - -func stdlibLoopsPisc() (*asset, error) { - bytes, err := stdlibLoopsPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/loops.pisc", size: 142, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibMathPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x95\x4f\x6f\xe3\x36\x10\xc5\xef\xfa\x14\xef\xb8\x71\x23\x24\xca\xd1\x71\x1c\x74\xbd\xdd\xb6\xc0\xa2\x3e\x24\xb7\x20\x80\x29\x69\x24\x33\x95\x48\xed\x90\x8a\xed\x7e\xfa\x82\xb4\x6c\x51\xf2\x1f\xec\xcd\x30\x7f\xef\x0d\xf9\x38\x43\x4d\xbf\x2d\x17\x98\xe7\xba\x4d\x2b\xc2\x17\x6c\x11\xc7\xc8\x71\x83\x85\x26\xce\x08\x02\xaa\xad\x53\x62\x58\x0d\x81\x0e\x7b\x8c\xbc\x4a\x64\xda\x1c\x24\x3b\xdc\xe0\x77\xce\x90\x69\x23\x15\xe1\x11\x3d\xb2\x0e\x99\xbf\x76\x0d\x71\xaa\x2b\x99\x41\x9c\xc1\x8d\x54\x63\xc7\x13\xe0\x9a\xdf\x10\xb6\xe2\xc4\xcd\x0a\x55\x92\xb2\x03\xe6\x9a\xa1\xe7\x7b\x3c\x4b\xd9\x86\xf4\xa2\x4d\x09\xac\x75\x40\x90\xac\x06\x04\xc9\x4a\xaa\x12\xba\xe8\xf3\x6b\x98\x32\x69\xa4\x56\x87\x70\x8f\xe2\x61\xa0\x8b\x61\x3a\x57\xb2\x1c\xe5\x48\x5c\x84\xe0\x1f\xcc\x9a\x51\xb4\x2a\xb3\xae\x68\x40\x65\xc3\x72\x75\x53\x51\x4d\xca\x0a\xde\x81\x2e\x88\xb6\xcd\xc0\x7a\xdb\x68\x45\xca\x4a\x31\xa6\x1e\x42\xec\x75\xa3\x61\xd7\x84\x46\x6f\x88\x5d\x16\xab\xed\x2a\x84\xeb\x24\xa4\x57\xae\x48\x82\x78\x75\x8b\x5a\xf3\x21\x2f\x42\xa1\x19\xa6\x16\x55\xd5\xe5\x66\x70\xf4\x28\x2a\xad\x39\xf4\xf8\xee\xff\xf8\xa5\xd4\x4b\x51\xd7\x22\xd4\xfe\xe9\xff\x38\x1e\xfd\x75\xf9\x6d\x79\x84\x3f\xee\x43\xf2\xe3\x1e\x5f\xc9\x18\xaa\x4e\x83\xfa\x18\x1c\xe9\xbb\x64\x63\xf1\xaf\x54\xf9\x45\x41\xa5\xcb\x50\xf1\x8f\xb0\x2d\x8b\x0a\x3f\x74\x29\x58\xda\x75\x8d\x47\xf4\x64\x32\xd8\xc6\x0f\x5d\x22\x15\x86\x90\xdc\x87\x76\xc9\xe0\xaa\x56\x5b\x24\xf8\xcd\x97\x59\xdd\x22\x6d\xed\x3e\x5c\x91\x65\x2d\x0b\x4b\xd8\x48\xbb\xee\xe2\xfd\x14\x55\x4b\x26\xb4\x7a\x38\x5b\xee\x21\x44\xd2\x10\xf9\x2a\x95\x6f\xa2\xae\x3d\xdc\x45\x6c\x8f\xf0\x68\xca\x5f\x5c\xeb\x9e\xc4\x71\x65\xd2\xcd\x79\xc1\xcf\xe1\x6c\xbe\xfc\x6c\x05\x77\xd3\x79\x02\x8f\x9e\x86\xd7\xee\x59\x38\xc7\x5d\xda\x85\xbd\xa8\xe1\x56\x0d\x06\xeb\x6f\x65\xa9\x24\xde\xc7\xea\xa3\xb8\x85\x30\xc1\x7b\xda\x09\x77\x83\x4b\x5d\x72\x4e\x1c\xff\x47\xac\x4f\x5a\x46\x17\x7e\x9a\x0c\x65\x5a\xe5\xfb\xae\x3a\x7a\x24\xa7\x1e\x5a\xd1\x2f\x5a\xdc\x4d\x22\xd7\xed\x53\xb8\x2e\x70\xeb\x76\xa3\x21\xb8\x44\x2d\xec\xfa\x28\x36\xd1\xe4\x2e\x9a\xa2\xf6\xd7\x28\x90\xba\x6a\xbe\x71\x88\x71\x83\x87\xbc\x6d\x30\xc7\x1b\x94\x6c\xf0\x8e\x37\xe4\xac\xdd\x0f\x59\xb8\x0f\x07\x6a\xb1\xed\x55\x95\xe0\xd2\x8b\xd0\xcb\x3a\xfc\xa0\xf7\xb2\xe8\x6e\x82\x17\x5d\x93\x6b\x3b\x99\xed\x77\xe3\xf7\x40\x9f\xa4\x9e\xf1\x05\xca\xb9\x3d\xbb\xea\xa8\x75\x0e\x97\xda\xb3\x2f\x97\xcb\x4f\x69\x34\xef\x99\xfa\x40\x85\x4c\x34\xc5\x53\xbf\x23\xb7\x1a\xf7\x6b\x77\x13\xcc\x20\x0d\x44\xc5\x24\xf2\x1d\x72\x2a\xa4\xa2\x7c\x5f\x7c\x3e\xd2\xcd\xa0\xdc\x97\x20\x9a\x62\x36\x5a\xf1\x87\x9b\xe1\x0d\x4f\x78\x47\x2e\x1b\x68\xf6\xdc\x7c\x64\xf0\xd4\x39\x44\x53\x88\xd4\xf8\xc5\x38\x86\xc0\x0d\x9c\xc1\xbd\xb7\x88\x13\x4c\xf0\x8e\xcd\x9a\x5c\xcb\xfd\x1f\x00\x00\xff\xff\x5a\xd8\x7d\x5b\xc0\x07\x00\x00") - -func stdlibMathPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibMathPisc, - "stdlib/math.pisc", - ) -} - -func stdlibMathPisc() (*asset, error) { - bytes, err := stdlibMathPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/math.pisc", size: 1984, mode: os.FileMode(436), modTime: time.Unix(1500942096, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibRandomPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x14\xca\xc1\x09\x80\x30\x0c\x40\xd1\x55\xfe\x51\x0f\x59\x40\xa7\x09\x49\xc0\x42\x9b\x16\xad\xba\xbe\x78\x7f\x1b\x76\xf4\x62\xc1\xc2\x13\x86\x08\x51\xa3\xb1\xe2\xf7\xa0\x46\x72\x6a\xba\x94\x9c\x5c\xaf\x0e\x5a\xf7\xdf\x89\x4e\xf6\x2f\x00\x00\xff\xff\x3c\x4d\xec\x7d\x3b\x00\x00\x00") - -func stdlibRandomPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibRandomPisc, - "stdlib/random.pisc", - ) -} - -func stdlibRandomPisc() (*asset, error) { - bytes, err := stdlibRandomPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/random.pisc", size: 59, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibShellPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x54\xcb\x6e\xdb\x3a\x10\x5d\x8b\x5f\x71\xc0\x78\xe1\x2c\x68\x38\x5b\x45\xd7\xc0\x7d\x24\xb7\xd9\xa4\x05\xd2\x9d\x23\x14\x8c\x38\x8e\x88\xd0\x24\x2b\x52\x36\xfa\xf7\xc5\x50\x7e\xb6\x5d\xd8\x20\xcf\xbc\xcf\x19\x4a\xd4\x70\x09\x73\x28\x85\x5b\x38\x9b\xb2\xda\x58\x47\x09\x6b\xc4\xc1\xfa\x8c\x16\x3b\xea\x14\xe9\xae\xc7\xbd\x10\x35\xac\x57\xc6\x0e\x98\x83\xff\xbf\x8f\x21\x73\xe4\x62\x81\x5b\x88\x2a\xee\x0d\xea\x38\xd0\x4e\x54\x6b\x74\x06\x2d\x8c\x8d\xe8\xb4\x73\xa2\x9a\x31\x8e\xce\x88\x92\x25\xf5\xe4\x9c\xda\x06\x33\x3a\xc2\xfc\x94\xe7\x56\x54\xcd\x8e\xba\x1c\x86\x15\xea\xa8\x73\xdf\xdb\x94\x39\xd9\xec\x78\x01\xd7\xe0\x8e\x74\x8c\xe4\xcd\xd9\x0b\x2d\xea\x38\xa6\xde\x5c\xbb\xb3\x6b\x0c\xf1\x4d\x77\x1f\x48\x7b\x1d\x7f\x09\x08\xd1\x08\x51\x35\xc6\x76\x79\x05\x33\x46\xd4\xa9\x07\x67\xb8\x60\xa2\x45\xd3\x28\x97\x18\x15\x55\x75\x45\x91\xa8\xaa\x8a\xa3\xd4\x6a\x1b\x0c\x41\x1a\x89\x94\x07\xd5\x05\x9f\xb5\xf5\x97\x24\xae\x61\x86\x10\xd1\xc2\x6e\x38\xea\x82\x55\x51\x1d\x0a\x98\x52\xb8\xcc\x00\xb9\x58\xc8\x89\xc1\xa6\x51\x63\x3c\x1b\x8e\x58\x57\xe6\xe4\xfe\x4f\x10\xcf\xc8\xe0\x3b\x65\xc5\x5d\xe8\xac\x78\xd6\x83\xbf\x2e\x3c\xca\x57\x7f\x6c\x71\x2c\x7d\x35\x8d\xda\x77\xae\x98\xbe\xfc\xfd\xf5\x93\x04\xf9\x9d\x7a\xa7\x83\x89\x21\xb6\x5d\x81\xe4\x8b\xbe\x6b\xa8\xd9\x9f\xa7\x6e\x27\x3f\x9b\x78\x53\x4a\xea\x17\x96\x1b\xcb\xc5\x9d\x9c\x4c\xdb\x60\xbc\xde\xd2\xb4\x0b\x7a\xff\xa1\xac\xb7\x19\x73\x84\x98\x6d\xf0\xe9\xb8\x52\xa2\xba\xc1\xbf\x03\xe9\x6c\xfd\x3b\x72\x4f\x48\x59\x67\xc2\x9b\x4e\xb6\x4b\xd8\x84\x01\xda\x97\xf0\x94\x7f\x38\xe2\x4a\x2d\xea\x7f\x1e\xfe\x7f\x7a\x3e\x9c\x1f\x9e\xff\x13\x95\x7c\xcd\x12\xf5\xd3\xe3\x0b\xf8\xec\x25\xea\xcf\x8f\x2f\xa2\x92\x12\xf5\x52\x54\x19\xb5\x27\x32\x49\xa5\xe8\x6c\xbe\xdc\x3f\x67\xfd\x31\xe7\x40\x89\xb2\xda\x84\x41\x1d\xc1\xda\x5a\xcc\xf8\xc7\x00\x1c\x79\xac\xfe\xc2\x1a\x52\x16\xad\x27\x94\xed\x65\x55\xf3\xa4\x7b\x3b\xe5\x54\x93\x14\xb3\x8b\xb2\x1c\xb2\xc4\x8c\x7b\x64\x26\x27\xac\x38\xa3\xc5\xbe\x27\xcf\xb1\xe4\xd3\x38\xd0\xb1\x4f\x16\xe5\x7c\x3f\x54\x5c\x9e\xeb\xd5\x77\xbf\xf9\x30\x7a\xda\xf6\x32\x44\xe1\x6a\x92\xe4\x44\x1b\x93\x36\x41\xcc\x1e\x3f\xfa\x1b\x8c\x89\x90\x7b\x9b\x90\x03\x12\xe5\x49\x8b\xa2\xa9\x4e\xe5\xb2\xb7\xb9\x4f\x5d\x88\x24\x6a\x76\x56\x93\xf1\xf0\x55\xb9\x7a\xec\xf2\x1b\xfb\x4a\x4e\xa3\x5c\xe8\xb4\xc3\xfd\xcf\x00\x00\x00\xff\xff\x46\xbd\x3e\x73\x83\x04\x00\x00") - -func stdlibShellPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibShellPisc, - "stdlib/shell.pisc", - ) -} - -func stdlibShellPisc() (*asset, error) { - bytes, err := stdlibShellPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/shell.pisc", size: 1155, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibStd_libPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x54\xc1\x6e\xe3\x36\x10\xbd\xfb\x2b\x1e\xb6\x87\x46\x41\x6c\x77\xb3\x37\x1b\xa8\x51\x6c\x2e\x0b\xb4\x48\x8b\x04\xe8\xc1\x35\x1a\x5a\x1e\x45\x84\x69\x52\x25\x47\x56\xfc\xf7\xc5\x0c\x25\x59\x8b\xe4\xb0\x87\xdd\xc8\xe4\xbc\xf7\xe6\x0d\x67\x66\x79\x8b\xdf\x50\x51\x87\x32\x44\x42\x17\xe2\x21\xa1\x0a\x11\x7f\x7e\x7b\xfa\x0a\x7a\xa3\xb2\x65\x1b\xfc\x02\xb7\xcb\xd9\x6c\x85\x26\x5a\xcf\xce\xe3\x06\x06\xf3\x39\x50\xe0\xd7\xc4\xd1\xfa\x57\xb9\x39\xff\xdb\xb4\x9c\xf0\xe9\x1f\xff\x69\xf2\x73\x3d\xe2\x06\xd4\x47\xa0\xf5\x6c\x36\x5b\xde\xe2\xb9\x26\x54\xc1\xb9\xd0\xc9\x75\x69\x9c\x4b\x30\x91\xc0\x35\xa1\x6c\x63\x24\xcf\x48\x6c\xca\xe3\x3c\xd5\x6d\x55\xb9\x9e\xe4\x64\xd9\x9e\x29\x69\x92\xb3\xd5\xc3\xe3\x57\x38\x92\x24\x1d\x79\xb3\x77\x24\xa2\x8e\xfc\x2b\xd7\x28\x80\xdf\xc9\xc3\x26\xa5\x7c\x0d\x38\x50\x65\x3d\x1d\xd4\x39\xb8\x36\x2c\x27\x14\xd3\x00\x28\x6b\x2a\x8f\x22\xc3\x61\x80\xf0\xa5\x21\xa4\x4b\x62\x3a\x41\x13\x57\x45\x7b\x6a\x42\x14\x8f\x95\x75\xd4\x18\xae\x45\x75\xb1\x40\x81\x97\x7c\xf5\x32\x3a\x60\x73\xa4\x04\xa3\x91\x90\xd0\x3b\x18\x7f\x80\x61\xa6\x53\xc3\x49\xa4\x72\xe5\xb3\x71\x0d\x33\x9c\xb3\x8b\xe4\x8c\x98\xbd\x82\x17\x9a\xc3\x4f\x78\x7e\x7c\x78\x5c\xe1\x8f\x70\xce\xa8\xc4\x86\x4f\xe4\x85\x4e\x70\x7d\x7a\x5c\x53\xa2\xde\x8b\x8d\x88\x94\x1a\x2a\x95\xef\x14\x0e\xad\xa3\xa4\xcf\xf0\x24\x25\x46\x2e\xb1\xd4\xe2\x76\x99\x3d\x1e\xda\x66\x78\x44\x03\x83\x02\x0f\x6d\xe3\x6c\x69\x98\x72\x3d\x39\x34\x08\xd5\x20\x5f\x1e\xb1\x9e\xad\xde\x83\x7e\x41\x63\xcb\xe3\x5c\xce\xd7\x7d\xf1\xee\x7f\x84\x99\xbb\x00\x72\x94\x4d\xbd\x93\x19\x29\xf6\x99\x64\xaf\xff\x0a\xdc\x63\x8b\xcf\x57\xc5\x1d\xd8\x9e\x28\x8d\xca\xa9\x33\x13\xd8\x5e\xb5\x9f\x3a\xd3\xfc\xa8\xec\x47\xf8\x41\x2e\x86\xec\x10\xfa\x35\x76\xff\xe0\x9f\x9c\x32\x78\xfb\x1d\xc1\x15\xde\xdf\xdf\x8f\xe8\x7d\xc6\x8b\x23\x3d\xbb\x7a\x59\xe1\xcb\x24\xaa\xcc\x71\x5f\x3e\x8a\x0b\x67\x8a\xb8\xc1\x1b\x2e\x12\x24\x7f\xde\x26\x92\x93\x27\x39\xf4\x69\xfd\xd7\x06\xce\x15\x2d\xf0\xdc\x37\xae\x9c\x19\xd9\x0b\xb9\x6f\x71\x36\xae\xa5\xdc\xc4\x3a\xcd\x52\x22\x3d\xc3\x5e\xea\x14\xfc\xa4\x68\xa6\x62\x8a\x3a\xda\x3a\x55\x35\x4d\xd8\xb4\x58\x47\x22\x51\x5e\x2c\x0c\xde\xf4\x6e\x85\x6d\xff\x6b\xae\x23\xb5\xc7\x0e\xfd\x87\xe4\xae\x8e\xb6\xca\x88\x9d\xa6\x2d\x3e\xf7\x76\xcc\xfe\xb3\xfe\x7f\x9f\x31\x32\x90\xdb\xac\x91\x83\x15\xb7\xd6\xb6\xff\x56\xe9\xd4\xe8\x53\x8f\x3d\x6f\x2b\xdc\x60\x03\x8e\x2d\xfd\x25\xa5\xa8\x8c\x4b\xf9\x6b\x3e\x97\xf9\x69\x1d\xa3\x90\xa8\x8d\x6e\x95\xbb\x4c\x28\xe1\x2a\x7b\x87\xc0\x35\xc5\xce\x26\xca\x37\x23\x7e\x81\x87\x7e\xf7\x98\x84\x97\x8d\xde\xbe\x68\xee\x13\xc9\x1c\xde\x4b\xa1\xc0\x66\xc8\x77\x79\x8b\xbf\x6b\xf2\x93\x84\x65\x6b\x77\x72\x74\x09\x2d\x0e\xc1\xff\xcc\xf0\x24\xec\xce\x49\xdb\xda\x4a\x2d\xe5\x90\x91\x7e\x24\xde\x62\x77\x25\x97\xae\xec\xfb\xc9\xe7\x5e\x7a\xd7\x49\x92\xa6\xd7\xe5\x71\x9d\xdb\x42\x67\x3d\xef\x7a\x8d\x28\x1d\x99\x38\xcf\xef\x7e\x33\x10\xe5\xfd\x2d\x9b\xee\xb2\x81\x0f\x8c\xdd\x95\xbd\xab\x65\xab\xad\x67\xff\x07\x00\x00\xff\xff\x8d\xf7\x0d\x9f\x96\x06\x00\x00") - -func stdlibStd_libPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibStd_libPisc, - "stdlib/std_lib.pisc", - ) -} - -func stdlibStd_libPisc() (*asset, error) { - bytes, err := stdlibStd_libPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/std_lib.pisc", size: 1686, mode: os.FileMode(436), modTime: time.Unix(1511844549, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibStringsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x53\x3d\x6f\xdb\x30\x10\x9d\xa3\x5f\xf1\x1a\x64\x88\x92\x32\xe9\xec\x00\x36\x82\xb4\x43\x26\x0f\xee\x66\x18\x10\x4d\x9d\x23\xa6\x12\x29\x93\x27\xbb\xfe\xf7\xc5\x51\x1f\x56\x3b\x75\xd3\x1d\xdf\xbd\xf7\xee\x43\xcf\x0f\xc8\x36\x1c\xac\xfb\x88\x4f\xad\x8d\x26\x1b\x22\x54\xda\x95\xb5\x7c\x9c\x7d\x28\x23\xb4\x2b\x11\x3b\x53\x65\x0f\xcf\x59\xb6\xf8\xbe\x7e\x43\xe4\xa0\x8c\x77\x46\x33\xee\xa1\xb1\x87\x52\x30\xc8\xf1\x96\x72\xe4\x34\x13\xb8\x22\xb0\x6f\xc1\x67\x2f\x78\x51\x81\x77\x29\x1d\x59\x9b\x5f\x78\xe9\xb9\x96\xfd\x63\x22\x52\x4a\xa0\x3d\xd1\x89\x02\x43\xbb\xcb\x80\x3e\xe9\xba\x23\x58\xc7\x1e\x7a\xe0\x1b\x19\x22\x87\xa5\x75\x62\x45\x8a\x95\x12\xd4\x17\xe4\x78\x65\xa6\xa6\x65\xb0\x87\x19\xf9\xc6\x52\xa1\x71\x02\xa4\x0f\x0a\x33\x22\xf5\xe9\xad\xc3\x3d\x4e\x64\x10\xa9\xbd\x3a\xfa\xd9\x05\x07\x2d\x79\xf6\xe1\x1f\x1f\xfb\x0b\x8a\xa1\x8d\x22\x4d\xab\x8b\x92\x96\x7a\xeb\xb0\x27\x3e\x13\x39\xe8\xba\x4e\xdd\x53\x4d\x0d\x39\x8e\xf0\x07\x14\x27\x32\xc5\x5c\x3e\xb6\xb5\x1d\x3b\x19\xf4\xc5\x4a\x8e\x4d\x7a\x98\x24\x07\x03\x83\x9d\x5e\xaf\x88\xd4\x16\xd0\x11\x1a\x25\xd9\xda\x36\xc4\x7f\xf7\x26\xd3\xb8\xac\xae\x73\x5a\x21\xc7\x7b\x04\x57\x36\x8e\xbc\x03\x64\x5e\x74\x5c\x5d\x97\x2c\x15\xaf\xe1\x3f\x96\x4b\xc7\x4e\xd7\x73\x9e\x65\xe8\x1c\xa9\x40\xba\xa4\x70\x75\xe0\xf7\x9f\xb2\xed\x40\x72\x31\x1a\x73\xcc\x21\xf8\x66\xea\xf7\x2b\x22\xf5\xaa\xc5\xf6\x7d\xbd\x2b\x50\x7a\x13\x71\xf0\x01\x8d\x0f\x72\x16\x07\x3f\x6a\x91\x36\x95\x32\x95\x1e\x55\x8e\x9d\x67\x91\x7a\x7a\x42\x8e\x1f\xbf\xc9\x74\x4c\x28\x24\x5b\x24\x02\xc1\x43\xf0\xda\x30\x85\x7b\xb1\x90\xcb\xda\x8a\xc8\x41\x56\x93\x2d\x86\x73\xef\xa6\x13\x4b\xec\x4a\xc1\x75\xcd\xda\x98\x2e\x44\xe4\x58\x58\xe7\x28\x64\x37\xdf\xb0\xb0\xd9\xcd\x16\x77\x29\x9e\x26\xb8\xc5\xe3\xa3\xc5\x0e\xe7\x8a\x1c\x76\x33\x93\xd9\xcd\x9d\xcd\x46\x15\x99\xb4\x8c\x44\x6e\x38\x6e\x24\xce\xc1\x97\x96\xfc\x01\xb7\xfd\xbf\x79\x3b\x31\x4e\xce\x5c\xbf\x21\xf9\x4c\xe3\x52\x69\x53\x92\xcc\x27\xb0\xf3\x8c\x17\xfc\x09\x00\x00\xff\xff\x74\xb0\x4a\xc5\xf1\x03\x00\x00") - -func stdlibStringsPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibStringsPisc, - "stdlib/strings.pisc", - ) -} - -func stdlibStringsPisc() (*asset, error) { - bytes, err := stdlibStringsPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/strings.pisc", size: 1009, mode: os.FileMode(436), modTime: time.Unix(1500942096, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibSymbolsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xce\xb1\x0e\x82\x30\x10\xc6\xf1\xbd\x4f\xf1\x1f\x81\x04\xd9\xc5\x48\x0c\xee\x0e\x3e\xc1\xa1\x97\x48\x82\x45\x68\x1b\xe3\xdb\x9b\x4a\x43\x18\x1c\xdb\xfb\x7e\xf7\x5d\x55\x98\xeb\xe7\xd9\x8d\x83\xdb\xbd\x7a\x77\x33\x45\x65\xf6\xe7\x4b\xcb\xc1\xfd\x7e\x8f\x64\x94\x25\x39\xed\xac\xe2\x15\x21\xd8\x7e\x0a\xca\x32\xa6\x5e\xd2\xf1\x55\x5a\x9d\xc8\x10\x3a\x22\x69\xc8\x39\xcd\x8a\x7f\xa8\x53\xfc\x7b\x4c\xc4\x61\x47\x8f\x4e\x41\x06\xa8\xcd\xc6\xaf\x7c\xa3\x05\xb1\x77\xba\x94\x4f\x1b\x9a\x58\xfb\xdf\xac\x87\xc4\x92\xda\x7c\x03\x00\x00\xff\xff\x27\x8e\xbf\xf1\xde\x00\x00\x00") - -func stdlibSymbolsPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibSymbolsPisc, - "stdlib/symbols.pisc", - ) -} - -func stdlibSymbolsPisc() (*asset, error) { - bytes, err := stdlibSymbolsPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/symbols.pisc", size: 222, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibVectorsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x55\x4d\x8b\xe3\x46\x10\x3d\xab\x7f\xc5\x83\x35\x64\xec\x89\x67\xd6\x9a\xdd\x1c\xe4\x10\x08\x31\x84\x9c\x02\x1b\xd8\x8b\x30\x6c\x8f\x55\x8e\x9b\x48\xdd\x4a\x77\x4b\xf6\xfc\xfb\x50\xa5\x4f\xaf\x9d\x4d\x4e\x33\x5d\xf5\xaa\x5e\xd7\xab\xd7\xf2\xf3\x0a\x9f\xe9\x10\x9d\x0f\xd0\xb6\x40\x3c\x91\xf1\x68\xa2\x29\x4d\x34\x14\xb0\x7a\x56\x2a\xdb\xfd\xfe\x0b\x5a\x3a\xac\x03\xc5\xb5\x8e\x78\xe0\x03\x5a\x5d\xc2\x14\x17\xac\xd7\xa0\x92\x2a\x2c\xf1\x07\x45\xce\x44\xe7\xa1\xa3\xe4\xa2\x63\x58\x43\xd8\x4e\x4d\xc6\x06\xd7\xc5\xbf\x52\x94\x7f\xc9\x46\xa9\xb6\x05\x5d\x86\xb2\x1f\xbb\xae\x3f\xe1\x81\x0b\x7a\x8a\x25\x7e\xb3\x26\x42\xc3\xd2\x79\x88\xcd\x68\x48\x1f\x4e\x3d\xd1\xdf\x8d\x8b\x5c\xf8\xf4\x84\x25\x3e\x35\x16\x5f\x38\xf2\x05\x47\xe7\x21\xb0\x81\xd7\x58\x9e\x7f\x6a\xa6\x32\xa4\xfd\xe1\x01\x1a\xaf\x3d\x3b\x96\xd3\x8d\x52\xe4\x08\x67\x5d\x0b\x67\xed\xa9\x26\x5b\x60\x8f\x68\x2a\x0a\x5d\x87\x4d\x18\x06\x9e\x86\x7d\x3f\x28\xb1\x65\x0a\x5b\xdc\x00\x36\x73\xc0\x8b\xbf\x05\xa4\x73\xc0\x87\x78\xba\x01\xbc\xcc\x01\x1f\xef\x00\x3e\xcc\x01\x3f\xdc\x01\x7c\x9c\x00\xef\xb0\x73\xf6\xbb\x08\x5d\x14\xa8\x9c\x27\x9c\xc8\x13\x1a\x5b\x52\x08\x2c\x99\x27\x98\x00\x8d\x55\x4b\xfe\x6d\x85\x3f\x9d\x2b\xe0\x49\x07\x67\x7b\xf7\xb0\xcc\x29\x33\x6c\xd0\xa6\xe3\x42\xda\x17\x2c\xf1\x73\x5d\x97\xec\x34\x2d\x61\x1d\x8d\xb3\xec\x9b\xf9\x62\xce\x26\x10\x6a\x6d\x3c\x6f\xa8\xdd\x88\x51\xdb\xf4\x7b\x86\x79\x0a\x4d\x29\x9b\x6b\x5f\x64\x92\x3b\x4c\xf9\xb0\x3b\xfd\x8a\x7d\x47\xaa\x92\x4c\x52\x59\x9b\x22\x6b\x37\x2a\x79\x8f\xcc\x4c\x5b\x7d\x97\xb9\x26\xaa\x64\xd1\xa6\x28\xc9\x62\xd1\x6e\xe4\x6f\x65\x2c\x72\x95\x24\x7c\x5e\x98\x41\x1e\x09\xa4\x53\x40\x25\x89\xf4\x96\x53\xcd\x86\x50\x49\x92\x63\x83\x47\xec\xb1\xc8\x8c\x4a\xe6\xfe\x60\x75\x42\x5d\xea\x99\x49\x4c\xa4\x2a\x60\x89\x5d\x53\xd5\x62\xc8\x83\xb3\x91\x6c\x0c\x70\xc7\xb9\x41\x9d\x8d\x4e\xce\x21\xea\xc3\x5f\x32\xfd\xbd\x4e\x4f\xe2\xfb\x9c\x47\x1f\xde\xc5\x76\xf6\xa8\x3d\xb5\xe4\x03\x4d\x45\x7d\xa0\x33\xfa\xa7\xee\xc0\xeb\x99\xde\xd8\xff\xa8\x53\x49\xd1\xd4\xc8\xf8\xc0\xca\x65\xfc\x2c\x58\x63\x25\x4a\xac\x45\x09\x51\x66\xc1\x99\x14\xcf\xa2\x4f\xde\x89\x49\x87\x99\xbc\xd9\x65\x8c\x31\x74\x88\xbe\x8d\xd1\xb7\x01\xdc\x7f\x9e\x98\x74\x4c\x5e\xa6\xaa\xeb\xf4\x7a\xdd\x2d\xe6\xf1\x71\x5a\x88\x92\x22\x25\xcf\x96\x2b\x8e\xa6\x8c\xe4\xbf\xfa\x8a\x74\x41\x2a\x3e\xf7\x73\x8e\xa6\xc9\x2c\x9d\xa5\xb7\x58\x8b\x07\x55\x49\x02\x96\xa1\x77\xe1\xa2\x03\x4c\xdf\x8b\xce\x1d\x43\x21\xf6\xc8\x51\x78\x57\x63\x0f\x73\x04\xdf\x6a\x58\x98\x4a\xfa\xda\xe9\x6e\x95\xae\xbf\xba\x58\xc5\xed\xba\x6b\x29\x8c\xfe\xa6\x43\xa7\x3b\x3a\x41\x78\x19\x39\x14\x6e\x64\x16\xf8\x18\x97\x2b\x5e\xcb\xca\x37\x53\x09\x44\x30\x8c\x8a\x61\x94\xec\x79\x85\xd1\x53\x8c\x3d\x7a\x67\x67\x56\xec\x67\x5c\x62\xc7\x13\xb2\x6b\x3b\xc0\xb5\xa5\xb7\xfc\x83\x93\xfd\x67\x0f\xf9\xd8\x0e\x69\x91\xec\xce\x05\x5e\xf9\x51\x7c\x83\x5f\xf2\xdf\xa4\xff\x97\x0e\x3d\xbb\x64\x7b\xf2\x7f\x02\x00\x00\xff\xff\xd5\x00\x21\x41\x46\x07\x00\x00") - -func stdlibVectorsPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibVectorsPisc, - "stdlib/vectors.pisc", - ) -} - -func stdlibVectorsPisc() (*asset, error) { - bytes, err := stdlibVectorsPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/vectors.pisc", size: 1862, mode: os.FileMode(436), modTime: time.Unix(1512805598, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _stdlibWithPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\xcd\x4e\xc3\x30\x10\x84\xcf\xf1\x53\x8c\x4a\x0f\x25\xc2\xcd\x3d\x45\x08\x09\x71\xe0\x82\x10\x57\x84\xd0\xc6\x31\xb1\x8b\x1b\x87\x78\x5b\xbf\x3e\x5a\x97\x22\xfe\x8e\xab\xf1\x7c\x33\xe3\xa6\x46\xf6\xec\xa8\x0b\x16\xb1\xdb\x5a\xc3\x09\x75\xa3\x54\xfb\xf0\x78\x8b\x6b\xac\x90\xe3\xdc\xdf\xd3\xce\x42\x6b\xac\xd7\x38\xc7\xe2\x45\x0c\x0b\x0c\x96\x75\x88\x86\x02\x52\xa6\x09\xbd\x37\xac\x07\xcb\x30\x14\x02\x36\x4a\xb5\x05\x8c\x95\x60\xf1\xbe\x8f\xfc\x45\x68\xcb\xd5\xc6\x6e\xab\xaa\x4b\xf1\x5d\xa1\xcd\x07\x9a\x55\xb5\x2c\xca\x29\x41\x0e\xed\x28\xe9\x03\xcd\x78\xc2\x3f\xa2\x74\x10\xb1\xd8\xf1\x8c\xec\xec\xa8\xaa\xa6\xc6\xdd\x2b\xd8\xf9\x74\xcc\x75\x94\x50\x5c\x48\x96\x2f\x40\xd3\x64\xc7\x1e\x9e\xc1\x11\x84\xc4\x64\xde\x64\xf3\xaf\xf4\xe5\xa9\xb7\x4e\xc7\x14\x55\x9d\xe1\x46\xc6\x95\x67\xfb\xe4\xc7\xe1\x13\xbb\xb3\x4c\xdf\xfa\xcb\x0f\xfc\xa1\x95\x86\x3f\x70\x1b\xf5\x11\x00\x00\xff\xff\x81\x99\x2d\xf3\x7d\x01\x00\x00") - -func stdlibWithPiscBytes() ([]byte, error) { - return bindataRead( - _stdlibWithPisc, - "stdlib/with.pisc", - ) -} - -func stdlibWithPisc() (*asset, error) { - bytes, err := stdlibWithPiscBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "stdlib/with.pisc", size: 381, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "stdlib/bools.pisc": stdlibBoolsPisc, - "stdlib/debug.pisc": stdlibDebugPisc, - "stdlib/dicts.pisc": stdlibDictsPisc, - "stdlib/io.pisc": stdlibIoPisc, - "stdlib/locals.pisc": stdlibLocalsPisc, - "stdlib/loops.pisc": stdlibLoopsPisc, - "stdlib/math.pisc": stdlibMathPisc, - "stdlib/random.pisc": stdlibRandomPisc, - "stdlib/shell.pisc": stdlibShellPisc, - "stdlib/std_lib.pisc": stdlibStd_libPisc, - "stdlib/strings.pisc": stdlibStringsPisc, - "stdlib/symbols.pisc": stdlibSymbolsPisc, - "stdlib/vectors.pisc": stdlibVectorsPisc, - "stdlib/with.pisc": stdlibWithPisc, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} -var _bintree = &bintree{nil, map[string]*bintree{ - "stdlib": &bintree{nil, map[string]*bintree{ - "bools.pisc": &bintree{stdlibBoolsPisc, map[string]*bintree{}}, - "debug.pisc": &bintree{stdlibDebugPisc, map[string]*bintree{}}, - "dicts.pisc": &bintree{stdlibDictsPisc, map[string]*bintree{}}, - "io.pisc": &bintree{stdlibIoPisc, map[string]*bintree{}}, - "locals.pisc": &bintree{stdlibLocalsPisc, map[string]*bintree{}}, - "loops.pisc": &bintree{stdlibLoopsPisc, map[string]*bintree{}}, - "math.pisc": &bintree{stdlibMathPisc, map[string]*bintree{}}, - "random.pisc": &bintree{stdlibRandomPisc, map[string]*bintree{}}, - "shell.pisc": &bintree{stdlibShellPisc, map[string]*bintree{}}, - "std_lib.pisc": &bintree{stdlibStd_libPisc, map[string]*bintree{}}, - "strings.pisc": &bintree{stdlibStringsPisc, map[string]*bintree{}}, - "symbols.pisc": &bintree{stdlibSymbolsPisc, map[string]*bintree{}}, - "vectors.pisc": &bintree{stdlibVectorsPisc, map[string]*bintree{}}, - "with.pisc": &bintree{stdlibWithPisc, map[string]*bintree{}}, - }}, -}} - -// RestoreAsset restores an asset under the given directory -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil -} - -// RestoreAssets restores an asset under the given directory recursively -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) -} - Index: boolean.go ================================================================== --- boolean.go +++ boolean.go @@ -1,38 +1,19 @@ -package pisc +package main -var ModBoolCore = Module{ - Author: "Andrew Owen", - Name: "BoolCore", - License: "MIT", - DocString: "The 3 basic boolean operation, and/or and not", - Load: loadBoolCore, -} - -func _and(m *Machine) error { - a := m.PopValue().(Boolean) - b := m.PopValue().(Boolean) - m.PushValue(Boolean(a && b)) - return nil -} - -func _or(m *Machine) error { - a := m.PopValue().(Boolean) - b := m.PopValue().(Boolean) - m.PushValue(Boolean(a || b)) - return nil -} - -func _not(m *Machine) error { - a := m.PopValue().(Boolean) - m.PushValue(Boolean(!a)) - return nil -} - -func loadBoolCore(m *Machine) error { - m.AppendToHelpTopic("Bools", "PISC boolean expressions are generally not short-circuited without using quotations") - m.AddGoWordWithStack("and", "( a b -- a&b )", "Boolean And", _and) - m.AddGoWordWithStack("or", "( a b -- a||b )", "Boolean OR", _or) - m.AddGoWordWithStack("not", "( a -- not-a )", "Boolean NOT", _not) - - return m.ImportPISCAsset("stdlib/bools.pisc") +func (m *machine) loadBooleanWords() error { + m.predefinedWords["and"] = NilWord(func(m *machine) { + a := m.popValue().(Boolean) + b := m.popValue().(Boolean) + m.pushValue(Boolean(a && b)) + }) + m.predefinedWords["or"] = NilWord(func(m *machine) { + a := m.popValue().(Boolean) + b := m.popValue().(Boolean) + m.pushValue(Boolean(a || b)) + }) + m.predefinedWords["not"] = NilWord(func(m *machine) { + a := m.popValue().(Boolean) + m.pushValue(Boolean(!a)) + }) + return nil } ADDED bools.pisc Index: bools.pisc ================================================================== --- bools.pisc +++ bools.pisc @@ -0,0 +1,7 @@ +/* +bools.pisc +*/ + +:DOC and ( x y -- ? ) Boolean and ; +:DOC or ( x y -- ? ) Boolean or ; +:DOC not ( x -- !x ) Boolean not ; DELETED build Index: build ================================================================== --- build +++ build @@ -1,95 +0,0 @@ -#! /bin/bash - -set -uo pipefail -export PISCDIR="$(pwd)" - -function older_than() { - local target="$1" - shift - if [ ! -e "$target" ] - then - echo "updating $target" >&2 - return 0 # success - fi - local f - for f in "$@" - do - if [ "$f" -nt "$target" ] - then - echo "updating $target" >&2 - return 0 # success - fi - done - return 1 # failure -} - -cd "$PISCDIR" - -function generate { - echo "Generating..." >&2 - older_than bindata.go stdlib/*.pisc && { - # TODO: Put in a go get command for go-bindata - echo "Generating bindata" >&2 - go-bindata -pkg pisc stdlib/... - } -} - -function webbuild { - older_than ./cmd/playground/playground.js *.go stdlib/*.pisc && { - cd "./cmd/playground" - # TODO: Put in a go get command for gopherjs - gopherjs build -m - cd ../.. - } -} - -function upload { - generate - webbuild - cd ./cmd/playground - # Note: This command won't work w/o a password for the scp - scp *.css *.js *.html yumaikas@junglecoder.com:/var/www/pisc-static/playground - cd ../.. -} - -function interpinstall { - generate - cd "./cmd/pisc" - go get - echo "Installing new PISC interpreter" - go install - cd "../.." -} - -function testpisc { - interpinstall - pisc -f tests/all.pisc -} - -case "$1" in -"generate") - generate - ;; -"install") - interpinstall - ;; -"web") - webbuild - ;; -"upload") - upload - ;; -"test") - testpisc - ;; -esac - -cat <&2 - return 0 # success - fi - local f - for f in "$@" - do - if [ "$f" -nt "$target" ] - then - echo "updating $target" >&2 - return 0 # success - fi - done - return 1 # failure -} - -# For now, force re-packing of bindata -rm bindata.go - -older_than bindata.go strings/*.pisc && { - echo "Packing scripts" - go-bindata -pkg main -o bindata.go scripts/... -} - -case "$1" in - build) - older_than game.exe *.go && { - go build -o game.exe - } - ;; - run) - older_than game.exe main.go finalFrontier.go && { - rm game.exe - go build -o game.exe - } - ./game.exe - ;; -esac - - - - - DELETED cmd/FinalFrontier/finalFrontier.go Index: cmd/FinalFrontier/finalFrontier.go ================================================================== --- cmd/FinalFrontier/finalFrontier.go +++ cmd/FinalFrontier/finalFrontier.go @@ -1,48 +0,0 @@ -package main - -import ( - "os" - "pisc" -) - -func loadGameScript(m *pisc.Machine) error { - assetKey := m.PopValue().String() - data, err := Asset(string(assetKey)) - if err != nil { - return err - } - err = m.ExecuteString(string(data), pisc.CodePosition{Source: "file:" + string(assetKey)}) - if err != nil { - return err - } - return nil -} - -func getTermMode(m *pisc.Machine) error { - m.PushValue(pisc.String(mode)) - return nil -} - -func exit(m *pisc.Machine) error { - de_init_term() - os.Exit(0) - return nil -} - -var ModFinalFrontier = pisc.Module{ - Author: "Andrew Owen", - Name: "ConsoleIO", - License: "MIT", - DocString: "Provides basic OS-interaction words", - Load: loadFinalFrontier, -} - -func loadFinalFrontier(m *pisc.Machine) error { - init_term() - m.AddGoWord("term-mode", "( -- mode )", getTermMode) - m.AddGoWord("getkey", "( -- keyval )", getch) - m.AddGoWord("game-script", "( filename -- ? ) ", loadGameScript) - m.AddGoWord("quit-game", "( -- )", exit) - os_overload(m) - return nil -} DELETED cmd/FinalFrontier/init_posix.go Index: cmd/FinalFrontier/init_posix.go ================================================================== --- cmd/FinalFrontier/init_posix.go +++ cmd/FinalFrontier/init_posix.go @@ -1,45 +0,0 @@ -// +build !windows - -package main - -import ( - "fmt" - "github.com/pkg/term" - "pisc" -) - -var mode = "POSIX" - -var pty *term.Term -var buf = make([]byte, 1) - -func init_term() error { - var err error - pty, err = term.Open("/dev/tty", term.RawMode) - if err != nil { - return err - } - return nil -} - -func de_init_term() error { - return pty.Restore() -} - -func os_overload(m *pisc.Machine) error { - return nil -} - -func getch(m *pisc.Machine) error { - num, err := pty.Read(buf) - - if err != nil { - return err - } - if num != 1 { - return fmt.Errorf("Didn't read at least 1 byte from the pty!") - } - - m.PushValue(pisc.Integer(int(buf[0]))) - return nil -} DELETED cmd/FinalFrontier/init_windows.go Index: cmd/FinalFrontier/init_windows.go ================================================================== --- cmd/FinalFrontier/init_windows.go +++ cmd/FinalFrontier/init_windows.go @@ -1,45 +0,0 @@ -// +build windows - -package main - -import ( - "pisc" - "github.com/mattn/go-colorable" - "io" - "fmt" -) - -//#include -import "C" - -var mode = "WINDOWS" -var writer io.Writer - -func init_term() error { - writer = colorable.NewColorableStdout() - return nil - // stub, so that compilation doesn't fail -} - -func de_init_term() error { - return nil -} - -func printWithAnsiColor(m *pisc.Machine) error { - str := m.PopValue().(pisc.String) - _, err := fmt.Fprint(writer, str) - return err -} - -func os_overload(m *pisc.Machine) error { - // Overwritting priv_puts to handle ANSI color codes on windows - m.AddGoWord("priv_puts", "( str -- )", printWithAnsiColor) - return nil -} - - -func getch(m *pisc.Machine) error { - char := C.getch() - m.PushValue(pisc.Integer(char)) - return nil -} DELETED cmd/FinalFrontier/main.go Index: cmd/FinalFrontier/main.go ================================================================== --- cmd/FinalFrontier/main.go +++ cmd/FinalFrontier/main.go @@ -1,27 +0,0 @@ -package main - -import ( - "fmt" - "pisc" -) - -func main() { - m := &pisc.Machine{ - Values: make([]pisc.StackEntry, 0), - DefinedWords: make(map[string]*pisc.CodeQuotation), - DefinedStackComments: make(map[string]string), - PredefinedWords: make(map[string]pisc.GoWord), - PrefixWords: make(map[string]*pisc.CodeQuotation), - HelpDocs: make(map[string]string), - } - - m.LoadModules(append( - pisc.StandardModules, - pisc.ModDebugCore, - pisc.ModIOCore, - ModFinalFrontier)...) - err := m.ExecuteString(`"scripts/main.pisc" game-script`, pisc.CodePosition{Source: "main.go"}) - if err != nil { - fmt.Println(err.Error()) - } -} DELETED cmd/FinalFrontier/scripts/backstory.txt Index: cmd/FinalFrontier/scripts/backstory.txt ================================================================== --- cmd/FinalFrontier/scripts/backstory.txt +++ cmd/FinalFrontier/scripts/backstory.txt @@ -1,1 +0,0 @@ -Explorers are even now mapping out the various lanes of slipspace. Most people seem to be content to stay on the planet of their birth, as both subspace and slipspace are treacherous places. Pirates, freighters, and smugglers alike vie for fattest, quickest buck. Planetary fleets mostly protect their homes. There used to be a system-wise empire around Sol, but logistics makes a galaxy-wide one near-impossible. Even if galactic rule was possible, the early slipspace instabilities spread people far and wide throughout space. This factured the society left behind. It took decades for a slipspace drive to be stable enough for more experimental use. It was only with the aging and death of those who witnessed the slipspace fracturing that the slipspace came to be accepted as a means of travel. The last 15 years have shown wondrous things. DELETED cmd/FinalFrontier/scripts/gamesave.pisc Index: cmd/FinalFrontier/scripts/gamesave.pisc ================================================================== --- cmd/FinalFrontier/scripts/gamesave.pisc +++ cmd/FinalFrontier/scripts/gamesave.pisc DELETED cmd/FinalFrontier/scripts/intro.pisc Index: cmd/FinalFrontier/scripts/intro.pisc ================================================================== --- cmd/FinalFrontier/scripts/intro.pisc +++ cmd/FinalFrontier/scripts/intro.pisc @@ -1,35 +0,0 @@ - -: intro ( game -- next ) -:game -CLS - -"Space, the Final Frontier - -The stars have beckoned you, even when you were but a wee child. -It's a risky life, spacefaring, what with pirates, smugglers, and planetary police -in a constant struggle, not to mention asteriods, navigation difficulty, and the utter -void of space. You've prepared for this day. Your reading time was dedicated to charts -and ship operation, your spare time to training in simulators, and your savings -have amounted to $5000. Will you explore the stars? (Y/n) -" println - -0 :k [ $k is-yn? not ] [ getkey :k ] while - -$k is-n? [ - "Though, perhaps the stars are for another time. After all, they won't be going anywhere" println - wait-enter - [ opening-menu ] -] when -$k is-y? [ [ pick-ship ] ] when -; - -: pick-ship ( game -- next ) - CLS - " You're going to need a ship before you can travel through space, however. " println - wait-enter - [ quit-game ] -; - - - - DELETED cmd/FinalFrontier/scripts/lib.pisc Index: cmd/FinalFrontier/scripts/lib.pisc ================================================================== --- cmd/FinalFrontier/scripts/lib.pisc +++ cmd/FinalFrontier/scripts/lib.pisc @@ -1,33 +0,0 @@ -term-mode "WINDOWS" eq [ - "scripts\\term_win.pisc" game-script -] when - -term-mode "POSIX" eq [ - "scripts\\term_posix.pisc" game-script -] when - -: wait-enter ( -- ) - [ getkey is-enter? ] [ ] while -; - -: ( num-opts -- obj ) - :num - 0 :m-idx - t :choosing - [ - getkey :k - $k is-enter? [ f :choosing ] when - $k is-arrow? [ - getkey :dir - $dir is-up? [ --m-idx ] when - $dir is-down? [ ++m-idx ] when - $m-idx $num mod :m-idx - $m-idx 0 < [ $num 1 - :m-idx ] when - ] when - ] :check - - [ $choosing ] <<-done? - [ $m-idx ] <<-chosen-idx - [ check ] <<-proc-key - [ $m-idx = [ back-white ] when ] <<-highlight -; DELETED cmd/FinalFrontier/scripts/main.pisc Index: cmd/FinalFrontier/scripts/main.pisc ================================================================== --- cmd/FinalFrontier/scripts/main.pisc +++ cmd/FinalFrontier/scripts/main.pisc @@ -1,56 +0,0 @@ -# This is final frontier, a game inspiredc by space, tradewinds, and a little bit of lane-based combat -/* -IDEAS: Maybe find some way to integrate long time travel into the culture of spacefarers -*/ - -"scripts\\lib.pisc" game-script -"scripts\\markets.pisc" game-script -"scripts\\intro.pisc" game-script -"scripts\\saving.pisc" game-script - -: opening-menu ( game -- next ) - :game - 4 :m - $m ->highlight :MENU - [ back-black ] :CHOICE - CHOICE print - - [ $m .done? ] - [ - CLS - NNL - ${ - cyan "Final Frontier" NNL - red - " " 0 MENU "New Game" CHOICE NNL - " " 1 MENU "Load Game" CHOICE NNL - " " 2 MENU "Options" CHOICE NNL - " " 3 MENU "Return to real life" CHOICE NNL - white "Up/Down to choose, Enter to confirm " NL - } print - - $m .proc-key - ] while - { - [ intro ] - [ load-game ] - [ options ] - [ exit-game ] - } $m .chosen-idx vec-at -; - -: load-game ( game -- ) :game CLS ${ "TODO: Implement game-loads" NL } println [ " " drop ] ; -: save-game ( game -- ) :game CLS ${ "TODO: Implement game-saves" NL } println [ " " drop ] ; -: options ( -- ) :game CLS ${ "TODO: Implement game options" NL } println [ " " drop ] ; -: exit-game ( game -- ) save-game quit-game ; - -: main ( -- ) - opening-menu :curr-state - :game - [ t ] [ $game $curr-state call :curr-state ] while - getkey - back-black println CLS - quit-game -; - -main DELETED cmd/FinalFrontier/scripts/map.pisc Index: cmd/FinalFrontier/scripts/map.pisc ================================================================== --- cmd/FinalFrontier/scripts/map.pisc +++ cmd/FinalFrontier/scripts/map.pisc @@ -1,41 +0,0 @@ -/* - -Render a galatic map from here - -*/ - -: star-map ( game -- next ) - -; - - -: show-world ( planet game -- next ) - :game :planet - - $planet ->description println - - $planet ->locations dup dup [ ->name ] vec-map :locs [ ->command ] vec-map :choices - $locs len 1 - :m - - $m ->highlight :MENU - [ back-black ] :CHOICE - - - [ $m .done? ] - # We're re-building the menu each time with a rest to $i - [ - CLS - CHOICE println - 0 :i - ${ - $planet ->name NNL - red - $locs [ :l - $i MENU " " $l CHOICE NNL - ] vec-each - white "Up/down to select, enter to choose" NL - } - ] while - - $choices $m .chosen-idx vec-at -; DELETED cmd/FinalFrontier/scripts/markets.pisc Index: cmd/FinalFrontier/scripts/markets.pisc ================================================================== --- cmd/FinalFrontier/scripts/markets.pisc +++ cmd/FinalFrontier/scripts/markets.pisc @@ -1,57 +0,0 @@ -# - -/* - -What is the economy going to be like in this game? - -## Basic Goods - -Water -Food -Fuel -Ore/Scrap - -## Data Capsules - -Programs -Videos -Games -Maps/Charts - -## Heavy Goods - -Robots -Munitions -Build-Crete -Enviro-shielding - -## Fragile Goods - -Solar Panels -Computer Chips -Documents -Sculptures - -*/ - -: show-market ( -- ) ; - -/* -World archetypes - -Colony: -Exports basic goods, with a random chance of exporting one other type of good at a low price - -Monastic Technocracy: -Imports basic goods, exports data capsules of various types - -Corporatist Industocracy: -Imports basic goods, exports heavy goods - -Creatist Fabritocracy: -Imports basic goods, exports Fragile Goods - -Beurocratic Metrocracy: -Imports everything, exports power/influence (heh) - -*/ DELETED cmd/FinalFrontier/scripts/saving.pisc Index: cmd/FinalFrontier/scripts/saving.pisc ================================================================== --- cmd/FinalFrontier/scripts/saving.pisc +++ cmd/FinalFrontier/scripts/saving.pisc @@ -1,125 +0,0 @@ -/* - -func (i Integer) Type() string { - return "Integer" -} - -func (d Double) Type() string { - return "Double" -} - -func (a Array) Type() string { - return "Vector" -} - -func (dict Dict) Type() string { - return "Dictionary" -} - -func (b Boolean) Type() string { - return "Boolean" -} - -func (s String) Type() string { - return "String" -} - -*/ - -: serial-mapping ( -- mapping ) - - [ write-dict ] <<-Dictionary - [ write-vec ] <<-Vector - [ write-int ] <<-Integer - [ write-double ] <<-Double - [ write-string ] <<-String - [ write-bool ] <<-Boolean - :t-table - - [ :v - $t-table $v typeof dict-has-key? - [ $t-table $v typeof dict-get ] - [ ${ "Type " $v typeof " cannot be saved." } error ] - if - ] -; - -: save-state ( path state -- state ) :state :path - $state typeof :type - f :success - [ $path open-file-writer :OUT - ": . ( dict value key -- dict ) dict-push ;" $OUT .write-line - - $OUT <<-OUT - 0 <<-tab - ] :get-output - [ eq dup $success or :success ] :eqn - $type "Dictionary" eqn [ get-output $state write-dict ] when - $type "Vector" eqn [ get-output $state write-vec ] when - $success not - [ ${ "Cannot write value of type: " $type } error ] - when - $OUT .close -; - -# Replace " with \" in the string, to keep it from breaking up -: quote-safe ( str -- str ) "\\" "\\\\" str-replace "\"" "\\\"" str-replace ; -: wrap-quotes ( str -- str ) "\"" swap str-concat "\"" str-concat ; - -: write-dict ( ctx dict -- ) - :pairs dup :ctx ->OUT :OUT - # Increase the tab-indent - $ctx dup ->tab 1 + <-tab - - serial-mapping :dispatch - [ $OUT .write-string ] :output - [ "\t" $ctx ->tab str-repeat output ] :TAB - - "\n" output - TAB "" output - - $pairs [ :k $pairs ->$k :v - $v dispatch :write - "\n" output TAB "\t" output - $ctx $v write - " " output - $k quote-safe wrap-quotes output - " ." output - ] dict-each-key - $ctx dup ->tab 1 - <-tab -; - -: write-vec ( ctx vec -- ) - :elems dup :ctx ->OUT :OUT - $ctx dup ->tab 1 + <-tab - [ "\t" $ctx ->tab str-repeat output ] :TAB - serial-mapping :dispatch - # Increase the tab-indent - [ $OUT .write-string ] :output - - "{" output - $elems [ :e - " " output - $ctx $e $e dispatch call - ] vec-each - " }" output - $ctx dup ->tab 1 - <-tab -; - - -: write-int ( ctx int -- ) >string swap ->OUT .write-string ; -: write-string ( ctx str -- ) quote-safe wrap-quotes swap ->OUT .write-string ; -: write-double ( ctx double -- ) >string swap ->OUT .write-string ; -: write-bool ( ctx bool -- ) [ :ctx ] dip [ "t" ] [ "f" ] if $ctx ->OUT .write-string ; - - -# DEBUG -/* -"out.txt" import :d - -"out.txt" $d save-state - -"TODO: Add tests!!" println -"TODO: Consider switching dicts to use critbit trees" println -*/ -# GUBED DELETED cmd/FinalFrontier/scripts/ships.pisc Index: cmd/FinalFrontier/scripts/ships.pisc ================================================================== --- cmd/FinalFrontier/scripts/ships.pisc +++ cmd/FinalFrontier/scripts/ships.pisc @@ -1,87 +0,0 @@ -# What is the model for ships going to be? - -# Lane types can be 1 of the 4 major types - -# 0 - Basic: Can carry basic cargo -# 1 - Data: Can carry data of various kinds, is radiation shielded. A cockpit has 1 data slot by default -# 2 - Heavy: Can carry basic cargo, or heavier goods -# 3 - Fragile: Is built with shock absorbsion to allow transport of fragile goods - -: ( size type -- lane ) - :type :size - { $size [ f ] times } :cargo - - $cargo <<-cargo - $type <<-type -; - -: ( name lanes -- ship ) - :lanes :name - - $lanes <<-lanes - $name <<-name -; - -/* -Each ship is built out of lanes -Each ship has a drone loadout controlled by the Cockpit -If the cockpit is destroyed, you game is over. -Most ships don't try to destroy a cockpit however, -preferring to leave you helpless or capture you. - -Ships can have 1x3 to 3x10 in dimentions, and filled with different segments - -Lanes can come in 3 sizes as well, Small, Medim and Large - -Segment types (* indicate mandatory segment): - -Life-support/Cockpit*, -Engines*, -Fuel Tank* -cargo pod -Crew quarter (1 crew member per section) -drone pod (1 drone per section) - -There are also possible non-standard segments: - -Long range sensors ( extra combat round ) -Contraband pod ( far better chance of passing an inspection ) -Ship scanner (allows you to see into ship segments) -Tow package (allows you to haul ships/trailers around) - -Segments have varying levels of armor: -low: Can be breached by any attck -medium: Will withstand a minimum of 1 successful attack. -heavy: Will withstand a minimum of 3 successful attacks. - -Drones come in 3 basic types: - -Attack: Shoots stuff -Defence: Defends against attack drones, each shot charges up a mega-beam -Ion: shorts-out drones and/or sections - -Advanced drones: Raider - -Raider drones do a variety of things, depending on which type of segment they manage to hit - -If they hit Life-support/cockpit, they take over the ship, -which allows it to be slaved to yours for transport to shipyards - -If they hit a engine pod, the opposing ship will be slowed down - -If they hit a Fuel tank, all the fuel in that tank is transfered to your ship next turn - -If they hit a cargo bay, the cargo in that bay is transfared to your ship next turn - -If they hit a crew-quarter, the crew member in that quarter is either -captured or killed, depending on if you have space to carry them or not. - - - - - - - - - - DELETED cmd/FinalFrontier/scripts/term_posix.pisc Index: cmd/FinalFrontier/scripts/term_posix.pisc ================================================================== --- cmd/FinalFrontier/scripts/term_posix.pisc +++ cmd/FinalFrontier/scripts/term_posix.pisc @@ -1,38 +0,0 @@ -: color-code ( code -- color-esc ) :code ${ ESC "[" $code "m" } ; - -# Clear screen and move cursor to top-left -: CLS ( -- ) ${ ESC "[2J" ESC "[;H" } print ; -: NL ( -- NL ) "\r\n" ; -: NNL ( -- NL ) NL NL ; - -# Fore-colors -: black ( -- esc-black ) "30" color-code ; -: red ( -- esc-red ) "31" color-code ; -: green ( -- esc-green ) "32" color-code ; -: yellow ( -- esc-yellow ) "33" color-code ; -: blue ( -- esc-blue ) "34" color-code ; -: magenta ( -- esc-magenta ) "35" color-code ; -: cyan ( -- esc-cyan ) "36" color-code ; -: white ( -- esc-white ) "37" color-code ; - -# back-colors -: back-black ( -- esc-black ) "40" color-code ; -: back-red ( -- esc-red ) "41" color-code ; -: back-green ( -- esc-green ) "42" color-code ; -: back-yellow ( -- esc-yellow ) "43" color-code ; -: back-blue ( -- esc-blue ) "44" color-code ; -: back-magenta ( -- esc-magenta ) "45" color-code ; -: back-cyan ( -- esc-cyan ) "46" color-code ; -: back-white ( -- esc-white ) "47" color-code ; - -: is-enter? ( k -- ? ) 13 = ; -: is-arrow? ( k -- ? ) 27 = [ getkey 91 = ] [ f ] if ; - -: is-up? ( k -- ? ) 65 = ; -: is-down? ( k -- ? ) 66 = ; -: is-right? ( k -- ? ) 67 = ; -: is-left? ( k -- ? ) 68 = ; - -: is-y? ( k -- ? ) 121 = ; -: is-n? ( k -- ? ) 110 = ; -: is-yn? ( k -- ? ) [ is-y? ] [ is-n? ] bi or ; DELETED cmd/FinalFrontier/scripts/term_win.pisc Index: cmd/FinalFrontier/scripts/term_win.pisc ================================================================== --- cmd/FinalFrontier/scripts/term_win.pisc +++ cmd/FinalFrontier/scripts/term_win.pisc @@ -1,39 +0,0 @@ -: color-code ( code -- color-esc ) :code ${ ESC "[" $code "m" } ; - -# Clear screen and move cursor to top-left -: CLS ( -- ) ${ ESC "[2J" ESC "[H" } print ; -: NL ( -- NL ) "\r\n" ; -: NNL ( -- NL ) NL NL ; - -# Fore-colors -: black ( -- esc-black ) "30" color-code ; -: red ( -- esc-red ) "31" color-code ; -: green ( -- esc-green ) "32" color-code ; -: yellow ( -- esc-yellow ) "33" color-code ; -: blue ( -- esc-blue ) "34" color-code ; -: magenta ( -- esc-magenta ) "35" color-code ; -: cyan ( -- esc-cyan ) "36" color-code ; -: white ( -- esc-white ) "37" color-code ; - -# back-colors -: back-black ( -- esc-black ) "40" color-code ; -: back-red ( -- esc-red ) "41" color-code ; -: back-green ( -- esc-green ) "42" color-code ; -: back-yellow ( -- esc-yellow ) "43" color-code ; -: back-blue ( -- esc-blue ) "44" color-code ; -: back-magenta ( -- esc-magenta ) "45" color-code ; -: back-cyan ( -- esc-cyan ) "46" color-code ; -: back-white ( -- esc-white ) "47" color-code ; - -: is-enter? ( k -- ? ) 13 = ; -: is-arrow? ( k -- ? ) 224 = ; - -: is-up? ( k -- ? ) 72 = ; -: is-down? ( k -- ? ) 80 = ; -: is-right? ( k -- ? ) 77 = ; -: is-left? ( k -- ? ) 75 = ; - -: is-y? ( k -- ? ) 121 = ; -: is-n? ( k -- ? ) 110 = ; -: is-yn? ( k -- ? ) [ is-y? ] [ is-n? ] bi or ; - DELETED cmd/build/build.go Index: cmd/build/build.go ================================================================== --- cmd/build/build.go +++ cmd/build/build.go @@ -1,15 +0,0 @@ -package main - -import "pisc" - -var ModBuildCore = pisc.Module{ - Author: "Andrew Owen", - Name: "BuildKit", - License: "MIT", - DocString: `commands for running pisc Buildscripts`, - Load: loadBuildWords, -} - -func loadBuildWords(m *pisc.Machine) error { - return nil -} DELETED cmd/build/main.go Index: cmd/build/main.go ================================================================== --- cmd/build/main.go +++ cmd/build/main.go @@ -1,18 +0,0 @@ -package main - -import ( - "pisc" - "pisc/libs/shell" -) - -func main() { - m := &pisc.Machine{ - Values: make([]pisc.StackEntry, 0), - DefinedWords: make(map[string]*pisc.CodeQuotation), - DefinedStackComments: make(map[string]string), - PredefinedWords: make(map[string]pisc.GoWord), - PrefixWords: make(map[string]*pisc.CodeQuotation), - HelpDocs: make(map[string]string), - } - m.LoadModules(append(pisc.StandardModules, shell.ModShellUtils)...) -} DELETED cmd/pisc-web-ide/main.go Index: cmd/pisc-web-ide/main.go ================================================================== --- cmd/pisc-web-ide/main.go +++ cmd/pisc-web-ide/main.go @@ -1,35 +0,0 @@ -package main - -import ( - "fmt" - "github.com/pressly/chi" - "github.com/pressly/chi/middleware" - "log" - "net/http" -) - -// To try out: https://github.com/pressly/chi - -func main() { - // Simple static webserver: - r := chi.NewRouter() - r.Use(middleware.Logger) - r.Use(middleware.Recoverer) - - r.FileServer("/", http.Dir("./webroot")) - r.Get("/test", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, "Testing now!") - }) - - r.Get("/test/:id/arrp/:foo", func(w http.ResponseWriter, r *http.Request) { - // FIXME: Not safe!! - fmt.Fprintln(w, chi.URLParam(r, "id")) - fmt.Fprintln(w, chi.URLParam(r, "foo")) - }) - r.Get("/test/a", func(w http.ResponseWriter, r *http.Request) { - // FIXME: Not safe!! - fmt.Fprintln(w, "foo") - }) - - log.Fatal(http.ListenAndServe(":8080", r)) -} DELETED cmd/pisc-web-ide/webroot/index.html Index: cmd/pisc-web-ide/webroot/index.html ================================================================== --- cmd/pisc-web-ide/webroot/index.html +++ cmd/pisc-web-ide/webroot/index.html @@ -1,10 +0,0 @@ - - - -

Hello PISC web-ide!

- - - - - - DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/Makefile Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/Makefile ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/Makefile +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/Makefile @@ -1,16 +0,0 @@ -.PHONY: boosh test - -boosh: - @node -e "var json = require('./build');json.JSHINT_OPTS=JSON.parse(require('fs').readFileSync('./.jshintrc'));require('fs').writeFileSync('./build.json', JSON.stringify(json, null, 2))" - @node_modules/smoosh/bin/smoosh make build.json - -test: - npm test - -bump: boosh - npm version patch - node make/bump - -publish: - npm publish - git push origin master --tags DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/README.md Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/README.md ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/README.md +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/README.md @@ -1,323 +0,0 @@ -# It's AJAX - -All over again. Includes support for xmlHttpRequest, JSONP, CORS, and CommonJS Promises A. - -It is also isomorphic allowing you to `require('reqwest')` in `Node.js` through the peer dependency [xhr2](https://github.com/pwnall/node-xhr2), albeit the original intent of this library is for the browser. For a more thorough solution for Node.js, see [mikeal/request](https://github.com/request/request). - -## API - -``` js -reqwest('path/to/html', function (resp) { - qwery('#content').html(resp) -}) - -reqwest({ - url: 'path/to/html' - , method: 'post' - , data: { foo: 'bar', baz: 100 } - , success: function (resp) { - qwery('#content').html(resp) - } -}) - -reqwest({ - url: 'path/to/html' - , method: 'get' - , data: [ { name: 'foo', value: 'bar' }, { name: 'baz', value: 100 } ] - , success: function (resp) { - qwery('#content').html(resp) - } -}) - -reqwest({ - url: 'path/to/json' - , type: 'json' - , method: 'post' - , error: function (err) { } - , success: function (resp) { - qwery('#content').html(resp.content) - } -}) - -reqwest({ - url: 'path/to/json' - , type: 'json' - , method: 'post' - , contentType: 'application/json' - , headers: { - 'X-My-Custom-Header': 'SomethingImportant' - } - , error: function (err) { } - , success: function (resp) { - qwery('#content').html(resp.content) - } -}) - -// Uses XMLHttpRequest2 credentialled requests (cookies, HTTP basic auth) if supported -reqwest({ - url: 'path/to/json' - , type: 'json' - , method: 'post' - , contentType: 'application/json' - , crossOrigin: true - , withCredentials: true - , error: function (err) { } - , success: function (resp) { - qwery('#content').html(resp.content) - } -}) - -reqwest({ - url: 'path/to/data.jsonp?callback=?' - , type: 'jsonp' - , success: function (resp) { - qwery('#content').html(resp.content) - } -}) - -reqwest({ - url: 'path/to/data.jsonp?foo=bar' - , type: 'jsonp' - , jsonpCallback: 'foo' - , jsonpCallbackName: 'bar' - , success: function (resp) { - qwery('#content').html(resp.content) - } -}) - -reqwest({ - url: 'path/to/data.jsonp?foo=bar' - , type: 'jsonp' - , jsonpCallback: 'foo' - , success: function (resp) { - qwery('#content').html(resp.content) - } - , complete: function (resp) { - qwery('#hide-this').hide() - } -}) -``` - -## Promises - -``` js -reqwest({ - url: 'path/to/data.jsonp?foo=bar' - , type: 'jsonp' - , jsonpCallback: 'foo' -}) - .then(function (resp) { - qwery('#content').html(resp.content) - }, function (err, msg) { - qwery('#errors').html(msg) - }) - .always(function (resp) { - qwery('#hide-this').hide() - }) -``` - -``` js -reqwest({ - url: 'path/to/data.jsonp?foo=bar' - , type: 'jsonp' - , jsonpCallback: 'foo' -}) - .then(function (resp) { - qwery('#content').html(resp.content) - }) - .fail(function (err, msg) { - qwery('#errors').html(msg) - }) - .always(function (resp) { - qwery('#hide-this').hide() - }) -``` - -``` js -var r = reqwest({ - url: 'path/to/data.jsonp?foo=bar' - , type: 'jsonp' - , jsonpCallback: 'foo' - , success: function () { - setTimeout(function () { - r - .then(function (resp) { - qwery('#content').html(resp.content) - }, function (err) { }) - .always(function (resp) { - qwery('#hide-this').hide() - }) - }, 15) - } -}) -``` - -## Options - - * `url` a fully qualified uri - * `method` http method (default: `GET`) - * `headers` http headers (default: `{}`) - * `data` entity body for `PATCH`, `POST` and `PUT` requests. Must be a query `String` or `JSON` object - * `type` a string enum. `html`, `xml`, `json`, or `jsonp`. Default is inferred by resource extension. Eg: `.json` will set `type` to `json`. `.xml` to `xml` etc. - * `contentType` sets the `Content-Type` of the request. Eg: `application/json` - * `crossOrigin` for cross-origin requests for browsers that support this feature. - * `success` A function called when the request successfully completes - * `error` A function called when the request fails. - * `complete` A function called whether the request is a success or failure. Always called when complete. - * `jsonpCallback` Specify the callback function name for a `JSONP` request. This value will be used instead of the random (but recommended) name automatically generated by reqwest. - -## Security - -If you are *still* requiring support for IE6/IE7, consider including [JSON3](https://bestiejs.github.io/json3/) in your project. Or simply do the following - -``` html - -``` - - -## Contributing - -``` sh -$ git clone git://github.com/ded/reqwest.git reqwest -$ cd !$ -$ npm install -``` - -Please keep your local edits to `src/reqwest.js`. -The base `./reqwest.js` and `./reqwest.min.js` will be built upon releases. - -## Running Tests - -``` sh -make test -``` - -## Browser support - - * IE6+ - * Chrome 1+ - * Safari 3+ - * Firefox 1+ - * Opera - -## Ender Support -Reqwest can be used as an [Ender](http://enderjs.com) module. Add it to your existing build as such: - - $ ender add reqwest - -Use it as such: - -``` js -$.ajax({ ... }) -``` - -Serialize things: - -``` js -$(form).serialize() // returns query string -> x=y&... -$(form).serialize({type:'array'}) // returns array name/value pairs -> [ { name: x, value: y}, ... ] -$(form).serialize({type:'map'}) // returns an object representation -> { x: y, ... } -$(form).serializeArray() -$.toQueryString({ - foo: 'bar' - , baz: 'thunk' -}) // returns query string -> foo=bar&baz=thunk -``` - -Or, get a bit fancy: - -``` js -$('#myform input[name=myradios]').serialize({type:'map'})['myradios'] // get the selected value -$('input[type=text],#specialthing').serialize() // turn any arbitrary set of form elements into a query string -``` - -## ajaxSetup -Use the `request.ajaxSetup` to predefine a data filter on all requests. See the example below that demonstrates JSON hijacking prevention: - -``` js -$.ajaxSetup({ - dataFilter: function (response, type) { - if (type == 'json') return response.substring('])}while(1);'.length) - else return response - } -}) -``` - -## RequireJs and Jam -Reqwest can also be used with RequireJs and can be installed via jam - -``` -jam install reqwest -``` - -```js -define(function(require){ - var reqwest = require('reqwest') -}); -``` - -## spm -Reqwest can also be installed via spm [![](http://spmjs.io/badge/reqwest)](http://spmjs.io/package/reqwest) - -``` -spm install reqwest -``` - -## jQuery and Zepto Compatibility -There are some differences between the *Reqwest way* and the -*jQuery/Zepto way*. - -### method ### -jQuery/Zepto use `type` to specify the request method while Reqwest uses -`method` and reserves `type` for the response data type. - -### dataType ### -When using jQuery/Zepto you use the `dataType` option to specify the type -of data to expect from the server, Reqwest uses `type`. jQuery also can -also take a space-separated list of data types to specify the request, -response and response-conversion types but Reqwest uses the `type` -parameter to infer the response type and leaves conversion up to you. - -### JSONP ### -Reqwest also takes optional `jsonpCallback` and `jsonpCallbackName` -options to specify the callback query-string key and the callback function -name respectively while jQuery uses `jsonp` and `jsonpCallback` for -these same options. - - -But fear not! If you must work the jQuery/Zepto way then Reqwest has -a wrapper that will remap these options for you: - -```js -reqwest.compat({ - url: 'path/to/data.jsonp?foo=bar' - , dataType: 'jsonp' - , jsonp: 'foo' - , jsonpCallback: 'bar' - , success: function (resp) { - qwery('#content').html(resp.content) - } -}) - -// or from Ender: - -$.ajax.compat({ - ... -}) -``` - -If you want to install jQuery/Zepto compatibility mode as the default -then simply place this snippet at the top of your code: - -```js -$.ajax.compat && $.ender({ ajax: $.ajax.compat }); -``` - - -**Happy Ajaxing!** DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/build.json Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/build.json ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/build.json +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/build.json @@ -1,74 +0,0 @@ -{ - "YO": "This file is built by the Makefile, your edits may not be saved on build", - "JAVASCRIPT": { - "DIST_DIR": "./", - "reqwest": [ - "src/copyright.js", - "src/reqwest.js" - ] - }, - "JSHINT_OPTS": { - "predef": [ - "define", - "ActiveXObject", - "XDomainRequest" - ], - "bitwise": true, - "camelcase": false, - "curly": false, - "eqeqeq": false, - "forin": false, - "immed": false, - "latedef": false, - "newcap": true, - "noarg": true, - "noempty": true, - "nonew": true, - "plusplus": false, - "quotmark": true, - "regexp": false, - "undef": true, - "unused": true, - "strict": false, - "trailing": true, - "maxlen": 120, - "asi": true, - "boss": true, - "debug": true, - "eqnull": true, - "esnext": true, - "evil": true, - "expr": true, - "funcscope": false, - "globalstrict": false, - "iterator": false, - "lastsemic": true, - "laxbreak": true, - "laxcomma": true, - "loopfunc": true, - "multistr": false, - "onecase": false, - "proto": false, - "regexdash": false, - "scripturl": true, - "smarttabs": false, - "shadow": false, - "sub": true, - "supernew": false, - "validthis": true, - "browser": true, - "couch": false, - "devel": false, - "dojo": false, - "mootools": false, - "node": true, - "nonstandard": true, - "prototypejs": false, - "rhino": false, - "worker": true, - "wsh": false, - "nomen": false, - "onevar": false, - "passfail": false - } -} DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/make/bump.js Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/make/bump.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/make/bump.js +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/make/bump.js @@ -1,8 +0,0 @@ -var fs = require('fs') - , version = require('../package.json').version; - -['./reqwest.js', './reqwest.min.js'].forEach(function (file) { - var data = fs.readFileSync(file, 'utf8') - data = data.replace(/^\/\*\!/, '/*! version: ' + version) - fs.writeFileSync(file, data) -}) DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/make/tests.js Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/make/tests.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/make/tests.js +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/make/tests.js @@ -1,89 +0,0 @@ -var exec = require('child_process').exec - , fs = require('fs') - , Connect = require('connect') - , dispatch = require('dispatch') - , mime = require('mime') - , DelayedStream = require('delayed-stream') - - , getMime = function(ext) { - return mime.lookup(ext == 'jsonp' ? 'js' : ext) - } - -var routes = { - '/': function (req, res) { - res.write(fs.readFileSync('./tests/tests.html', 'utf8')) - res.end() - }, - '/tests/timeout$': function (req, res) { - var delayed = DelayedStream.create(req) - setTimeout(function() { - res.writeHead(200, { - 'Expires': 0 - , 'Cache-Control': 'max-age=0, no-cache, no-store' - }) - req.query.callback && res.write(req.query.callback + '(') - res.write(JSON.stringify({ method: req.method, query: req.query, headers: req.headers })) - req.query.callback && res.write(');') - delayed.pipe(res) - }, 2000) - }, - '/tests/204': function(req, res) { - res.writeHead(204); - res.end(); - }, - '(([\\w\\-\\/\\.]+)\\.(css|js|json|jsonp|html|xml)$)': function (req, res, next, uri, file, ext) { - res.writeHead(200, { - 'Expires': 0 - , 'Cache-Control': 'max-age=0, no-cache, no-store' - , 'Content-Type': getMime(ext) - }) - if (req.query.echo !== undefined) { - ext == 'jsonp' && res.write((req.query.callback || req.query.testCallback || 'echoCallback') + '(') - res.write(JSON.stringify({ method: req.method, query: req.query, headers: req.headers })) - ext == 'jsonp' && res.write(');') - } else { - res.write(fs.readFileSync('./' + file + '.' + ext)) - } - res.end() - } -} - -Connect.createServer(Connect.query(), dispatch(routes)).listen(1234) - -var otherOriginRoutes = { - '/get-value': function (req, res) { - res.writeHead(200, { - 'Access-Control-Allow-Origin': req.headers.origin, - 'Content-Type': 'text/plain' - }) - res.end('hello') - }, - '/set-cookie': function (req, res) { - res.writeHead(200, { - 'Access-Control-Allow-Origin': req.headers.origin, - 'Access-Control-Allow-Credentials': 'true', - 'Content-Type': 'text/plain', - 'Set-Cookie': 'cookie=hello' - }) - res.end('Set a cookie!') - }, - '/get-cookie-value': function (req, res) { - var cookies = {} - , value - - req.headers.cookie && req.headers.cookie.split(';').forEach(function( cookie ) { - var parts = cookie.split('=') - cookies[ parts[ 0 ].trim() ] = ( parts[ 1 ] || '' ).trim() - }) - value = cookies.cookie - - res.writeHead(200, { - 'Access-Control-Allow-Origin': req.headers.origin, - 'Access-Control-Allow-Credentials': 'true', - 'Content-Type': 'text/plain' - }) - res.end(value) - } -} - -Connect.createServer(Connect.query(), dispatch(otherOriginRoutes)).listen(5678) DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/package.json Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/package.json ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/package.json +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/package.json @@ -1,48 +0,0 @@ -{ - "name": "reqwest", - "description": "A wrapper for asynchronous http requests", - "keywords": [ - "ender", - "ajax", - "xhr", - "connection", - "web 2.0", - "async", - "sync" - ], - "version": "2.0.5", - "homepage": "https://github.com/ded/reqwest", - "author": "Dustin Diaz (http://dustindiaz.com)", - "repository": { - "type": "git", - "url": "https://github.com/ded/reqwest.git" - }, - "main": "./reqwest.js", - "ender": "./src/ender.js", - "browser": { - "xhr2": false - }, - "devDependencies": { - "connect": "1.8.x", - "mime": "1.x.x", - "sink-test": ">=0.1.2", - "dispatch": "0.x.x", - "valentine": ">=1.4.7", - "smoosh": "0.4.0", - "delayed-stream": "0.0.5", - "bump": "0.2.3" - }, - "scripts": { - "boosh": "smoosh make ./build.json", - "test": "node ./test.js" - }, - "license": "MIT", - "spm": { - "main": "reqwest.js", - "ignore": [ - "vendor", - "test", - "make" - ] - } -} DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/phantom.js Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/phantom.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/phantom.js +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/phantom.js @@ -1,33 +0,0 @@ -var page = require('webpage').create() -page.open('http://localhost:1234', function() { - - function f() { - setTimeout(function () { - var clsName = page.evaluate(function() { - var el = document.getElementById('tests') - return el.className - }) - if (!clsName.match(/sink-done/)) f() - else { - var count = 0 - var fail = page.evaluate(function () { - var t = '' - var els = document.querySelectorAll('ol#tests .fail .fail') - for (var i = 0; i < els.length; i++) { - t += els[i].textContent + '\n' - } - return {text: t, count: els.length} - }) - var pass = !!clsName.match(/sink-pass/) - if (pass) console.log('All tests have passed!') - else { - console.log(fail.count + ' test(s) failed') - console.log(fail.text.trim()) - } - - phantom.exit(pass ? 0 : 1) - } - }, 10) - } - f() -}) DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/reqwest.js Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/reqwest.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/reqwest.js +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/reqwest.js @@ -1,630 +0,0 @@ -/*! - * Reqwest! A general purpose XHR connection manager - * license MIT (c) Dustin Diaz 2015 - * https://github.com/ded/reqwest - */ - -!function (name, context, definition) { - if (typeof module != 'undefined' && module.exports) module.exports = definition() - else if (typeof define == 'function' && define.amd) define(definition) - else context[name] = definition() -}('reqwest', this, function () { - - var context = this - - if ('window' in context) { - var doc = document - , byTag = 'getElementsByTagName' - , head = doc[byTag]('head')[0] - } else { - var XHR2 - try { - XHR2 = require('xhr2') - } catch (ex) { - throw new Error('Peer dependency `xhr2` required! Please npm install xhr2') - } - } - - - var httpsRe = /^http/ - , protocolRe = /(^\w+):\/\// - , twoHundo = /^(20\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request - , readyState = 'readyState' - , contentType = 'Content-Type' - , requestedWith = 'X-Requested-With' - , uniqid = 0 - , callbackPrefix = 'reqwest_' + (+new Date()) - , lastValue // data stored by the most recent JSONP callback - , xmlHttpRequest = 'XMLHttpRequest' - , xDomainRequest = 'XDomainRequest' - , noop = function () {} - - , isArray = typeof Array.isArray == 'function' - ? Array.isArray - : function (a) { - return a instanceof Array - } - - , defaultHeaders = { - 'contentType': 'application/x-www-form-urlencoded' - , 'requestedWith': xmlHttpRequest - , 'accept': { - '*': 'text/javascript, text/html, application/xml, text/xml, */*' - , 'xml': 'application/xml, text/xml' - , 'html': 'text/html' - , 'text': 'text/plain' - , 'json': 'application/json, text/javascript' - , 'js': 'application/javascript, text/javascript' - } - } - - , xhr = function(o) { - // is it x-domain - if (o['crossOrigin'] === true) { - var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null - if (xhr && 'withCredentials' in xhr) { - return xhr - } else if (context[xDomainRequest]) { - return new XDomainRequest() - } else { - throw new Error('Browser does not support cross-origin requests') - } - } else if (context[xmlHttpRequest]) { - return new XMLHttpRequest() - } else if (XHR2) { - return new XHR2() - } else { - return new ActiveXObject('Microsoft.XMLHTTP') - } - } - , globalSetupOptions = { - dataFilter: function (data) { - return data - } - } - - function succeed(r) { - var protocol = protocolRe.exec(r.url) - protocol = (protocol && protocol[1]) || context.location.protocol - return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response - } - - function handleReadyState(r, success, error) { - return function () { - // use _aborted to mitigate against IE err c00c023f - // (can't read props on aborted request objects) - if (r._aborted) return error(r.request) - if (r._timedOut) return error(r.request, 'Request is aborted: timeout') - if (r.request && r.request[readyState] == 4) { - r.request.onreadystatechange = noop - if (succeed(r)) success(r.request) - else - error(r.request) - } - } - } - - function setHeaders(http, o) { - var headers = o['headers'] || {} - , h - - headers['Accept'] = headers['Accept'] - || defaultHeaders['accept'][o['type']] - || defaultHeaders['accept']['*'] - - var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData); - // breaks cross-origin requests with legacy browsers - if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith'] - if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType'] - for (h in headers) - headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h]) - } - - function setCredentials(http, o) { - if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') { - http.withCredentials = !!o['withCredentials'] - } - } - - function generalCallback(data) { - lastValue = data - } - - function urlappend (url, s) { - return url + (/\?/.test(url) ? '&' : '?') + s - } - - function handleJsonp(o, fn, err, url) { - var reqId = uniqid++ - , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key - , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId) - , cbreg = new RegExp('((^|\\?|&)' + cbkey + ')=([^&]+)') - , match = url.match(cbreg) - , script = doc.createElement('script') - , loaded = 0 - , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1 - - if (match) { - if (match[3] === '?') { - url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name - } else { - cbval = match[3] // provided callback func name - } - } else { - url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em - } - - context[cbval] = generalCallback - - script.type = 'text/javascript' - script.src = url - script.async = true - if (typeof script.onreadystatechange !== 'undefined' && !isIE10) { - // need this for IE due to out-of-order onreadystatechange(), binding script - // execution to an event listener gives us control over when the script - // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html - script.htmlFor = script.id = '_reqwest_' + reqId - } - - script.onload = script.onreadystatechange = function () { - if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) { - return false - } - script.onload = script.onreadystatechange = null - script.onclick && script.onclick() - // Call the user callback with the last value stored and clean up values and scripts. - fn(lastValue) - lastValue = undefined - head.removeChild(script) - loaded = 1 - } - - // Add the script to the DOM head - head.appendChild(script) - - // Enable JSONP timeout - return { - abort: function () { - script.onload = script.onreadystatechange = null - err({}, 'Request is aborted: timeout', {}) - lastValue = undefined - head.removeChild(script) - loaded = 1 - } - } - } - - function getRequest(fn, err) { - var o = this.o - , method = (o['method'] || 'GET').toUpperCase() - , url = typeof o === 'string' ? o : o['url'] - // convert non-string objects to query-string form unless o['processData'] is false - , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string') - ? reqwest.toQueryString(o['data']) - : (o['data'] || null) - , http - , sendWait = false - - // if we're working on a GET request and we have data then we should append - // query string to end of URL and not post data - if ((o['type'] == 'jsonp' || method == 'GET') && data) { - url = urlappend(url, data) - data = null - } - - if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url) - - // get the xhr from the factory if passed - // if the factory returns null, fall-back to ours - http = (o.xhr && o.xhr(o)) || xhr(o) - - http.open(method, url, o['async'] === false ? false : true) - setHeaders(http, o) - setCredentials(http, o) - if (context[xDomainRequest] && http instanceof context[xDomainRequest]) { - http.onload = fn - http.onerror = err - // NOTE: see - // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e - http.onprogress = function() {} - sendWait = true - } else { - http.onreadystatechange = handleReadyState(this, fn, err) - } - o['before'] && o['before'](http) - if (sendWait) { - setTimeout(function () { - http.send(data) - }, 200) - } else { - http.send(data) - } - return http - } - - function Reqwest(o, fn) { - this.o = o - this.fn = fn - - init.apply(this, arguments) - } - - function setType(header) { - // json, javascript, text/plain, text/html, xml - if (header === null) return undefined; //In case of no content-type. - if (header.match('json')) return 'json' - if (header.match('javascript')) return 'js' - if (header.match('text')) return 'html' - if (header.match('xml')) return 'xml' - } - - function init(o, fn) { - - this.url = typeof o == 'string' ? o : o['url'] - this.timeout = null - - // whether request has been fulfilled for purpose - // of tracking the Promises - this._fulfilled = false - // success handlers - this._successHandler = function(){} - this._fulfillmentHandlers = [] - // error handlers - this._errorHandlers = [] - // complete (both success and fail) handlers - this._completeHandlers = [] - this._erred = false - this._responseArgs = {} - - var self = this - - fn = fn || function () {} - - if (o['timeout']) { - this.timeout = setTimeout(function () { - timedOut() - }, o['timeout']) - } - - if (o['success']) { - this._successHandler = function () { - o['success'].apply(o, arguments) - } - } - - if (o['error']) { - this._errorHandlers.push(function () { - o['error'].apply(o, arguments) - }) - } - - if (o['complete']) { - this._completeHandlers.push(function () { - o['complete'].apply(o, arguments) - }) - } - - function complete (resp) { - o['timeout'] && clearTimeout(self.timeout) - self.timeout = null - while (self._completeHandlers.length > 0) { - self._completeHandlers.shift()(resp) - } - } - - function success (resp) { - var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE - resp = (type !== 'jsonp') ? self.request : resp - // use global data filter on response text - var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type) - , r = filteredResponse - try { - resp.responseText = r - } catch (e) { - // can't assign this in IE<=8, just ignore - } - if (r) { - switch (type) { - case 'json': - try { - resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')') - } catch (err) { - return error(resp, 'Could not parse JSON in response', err) - } - break - case 'js': - resp = eval(r) - break - case 'html': - resp = r - break - case 'xml': - resp = resp.responseXML - && resp.responseXML.parseError // IE trololo - && resp.responseXML.parseError.errorCode - && resp.responseXML.parseError.reason - ? null - : resp.responseXML - break - } - } - - self._responseArgs.resp = resp - self._fulfilled = true - fn(resp) - self._successHandler(resp) - while (self._fulfillmentHandlers.length > 0) { - resp = self._fulfillmentHandlers.shift()(resp) - } - - complete(resp) - } - - function timedOut() { - self._timedOut = true - self.request.abort() - } - - function error(resp, msg, t) { - resp = self.request - self._responseArgs.resp = resp - self._responseArgs.msg = msg - self._responseArgs.t = t - self._erred = true - while (self._errorHandlers.length > 0) { - self._errorHandlers.shift()(resp, msg, t) - } - complete(resp) - } - - this.request = getRequest.call(this, success, error) - } - - Reqwest.prototype = { - abort: function () { - this._aborted = true - this.request.abort() - } - - , retry: function () { - init.call(this, this.o, this.fn) - } - - /** - * Small deviation from the Promises A CommonJs specification - * http://wiki.commonjs.org/wiki/Promises/A - */ - - /** - * `then` will execute upon successful requests - */ - , then: function (success, fail) { - success = success || function () {} - fail = fail || function () {} - if (this._fulfilled) { - this._responseArgs.resp = success(this._responseArgs.resp) - } else if (this._erred) { - fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t) - } else { - this._fulfillmentHandlers.push(success) - this._errorHandlers.push(fail) - } - return this - } - - /** - * `always` will execute whether the request succeeds or fails - */ - , always: function (fn) { - if (this._fulfilled || this._erred) { - fn(this._responseArgs.resp) - } else { - this._completeHandlers.push(fn) - } - return this - } - - /** - * `fail` will execute when the request fails - */ - , fail: function (fn) { - if (this._erred) { - fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t) - } else { - this._errorHandlers.push(fn) - } - return this - } - , 'catch': function (fn) { - return this.fail(fn) - } - } - - function reqwest(o, fn) { - return new Reqwest(o, fn) - } - - // normalize newline variants according to spec -> CRLF - function normalize(s) { - return s ? s.replace(/\r?\n/g, '\r\n') : '' - } - - function serial(el, cb) { - var n = el.name - , t = el.tagName.toLowerCase() - , optCb = function (o) { - // IE gives value="" even where there is no value attribute - // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273 - if (o && !o['disabled']) - cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text'])) - } - , ch, ra, val, i - - // don't serialize elements that are disabled or without a name - if (el.disabled || !n) return - - switch (t) { - case 'input': - if (!/reset|button|image|file/i.test(el.type)) { - ch = /checkbox/i.test(el.type) - ra = /radio/i.test(el.type) - val = el.value - // WebKit gives us "" instead of "on" if a checkbox has no value, so correct it here - ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val)) - } - break - case 'textarea': - cb(n, normalize(el.value)) - break - case 'select': - if (el.type.toLowerCase() === 'select-one') { - optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null) - } else { - for (i = 0; el.length && i < el.length; i++) { - el.options[i].selected && optCb(el.options[i]) - } - } - break - } - } - - // collect up all form elements found from the passed argument elements all - // the way down to child elements; pass a '
' or form fields. - // called with 'this'=callback to use for serial() on each element - function eachFormElement() { - var cb = this - , e, i - , serializeSubtags = function (e, tags) { - var i, j, fa - for (i = 0; i < tags.length; i++) { - fa = e[byTag](tags[i]) - for (j = 0; j < fa.length; j++) serial(fa[j], cb) - } - } - - for (i = 0; i < arguments.length; i++) { - e = arguments[i] - if (/input|select|textarea/i.test(e.tagName)) serial(e, cb) - serializeSubtags(e, [ 'input', 'select', 'textarea' ]) - } - } - - // standard query string style serialization - function serializeQueryString() { - return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments)) - } - - // { 'name': 'value', ... } style serialization - function serializeHash() { - var hash = {} - eachFormElement.apply(function (name, value) { - if (name in hash) { - hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]]) - hash[name].push(value) - } else hash[name] = value - }, arguments) - return hash - } - - // [ { name: 'name', value: 'value' }, ... ] style serialization - reqwest.serializeArray = function () { - var arr = [] - eachFormElement.apply(function (name, value) { - arr.push({name: name, value: value}) - }, arguments) - return arr - } - - reqwest.serialize = function () { - if (arguments.length === 0) return '' - var opt, fn - , args = Array.prototype.slice.call(arguments, 0) - - opt = args.pop() - opt && opt.nodeType && args.push(opt) && (opt = null) - opt && (opt = opt.type) - - if (opt == 'map') fn = serializeHash - else if (opt == 'array') fn = reqwest.serializeArray - else fn = serializeQueryString - - return fn.apply(null, args) - } - - reqwest.toQueryString = function (o, trad) { - var prefix, i - , traditional = trad || false - , s = [] - , enc = encodeURIComponent - , add = function (key, value) { - // If value is a function, invoke it and return its value - value = ('function' === typeof value) ? value() : (value == null ? '' : value) - s[s.length] = enc(key) + '=' + enc(value) - } - // If an array was passed in, assume that it is an array of form elements. - if (isArray(o)) { - for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value']) - } else { - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for (prefix in o) { - if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add) - } - } - - // spaces should be + according to spec - return s.join('&').replace(/%20/g, '+') - } - - function buildParams(prefix, obj, traditional, add) { - var name, i, v - , rbracket = /\[\]$/ - - if (isArray(obj)) { - // Serialize array item. - for (i = 0; obj && i < obj.length; i++) { - v = obj[i] - if (traditional || rbracket.test(prefix)) { - // Treat each array item as a scalar. - add(prefix, v) - } else { - buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add) - } - } - } else if (obj && obj.toString() === '[object Object]') { - // Serialize object item. - for (name in obj) { - buildParams(prefix + '[' + name + ']', obj[name], traditional, add) - } - - } else { - // Serialize scalar item. - add(prefix, obj) - } - } - - reqwest.getcallbackPrefix = function () { - return callbackPrefix - } - - // jQuery and Zepto compatibility, differences can be remapped here so you can call - // .ajax.compat(options, callback) - reqwest.compat = function (o, fn) { - if (o) { - o['type'] && (o['method'] = o['type']) && delete o['type'] - o['dataType'] && (o['type'] = o['dataType']) - o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback'] - o['jsonp'] && (o['jsonpCallback'] = o['jsonp']) - } - return new Reqwest(o, fn) - } - - reqwest.ajaxSetup = function (options) { - options = options || {} - for (var k in options) { - globalSetupOptions[k] = options[k] - } - } - - return reqwest -}); DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/reqwest.min.js Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/reqwest.min.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/reqwest.min.js +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/reqwest.min.js cannot compute difference between binary files DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/copyright.js Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/copyright.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/copyright.js +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/copyright.js @@ -1,5 +0,0 @@ -/*! - * Reqwest! A general purpose XHR connection manager - * license MIT (c) Dustin Diaz 2015 - * https://github.com/ded/reqwest - */ DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/ender.js Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/ender.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/ender.js +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/ender.js @@ -1,26 +0,0 @@ -!function ($) { - var r = require('reqwest') - , integrate = function (method) { - return function () { - var args = Array.prototype.slice.call(arguments, 0) - , i = (this && this.length) || 0 - while (i--) args.unshift(this[i]) - return r[method].apply(null, args) - } - } - , s = integrate('serialize') - , sa = integrate('serializeArray') - - $.ender({ - ajax: r - , serialize: r.serialize - , serializeArray: r.serializeArray - , toQueryString: r.toQueryString - , ajaxSetup: r.ajaxSetup - }) - - $.ender({ - serialize: s - , serializeArray: sa - }, true) -}(ender); DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/reqwest.js Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/reqwest.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/reqwest.js +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/reqwest.js @@ -1,624 +0,0 @@ -!function (name, context, definition) { - if (typeof module != 'undefined' && module.exports) module.exports = definition() - else if (typeof define == 'function' && define.amd) define(definition) - else context[name] = definition() -}('reqwest', this, function () { - - var context = this - - if ('window' in context) { - var doc = document - , byTag = 'getElementsByTagName' - , head = doc[byTag]('head')[0] - } else { - var XHR2 - try { - XHR2 = require('xhr2') - } catch (ex) { - throw new Error('Peer dependency `xhr2` required! Please npm install xhr2') - } - } - - - var httpsRe = /^http/ - , protocolRe = /(^\w+):\/\// - , twoHundo = /^(20\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request - , readyState = 'readyState' - , contentType = 'Content-Type' - , requestedWith = 'X-Requested-With' - , uniqid = 0 - , callbackPrefix = 'reqwest_' + (+new Date()) - , lastValue // data stored by the most recent JSONP callback - , xmlHttpRequest = 'XMLHttpRequest' - , xDomainRequest = 'XDomainRequest' - , noop = function () {} - - , isArray = typeof Array.isArray == 'function' - ? Array.isArray - : function (a) { - return a instanceof Array - } - - , defaultHeaders = { - 'contentType': 'application/x-www-form-urlencoded' - , 'requestedWith': xmlHttpRequest - , 'accept': { - '*': 'text/javascript, text/html, application/xml, text/xml, */*' - , 'xml': 'application/xml, text/xml' - , 'html': 'text/html' - , 'text': 'text/plain' - , 'json': 'application/json, text/javascript' - , 'js': 'application/javascript, text/javascript' - } - } - - , xhr = function(o) { - // is it x-domain - if (o['crossOrigin'] === true) { - var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null - if (xhr && 'withCredentials' in xhr) { - return xhr - } else if (context[xDomainRequest]) { - return new XDomainRequest() - } else { - throw new Error('Browser does not support cross-origin requests') - } - } else if (context[xmlHttpRequest]) { - return new XMLHttpRequest() - } else if (XHR2) { - return new XHR2() - } else { - return new ActiveXObject('Microsoft.XMLHTTP') - } - } - , globalSetupOptions = { - dataFilter: function (data) { - return data - } - } - - function succeed(r) { - var protocol = protocolRe.exec(r.url) - protocol = (protocol && protocol[1]) || context.location.protocol - return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response - } - - function handleReadyState(r, success, error) { - return function () { - // use _aborted to mitigate against IE err c00c023f - // (can't read props on aborted request objects) - if (r._aborted) return error(r.request) - if (r._timedOut) return error(r.request, 'Request is aborted: timeout') - if (r.request && r.request[readyState] == 4) { - r.request.onreadystatechange = noop - if (succeed(r)) success(r.request) - else - error(r.request) - } - } - } - - function setHeaders(http, o) { - var headers = o['headers'] || {} - , h - - headers['Accept'] = headers['Accept'] - || defaultHeaders['accept'][o['type']] - || defaultHeaders['accept']['*'] - - var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData); - // breaks cross-origin requests with legacy browsers - if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith'] - if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType'] - for (h in headers) - headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h]) - } - - function setCredentials(http, o) { - if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') { - http.withCredentials = !!o['withCredentials'] - } - } - - function generalCallback(data) { - lastValue = data - } - - function urlappend (url, s) { - return url + (/\?/.test(url) ? '&' : '?') + s - } - - function handleJsonp(o, fn, err, url) { - var reqId = uniqid++ - , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key - , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId) - , cbreg = new RegExp('((^|\\?|&)' + cbkey + ')=([^&]+)') - , match = url.match(cbreg) - , script = doc.createElement('script') - , loaded = 0 - , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1 - - if (match) { - if (match[3] === '?') { - url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name - } else { - cbval = match[3] // provided callback func name - } - } else { - url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em - } - - context[cbval] = generalCallback - - script.type = 'text/javascript' - script.src = url - script.async = true - if (typeof script.onreadystatechange !== 'undefined' && !isIE10) { - // need this for IE due to out-of-order onreadystatechange(), binding script - // execution to an event listener gives us control over when the script - // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html - script.htmlFor = script.id = '_reqwest_' + reqId - } - - script.onload = script.onreadystatechange = function () { - if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) { - return false - } - script.onload = script.onreadystatechange = null - script.onclick && script.onclick() - // Call the user callback with the last value stored and clean up values and scripts. - fn(lastValue) - lastValue = undefined - head.removeChild(script) - loaded = 1 - } - - // Add the script to the DOM head - head.appendChild(script) - - // Enable JSONP timeout - return { - abort: function () { - script.onload = script.onreadystatechange = null - err({}, 'Request is aborted: timeout', {}) - lastValue = undefined - head.removeChild(script) - loaded = 1 - } - } - } - - function getRequest(fn, err) { - var o = this.o - , method = (o['method'] || 'GET').toUpperCase() - , url = typeof o === 'string' ? o : o['url'] - // convert non-string objects to query-string form unless o['processData'] is false - , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string') - ? reqwest.toQueryString(o['data']) - : (o['data'] || null) - , http - , sendWait = false - - // if we're working on a GET request and we have data then we should append - // query string to end of URL and not post data - if ((o['type'] == 'jsonp' || method == 'GET') && data) { - url = urlappend(url, data) - data = null - } - - if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url) - - // get the xhr from the factory if passed - // if the factory returns null, fall-back to ours - http = (o.xhr && o.xhr(o)) || xhr(o) - - http.open(method, url, o['async'] === false ? false : true) - setHeaders(http, o) - setCredentials(http, o) - if (context[xDomainRequest] && http instanceof context[xDomainRequest]) { - http.onload = fn - http.onerror = err - // NOTE: see - // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e - http.onprogress = function() {} - sendWait = true - } else { - http.onreadystatechange = handleReadyState(this, fn, err) - } - o['before'] && o['before'](http) - if (sendWait) { - setTimeout(function () { - http.send(data) - }, 200) - } else { - http.send(data) - } - return http - } - - function Reqwest(o, fn) { - this.o = o - this.fn = fn - - init.apply(this, arguments) - } - - function setType(header) { - // json, javascript, text/plain, text/html, xml - if (header === null) return undefined; //In case of no content-type. - if (header.match('json')) return 'json' - if (header.match('javascript')) return 'js' - if (header.match('text')) return 'html' - if (header.match('xml')) return 'xml' - } - - function init(o, fn) { - - this.url = typeof o == 'string' ? o : o['url'] - this.timeout = null - - // whether request has been fulfilled for purpose - // of tracking the Promises - this._fulfilled = false - // success handlers - this._successHandler = function(){} - this._fulfillmentHandlers = [] - // error handlers - this._errorHandlers = [] - // complete (both success and fail) handlers - this._completeHandlers = [] - this._erred = false - this._responseArgs = {} - - var self = this - - fn = fn || function () {} - - if (o['timeout']) { - this.timeout = setTimeout(function () { - timedOut() - }, o['timeout']) - } - - if (o['success']) { - this._successHandler = function () { - o['success'].apply(o, arguments) - } - } - - if (o['error']) { - this._errorHandlers.push(function () { - o['error'].apply(o, arguments) - }) - } - - if (o['complete']) { - this._completeHandlers.push(function () { - o['complete'].apply(o, arguments) - }) - } - - function complete (resp) { - o['timeout'] && clearTimeout(self.timeout) - self.timeout = null - while (self._completeHandlers.length > 0) { - self._completeHandlers.shift()(resp) - } - } - - function success (resp) { - var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE - resp = (type !== 'jsonp') ? self.request : resp - // use global data filter on response text - var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type) - , r = filteredResponse - try { - resp.responseText = r - } catch (e) { - // can't assign this in IE<=8, just ignore - } - if (r) { - switch (type) { - case 'json': - try { - resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')') - } catch (err) { - return error(resp, 'Could not parse JSON in response', err) - } - break - case 'js': - resp = eval(r) - break - case 'html': - resp = r - break - case 'xml': - resp = resp.responseXML - && resp.responseXML.parseError // IE trololo - && resp.responseXML.parseError.errorCode - && resp.responseXML.parseError.reason - ? null - : resp.responseXML - break - } - } - - self._responseArgs.resp = resp - self._fulfilled = true - fn(resp) - self._successHandler(resp) - while (self._fulfillmentHandlers.length > 0) { - resp = self._fulfillmentHandlers.shift()(resp) - } - - complete(resp) - } - - function timedOut() { - self._timedOut = true - self.request.abort() - } - - function error(resp, msg, t) { - resp = self.request - self._responseArgs.resp = resp - self._responseArgs.msg = msg - self._responseArgs.t = t - self._erred = true - while (self._errorHandlers.length > 0) { - self._errorHandlers.shift()(resp, msg, t) - } - complete(resp) - } - - this.request = getRequest.call(this, success, error) - } - - Reqwest.prototype = { - abort: function () { - this._aborted = true - this.request.abort() - } - - , retry: function () { - init.call(this, this.o, this.fn) - } - - /** - * Small deviation from the Promises A CommonJs specification - * http://wiki.commonjs.org/wiki/Promises/A - */ - - /** - * `then` will execute upon successful requests - */ - , then: function (success, fail) { - success = success || function () {} - fail = fail || function () {} - if (this._fulfilled) { - this._responseArgs.resp = success(this._responseArgs.resp) - } else if (this._erred) { - fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t) - } else { - this._fulfillmentHandlers.push(success) - this._errorHandlers.push(fail) - } - return this - } - - /** - * `always` will execute whether the request succeeds or fails - */ - , always: function (fn) { - if (this._fulfilled || this._erred) { - fn(this._responseArgs.resp) - } else { - this._completeHandlers.push(fn) - } - return this - } - - /** - * `fail` will execute when the request fails - */ - , fail: function (fn) { - if (this._erred) { - fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t) - } else { - this._errorHandlers.push(fn) - } - return this - } - , 'catch': function (fn) { - return this.fail(fn) - } - } - - function reqwest(o, fn) { - return new Reqwest(o, fn) - } - - // normalize newline variants according to spec -> CRLF - function normalize(s) { - return s ? s.replace(/\r?\n/g, '\r\n') : '' - } - - function serial(el, cb) { - var n = el.name - , t = el.tagName.toLowerCase() - , optCb = function (o) { - // IE gives value="" even where there is no value attribute - // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273 - if (o && !o['disabled']) - cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text'])) - } - , ch, ra, val, i - - // don't serialize elements that are disabled or without a name - if (el.disabled || !n) return - - switch (t) { - case 'input': - if (!/reset|button|image|file/i.test(el.type)) { - ch = /checkbox/i.test(el.type) - ra = /radio/i.test(el.type) - val = el.value - // WebKit gives us "" instead of "on" if a checkbox has no value, so correct it here - ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val)) - } - break - case 'textarea': - cb(n, normalize(el.value)) - break - case 'select': - if (el.type.toLowerCase() === 'select-one') { - optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null) - } else { - for (i = 0; el.length && i < el.length; i++) { - el.options[i].selected && optCb(el.options[i]) - } - } - break - } - } - - // collect up all form elements found from the passed argument elements all - // the way down to child elements; pass a '' or form fields. - // called with 'this'=callback to use for serial() on each element - function eachFormElement() { - var cb = this - , e, i - , serializeSubtags = function (e, tags) { - var i, j, fa - for (i = 0; i < tags.length; i++) { - fa = e[byTag](tags[i]) - for (j = 0; j < fa.length; j++) serial(fa[j], cb) - } - } - - for (i = 0; i < arguments.length; i++) { - e = arguments[i] - if (/input|select|textarea/i.test(e.tagName)) serial(e, cb) - serializeSubtags(e, [ 'input', 'select', 'textarea' ]) - } - } - - // standard query string style serialization - function serializeQueryString() { - return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments)) - } - - // { 'name': 'value', ... } style serialization - function serializeHash() { - var hash = {} - eachFormElement.apply(function (name, value) { - if (name in hash) { - hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]]) - hash[name].push(value) - } else hash[name] = value - }, arguments) - return hash - } - - // [ { name: 'name', value: 'value' }, ... ] style serialization - reqwest.serializeArray = function () { - var arr = [] - eachFormElement.apply(function (name, value) { - arr.push({name: name, value: value}) - }, arguments) - return arr - } - - reqwest.serialize = function () { - if (arguments.length === 0) return '' - var opt, fn - , args = Array.prototype.slice.call(arguments, 0) - - opt = args.pop() - opt && opt.nodeType && args.push(opt) && (opt = null) - opt && (opt = opt.type) - - if (opt == 'map') fn = serializeHash - else if (opt == 'array') fn = reqwest.serializeArray - else fn = serializeQueryString - - return fn.apply(null, args) - } - - reqwest.toQueryString = function (o, trad) { - var prefix, i - , traditional = trad || false - , s = [] - , enc = encodeURIComponent - , add = function (key, value) { - // If value is a function, invoke it and return its value - value = ('function' === typeof value) ? value() : (value == null ? '' : value) - s[s.length] = enc(key) + '=' + enc(value) - } - // If an array was passed in, assume that it is an array of form elements. - if (isArray(o)) { - for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value']) - } else { - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for (prefix in o) { - if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add) - } - } - - // spaces should be + according to spec - return s.join('&').replace(/%20/g, '+') - } - - function buildParams(prefix, obj, traditional, add) { - var name, i, v - , rbracket = /\[\]$/ - - if (isArray(obj)) { - // Serialize array item. - for (i = 0; obj && i < obj.length; i++) { - v = obj[i] - if (traditional || rbracket.test(prefix)) { - // Treat each array item as a scalar. - add(prefix, v) - } else { - buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add) - } - } - } else if (obj && obj.toString() === '[object Object]') { - // Serialize object item. - for (name in obj) { - buildParams(prefix + '[' + name + ']', obj[name], traditional, add) - } - - } else { - // Serialize scalar item. - add(prefix, obj) - } - } - - reqwest.getcallbackPrefix = function () { - return callbackPrefix - } - - // jQuery and Zepto compatibility, differences can be remapped here so you can call - // .ajax.compat(options, callback) - reqwest.compat = function (o, fn) { - if (o) { - o['type'] && (o['method'] = o['type']) && delete o['type'] - o['dataType'] && (o['type'] = o['dataType']) - o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback'] - o['jsonp'] && (o['jsonpCallback'] = o['jsonp']) - } - return new Reqwest(o, fn) - } - - reqwest.ajaxSetup = function (options) { - options = options || {} - for (var k in options) { - globalSetupOptions[k] = options[k] - } - } - - return reqwest -}); DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/test.js Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/test.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/test.js +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/test.js @@ -1,15 +0,0 @@ -var spawn = require('child_process').spawn - , server = spawn('node', ['make/tests.js']) - , phantom = spawn('./vendor/phantomjs', ['./phantom.js']) - - -phantom.stdout.on('data', function (data) { - console.log('stdout: ' + data); -}) - -phantom.on('exit', function (code, signal) { - var outcome = code == 0 ? 'passed' : 'failed' - console.log('Reqwest tests have %s', outcome, code) - server.kill('SIGHUP') - process.exit(code) -}) DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/ender.js Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/ender.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/ender.js +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/ender.js @@ -1,117 +0,0 @@ -/*! - * Ender: open module JavaScript framework (client-lib) - * copyright Dustin Diaz & Jacob Thornton 2011-2012 (@ded @fat) - * http://ender.no.de - * License MIT - */ -(function (context) { - - // a global object for node.js module compatiblity - // ============================================ - - context['global'] = context - - // Implements simple module system - // losely based on CommonJS Modules spec v1.1.1 - // ============================================ - - var modules = {} - , old = context['$'] - , oldRequire = context['require'] - , oldProvide = context['provide'] - - function require (identifier) { - // modules can be required from ender's build system, or found on the window - var module = modules['$' + identifier] || window[identifier] - if (!module) throw new Error("Ender Error: Requested module '" + identifier + "' has not been defined.") - return module - } - - function provide (name, what) { - return (modules['$' + name] = what) - } - - context['provide'] = provide - context['require'] = require - - function aug(o, o2) { - for (var k in o2) k != 'noConflict' && k != '_VERSION' && (o[k] = o2[k]) - return o - } - - /** - * main Ender return object - * @constructor - * @param {Array|Node|string} s a CSS selector or DOM node(s) - * @param {Array.|Node} r a root node(s) - */ - function Ender(s, r) { - var elements - , i - - this.selector = s - // string || node || nodelist || window - if (typeof s == 'undefined') { - elements = [] - this.selector = '' - } else if (typeof s == 'string' || s.nodeName || (s.length && 'item' in s) || s == window) { - elements = ender._select(s, r) - } else { - elements = isFinite(s.length) ? s : [s] - } - this.length = elements.length - for (i = this.length; i--;) this[i] = elements[i] - } - - /** - * @param {function(el, i, inst)} fn - * @param {Object} opt_scope - * @returns {Ender} - */ - Ender.prototype['forEach'] = function (fn, opt_scope) { - var i, l - // opt out of native forEach so we can intentionally call our own scope - // defaulting to the current item and be able to return self - for (i = 0, l = this.length; i < l; ++i) i in this && fn.call(opt_scope || this[i], this[i], i, this) - // return self for chaining - return this - } - - Ender.prototype.$ = ender // handy reference to self - - - function ender(s, r) { - return new Ender(s, r) - } - - ender['_VERSION'] = '0.4.3-dev' - - ender.fn = Ender.prototype // for easy compat to jQuery plugins - - ender.ender = function (o, chain) { - aug(chain ? Ender.prototype : ender, o) - } - - ender._select = function (s, r) { - if (typeof s == 'string') return (r || document).querySelectorAll(s) - if (s.nodeName) return [s] - return s - } - - - // use callback to receive Ender's require & provide - ender.noConflict = function (callback) { - context['$'] = old - if (callback) { - context['provide'] = oldProvide - context['require'] = oldRequire - callback(require, provide, this) - } - return this - } - - if (typeof module !== 'undefined' && module.exports) module.exports = ender - // use subscript notation as extern for Closure compilation - context['ender'] = context['$'] = context['ender'] || ender - -}(this)); DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/badfixtures.xml Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/badfixtures.xml ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/badfixtures.xml +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/badfixtures.xml @@ -1,1 +0,0 @@ -><><>Not a valid xml document<><>< DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.html Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.html ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.html +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.html @@ -1,1 +0,0 @@ -

boosh

DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.js Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.js +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.js @@ -1,1 +0,0 @@ -window.boosh = 'boosh'; DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.json Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.json ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.json +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.json @@ -1,1 +0,0 @@ -{ "boosh": "boosh" } DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.xml Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.xml ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.xml +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.xml @@ -1,1 +0,0 @@ -boosh DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp.jsonp Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp.jsonp ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp.jsonp +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp.jsonp @@ -1,1 +0,0 @@ -reqwest_0({ "boosh": "boosh" }); DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp2.jsonp Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp2.jsonp ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp2.jsonp +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp2.jsonp @@ -1,1 +0,0 @@ -bar({ "boosh": "boosh" }); DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp3.jsonp Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp3.jsonp ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp3.jsonp +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp3.jsonp @@ -1,1 +0,0 @@ -reqwest_2({ "boosh": "boosh" }); DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi.jsonp Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi.jsonp ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi.jsonp +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi.jsonp @@ -1,1 +0,0 @@ -reqwest_0({ "a": "a" }); DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi_b.jsonp Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi_b.jsonp ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi_b.jsonp +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi_b.jsonp @@ -1,1 +0,0 @@ -reqwest_0({ "b": "b" }); DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi_c.jsonp Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi_c.jsonp ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi_c.jsonp +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi_c.jsonp @@ -1,1 +0,0 @@ -reqwest_0({ "c": "c" }); DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_with_prefix.json Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_with_prefix.json ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_with_prefix.json +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_with_prefix.json @@ -1,1 +0,0 @@ -])}while(1);{ "boosh": "boosh" } DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/invalidJSON.json Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/invalidJSON.json ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/invalidJSON.json +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/invalidJSON.json @@ -1,5 +0,0 @@ -this is not valid JSON!, there: are ~!_+ punctuation - -marks - -all, over, the:place ^ 2 DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/tests.html Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/tests.html ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/tests.html +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/tests.html @@ -1,105 +0,0 @@ - - - - Reqwest tests - - - - - - - - - - -

Reqwest Tests

-
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
    - - - DELETED cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/tests.js Index: cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/tests.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/tests.js +++ cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/tests.js @@ -1,1835 +0,0 @@ -/*jshint maxlen:80*/ -/*global reqwest:true, sink:true, start:true, ender:true, v:true, boosh:true*/ - -(function (ajax) { - var BIND_ARGS = 'bind' - , PASS_ARGS = 'pass' - , FakeXHR = (function () { - function FakeXHR () { - this.args = {} - FakeXHR.last = this - } - FakeXHR.setup = function () { - FakeXHR.oldxhr = window['XMLHttpRequest'] - FakeXHR.oldaxo = window['ActiveXObject'] - window['XMLHttpRequest'] = FakeXHR - window['ActiveXObject'] = FakeXHR - FakeXHR.last = null - } - FakeXHR.restore = function () { - window['XMLHttpRequest'] = FakeXHR.oldxhr - window['ActiveXObject'] = FakeXHR.oldaxo - } - FakeXHR.prototype.methodCallCount = function (name) { - return this.args[name] ? this.args[name].length : 0 - } - FakeXHR.prototype.methodCallArgs = function (name, i, j) { - var a = this.args[name] - && this.args[name].length > i ? this.args[name][i] : null - if (arguments.length > 2) return a && a.length > j ? a[j] : null - return a - } - v.each(['open', 'send', 'setRequestHeader' ], function (f) { - FakeXHR.prototype[f] = function () { - if (!this.args[f]) this.args[f] = [] - this.args[f].push(arguments) - } - }) - return FakeXHR - }()) - - sink('Setup', function (test, ok, before, after) { - before(function () { - ajax.ajaxSetup({ - dataFilter: function (resp, type) { - // example filter to prevent json hijacking - return resp.substring('])}while(1);'.length) - } - }) - }) - after(function () { - ajax.ajaxSetup({ - // reset to original data filter - dataFilter: function (resp, type) { - return resp - } - }) - }) - test('dataFilter', function (complete) { - ajax({ - url: '/tests/fixtures/fixtures_with_prefix.json' - , type: 'json' - , success: function (resp) { - ok(resp, 'received response') - ok( - resp && resp.boosh == 'boosh' - , 'correctly evaluated response as JSON' - ) - complete() - } - }) - }) - }) - - sink('Mime Types', function (test, ok) { - test('JSON', function (complete) { - ajax({ - url: '/tests/fixtures/fixtures.json' - , type: 'json' - , success: function (resp) { - ok(resp, 'received response') - ok( - resp && resp.boosh == 'boosh' - , 'correctly evaluated response as JSON' - ) - complete() - } - }) - }) - - test('JSONP', function (complete) { - // stub callback prefix - reqwest.getcallbackPrefix = function (id) { - return 'reqwest_' + id - } - ajax({ - url: '/tests/fixtures/fixtures_jsonp.jsonp?callback=?' - , type: 'jsonp' - , success: function (resp) { - ok(resp, 'received response for unique generated callback') - ok( - resp && resp.boosh == 'boosh' - , 'correctly evaled response for unique generated cb as JSONP' - ) - complete() - } - }) - }) - - test('JS', function (complete) { - ajax({ - url: '/tests/fixtures/fixtures.js' - , type: 'js' - , success: function () { - ok( - typeof boosh !== 'undefined' && boosh == 'boosh' - , 'evaluated response as JavaScript' - ) - complete() - } - }) - }) - - test('HTML', function (complete) { - ajax({ - url: '/tests/fixtures/fixtures.html' - , type: 'html' - , success: function (resp) { - ok(resp == '

    boosh

    ', 'evaluated response as HTML') - complete() - } - }) - }) - - test('XML', function (complete) { - ajax({ - url: '/tests/fixtures/fixtures.xml' - , type: 'xml' - , success: function (resp) { - ok(resp - && resp.documentElement - && resp.documentElement.nodeName == 'root' - , 'XML Response root is ' - ) - ok(resp - && resp.documentElement - && resp.documentElement.hasChildNodes - && resp.documentElement.firstChild.nodeName == 'boosh' - && resp.documentElement.firstChild.firstChild.nodeValue - == 'boosh' - , 'Correct XML response' - ) - complete() - } - , error: function (err) { - ok(false, err.responseText) - complete() - } - }) - }) - - test('XML (404)', function (complete) { - ajax({ - url:'/tests/fixtures/badfixtures.xml' - , type:'xml' - , success: function (resp) { - if (resp == null) { - ok(true, 'XML response is null') - complete() - } else { - ok(resp - && resp.documentElement - && resp.documentElement.firstChild - && (/error/i).test(resp.documentElement.firstChild.nodeValue) - , 'XML response reports parsing error' - ) - complete() - } - } - , error: function () { - ok(true, 'No XML response (error())') - complete() - } - }) - }) - }) - - sink('JSONP', function (test, ok) { - test('Named callback in query string', function (complete) { - ajax({ - url: '/tests/fixtures/fixtures_jsonp2.jsonp?foo=bar' - , type: 'jsonp' - , jsonpCallback: 'foo' - , success: function (resp) { - ok(resp, 'received response for custom callback') - ok( - resp && resp.boosh == 'boosh' - , 'correctly evaluated response as JSONP with custom callback' - ) - complete() - } - }) - }) - - test('Unnamed callback in query string', function (complete) { - ajax({ - url: '/tests/fixtures/fixtures_jsonp3.jsonp?foo=?' - , type: 'jsonp' - , jsonpCallback: 'foo' - , success: function (resp) { - ok(resp, 'received response for custom wildcard callback') - ok( - resp && resp.boosh == 'boosh' - , 'correctly evaled response as JSONP with custom wildcard cb' - ) - complete() - } - }) - }) - - test('No callback, no query string', function (complete) { - ajax({ - url: '/tests/fixtures/fixtures_jsonp3.jsonp' - , type: 'jsonp' - , jsonpCallback: 'foo' - , success: function (resp) { - ok(resp, 'received response for custom wildcard callback') - ok( - resp && resp.boosh == 'boosh' - , 'correctly evaled response as JSONP with custom cb not in url' - ) - complete() - } - }) - }) - - test('No callback in existing query string', function (complete) { - ajax({ - url: '/tests/none.jsonp?echo&somevar=some+long+str+here' - , type: 'jsonp' - , jsonpCallbackName: 'yohoho' - , success: function (resp) { - ok(resp && resp.query, 'received response from echo callback') - ok( - resp && resp.query && resp.query.somevar == 'some long str here' - , 'correctly evaluated response as JSONP with echo callback' - ) - complete() - } - }) - }) - - test('Append data to existing query string', function (complete) { - ajax({ - url: '/tests/none.jsonp?echo' // should append &somevar... - , type: 'jsonp' - , data: { somevar: 'some long str here', anothervar: 'yo ho ho!' } - , success: function (resp) { - ok(resp && resp.query, 'received response from echo callback') - ok( - resp && resp.query && resp.query.somevar == 'some long str here' - , 'correctly sent and received data object from JSONP echo (1)' - ) - ok( - resp && resp.query && resp.query.anothervar == 'yo ho ho!' - , 'correctly sent and received data object from JSONP echo (2)' - ) - complete() - } - }) - }) - - test('Generate complete query string from data', function (complete) { - ajax({ - url: '/tests/none.jsonp' // should append ?echo...etc. - , type: 'jsonp' - , data: [ - { name: 'somevar', value: 'some long str here' } - , { name: 'anothervar', value: 'yo ho ho!' } - , { name: 'echo', value: true } - ] - , success: function (resp) { - ok(resp && resp.query, 'received response from echo callback') - ok( - resp && resp.query && resp.query.somevar == 'some long str here' - , 'correctly sent and received data array from JSONP echo (1)' - ) - ok( - resp && resp.query && resp.query.anothervar == 'yo ho ho!' - , 'correctly sent and received data array from JSONP echo (2)' - ) - complete() - } - }) - }) - - test('Append data to query string and insert callback name' - , function (complete) { - - ajax({ - // should append data and match callback correctly - url: '/tests/none.jsonp?callback=?' - , type: 'jsonp' - , jsonpCallbackName: 'reqwest_foo' - , data: { foo: 'bar', boo: 'baz', echo: true } - , success: function (resp) { - ok(resp && resp.query, 'received response from echo callback') - ok( - resp && resp.query && resp.query.callback == 'reqwest_foo' - , 'correctly matched callback in URL' - ) - complete() - } - }) - }) - }) - - sink('Callbacks', function (test, ok) { - - test('sync version', function (done) { - var r = ajax({ - method: 'get' - , url: '/tests/fixtures/fixtures.json' - , type: 'json' - , async: false - }) - var request = r.request, - responseText = request.response !== undefined ? request.response : request.responseText - ok(eval('(' + responseText + ')').boosh == 'boosh', 'can make sync calls') - done() - }) - - test('no callbacks', function (complete) { - var pass = true - try { - ajax('/tests/fixtures/fixtures.js') - } catch (ex) { - pass = false - } finally { - ok(pass, 'successfully doesnt fail without callback') - complete() - } - }) - - test('complete is called', function (complete) { - ajax({ - url: '/tests/fixtures/fixtures.js' - , complete: function () { - ok(true, 'called complete') - complete() - } - }) - }) - - test('invalid JSON sets error on resp object', function (complete) { - ajax({ - url: '/tests/fixtures/invalidJSON.json' - , type: 'json' - , success: function () { - ok(false, 'success callback fired') - complete() - } - , error: function (resp, msg) { - ok( - msg == 'Could not parse JSON in response' - , 'error callback fired' - ) - complete() - } - }) - }) - - test('multiple parallel named JSONP callbacks', 8, function () { - ajax({ - url: '/tests/fixtures/fixtures_jsonp_multi.jsonp?callback=reqwest_0' - , type: 'jsonp' - , success: function (resp) { - ok(resp, 'received response from call #1') - ok( - resp && resp.a == 'a' - , 'evaluated response from call #1 as JSONP' - ) - } - }) - ajax({ - url: '/tests/fixtures/fixtures_jsonp_multi_b.jsonp?callback=reqwest_0' - , type: 'jsonp' - , success: function (resp) { - ok(resp, 'received response from call #2') - ok( - resp && resp.b == 'b' - , 'evaluated response from call #2 as JSONP' - ) - } - }) - ajax({ - url: '/tests/fixtures/fixtures_jsonp_multi_c.jsonp?callback=reqwest_0' - , type: 'jsonp' - , success: function (resp) { - ok(resp, 'received response from call #2') - ok( - resp && resp.c == 'c' - , 'evaluated response from call #3 as JSONP' - ) - } - }) - ajax({ - url: '/tests/fixtures/fixtures_jsonp_multi.jsonp?callback=reqwest_0' - , type: 'jsonp' - , success: function (resp) { - ok(resp, 'received response from call #2') - ok( - resp && resp.a == 'a' - , 'evaluated response from call #4 as JSONP' - ) - } - }) - }) - - test('JSONP also supports success promises', function (complete) { - ajax({ - url: '/tests/none.jsonp?echo' - , type: 'jsonp' - , success: function (resp) { - ok(resp, 'received response in constructor success callback') - } - }) - .then(function (resp) { - ok(resp, 'received response in promise success callback') - return resp; - }) - .then(function (resp) { - ok(resp, 'received response in second promise success callback') - complete() - }) - }) - - test('JSONP also supports error promises', function (complete) { - ajax({ - url: '/tests/timeout/' - , type: 'jsonp' - , error: function (err) { - ok(err, 'received error response in constructor error callback') - } - }) - .fail(function (err) { - ok(err, 'received error response in promise error callback') - }) - .fail(function (err) { - ok(err, 'received error response in second promise error callback') - complete() - }) - .abort() - }) - - }) - - if (window.XMLHttpRequest - && ('withCredentials' in new window.XMLHttpRequest())) { - - sink('Cross-origin Resource Sharing', function (test, ok) { - test('make request to another origin', 1, function () { - ajax({ - url: 'http://' + window.location.hostname + ':5678/get-value' - , type: 'text' - , method: 'get' - , crossOrigin: true - , complete: function (resp) { - ok(resp.responseText === 'hello', 'request made successfully') - } - }) - }) - - test('set cookie on other origin', 2, function () { - ajax({ - url: 'http://' + window.location.hostname + ':5678/set-cookie' - , type: 'text' - , method: 'get' - , crossOrigin: true - , withCredentials: true - , before: function (http) { - ok( - http.withCredentials === true - , 'has set withCredentials on connection object' - ) - } - , complete: function (resp) { - ok(resp.status === 200, 'cookie set successfully') - } - }) - }) - - test('get cookie from other origin', 1, function () { - ajax({ - url: 'http://' - + window.location.hostname - + ':5678/get-cookie-value' - , type: 'text' - , method: 'get' - , crossOrigin: true - , withCredentials: true - , complete: function (resp) { - ok( - resp.responseText == 'hello' - , 'cookie value retrieved successfully' - ) - } - }) - }) - - }) - } - - sink('Connection Object', function (test, ok) { - - test('use xhr factory provided in the options', function (complete) { - var reqwest - , xhr - - if (typeof XMLHttpRequest !== 'undefined') { - xhr = new XMLHttpRequest() - } else if (typeof ActiveXObject !== 'undefined') { - xhr = new ActiveXObject('Microsoft.XMLHTTP') - } else { - ok(false, 'browser not supported') - } - - reqwest = ajax({ - url: '/tests/fixtures/fixtures.html', - xhr: function () { - return xhr - } - }) - - ok(reqwest.request === xhr, 'uses factory') - complete() - }) - - test('fallbacks to own xhr factory if falsy is returned', function (complete) { - var reqwest - - FakeXHR.setup() - try { - reqwest = ajax({ - url: '/tests/fixtures/fixtures.html', - xhr: function () { - return null - } - }) - - ok(reqwest.request instanceof FakeXHR, 'fallbacks correctly') - complete() - } finally { - FakeXHR.restore() - } - }) - - test('setRequestHeaders', function (complete) { - ajax({ - url: '/tests/fixtures/fixtures.html' - , data: 'foo=bar&baz=thunk' - , method: 'post' - , headers: { - 'Accept': 'application/x-foo' - } - , success: function () { - ok(true, 'can post headers') - complete() - } - }) - }) - - test('can inspect http before send', function (complete) { - var connection = ajax({ - url: '/tests/fixtures/fixtures.js' - , method: 'post' - , type: 'js' - , before: function (http) { - ok(http.readyState == 1, 'received http connection object') - } - , success: function () { - // Microsoft.XMLHTTP appears not to run this async in IE6&7, it - // processes the request and triggers success() before ajax() even - // returns. Perhaps a better solution would be to defer the calls - // within handleReadyState() - setTimeout(function () { - ok( - connection.request.readyState == 4 - , 'success callback has readyState of 4' - ) - complete() - }, 0) - } - }) - }) - - test('ajax() encodes array `data`', function (complete) { - FakeXHR.setup() - try { - ajax({ - url: '/tests/fixtures/fixtures.html' - , method: 'post' - , data: [ - { name: 'foo', value: 'bar' } - , { name: 'baz', value: 'thunk' } - ] - }) - ok(FakeXHR.last.methodCallCount('send') == 1, 'send called') - ok( - FakeXHR.last.methodCallArgs('send', 0).length == 1 - , 'send called with 1 arg' - ) - ok( - FakeXHR.last.methodCallArgs('send', 0, 0) == 'foo=bar&baz=thunk' - , 'send called with encoded array' - ) - complete() - } finally { - FakeXHR.restore() - } - }) - - test('ajax() encodes hash `data`', function (complete) { - FakeXHR.setup() - try { - ajax({ - url: '/tests/fixtures/fixtures.html' - , method: 'post' - , data: { bar: 'foo', thunk: 'baz' } - }) - ok(FakeXHR.last.methodCallCount('send') == 1, 'send called') - ok( - FakeXHR.last.methodCallArgs('send', 0).length == 1 - , 'send called with 1 arg' - ) - ok( - FakeXHR.last.methodCallArgs('send', 0, 0) == 'bar=foo&thunk=baz' - , 'send called with encoded array' - ) - complete() - } finally { - FakeXHR.restore() - } - }) - - test('ajax() obeys `processData`', function (complete) { - FakeXHR.setup() - try { - var d = { bar: 'foo', thunk: 'baz' } - ajax({ - url: '/tests/fixtures/fixtures.html' - , processData: false - , method: 'post' - , data: d - }) - ok(FakeXHR.last.methodCallCount('send') == 1, 'send called') - ok( - FakeXHR.last.methodCallArgs('send', 0).length == 1 - , 'send called with 1 arg' - ) - ok( - FakeXHR.last.methodCallArgs('send', 0, 0) === d - , 'send called with exact `data` object' - ) - complete() - } finally { - FakeXHR.restore() - } - }) - - function testXhrGetUrlAdjustment(url, data, expectedUrl, complete) { - FakeXHR.setup() - try { - ajax({ url: url, data: data }) - ok(FakeXHR.last.methodCallCount('open') == 1, 'open called') - ok( - FakeXHR.last.methodCallArgs('open', 0).length == 3 - , 'open called with 3 args' - ) - ok( - FakeXHR.last.methodCallArgs('open', 0, 0) == 'GET' - , 'first arg of open() is "GET"' - ) - ok(FakeXHR.last.methodCallArgs('open', 0, 1) == expectedUrl - , 'second arg of open() is URL with query string') - ok( - FakeXHR.last.methodCallArgs('open', 0, 2) === true - , 'third arg of open() is `true`' - ) - ok(FakeXHR.last.methodCallCount('send') == 1, 'send called') - ok( - FakeXHR.last.methodCallArgs('send', 0).length == 1 - , 'send called with 1 arg' - ) - ok( - FakeXHR.last.methodCallArgs('send', 0, 0) === null - , 'send called with null' - ) - complete() - } finally { - FakeXHR.restore() - } - } - - test('ajax() appends GET URL with ?`data`', function (complete) { - testXhrGetUrlAdjustment( - '/tests/fixtures/fixtures.html' - , 'bar=foo&thunk=baz' - , '/tests/fixtures/fixtures.html?bar=foo&thunk=baz' - , complete - ) - }) - - test('ajax() appends GET URL with ?`data` (serialized object)' - , function (complete) { - - testXhrGetUrlAdjustment( - '/tests/fixtures/fixtures.html' - , { bar: 'foo', thunk: 'baz' } - , '/tests/fixtures/fixtures.html?bar=foo&thunk=baz' - , complete - ) - }) - - test('ajax() appends GET URL with &`data` (serialized array)' - , function (complete) { - - testXhrGetUrlAdjustment( - '/tests/fixtures/fixtures.html?x=y' - , [ { name: 'bar', value: 'foo'}, {name: 'thunk', value: 'baz' } ] - , '/tests/fixtures/fixtures.html?x=y&bar=foo&thunk=baz' - , complete - ) - }) - }) - - sink('Standard vs compat mode', function (test, ok) { - function methodMatch(resp, method) { - return resp && resp.method === method - } - function headerMatch(resp, key, expected) { - return resp && resp.headers && resp.headers[key] === expected - } - function queryMatch(resp, key, expected) { - return resp && resp.query && resp.query[key] === expected - } - - test('standard mode default', function (complete) { - ajax({ - url: '/tests/none.json?echo' - , success: function (resp) { - ok(methodMatch(resp, 'GET'), 'correct request method (GET)') - ok( - headerMatch( - resp - , 'content-type' - , 'application/x-www-form-urlencoded' - ) - , 'correct Content-Type request header' - ) - ok( - headerMatch(resp, 'x-requested-with', 'XMLHttpRequest') - , 'correct X-Requested-With header' - ) - ok( - headerMatch( - resp - , 'accept' - , 'text/javascript, text/html, application/xml, text/xml, */*' - ) - , 'correct Accept header' - ) - complete() - } - }) - }) - - test('standard mode custom content-type', function (complete) { - ajax({ - url: '/tests/none.json?echo' - , contentType: 'yapplication/foobar' - , success: function (resp) { - ok(methodMatch(resp, 'GET'), 'correct request method (GET)') - ok( - headerMatch(resp, 'content-type', 'yapplication/foobar') - , 'correct Content-Type request header' - ) - ok( - headerMatch(resp, 'x-requested-with', 'XMLHttpRequest') - , 'correct X-Requested-With header' - ) - ok( - headerMatch( - resp - , 'accept' - , 'text/javascript, text/html, application/xml, text/xml, */*' - ) - , 'correct Accept header' - ) - complete() - } - }) - }) - - test('standard mode on no content-type', function (complete) { - ajax({ - url: '/tests/204' - , success: function (resp) { - ok(true, 'Nothing blew up.') - } - }) - }) - - test('compat mode "dataType=json" headers', function (complete) { - ajax.compat({ - url: '/tests/none.json?echo' - , dataType: 'json' // should map to 'type' - , success: function (resp) { - ok(methodMatch(resp, 'GET'), 'correct request method (GET)') - ok( - headerMatch( - resp - , 'content-type' - , 'application/x-www-form-urlencoded' - ) - , 'correct Content-Type request header' - ) - ok( - headerMatch(resp, 'x-requested-with', 'XMLHttpRequest') - , 'correct X-Requested-With header' - ) - ok( - headerMatch(resp, 'accept', 'application/json, text/javascript') - , 'correct Accept header' - ) - complete() - } - }) - }) - - test('compat mode "dataType=json" with "type=post" headers' - , function (complete) { - ajax.compat({ - url: '/tests/none.json?echo' - , type: 'post' - , dataType: 'json' // should map to 'type' - , success: function (resp) { - ok(methodMatch(resp, 'POST'), 'correct request method (POST)') - ok( - headerMatch( - resp - , 'content-type' - , 'application/x-www-form-urlencoded' - ) - , 'correct Content-Type request header' - ) - ok( - headerMatch(resp, 'x-requested-with', 'XMLHttpRequest') - , 'correct X-Requested-With header' - ) - ok( - headerMatch(resp, 'accept', 'application/json, text/javascript') - , 'correct Accept header' - ) - complete() - } - }) - }) - - test('compat mode "dataType=json" headers (with additional headers)' - , function (complete) { - - ajax.compat({ - url: '/tests/none.json?echo' - , dataType: 'json' // should map to 'type' - // verify that these are left intact and nothing screwy - // happens with headers - , headers: { one: 1, two: 2 } - , success: function (resp) { - ok( - headerMatch( - resp - , 'content-type' - , 'application/x-www-form-urlencoded' - ) - , 'correct Content-Type request header' - ) - ok( - headerMatch(resp, 'x-requested-with', 'XMLHttpRequest') - , 'correct X-Requested-With header' - ) - ok( - headerMatch(resp, 'accept', 'application/json, text/javascript') - , 'correct Accept header' - ) - ok( - headerMatch(resp, 'one', '1') && headerMatch(resp, 'two', '2') - , 'left additional headers intact' - ) - complete() - } - }) - }) - - test('compat mode "dataType=jsonp" query string', function (complete) { - ajax.compat({ - url: '/tests/none.jsonp?echo' - , dataType: 'jsonp' - , jsonp: 'testCallback' // should map to jsonpCallback - , jsonpCallback: 'foobar' // should map to jsonpCallbackName - , success: function (resp) { - ok( - queryMatch(resp, 'echo', '') - , 'correct Content-Type request header' - ) - ok( - queryMatch(resp, 'testCallback', 'foobar') - , 'correct X-Requested-With header' - ) - complete() - } - }) - }) - }) - - /***************** SERIALIZER TESTS ***********************/ - - // define some helpers for the serializer tests that are used often and - // shared with the ender integration tests - - function createSerializeHelper(ok) { - var forms = document.forms - , foo = forms[0].getElementsByTagName('input')[1] - , bar = forms[0].getElementsByTagName('input')[2] - , choices = forms[0].getElementsByTagName('select')[0] - , BIND_ARGS = 'bind' - , PASS_ARGS = 'pass' - - function reset() { - forms[1].reset() - } - - function formElements(formIndex, tagName, elementIndex) { - return forms[formIndex].getElementsByTagName(tagName)[elementIndex] - } - - function isArray(a) { - return Object.prototype.toString.call(a) == '[object Array]' - } - - function sameValue(value, expected) { - if (expected == null) { - return value === null - } else if (isArray(expected)) { - if (value.length !== expected.length) return false - for (var i = 0; i < expected.length; i++) { - if (value[i] != expected[i]) return false - } - return true - } else return value == expected - } - - function testInput(input, name, value, str) { - var sa = ajax.serialize(input, { type: 'array' }) - , sh = ajax.serialize(input, { type: 'map' }) - , av, i - - if (value != null) { - av = isArray(value) ? value : [ value ] - - ok( - sa.length == av.length - , 'serialize(' + str + ', {type:\'array\'}) returns array ' - + '[{name,value}]' - ) - - for (i = 0; i < av.length; i++) { - ok( - name == sa[i].name - , 'serialize(' + str + ', {type:\'array\'})[' + i + '].name' - ) - ok( - av[i] == sa[i].value - , 'serialize(' + str + ', {type:\'array\'})[' + i + '].value' - ) - } - - ok(sameValue(sh[name], value), 'serialize(' + str + ', {type:\'map\'})') - } else { - // the cases where an element shouldn't show up at all, checkbox not - // checked for example - ok(sa.length === 0, 'serialize(' + str + ', {type:\'array\'}) is []') - ok( - v.keys(sh).length === 0 - , 'serialize(' + str + ', {type:\'map\'}) is {}' - ) - } - } - - function testFormSerialize(method, type) { - var expected = - 'foo=bar&bar=baz&wha=1&wha=3&who=tawoo&%24escapable+name' - + '%24=escapeme&choices=two&opinions=world+peace+is+not+real' - - ok(method, 'serialize() bound to context') - ok( - (method ? method(forms[0]) : null) == expected - , 'serialized form (' + type + ')' - ) - } - - function executeMultiArgumentMethod(method, argType, options) { - var els = [ foo, bar, choices ] - , ths = argType === BIND_ARGS ? ender(els) : null - , args = argType === PASS_ARGS ? els : [] - - if (!!options) args.push(options) - - return method.apply(ths, args) - } - - function testMultiArgumentSerialize(method, type, argType) { - ok(method, 'serialize() bound in context') - var result = method ? executeMultiArgumentMethod(method, argType) : null - ok( - result == 'foo=bar&bar=baz&choices=two' - , 'serialized all 3 arguments together' - ) - } - - function verifyFormSerializeArray(result, type) { - var expected = [ - { name: 'foo', value: 'bar' } - , { name: 'bar', value: 'baz' } - , { name: 'wha', value: 1 } - , { name: 'wha', value: 3 } - , { name: 'who', value: 'tawoo' } - , { name: '$escapable name$', value: 'escapeme' } - , { name: 'choices', value: 'two' } - , { name: 'opinions', value: 'world peace is not real' } - ] - , i - - for (i = 0; i < expected.length; i++) { - ok(v.some(result, function (v) { - return v.name == expected[i].name && v.value == expected[i].value - }), 'serialized ' + expected[i].name + ' (' + type + ')') - } - } - - function testFormSerializeArray(method, type) { - ok(method, 'serialize(..., {type:\'array\'}) bound to context') - - var result = method ? method(forms[0], { type: 'array' }) : [] - if (!result) result = [] - - verifyFormSerializeArray(result, type) - } - - function testMultiArgumentSerializeArray(method, type, argType) { - ok(method, 'serialize(..., {type:\'array\'}) bound to context') - var result = method - ? executeMultiArgumentMethod(method, argType, { type: 'array' }) - : [] - - if (!result) result = [] - - ok(result.length == 3, 'serialized as array of 3') - ok( - result.length == 3 - && result[0].name == 'foo' - && result[0].value == 'bar' - , 'serialized first element (' + type + ')' - ) - ok( - result.length == 3 - && result[1].name == 'bar' - && result[1].value == 'baz' - , 'serialized second element (' + type + ')' - ) - ok( - result.length == 3 - && result[2].name == 'choices' - && result[2].value == 'two' - , 'serialized third element (' + type + ')' - ) - } - - function testFormSerializeHash(method, type) { - var expected = { - foo: 'bar' - , bar: 'baz' - , wha: [ '1', '3' ] - , who: 'tawoo' - , '$escapable name$': 'escapeme' - , choices: 'two' - , opinions: 'world peace is not real' - } - , result - - ok(method, 'serialize({type:\'map\'}) bound to context') - - result = method ? method(forms[0], { type: 'map' }) : {} - if (!result) result = {} - - ok( - v.keys(expected).length === v.keys(result).length - , 'same number of keys (' + type + ')' - ) - - v.each(v.keys(expected), function (k) { - ok( - sameValue(expected[k], result[k]) - , 'same value for ' + k + ' (' + type + ')' - ) - }) - } - - function testMultiArgumentSerializeHash(method, type, argType) { - ok(method, 'serialize({type:\'map\'}) bound to context') - var result = method - ? executeMultiArgumentMethod(method, argType, { type: 'map' }) - : {} - if (!result) result = {} - ok(result.foo == 'bar', 'serialized first element (' + type + ')') - ok(result.bar == 'baz', 'serialized second element (' + type + ')') - ok(result.choices == 'two', 'serialized third element (' + type + ')') - } - - return { - reset: reset - , formElements: formElements - , testInput: testInput - , testFormSerialize: testFormSerialize - , testMultiArgumentSerialize: testMultiArgumentSerialize - , testFormSerializeArray: testFormSerializeArray - , verifyFormSerializeArray: verifyFormSerializeArray - , testMultiArgumentSerializeArray: testMultiArgumentSerializeArray - , testFormSerializeHash: testFormSerializeHash - , testMultiArgumentSerializeHash: testMultiArgumentSerializeHash - } - } - - sink('Serializing', function (test, ok) { - - /* - * Serialize forms according to spec. - * * reqwest.serialize(ele[, ele...]) returns a query string style - * serialization - * * reqwest.serialize(ele[, ele...], {type:'array'}) returns a - * [ { name: 'name', value: 'value'}, ... ] style serialization, - * compatible with jQuery.serializeArray() - * * reqwest.serialize(ele[, ele...], {type:\'map\'}) returns a - * { 'name': 'value', ... } style serialization, compatible with - * Prototype Form.serializeElements({hash:true}) - * Some tests based on spec notes here: - * http://malsup.com/jquery/form/comp/test.html - */ - - var sHelper = createSerializeHelper(ok) - sHelper.reset() - - test('correctly serialize textarea', function (complete) { - var textarea = sHelper.formElements(1, 'textarea', 0) - , sa - - // the texarea has 2 different newline styles, should come out as - // normalized CRLF as per forms spec - ok( - 'T3=%3F%0D%0AA+B%0D%0AZ' == ajax.serialize(textarea) - , 'serialize(textarea)' - ) - sa = ajax.serialize(textarea, { type: 'array' }) - ok(sa.length == 1, 'serialize(textarea, {type:\'array\'}) returns array') - sa = sa[0] - ok('T3' == sa.name, 'serialize(textarea, {type:\'array\'}).name') - ok( - '?\r\nA B\r\nZ' == sa.value - , 'serialize(textarea, {type:\'array\'}).value' - ) - ok( - '?\r\nA B\r\nZ' == ajax.serialize(textarea, { type: 'map' }).T3 - , 'serialize(textarea, {type:\'map\'})' - ) - complete() - }) - - test('correctly serialize input[type=hidden]', function (complete) { - sHelper.testInput( - sHelper.formElements(1, 'input', 0) - , 'H1' - , 'x' - , 'hidden' - ) - sHelper.testInput( - sHelper.formElements(1, 'input', 1) - , 'H2' - , '' - , 'hidden[no value]' - ) - complete() - }) - - test('correctly serialize input[type=password]', function (complete) { - sHelper.testInput( - sHelper.formElements(1, 'input', 2) - , 'PWD1' - , 'xyz' - , 'password' - ) - sHelper.testInput( - sHelper.formElements(1, 'input', 3) - , 'PWD2' - , '' - , 'password[no value]' - ) - complete() - }) - - test('correctly serialize input[type=text]', function (complete) { - sHelper.testInput( - sHelper.formElements(1, 'input', 4) - , 'T1' - , '' - , 'text[no value]' - ) - sHelper.testInput( - sHelper.formElements(1, 'input', 5) - , 'T2' - , 'YES' - , 'text[readonly]' - ) - sHelper.testInput( - sHelper.formElements(1, 'input', 10) - , 'My Name' - , 'me' - , 'text[space name]' - ) - complete() - }) - - test('correctly serialize input[type=checkbox]', function (complete) { - var cb1 = sHelper.formElements(1, 'input', 6) - , cb2 = sHelper.formElements(1, 'input', 7) - sHelper.testInput(cb1, 'C1', null, 'checkbox[not checked]') - cb1.checked = true - sHelper.testInput(cb1, 'C1', '1', 'checkbox[checked]') - // special case here, checkbox with no value='' should give you 'on' - // for cb.value - sHelper.testInput(cb2, 'C2', null, 'checkbox[no value, not checked]') - cb2.checked = true - sHelper.testInput(cb2, 'C2', 'on', 'checkbox[no value, checked]') - complete() - }) - - test('correctly serialize input[type=radio]', function (complete) { - var r1 = sHelper.formElements(1, 'input', 8) - , r2 = sHelper.formElements(1, 'input', 9) - sHelper.testInput(r1, 'R1', null, 'radio[not checked]') - r1.checked = true - sHelper.testInput(r1, 'R1', '1', 'radio[not checked]') - sHelper.testInput(r2, 'R1', null, 'radio[no value, not checked]') - r2.checked = true - sHelper.testInput(r2, 'R1', '', 'radio[no value, checked]') - complete() - }) - - test('correctly serialize input[type=reset]', function (complete) { - sHelper.testInput( - sHelper.formElements(1, 'input', 11) - , 'rst' - , null - , 'reset' - ) - complete() - }) - - test('correctly serialize input[type=file]', function (complete) { - sHelper.testInput( - sHelper.formElements(1, 'input', 12) - , 'file' - , null - , 'file' - ) - complete() - }) - - test('correctly serialize input[type=submit]', function (complete) { - // we're only supposed to serialize a submit button if it was clicked to - // perform this serialization: - // http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2 - // but we'll pretend to be oblivious to this part of the spec... - sHelper.testInput( - sHelper.formElements(1, 'input', 13) - , 'sub' - , 'NO' - , 'submit' - ) - complete() - }) - - test('correctly serialize select with no options', function (complete) { - var select = sHelper.formElements(1, 'select', 0) - sHelper.testInput(select, 'S1', null, 'select, no options') - complete() - }) - - test('correctly serialize select with values', function (complete) { - var select = sHelper.formElements(1, 'select', 1) - sHelper.testInput(select, 'S2', 'abc', 'select option 1 (default)') - select.selectedIndex = 1 - sHelper.testInput(select, 'S2', 'def', 'select option 2') - select.selectedIndex = 6 - sHelper.testInput(select, 'S2', 'disco stu', 'select option 7') - // a special case where we have , should - // return '' rather than X which will happen if you just do a simple - // `value=(option.value||option.text)` - select.selectedIndex = 9 - sHelper.testInput( - select - , 'S2' - , '' - , 'select option 9, value="" should yield ""' - ) - select.selectedIndex = -1 - sHelper.testInput(select, 'S2', null, 'select, unselected') - complete() - }) - - test('correctly serialize select without explicit values' - , function (complete) { - - var select = sHelper.formElements(1, 'select', 2) - sHelper.testInput(select, 'S3', 'ABC', 'select option 1 (default)') - select.selectedIndex = 1 - sHelper.testInput(select, 'S3', 'DEF', 'select option 2') - select.selectedIndex = 6 - sHelper.testInput(select, 'S3', 'DISCO STU!', 'select option 7') - select.selectedIndex = -1 - sHelper.testInput(select, 'S3', null, 'select, unselected') - complete() - }) - - test('correctly serialize select multiple', function (complete) { - var select = sHelper.formElements(1, 'select', 3) - sHelper.testInput(select, 'S4', null, 'select, unselected (default)') - select.options[1].selected = true - sHelper.testInput(select, 'S4', '2', 'select option 2') - select.options[3].selected = true - sHelper.testInput(select, 'S4', [ '2', '4' ], 'select options 2 & 4') - select.options[8].selected = true - sHelper.testInput( - select - , 'S4' - , [ '2', '4', 'Disco Stu!' ] - , 'select option 2 & 4 & 9' - ) - select.options[3].selected = false - sHelper.testInput( - select - , 'S4' - , [ '2', 'Disco Stu!' ] - , 'select option 2 & 9' - ) - select.options[1].selected = false - select.options[8].selected = false - sHelper.testInput(select, 'S4', null, 'select, all unselected') - complete() - }) - - test('correctly serialize options', function (complete) { - var option = sHelper.formElements(1, 'select', 1).options[6] - sHelper.testInput( - option - , '-' - , null - , 'just option (with value), shouldn\'t serialize' - ) - - option = sHelper.formElements(1, 'select', 2).options[6] - sHelper.testInput( - option - , '-' - , null - , 'option (without value), shouldn\'t serialize' - ) - - complete() - }) - - test('correctly serialize disabled', function (complete) { - var input = sHelper.formElements(1, 'input', 14) - , select - - sHelper.testInput(input, 'D1', null, 'disabled text input') - input = sHelper.formElements(1, 'input', 15) - sHelper.testInput(input, 'D2', null, 'disabled checkbox') - input = sHelper.formElements(1, 'input', 16) - sHelper.testInput(input, 'D3', null, 'disabled radio') - - select = sHelper.formElements(1, 'select', 4) - sHelper.testInput(select, 'D4', null, 'disabled select') - select = sHelper.formElements(1, 'select', 3) - sHelper.testInput(select, 'D5', null, 'disabled select option') - select = sHelper.formElements(1, 'select', 6) - sHelper.testInput(select, 'D6', null, 'disabled multi select') - select = sHelper.formElements(1, 'select', 7) - sHelper.testInput(select, 'D7', null, 'disabled multi select option') - complete() - }) - - test('serialize(form)', function (complete) { - sHelper.testFormSerialize(ajax.serialize, 'direct') - complete() - }) - - test('serialize(form, {type:\'array\'})', function (complete) { - sHelper.testFormSerializeArray(ajax.serialize, 'direct') - complete() - }) - - test('serialize(form, {type:\'map\'})', function (complete) { - sHelper.testFormSerializeHash(ajax.serialize, 'direct') - complete() - }) - - // mainly for Ender integration, so you can do this: - // $('input[name=T2],input[name=who],input[name=wha]').serialize() - test('serialize(element, element, element...)', function (complete) { - sHelper.testMultiArgumentSerialize(ajax.serialize, 'direct', PASS_ARGS) - complete() - }) - - // mainly for Ender integration, so you can do this: - // $('input[name=T2],input[name=who],input[name=wha]') - // .serialize({type:'array'}) - test('serialize(element, element, element..., {type:\'array\'})' - , function (complete) { - sHelper.testMultiArgumentSerializeArray( - ajax.serialize - , 'direct' - , PASS_ARGS - ) - complete() - }) - - // mainly for Ender integration, so you can do this: - // $('input[name=T2],input[name=who],input[name=wha]') - // .serialize({type:'map'}) - test('serialize(element, element, element...)', function (complete) { - sHelper.testMultiArgumentSerializeHash( - ajax.serialize - , 'direct' - , PASS_ARGS - ) - complete() - }) - - test('toQueryString([{ name: x, value: y }, ... ]) name/value array' - , function (complete) { - - var arr = [ - { name: 'foo', value: 'bar' } - , { name: 'baz', value: '' } - , { name: 'x', value: -20 } - , { name: 'x', value: 20 } - ] - - ok(ajax.toQueryString(arr) == 'foo=bar&baz=&x=-20&x=20', 'simple') - - arr = [ - { name: 'dotted.name.intact', value: '$@%' } - , { name: '$ $', value: 20 } - , { name: 'leave britney alone', value: 'waa haa haa' } - ] - - ok( - ajax.toQueryString(arr) == - 'dotted.name.intact=%24%40%25&%24+%24=20' - + '&leave+britney+alone=waa+haa+haa' - , 'escaping required' - ) - - complete() - }) - - test('toQueryString({name: value,...} complex object', function (complete) { - var obj = { 'foo': 'bar', 'baz': '', 'x': -20 } - - ok(ajax.toQueryString(obj) == 'foo=bar&baz=&x=-20', 'simple') - - obj = { - 'dotted.name.intact': '$@%' - , '$ $': 20 - , 'leave britney alone': 'waa haa haa' - } - ok( - ajax.toQueryString(obj) == - 'dotted.name.intact=%24%40%25&%24+%24=20' - + '&leave+britney+alone=waa+haa+haa' - , 'escaping required' - ) - - complete() - }) - - test('toQueryString({name: [ value1, value2 ...],...} object with arrays', function (complete) { - var obj = { 'foo': 'bar', 'baz': [ '', '', 'boo!' ], 'x': [ -20, 2.2, 20 ] } - ok(ajax.toQueryString(obj, true) == "foo=bar&baz=&baz=&baz=boo!&x=-20&x=2.2&x=20", "object with arrays") - ok(ajax.toQueryString(obj) == "foo=bar&baz%5B%5D=&baz%5B%5D=&baz%5B%5D=boo!&x%5B%5D=-20&x%5B%5D=2.2&x%5B%5D=20") - complete() - }) - - test('toQueryString({name: { nestedName: value },...} object with objects', function(complete) { - var obj = { 'foo': { 'bar': 'baz' }, 'x': [ { 'bar': 'baz' }, { 'boo': 'hiss' } ] } - ok(ajax.toQueryString(obj) == "foo%5Bbar%5D=baz&x%5B0%5D%5Bbar%5D=baz&x%5B1%5D%5Bboo%5D=hiss", "object with objects") - complete() - }) - - }) - - sink('Ender Integration', function (test, ok) { - var sHelper = createSerializeHelper(ok) - sHelper.reset() - - test('$.ajax alias for reqwest, not bound to boosh', 1, function () { - ok(ender.ajax === ajax, '$.ajax is reqwest') - }) - - // sHelper.test that you can do $.serialize(form) - test('$.serialize(form)', function (complete) { - sHelper.testFormSerialize(ender.serialize, 'ender') - complete() - }) - - // sHelper.test that you can do $.serialize(form) - test('$.serialize(form, {type:\'array\'})', function (complete) { - sHelper.testFormSerializeArray(ender.serialize, 'ender') - complete() - }) - - // sHelper.test that you can do $.serialize(form) - test('$.serialize(form, {type:\'map\'})', function (complete) { - sHelper.testFormSerializeHash(ender.serialize, 'ender') - complete() - }) - - // sHelper.test that you can do $.serializeObject(form) - test('$.serializeArray(...) alias for serialize(..., {type:\'map\'}' - , function (complete) { - sHelper.verifyFormSerializeArray( - ender.serializeArray(document.forms[0]) - , 'ender' - ) - complete() - }) - - test('$.serialize(element, element, element...)', function (complete) { - sHelper.testMultiArgumentSerialize(ender.serialize, 'ender', PASS_ARGS) - complete() - }) - - test('$.serialize(element, element, element..., {type:\'array\'})' - , function (complete) { - sHelper.testMultiArgumentSerializeArray( - ender.serialize - , 'ender' - , PASS_ARGS - ) - complete() - }) - - test('$.serialize(element, element, element..., {type:\'map\'})' - , function (complete) { - sHelper.testMultiArgumentSerializeHash( - ender.serialize - , 'ender' - , PASS_ARGS - ) - complete() - }) - - test('$(element, element, element...).serialize()', function (complete) { - sHelper.testMultiArgumentSerialize(ender.fn.serialize, 'ender', BIND_ARGS) - complete() - }) - - test('$(element, element, element...).serialize({type:\'array\'})' - , function (complete) { - sHelper.testMultiArgumentSerializeArray( - ender.fn.serialize - , 'ender' - , BIND_ARGS - ) - complete() - }) - - test('$(element, element, element...).serialize({type:\'map\'})' - , function (complete) { - sHelper.testMultiArgumentSerializeHash( - ender.fn.serialize - , 'ender' - , BIND_ARGS - ) - complete() - }) - - test('$.toQueryString alias for reqwest.toQueryString, not bound to boosh' - , function (complete) { - ok( - ender.toQueryString === ajax.toQueryString - , '$.toQueryString is reqwest.toQueryString' - ) - complete() - }) - }) - - - /** - * Promise tests for `then` `fail` and `always` - */ - sink('Promises', function (test, ok) { - - test('always callback is called', function (complete) { - ajax({ - url: '/tests/fixtures/fixtures.js' - }) - .always(function () { - ok(true, 'called complete') - complete() - }) - }) - - test('success and error handlers are called', 3, function () { - ajax({ - url: '/tests/fixtures/invalidJSON.json' - , type: 'json' - }) - .then( - function () { - ok(false, 'success callback fired') - } - , function (resp, msg) { - ok( - msg == 'Could not parse JSON in response' - , 'error callback fired' - ) - } - ) - - ajax({ - url: '/tests/fixtures/invalidJSON.json' - , type: 'json' - }) - .fail(function (resp, msg) { - ok(msg == 'Could not parse JSON in response', 'fail callback fired') - }) - - ajax({ - url: '/tests/fixtures/fixtures.json' - , type: 'json' - }) - .then( - function () { - ok(true, 'success callback fired') - } - , function () { - ok(false, 'error callback fired') - } - ) - }) - - test('then is chainable', 2, function () { - ajax({ - url: '/tests/fixtures/fixtures.json' - , type: 'json' - }) - .then( - function (resp) { - ok(true, 'first success callback fired') - return 'new value'; - } - ) - .then( - function (resp) { - ok(resp === 'new value', 'second success callback fired') - } - ) - }) - - test('success does not chain with then', 2, function () { - ajax({ - url: '/tests/fixtures/fixtures.json' - , type: 'json' - , success: function() { - ok(true, 'success callback fired') - return 'some independent value'; - } - }) - .then( - function (resp) { - ok( - resp && resp !== 'some independent value' - , 'then callback fired' - ) - } - ) - }) - - test('then & always handlers can be added after a response is received' - , 2 - , function () { - - var a = ajax({ - url: '/tests/fixtures/fixtures.json' - , type: 'json' - }) - .always(function () { - setTimeout(function () { - a.then( - function () { - ok(true, 'success callback called') - } - , function () { - ok(false, 'error callback called') - } - ).always(function () { - ok(true, 'complete callback called') - }) - }, 1) - }) - }) - - test('then is chainable after a response is received' - , 2 - , function () { - - var a = ajax({ - url: '/tests/fixtures/fixtures.json' - , type: 'json' - }) - .always(function () { - setTimeout(function () { - a.then(function () { - ok(true, 'first success callback called') - return 'new value'; - }).then(function (resp) { - ok(resp === 'new value', 'second success callback called') - }) - }, 1) - }) - }) - - test('failure handlers can be added after a response is received' - , function (complete) { - - var a = ajax({ - url: '/tests/fixtures/invalidJSON.json' - , type: 'json' - }) - .always(function () { - setTimeout(function () { - a - .fail(function () { - ok(true, 'fail callback called') - complete() - }) - }, 1) - }) - }) - - test('.then success and fail are optional parameters', 1, function () { - try { - ajax({ - url: '/tests/fixtures/invalidJSON.json' - , type: 'json' - }) - .then() - } catch (ex) { - ok(false, '.then() parameters should be optional') - } finally { - ok(true, 'passed .then() optional parameters') - } - }) - - }) - - - - sink('Timeout', function (test, ok) { - test('xmlHttpRequest', function (complete) { - var ts = +new Date() - ajax({ - url: '/tests/timeout' - , type: 'json' - , timeout: 250 - , error: function (err, msg) { - ok(err, 'received error response') - try { - ok(err && err.status === 0, 'correctly caught timeout') - ok(msg && msg === 'Request is aborted: timeout', 'timeout message received') - } catch (e) { - ok(true, 'IE is a troll') - } - var tt = Math.abs(+new Date() - ts) - ok( - tt > 200 && tt < 300 - , 'timeout close enough to 250 (' + tt + ')' - ) - complete() - } - }) - }) - - test('jsonpRequest', function (complete) { - var ts = +new Date() - ajax({ - url: '/tests/timeout' - , type: 'jsonp' - , timeout: 250 - , error: function (err) { - ok(err, 'received error response') - var tt = Math.abs(+new Date() - ts) - ok( - tt > 200 && tt < 300 - , 'timeout close enough to 250 (' + tt + ')' - ) - complete() - } - }) - }) - }) - - start() - -}(reqwest)) DELETED cmd/pisc-web-ide/webroot/static/js/vue-js/vue.js Index: cmd/pisc-web-ide/webroot/static/js/vue-js/vue.js ================================================================== --- cmd/pisc-web-ide/webroot/static/js/vue-js/vue.js +++ cmd/pisc-web-ide/webroot/static/js/vue-js/vue.js @@ -1,9175 +0,0 @@ -/*! - * Vue.js v2.2.0 - * (c) 2014-2017 Evan You - * Released under the MIT License. - */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.Vue = factory()); -}(this, (function () { 'use strict'; - -/* */ - -/** - * Convert a value to a string that is actually rendered. - */ -function _toString (val) { - return val == null - ? '' - : typeof val === 'object' - ? JSON.stringify(val, null, 2) - : String(val) -} - -/** - * Convert a input value to a number for persistence. - * If the conversion fails, return original string. - */ -function toNumber (val) { - var n = parseFloat(val); - return isNaN(n) ? val : n -} - -/** - * Make a map and return a function for checking if a key - * is in that map. - */ -function makeMap ( - str, - expectsLowerCase -) { - var map = Object.create(null); - var list = str.split(','); - for (var i = 0; i < list.length; i++) { - map[list[i]] = true; - } - return expectsLowerCase - ? function (val) { return map[val.toLowerCase()]; } - : function (val) { return map[val]; } -} - -/** - * Check if a tag is a built-in tag. - */ -var isBuiltInTag = makeMap('slot,component', true); - -/** - * Remove an item from an array - */ -function remove (arr, item) { - if (arr.length) { - var index = arr.indexOf(item); - if (index > -1) { - return arr.splice(index, 1) - } - } -} - -/** - * Check whether the object has the property. - */ -var hasOwnProperty = Object.prototype.hasOwnProperty; -function hasOwn (obj, key) { - return hasOwnProperty.call(obj, key) -} - -/** - * Check if value is primitive - */ -function isPrimitive (value) { - return typeof value === 'string' || typeof value === 'number' -} - -/** - * Create a cached version of a pure function. - */ -function cached (fn) { - var cache = Object.create(null); - return (function cachedFn (str) { - var hit = cache[str]; - return hit || (cache[str] = fn(str)) - }) -} - -/** - * Camelize a hyphen-delimited string. - */ -var camelizeRE = /-(\w)/g; -var camelize = cached(function (str) { - return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; }) -}); - -/** - * Capitalize a string. - */ -var capitalize = cached(function (str) { - return str.charAt(0).toUpperCase() + str.slice(1) -}); - -/** - * Hyphenate a camelCase string. - */ -var hyphenateRE = /([^-])([A-Z])/g; -var hyphenate = cached(function (str) { - return str - .replace(hyphenateRE, '$1-$2') - .replace(hyphenateRE, '$1-$2') - .toLowerCase() -}); - -/** - * Simple bind, faster than native - */ -function bind (fn, ctx) { - function boundFn (a) { - var l = arguments.length; - return l - ? l > 1 - ? fn.apply(ctx, arguments) - : fn.call(ctx, a) - : fn.call(ctx) - } - // record original fn length - boundFn._length = fn.length; - return boundFn -} - -/** - * Convert an Array-like object to a real Array. - */ -function toArray (list, start) { - start = start || 0; - var i = list.length - start; - var ret = new Array(i); - while (i--) { - ret[i] = list[i + start]; - } - return ret -} - -/** - * Mix properties into target object. - */ -function extend (to, _from) { - for (var key in _from) { - to[key] = _from[key]; - } - return to -} - -/** - * Quick object check - this is primarily used to tell - * Objects from primitive values when we know the value - * is a JSON-compliant type. - */ -function isObject (obj) { - return obj !== null && typeof obj === 'object' -} - -/** - * Strict object type check. Only returns true - * for plain JavaScript objects. - */ -var toString = Object.prototype.toString; -var OBJECT_STRING = '[object Object]'; -function isPlainObject (obj) { - return toString.call(obj) === OBJECT_STRING -} - -/** - * Merge an Array of Objects into a single Object. - */ -function toObject (arr) { - var res = {}; - for (var i = 0; i < arr.length; i++) { - if (arr[i]) { - extend(res, arr[i]); - } - } - return res -} - -/** - * Perform no operation. - */ -function noop () {} - -/** - * Always return false. - */ -var no = function () { return false; }; - -/** - * Return same value - */ -var identity = function (_) { return _; }; - -/** - * Generate a static keys string from compiler modules. - */ -function genStaticKeys (modules) { - return modules.reduce(function (keys, m) { - return keys.concat(m.staticKeys || []) - }, []).join(',') -} - -/** - * Check if two values are loosely equal - that is, - * if they are plain objects, do they have the same shape? - */ -function looseEqual (a, b) { - var isObjectA = isObject(a); - var isObjectB = isObject(b); - if (isObjectA && isObjectB) { - return JSON.stringify(a) === JSON.stringify(b) - } else if (!isObjectA && !isObjectB) { - return String(a) === String(b) - } else { - return false - } -} - -function looseIndexOf (arr, val) { - for (var i = 0; i < arr.length; i++) { - if (looseEqual(arr[i], val)) { return i } - } - return -1 -} - -/** - * Ensure a function is called only once. - */ -function once (fn) { - var called = false; - return function () { - if (!called) { - called = true; - fn(); - } - } -} - -/* */ - -var config = { - /** - * Option merge strategies (used in core/util/options) - */ - optionMergeStrategies: Object.create(null), - - /** - * Whether to suppress warnings. - */ - silent: false, - - /** - * Show production mode tip message on boot? - */ - productionTip: "development" !== 'production', - - /** - * Whether to enable devtools - */ - devtools: "development" !== 'production', - - /** - * Whether to record perf - */ - performance: "development" !== 'production', - - /** - * Error handler for watcher errors - */ - errorHandler: null, - - /** - * Ignore certain custom elements - */ - ignoredElements: [], - - /** - * Custom user key aliases for v-on - */ - keyCodes: Object.create(null), - - /** - * Check if a tag is reserved so that it cannot be registered as a - * component. This is platform-dependent and may be overwritten. - */ - isReservedTag: no, - - /** - * Check if a tag is an unknown element. - * Platform-dependent. - */ - isUnknownElement: no, - - /** - * Get the namespace of an element - */ - getTagNamespace: noop, - - /** - * Parse the real tag name for the specific platform. - */ - parsePlatformTagName: identity, - - /** - * Check if an attribute must be bound using property, e.g. value - * Platform-dependent. - */ - mustUseProp: no, - - /** - * List of asset types that a component can own. - */ - _assetTypes: [ - 'component', - 'directive', - 'filter' - ], - - /** - * List of lifecycle hooks. - */ - _lifecycleHooks: [ - 'beforeCreate', - 'created', - 'beforeMount', - 'mounted', - 'beforeUpdate', - 'updated', - 'beforeDestroy', - 'destroyed', - 'activated', - 'deactivated' - ], - - /** - * Max circular updates allowed in a scheduler flush cycle. - */ - _maxUpdateCount: 100 -}; - -/* */ -/* globals MutationObserver */ - -// can we use __proto__? -var hasProto = '__proto__' in {}; - -// Browser environment sniffing -var inBrowser = typeof window !== 'undefined'; -var UA = inBrowser && window.navigator.userAgent.toLowerCase(); -var isIE = UA && /msie|trident/.test(UA); -var isIE9 = UA && UA.indexOf('msie 9.0') > 0; -var isEdge = UA && UA.indexOf('edge/') > 0; -var isAndroid = UA && UA.indexOf('android') > 0; -var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA); -var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; - -// this needs to be lazy-evaled because vue may be required before -// vue-server-renderer can set VUE_ENV -var _isServer; -var isServerRendering = function () { - if (_isServer === undefined) { - /* istanbul ignore if */ - if (!inBrowser && typeof global !== 'undefined') { - // detect presence of vue-server-renderer and avoid - // Webpack shimming the process - _isServer = global['process'].env.VUE_ENV === 'server'; - } else { - _isServer = false; - } - } - return _isServer -}; - -// detect devtools -var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__; - -/* istanbul ignore next */ -function isNative (Ctor) { - return /native code/.test(Ctor.toString()) -} - -var hasSymbol = - typeof Symbol !== 'undefined' && isNative(Symbol) && - typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys); - -/** - * Defer a task to execute it asynchronously. - */ -var nextTick = (function () { - var callbacks = []; - var pending = false; - var timerFunc; - - function nextTickHandler () { - pending = false; - var copies = callbacks.slice(0); - callbacks.length = 0; - for (var i = 0; i < copies.length; i++) { - copies[i](); - } - } - - // the nextTick behavior leverages the microtask queue, which can be accessed - // via either native Promise.then or MutationObserver. - // MutationObserver has wider support, however it is seriously bugged in - // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It - // completely stops working after triggering a few times... so, if native - // Promise is available, we will use it: - /* istanbul ignore if */ - if (typeof Promise !== 'undefined' && isNative(Promise)) { - var p = Promise.resolve(); - var logError = function (err) { console.error(err); }; - timerFunc = function () { - p.then(nextTickHandler).catch(logError); - // in problematic UIWebViews, Promise.then doesn't completely break, but - // it can get stuck in a weird state where callbacks are pushed into the - // microtask queue but the queue isn't being flushed, until the browser - // needs to do some other work, e.g. handle a timer. Therefore we can - // "force" the microtask queue to be flushed by adding an empty timer. - if (isIOS) { setTimeout(noop); } - }; - } else if (typeof MutationObserver !== 'undefined' && ( - isNative(MutationObserver) || - // PhantomJS and iOS 7.x - MutationObserver.toString() === '[object MutationObserverConstructor]' - )) { - // use MutationObserver where native Promise is not available, - // e.g. PhantomJS IE11, iOS7, Android 4.4 - var counter = 1; - var observer = new MutationObserver(nextTickHandler); - var textNode = document.createTextNode(String(counter)); - observer.observe(textNode, { - characterData: true - }); - timerFunc = function () { - counter = (counter + 1) % 2; - textNode.data = String(counter); - }; - } else { - // fallback to setTimeout - /* istanbul ignore next */ - timerFunc = function () { - setTimeout(nextTickHandler, 0); - }; - } - - return function queueNextTick (cb, ctx) { - var _resolve; - callbacks.push(function () { - if (cb) { cb.call(ctx); } - if (_resolve) { _resolve(ctx); } - }); - if (!pending) { - pending = true; - timerFunc(); - } - if (!cb && typeof Promise !== 'undefined') { - return new Promise(function (resolve) { - _resolve = resolve; - }) - } - } -})(); - -var _Set; -/* istanbul ignore if */ -if (typeof Set !== 'undefined' && isNative(Set)) { - // use native Set when available. - _Set = Set; -} else { - // a non-standard Set polyfill that only works with primitive keys. - _Set = (function () { - function Set () { - this.set = Object.create(null); - } - Set.prototype.has = function has (key) { - return this.set[key] === true - }; - Set.prototype.add = function add (key) { - this.set[key] = true; - }; - Set.prototype.clear = function clear () { - this.set = Object.create(null); - }; - - return Set; - }()); -} - -var perf; - -{ - perf = inBrowser && window.performance; - if (perf && (!perf.mark || !perf.measure)) { - perf = undefined; - } -} - -/* */ - -var emptyObject = Object.freeze({}); - -/** - * Check if a string starts with $ or _ - */ -function isReserved (str) { - var c = (str + '').charCodeAt(0); - return c === 0x24 || c === 0x5F -} - -/** - * Define a property. - */ -function def (obj, key, val, enumerable) { - Object.defineProperty(obj, key, { - value: val, - enumerable: !!enumerable, - writable: true, - configurable: true - }); -} - -/** - * Parse simple path. - */ -var bailRE = /[^\w.$]/; -function parsePath (path) { - if (bailRE.test(path)) { - return - } else { - var segments = path.split('.'); - return function (obj) { - for (var i = 0; i < segments.length; i++) { - if (!obj) { return } - obj = obj[segments[i]]; - } - return obj - } - } -} - -var warn = noop; -var tip = noop; -var formatComponentName; - -{ - var hasConsole = typeof console !== 'undefined'; - var classifyRE = /(?:^|[-_])(\w)/g; - var classify = function (str) { return str - .replace(classifyRE, function (c) { return c.toUpperCase(); }) - .replace(/[-_]/g, ''); }; - - warn = function (msg, vm) { - if (hasConsole && (!config.silent)) { - console.error("[Vue warn]: " + msg + " " + ( - vm ? formatLocation(formatComponentName(vm)) : '' - )); - } - }; - - tip = function (msg, vm) { - if (hasConsole && (!config.silent)) { - console.warn("[Vue tip]: " + msg + " " + ( - vm ? formatLocation(formatComponentName(vm)) : '' - )); - } - }; - - formatComponentName = function (vm, includeFile) { - if (vm.$root === vm) { - return '' - } - var name = vm._isVue - ? vm.$options.name || vm.$options._componentTag - : vm.name; - - var file = vm._isVue && vm.$options.__file; - if (!name && file) { - var match = file.match(/([^/\\]+)\.vue$/); - name = match && match[1]; - } - - return ( - (name ? ("<" + (classify(name)) + ">") : "") + - (file && includeFile !== false ? (" at " + file) : '') - ) - }; - - var formatLocation = function (str) { - if (str === "") { - str += " - use the \"name\" option for better debugging messages."; - } - return ("\n(found in " + str + ")") - }; -} - -/* */ - - -var uid$1 = 0; - -/** - * A dep is an observable that can have multiple - * directives subscribing to it. - */ -var Dep = function Dep () { - this.id = uid$1++; - this.subs = []; -}; - -Dep.prototype.addSub = function addSub (sub) { - this.subs.push(sub); -}; - -Dep.prototype.removeSub = function removeSub (sub) { - remove(this.subs, sub); -}; - -Dep.prototype.depend = function depend () { - if (Dep.target) { - Dep.target.addDep(this); - } -}; - -Dep.prototype.notify = function notify () { - // stablize the subscriber list first - var subs = this.subs.slice(); - for (var i = 0, l = subs.length; i < l; i++) { - subs[i].update(); - } -}; - -// the current target watcher being evaluated. -// this is globally unique because there could be only one -// watcher being evaluated at any time. -Dep.target = null; -var targetStack = []; - -function pushTarget (_target) { - if (Dep.target) { targetStack.push(Dep.target); } - Dep.target = _target; -} - -function popTarget () { - Dep.target = targetStack.pop(); -} - -/* - * not type checking this file because flow doesn't play well with - * dynamically accessing methods on Array prototype - */ - -var arrayProto = Array.prototype; -var arrayMethods = Object.create(arrayProto);[ - 'push', - 'pop', - 'shift', - 'unshift', - 'splice', - 'sort', - 'reverse' -] -.forEach(function (method) { - // cache original method - var original = arrayProto[method]; - def(arrayMethods, method, function mutator () { - var arguments$1 = arguments; - - // avoid leaking arguments: - // http://jsperf.com/closure-with-arguments - var i = arguments.length; - var args = new Array(i); - while (i--) { - args[i] = arguments$1[i]; - } - var result = original.apply(this, args); - var ob = this.__ob__; - var inserted; - switch (method) { - case 'push': - inserted = args; - break - case 'unshift': - inserted = args; - break - case 'splice': - inserted = args.slice(2); - break - } - if (inserted) { ob.observeArray(inserted); } - // notify change - ob.dep.notify(); - return result - }); -}); - -/* */ - -var arrayKeys = Object.getOwnPropertyNames(arrayMethods); - -/** - * By default, when a reactive property is set, the new value is - * also converted to become reactive. However when passing down props, - * we don't want to force conversion because the value may be a nested value - * under a frozen data structure. Converting it would defeat the optimization. - */ -var observerState = { - shouldConvert: true, - isSettingProps: false -}; - -/** - * Observer class that are attached to each observed - * object. Once attached, the observer converts target - * object's property keys into getter/setters that - * collect dependencies and dispatches updates. - */ -var Observer = function Observer (value) { - this.value = value; - this.dep = new Dep(); - this.vmCount = 0; - def(value, '__ob__', this); - if (Array.isArray(value)) { - var augment = hasProto - ? protoAugment - : copyAugment; - augment(value, arrayMethods, arrayKeys); - this.observeArray(value); - } else { - this.walk(value); - } -}; - -/** - * Walk through each property and convert them into - * getter/setters. This method should only be called when - * value type is Object. - */ -Observer.prototype.walk = function walk (obj) { - var keys = Object.keys(obj); - for (var i = 0; i < keys.length; i++) { - defineReactive$$1(obj, keys[i], obj[keys[i]]); - } -}; - -/** - * Observe a list of Array items. - */ -Observer.prototype.observeArray = function observeArray (items) { - for (var i = 0, l = items.length; i < l; i++) { - observe(items[i]); - } -}; - -// helpers - -/** - * Augment an target Object or Array by intercepting - * the prototype chain using __proto__ - */ -function protoAugment (target, src) { - /* eslint-disable no-proto */ - target.__proto__ = src; - /* eslint-enable no-proto */ -} - -/** - * Augment an target Object or Array by defining - * hidden properties. - */ -/* istanbul ignore next */ -function copyAugment (target, src, keys) { - for (var i = 0, l = keys.length; i < l; i++) { - var key = keys[i]; - def(target, key, src[key]); - } -} - -/** - * Attempt to create an observer instance for a value, - * returns the new observer if successfully observed, - * or the existing observer if the value already has one. - */ -function observe (value, asRootData) { - if (!isObject(value)) { - return - } - var ob; - if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { - ob = value.__ob__; - } else if ( - observerState.shouldConvert && - !isServerRendering() && - (Array.isArray(value) || isPlainObject(value)) && - Object.isExtensible(value) && - !value._isVue - ) { - ob = new Observer(value); - } - if (asRootData && ob) { - ob.vmCount++; - } - return ob -} - -/** - * Define a reactive property on an Object. - */ -function defineReactive$$1 ( - obj, - key, - val, - customSetter -) { - var dep = new Dep(); - - var property = Object.getOwnPropertyDescriptor(obj, key); - if (property && property.configurable === false) { - return - } - - // cater for pre-defined getter/setters - var getter = property && property.get; - var setter = property && property.set; - - var childOb = observe(val); - Object.defineProperty(obj, key, { - enumerable: true, - configurable: true, - get: function reactiveGetter () { - var value = getter ? getter.call(obj) : val; - if (Dep.target) { - dep.depend(); - if (childOb) { - childOb.dep.depend(); - } - if (Array.isArray(value)) { - dependArray(value); - } - } - return value - }, - set: function reactiveSetter (newVal) { - var value = getter ? getter.call(obj) : val; - /* eslint-disable no-self-compare */ - if (newVal === value || (newVal !== newVal && value !== value)) { - return - } - /* eslint-enable no-self-compare */ - if ("development" !== 'production' && customSetter) { - customSetter(); - } - if (setter) { - setter.call(obj, newVal); - } else { - val = newVal; - } - childOb = observe(newVal); - dep.notify(); - } - }); -} - -/** - * Set a property on an object. Adds the new property and - * triggers change notification if the property doesn't - * already exist. - */ -function set (obj, key, val) { - if (Array.isArray(obj)) { - obj.length = Math.max(obj.length, key); - obj.splice(key, 1, val); - return val - } - if (hasOwn(obj, key)) { - obj[key] = val; - return - } - var ob = obj.__ob__; - if (obj._isVue || (ob && ob.vmCount)) { - "development" !== 'production' && warn( - 'Avoid adding reactive properties to a Vue instance or its root $data ' + - 'at runtime - declare it upfront in the data option.' - ); - return - } - if (!ob) { - obj[key] = val; - return - } - defineReactive$$1(ob.value, key, val); - ob.dep.notify(); - return val -} - -/** - * Delete a property and trigger change if necessary. - */ -function del (obj, key) { - if (Array.isArray(obj)) { - obj.splice(key, 1); - return - } - var ob = obj.__ob__; - if (obj._isVue || (ob && ob.vmCount)) { - "development" !== 'production' && warn( - 'Avoid deleting properties on a Vue instance or its root $data ' + - '- just set it to null.' - ); - return - } - if (!hasOwn(obj, key)) { - return - } - delete obj[key]; - if (!ob) { - return - } - ob.dep.notify(); -} - -/** - * Collect dependencies on array elements when the array is touched, since - * we cannot intercept array element access like property getters. - */ -function dependArray (value) { - for (var e = (void 0), i = 0, l = value.length; i < l; i++) { - e = value[i]; - e && e.__ob__ && e.__ob__.dep.depend(); - if (Array.isArray(e)) { - dependArray(e); - } - } -} - -/* */ - -/** - * Option overwriting strategies are functions that handle - * how to merge a parent option value and a child option - * value into the final value. - */ -var strats = config.optionMergeStrategies; - -/** - * Options with restrictions - */ -{ - strats.el = strats.propsData = function (parent, child, vm, key) { - if (!vm) { - warn( - "option \"" + key + "\" can only be used during instance " + - 'creation with the `new` keyword.' - ); - } - return defaultStrat(parent, child) - }; -} - -/** - * Helper that recursively merges two data objects together. - */ -function mergeData (to, from) { - if (!from) { return to } - var key, toVal, fromVal; - var keys = Object.keys(from); - for (var i = 0; i < keys.length; i++) { - key = keys[i]; - toVal = to[key]; - fromVal = from[key]; - if (!hasOwn(to, key)) { - set(to, key, fromVal); - } else if (isPlainObject(toVal) && isPlainObject(fromVal)) { - mergeData(toVal, fromVal); - } - } - return to -} - -/** - * Data - */ -strats.data = function ( - parentVal, - childVal, - vm -) { - if (!vm) { - // in a Vue.extend merge, both should be functions - if (!childVal) { - return parentVal - } - if (typeof childVal !== 'function') { - "development" !== 'production' && warn( - 'The "data" option should be a function ' + - 'that returns a per-instance value in component ' + - 'definitions.', - vm - ); - return parentVal - } - if (!parentVal) { - return childVal - } - // when parentVal & childVal are both present, - // we need to return a function that returns the - // merged result of both functions... no need to - // check if parentVal is a function here because - // it has to be a function to pass previous merges. - return function mergedDataFn () { - return mergeData( - childVal.call(this), - parentVal.call(this) - ) - } - } else if (parentVal || childVal) { - return function mergedInstanceDataFn () { - // instance merge - var instanceData = typeof childVal === 'function' - ? childVal.call(vm) - : childVal; - var defaultData = typeof parentVal === 'function' - ? parentVal.call(vm) - : undefined; - if (instanceData) { - return mergeData(instanceData, defaultData) - } else { - return defaultData - } - } - } -}; - -/** - * Hooks and props are merged as arrays. - */ -function mergeHook ( - parentVal, - childVal -) { - return childVal - ? parentVal - ? parentVal.concat(childVal) - : Array.isArray(childVal) - ? childVal - : [childVal] - : parentVal -} - -config._lifecycleHooks.forEach(function (hook) { - strats[hook] = mergeHook; -}); - -/** - * Assets - * - * When a vm is present (instance creation), we need to do - * a three-way merge between constructor options, instance - * options and parent options. - */ -function mergeAssets (parentVal, childVal) { - var res = Object.create(parentVal || null); - return childVal - ? extend(res, childVal) - : res -} - -config._assetTypes.forEach(function (type) { - strats[type + 's'] = mergeAssets; -}); - -/** - * Watchers. - * - * Watchers hashes should not overwrite one - * another, so we merge them as arrays. - */ -strats.watch = function (parentVal, childVal) { - /* istanbul ignore if */ - if (!childVal) { return Object.create(parentVal || null) } - if (!parentVal) { return childVal } - var ret = {}; - extend(ret, parentVal); - for (var key in childVal) { - var parent = ret[key]; - var child = childVal[key]; - if (parent && !Array.isArray(parent)) { - parent = [parent]; - } - ret[key] = parent - ? parent.concat(child) - : [child]; - } - return ret -}; - -/** - * Other object hashes. - */ -strats.props = -strats.methods = -strats.computed = function (parentVal, childVal) { - if (!childVal) { return Object.create(parentVal || null) } - if (!parentVal) { return childVal } - var ret = Object.create(null); - extend(ret, parentVal); - extend(ret, childVal); - return ret -}; - -/** - * Default strategy. - */ -var defaultStrat = function (parentVal, childVal) { - return childVal === undefined - ? parentVal - : childVal -}; - -/** - * Validate component names - */ -function checkComponents (options) { - for (var key in options.components) { - var lower = key.toLowerCase(); - if (isBuiltInTag(lower) || config.isReservedTag(lower)) { - warn( - 'Do not use built-in or reserved HTML elements as component ' + - 'id: ' + key - ); - } - } -} - -/** - * Ensure all props option syntax are normalized into the - * Object-based format. - */ -function normalizeProps (options) { - var props = options.props; - if (!props) { return } - var res = {}; - var i, val, name; - if (Array.isArray(props)) { - i = props.length; - while (i--) { - val = props[i]; - if (typeof val === 'string') { - name = camelize(val); - res[name] = { type: null }; - } else { - warn('props must be strings when using array syntax.'); - } - } - } else if (isPlainObject(props)) { - for (var key in props) { - val = props[key]; - name = camelize(key); - res[name] = isPlainObject(val) - ? val - : { type: val }; - } - } - options.props = res; -} - -/** - * Normalize raw function directives into object format. - */ -function normalizeDirectives (options) { - var dirs = options.directives; - if (dirs) { - for (var key in dirs) { - var def = dirs[key]; - if (typeof def === 'function') { - dirs[key] = { bind: def, update: def }; - } - } - } -} - -/** - * Merge two option objects into a new one. - * Core utility used in both instantiation and inheritance. - */ -function mergeOptions ( - parent, - child, - vm -) { - { - checkComponents(child); - } - normalizeProps(child); - normalizeDirectives(child); - var extendsFrom = child.extends; - if (extendsFrom) { - parent = typeof extendsFrom === 'function' - ? mergeOptions(parent, extendsFrom.options, vm) - : mergeOptions(parent, extendsFrom, vm); - } - if (child.mixins) { - for (var i = 0, l = child.mixins.length; i < l; i++) { - var mixin = child.mixins[i]; - if (mixin.prototype instanceof Vue$3) { - mixin = mixin.options; - } - parent = mergeOptions(parent, mixin, vm); - } - } - var options = {}; - var key; - for (key in parent) { - mergeField(key); - } - for (key in child) { - if (!hasOwn(parent, key)) { - mergeField(key); - } - } - function mergeField (key) { - var strat = strats[key] || defaultStrat; - options[key] = strat(parent[key], child[key], vm, key); - } - return options -} - -/** - * Resolve an asset. - * This function is used because child instances need access - * to assets defined in its ancestor chain. - */ -function resolveAsset ( - options, - type, - id, - warnMissing -) { - /* istanbul ignore if */ - if (typeof id !== 'string') { - return - } - var assets = options[type]; - // check local registration variations first - if (hasOwn(assets, id)) { return assets[id] } - var camelizedId = camelize(id); - if (hasOwn(assets, camelizedId)) { return assets[camelizedId] } - var PascalCaseId = capitalize(camelizedId); - if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] } - // fallback to prototype chain - var res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; - if ("development" !== 'production' && warnMissing && !res) { - warn( - 'Failed to resolve ' + type.slice(0, -1) + ': ' + id, - options - ); - } - return res -} - -/* */ - -function validateProp ( - key, - propOptions, - propsData, - vm -) { - var prop = propOptions[key]; - var absent = !hasOwn(propsData, key); - var value = propsData[key]; - // handle boolean props - if (isType(Boolean, prop.type)) { - if (absent && !hasOwn(prop, 'default')) { - value = false; - } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) { - value = true; - } - } - // check default value - if (value === undefined) { - value = getPropDefaultValue(vm, prop, key); - // since the default value is a fresh copy, - // make sure to observe it. - var prevShouldConvert = observerState.shouldConvert; - observerState.shouldConvert = true; - observe(value); - observerState.shouldConvert = prevShouldConvert; - } - { - assertProp(prop, key, value, vm, absent); - } - return value -} - -/** - * Get the default value of a prop. - */ -function getPropDefaultValue (vm, prop, key) { - // no default, return undefined - if (!hasOwn(prop, 'default')) { - return undefined - } - var def = prop.default; - // warn against non-factory defaults for Object & Array - if ("development" !== 'production' && isObject(def)) { - warn( - 'Invalid default value for prop "' + key + '": ' + - 'Props with type Object/Array must use a factory function ' + - 'to return the default value.', - vm - ); - } - // the raw prop value was also undefined from previous render, - // return previous default value to avoid unnecessary watcher trigger - if (vm && vm.$options.propsData && - vm.$options.propsData[key] === undefined && - vm._props[key] !== undefined) { - return vm._props[key] - } - // call factory function for non-Function types - // a value is Function if its prototype is function even across different execution context - return typeof def === 'function' && getType(prop.type) !== 'Function' - ? def.call(vm) - : def -} - -/** - * Assert whether a prop is valid. - */ -function assertProp ( - prop, - name, - value, - vm, - absent -) { - if (prop.required && absent) { - warn( - 'Missing required prop: "' + name + '"', - vm - ); - return - } - if (value == null && !prop.required) { - return - } - var type = prop.type; - var valid = !type || type === true; - var expectedTypes = []; - if (type) { - if (!Array.isArray(type)) { - type = [type]; - } - for (var i = 0; i < type.length && !valid; i++) { - var assertedType = assertType(value, type[i]); - expectedTypes.push(assertedType.expectedType || ''); - valid = assertedType.valid; - } - } - if (!valid) { - warn( - 'Invalid prop: type check failed for prop "' + name + '".' + - ' Expected ' + expectedTypes.map(capitalize).join(', ') + - ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.', - vm - ); - return - } - var validator = prop.validator; - if (validator) { - if (!validator(value)) { - warn( - 'Invalid prop: custom validator check failed for prop "' + name + '".', - vm - ); - } - } -} - -/** - * Assert the type of a value - */ -function assertType (value, type) { - var valid; - var expectedType = getType(type); - if (expectedType === 'String') { - valid = typeof value === (expectedType = 'string'); - } else if (expectedType === 'Number') { - valid = typeof value === (expectedType = 'number'); - } else if (expectedType === 'Boolean') { - valid = typeof value === (expectedType = 'boolean'); - } else if (expectedType === 'Function') { - valid = typeof value === (expectedType = 'function'); - } else if (expectedType === 'Object') { - valid = isPlainObject(value); - } else if (expectedType === 'Array') { - valid = Array.isArray(value); - } else { - valid = value instanceof type; - } - return { - valid: valid, - expectedType: expectedType - } -} - -/** - * Use function string name to check built-in types, - * because a simple equality check will fail when running - * across different vms / iframes. - */ -function getType (fn) { - var match = fn && fn.toString().match(/^\s*function (\w+)/); - return match && match[1] -} - -function isType (type, fn) { - if (!Array.isArray(fn)) { - return getType(fn) === getType(type) - } - for (var i = 0, len = fn.length; i < len; i++) { - if (getType(fn[i]) === getType(type)) { - return true - } - } - /* istanbul ignore next */ - return false -} - -function handleError (err, vm, type) { - if (config.errorHandler) { - config.errorHandler.call(null, err, vm, type); - } else { - { - warn(("Error in " + type + ":"), vm); - } - /* istanbul ignore else */ - if (inBrowser && typeof console !== 'undefined') { - console.error(err); - } else { - throw err - } - } -} - -/* not type checking this file because flow doesn't play well with Proxy */ - -var initProxy; - -{ - var allowedGlobals = makeMap( - 'Infinity,undefined,NaN,isFinite,isNaN,' + - 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + - 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' + - 'require' // for Webpack/Browserify - ); - - var warnNonPresent = function (target, key) { - warn( - "Property or method \"" + key + "\" is not defined on the instance but " + - "referenced during render. Make sure to declare reactive data " + - "properties in the data option.", - target - ); - }; - - var hasProxy = - typeof Proxy !== 'undefined' && - Proxy.toString().match(/native code/); - - if (hasProxy) { - var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta'); - config.keyCodes = new Proxy(config.keyCodes, { - set: function set (target, key, value) { - if (isBuiltInModifier(key)) { - warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key)); - return false - } else { - target[key] = value; - return true - } - } - }); - } - - var hasHandler = { - has: function has (target, key) { - var has = key in target; - var isAllowed = allowedGlobals(key) || key.charAt(0) === '_'; - if (!has && !isAllowed) { - warnNonPresent(target, key); - } - return has || !isAllowed - } - }; - - var getHandler = { - get: function get (target, key) { - if (typeof key === 'string' && !(key in target)) { - warnNonPresent(target, key); - } - return target[key] - } - }; - - initProxy = function initProxy (vm) { - if (hasProxy) { - // determine which proxy handler to use - var options = vm.$options; - var handlers = options.render && options.render._withStripped - ? getHandler - : hasHandler; - vm._renderProxy = new Proxy(vm, handlers); - } else { - vm._renderProxy = vm; - } - }; -} - -/* */ - -var VNode = function VNode ( - tag, - data, - children, - text, - elm, - context, - componentOptions -) { - this.tag = tag; - this.data = data; - this.children = children; - this.text = text; - this.elm = elm; - this.ns = undefined; - this.context = context; - this.functionalContext = undefined; - this.key = data && data.key; - this.componentOptions = componentOptions; - this.componentInstance = undefined; - this.parent = undefined; - this.raw = false; - this.isStatic = false; - this.isRootInsert = true; - this.isComment = false; - this.isCloned = false; - this.isOnce = false; -}; - -var prototypeAccessors = { child: {} }; - -// DEPRECATED: alias for componentInstance for backwards compat. -/* istanbul ignore next */ -prototypeAccessors.child.get = function () { - return this.componentInstance -}; - -Object.defineProperties( VNode.prototype, prototypeAccessors ); - -var createEmptyVNode = function () { - var node = new VNode(); - node.text = ''; - node.isComment = true; - return node -}; - -function createTextVNode (val) { - return new VNode(undefined, undefined, undefined, String(val)) -} - -// optimized shallow clone -// used for static nodes and slot nodes because they may be reused across -// multiple renders, cloning them avoids errors when DOM manipulations rely -// on their elm reference. -function cloneVNode (vnode) { - var cloned = new VNode( - vnode.tag, - vnode.data, - vnode.children, - vnode.text, - vnode.elm, - vnode.context, - vnode.componentOptions - ); - cloned.ns = vnode.ns; - cloned.isStatic = vnode.isStatic; - cloned.key = vnode.key; - cloned.isCloned = true; - return cloned -} - -function cloneVNodes (vnodes) { - var res = new Array(vnodes.length); - for (var i = 0; i < vnodes.length; i++) { - res[i] = cloneVNode(vnodes[i]); - } - return res -} - -/* */ - -var normalizeEvent = cached(function (name) { - var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first - name = once$$1 ? name.slice(1) : name; - var capture = name.charAt(0) === '!'; - name = capture ? name.slice(1) : name; - return { - name: name, - once: once$$1, - capture: capture - } -}); - -function createFnInvoker (fns) { - function invoker () { - var arguments$1 = arguments; - - var fns = invoker.fns; - if (Array.isArray(fns)) { - for (var i = 0; i < fns.length; i++) { - fns[i].apply(null, arguments$1); - } - } else { - // return handler return value for single handlers - return fns.apply(null, arguments) - } - } - invoker.fns = fns; - return invoker -} - -function updateListeners ( - on, - oldOn, - add, - remove$$1, - vm -) { - var name, cur, old, event; - for (name in on) { - cur = on[name]; - old = oldOn[name]; - event = normalizeEvent(name); - if (!cur) { - "development" !== 'production' && warn( - "Invalid handler for event \"" + (event.name) + "\": got " + String(cur), - vm - ); - } else if (!old) { - if (!cur.fns) { - cur = on[name] = createFnInvoker(cur); - } - add(event.name, cur, event.once, event.capture); - } else if (cur !== old) { - old.fns = cur; - on[name] = old; - } - } - for (name in oldOn) { - if (!on[name]) { - event = normalizeEvent(name); - remove$$1(event.name, oldOn[name], event.capture); - } - } -} - -/* */ - -function mergeVNodeHook (def, hookKey, hook) { - var invoker; - var oldHook = def[hookKey]; - - function wrappedHook () { - hook.apply(this, arguments); - // important: remove merged hook to ensure it's called only once - // and prevent memory leak - remove(invoker.fns, wrappedHook); - } - - if (!oldHook) { - // no existing hook - invoker = createFnInvoker([wrappedHook]); - } else { - /* istanbul ignore if */ - if (oldHook.fns && oldHook.merged) { - // already a merged invoker - invoker = oldHook; - invoker.fns.push(wrappedHook); - } else { - // existing plain hook - invoker = createFnInvoker([oldHook, wrappedHook]); - } - } - - invoker.merged = true; - def[hookKey] = invoker; -} - -/* */ - -// The template compiler attempts to minimize the need for normalization by -// statically analyzing the template at compile time. -// -// For plain HTML markup, normalization can be completely skipped because the -// generated render function is guaranteed to return Array. There are -// two cases where extra normalization is needed: - -// 1. When the children contains components - because a functional component -// may return an Array instead of a single root. In this case, just a simple -// normalization is needed - if any child is an Array, we flatten the whole -// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep -// because functional components already normalize their own children. -function simpleNormalizeChildren (children) { - for (var i = 0; i < children.length; i++) { - if (Array.isArray(children[i])) { - return Array.prototype.concat.apply([], children) - } - } - return children -} - -// 2. When the children contains constrcuts that always generated nested Arrays, -// e.g.