-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from hasumikin/upgrade-resources
Upgrade resources
- Loading branch information
Showing
48 changed files
with
11,316 additions
and
2,723 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/ext/ruby-parser/ruby/parse.c | ||
/ext/ruby-parser/ruby/parse.h | ||
/lib/*.bundle | ||
/lib/ruby_parser.so | ||
/tmp | ||
/Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem "lrama", "0.6.0" | ||
gem "lrama", "0.6.3" | ||
gem "rake-compiler", "~> 1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* CC0 (Public domain) - see ccan/licenses/CC0 file for details */ | ||
#ifndef CCAN_CHECK_TYPE_H | ||
#define CCAN_CHECK_TYPE_H | ||
|
||
/** | ||
* ccan_check_type - issue a warning or build failure if type is not correct. | ||
* @expr: the expression whose type we should check (not evaluated). | ||
* @type: the exact type we expect the expression to be. | ||
* | ||
* This macro is usually used within other macros to try to ensure that a macro | ||
* argument is of the expected type. No type promotion of the expression is | ||
* done: an unsigned int is not the same as an int! | ||
* | ||
* ccan_check_type() always evaluates to 0. | ||
* | ||
* If your compiler does not support typeof, then the best we can do is fail | ||
* to compile if the sizes of the types are unequal (a less complete check). | ||
* | ||
* Example: | ||
* // They should always pass a 64-bit value to _set_some_value! | ||
* #define set_some_value(expr) \ | ||
* _set_some_value((ccan_check_type((expr), uint64_t), (expr))) | ||
*/ | ||
|
||
/** | ||
* ccan_check_types_match - issue a warning or build failure if types are not same. | ||
* @expr1: the first expression (not evaluated). | ||
* @expr2: the second expression (not evaluated). | ||
* | ||
* This macro is usually used within other macros to try to ensure that | ||
* arguments are of identical types. No type promotion of the expressions is | ||
* done: an unsigned int is not the same as an int! | ||
* | ||
* ccan_check_types_match() always evaluates to 0. | ||
* | ||
* If your compiler does not support typeof, then the best we can do is fail | ||
* to compile if the sizes of the types are unequal (a less complete check). | ||
* | ||
* Example: | ||
* // Do subtraction to get to enclosing type, but make sure that | ||
* // pointer is of correct type for that member. | ||
* #define ccan_container_of(mbr_ptr, encl_type, mbr) \ | ||
* (ccan_check_types_match((mbr_ptr), &((encl_type *)0)->mbr), \ | ||
* ((encl_type *) \ | ||
* ((char *)(mbr_ptr) - offsetof(enclosing_type, mbr)))) | ||
*/ | ||
#if defined(HAVE_TYPEOF) && HAVE_TYPEOF | ||
#define ccan_check_type(expr, type) \ | ||
((typeof(expr) *)0 != (type *)0) | ||
|
||
#define ccan_check_types_match(expr1, expr2) \ | ||
((typeof(expr1) *)0 != (typeof(expr2) *)0) | ||
#else | ||
#include "ccan/build_assert/build_assert.h" | ||
/* Without typeof, we can only test the sizes. */ | ||
#define ccan_check_type(expr, type) \ | ||
CCAN_BUILD_ASSERT_OR_ZERO(sizeof(expr) == sizeof(type)) | ||
|
||
#define ccan_check_types_match(expr1, expr2) \ | ||
CCAN_BUILD_ASSERT_OR_ZERO(sizeof(expr1) == sizeof(expr2)) | ||
#endif /* HAVE_TYPEOF */ | ||
|
||
#endif /* CCAN_CHECK_TYPE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
/* CC0 (Public domain) - see ccan/licenses/CC0 file for details */ | ||
#ifndef CCAN_CONTAINER_OF_H | ||
#define CCAN_CONTAINER_OF_H | ||
#include "ccan/check_type/check_type.h" | ||
|
||
/** | ||
* ccan_container_of - get pointer to enclosing structure | ||
* @member_ptr: pointer to the structure member | ||
* @containing_type: the type this member is within | ||
* @member: the name of this member within the structure. | ||
* | ||
* Given a pointer to a member of a structure, this macro does pointer | ||
* subtraction to return the pointer to the enclosing type. | ||
* | ||
* Example: | ||
* struct foo { | ||
* int fielda, fieldb; | ||
* // ... | ||
* }; | ||
* struct info { | ||
* int some_other_field; | ||
* struct foo my_foo; | ||
* }; | ||
* | ||
* static struct info *foo_to_info(struct foo *foo) | ||
* { | ||
* return ccan_container_of(foo, struct info, my_foo); | ||
* } | ||
*/ | ||
#define ccan_container_of(member_ptr, containing_type, member) \ | ||
((containing_type *) \ | ||
((char *)(member_ptr) \ | ||
- ccan_container_off(containing_type, member)) \ | ||
+ ccan_check_types_match(*(member_ptr), ((containing_type *)0)->member)) | ||
|
||
|
||
/** | ||
* ccan_container_of_or_null - get pointer to enclosing structure, or NULL | ||
* @member_ptr: pointer to the structure member | ||
* @containing_type: the type this member is within | ||
* @member: the name of this member within the structure. | ||
* | ||
* Given a pointer to a member of a structure, this macro does pointer | ||
* subtraction to return the pointer to the enclosing type, unless it | ||
* is given NULL, in which case it also returns NULL. | ||
* | ||
* Example: | ||
* struct foo { | ||
* int fielda, fieldb; | ||
* // ... | ||
* }; | ||
* struct info { | ||
* int some_other_field; | ||
* struct foo my_foo; | ||
* }; | ||
* | ||
* static struct info *foo_to_info_allowing_null(struct foo *foo) | ||
* { | ||
* return ccan_container_of_or_null(foo, struct info, my_foo); | ||
* } | ||
*/ | ||
static inline char *container_of_or_null_(void *member_ptr, size_t offset) | ||
{ | ||
return member_ptr ? (char *)member_ptr - offset : NULL; | ||
} | ||
#define ccan_container_of_or_null(member_ptr, containing_type, member) \ | ||
((containing_type *) \ | ||
ccan_container_of_or_null_(member_ptr, \ | ||
ccan_container_off(containing_type, member)) \ | ||
+ ccan_check_types_match(*(member_ptr), ((containing_type *)0)->member)) | ||
|
||
/** | ||
* ccan_container_off - get offset to enclosing structure | ||
* @containing_type: the type this member is within | ||
* @member: the name of this member within the structure. | ||
* | ||
* Given a pointer to a member of a structure, this macro does | ||
* typechecking and figures out the offset to the enclosing type. | ||
* | ||
* Example: | ||
* struct foo { | ||
* int fielda, fieldb; | ||
* // ... | ||
* }; | ||
* struct info { | ||
* int some_other_field; | ||
* struct foo my_foo; | ||
* }; | ||
* | ||
* static struct info *foo_to_info(struct foo *foo) | ||
* { | ||
* size_t off = ccan_container_off(struct info, my_foo); | ||
* return (void *)((char *)foo - off); | ||
* } | ||
*/ | ||
#define ccan_container_off(containing_type, member) \ | ||
offsetof(containing_type, member) | ||
|
||
/** | ||
* ccan_container_of_var - get pointer to enclosing structure using a variable | ||
* @member_ptr: pointer to the structure member | ||
* @container_var: a pointer of same type as this member's container | ||
* @member: the name of this member within the structure. | ||
* | ||
* Given a pointer to a member of a structure, this macro does pointer | ||
* subtraction to return the pointer to the enclosing type. | ||
* | ||
* Example: | ||
* static struct info *foo_to_i(struct foo *foo) | ||
* { | ||
* struct info *i = ccan_container_of_var(foo, i, my_foo); | ||
* return i; | ||
* } | ||
*/ | ||
#if defined(HAVE_TYPEOF) && HAVE_TYPEOF | ||
#define ccan_container_of_var(member_ptr, container_var, member) \ | ||
ccan_container_of(member_ptr, typeof(*container_var), member) | ||
#else | ||
#define ccan_container_of_var(member_ptr, container_var, member) \ | ||
((void *)((char *)(member_ptr) - \ | ||
ccan_container_off_var(container_var, member))) | ||
#endif | ||
|
||
/** | ||
* ccan_container_off_var - get offset of a field in enclosing structure | ||
* @container_var: a pointer to a container structure | ||
* @member: the name of a member within the structure. | ||
* | ||
* Given (any) pointer to a structure and a its member name, this | ||
* macro does pointer subtraction to return offset of member in a | ||
* structure memory layout. | ||
* | ||
*/ | ||
#if defined(HAVE_TYPEOF) && HAVE_TYPEOF | ||
#define ccan_container_off_var(var, member) \ | ||
ccan_container_off(typeof(*var), member) | ||
#else | ||
#define ccan_container_off_var(var, member) \ | ||
((const char *)&(var)->member - (const char *)(var)) | ||
#endif | ||
|
||
#endif /* CCAN_CONTAINER_OF_H */ |
Oops, something went wrong.