*** empty log message ***
[h316.git] / pc-tools / ldc2 / src / main.cpp
index 36cb22ed22c06fb9b1463f4e176cfb3073154f29..f8274103d6d8db868da086181623cc8d94043dd3 100644 (file)
@@ -1,3 +1,7 @@
+/* ldc2 preliminary main program */
+
+#include <vector>
+#include <string>
 
 #include <stdio.h>
 #include <unistd.h>
@@ -5,6 +9,10 @@
 #include "tape_block.hh"
 #include "data_block.hh"
 
+#include "argread.hh"
+
+using namespace std;
+
 void tape_start(void* m){
   printf("tape_start\n");
 }
@@ -13,27 +21,45 @@ void tape_stop(void* m){
   printf("tape_stop\n");
 }
 
-int main(){
+
+
+
+void dump_vector(vector<string> arguments){
+  for (vector<string>::iterator iter=arguments.begin();iter<arguments.end();iter++){
+    printf("%s\n",(*iter).c_str());
+  }
+}
+
+int main(int argc, char ** args){
+  int help_needed;
+  int name_set;
+  int file_set;
+  string name="Philipp";
+  string filename;
+
+  argreader ar("ldc2");
+  ar.add_param("n","name=","Enter other name",&name_set,&name,"<name>");
+  ar.add_param("h","help","Give help",&help_needed);
+  ar.add_free_param("<file>","File to read data from",&file_set,&filename);
+
+   
+                  
+  dump_vector(ar.read_args(argc,args));
+
+ if (help_needed==1) dump_vector(ar.get_help());
+
+  printf("Hallo %s!\n",name.c_str());
+  exit(0);
   tape_block * myblock=0;
   do{
     if (myblock) delete myblock;
     myblock=tape_block::gen_from_fd(0);
-
+    
     vector<string> desc=myblock->get_description();
     for (vector<string>::iterator iter=desc.begin();
         iter!=desc.end();iter++)
       printf("%s\n",(*iter).c_str());
-
-
-//     if ((myblock->get_type()==0)&&(myblock->get_subtype()==050)){
-//       data_block * dp=(data_block *)myblock;
-//       printf ("0-50 symbol name: %s\n",dp->extract_string(4).c_str());
-//       printf ("0-50 symbol name: %s\n",dp->extract_string(11).c_str());
-//       printf ("Block size:%i\n",dp->get_word_size());
-//     }
   } while (myblock->get_state()==tape_block::TBS_OK);
-  printf("---");
-  printf("State:%i\n",myblock->get_state());
-  printf("raw size:%i\n",myblock->get_raw_size());
     return 0;
 }
+