| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | . syck . |
|---|
| 5 | |
|---|
| 6 | [ version 0.65 ] |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | INSTALLATION |
|---|
| 13 | |
|---|
| 14 | ./configure |
|---|
| 15 | make |
|---|
| 16 | make check |
|---|
| 17 | sudo make install |
|---|
| 18 | |
|---|
| 19 | If the unit tests don't pass, notify me immediately. This distribution |
|---|
| 20 | is tested on FreeBSD and Linux. I don't release it unless the tests |
|---|
| 21 | pass on those machines. If tests aren't passing, then that's a problem. |
|---|
| 22 | |
|---|
| 23 | ABOUT |
|---|
| 24 | |
|---|
| 25 | Syck is the Scripters' YAML Cobble-Yourself-a-Parser Kit. I don't |
|---|
| 26 | much care if the acronym works, as long as the library does! |
|---|
| 27 | |
|---|
| 28 | The whole point of Syck is to make parsing and emitting YAML very |
|---|
| 29 | simple for scripting languages through C bindings. It doesn't strive |
|---|
| 30 | to be a pull parser or very extendible. It just is concerned with |
|---|
| 31 | loading a YAML document into a C structure which can be easily |
|---|
| 32 | translated into a scripting language's internal native data type. |
|---|
| 33 | |
|---|
| 34 | RUBY INSTALLATION |
|---|
| 35 | |
|---|
| 36 | You don't need to `make install', but please configure and make libsyck |
|---|
| 37 | as outlined above. |
|---|
| 38 | |
|---|
| 39 | cd ext/ruby |
|---|
| 40 | ruby install.rb config |
|---|
| 41 | ruby install.rb setup |
|---|
| 42 | sudo ruby install.rb install |
|---|
| 43 | |
|---|
| 44 | Syck works best with Ruby. Ruby's symbol table is leveraged, as well |
|---|
| 45 | as Ruby's VALUE system. (You can read more about that below.) |
|---|
| 46 | |
|---|
| 47 | Syck is now included with Ruby (beginning with Ruby 1.8.0.) Please |
|---|
| 48 | voice your support for Syck/YAML in Ruby distributions on the various |
|---|
| 49 | platforms. |
|---|
| 50 | |
|---|
| 51 | PYTHON INSTALLATION |
|---|
| 52 | |
|---|
| 53 | You'll need to `make install' as described above. |
|---|
| 54 | |
|---|
| 55 | cd ext/python/ |
|---|
| 56 | python setup.py build |
|---|
| 57 | sudo python setup.py install |
|---|
| 58 | |
|---|
| 59 | PHP INSTALLATION |
|---|
| 60 | |
|---|
| 61 | You'll need to `make install' as described above. |
|---|
| 62 | |
|---|
| 63 | ln -s lib include # or cp -r lib include |
|---|
| 64 | cd ext/php/ |
|---|
| 65 | phpize |
|---|
| 66 | ./configure --with-syck=../.. |
|---|
| 67 | make |
|---|
| 68 | sudo make install |
|---|
| 69 | |
|---|
| 70 | HOW SYCK IS SO GREAT |
|---|
| 71 | |
|---|
| 72 | For example, in Ruby everything evaluates to a VALUE. I merely |
|---|
| 73 | supply a handler to Syck that will take a SyckNode and transform |
|---|
| 74 | it into a Ruby VALUE. |
|---|
| 75 | |
|---|
| 76 | A simple Ruby YAML::load could be built like so: |
|---|
| 77 | |
|---|
| 78 | static VALUE |
|---|
| 79 | YAML_load( VALUE str ) |
|---|
| 80 | { |
|---|
| 81 | SyckParser* parser; |
|---|
| 82 | parser = syck_new_parser(); |
|---|
| 83 | syck_parser_handler( parser, YAML_handler ); |
|---|
| 84 | return syck_parse( parser, str ); |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | static VALUE |
|---|
| 88 | YAML_handler( SyckNode* node ) |
|---|
| 89 | { |
|---|
| 90 | switch( node->kind ) |
|---|
| 91 | { |
|---|
| 92 | case SYCK_MAP: |
|---|
| 93 | VALUE key; |
|---|
| 94 | VALUE h = rb_hash_new(); |
|---|
| 95 | for ( key = node->content[0]; key != null; key++ ) |
|---|
| 96 | { |
|---|
| 97 | rb_hash_set( h, key, key++ ); |
|---|
| 98 | } |
|---|
| 99 | return h; |
|---|
| 100 | break; |
|---|
| 101 | } |
|---|
| 102 | } |
|---|
| 103 | |
|---|
| 104 | For most C developers, it should be a no-brainer to bring |
|---|
| 105 | basic YAML serialization to PHP, Tcl, Cocoa, etc. |
|---|
| 106 | |
|---|
| 107 | Instructions for using Syck's API are available in the |
|---|
| 108 | README.EXT in this very same directory. |
|---|