Class: Char

Inherits:
JAVA::Value show all
Defined in:
ext/primitive/primitive.c

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from JAVA::Value

const_missing

Class Method Details

.[](o) ⇒ Object



805
806
807
808
809
810
# File 'ext/primitive/primitive.c', line 805

static VALUE
r_Char_new(VALUE self, VALUE o)
{
	uint16_t value = __accept_char(o);
	return __allocate_Char(value);
}

Instance Method Details

#!=(o) ⇒ Object



923
924
925
926
927
928
929
930
# File 'ext/primitive/primitive.c', line 923

static VALUE
r_Char_ne(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return p->value != v ? Qtrue : Qfalse;
}

#%(o) ⇒ Object



961
962
963
964
965
966
967
968
# File 'ext/primitive/primitive.c', line 961

static VALUE
r_Char_mod(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return __allocate_Int32(__mod_int32(p->value, v));
}

#&(o) ⇒ Object



1061
1062
1063
1064
1065
1066
1067
1068
# File 'ext/primitive/primitive.c', line 1061

static VALUE
r_Char_and(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return __allocate_Int32(p->value & v);
}

#*(o) ⇒ Object



945
946
947
948
949
950
951
952
# File 'ext/primitive/primitive.c', line 945

static VALUE
r_Char_mul(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return __allocate_Int32(p->value * v);
}

#+(o) ⇒ Object



969
970
971
972
973
974
975
976
# File 'ext/primitive/primitive.c', line 969

static VALUE
r_Char_add(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return __allocate_Int32(p->value + v);
}

#+@Object



931
932
933
934
935
936
937
# File 'ext/primitive/primitive.c', line 931

static VALUE
r_Char_pos(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __allocate_Int32(+p->value);
}

#-(o) ⇒ Object



977
978
979
980
981
982
983
984
# File 'ext/primitive/primitive.c', line 977

static VALUE
r_Char_sub(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return __allocate_Int32(p->value - v);
}

#-@Object



938
939
940
941
942
943
944
# File 'ext/primitive/primitive.c', line 938

static VALUE
r_Char_neg(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __allocate_Int32(-p->value);
}

#/(o) ⇒ Object



953
954
955
956
957
958
959
960
# File 'ext/primitive/primitive.c', line 953

static VALUE
r_Char_div(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return __allocate_Int32(__div_int32(p->value, v));
}

#<(o) ⇒ Object



997
998
999
1000
1001
1002
1003
1004
# File 'ext/primitive/primitive.c', line 997

static VALUE
r_Char_lt(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return p->value < v ? Qtrue : Qfalse;
}

#<<(o) ⇒ Object



1036
1037
1038
1039
1040
1041
1042
1043
# File 'ext/primitive/primitive.c', line 1036

static VALUE
r_Char_shl(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t d = __accept_int32(o);
	return __allocate_Int32(p->value << d);
}

#<=(o) ⇒ Object



1005
1006
1007
1008
1009
1010
1011
1012
# File 'ext/primitive/primitive.c', line 1005

static VALUE
r_Char_le(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return p->value <= v ? Qtrue : Qfalse;
}

#<=>(o) ⇒ Object



985
986
987
988
989
990
991
992
993
994
995
996
# File 'ext/primitive/primitive.c', line 985

static VALUE
r_Char_cmp(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	if (p->value < v)
		return r_INT32_M1;
	if (p->value > v)
		return r_INT32_1;
	return r_INT32_0;
}

#==(o) ⇒ Object



915
916
917
918
919
920
921
922
# File 'ext/primitive/primitive.c', line 915

static VALUE
r_Char_eq(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return p->value == v ? Qtrue : Qfalse;
}

#===(o) ⇒ Object



811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'ext/primitive/primitive.c', line 811

static VALUE
r_Char_equals(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	if (TYPE(o) == T_DATA) {
		if (RBASIC(o)->klass == r_Char) {
			Char *op;
			Data_Get_Struct(o, Char, op);
			if (p->value == op->value)
				return Qtrue;
		}
	}
	return Qfalse;
}

#>(o) ⇒ Object



1021
1022
1023
1024
1025
1026
1027
1028
# File 'ext/primitive/primitive.c', line 1021

static VALUE
r_Char_gt(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return p->value > v ? Qtrue : Qfalse;
}

#>=(o) ⇒ Object



1013
1014
1015
1016
1017
1018
1019
1020
# File 'ext/primitive/primitive.c', line 1013

static VALUE
r_Char_ge(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return p->value >= v ? Qtrue : Qfalse;
}

#>>(o) ⇒ Object



1044
1045
1046
1047
1048
1049
1050
1051
# File 'ext/primitive/primitive.c', line 1044

static VALUE
r_Char_shr(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t d = __accept_int32(o);
	return __allocate_Int32(p->value >> d);
}

#^(o) ⇒ Object



