Doxygen Source Code Documentation
SUMA_ProgramTemplate.c File Reference
#include "SUMA_suma.h"Go to the source code of this file.
| Functions | |
| void | usage_PROGRAM_NAME (SUMA_GENERIC_ARGV_PARSE *ps) | 
| SUMA_GENERIC_PROG_OPTIONS_STRUCT * | SUMA_PROGRAM_NAME_ParseInput (char *argv[], int argc, SUMA_GENERIC_ARGV_PARSE *ps) | 
| int | main (int argc, char *argv[]) | 
| Variables | |
| SUMA_SurfaceViewer * | SUMAg_cSV = NULL | 
| SUMA_SurfaceViewer * | SUMAg_SVv = NULL | 
| int | SUMAg_N_SVv = 0 | 
| SUMA_DO * | SUMAg_DOv = NULL | 
| int | SUMAg_N_DOv = 0 | 
| SUMA_CommonFields * | SUMAg_CF = NULL | 
Function Documentation
| 
 | ||||||||||||
| \** File : SUMA.c 
 Input paramters : 
 
 
 Definition at line 79 of file SUMA_ProgramTemplate.c. References argc, SUMA_GENERIC_PROG_OPTIONS_STRUCT::debug, LocalHead, SUMA_Alloc_DisplayObject_Struct(), SUMA_Boolean, SUMA_error_message(), SUMA_Free_CommonFields(), SUMA_Free_Generic_Prog_Options_Struct(), SUMA_FreeGenericArgParse(), SUMA_mainENTRY, SUMA_MAX_DISPLAYABLE_OBJECTS, SUMA_Parse_IO_Args(), SUMA_PROGRAM_NAME_ParseInput(), SUMA_STANDALONE_INIT, and usage_PROGRAM_NAME(). 
 00080 {/* Main */    
00081    static char FuncName[]={"PROGRAM_NAME"}; 
00082    SUMA_GENERIC_PROG_OPTIONS_STRUCT *Opt;  
00083    SUMA_GENERIC_ARGV_PARSE *ps=NULL;
00084    SUMA_Boolean LocalHead = NOPE;
00085 
00086         SUMA_mainENTRY;
00087    SUMA_STANDALONE_INIT;
00088 
00089    /* Allocate space for DO structure */
00090         SUMAg_DOv = SUMA_Alloc_DisplayObject_Struct (SUMA_MAX_DISPLAYABLE_OBJECTS);
00091    ps = SUMA_Parse_IO_Args(argc, argv, "-o;-talk;");
00092    
00093    if (argc < 2) {
00094       usage_PROGRAM_NAME(ps);
00095       exit (1);
00096    }
00097    
00098    Opt = SUMA_PROGRAM_NAME_ParseInput (argv, argc, ps);
00099 
00100    if (Opt->debug > 2) LocalHead = YUP;
00101 
00102    if (ps) SUMA_FreeGenericArgParse(ps); ps = NULL;
00103    if (Opt) Opt = SUMA_Free_Generic_Prog_Options_Struct(Opt);
00104    if (!SUMA_Free_CommonFields(SUMAg_CF)) SUMA_error_message(FuncName,"SUMAg_CF Cleanup Failed!",1);
00105    exit(0);
00106    
00107 } 
 | 
| 
 | ||||||||||||||||
