/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to pcilib/view.c

  • Committer: Suren A. Chilingaryan
  • Date: 2016-02-23 06:20:33 UTC
  • mfrom: (346.1.18 pcitool)
  • Revision ID: csa@suren.me-20160223062033-mz8qkpm1a2oioveb
Merge Python scripting support from Vasiliy Chernov

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
            return PCILIB_ERROR_MEMORY;
70
70
        }
71
71
 
 
72
        memcpy(cur, v, v->api->description_size);
 
73
        ctx->views[ctx->num_views + i] = cur;
 
74
 
72
75
        if (v->api->init) 
73
 
            view_ctx = v->api->init(ctx);
 
76
            view_ctx = v->api->init(ctx, ctx->num_views + i);
74
77
        else {
75
78
            view_ctx = (pcilib_view_context_t*)malloc(sizeof(pcilib_view_context_t));
76
79
            if (view_ctx) memset(view_ctx, 0, sizeof(pcilib_view_context_t));
83
86
            return PCILIB_ERROR_FAILED;
84
87
        }
85
88
 
86
 
        memcpy(cur, v, v->api->description_size);
87
 
        view_ctx->view = ctx->num_views + i;
 
89
        view_ctx->view = ctx->num_views + i;
88
90
        view_ctx->name = v->name;
89
91
 
 
92
        HASH_ADD_KEYPTR(hh, ctx->view_hash, view_ctx->name, strlen(view_ctx->name), view_ctx);
 
93
 
90
94
        if (refs) refs[i] = view_ctx;
91
95
 
92
 
        HASH_ADD_KEYPTR(hh, ctx->view_hash, view_ctx->name, strlen(view_ctx->name), view_ctx);
93
 
        ctx->views[ctx->num_views + i] = cur;
94
 
 
95
96
        ptr += v->api->description_size;
96
97
    }
97
98