Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Implement Proc#isolated? #2

Closed
kachick opened this issue Jun 20, 2021 · 0 comments
Closed

Implement Proc#isolated? #2

kachick opened this issue Jun 20, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@kachick
Copy link
Owner

kachick commented Jun 20, 2021

typedef struct rb_proc_t;

#define GetCoreDataFromValue(obj, type, ptr) ((ptr) = CoreDataFromValue((obj), type))

#define GetProcPtr(obj, ptr) \
  GetCoreDataFromValue((obj), rb_proc_t, (ptr))

static typedef struct {
    // const struct rb_block VALUE;
    unsigned int is_from_method: 1;	/* bool */
    unsigned int is_lambda: 1;		/* bool */
    unsigned int is_isolated: 1;        /* bool */
} rb_proc_t;


VALUE
rb_proc_lambda_p(VALUE procval)
{
    rb_proc_t *proc;
    GetProcPtr(procval, proc);

    return proc->is_lambda ? Qtrue : Qfalse;
}

VALUE
rb_proc_isolated_p(VALUE procval)
{
    rb_proc_t *proc;
    GetProcPtr(procval, proc);

    return proc->is_isolated ? Qtrue : Qfalse;
}


        // proc->is_isolated = TRUE;

void
Init_proc_isolation(void)
{
  rb_define_method(rb_cProc, "isolated?", rb_proc_isolated_p, 0);
}

This is my image, but can't work 🤔

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

1 participant