示例#1
0
文件: charneg.c 项目: nla/yaz
/* Return charset, lang, selected from negotiation.. Client side */
void yaz_get_response_charneg(NMEM mem, Z_CharSetandLanguageNegotiation *p,
                              char **charset, char **lang, int *selected)
{
    Z_TargetResponse *res = p->u.response;

    if (charset && res->which == Z_TargetResponse_private &&
        res->u.zprivate->which == Z_PrivateCharacterSet_externallySpecified)
    {
        Z_External *pext = res->u.zprivate->u.externallySpecified;

        if (pext->which == Z_External_octet)
        {
            *charset = (char *)
                nmem_malloc(mem, (1+pext->u.octet_aligned->len)*sizeof(char));
            memcpy(*charset, pext->u.octet_aligned->buf,
                   pext->u.octet_aligned->len);
            (*charset)[pext->u.octet_aligned->len] = 0;
        }
    }
    if (charset && res->which == Z_TargetResponse_iso10646)
        *charset = set_form(res->u.iso10646->encodingLevel);
    if (lang && res->selectedLanguage)
        *lang = nmem_strdup(mem, res->selectedLanguage);

    if (selected && res->recordsInSelectedCharSets)
        *selected = *res->recordsInSelectedCharSets;
}
示例#2
0
文件: handle.c 项目: RickPack/curl
SEXP R_handle_reset(SEXP ptr){
  //reset all fields
  reference *ref = get_ref(ptr);
  set_form(ref, NULL);
  set_headers(ref, NULL);
  curl_easy_reset(ref->handle);

  //restore default settings
  set_handle_defaults(ref);
  return ScalarLogical(1);
}
示例#3
0
文件: BIG2DEMO.C 项目: DrCoolzic/BIG2
/*! Initialization and main loop */
void main(void) {
	int evnt, quit = FALSE, flacc = FALSE;
	MFDB img;

	/* Initialiser */
	if(initial("BIG2DEMO.RSC", MENU, BUREAU, NUM_TREE,
				TRINDEX, FRSTR, NB_FENETRES, TITREACC)) {
		if(_app) set_bimg();			/* Set image on the desk */
		ptr_fonctions();
		set_form();
		load_fontspeedo();

		if(work_display.n_color >= 16)	/* if we are in color mode */
			relief();
		aide_en_ligne = K_CTRL;			/* Help-bubble with Control key */

		do {
			if((_app == ZERO) &&(NOT flacc)) {	
				acc_loop();
				flacc = TRUE;
			}	/* we are running as an accessory */

			evnt = dialog(DLG_DESK, adr_desk, TRUE, TRUE, PU_LIBRE, &img, FALSE);
			
			if(evnt & MU_MESAG)
				event_mesag(&flacc, &quit);
			
			if((evnt & MU_BUTTON) &&(buf[0] == BEV_FREEPU))
				event_freepu();
			
			if((evnt & MU_BUTTON) &&(buf[0] == BEV_WFORM))
				event_wform();
			
			if((evnt & MU_BUTTON) &&(buf[0] == BEV_WMENU))
				event_wmenu(&flacc);
			
			if((evnt & MU_BUTTON) &&(buf[0] == BEV_WHIER))
				event_whier();
			
			if((evnt & MU_BUTTON) &&(buf[0] == BEV_TOOL))
				event_tool();
			
			if((evnt & MU_BUTTON) &&(NOT wind_find(mx, my)))
				event_desk();
		} while(NOT quit);
		
		if(fgdos)
			vst_unload_fonts(work_display.handle, 0);
		end();
	}	/* init OK */
}	/* end of main */
示例#4
0
文件: wolf.c 项目: shentino/simud
void create() {
   object ob;
   ::create();
   set_gender( random(2)+1 );
/* OBJEDIT { */
   set_spd( 12 );
   set_con( 13 );
   set_str( 14 );
   set_dex( 15 );
   set_wil( 10 );
   set_cha( 3 );
   set_int( 4 );
   set_emp( 3 );
   set_distant( "a wolf" );
   set_specific( "the wolf" );
   set_look( "~Name ~verbhas gray fur, penetrating yellow eyes, and a generally surly disposition. ~Pron is $(HP)." );
   set_plural( "wolves" );
   set_name( "wolf" );
   set_type( "wolf" );
   set_droppable( 1 );
   set_weight( 45000 );
/* } OBJEDIT */

   set_living_name( name );

   set_food(query_food_capacity()/2);
   set_drink(query_drink_capacity()/2);

   add_form("animal");
   set_form("animal", 1);
   remove_form("brawl");

   set_race("canine");
   set_wc((["piercing":6]));
   set_wimpy(30);

   /*
   set_env_var( "skin_type", "/monsters/skin/wolf_pelt" );
   set_env_var( "meat_type", "/monsters/meat/wolf" );
   */
   set_product_aspect( C_WOLF );
   add_product( C_MEAT, 3, 40 );
   add_product( C_PELT, 7, 20 );
   // add_product( C_TOOTH, 4, 40 );

   clone_object("/ai/carnivore")->move(this_object());
   ob = clone_object("/ai/aggro");
   ob->set_aggro_level(10);
   ob->move(this_object());
}
示例#5
0
文件: deer.c 项目: shentino/simud
void create() {
   ::create();
   set_gender( random(2)+1 );
/* OBJEDIT { */
   set_spd( 9 );
   set_con( 8 );
   set_str( 9 );
   set_dex( 10 );
   set_wil( 8 );
   set_cha( 9 );
   set_int( 5 );
   set_emp( 7 );
   set_type( "animal" );
/* } OBJEDIT */

   set_living_name( name );

   set_food(query_food_capacity());
   set_drink(query_drink_capacity());

   /*
   set_env_var( "skin_type", "/monsters/skin/deer_skin" );
   */
   set_product_aspect( C_DEER );
   add_product( C_MEAT, 8, 20 );
   //add_product( C_GREASE, 2, 30 );
   //add_product( C_BONE, 4, 20 );
   //add_product( C_HORN, 2, 10 );
   add_product( C_PELT, 10, 20 );

   add_form("animal");
   set_form("animal", 1);
   remove_form("brawl");

   set_race("bovine");
   set_wc((["blunt":4]));
   set_wimpy(90);

   use_ai_module( "forage" );
}
示例#6
0
TModalLayout::TModalLayout(TEventWindow *ew, pchar caption, int type /*= ML_STANDARD*/)
: m_dlg(ew,*this,caption,type), m_released(false)
{
		set_form(&m_dlg);
}
示例#7
0
文件: handle.c 项目: RickPack/curl
SEXP R_handle_setform(SEXP ptr, SEXP form){
  if(!isVector(form))
    error("Form must be a list.");
  set_form(get_ref(ptr), make_form(form));
  return ScalarLogical(1);
}
示例#8
0
文件: charneg.c 项目: nla/yaz
/* Get charsets, langs, selected from negotiation.. Server side */
void yaz_get_proposal_charneg(NMEM mem, Z_CharSetandLanguageNegotiation *p,
                              char ***charsets, int *num_charsets,
                              char ***langs, int *num_langs, int *selected)
{
    int i;
    Z_OriginProposal *pro = p->u.proposal;

    if (num_charsets && charsets)
    {
        if (pro->num_proposedCharSets)
        {
            *num_charsets = pro->num_proposedCharSets;

            (*charsets) = (char **)
                nmem_malloc(mem, pro->num_proposedCharSets * sizeof(char *));

            for (i = 0; i < pro->num_proposedCharSets; i++)
            {
                (*charsets)[i] = 0;

                if (pro->proposedCharSets[i]->which ==
                    Z_OriginProposal_0_private &&
                    pro->proposedCharSets[i]->u.zprivate->which ==
                    Z_PrivateCharacterSet_externallySpecified)
                {
                    Z_External *pext =
                        pro->proposedCharSets[i]->u.zprivate->u.externallySpecified;

                    if (pext->which == Z_External_octet)
                    {
                        (*charsets)[i] = (char *)
                            nmem_malloc(mem, (1+pext->u.octet_aligned->len) *
                                        sizeof(char));

                        memcpy((*charsets)[i], pext->u.octet_aligned->buf,
                               pext->u.octet_aligned->len);
                        (*charsets)[i][pext->u.octet_aligned->len] = 0;
                    }
                }
                else if (pro->proposedCharSets[i]->which ==
                         Z_OriginProposal_0_iso10646)
                    (*charsets)[i] = set_form(
                        pro->proposedCharSets[i]->u.iso10646->encodingLevel);
            }
        }
        else
            *num_charsets = 0;
    }

    if (langs && num_langs)
    {
        if (pro->num_proposedlanguages)
        {
            *num_langs = pro->num_proposedlanguages;

            (*langs) = (char **)
                nmem_malloc(mem, pro->num_proposedlanguages * sizeof(char *));

            for (i = 0; i < pro->num_proposedlanguages; i++)
                (*langs)[i] = nmem_strdup(mem, pro->proposedlanguages[i]);
        }
        else
            *num_langs = 0;
    }

    if (pro->recordsInSelectedCharSets && selected)
        *selected = *pro->recordsInSelectedCharSets;
}