Esempio n. 1
0
int main(int argc, char* argv[]) {

    int debuggingMode = 0;
    StackPtr stack; //the pointer to the stack for chars
    stack = stk_create(); //create the stack

    if(argv[1] != NULL) {
        if(strcmp(argv[1], "-d\n")) {
            debuggingMode = 1;
        }
    }

    char input[300]; //assuming input will be less than 300 characters
    int comp;

    //Ask the user for input
    printf("Enter symbols you'd like checked for balance or Q to quit: ");
    fgets(input, 300, stdin);

   while(strcmp("Q\n", input) != 0 && strcmp("q\n", input) != 0) {

        checkBalanced(stack, input, debuggingMode);

        stk_clear(stack);

        printf("Enter symbols you'd like checked for balance or Q to quit: ");
        fgets(input, 300, stdin);

    }

    return 0;
}
Esempio n. 2
0
mem_Object mem_create_objects( int size )
{
   objectInfo info = xmalloc( sizeof ( struct objectInfo ) );

#if MAA_MAGIC
   info->magic   = MEM_OBJECTS_MAGIC;
#endif
   info->total   = 0;
   info->used    = 0;
   info->reused  = 0;
   info->size    = size;
   info->stack   = stk_create();
   info->obstack = xmalloc( sizeof( struct obstack ) );
   obstack_init( info->obstack );

   return info;
}
Esempio n. 3
0
static void must_create_stack( young_heap_t *heap )
{
  if (!stk_create( DATA(heap)->globals ))
    panic_exit( "nursery: create_stack" );
}