コード例 #1
0
HPExport void plugin_init (void) {
	clif = GET_SYMBOL("clif");
	skill = GET_SYMBOL("skill");
	strlib = GET_SYMBOL("strlib");
	clif_sk_fail_original = clif->skill_fail;
	clif->skill_fail = SKM_skill_fail;
}
コード例 #2
0
ファイル: sample.c プロジェクト: Alvero/Hercules
/* run when server starts */
HPExport void plugin_init (void) {
	char *server_type;
	char *server_name;
	
	//get the symbols from the server
	server_type = GET_SYMBOL("SERVER_TYPE");
	server_name = GET_SYMBOL("SERVER_NAME");

	script = GET_SYMBOL("script");
		
	ShowInfo ("Server type is ");
	
	switch (*server_type) {
		case SERVER_TYPE_LOGIN: printf ("Login Server\n"); break;
		case SERVER_TYPE_CHAR: printf ("Char Server\n"); break;
		case SERVER_TYPE_MAP: printf ("Map Server\n"); break;
	}
	
	ShowInfo ("I'm being run from the '%s' filename\n", server_name);
	
	if( HPMi->addCommand != NULL ) {//link our '@sample' command
		HPMi->addCommand("sample",ACMD_A(sample));
	}
	
	if( HPMi->addScript != NULL ) {//link our 'sample' script command
		HPMi->addScript("sample","i",BUILDIN_A(sample));
	}
	
	if( HPMi->addCPCommand != NULL ) {//link our 'sample' console command
		HPMi->addCPCommand("this:is:a:sample",CPCMD_A(sample));
	}
}
コード例 #3
0
ファイル: HPMHooking.c プロジェクト: BlazingSpear/Hercules
HPExport bool Hooked (bool *fr) {
	HPMforce_return = fr;
	DB = GET_SYMBOL("DB");
	iMalloc = GET_SYMBOL("iMalloc");
#include "../plugins/HPMHooking/HPMHooking.GetSymbol.inc"
	HPM_HP_load();
	return true;
}
コード例 #4
0
ファイル: HPMHooking.c プロジェクト: LordRegent/Hercules
HPExport bool Hooked (bool *fr) {
	HPMforce_return = fr;
	DB = GET_SYMBOL("DB");
	iMalloc = GET_SYMBOL("iMalloc");
#include HPM_SYMBOL_INCLUDE
	HPM_HP_load();
	return true;
}
コード例 #5
0
ファイル: db2sql.c プロジェクト: Abunay01/Cronus
HPExport void plugin_init (void) {
	SQL = GET_SYMBOL("SQL");
	itemdb = GET_SYMBOL("itemdb");
	iMap = GET_SYMBOL("iMap");
	strlib = GET_SYMBOL("strlib");
	
	HPMi->addCPCommand("server:tools:db2sql",CPCMD_A(db2sql));
}
コード例 #6
0
ファイル: HPMHooking.c プロジェクト: kerbiii/Hercules
HPExport const char *Hooked (bool *fr) {
	HPMforce_return = fr;
	if (!(DB = GET_SYMBOL("DB"))) return "DB";
	if (!(iMalloc = GET_SYMBOL("iMalloc"))) return "iMalloc";
#include HPM_SYMBOL_INCLUDE
	HPM_HP_load();
	return NULL;
}
コード例 #7
0
ファイル: autonext.c プロジェクト: ossi0110/hpm-plugins
/* Server Startup */
HPExport void plugin_init (void) 
{
	clif = GET_SYMBOL("clif");
	script = GET_SYMBOL("script");

	if( HPMi->addScript != NULL ) 
	{
		HPMi->addScript("autonext","i",BUILDIN_A(autonext));
	}
}
コード例 #8
0
ファイル: partyscript.c プロジェクト: robertol/Cronus
/* Server Startup */
HPExport void plugin_init (void) {
	instance = GET_SYMBOL("instance");
    script = GET_SYMBOL("script");
	mapreg = GET_SYMBOL("mapreg");
	strlib = GET_SYMBOL("strlib");
	party = GET_SYMBOL("party");
	intif = GET_SYMBOL("intif");
    clif = GET_SYMBOL("clif");
	map = GET_SYMBOL("map");
	DB = GET_SYMBOL("DB");

	//Commands
	addAtcommand("partyoption",partyoption);
	addAtcommand("leaveparty",leaveparty);
	addAtcommand("party",party);
	
	//Scripts
	addScriptCommand("party_changeoption","iii",party_changeoption);
	addScriptCommand("party_changeleader","ii",party_changeleader);
	addScriptCommand("party_addmember","ii",party_addmember);
	addScriptCommand("party_delmember","?",party_delmember);
	addScriptCommand("party_create","s???",party_create);
	addScriptCommand("party_destroy","i",party_destroy);

	party->changeleader = party_changeleader_mine;
	party->reply_invite = party_reply_invite_mine;
	party->created = party_created_mine;
	party->create = party_create_mine;
};
コード例 #9
0
static int load_vivante_symbols(void *lib) {
    int error = 0;
    if (!(wr_fbGetDisplayByIndex = GET_SYMBOL(lib, "fbGetDisplayByIndex"))) {
        error++;
    }
    if (!(wr_fbCreateWindow = GET_SYMBOL(lib, "fbCreateWindow"))) {
        error++;
    }
    if (error != 0) {
        fprintf(stderr, "failed to load all Vivante symbols %d\n", error);
        return 1;
    }
    return error;
}
コード例 #10
0
ファイル: print1.c プロジェクト: hoelzl/Clicc
void print1(CL_FORM *base)
{
	LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(2));	/* T */
	BIND_SPECIAL(SYMBOL(Slisp, 474), ARG(2));	/* *PRINT-ESCAPE* */
	if(CL_TRUEP(ARG(1)))
	{
		if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 48))	/* T */
		{
			COPY(SYMVAL(Slisp, 59), ARG(1));	/* *TERMINAL-IO* */
		}
	}
	else
	{
		COPY(SYMVAL(Slisp, 61), ARG(1));	/* *STANDARD-OUTPUT* */
	}
	COPY(ARG(1), ARG(3));
	terpri1(ARG(3));
	COPY(ARG(0), ARG(3));
	COPY(ARG(1), ARG(4));
	write2(ARG(3));
	LOAD_CHAR(ARG(3), ' ', ARG(3));
	COPY(ARG(1), ARG(4));
	write_char1(ARG(3));
	mv_count = 1;
	RESTORE_SPECIAL;
}
コード例 #11
0
ファイル: lisp355.c プロジェクト: plops/clicc
static void Z124_lambda(CL_FORM *base)
{
	if(CL_SMSTRP(ARG(1)))
	{
		COPY(INDIRECT(GET_FORM(ARG(0)) + 4), ARG(2));
		COPY(INDIRECT(GET_FORM(ARG(0)) + 3), ARG(3));
		Ffuncall(ARG(2), 2);
		COPY(ARG(2), ARG(0));
	}
	else
	{
		if(CL_CONSP(ARG(1)))
		{
			COPY(GET_CAR(ARG(1)), ARG(2));
			if(CL_SYMBOLP(ARG(2)) && GET_SYMBOL(ARG(2)) == SYMBOL(Slisp, 255))	/* CHARACTER-SET */
			{
				LOAD_SYMBOL(SYMBOL(Slisp, 255), ARG(3));	/* CHARACTER-SET */
				COPY(INDIRECT(GET_FORM(ARG(0)) + 4), ARG(4));
				COPY(GET_CDR(ARG(1)), ARG(5));
				Ffuncall(ARG(4), 2);
				mv_count = 1;
				ALLOC_CONS(ARG(5), ARG(3), ARG(4), ARG(0));
			}
			else
			{
				COPY(ARG(1), ARG(0));
			}
		}
		else
		{
			COPY(ARG(1), ARG(0));
		}
	}
}
コード例 #12
0
ファイル: battleconf.c プロジェクト: Chocolate31/eamod
HPExport void plugin_init(void) {
	char *server_type;
	char *server_name;

	/* core vars */
	server_type = GET_SYMBOL("SERVER_TYPE");
	server_name = GET_SYMBOL("SERVER_NAME");

	/* core interfaces */
	iMalloc = GET_SYMBOL("iMalloc");

	/* map-server interfaces */
	strlib = GET_SYMBOL("strlib");

	/* session[] */
	session = GET_SYMBOL("session");}