1069
1070
1071
1072
1073
1074
1075
1076
# File 'ext/primitive/primitive.c', line 1069

static VALUE
r_Char_xor(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return __allocate_Int32(p->value ^ v);
}

#eql?(o) ⇒ Boolean

Returns:

  • (Boolean)


811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'ext/primitive/primitive.c', line 811

static VALUE
r_Char_equals(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	if (TYPE(o) == T_DATA) {
		if (RBASIC(o)->klass == r_Char) {
			Char *op;
			Data_Get_Struct(o, Char, op);
			if (p->value == op->value)
				return Qtrue;
		}
	}
	return Qfalse;
}

#equals(o) ⇒ Object



811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'ext/primitive/primitive.c', line 811

static VALUE
r_Char_equals(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	if (TYPE(o) == T_DATA) {
		if (RBASIC(o)->klass == r_Char) {
			Char *op;
			Data_Get_Struct(o, Char, op);
			if (p->value == op->value)
				return Qtrue;
		}
	}
	return Qfalse;
}

#hashObject



840
841
842
843
844
845
846
# File 'ext/primitive/primitive.c', line 840

static VALUE
r_Char_hash(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return LONG2NUM((long) __hash_int32(p->value));
}

#hashCodeObject



826
827
828
829
830
831
832
# File 'ext/primitive/primitive.c', line 826

static VALUE
r_Char_hashCode(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __allocate_Int32(__hash_int32(p->value));
}

#inspectObject



847
848
849
850
851
852
853
# File 'ext/primitive/primitive.c', line 847

static VALUE
r_Char_to_s(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __int32_to_s(p->value);
}

#to_byteObject



854
855
856
857
858
859
860
# File 'ext/primitive/primitive.c', line 854

static VALUE
r_Char_to_byte(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __allocate_Byte((int8_t) p->value);
}

#to_charObject



861
862
863
864
865
# File 'ext/primitive/primitive.c', line 861

static VALUE
r_Char_to_char(VALUE self)
{
	return self;
}

#to_fObject



908
909
910
911
912
913
914
# File 'ext/primitive/primitive.c', line 908

static VALUE
r_Char_to_f(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __int32_to_f(p->value);
}

#to_float32Object



887
888
889
890
891
892
893
# File 'ext/primitive/primitive.c', line 887

static VALUE
r_Char_to_float32(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __allocate_Float32((float) p->value);
}

#to_float64Object



894
895
896
897
898
899
900
# File 'ext/primitive/primitive.c', line 894

static VALUE
r_Char_to_float64(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __allocate_Float64((double) p->value);
}

#to_iObject



901
902
903
904
905
906
907
# File 'ext/primitive/primitive.c', line 901

static VALUE
r_Char_to_i(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __int32_to_i(p->value);
}

#to_intObject



901
902
903
904
905
906
907
# File 'ext/primitive/primitive.c', line 901

static VALUE
r_Char_to_i(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __int32_to_i(p->value);
}

#to_int16Object



866
867
868
869
870
871
872
# File 'ext/primitive/primitive.c', line 866

static VALUE
r_Char_to_int16(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __allocate_Int16((int16_t) p->value);
}

#to_int32Object



873
874
875
876
877
878
879
# File 'ext/primitive/primitive.c', line 873

static VALUE
r_Char_to_int32(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __allocate_Int32((int32_t) p->value);
}

#to_int64Object



880
881
882
883
884
885
886
# File 'ext/primitive/primitive.c', line 880

static VALUE
r_Char_to_int64(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __allocate_Int64((int64_t) p->value);
}

#to_sObject



847
848
849
850
851
852
853
# File 'ext/primitive/primitive.c', line 847

static VALUE
r_Char_to_s(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __int32_to_s(p->value);
}

#toStringObject



833
834
835
836
837
838
839
# File 'ext/primitive/primitive.c', line 833

static VALUE
r_Char_toString(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return rb_funcall(__int32_to_s(p->value), TO_J_ID, 0);
}

#ushr(o) ⇒ Object



1052
1053
1054
1055
1056
1057
1058
1059
1060
# File 'ext/primitive/primitive.c', line 1052

static VALUE
r_Char_ushr(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	uint32_t u = (uint32_t) p->value;
	int32_t d = __accept_int32(o);
	return __allocate_Int32((int32_t) (u >> d));
}

#|(o) ⇒ Object



1077
1078
1079
1080
1081
1082
1083
1084
# File 'ext/primitive/primitive.c', line 1077

static VALUE
r_Char_or(VALUE self, VALUE o)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	int32_t v = __accept_int32(o);
	return __allocate_Int32(p->value | v);
}

#~Object



1029
1030
1031
1032
1033
1034
1035
# File 'ext/primitive/primitive.c', line 1029

static VALUE
r_Char_inv(VALUE self)
{
	Char *p;
	Data_Get_Struct(self, Char, p);
	return __allocate_Int32(~p->value);
}