void mips1::init(int ac, char *av[]) {
  extern char* appfilename;
  initCache();
  ac_init_opt( ac, av);
  ac_init_app( ac, av);
  APP_MEM->load(appfilename);
  set_args(ac_argc, ac_argv);
#ifdef AC_VERIFY
  set_queue(av[0]);
#endif

  ac_pc = ac_start_addr;
  ISA._behavior_begin();
  cerr << "ArchC: -------------------- Starting Simulation --------------------" << endl;
  InitStat();

  hazard_count = 0;
  memset(hazard_count_by_type, 0, sizeof(hazard_count_by_type));

  signal(SIGINT, sigint_handler);
  signal(SIGTERM, sigint_handler);
  signal(SIGSEGV, sigsegv_handler);
  signal(SIGUSR1, sigusr1_handler);
#ifdef USE_GDB
  signal(SIGUSR2, sigusr2_handler);
#endif
#ifndef AC_COMPSIM
  set_running();
#else
  void Execute(int argc, char *argv[]);
  Execute(argc, argv);
#endif
}
Beispiel #2
0
void mips1::init() {
  set_args(ac_argc, ac_argv);
#ifdef AC_VERIFY
  set_queue(av[0]);
#endif

  ISA._behavior_begin();
  cerr << "ArchC: -------------------- Starting Simulation --------------------" << endl;
  InitStat();

  signal(SIGINT, sigint_handler);
  signal(SIGTERM, sigint_handler);
  signal(SIGSEGV, sigsegv_handler);
  signal(SIGUSR1, sigusr1_handler);
#ifdef USE_GDB
  signal(SIGUSR2, sigusr2_handler);
#endif
#ifndef AC_COMPSIM
  set_running();
#else
  ac_pc = 0;
  void Execute(int argc, char *argv[]);
  Execute(argc, argv);
#endif
}
static gboolean
hippo_block_netflix_movie_update_from_xml (HippoBlock           *block,
                                           HippoDataCache       *cache,
                                           LmMessageNode        *node)
{
    HippoBlockNetflixMovie *block_netflix = HIPPO_BLOCK_NETFLIX_MOVIE(block);
    LmMessageNode *netflix_node, *queue_node;
    LmMessageNode *child_node;
    HippoPerson *user;
    const char *description = NULL;
    const char *image_url = NULL;
    GSList *queue = NULL;

    if (!HIPPO_BLOCK_CLASS(hippo_block_netflix_movie_parent_class)->update_from_xml(block, cache, node))
        return FALSE;

    if (!hippo_xml_split(cache, node, NULL,
                         "netflixMovie", HIPPO_SPLIT_NODE, &netflix_node,
                         "description", HIPPO_SPLIT_STRING | HIPPO_SPLIT_ELEMENT | HIPPO_SPLIT_OPTIONAL, &description,
                         NULL))
        return FALSE;

    /* The imageUrl should be on the netflixMovie node, but we have to keep it on the
     * queue node in what the server sends for a while for compatibility purposes,
     * so we support it in either location.
     */
    if (!hippo_xml_split(cache, netflix_node, NULL,
                         "queue", HIPPO_SPLIT_NODE, &queue_node,
                         "userId", HIPPO_SPLIT_PERSON, &user,
                         "imageUrl", HIPPO_SPLIT_STRING | HIPPO_SPLIT_OPTIONAL, &image_url,
                         NULL))
        return FALSE;
    
    if (image_url == NULL) {
        if (!hippo_xml_split(cache, queue_node, NULL, 
                             "imageUrl", HIPPO_SPLIT_STRING, &image_url,
                             NULL))
            return FALSE;
    }
        
    for (child_node = queue_node->children; child_node; child_node = child_node->next) {
       HippoNetflixMovie *movie;        
       if (strcmp(child_node->name, "movie") != 0)
           continue;
       movie = hippo_netflix_movie_new_from_xml(cache, child_node);
       if (movie != NULL)
           queue = g_slist_prepend(queue, movie);
    }

    queue = g_slist_reverse(queue);

    set_description(block_netflix, description);
    set_image_url(block_netflix, image_url);
    set_queue(block_netflix, queue);

    hippo_block_abstract_person_set_user(HIPPO_BLOCK_ABSTRACT_PERSON(block_netflix), user);
    
    return TRUE;
}
static void
hippo_block_netflix_movie_dispose(GObject *object)
{
    HippoBlockNetflixMovie *block_netflix = HIPPO_BLOCK_NETFLIX_MOVIE(object);

    set_queue(block_netflix, NULL);
    
    G_OBJECT_CLASS(hippo_block_netflix_movie_parent_class)->dispose(object);
}