From: Sean P. <sea...@ma...> - 2009-12-13 22:14:52
|
Hi cee1, Welcome! Questions on ASL are always appreciated. I'm not sure which version of the code you're referring too, the line numbers don't match up with the current release. I'm going to use the latest code from my sanbox here: http://stlab.adobe.com:8080/@lno=y@//sandbox/sparent/adobe_source_libraries/source/adam.cpp?ac=64&rev1=28 On Dec 13, 2009, at 5:17 AM, cee1 wrote: > Hi all, > I'm reading the code of adam.cpp, and get totally lost. It is a bit twisty - I've been slowing working on a rewrite using Boost Graph Library - but no ETA on when that will appear. > In the function sheet_t::implementation_t::get: > (adam.cpp 1387) "if (initialize_mode_m) { ..." > I've found initialize_mode_m is false when instantiates > sheet_t::implementation_t, and will be true when calls add_constant, > add_input or add_interface. So the following assert should always > fail: (line 1435 in my copy) When a sheet is constructed, initializers are evaluated as the cells are added. the get() function is called by the expression evaluator to look up variables. The expressions on a sheet initializer can only refer to cells that have been previously declared (added to the sheet) and the initializers don't attempt to follow relationships, they only pick up the cell value of previously initialized cells. > (adam.cpp 1428) assert(cell.interface_input_m && ...), > Because when this line is reached, the initialize_mode_m is false, > then we should not have called add_constant, add_input or > add_interface, so the cell is not an interface cell, assert failed. (line 1476) - there is a return statement on line 1449 so this line is not going to be reached if initialize_mode_m is true. > > Also, I find some code that makes no sense to me, like: > (adam.cpp 1267) sheet_t::implementation_t::initialize_one > accumulate_contributing_m.reset(); > ... > cell.init_contributing_m |= accumulate_contributing_m; (1315) accumulate_contributing_m is a member variable that holds a bit field corresponding to cells. Executing calculate_m() on line 1323 is going to set the bits for the cells that are read as part of that expression in accumulate_contributing_m. Then on line 1325 that bit set is or'ed with the other bits contributing to the initializer on that cell. > > or > > (adam.cpp 1173) in function sheet_t::implementation_t::update > if (cell.specifier_m == access_interface_output) > get_stack_m.push_back(std::make_pair(cell.name_m, false)); (1221) The get_stack_m is used to detect self-referential expressions in get() (which is called as part of calculating an expression for variable lookup). For example, if you have a rule like: a <== max(a, b); Then the lookup of "a" is self referential, and must refer to the initial value of "a", but "b" is not self referential and will refer to the final value of "b". See line 1475 for where this is used. > ... > if (cell.specifier_m == access_interface_output) > get_stack_m.pop_back(); > > > Sorry for this mass mail, but I feel lost in adam.cpp. Could someone > show me the global picture of how these functions in > sheet_t::implementation work? No problem - keep the questions coming. Sean > > > Regards, > - cee1 > ------------------------------------------------------------------------------ > Return on Information: > Google Enterprise Search pays you back > Get the facts. > http://p.sf.net/sfu/google-dev2dev > _______________________________________________ > Adobe-source-devel mailing list > Ado...@li... > https://lists.sourceforge.net/lists/listinfo/adobe-source-devel |