Permalink
Browse files

Add couple of last required functions

  • Loading branch information...
bacek committed Mar 27, 2012
1 parent bc20be3 commit d3630a9ae9213d154c03c9aa06a35f2a1f25c0bf
Showing with 63 additions and 3 deletions.
  1. +24 −2 include/parrot/signature.h
  2. +39 −1 src/call/signature.c
View
@@ -28,12 +28,25 @@ PARROT_CANNOT_RETURN_NULL
Parrot_Signature* Parrot_pcc_signature_new(PARROT_INTERP)
__attribute__nonnull__(1);
+PARROT_EXPORT
+INTVAL Parrot_pcc_signature_num_positionals(PARROT_INTERP,
+ ARGIN(Parrot_Signature *self))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
PARROT_EXPORT
void Parrot_pcc_signature_reset(PARROT_INTERP,
ARGIN(Parrot_Signature *self))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
+INTVAL Parrot_pcc_signature_exists_named(PARROT_INTERP,
+ ARGIN(Parrot_Signature *self),
+ ARGIN(STRING *key))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
INTVAL Parrot_pcc_signature_get_integer(PARROT_INTERP,
ARGIN(Parrot_Signature *self),
INTVAL key)
@@ -84,7 +97,7 @@ STRING* Parrot_pcc_signature_get_string(PARROT_INTERP,
PARROT_CAN_RETURN_NULL
STRING * Parrot_pcc_signature_get_string_named(PARROT_INTERP,
- ARGIN(Parrot_Signature *),
+ ARGIN(Parrot_Signature *self),
ARGIN(STRING *key))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
@@ -150,9 +163,18 @@ void Parrot_pcc_signature_push_string_named(PARROT_INTERP,
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_pcc_signature_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_pcc_signature_num_positionals \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(self))
#define ASSERT_ARGS_Parrot_pcc_signature_reset __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(self))
+#define ASSERT_ARGS_Parrot_pcc_signature_exists_named \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(self) \
+ , PARROT_ASSERT_ARG(key))
#define ASSERT_ARGS_Parrot_pcc_signature_get_integer \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
@@ -186,7 +208,7 @@ void Parrot_pcc_signature_push_string_named(PARROT_INTERP,
#define ASSERT_ARGS_Parrot_pcc_signature_get_string_named \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(Parrot_Signature *) \
+ , PARROT_ASSERT_ARG(self) \
, PARROT_ASSERT_ARG(key))
#define ASSERT_ARGS_Parrot_pcc_signature_push_float \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
View
@@ -234,6 +234,22 @@ Parrot_pcc_signature_reset(PARROT_INTERP, ARGIN(Parrot_Signature *self))
}
}
+/*
+=item C<INTVAL Parrot_pcc_signature_num_positionals(PARROT_INTERP,
+Parrot_Signature *self)>
+
+Get number of positional arguments.
+
+=cut
+*/
+
+PARROT_EXPORT
+INTVAL
+Parrot_pcc_signature_num_positionals(PARROT_INTERP, ARGIN(Parrot_Signature *self))
+{
+ return self->num_positionals;
+}
+
/*
=back
@@ -442,7 +458,7 @@ Parrot_Signature *self, STRING *key)>
Parrot_Signature *self, STRING *key)>
=item C<STRING * Parrot_pcc_signature_get_string_named(PARROT_INTERP,
-Parrot_Signature *, STRING *key)>
+Parrot_Signature *self, STRING *key)>
=item C<PMC * Parrot_pcc_signature_get_pmc_named(PARROT_INTERP, Parrot_Signature
*self, STRING *key)>
@@ -522,6 +538,28 @@ Parrot_pcc_signature_get_pmc_named(PARROT_INTERP,
return PMCNULL;
}
+/*
+=item C<INTVAL Parrot_pcc_signature_exists_named(PARROT_INTERP, Parrot_Signature
+*self, STRING *key)>
+
+Check named parameter for existance.
+
+=cut
+*/
+
+INTVAL
+Parrot_pcc_signature_exists_named(PARROT_INTERP,
+ ARGIN(Parrot_Signature *self), ARGIN(STRING *key))
+{
+ if (self->hash) {
+ void * const k = Parrot_hash_key_from_string(interp, self->hash, key);
+
+ return Parrot_hash_exists(interp, self->hash, k);
+ }
+
+ return 0;
+}
+
/*
=back

0 comments on commit d3630a9

Please sign in to comment.