コード例 #13
0
/**
 * We started!
 **/
HPExport void plugin_init (void) {

	/* thats all we need! */
	mob = GET_SYMBOL("mob");

	/* lets hook! */
	addHookPre("mob->setdropitem",mob_setdropitem_pre);
}
コード例 #14
0
ファイル: storeitem.c プロジェクト: eruvador/StaffPlugins
HPExport void plugin_init (void) {
	atcommand = GET_SYMBOL("atcommand");
	storage = GET_SYMBOL("storage");
	clif = GET_SYMBOL("clif");
	pc = GET_SYMBOL("pc");
	map = GET_SYMBOL("map");
	itemdb = GET_SYMBOL("itemdb");
	intif = GET_SYMBOL("intif");
	pet = GET_SYMBOL("pet");

	addAtcommand("storeitem",storeitem);
}
コード例 #15
0
ファイル: plugin.c プロジェクト: aleao-sl/groonga
static grn_rc
grn_plugin_initialize(grn_ctx *ctx, grn_plugin *plugin,
                      grn_dl dl, grn_id id, const char *path)
{
  plugin->dl = dl;

#define GET_SYMBOL(type) do {                                           \
  grn_dl_clear_error();                                                 \
  plugin->type ## _func = grn_dl_sym(dl, GRN_PLUGIN_FUNC_PREFIX #type); \
  if (!plugin->type ## _func) {                                         \
    const char *label;                                                  \
    label = grn_dl_sym_error_label();                                   \
    SERR("%s", label);                                                  \
  }                                                                     \
} while (0)

  GET_SYMBOL(init);
  GET_SYMBOL(register);
  GET_SYMBOL(fin);

