source: CIVL/examples/experimental/reverse_CIVL/ADFirstAidKit/treeverseCtest.c

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[4d61ad0]1#include <stdio.h>
2#include "treeverse.h"
3
4int str2int(char *str) {
5 int res = 0 ;
6 while(*str) {
7 res = (res * 10) + (*str) - '0' ;
8 str++ ;
9 }
10 return(res) ;
11}
12
13int main(int argc, char *argv[]) {
14 int action,step ;
15 int nstp = 10 ;
16 int nsnp = 3 ;
17 if (argc>1) nstp=str2int(argv[1]) ;
18 if (argc>2) nsnp=str2int(argv[2]) ;
19 printf("REVERSING %i STEPS WITH %i SNAPSHOTS:\n",nstp,nsnp) ;
20 trv_init(nstp, nsnp, 1) ;
21 while (trv_next_action(&action, &step)) {
22 switch (action) {
23 case PUSHSNAP :
24 printf("[%i] PUSH SNAPSHOT %i\n",action,step) ;
25 break ;
26 case LOOKSNAP :
27 printf("[%i] LOOK SNAPSHOT %i\n",action,step) ;
28 break ;
29 case POPSNAP :
30 printf("[%i] POP SNAPSHOT %i\n",action,step) ;
31 break ;
32 case ADVANCE :
33 printf("[%i] ADVANCE ONE STEP %i\n",action,step) ;
34 break ;
35 case FIRSTTURN :
36 printf("[%i] FIRST TURN %i\n",action,step) ;
37 break ;
38 case TURN :
39 printf("[%i] TURN %i\n",action,step) ;
40 break ;
41 default :
42 printf("[%i] ?? %i\n",action,step) ;
43 break ;
44 }
45
46/* if (step==8 && action==4) { */
47/* printf(" =============> step 8: TRV_RESIZE() !!!\n") ; */
48/* trv_resize() ; */
49/* } */
50 }
51}
Note: See TracBrowser for help on using the repository browser.