#endif
typedef enum{
- TM路Tape路Topo路mu = 0
- ,TM路Tape路Topo路empty = 1
- ,TM路Tape路Topo路singleton = 1 << 1
- ,TM路Tape路Topo路segment = 1 << 2
- ,TM路Tape路Topo路circle = 1 << 3
- ,TM路Tape路Topo路tail_cyclic = 1 << 4
- ,TM路Tape路Topo路infinite = 1 << 5
- }TM路Tape路Topo;
- const TM路Tape路Topo TM路Tape路Topo路bounded =
- TM路Tape路Topo路singleton
- | TM路Tape路Topo路segment
+ TM路Topo路mu = 0
+ ,TM路Topo路empty = 1
+ ,TM路Topo路singleton = 1 << 1
+ ,TM路Topo路segment = 1 << 2
+ ,TM路Topo路circle = 1 << 3
+ ,TM路Topo路tail_cyclic = 1 << 4
+ ,TM路Topo路infinite = 1 << 5
+ }TM路Topo;
+ const TM路Topo TM路Topo路bounded =
+ TM路Topo路singleton
+ | TM路Topo路segment
;
typedef enum{
- TM路Head路Status路mu = 0
- ,TM路Head路Status路dismounted = 1
- ,TM路Head路Status路out_of_area = 1 << 1
- ,TM路Head路Status路leftmost = 1 << 2
- ,TM路Head路Status路interim = 1 << 3
- ,TM路Head路Status路rightmost = 1 << 4
- } TM路Head路Status;
-
- const TM路Head路Status TM路Head路Status路on_tape =
- TM路Head路Status路leftmost
- | TM路Head路Status路interim
- | TM路Head路Status路rightmost
+ TM路Status路mu = 0
+ ,TM路Status路dismounted = 1
+ ,TM路Status路out_of_area = 1 << 1
+ ,TM路Status路leftmost = 1 << 2
+ ,TM路Status路interim = 1 << 3
+ ,TM路Status路rightmost = 1 << 4
+ } TM路Status;
+
+ const TM路Status TM路Status路on_tape =
+ TM路Status路leftmost
+ | TM路Status路interim
+ | TM路Status路rightmost
;
#endif //#ifndef TM路FACE
typedef struct 路(TM,_TM路CVT_,FG){
- TM路Tape路Topo (*Tape路topo) ( 路(TM,_TM路CVT_) tm );
- bool (*Tape路bounded) ( 路(TM,_TM路CVT_) tm );
- 路(extent_t,_TM路CVT_) (*Tape路extent) ( 路(TM,_TM路CVT_) tm );
+ TM路Topo (*topo) ( 路(TM,_TM路CVT_) tm );
+ bool (*bounded) ( 路(TM,_TM路CVT_) tm );
+ 路(extent_t,_TM路CVT_) (*extent) ( 路(TM,_TM路CVT_) tm );
- TM路Head路Status (*Head路status) ( 路(TM,_TM路CVT_) tm );
- bool (*Head路dismounted) ( 路(TM,_TM路CVT_) tm );
- bool (*Head路on_tape) ( 路(TM,_TM路CVT_) tm );
- bool (*Head路on_leftmost)( 路(TM,_TM路CVT_) tm );
- bool (*Head路on_rightmost)( 路(TM,_TM路CVT_) tm );
+ TM路Status (*status) ( 路(TM,_TM路CVT_) tm );
+ bool (*dismounted) ( 路(TM,_TM路CVT_) tm );
+ bool (*on_tape) ( 路(TM,_TM路CVT_) tm );
+ bool (*on_leftmost)( 路(TM,_TM路CVT_) tm );
+ bool (*on_rightmost)( 路(TM,_TM路CVT_) tm );
// tape machine functions
void (*mount) ( 路(TM,_TM路CVT_) tm );
Array implementation with a segment tape
*/
- Local TM路Tape路Topo 路(TM,_TM路CVT_,Array,Tape路topo)( 路(TM,_TM路CVT_) tm ){
+ Local TM路Topo 路(TM,_TM路CVT_,Array,topo)( 路(TM,_TM路CVT_) tm ){
路(TM,_TM路CVT_,Array,Tableau) *t = (路(TM,_TM路CVT_,Array,Tableau) *) tm.tableau;
- if( t->extent == 0 ) return TM路Tape路Topo路singleton;
- return TM路Tape路Topo路segment;
+ if( t->extent == 0 ) return TM路Topo路singleton;
+ return TM路Topo路segment;
}
- Local bool 路(TM,_TM路CVT_,Array,Tape路bounded)( 路(TM,_TM路CVT_) tm ){
+ Local bool 路(TM,_TM路CVT_,Array,bounded)( 路(TM,_TM路CVT_) tm ){
路(TM,_TM路CVT_,Array,Tableau) *t = (路(TM,_TM路CVT_,Array,Tableau) *) tm.tableau;
- return 路(TM,_TM路CVT_,Array,Tape路topo)( tm ) & TM路Tape路Topo路bounded;
+ return 路(TM,_TM路CVT_,Array,topo)( tm ) & TM路Topo路bounded;
}
- Local 路(extent_t,_TM路CVT_) 路(TM,_TM路CVT_,Array,Tape路extent)( 路(TM,_TM路CVT_) tm ){
+ Local 路(extent_t,_TM路CVT_) 路(TM,_TM路CVT_,Array,extent)( 路(TM,_TM路CVT_) tm ){
路(TM,_TM路CVT_,Array,Tableau) *t = (路(TM,_TM路CVT_,Array,Tableau) *) tm.tableau;
return t->extent;
}
- Local TM路Head路Status 路(TM,_TM路CVT_,Array,Head路status)( 路(TM,_TM路CVT_) tm ){
+ Local TM路Status 路(TM,_TM路CVT_,Array,status)( 路(TM,_TM路CVT_) tm ){
路(TM,_TM路CVT_,Array,Tableau) *t = (路(TM,_TM路CVT_,Array,Tableau) *) tm.tableau;
- if( !t->hd ) return TM路Head路Status路dismounted;
- if( t->hd == t->position ) return TM路Head路Status路leftmost;
+ if( !t->hd ) return TM路Status路dismounted;
+ if( t->hd == t->position ) return TM路Status路leftmost;
_TM路CVT_ *rightmost_pt = t->position + t->extent;
- if( t->hd == rightmost_pt ) return TM路Head路Status路rightmost;
+ if( t->hd == rightmost_pt ) return TM路Status路rightmost;
if( t->hd < t->position || t->hd > rightmost_pt )
- return TM路Head路Status路out_of_area;
+ return TM路Status路out_of_area;
- return TM路Head路Status路interim;
+ return TM路Status路interim;
}
- Local bool 路(TM,_TM路CVT_,Array,Head路dismounted)( 路(TM,_TM路CVT_) tm ){
+ Local bool 路(TM,_TM路CVT_,Array,dismounted)( 路(TM,_TM路CVT_) tm ){
路(TM,_TM路CVT_,Array,Tableau) *t = (路(TM,_TM路CVT_,Array,Tableau) *) tm.tableau;
- return 路(TM,_TM路CVT_,Array,Head路status)( tm ) & TM路Head路Status路dismounted;
+ return 路(TM,_TM路CVT_,Array,status)( tm ) & TM路Status路dismounted;
}
- Local bool 路(TM,_TM路CVT_,Array,Head路on_tape)( 路(TM,_TM路CVT_) tm ){
+ Local bool 路(TM,_TM路CVT_,Array,on_tape)( 路(TM,_TM路CVT_) tm ){
路(TM,_TM路CVT_,Array,Tableau) *t = (路(TM,_TM路CVT_,Array,Tableau) *) tm.tableau;
- return 路(TM,_TM路CVT_,Array,Head路status)( tm ) & TM路Head路Status路on_tape;
+ return 路(TM,_TM路CVT_,Array,status)( tm ) & TM路Status路on_tape;
}
- Local bool 路(TM,_TM路CVT_,Array,Head路on_leftmost)( 路(TM,_TM路CVT_) tm ){
+ Local bool 路(TM,_TM路CVT_,Array,on_leftmost)( 路(TM,_TM路CVT_) tm ){
路(TM,_TM路CVT_,Array,Tableau) *t = (路(TM,_TM路CVT_,Array,Tableau) *) tm.tableau;
- return 路(TM,_TM路CVT_,Array,Head路status)( tm ) & TM路Head路Status路leftmost;
+ return 路(TM,_TM路CVT_,Array,status)( tm ) & TM路Status路leftmost;
}
- Local bool 路(TM,_TM路CVT_,Array,Head路on_rightmost)( 路(TM,_TM路CVT_) tm ){
+ Local bool 路(TM,_TM路CVT_,Array,on_rightmost)( 路(TM,_TM路CVT_) tm ){
路(TM,_TM路CVT_,Array,Tableau) *t = (路(TM,_TM路CVT_,Array,Tableau) *) tm.tableau;
- return 路(TM,_TM路CVT_,Array,Head路status)( tm ) & TM路Head路Status路rightmost;
+ return 路(TM,_TM路CVT_,Array,status)( tm ) & TM路Status路rightmost;
}
// does nothing if the hd is already mounted
Local void 路(TM,_TM路CVT_,Array,rewind)( 路(TM,_TM路CVT_) tm ){
路(TM,_TM路CVT_,Array,Tableau) *t = (路(TM,_TM路CVT_,Array,Tableau) *) tm.tableau;
- if( 路(TM,_TM路CVT_,Array,Head路dismounted)( tm ) ) return;
+ if( 路(TM,_TM路CVT_,Array,dismounted)( tm ) ) return;
t->hd = t->position;
}
Local 路(TM,_TM路CVT_,FG) 路(TM,_TM路CVT_,Array,fg) = {
- .Tape路topo = 路(TM,_TM路CVT_,Array,Tape路topo)
- ,.Tape路bounded = 路(TM,_TM路CVT_,Array,Tape路bounded)
- ,.Tape路extent = 路(TM,_TM路CVT_,Array,Tape路extent)
+ .topo = 路(TM,_TM路CVT_,Array,topo)
+ ,.bounded = 路(TM,_TM路CVT_,Array,bounded)
+ ,.extent = 路(TM,_TM路CVT_,Array,extent)
- ,.Head路status = 路(TM,_TM路CVT_,Array,Head路status)
- ,.Head路dismounted = 路(TM,_TM路CVT_,Array,Head路dismounted)
- ,.Head路on_tape = 路(TM,_TM路CVT_,Array,Head路on_tape)
- ,.Head路on_leftmost = 路(TM,_TM路CVT_,Array,Head路on_leftmost)
- ,.Head路on_rightmost= 路(TM,_TM路CVT_,Array,Head路on_rightmost)
+ ,.status = 路(TM,_TM路CVT_,Array,status)
+ ,.dismounted = 路(TM,_TM路CVT_,Array,dismounted)
+ ,.on_tape = 路(TM,_TM路CVT_,Array,on_tape)
+ ,.on_leftmost = 路(TM,_TM路CVT_,Array,on_leftmost)
+ ,.on_rightmost = 路(TM,_TM路CVT_,Array,on_rightmost)
- ,.mount = 路(TM,_TM路CVT_,Array,mount)
- ,.dismount = 路(TM,_TM路CVT_,Array,dismount)
+ ,.mount = 路(TM,_TM路CVT_,Array,mount)
+ ,.dismount = 路(TM,_TM路CVT_,Array,dismount)
- ,.step = 路(TM,_TM路CVT_,Array,step)
- ,.step_right = 路(TM,_TM路CVT_,Array,step)
- ,.step_left = 路(TM,_TM路CVT_,Array,step_left)
- ,.rewind = 路(TM,_TM路CVT_,Array,rewind)
+ ,.step = 路(TM,_TM路CVT_,Array,step)
+ ,.step_right = 路(TM,_TM路CVT_,Array,step)
+ ,.step_left = 路(TM,_TM路CVT_,Array,step_left)
+ ,.rewind = 路(TM,_TM路CVT_,Array,rewind)
- ,.read = 路(TM,_TM路CVT_,Array,read)
- ,.write = 路(TM,_TM路CVT_,Array,write)
+ ,.read = 路(TM,_TM路CVT_,Array,read)
+ ,.write = 路(TM,_TM路CVT_,Array,write)
};