#undef GET_SYMBOL

  if (!plugin->init_func || !plugin->register_func || !plugin->fin_func) {
    ERR(GRN_INVALID_FORMAT,
        "init func (%s) %sfound, "
        "register func (%s) %sfound and "
        "fin func (%s) %sfound",
        GRN_PLUGIN_FUNC_PREFIX "init", plugin->init_func ? "" : "not ",
        GRN_PLUGIN_FUNC_PREFIX "register", plugin->register_func ? "" : "not ",
        GRN_PLUGIN_FUNC_PREFIX "fin", plugin->fin_func ? "" : "not ");
  }

  if (!ctx->rc) {
    ctx->impl->plugin_path = path;
    grn_plugin_call_init(ctx, id);
    ctx->impl->plugin_path = NULL;
  }

  return ctx->rc;
}
コード例 #16
0
ファイル: native_webview.c プロジェクト: mjparme/openjdk-jfx
void init_functions(JNIEnv *env) {
    void *libandroid_webview = dlopen(LIBANDROID_WEBVIEW_SO, RTLD_LAZY | RTLD_GLOBAL);
    if (!libandroid_webview) {
        THROW_RUNTIME_EXCEPTION(env, "dlopen error: %s", dlerror());
    }

    _ANDROID_create_android_webview = GET_SYMBOL(env, libandroid_webview, "create_android_webview");
    _ANDROID_move_and_resize = GET_SYMBOL(env, libandroid_webview, "move_and_resize");
    _ANDROID_set_visible = GET_SYMBOL(env, libandroid_webview, "set_visible");
    _ANDROID_move_to_top = GET_SYMBOL(env, libandroid_webview, "move_to_top");
    _ANDROID_load_url = GET_SYMBOL(env, libandroid_webview, "load_url");
    _ANDROID_load_content = GET_SYMBOL(env, libandroid_webview, "load_content");
    _ANDROID_dispose = GET_SYMBOL(env, libandroid_webview, "dispose");
    _ANDROID_set_encoding = GET_SYMBOL(env, libandroid_webview, "set_encoding");
}
コード例 #17
0
static int load_egl_symbols(void *lib) {
    int error = 0;

    if (!(_eglGetDisplay = GET_SYMBOL(lib, "eglGetDisplay"))) {
        error++;
    }

    if (error) {
        // handle error conditions better ?
        fprintf(stderr, "failed to load all EGL symbols %d\n", error);
        return 1;
    }
    return 0;
}
コード例 #18
0
ファイル: lisp184.c プロジェクト: hoelzl/Clicc
void Fget_output_stream_string(CL_FORM *base)
{
	COPY(ARG(0), ARG(1));
	stream_type(ARG(1));
	if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 102))	/* STRING-OUTPUT */
	{
	}
	else
	{
		LOAD_SMSTR((CL_FORM *)&KClisp[268], ARG(1));	/* string-output-stream expected */
		Ferror(ARG(1), 1);
	}
	stream_extra(ARG(0));
	Ffuncall(ARG(0), 1);
}
コード例 #19
0
ファイル: cheats.c プロジェクト: minhlaingwin/CheatDevicePS2
void SetupERL()
{
    struct erl_record_t *erl;

    erl_add_global_symbol("GetSyscallHandler", (u32)GetSyscallHandler);
    erl_add_global_symbol("SetSyscall", (u32)SetSyscall);

    /* Install cheat engine ERL */
    erl = load_erl_from_mem_to_addr(_engine_erl_start, 0x00080000, 0, NULL);
    if(!erl)
    {
        printf("Error loading cheat engine ERL!\n");
        SleepThread();
    }

    erl->flags |= ERL_FLAG_CLEAR;
    FlushCache(0);

    printf("Installed cheat engine ERL. Getting symbols...\n");
    struct symbol_t *sym;
#define GET_SYMBOL(var, name) \
	sym = erl_find_local_symbol(name, erl); \
	if (sym == NULL) { \
		printf("%s: could not find symbol '%s'\n", __FUNCTION__, name); \
		SleepThread(); \
	} \
	printf("%08x %s\n", (u32)sym->address, name); \
	var = (typeof(var))sym->address

    GET_SYMBOL(get_max_hooks, "get_max_hooks");
    GET_SYMBOL(get_num_hooks, "get_num_hooks");
    GET_SYMBOL(add_hook, "add_hook");
    GET_SYMBOL(clear_hooks, "clear_hooks");
    GET_SYMBOL(get_max_codes, "get_max_codes");
    GET_SYMBOL(set_max_codes, "set_max_codes");
    GET_SYMBOL(get_num_codes, "get_num_codes");
    GET_SYMBOL(add_code, "add_code");
    GET_SYMBOL(clear_codes, "clear_codes");

    printf("Symbols loaded.\n");
}
コード例 #20
0
ファイル: tetra.c プロジェクト: Alfandorachk/Tetra
void patch(void)
{
    TTR_Node *node, *stored;
    int type;

    SET_GLOBAL_SCOPE();
    for (   node = dll_pop_head(call_patch_list);
            node != NULL;
            node = dll_pop_head(call_patch_list)) {
        stored = GET_SYMBOL(N_STR(node));    
        if (stored == NULL) {
            fprintf(stderr, "<Line %d> Function \"%s\" never defined\n",
                    N_LINE(node), N_STR(node));
            err_exit("Fatal error");
        } else {
            N_DTYPE(node) = N_DTYPE(stored);
            if (COMPARE_TYPES(N_CHILD(stored, 0), N_CHILD(node, 0))) {
                fprintf(stderr, 
                        "<Line %d> Incompatible types in call to %s.\n",
                        N_LINE(node), N_STR(node));
                err_exit("Fatal error");
            }
        }
    }

    for (   node = dll_pop_head(var_patch_list);
            node != NULL;
            node = dll_pop_head(var_patch_list)) {
        SET_GLOBAL_SCOPE();
        ENTER_SCOPE(N_SCOPE(node));
        if (N_TYPE(node) == N_ASSIGN) {
            TTR_set_ident_data_type(symbol_table,
                    N_CHILD(node, 0), N_DTYPE(N_CHILD(node, 1)));
        }
        type = TTR_infer_data_type(node);
        if (type == INVALID_T) {
            fprintf(stderr, "<Line %d> Incompatible types.\n",
                    N_LINE(node));
            err_exit("Fatal error");
        } else if (type == UNDEFINED_T) {
            fprintf(stderr, "<Line %d> Unknown symbol.\n", N_LINE(node));
            print_tree(node, 0);
            err_exit("Fatal error");
        }
    }

}
コード例 #21
0
ファイル: lisp89.c プロジェクト: hoelzl/Clicc
void read_delimited_list1(CL_FORM *base)
{
	CL_FORM *display[1];
	if(CL_TRUEP(ARG(1)))
	{
		if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 48))	/* T */
		{
			COPY(SYMVAL(Slisp, 59), ARG(1));	/* *TERMINAL-IO* */
		}
	}
	else
	{
		COPY(SYMVAL(Slisp, 60), ARG(1));	/* *STANDARD-INPUT* */
	}
	display[0] = ARG(0);
	Z48_read_rest(ARG(3), display);
	COPY(ARG(3), ARG(0));
}
コード例 #22
0
ファイル: fresh_line1.c プロジェクト: hoelzl/Clicc
void fresh_line1(CL_FORM *base)
{
	if(CL_TRUEP(ARG(0)))
	{
		if(CL_SYMBOLP(ARG(0)) && GET_SYMBOL(ARG(0)) == SYMBOL(Slisp, 48))	/* T */
		{
			COPY(SYMVAL(Slisp, 59), ARG(0));	/* *TERMINAL-IO* */
		}
	}
	else
	{
		COPY(SYMVAL(Slisp, 61), ARG(0));	/* *STANDARD-OUTPUT* */
	}
	COPY(ARG(0), ARG(1));
	COPY(ARG(1), ARG(2));
	COPY(ARG(2), ARG(3));
	LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(4));	/* STREAM */
	rt_struct_typep(ARG(3));
	if(CL_TRUEP(ARG(3)))
	{
		COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 5 + 1), ARG(1));
	}
	else
	{
		COPY(SYMVAL(Slisp, 352), ARG(1));	/* NO_STRUCT */
		LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(3));	/* STREAM */
		Ferror(ARG(1), 3);
	}
	Ffuncall(ARG(1), 1);
	mv_count = 1;
	if(CL_FIXNUMP(ARG(1)) && GET_FIXNUM(ARG(1)) == 0)
	{
		LOAD_NIL(ARG(0));
	}
	else
	{
		LOAD_CHAR(ARG(1), '\n', ARG(1));
		COPY(ARG(0), ARG(2));
		write_char1(ARG(1));
		COPY(ARG(1), ARG(0));
	}
}
コード例 #23
0
PrologServiceClass * load_plugin_service_class (char * directory, char * name) {
	char command [256];
#ifdef LINUX_OPERATING_SYSTEM
#ifdef MAC_OPERATING_SYSTEM
	sprintf (command, "%s%s.mdll", directory, name);
#else
	sprintf (command, "%s%s.so", directory, name);
#endif
#endif
#ifdef WINDOWS_OPERATING_SYSTEM
	sprintf (command, "%s%s.dll", directory, name);
#endif
	THREAD dll = DLL_OPEN (command);
	if (dll == NULL) return NULL;
	service_class_creator create_service_class = (service_class_creator) GET_SYMBOL (dll, "create_service_class");
	if (! create_service_class) {
		DLL_CLOSE (dll);
		return NULL;
	}
	return create_service_class ();
}
コード例 #24
0
ファイル: costumeitem.c プロジェクト: FrydRT/Server
/* Server Startup */
HPExport void plugin_init (void) {
	clif = GET_SYMBOL("clif");
	pet = GET_SYMBOL("pet");
	script = GET_SYMBOL("script");
	map = GET_SYMBOL("map");
	logs = GET_SYMBOL("logs");
	itemdb = GET_SYMBOL("itemdb");
	pc = GET_SYMBOL("pc");

		//Hook
	addHookPre("map->reqnickdb",HPM_map_reqnickdb);
	addHookPost("pc->equippoint",HPM_pc_equippoint);
	
		//atCommand
	addAtcommand("costumeitem",costumeitem);

		//scriptCommand
	addScriptCommand("costume","i",costume);
};
コード例 #25
0
ファイル: gensym1.c プロジェクト: hoelzl/Clicc
void gensym1(CL_FORM *base)
{
	if(CL_TRUEP(ARG(0)))
	{
		LOAD_FIXNUM(ARG(2), 0, ARG(2));
		if(CL_FIXNUMP(ARG(0)) && GET_FIXNUM(ARG(0)) >= GET_FIXNUM(ARG(2)))
		{
			COPY(ARG(0), SYMVAL(Slisp, 662));	/* *GENSYM-COUNTER* */
		}
		else
		{
			COPY(ARG(0), ARG(1));
			Fstringp(ARG(1));
			if(CL_TRUEP(ARG(1)))
			{
				COPY(ARG(0), SYMVAL(Slisp, 674));	/* *GENSYM-PREFIX* */
			}
			else
			{
				LOAD_SMSTR((CL_FORM *)&Kgensym1[0], ARG(1));	/* positive integer or string expected */
				Ferror(ARG(1), 1);
			}
		}
	}
	LOAD_SYMBOL(SYMBOL(Slisp, 44), ARG(1));	/* STRING */
	COPY(SYMVAL(Slisp, 674), ARG(2));	/* *GENSYM-PREFIX* */
	COPY(SYMVAL(Slisp, 662), ARG(3));	/* *GENSYM-COUNTER* */
	LOAD_FIXNUM(ARG(4), 10, ARG(4));
	LOAD_SYMBOL(SYMBOL(Slisp, 18), ARG(5));	/* CHARACTER */
	LOAD_NIL(ARG(6));
	LOAD_NIL(ARG(7));
	LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(8));	/* T */
	LOAD_FIXNUM(ARG(9), 0, ARG(9));
	LOAD_NIL(ARG(10));
	LOAD_FIXNUM(ARG(11), 0, ARG(11));
	LOAD_NIL(ARG(12));
	LOAD_NIL(ARG(13));
	LOAD_NIL(ARG(14));
	make_array1(ARG(4));
	make_string_output_stream1(ARG(4));
	COPY(ARG(3), ARG(5));
	COPY(ARG(4), ARG(6));
	prin11(ARG(5));
	COPY(ARG(4), ARG(5));
	LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(6));	/* STREAM */
	rt_struct_typep(ARG(5));
	if(CL_TRUEP(ARG(5)))
	{
		COPY(OFFSET(AR_BASE(GET_FORM(ARG(4))), 0 + 1), ARG(5));
	}
	else
	{
		COPY(SYMVAL(Slisp, 352), ARG(5));	/* NO_STRUCT */
		COPY(ARG(4), ARG(6));
		LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(7));	/* STREAM */
		Ferror(ARG(5), 3);
	}
	if(CL_SYMBOLP(ARG(5)) && GET_SYMBOL(ARG(5)) == SYMBOL(Slisp, 102))	/* STRING-OUTPUT */
	{
	}
	else
	{
		LOAD_SMSTR((CL_FORM *)&KClisp[268], ARG(5));	/* string-output-stream expected */
		Ferror(ARG(5), 1);
	}
	COPY(ARG(4), ARG(5));
	COPY(ARG(5), ARG(6));
	COPY(ARG(6), ARG(7));
	LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(8));	/* STREAM */
	rt_struct_typep(ARG(7));
	if(CL_TRUEP(ARG(7)))
	{
		COPY(OFFSET(AR_BASE(GET_FORM(ARG(6))), 1 + 1), ARG(5));
	}
	else
	{
		COPY(SYMVAL(Slisp, 352), ARG(5));	/* NO_STRUCT */
		LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(7));	/* STREAM */
		Ferror(ARG(5), 3);
	}
	Ffuncall(ARG(5), 1);
	mv_count = 1;
	COPY(ARG(5), ARG(3));
	Fconcatenate(ARG(1), 3);
	Fmake_symbol(ARG(1));
	COPY(SYMVAL(Slisp, 662), ARG(2));	/* *GENSYM-COUNTER* */
	F1plus(ARG(2));
	COPY(ARG(2), SYMVAL(Slisp, 662));	/* *GENSYM-COUNTER* */
	COPY(ARG(1), ARG(0));
}
コード例 #26
0
ファイル: Ftypep.c プロジェクト: hoelzl/Clicc
void Ftypep(CL_FORM *base)
{
	if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 48))	/* T */
	{
		LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
	}
	else
	{
		if(CL_TRUEP(ARG(1)))
		{
			if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 23))	/* FIXNUM */
			{
				if(CL_FIXNUMP(ARG(0)))
				{
					COPY(SYMVAL(Slisp, 1), ARG(2));	/* MOST-NEGATIVE-FIXNUM */
					COPY(ARG(0), ARG(3));
					COPY(SYMVAL(Slisp, 0), ARG(4));	/* MOST-POSITIVE-FIXNUM */
					Fle(ARG(2), 3);
					COPY(ARG(2), ARG(0));
				}
				else
				{
					LOAD_NIL(ARG(0));
				}
			}
			else
			{
				LOAD_BOOL(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 24), ARG(2));	/* FLOAT */
				if(CL_TRUEP(ARG(2)))
				{
					goto THEN1;
				}
				else
				{
					LOAD_BOOL(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 37), ARG(3));	/* SHORT-FLOAT */
					if(CL_TRUEP(ARG(3)))
					{
						goto THEN1;
					}
					else
					{
						LOAD_BOOL(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 42), ARG(4));	/* SINGLE-FLOAT */
						if(CL_TRUEP(ARG(4)))
						{
							goto THEN1;
						}
						else
						{
							LOAD_BOOL(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 22), ARG(5));	/* DOUBLE-FLOAT */
							if(CL_TRUEP(ARG(5)))
							{
								goto THEN1;
							}
							else
							{
							}	/* LONG-FLOAT */
						}
					}
				}
				if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 29))
				{
					THEN1:;
					LOAD_BOOL(CL_FLOATP(ARG(0)), ARG(0));
				}
				else
				{
					LOAD_BOOL(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 18), ARG(2));	/* CHARACTER */
					if(CL_TRUEP(ARG(2)))
					{
						goto THEN2;
					}
					else
					{
					}	/* STANDARD-CHAR */
					if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 43))
					{
						THEN2:;
						LOAD_BOOL(CL_CHARP(ARG(0)), ARG(0));
					}
					else
					{
						if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 28))	/* LIST */
						{
							LOAD_BOOL(CL_LISTP(ARG(0)), ARG(0));
						}
						else
						{
							if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 31))	/* NULL */
							{
								if(CL_TRUEP(ARG(0)))
								{
									LOAD_NIL(ARG(0));
								}
								else
								{
									LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
								}
							}
							else
							{
								if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 21))	/* CONS */
								{
									LOAD_BOOL(CL_CONSP(ARG(0)), ARG(0));
								}
								else
								{
									LOAD_SMSTR((CL_FORM *)&KClisp[86], ARG(2));	/* (TYPEP ~S ~S) is not implemented */
									COPY(ARG(0), ARG(3));
									COPY(ARG(1), ARG(4));
									Ferror(ARG(2), 3);
								}
							}
						}
					}
				}
			}
		}
		else
		{
			LOAD_NIL(ARG(0));
		}
	}
}
コード例 #27
0
ファイル: Fmap.c プロジェクト: hoelzl/Clicc
void Fmap(CL_FORM *base, int nargs)
{
	Flist(ARG(3), nargs - 3);
	ALLOC_CONS(ARG(6), ARG(2), ARG(3), ARG(3));
	LOAD_GLOBFUN(&CFmin, ARG(4));
	LOAD_GLOBFUN(&CFlength, ARG(5));
	COPY(ARG(3), ARG(6));
	Fmapcar(ARG(5), 2);
	Fapply(ARG(4), 2);
	mv_count = 1;
	LOAD_FIXNUM(ARG(5), 0, ARG(5));
	GEN_HEAPVAR(ARG(5), ARG(6));
	{
		GEN_CLOSURE(array, ARG(6), 4, Z146_get_elem, 1);
		COPY(ARG(5), &array[3]);
		LOAD_CLOSURE(array, ARG(6));
	}
	if(CL_TRUEP(ARG(0)))
	{
		if(CL_SYMBOLP(ARG(0)) && GET_SYMBOL(ARG(0)) == SYMBOL(Slisp, 28))	/* LIST */
		{
			LOAD_NIL(ARG(7));
			LOAD_NIL(ARG(8));
			ALLOC_CONS(ARG(9), ARG(7), ARG(8), ARG(7));
			M1_1:;
			COPY(INDIRECT(ARG(5)), ARG(8));
			COPY(ARG(4), ARG(9));
			Fge(ARG(8), 2);
			if(CL_TRUEP(ARG(8)))
			{
				COPY(GET_CAR(ARG(7)), ARG(0));
				goto RETURN1;
			}
			COPY(ARG(1), ARG(8));
			COPY(ARG(6), ARG(9));
			COPY(ARG(3), ARG(10));
			Fmaplist(ARG(9), 2);
			Fapply(ARG(8), 2);
			mv_count = 1;
			COPY(ARG(7), ARG(9));
			add_q(ARG(8));
			COPY(INDIRECT(ARG(5)), ARG(8));
			F1plus(ARG(8));
			COPY(ARG(8), INDIRECT(ARG(5)));
			goto M1_1;
			RETURN1:;
		}
		else
		{
			COPY(ARG(0), ARG(7));
			COPY(ARG(4), ARG(8));
			LOAD_NIL(ARG(9));
			LOAD_NIL(ARG(10));
			make_sequence1(ARG(7));
			M2_1:;
			COPY(INDIRECT(ARG(5)), ARG(8));
			COPY(ARG(4), ARG(9));
			Fge(ARG(8), 2);
			if(CL_TRUEP(ARG(8)))
			{
				COPY(ARG(7), ARG(0));
				goto RETURN2;
			}
			COPY(ARG(7), ARG(8));
			COPY(INDIRECT(ARG(5)), ARG(9));
			COPY(ARG(1), ARG(10));
			COPY(ARG(6), ARG(11));
			COPY(ARG(3), ARG(12));
			Fmaplist(ARG(11), 2);
			Fapply(ARG(10), 2);
			mv_count = 1;
			COPY(ARG(10), ARG(11));
			COPY(ARG(8), ARG(12));
			COPY(ARG(9), ARG(13));
			Fset_elt(ARG(11));
			COPY(INDIRECT(ARG(5)), ARG(8));
			F1plus(ARG(8));
			COPY(ARG(8), INDIRECT(ARG(5)));
			goto M2_1;
			RETURN2:;
		}
	}
	else
	{
		M3_1:;
		COPY(INDIRECT(ARG(5)), ARG(7));
		COPY(ARG(4), ARG(8));
		Fge(ARG(7), 2);
		if(CL_TRUEP(ARG(7)))
		{
			LOAD_NIL(ARG(0));
			goto RETURN3;
		}
		COPY(ARG(1), ARG(7));
		COPY(ARG(6), ARG(8));
		COPY(ARG(3), ARG(9));
		Fmaplist(ARG(8), 2);
		Fapply(ARG(7), 2);
		mv_count = 1;
		COPY(INDIRECT(ARG(5)), ARG(7));
		F1plus(ARG(7));
		COPY(ARG(7), INDIRECT(ARG(5)));
		goto M3_1;
		RETURN3:;
	}
}
コード例 #28
0
ファイル: kdb5.c プロジェクト: aosm/Kerberos
static krb5_error_code
kdb_load_library(krb5_context kcontext, char *lib_name, db_library * lib)
{
    krb5_error_code status;
    void   *vftabl_addr = NULL;
    char    buf[KRB5_MAX_ERR_STR];

    if (!strcmp("kdb_db2", lib_name) && (kdb_db2_pol_err_loaded == 0)) {
	initialize_adb_error_table();
	kdb_db2_pol_err_loaded = 1;
    }

    *lib = calloc((size_t) 1, sizeof(**lib));
    if (*lib == NULL) {
	status = ENOMEM;
	goto clean_n_exit;
    }

    status = kdb_init_lib_lock(*lib);
    if (status) {
	goto clean_n_exit;
    }

    strcpy((*lib)->name, lib_name);

#if !defined(KDB5_USE_LIB_KDB_DB2) && !defined(KDB5_USE_LIB_TEST)
#error No database module defined
#endif

#ifdef KDB5_USE_LIB_KDB_DB2
    if (strcmp(lib_name, "kdb_db2") == 0) {
	DEF_SYMBOL(kdb_db2);
	vftabl_addr = (void *) &GET_SYMBOL(kdb_db2);
    } else
#endif
#ifdef KDB5_USE_LIB_TEST
    if (strcmp(lib_name, "test") == 0) {
	DEF_SYMBOL(test);
	vftabl_addr = (void *) &GET_SYMBOL(test);
    } else
#endif
    {
	sprintf(buf, "Program not built to support %s database type\n",
		lib_name);
	status = KRB5_KDB_DBTYPE_NOSUP;
	krb5_db_set_err(kcontext, krb5_err_have_str, status, buf);
	goto clean_n_exit;
    }

    memcpy(&(*lib)->vftabl, vftabl_addr, sizeof(kdb_vftabl));

    kdb_setup_opt_functions(*lib);

    if ((status = (*lib)->vftabl.init_library())) {
	/* ERROR. library not initialized cleanly */
	sprintf(buf, "%s library initialization failed, error code %ld\n",
		lib_name, status);
	status = KRB5_KDB_DBTYPE_INIT;
	krb5_db_set_err(kcontext, krb5_err_have_str, status, buf);
	goto clean_n_exit;
    }

  clean_n_exit:
    if (status) {
	free(*lib), *lib = NULL;
    }
    return status;
}
コード例 #29
0
ファイル: lisp381.c プロジェクト: plops/clicc
void Penumerate_directories(CL_FORM *base)
{
	M1_1:;
	if(CL_TRUEP(ARG(1)))
	{
		if(CL_CONSP(ARG(1)))
		{
			COPY(GET_CAR(ARG(1)), ARG(5));
		}
		else
		{
			LOAD_SMSTR((CL_FORM *)&KClisp[239], ARG(5));	/* ~a is not a list */
			COPY(ARG(1), ARG(6));
			Ferror(ARG(5), 2);
		}
		if(CL_SMSTRP(ARG(5)))
		{
			LOAD_SYMBOL(SYMBOL(Slisp, 44), ARG(6));	/* STRING */
			COPY(ARG(0), ARG(7));
			COPY(ARG(5), ARG(8));
			LOAD_SMSTR((CL_FORM *)&KPenumerate_directories[0], ARG(9));	/* / */
			Fconcatenate(ARG(6), 4);
			if(CL_CONSP(ARG(1)))
			{
				COPY(GET_CDR(ARG(1)), ARG(7));
			}
			else
			{
				LOAD_SMSTR((CL_FORM *)&KClisp[241], ARG(7));	/* ~a is not a list */
				COPY(ARG(1), ARG(8));
				Ferror(ARG(7), 2);
			}
			COPY(ARG(6), ARG(0));
			COPY(ARG(7), ARG(1));
			LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(3));	/* T */
			goto M1_1;
		}
		else
		{
			if(CL_SYMBOLP(ARG(5)) && GET_SYMBOL(ARG(5)) == SYMBOL(Slisp, 265))	/* UP */
			{
				LOAD_SYMBOL(SYMBOL(Slisp, 44), ARG(6));	/* STRING */
				COPY(ARG(0), ARG(7));
				LOAD_SMSTR((CL_FORM *)&KPenumerate_directories[2], ARG(8));	/* ../ */
				Fconcatenate(ARG(6), 3);
				if(CL_CONSP(ARG(1)))
				{
					COPY(GET_CDR(ARG(1)), ARG(7));
				}
				else
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[241], ARG(7));	/* ~a is not a list */
					COPY(ARG(1), ARG(8));
					Ferror(ARG(7), 2);
				}
				COPY(ARG(6), ARG(0));
				COPY(ARG(7), ARG(1));
				LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(3));	/* T */
				goto M1_1;
			}
			else
			{
				LOAD_SMSTR((CL_FORM *)&KPenumerate_directories[4], ARG(0));	/* etypecase: the value ~a is not a legal value */
				COPY(ARG(5), ARG(1));
				Ferror(ARG(0), 2);
			}
		}
	}
	else
	{
		COPY(ARG(2), ARG(1));
		LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(2));	/* T */
		COPY(ARG(4), ARG(3));
		Penumerate_files(ARG(0));
	}
	goto RETURN1;
	RETURN1:;
}
コード例 #30
0
ファイル: lisp355.c プロジェクト: plops/clicc
static void Z122_check_for(CL_FORM *base)
{
	COPY(ARG(1), ARG(2));
	LOAD_SYMBOL(SYMBOL(Slisp, 248), ARG(3));	/* PATTERN */
	rt_struct_typep(ARG(2));
	if(CL_TRUEP(ARG(2)))
	{
		LOAD_NIL(ARG(2));
		COPY(ARG(1), ARG(3));
		pattern_pieces(ARG(3));
		M1_1:;
		if(CL_ATOMP(ARG(3)))
		{
			LOAD_NIL(ARG(2));
			COPY(ARG(2), ARG(0));
			goto RETURN1;
		}
		COPY(ARG(3), ARG(4));
		COPY(GET_CAR(ARG(4)), ARG(2));
		if(CL_SMSTRP(ARG(2)))
		{
			COPY(ARG(0), ARG(4));
			COPY(ARG(2), ARG(5));
			Z122_check_for(ARG(4));
			bool_result = CL_TRUEP(ARG(4));
		}
		else
		{
			if(CL_CONSP(ARG(2)))
			{
				if(CL_CONSP(ARG(1)))
				{
					COPY(GET_CAR(ARG(1)), ARG(4));
				}
				else
				{
					if(CL_TRUEP(ARG(1)))
					{
						LOAD_SMSTR((CL_FORM *)&KClisp[239], ARG(4));	/* ~a is not a list */
						COPY(ARG(1), ARG(5));
						Ferror(ARG(4), 2);
					}
					else
					{
						COPY(ARG(1), ARG(4));
					}
				}
				if(CL_SYMBOLP(ARG(4)) && GET_SYMBOL(ARG(4)) == SYMBOL(Slisp, 255))	/* CHARACTER-SET */
				{
					COPY(ARG(0), ARG(5));
					if(CL_CONSP(ARG(1)))
					{
						COPY(GET_CDR(ARG(1)), ARG(6));
					}
					else
					{
						if(CL_TRUEP(ARG(1)))
						{
							LOAD_SMSTR((CL_FORM *)&KClisp[241], ARG(6));	/* ~a is not a list */
							COPY(ARG(1), ARG(7));
							Ferror(ARG(6), 2);
						}
						else
						{
							COPY(ARG(1), ARG(6));
						}
					}
					Z122_check_for(ARG(5));
				}
				else
				{
					goto ELSE1;
				}
			}
			else
			{
				goto ELSE1;
			}
			bool_result = CL_TRUEP(ARG(5));
		}
		if(bool_result)
		{
			LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
			goto RETURN1;
		}
		ELSE1:;
		COPY(ARG(3), ARG(4));
		COPY(GET_CDR(ARG(4)), ARG(3));
		goto M1_1;
		RETURN1:;
	}
	else
	{
		if(CL_LISTP(ARG(1)))
		{
			LOAD_NIL(ARG(2));
			COPY(ARG(1), ARG(3));
			M2_1:;
			if(CL_ATOMP(ARG(3)))
			{
				LOAD_NIL(ARG(2));
				COPY(ARG(2), ARG(0));
				goto RETURN2;
			}
			COPY(ARG(3), ARG(4));
			COPY(GET_CAR(ARG(4)), ARG(2));
			COPY(ARG(0), ARG(4));
			COPY(ARG(2), ARG(5));
			Z122_check_for(ARG(4));
			if(CL_TRUEP(ARG(4)))
			{
				LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
				goto RETURN2;
			}
			COPY(ARG(3), ARG(4));
			COPY(GET_CDR(ARG(4)), ARG(3));
			goto M2_1;
			RETURN2:;
		}
		else
		{
			if(CL_SMSTRP(ARG(1)))
			{
				COPY(ARG(1), ARG(2));
				Flength(ARG(2));
				LOAD_SMALLFIXNUM(0, ARG(3));
				M3_1:;
				COPY(ARG(3), ARG(4));
				COPY(ARG(2), ARG(5));
				Fge(ARG(4), 2);
				if(CL_TRUEP(ARG(4)))
				{
					LOAD_NIL(ARG(0));
					goto RETURN3;
				}
				COPY(ARG(0), ARG(4));
				COPY(ARG(1), ARG(5));
				COPY(ARG(3), ARG(6));
				Fschar(ARG(5));
				Ffuncall(ARG(4), 2);
				mv_count = 1;
				if(CL_TRUEP(ARG(4)))
				{
					LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
					goto RETURN3;
				}
				F1plus(ARG(3));
				goto M3_1;
				RETURN3:;
			}
			else
			{
				if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 256))	/* UNSPECIFIC */
				{
					LOAD_NIL(ARG(0));
				}
				else
				{
					LOAD_SMSTR((CL_FORM *)&Kmaybe_diddle_case[0], ARG(0));	/* etypecase: the value ~a is not a legal value */
					Ferror(ARG(0), 2);
				}
			}
		}
	}
}