Changeset 03cad47 in mainline
- Timestamp:
- 2012-07-28T00:20:31Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4056ad0
- Parents:
- 6e34bd0
- Location:
- uspace/app/bithenge
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bithenge/expression.c
r6e34bd0 r03cad47 271 271 .prefix_length = param_wrapper_prefix_length, 272 272 .destroy = param_wrapper_destroy, 273 .num_params = 0, /* This transform should not be used inside another274 param_wrapper or explicitly in a script, so this275 number doesn't matter. */276 273 }; 277 274 … … 295 292 296 293 rc = bithenge_init_transform(param_wrapper_as_transform(self), 297 ¶m_wrapper_ops );294 ¶m_wrapper_ops, 0); 298 295 if (rc != EOK) 299 296 goto error; -
uspace/app/bithenge/transform.c
r6e34bd0 r03cad47 44 44 * @param[out] self Transform to initialize. 45 45 * @param[in] ops Operations provided by the transform. 46 * @param num_params The number of parameters required. If this is nonzero, the 47 * transform will get its own context with parameters, probably provided by a 48 * param_wrapper. If this is zero, the existing outer context will be used with 49 * whatever parameters it has. 46 50 * @return EOK or an error code from errno.h. */ 47 51 int bithenge_init_transform(bithenge_transform_t *self, 48 const bithenge_transform_ops_t *ops )52 const bithenge_transform_ops_t *ops, int num_params) 49 53 { 50 54 assert(ops); … … 53 57 self->ops = ops; 54 58 self->refs = 1; 59 self->num_params = num_params; 55 60 return EOK; 56 61 } … … 99 104 /** The ASCII text transform. */ 100 105 bithenge_transform_t bithenge_ascii_transform = { 101 &ascii_ops, 1 106 &ascii_ops, 1, 0 102 107 }; 103 108 … … 159 164 \ 160 165 bithenge_transform_t bithenge_##NAME##_transform = { \ 161 &NAME##_ops, 1 166 &NAME##_ops, 1, 0 \ 162 167 } 163 168 … … 222 227 /** The zero-terminated data transform. */ 223 228 bithenge_transform_t bithenge_zero_terminated_transform = { 224 &zero_terminated_ops, 1 229 &zero_terminated_ops, 1, 0 225 230 }; 226 231 … … 480 485 } 481 486 rc = bithenge_init_transform(struct_as_transform(self), 482 &struct_transform_ops );487 &struct_transform_ops, 0); 483 488 if (rc != EOK) 484 489 goto error; … … 579 584 } 580 585 rc = bithenge_init_transform(compose_as_transform(self), 581 &compose_transform_ops );586 &compose_transform_ops, 0); 582 587 if (rc != EOK) 583 588 goto error; -
uspace/app/bithenge/transform.h
r6e34bd0 r03cad47 46 46 const struct bithenge_transform_ops *ops; 47 47 unsigned int refs; 48 int num_params; 48 49 } bithenge_transform_t; 49 50 … … 66 67 * @param self The transform. */ 67 68 void (*destroy)(bithenge_transform_t *self); 68 /** The number of parameters required. */69 int num_params;70 69 } bithenge_transform_ops_t; 71 70 … … 136 135 } 137 136 138 /** Get the number of parameters required by a transform. T akes ownership of139 * nothing.137 /** Get the number of parameters required by a transform. This number is used 138 * by the parser and param-wrapper. Takes ownership of nothing. 140 139 * @param self The transform. 141 140 * @return The number of parameters required. */ … … 143 142 { 144 143 assert(self); 145 assert(self->ops); 146 return self->ops->num_params; 144 return self->num_params; 147 145 } 148 146 … … 220 218 221 219 int bithenge_init_transform(bithenge_transform_t *self, 222 const bithenge_transform_ops_t *ops );220 const bithenge_transform_ops_t *ops, int num_params); 223 221 int bithenge_new_struct(bithenge_transform_t **out, 224 222 bithenge_named_transform_t *subtransforms);
Note:
See TracChangeset
for help on using the changeset viewer.