Skip to content

Commit

Permalink
Add doTable function
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben committed May 4, 2015
1 parent c4273f1 commit b128e54
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/doTEA.R
@@ -1,3 +1,7 @@
#' Build the requested table, including any requisite tables that led up to this table.
doTable <- function(input_table=teaenv$active_tab){
.C("build_one_table", as.character(input_table))
}

#' The preedits are reduced to a list of queries. We can apply them at any time to any
#' table to make sure that they are still clean.
Expand Down
12 changes: 12 additions & 0 deletions c/in_out_tree.c
Expand Up @@ -161,3 +161,15 @@ bool run_all_tags(char *type, char **active_tab, void* aux_info){
"Trouble doing %s segment with tag '%s'.", type, Tag(i));}
return true;
}

void build_one_table(char **tab){ //char ** to be R-friendly
Tea_stopif(!tab || !*tab, return, 0, "No input table given");
Tea_stopif(!in_out_tab, return, 0, "No table generation info. Have you run readSpec?");
int row=-1;
for (int i=0; i< *in_out_tab->textsize; i++)
if (!strcmp(Output(i), *tab)) {row=i; break;}
Tea_stopif(row==-1, return, 0, "Could not find %s in the list of output tables.", *tab);

char *active_tab=NULL;
run_one_tag(row, &active_tab, NULL, (bool[]){true});
}

0 comments on commit b128e54

Please sign in to comment.