示例#1
0
PROGRAM new_program(char *filename)
{
  FILE *input;
  PROGRAM result = calloc(1, sizeof(*result));
  /* 
   * Identify the kind of source 
   * --- 
   *  Identyfikacja rodzaju programu
   */
  result->kind = identify_program(filename);
  if (!result->kind)
  {
    free(result);
    return NULL;
  }
  /* 
   * Load the source into memory 
   * ---
   *  Wczytanie ¼ród³a do pamiêci
   */
  result->filename = strdup(filename);
  input = fopen(filename, "r");
  if (!input) 
  {
    free(result);
    return NULL;
  }
  afgettoch(&(result->source), input, '\0');
  fclose(input);
  return result;
}
示例#2
0
/* The main program. */
int main (int argc, char **argv) {
   identify_program(argc, argv);
   process_options(argc, argv);
   process_parameters(argc, argv);
   assign_defaults();
   compose_tunes();
   monitor_locks(foreground_task, poll_interval);
}