Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[java/runtime] rename flattenSpec to FlattenSpec, and minor edits
  • Loading branch information
mberends committed Jan 22, 2011
1 parent 7d44ea3 commit cc11e4f
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 6 deletions.
42 changes: 40 additions & 2 deletions java/runtime/Rakudo/Metamodel/Representation.java
Expand Up @@ -3,10 +3,13 @@
import Rakudo.Metamodel.RakudoObject;
import Rakudo.Runtime.ThreadContext;




/// <summary>
/// All representations should implement this API.
/// </summary>
public interface Representation
public interface Representation // C# has public abstract class
{
/// <summary>
/// Creates a new type object of this representation, and
Expand Down Expand Up @@ -75,17 +78,52 @@ public interface Representation
/// <returns></returns>
int hint_for(ThreadContext tc, RakudoObject classHandle, String name);

/// <summary>
/// Used with boxing. Sets an integer value, for representations that
/// can hold one.
/// </summary>
/// <param name="Object"></param>
/// <param name="Value"></param>
void set_int(ThreadContext tc, RakudoObject classHandle, int Value);

/// <summary>
/// Used with boxing. Gets an integer value, for representations that
/// can hold one.
/// </summary>
/// <param name="Object"></param>
/// <param name="Value"></param>
int get_int(ThreadContext tc, RakudoObject classHandle);

/// <summary>
/// Used with boxing. Sets a floating point value, for representations that
/// can hold one.
/// </summary>
/// <param name="Object"></param>
/// <param name="Value"></param>
void set_num(ThreadContext tc, RakudoObject classHandle, double Value);

/// <summary>
/// Used with boxing. Gets a floating point value, for representations that
/// can hold one.
/// </summary>
/// <param name="Object"></param>
/// <param name="Value"></param>
double get_num(ThreadContext tc, RakudoObject classHandle);

/// <summary>
/// Used with boxing. Sets a string value, for representations that
/// can hold one.
/// </summary>
/// <param name="Object"></param>
/// <param name="Value"></param>
void set_str(ThreadContext tc, RakudoObject classHandle, String Value);

/// <summary>
/// Used with boxing. Gets a string value, for representations that
/// can hold one.
/// </summary>
/// <param name="Object"></param>
/// <param name="Value"></param>
String get_str(ThreadContext tc, RakudoObject classHandle);

}

Expand Up @@ -20,7 +20,7 @@ public final class Instance extends RakudoObject
{
public RakudoObject[] Positionals;
public HashMap<String, RakudoObject> Nameds;
public int[] flattenSpec;
public int[] FlattenSpec;
public Instance(SharedTable sharedTable)
{
this.setSTable(sharedTable);
Expand Down
21 changes: 19 additions & 2 deletions java/runtime/Rakudo/Runtime/CaptureHelper.java
Expand Up @@ -11,7 +11,7 @@
/// Provides helper methods for getting stuff into and out of captures,
/// both native ones and user-level ones.
/// </summary>
public class CaptureHelper // the C# version has a static class
public class CaptureHelper // C# has static class
{
/// <summary>
/// Don't flatten.
Expand All @@ -31,7 +31,7 @@ public class CaptureHelper // the C# version has a static class
/// <summary>
/// Cache of the native capture type object.
/// </summary>
public static RakudoObject CaptureTypeObject; // the C# version has internal
public static RakudoObject CaptureTypeObject; // C# has internal

/// <summary>
/// Empty capture former.
Expand Down Expand Up @@ -68,6 +68,23 @@ public static RakudoObject FormWith(RakudoObject[] posArgs, HashMap<String, Raku
return capture;
}

/// <summary>
/// Forms a capture from the provided positional and named arguments
/// and the given flattening spec.
/// </summary>
/// <param name="PosArgs"></param>
/// <param name="NamedArgs"></param>
/// <param name="FlattenSpec"></param>
/// <returns></returns>
public static RakudoObject FormWith(RakudoObject[] posArgs, HashMap<String, RakudoObject> namedArgs, int[] flattenSpec)
{
P6capture.Instance capture = (P6capture.Instance)CaptureTypeObject.getSTable().REPR.instance_of(null, CaptureTypeObject);
capture.Positionals = posArgs;
capture.Nameds = namedArgs;
capture.FlattenSpec = flattenSpec;
return capture;
}

/// <summary>
/// Get a positional argument from a capture.
/// </summary>
Expand Down
6 changes: 5 additions & 1 deletion java/runtime/Rakudo/Runtime/DefinednessConstraint.java
@@ -1,5 +1,10 @@
package Rakudo.Runtime;






/// <summary>
/// Possible constraints on whether a parameter must be defined or
/// not (from the representation's point of view).
Expand All @@ -21,4 +26,3 @@ public enum DefinednessConstraint
/// </summary>
UndefinedOnly
}

0 comments on commit cc11e4f

Please sign in to comment.