예제 #1
0
파일: cplusplus.c 프로젝트: spchamp/ilu
int main (int ac, char **av, char **envp)
{
  list s;
  char **filename;

  int i_num_isl_files_processed = 0;
  int i_renaming_files = 0;

  if ((ProgramName = iluparser_GetProgramName(av[0])) == NULL)
#if (defined(WIN32) && defined(_WINIO))
    ProgramName = "wcppstub";
#else
    ProgramName = "c++-stubber";
#endif /* (defined(WIN32) && defined(_WINIO)) */

  if (ac < 2)
    {
      PrintUsage();
      return(1);
    }

  if (!ParseArgs (&ac, &av))
    return(1);

  if (NamesFile != NULL)
    {
      if (!ReadSynonyms (NamesFile))
	{
	  fprintf (stderr, "Couldn't read names file %s.\n", NamesFile);
	  return (1);
	};
    };      

  if (StubsFile || HeaderFile || ClientCommonFile)
  	i_renaming_files = 1;

  for (filename = av;  *filename != NULL;  filename += 1)
    {
	  if (i_renaming_files && (i_num_isl_files_processed > 0)) {
      fprintf (stderr, "Can't use -sname -hname or -cname with more than 1 isl file.\n");
      return(1);
	  }
      if ((s = ParseFile (*filename)) == NULL)
	{
	  fprintf (stderr, "Couldn't find or parse %s.\n", *filename);
	  return (1);
	}
      list_enumerate (s, (iluparser_EnumProc) GenerateStubs, NULL);
	  i_num_isl_files_processed++;
    }
  return(0);
}
DWORD request_core_enumextcmd(Remote* remote, Packet* packet)
{
	BOOL bResult = FALSE;
	Packet* pResponse = packet_create_response(packet);

	if (pResponse != NULL)
	{
		EnumExtensions enumExt;
		enumExt.pResponse = pResponse;
		enumExt.lpExtensionName = packet_get_tlv_value_string(packet, TLV_TYPE_STRING);

		dprintf("[LISTEXTCMD] Listing extension commands for %s ...", enumExt.lpExtensionName);
		// Start by enumerating the names of the extensions
		bResult = list_enumerate(gExtensionList, ext_cmd_callback, &enumExt);

		packet_transmit_response(ERROR_SUCCESS, remote, pResponse);
	}

	return ERROR_SUCCESS;
}
예제 #3
0
int main()
{
    list_t list;
    const uint32_t entry_width = 20;
    
    if(list_init(&list, entry_width) != 0)
    {
        printf("Could not initialize list.\n");
        return 1;
    }

    char text[20];
    const uint8_t count = 10;
    uint8_t i = 0;
    while(i < count)
    {
        snprintf(text, 20, "Test: %" PRIu8, i);
        printf("Pushing: %s\n", text);

        if(list_push(&list, text) != 0)
        {
            printf("Could not push item.\n");
            return 2;
        }
    
        i++;
    }

    printf("\n");

    // NOTE: For efficiency, this is a reference to within the list. If you
    //       want a copy, make a copy. If you want to make sure this is thread-
    //       safe, use a lock.
    void *retrieved;
    if((retrieved = list_get(&list, 5)) == NULL)
    {
        printf("Could not retrieve item.\n");
        return 3;
    }

    printf("Retrieved: %s\n", (char *)retrieved);
    printf("Removing.\n");

    if(list_remove(&list, 5) != 0)
    {
        printf("Could not remove item.\n");
        return 4;
    }

    printf("\n");
    printf("Enumerating:\n");

    if(list_enumerate(&list, enumerate_cb, NULL) != 0)
    {
        printf("Could not enumerate list.\n");
        return 5;
    }

    if(list_destroy(&list) != 0)
    {
        printf("Could not destroy list.\n");
        return 6;
    }

    return 0;
}
예제 #4
0
파일: breakpoint.c 프로젝트: jdm/megazeux
void foreach_watchpoint(struct world *mzx_world, const char *counter, enumerate_func func)
{
  struct watchpoint wp = { counter };
  list_enumerate(mzx_world->debug_watch.watchpoints, func, &wp);
}
예제 #5
0
파일: breakpoint.c 프로젝트: jdm/megazeux
void foreach_breakpoint(struct world *mzx_world, struct robot *cur_robot, enumerate_func func)
{
  struct breakpoint bp = { cur_robot, 0 };
  list_enumerate(mzx_world->debug_watch.breakpoints, func, &bp);
}
예제 #6
0
파일: omgidl.c 프로젝트: spchamp/ilu
int main(int argc, char* argv[])
{
  char *filename;
  extern FILE* idlin;
  extern int idl_flex_debug;
  list defs;
  list toplevel_prefix; /* Current prefix for repository ID. */
  int i;

  search_list = iluparser_new_list ();

  for (i = 1; i < argc; i++){
    if (argv[i][0] != '-')
      break;
    switch (argv[i][1]){
    case 'a':
      idl_subset |= IDL_STYLE_GUIDE;
      break;
    case 'I':
      if (argv[i][2])
	list_insert (search_list, argv[i]+2);
      else
	list_insert (search_list, argv[++i]);
      break;
    case 'h':
    default:
      usage();
      break;
    }
  }
  if (i+1 != argc)
    usage();
  filename = argv[i];
	
  /* Open top-level IDL file. */
  init_types();
  idl_flex_debug=0;
  if ((idlin = fopen (filename, "r")) == NULL)
    {
      perror(argv[1]);
      exit(1);
    }

  /* Syntactical analysis */
  idlsetinitialfile(filename);
  if(idlparse())
    return 1;
  defs = the_result;

  /* Semantical analysis */

  /* join modules for re-opening */
  defs = reopen_modules (defs);
  /* backlink, toplevel has no parent */
  list_enumerate (defs, definition_backlink,0);
  /* resolve all names */
  list_enumerate (defs, definition_resolvenames, defs);
  /* perform consistency checks, compute constants */
  list_enumerate (defs, definition_check, defs);
  /* assign repository IDs */
  toplevel_prefix = iluparser_new_list ();
  list_push (toplevel_prefix, "");
  list_enumerate (defs, definition_setuid, toplevel_prefix);
  /* Test conformance with AB style guide */
  list_enumerate (defs, ab_style, 0);

  /* Drop all results :-) */
  return 0;
}