Changeset 0d1a8fd in mainline for uspace/app/bithenge/script.c


Ignore:
Timestamp:
2012-06-24T18:44:34Z (12 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f2da0bb
Parents:
03b2b2c
Message:

Bithenge: allow primitive transforms in scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bithenge/script.c

    r03b2b2c r0d1a8fd  
    232232}
    233233
    234 /** Find a transform by name.
     234/** Find a transform by name. A reference will be added to the transform.
    235235 * @return The found transform, or NULL if none was found. */
    236236static bithenge_transform_t *get_named_transform(state_t *state,
    237237    const char *name)
    238238{
    239         for (transform_list_t *e = state->transform_list; e; e = e->next)
    240                 if (!str_cmp(e->name, name))
     239        for (transform_list_t *e = state->transform_list; e; e = e->next) {
     240                if (!str_cmp(e->name, name)) {
     241                        bithenge_transform_inc_ref(e->transform);
    241242                        return e->transform;
     243                }
     244        }
     245        for (int i = 0; bithenge_primitive_transforms[i].name; i++) {
     246                if (!str_cmp(bithenge_primitive_transforms[i].name, name)) {
     247                        bithenge_transform_t *xform =
     248                            bithenge_primitive_transforms[i].transform;
     249                        bithenge_transform_inc_ref(xform);
     250                        return xform;
     251                }
     252        }
    242253        return NULL;
    243254}
Note: See TracChangeset for help on using the changeset viewer.