cybrid_api_id_ruby 0.123.11 → 0.123.46
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -3
- data/README.md +5 -5
- data/cybrid_api_id_ruby.gemspec +1 -1
- data/docs/UserIdpModel.md +2 -0
- data/lib/cybrid_api_id_ruby/api/bank_applications_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api/customer_tokens_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api/organization_applications_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api/users_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api_client.rb +1 -1
- data/lib/cybrid_api_id_ruby/api_error.rb +1 -1
- data/lib/cybrid_api_id_ruby/configuration.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_list_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_with_secret_all_of_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_with_secret_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/customer_token_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/error_response_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_bank_application_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_customer_token_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_organization_application_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_user_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/user_idp_model.rb +37 -2
- data/lib/cybrid_api_id_ruby/models/user_list_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/version.rb +2 -2
- data/lib/cybrid_api_id_ruby.rb +1 -1
- data/spec/api/bank_applications_idp_api_spec.rb +1 -1
- data/spec/api/customer_tokens_idp_api_spec.rb +1 -1
- data/spec/api/organization_applications_idp_api_spec.rb +1 -1
- data/spec/api/users_idp_api_spec.rb +1 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/application_idp_model_spec.rb +1 -1
- data/spec/models/application_list_idp_model_spec.rb +1 -1
- data/spec/models/application_with_secret_all_of_idp_model_spec.rb +1 -1
- data/spec/models/application_with_secret_idp_model_spec.rb +1 -1
- data/spec/models/customer_token_idp_model_spec.rb +1 -1
- data/spec/models/error_response_idp_model_spec.rb +1 -1
- data/spec/models/post_bank_application_idp_model_spec.rb +1 -1
- data/spec/models/post_customer_token_idp_model_spec.rb +1 -1
- data/spec/models/post_organization_application_idp_model_spec.rb +1 -1
- data/spec/models/post_user_idp_model_spec.rb +1 -1
- data/spec/models/user_idp_model_spec.rb +11 -1
- data/spec/models/user_list_idp_model_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/vendor/bundle/ruby/3.3.0/cache/date-3.4.1.gem +0 -0
- data/vendor/bundle/ruby/3.3.0/cache/psych-5.2.1.gem +0 -0
- data/vendor/bundle/ruby/3.3.0/cache/rspec-support-3.13.2.gem +0 -0
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/byebug-11.1.3/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/date-3.4.1/date_core.so +0 -0
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/date-3.4.1/gem_make.out +32 -0
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/date-3.4.1/mkmf.log +93 -0
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/jaro_winkler-1.5.6/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/psych-5.2.1/gem.build_complete +0 -0
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/{psych-5.2.0 → psych-5.2.1}/gem_make.out +18 -18
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/{psych-5.2.0 → psych-5.2.1}/psych.so +0 -0
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/racc-1.8.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/stringio-3.1.2/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/README.md +102 -0
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/ext/date/Makefile +269 -0
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/ext/date/date_core.c +10064 -0
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/ext/date/date_parse.c +3086 -0
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/ext/date/date_strftime.c +638 -0
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/ext/date/date_strptime.c +703 -0
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/ext/date/date_tmx.h +56 -0
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/ext/date/extconf.rb +13 -0
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/ext/date/prereq.mk +19 -0
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/ext/date/zonetab.h +1564 -0
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/ext/date/zonetab.list +330 -0
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/lib/date.rb +70 -0
- data/vendor/bundle/ruby/3.3.0/gems/date-3.4.1/lib/date_core.so +0 -0
- data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/scalar_scanner.rb +0 -2
- data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/versions.rb +1 -1
- data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/visitors/to_ruby.rb +0 -1
- data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych.rb +2 -0
- data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych.so +0 -0
- data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/Changelog.md +14 -3
- data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/spec/shell_out.rb +3 -0
- data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/version.rb +1 -1
- data/vendor/bundle/ruby/3.3.0/specifications/date-3.4.1.gemspec +25 -0
- data/vendor/bundle/ruby/3.3.0/specifications/{psych-5.2.0.gemspec → psych-5.2.1.gemspec} +4 -3
- data/vendor/bundle/ruby/3.3.0/specifications/{rspec-support-3.13.1.gemspec → rspec-support-3.13.2.gemspec} +7 -7
- metadata +119 -100
- data/vendor/bundle/ruby/3.3.0/cache/psych-5.2.0.gem +0 -0
- data/vendor/bundle/ruby/3.3.0/cache/rspec-support-3.13.1.gem +0 -0
- /data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/{psych-5.2.0 → date-3.4.1}/gem.build_complete +0 -0
- /data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/{psych-5.2.0 → psych-5.2.1}/mkmf.log +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/CONTRIBUTING.md +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/LICENSE +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/README.md +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/Makefile +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/depend +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/extconf.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/psych.c +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/psych.h +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/psych_emitter.c +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/psych_emitter.h +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/psych_parser.c +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/psych_parser.h +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/psych_to_ruby.c +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/psych_to_ruby.h +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/psych_yaml_tree.c +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/ext/psych/psych_yaml_tree.h +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/class_loader.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/coder.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/core_ext.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/exception.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/handler.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/handlers/document_stream.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/handlers/recorder.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/json/ruby_events.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/json/stream.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/json/tree_builder.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/json/yaml_events.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/nodes/alias.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/nodes/document.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/nodes/mapping.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/nodes/node.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/nodes/scalar.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/nodes/sequence.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/nodes/stream.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/nodes.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/omap.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/parser.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/set.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/stream.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/streaming.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/syntax_error.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/tree_builder.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/visitors/depth_first.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/visitors/emitter.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/visitors/json_tree.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/visitors/visitor.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/visitors/yaml_tree.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/visitors.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.2.0 → psych-5.2.1}/lib/psych/y.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/LICENSE.md +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/README.md +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/caller_filter.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/comparable_version.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/differ.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/directory_maker.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/encoded_string.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/fuzzy_matcher.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/hunk_generator.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/matcher_definition.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/method_signature_verifier.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/mutex.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/object_formatter.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/recursive_const_methods.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/reentrant_mutex.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/ruby_features.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/source/location.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/source/node.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/source/token.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/source.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/spec/deprecation_helpers.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/spec/diff_helpers.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/spec/formatting_support.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/spec/in_sub_process.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/spec/library_wide_checks.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/spec/stderr_splitter.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/spec/string_matcher.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/spec/with_isolated_directory.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/spec/with_isolated_stderr.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/spec.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/warnings.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support/with_keywords_when_needed.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{rspec-support-3.13.1 → rspec-support-3.13.2}/lib/rspec/support.rb +0 -0
@@ -0,0 +1,703 @@
|
|
1
|
+
/*
|
2
|
+
date_strptime.c: Coded by Tadayoshi Funaba 2011,2012
|
3
|
+
*/
|
4
|
+
|
5
|
+
#include "ruby.h"
|
6
|
+
#include "ruby/encoding.h"
|
7
|
+
#include "ruby/re.h"
|
8
|
+
#include <ctype.h>
|
9
|
+
|
10
|
+
#undef strncasecmp
|
11
|
+
#define strncasecmp STRNCASECMP
|
12
|
+
|
13
|
+
static const char *day_names[] = {
|
14
|
+
"Sunday", "Monday", "Tuesday", "Wednesday",
|
15
|
+
"Thursday", "Friday", "Saturday",
|
16
|
+
};
|
17
|
+
static const int ABBREVIATED_DAY_NAME_LENGTH = 3;
|
18
|
+
|
19
|
+
static const char *month_names[] = {
|
20
|
+
"January", "February", "March", "April",
|
21
|
+
"May", "June", "July", "August", "September",
|
22
|
+
"October", "November", "December",
|
23
|
+
};
|
24
|
+
static const int ABBREVIATED_MONTH_NAME_LENGTH = 3;
|
25
|
+
|
26
|
+
#define sizeof_array(o) (sizeof o / sizeof o[0])
|
27
|
+
|
28
|
+
#define f_negate(x) rb_funcall(x, rb_intern("-@"), 0)
|
29
|
+
#define f_add(x,y) rb_funcall(x, '+', 1, y)
|
30
|
+
#define f_sub(x,y) rb_funcall(x, '-', 1, y)
|
31
|
+
#define f_mul(x,y) rb_funcall(x, '*', 1, y)
|
32
|
+
#define f_div(x,y) rb_funcall(x, '/', 1, y)
|
33
|
+
#define f_idiv(x,y) rb_funcall(x, rb_intern("div"), 1, y)
|
34
|
+
#define f_mod(x,y) rb_funcall(x, '%', 1, y)
|
35
|
+
#define f_expt(x,y) rb_funcall(x, rb_intern("**"), 1, y)
|
36
|
+
|
37
|
+
#define f_lt_p(x,y) rb_funcall(x, '<', 1, y)
|
38
|
+
#define f_gt_p(x,y) rb_funcall(x, '>', 1, y)
|
39
|
+
#define f_le_p(x,y) rb_funcall(x, rb_intern("<="), 1, y)
|
40
|
+
#define f_ge_p(x,y) rb_funcall(x, rb_intern(">="), 1, y)
|
41
|
+
|
42
|
+
#define f_match(r,s) rb_funcall(r, rb_intern("match"), 1, s)
|
43
|
+
#define f_aref(o,i) rb_funcall(o, rb_intern("[]"), 1, i)
|
44
|
+
#define f_end(o,i) rb_funcall(o, rb_intern("end"), 1, i)
|
45
|
+
|
46
|
+
#define issign(c) ((c) == '-' || (c) == '+')
|
47
|
+
|
48
|
+
static int
|
49
|
+
num_pattern_p(const char *s)
|
50
|
+
{
|
51
|
+
if (isdigit((unsigned char)*s))
|
52
|
+
return 1;
|
53
|
+
if (*s == '%') {
|
54
|
+
s++;
|
55
|
+
if (*s == 'E' || *s == 'O')
|
56
|
+
s++;
|
57
|
+
if (*s &&
|
58
|
+
(strchr("CDdeFGgHIjkLlMmNQRrSsTUuVvWwXxYy", *s) ||
|
59
|
+
isdigit((unsigned char)*s)))
|
60
|
+
return 1;
|
61
|
+
}
|
62
|
+
return 0;
|
63
|
+
}
|
64
|
+
|
65
|
+
#define NUM_PATTERN_P() num_pattern_p(&fmt[fi + 1])
|
66
|
+
|
67
|
+
static long
|
68
|
+
read_digits(const char *s, size_t slen, VALUE *n, size_t width)
|
69
|
+
{
|
70
|
+
size_t l;
|
71
|
+
|
72
|
+
if (!width)
|
73
|
+
return 0;
|
74
|
+
|
75
|
+
l = 0;
|
76
|
+
while (l < slen && ISDIGIT(s[l])) {
|
77
|
+
if (++l == width) break;
|
78
|
+
}
|
79
|
+
|
80
|
+
if (l == 0)
|
81
|
+
return 0;
|
82
|
+
|
83
|
+
if ((4 * l * sizeof(char)) <= (sizeof(long)*CHAR_BIT)) {
|
84
|
+
const char *os = s;
|
85
|
+
long v;
|
86
|
+
|
87
|
+
v = 0;
|
88
|
+
while ((size_t)(s - os) < l) {
|
89
|
+
v *= 10;
|
90
|
+
v += *s - '0';
|
91
|
+
s++;
|
92
|
+
}
|
93
|
+
if (os == s)
|
94
|
+
return 0;
|
95
|
+
*n = LONG2NUM(v);
|
96
|
+
return l;
|
97
|
+
}
|
98
|
+
else {
|
99
|
+
VALUE vbuf = 0;
|
100
|
+
char *s2 = ALLOCV_N(char, vbuf, l + 1);
|
101
|
+
memcpy(s2, s, l);
|
102
|
+
s2[l] = '\0';
|
103
|
+
*n = rb_cstr_to_inum(s2, 10, 0);
|
104
|
+
ALLOCV_END(vbuf);
|
105
|
+
return l;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
#define set_hash(k,v) rb_hash_aset(hash, ID2SYM(rb_intern(k"")), v)
|
110
|
+
#define ref_hash(k) rb_hash_aref(hash, ID2SYM(rb_intern(k"")))
|
111
|
+
#define del_hash(k) rb_hash_delete(hash, ID2SYM(rb_intern(k"")))
|
112
|
+
|
113
|
+
#define fail() \
|
114
|
+
do { \
|
115
|
+
set_hash("_fail", Qtrue); \
|
116
|
+
return 0; \
|
117
|
+
} while (0)
|
118
|
+
|
119
|
+
#define fail_p() (!NIL_P(ref_hash("_fail")))
|
120
|
+
|
121
|
+
#define READ_DIGITS(n,w) \
|
122
|
+
do { \
|
123
|
+
size_t l; \
|
124
|
+
l = read_digits(&str[si], slen - si, &n, w); \
|
125
|
+
if (l == 0) \
|
126
|
+
fail(); \
|
127
|
+
si += l; \
|
128
|
+
} while (0)
|
129
|
+
|
130
|
+
#define READ_DIGITS_MAX(n) READ_DIGITS(n, LONG_MAX)
|
131
|
+
|
132
|
+
static int
|
133
|
+
valid_range_p(VALUE v, int a, int b)
|
134
|
+
{
|
135
|
+
if (FIXNUM_P(v)) {
|
136
|
+
int vi = FIX2INT(v);
|
137
|
+
return !(vi < a || vi > b);
|
138
|
+
}
|
139
|
+
return !(f_lt_p(v, INT2NUM(a)) || f_gt_p(v, INT2NUM(b)));
|
140
|
+
}
|
141
|
+
|
142
|
+
#define recur(fmt) \
|
143
|
+
do { \
|
144
|
+
size_t l; \
|
145
|
+
l = date__strptime_internal(&str[si], slen - si, \
|
146
|
+
fmt, sizeof fmt - 1, hash); \
|
147
|
+
if (fail_p()) \
|
148
|
+
return 0; \
|
149
|
+
si += l; \
|
150
|
+
} while (0)
|
151
|
+
|
152
|
+
VALUE date_zone_to_diff(VALUE);
|
153
|
+
|
154
|
+
static inline int
|
155
|
+
head_match_p(size_t len, const char *name, const char *str, size_t slen, size_t si)
|
156
|
+
{
|
157
|
+
return slen - si >= len && strncasecmp(name, &str[si], len) == 0;
|
158
|
+
}
|
159
|
+
|
160
|
+
static size_t
|
161
|
+
date__strptime_internal(const char *str, size_t slen,
|
162
|
+
const char *fmt, size_t flen, VALUE hash)
|
163
|
+
{
|
164
|
+
size_t si, fi;
|
165
|
+
int c;
|
166
|
+
|
167
|
+
#define HEAD_MATCH_P(len, name) head_match_p(len, name, str, slen, si)
|
168
|
+
si = fi = 0;
|
169
|
+
|
170
|
+
while (fi < flen) {
|
171
|
+
if (isspace((unsigned char)fmt[fi])) {
|
172
|
+
while (si < slen && isspace((unsigned char)str[si]))
|
173
|
+
si++;
|
174
|
+
while (++fi < flen && isspace((unsigned char)fmt[fi]));
|
175
|
+
continue;
|
176
|
+
}
|
177
|
+
|
178
|
+
if (si >= slen) fail();
|
179
|
+
|
180
|
+
switch (fmt[fi]) {
|
181
|
+
case '%':
|
182
|
+
|
183
|
+
again:
|
184
|
+
fi++;
|
185
|
+
c = fmt[fi];
|
186
|
+
|
187
|
+
switch (c) {
|
188
|
+
case 'E':
|
189
|
+
if (fmt[fi + 1] && strchr("cCxXyY", fmt[fi + 1]))
|
190
|
+
goto again;
|
191
|
+
fi--;
|
192
|
+
goto ordinal;
|
193
|
+
case 'O':
|
194
|
+
if (fmt[fi + 1] && strchr("deHImMSuUVwWy", fmt[fi + 1]))
|
195
|
+
goto again;
|
196
|
+
fi--;
|
197
|
+
goto ordinal;
|
198
|
+
case ':':
|
199
|
+
{
|
200
|
+
int i;
|
201
|
+
|
202
|
+
for (i = 1; i < 3 && fi + i < flen && fmt[fi+i] == ':'; ++i);
|
203
|
+
if (fmt[fi+i] == 'z') {
|
204
|
+
fi += i - 1;
|
205
|
+
goto again;
|
206
|
+
}
|
207
|
+
fail();
|
208
|
+
}
|
209
|
+
|
210
|
+
case 'A':
|
211
|
+
case 'a':
|
212
|
+
{
|
213
|
+
int i;
|
214
|
+
|
215
|
+
for (i = 0; i < (int)sizeof_array(day_names); i++) {
|
216
|
+
const char *day_name = day_names[i];
|
217
|
+
size_t l = strlen(day_name);
|
218
|
+
if (HEAD_MATCH_P(l, day_name) ||
|
219
|
+
HEAD_MATCH_P(l = ABBREVIATED_DAY_NAME_LENGTH, day_name)) {
|
220
|
+
si += l;
|
221
|
+
set_hash("wday", INT2FIX(i));
|
222
|
+
goto matched;
|
223
|
+
}
|
224
|
+
}
|
225
|
+
fail();
|
226
|
+
}
|
227
|
+
case 'B':
|
228
|
+
case 'b':
|
229
|
+
case 'h':
|
230
|
+
{
|
231
|
+
int i;
|
232
|
+
|
233
|
+
for (i = 0; i < (int)sizeof_array(month_names); i++) {
|
234
|
+
const char *month_name = month_names[i];
|
235
|
+
size_t l = strlen(month_name);
|
236
|
+
if (HEAD_MATCH_P(l, month_name) ||
|
237
|
+
HEAD_MATCH_P(l = ABBREVIATED_MONTH_NAME_LENGTH, month_name)) {
|
238
|
+
si += l;
|
239
|
+
set_hash("mon", INT2FIX(i + 1));
|
240
|
+
goto matched;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
fail();
|
244
|
+
}
|
245
|
+
|
246
|
+
case 'C':
|
247
|
+
{
|
248
|
+
VALUE n;
|
249
|
+
|
250
|
+
if (NUM_PATTERN_P())
|
251
|
+
READ_DIGITS(n, 2);
|
252
|
+
else
|
253
|
+
READ_DIGITS_MAX(n);
|
254
|
+
set_hash("_cent", n);
|
255
|
+
goto matched;
|
256
|
+
}
|
257
|
+
|
258
|
+
case 'c':
|
259
|
+
recur("%a %b %e %H:%M:%S %Y");
|
260
|
+
goto matched;
|
261
|
+
|
262
|
+
case 'D':
|
263
|
+
recur("%m/%d/%y");
|
264
|
+
goto matched;
|
265
|
+
|
266
|
+
case 'd':
|
267
|
+
case 'e':
|
268
|
+
{
|
269
|
+
VALUE n;
|
270
|
+
|
271
|
+
if (str[si] == ' ') {
|
272
|
+
si++;
|
273
|
+
READ_DIGITS(n, 1);
|
274
|
+
} else {
|
275
|
+
READ_DIGITS(n, 2);
|
276
|
+
}
|
277
|
+
if (!valid_range_p(n, 1, 31))
|
278
|
+
fail();
|
279
|
+
set_hash("mday", n);
|
280
|
+
goto matched;
|
281
|
+
}
|
282
|
+
|
283
|
+
case 'F':
|
284
|
+
recur("%Y-%m-%d");
|
285
|
+
goto matched;
|
286
|
+
|
287
|
+
case 'G':
|
288
|
+
{
|
289
|
+
VALUE n;
|
290
|
+
|
291
|
+
if (NUM_PATTERN_P())
|
292
|
+
READ_DIGITS(n, 4);
|
293
|
+
else
|
294
|
+
READ_DIGITS_MAX(n);
|
295
|
+
set_hash("cwyear", n);
|
296
|
+
goto matched;
|
297
|
+
}
|
298
|
+
|
299
|
+
case 'g':
|
300
|
+
{
|
301
|
+
VALUE n;
|
302
|
+
|
303
|
+
READ_DIGITS(n, 2);
|
304
|
+
if (!valid_range_p(n, 0, 99))
|
305
|
+
fail();
|
306
|
+
set_hash("cwyear",n);
|
307
|
+
if (NIL_P(ref_hash("_cent")))
|
308
|
+
set_hash("_cent",
|
309
|
+
INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
|
310
|
+
goto matched;
|
311
|
+
}
|
312
|
+
|
313
|
+
case 'H':
|
314
|
+
case 'k':
|
315
|
+
{
|
316
|
+
VALUE n;
|
317
|
+
|
318
|
+
if (str[si] == ' ') {
|
319
|
+
si++;
|
320
|
+
READ_DIGITS(n, 1);
|
321
|
+
} else {
|
322
|
+
READ_DIGITS(n, 2);
|
323
|
+
}
|
324
|
+
if (!valid_range_p(n, 0, 24))
|
325
|
+
fail();
|
326
|
+
set_hash("hour", n);
|
327
|
+
goto matched;
|
328
|
+
}
|
329
|
+
|
330
|
+
case 'I':
|
331
|
+
case 'l':
|
332
|
+
{
|
333
|
+
VALUE n;
|
334
|
+
|
335
|
+
if (str[si] == ' ') {
|
336
|
+
si++;
|
337
|
+
READ_DIGITS(n, 1);
|
338
|
+
} else {
|
339
|
+
READ_DIGITS(n, 2);
|
340
|
+
}
|
341
|
+
if (!valid_range_p(n, 1, 12))
|
342
|
+
fail();
|
343
|
+
set_hash("hour", n);
|
344
|
+
goto matched;
|
345
|
+
}
|
346
|
+
|
347
|
+
case 'j':
|
348
|
+
{
|
349
|
+
VALUE n;
|
350
|
+
|
351
|
+
READ_DIGITS(n, 3);
|
352
|
+
if (!valid_range_p(n, 1, 366))
|
353
|
+
fail();
|
354
|
+
set_hash("yday", n);
|
355
|
+
goto matched;
|
356
|
+
}
|
357
|
+
|
358
|
+
case 'L':
|
359
|
+
case 'N':
|
360
|
+
{
|
361
|
+
VALUE n;
|
362
|
+
int sign = 1;
|
363
|
+
size_t osi;
|
364
|
+
|
365
|
+
if (issign(str[si])) {
|
366
|
+
if (str[si] == '-')
|
367
|
+
sign = -1;
|
368
|
+
si++;
|
369
|
+
}
|
370
|
+
osi = si;
|
371
|
+
if (NUM_PATTERN_P())
|
372
|
+
READ_DIGITS(n, c == 'L' ? 3 : 9);
|
373
|
+
else
|
374
|
+
READ_DIGITS_MAX(n);
|
375
|
+
if (sign == -1)
|
376
|
+
n = f_negate(n);
|
377
|
+
set_hash("sec_fraction",
|
378
|
+
rb_rational_new2(n,
|
379
|
+
f_expt(INT2FIX(10),
|
380
|
+
ULONG2NUM(si - osi))));
|
381
|
+
goto matched;
|
382
|
+
}
|
383
|
+
|
384
|
+
case 'M':
|
385
|
+
{
|
386
|
+
VALUE n;
|
387
|
+
|
388
|
+
READ_DIGITS(n, 2);
|
389
|
+
if (!valid_range_p(n, 0, 59))
|
390
|
+
fail();
|
391
|
+
set_hash("min", n);
|
392
|
+
goto matched;
|
393
|
+
}
|
394
|
+
|
395
|
+
case 'm':
|
396
|
+
{
|
397
|
+
VALUE n;
|
398
|
+
|
399
|
+
READ_DIGITS(n, 2);
|
400
|
+
if (!valid_range_p(n, 1, 12))
|
401
|
+
fail();
|
402
|
+
set_hash("mon", n);
|
403
|
+
goto matched;
|
404
|
+
}
|
405
|
+
|
406
|
+
case 'n':
|
407
|
+
case 't':
|
408
|
+
recur(" ");
|
409
|
+
goto matched;
|
410
|
+
|
411
|
+
case 'P':
|
412
|
+
case 'p':
|
413
|
+
if (slen - si < 2) fail();
|
414
|
+
{
|
415
|
+
char c = str[si];
|
416
|
+
const int hour = (c == 'P' || c == 'p') ? 12 : 0;
|
417
|
+
if (!hour && !(c == 'A' || c == 'a')) fail();
|
418
|
+
if ((c = str[si+1]) == '.') {
|
419
|
+
if (slen - si < 4 || str[si+3] != '.') fail();
|
420
|
+
c = str[si += 2];
|
421
|
+
}
|
422
|
+
if (!(c == 'M' || c == 'm')) fail();
|
423
|
+
si += 2;
|
424
|
+
set_hash("_merid", INT2FIX(hour));
|
425
|
+
goto matched;
|
426
|
+
}
|
427
|
+
|
428
|
+
case 'Q':
|
429
|
+
{
|
430
|
+
VALUE n;
|
431
|
+
int sign = 1;
|
432
|
+
|
433
|
+
if (str[si] == '-') {
|
434
|
+
sign = -1;
|
435
|
+
si++;
|
436
|
+
}
|
437
|
+
READ_DIGITS_MAX(n);
|
438
|
+
if (sign == -1)
|
439
|
+
n = f_negate(n);
|
440
|
+
set_hash("seconds",
|
441
|
+
rb_rational_new2(n, INT2FIX(1000)));
|
442
|
+
goto matched;
|
443
|
+
}
|
444
|
+
|
445
|
+
case 'R':
|
446
|
+
recur("%H:%M");
|
447
|
+
goto matched;
|
448
|
+
|
449
|
+
case 'r':
|
450
|
+
recur("%I:%M:%S %p");
|
451
|
+
goto matched;
|
452
|
+
|
453
|
+
case 'S':
|
454
|
+
{
|
455
|
+
VALUE n;
|
456
|
+
|
457
|
+
READ_DIGITS(n, 2);
|
458
|
+
if (!valid_range_p(n, 0, 60))
|
459
|
+
fail();
|
460
|
+
set_hash("sec", n);
|
461
|
+
goto matched;
|
462
|
+
}
|
463
|
+
|
464
|
+
case 's':
|
465
|
+
{
|
466
|
+
VALUE n;
|
467
|
+
int sign = 1;
|
468
|
+
|
469
|
+
if (str[si] == '-') {
|
470
|
+
sign = -1;
|
471
|
+
si++;
|
472
|
+
}
|
473
|
+
READ_DIGITS_MAX(n);
|
474
|
+
if (sign == -1)
|
475
|
+
n = f_negate(n);
|
476
|
+
set_hash("seconds", n);
|
477
|
+
goto matched;
|
478
|
+
}
|
479
|
+
|
480
|
+
case 'T':
|
481
|
+
recur("%H:%M:%S");
|
482
|
+
goto matched;
|
483
|
+
|
484
|
+
case 'U':
|
485
|
+
case 'W':
|
486
|
+
{
|
487
|
+
VALUE n;
|
488
|
+
|
489
|
+
READ_DIGITS(n, 2);
|
490
|
+
if (!valid_range_p(n, 0, 53))
|
491
|
+
fail();
|
492
|
+
set_hash(c == 'U' ? "wnum0" : "wnum1", n);
|
493
|
+
goto matched;
|
494
|
+
}
|
495
|
+
|
496
|
+
case 'u':
|
497
|
+
{
|
498
|
+
VALUE n;
|
499
|
+
|
500
|
+
READ_DIGITS(n, 1);
|
501
|
+
if (!valid_range_p(n, 1, 7))
|
502
|
+
fail();
|
503
|
+
set_hash("cwday", n);
|
504
|
+
goto matched;
|
505
|
+
}
|
506
|
+
|
507
|
+
case 'V':
|
508
|
+
{
|
509
|
+
VALUE n;
|
510
|
+
|
511
|
+
READ_DIGITS(n, 2);
|
512
|
+
if (!valid_range_p(n, 1, 53))
|
513
|
+
fail();
|
514
|
+
set_hash("cweek", n);
|
515
|
+
goto matched;
|
516
|
+
}
|
517
|
+
|
518
|
+
case 'v':
|
519
|
+
recur("%e-%b-%Y");
|
520
|
+
goto matched;
|
521
|
+
|
522
|
+
case 'w':
|
523
|
+
{
|
524
|
+
VALUE n;
|
525
|
+
|
526
|
+
READ_DIGITS(n, 1);
|
527
|
+
if (!valid_range_p(n, 0, 6))
|
528
|
+
fail();
|
529
|
+
set_hash("wday", n);
|
530
|
+
goto matched;
|
531
|
+
}
|
532
|
+
|
533
|
+
case 'X':
|
534
|
+
recur("%H:%M:%S");
|
535
|
+
goto matched;
|
536
|
+
|
537
|
+
case 'x':
|
538
|
+
recur("%m/%d/%y");
|
539
|
+
goto matched;
|
540
|
+
|
541
|
+
case 'Y':
|
542
|
+
{
|
543
|
+
VALUE n;
|
544
|
+
int sign = 1;
|
545
|
+
|
546
|
+
if (issign(str[si])) {
|
547
|
+
if (str[si] == '-')
|
548
|
+
sign = -1;
|
549
|
+
si++;
|
550
|
+
}
|
551
|
+
if (NUM_PATTERN_P())
|
552
|
+
READ_DIGITS(n, 4);
|
553
|
+
else
|
554
|
+
READ_DIGITS_MAX(n);
|
555
|
+
if (sign == -1)
|
556
|
+
n = f_negate(n);
|
557
|
+
set_hash("year", n);
|
558
|
+
goto matched;
|
559
|
+
}
|
560
|
+
|
561
|
+
case 'y':
|
562
|
+
{
|
563
|
+
VALUE n;
|
564
|
+
int sign = 1;
|
565
|
+
|
566
|
+
READ_DIGITS(n, 2);
|
567
|
+
if (!valid_range_p(n, 0, 99))
|
568
|
+
fail();
|
569
|
+
if (sign == -1)
|
570
|
+
n = f_negate(n);
|
571
|
+
set_hash("year", n);
|
572
|
+
if (NIL_P(ref_hash("_cent")))
|
573
|
+
set_hash("_cent",
|
574
|
+
INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
|
575
|
+
goto matched;
|
576
|
+
}
|
577
|
+
|
578
|
+
case 'Z':
|
579
|
+
case 'z':
|
580
|
+
{
|
581
|
+
static const char pat_source[] =
|
582
|
+
"\\A("
|
583
|
+
"(?:gmt|utc?)?[-+]\\d+(?:[,.:]\\d+(?::\\d+)?)?"
|
584
|
+
"|(?-i:[[:alpha:].\\s]+)(?:standard|daylight)\\s+time\\b"
|
585
|
+
"|(?-i:[[:alpha:]]+)(?:\\s+dst)?\\b"
|
586
|
+
")";
|
587
|
+
static VALUE pat = Qnil;
|
588
|
+
VALUE m, b;
|
589
|
+
|
590
|
+
if (NIL_P(pat)) {
|
591
|
+
pat = rb_reg_new(pat_source, sizeof pat_source - 1,
|
592
|
+
ONIG_OPTION_IGNORECASE);
|
593
|
+
rb_obj_freeze(pat);
|
594
|
+
rb_gc_register_mark_object(pat);
|
595
|
+
}
|
596
|
+
|
597
|
+
b = rb_backref_get();
|
598
|
+
rb_match_busy(b);
|
599
|
+
m = f_match(pat, rb_usascii_str_new(&str[si], slen - si));
|
600
|
+
|
601
|
+
if (!NIL_P(m)) {
|
602
|
+
VALUE s, l, o;
|
603
|
+
|
604
|
+
s = rb_reg_nth_match(1, m);
|
605
|
+
l = f_end(m, INT2FIX(0));
|
606
|
+
o = date_zone_to_diff(s);
|
607
|
+
si += NUM2LONG(l);
|
608
|
+
set_hash("zone", s);
|
609
|
+
set_hash("offset", o);
|
610
|
+
rb_backref_set(b);
|
611
|
+
goto matched;
|
612
|
+
}
|
613
|
+
rb_backref_set(b);
|
614
|
+
fail();
|
615
|
+
}
|
616
|
+
|
617
|
+
case '%':
|
618
|
+
if (str[si] != '%')
|
619
|
+
fail();
|
620
|
+
si++;
|
621
|
+
goto matched;
|
622
|
+
|
623
|
+
case '+':
|
624
|
+
recur("%a %b %e %H:%M:%S %Z %Y");
|
625
|
+
goto matched;
|
626
|
+
|
627
|
+
default:
|
628
|
+
if (str[si] != '%')
|
629
|
+
fail();
|
630
|
+
si++;
|
631
|
+
if (fi < flen) {
|
632
|
+
if (si >= slen || str[si] != fmt[fi])
|
633
|
+
fail();
|
634
|
+
si++;
|
635
|
+
}
|
636
|
+
goto matched;
|
637
|
+
}
|
638
|
+
default:
|
639
|
+
ordinal:
|
640
|
+
if (str[si] != fmt[fi])
|
641
|
+
fail();
|
642
|
+
si++;
|
643
|
+
fi++;
|
644
|
+
break;
|
645
|
+
matched:
|
646
|
+
fi++;
|
647
|
+
break;
|
648
|
+
}
|
649
|
+
}
|
650
|
+
|
651
|
+
return si;
|
652
|
+
}
|
653
|
+
|
654
|
+
VALUE
|
655
|
+
date__strptime(const char *str, size_t slen,
|
656
|
+
const char *fmt, size_t flen, VALUE hash)
|
657
|
+
{
|
658
|
+
size_t si;
|
659
|
+
VALUE cent, merid;
|
660
|
+
|
661
|
+
si = date__strptime_internal(str, slen, fmt, flen, hash);
|
662
|
+
|
663
|
+
if (slen > si) {
|
664
|
+
VALUE s;
|
665
|
+
|
666
|
+
s = rb_usascii_str_new(&str[si], slen - si);
|
667
|
+
set_hash("leftover", s);
|
668
|
+
}
|
669
|
+
|
670
|
+
if (fail_p())
|
671
|
+
return Qnil;
|
672
|
+
|
673
|
+
cent = del_hash("_cent");
|
674
|
+
if (!NIL_P(cent)) {
|
675
|
+
VALUE year;
|
676
|
+
|
677
|
+
year = ref_hash("cwyear");
|
678
|
+
if (!NIL_P(year))
|
679
|
+
set_hash("cwyear", f_add(year, f_mul(cent, INT2FIX(100))));
|
680
|
+
year = ref_hash("year");
|
681
|
+
if (!NIL_P(year))
|
682
|
+
set_hash("year", f_add(year, f_mul(cent, INT2FIX(100))));
|
683
|
+
}
|
684
|
+
|
685
|
+
merid = del_hash("_merid");
|
686
|
+
if (!NIL_P(merid)) {
|
687
|
+
VALUE hour;
|
688
|
+
|
689
|
+
hour = ref_hash("hour");
|
690
|
+
if (!NIL_P(hour)) {
|
691
|
+
hour = f_mod(hour, INT2FIX(12));
|
692
|
+
set_hash("hour", f_add(hour, merid));
|
693
|
+
}
|
694
|
+
}
|
695
|
+
|
696
|
+
return hash;
|
697
|
+
}
|
698
|
+
|
699
|
+
/*
|
700
|
+
Local variables:
|
701
|
+
c-file-style: "ruby"
|
702
|
+
End:
|
703
|
+
*/
|