| 
 Definition at line 33 of file SUMA_ProgramTemplate.c. References SUMA_GENERIC_ARGV_PARSE::arg_checked, argc, SUMA_GENERIC_PROG_OPTIONS_STRUCT::debug, LocalHead, SUMA_Alloc_Generic_Prog_Options_Struct(), SUMA_Boolean, SUMA_ENTRY, SUMA_RETURN, SUMA_SKIP_COMMON_OPTIONS, and usage_PROGRAM_NAME(). Referenced by main(). 
 00034 {
00035    static char FuncName[]={"SUMA_BrainWrap_ParseInput"}; 
00036    SUMA_GENERIC_PROG_OPTIONS_STRUCT *Opt=NULL;
00037    int kar;
00038    SUMA_Boolean brk;
00039    SUMA_Boolean LocalHead = NOPE;
00040 
00041    SUMA_ENTRY;
00042    
00043    Opt = SUMA_Alloc_Generic_Prog_Options_Struct();
00044    kar = 1;
00045    brk = NOPE;
00046         while (kar < argc) { /* loop accross command ine options */
00047                 /*fprintf(stdout, "%s verbose: Parsing command line...\n", FuncName);*/
00048                 if (strcmp(argv[kar], "-h") == 0 || strcmp(argv[kar], "-help") == 0) {
00049                          usage_PROGRAM_NAME(ps);
00050           exit (0);
00051                 }
00052                 
00053                 SUMA_SKIP_COMMON_OPTIONS(brk, kar);
00054       
00055       if (!brk && (strcmp(argv[kar], "-debug") == 0))
00056       {
00057          if (kar+1 >= argc)
00058          {
00059             fprintf (SUMA_STDERR, "need a number after -debug \n");
00060             exit (1);
00061          }
00062          
00063          Opt->debug = atoi(argv[++kar]);
00064          brk = YUP;
00065       }
00066       
00067       if (!brk && !ps->arg_checked[kar]) {
00068                         fprintf (SUMA_STDERR,"Error %s:\nOption %s not understood. Try -help for usage\n", FuncName, argv[kar]);
00069                         exit (1);
00070                 } else {        
00071                         brk = NOPE;
00072                         kar ++;
00073                 }
00074    }
00075    
00076    SUMA_RETURN(Opt);
00077 }
 | 
| 
 | 
| 
 Definition at line 14 of file SUMA_ProgramTemplate.c. References i, SUMA_free, SUMA_help_basics(), SUMA_help_IO_Args(), and SUMA_New_Additions(). Referenced by main(), and SUMA_PROGRAM_NAME_ParseInput(). 
 00015 {
00016       static char FuncName[]={"usage_PROGRAM_NAME"};
00017       char * s = NULL, *sio=NULL, *st = NULL, *sts = NULL;
00018       int i;
00019       s = SUMA_help_basics();
00020       sio  = SUMA_help_IO_Args(ps);
00021       printf ( "\n"
00022                "Usage: A template code for writing SUMA programs.\n"
00023                " \n"
00024                "%s"
00025                "%s"
00026                "\n", sio,  s);
00027       SUMA_free(s); s = NULL; SUMA_free(st); st = NULL; SUMA_free(sio); sio = NULL;       
00028       s = SUMA_New_Additions(0, 1); printf("%s\n", s);SUMA_free(s); s = NULL;
00029       printf("       Ziad S. Saad SSCC/NIMH/NIH ziad@nih.gov     \n");
00030       exit(0);
00031 }
 | 
Variable Documentation
| 
 | 
| Global pointer to structure containing info common to all viewers Definition at line 12 of file SUMA_ProgramTemplate.c. | 
| 
 | 
| Global pointer to current Surface Viewer structure Definition at line 6 of file SUMA_ProgramTemplate.c. | 
| 
 | 
| Global pointer to Displayable Object structure vector Definition at line 10 of file SUMA_ProgramTemplate.c. | 
| 
 | 
| Number of DOs stored in DOv Definition at line 11 of file SUMA_ProgramTemplate.c. | 
| 
 | 
| Number of SVs realized by X Definition at line 9 of file SUMA_ProgramTemplate.c. | 
| 
 | 
| Global pointer to the vector containing the various Surface Viewer Structures SUMAg_SVv contains SUMA_MAX_SURF_VIEWERS structures Definition at line 7 of file SUMA_ProgramTemplate.c. | 
 
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
 
 
 
 
       
	   
	   
	   
	  