/******************************************************************************* Copyright (c) 2009, Perforce Software, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ /******************************************************************************* * Name : p4specdata.cpp * * Author : Tony Smith <tony@perforce.com> or <tony@smee.org> * * Description : Ruby bindings for the Perforce API. SpecData subclass for * P4Ruby. This class allows for manipulation of Spec data * stored in a Ruby hash using the standard Perforce classes * ******************************************************************************/ #include <ruby.h> #include "undefdups.h" #include <clientapi.h> #include <i18napi.h> #include <spec.h> #include "extconf.h" #include "debug.h" #include "p4rubydebug.h" #include "p4specdata.h" StrPtr * SpecDataRuby::GetLine( SpecElem *sd, int x, const char **cmt ) { *cmt = 0; VALUE val; VALUE key; StrBuf t; key = rb_str_new( sd->tag.Text(), sd->tag.Length() ); val = rb_hash_aref( hash, key ); if( val == Qnil ) return 0; if( !sd->IsList() ) { last = STR2CSTR( val ); return &last; } // It's a list, which means we should have an array value here if( !rb_obj_is_kind_of( val, rb_cArray ) ) { rb_warn( "%s should be an array element. Ignoring...", sd->tag.Text() ); return 0; } val = rb_ary_entry( val, x ); if( val == Qnil ) return 0; last = STR2CSTR( val ); return &last; } void SpecDataRuby::SetLine( SpecElem *sd, int x, const StrPtr *v, Error *e ) { VALUE key; VALUE val; VALUE ary; StrBuf t; key = rb_str_new( sd->tag.Text(), sd->tag.Length() ); val = rb_str_new( v->Text(), v->Length() ); if( sd->IsList() ) { ary = rb_hash_aref( hash, key ); if( ary == Qnil ) { ary = rb_ary_new(); rb_hash_aset( hash, key, ary ); } rb_ary_store( ary, x, val ); } else { rb_hash_aset( hash, key, val ); } return; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 14682 | Git Fusion |
Git Fusion branch management Imported from Git ghost-of-change-num: 960958 ghost-of-sha1: 005052ae424bd69f426f7209e741ca1c8c3253c7 ghost-precedes-sha1: ad052c71a568ef12165e143a6866ad9ceffbb4a1 parent-branch: None@960958 push-state: incomplete |
||
#3 | 14608 | jmistry |
Add encoding to Strings As part of adding Ruby 1.9 support we need to associate the encoding for Ruby's strings from the server. This approach is similar to Sven's (in changelist 257263), where everything but the 'content' charset was set to 'utf8'. The content charset is picked up from P4CHARSET and this is used to translate any file content. Also disabled the Ruby 1.9 warning for each compile. User visible change to be documented in release notes. |
||
#2 | 14592 | Sven Erik Knop |
Enable P4-Ruby to compile and test with Ruby 1.9. The current solution is far from ideal because it is not possible to compile and test both Ruby 1.8 and Ruby 1.9 in parallel. The Makefile writes both artifacts and binaries to the same location. This means a user/tester/builder needs to choose on Ruby platform or ensure 'make clean' is called first. Many of the test cases also still fail in Ruby 1.9. We also need to investigate the Unicode story with Ruby 1.9 and see if the lessons learned from Python 3 can be applied somehow. Infrastructure change, no functional change yet. |
||
#1 | 14545 | tony |
Add files omitted accidentally from 191623, and update release note to suit. |