Beispiel #1
0
void cairo_mod_init_path(void)
{
  /*! @decl constant CAIRO_PATH_MOVE_TO
   *! @decl constant CAIRO_PATH_LINE_TO
   *! @decl constant CAIRO_PATH_CURVE_TO
   *! @decl constant CAIRO_PATH_CLOSE_PATH
   *!
   *! The various types of path elements in an Cairo path
   */
  ADD_INT_CONSTANT("CAIRO_PATH_MOVE_TO", CAIRO_PATH_MOVE_TO, 0);
  ADD_INT_CONSTANT("CAIRO_PATH_LINE_TO", CAIRO_PATH_LINE_TO, 0);
  ADD_INT_CONSTANT("CAIRO_PATH_CURVE_TO", CAIRO_PATH_CURVE_TO, 0);
  ADD_INT_CONSTANT("CAIRO_PATH_CLOSE_PATH", CAIRO_PATH_CLOSE_PATH, 0);

  /* Cairo.Path */
  start_new_program();
  {
    ADD_STORAGE(struct cairo_mod_path);
    ADD_FUNCTION("_get_iterator", f_path_get_iterator, tFunc(tVoid,tObj), ID_PUBLIC);
    set_init_callback(init_cairo_mod_path);
    set_exit_callback(exit_cairo_mod_path);
  }
  add_program_constant("Path",
                       cairo_mod_path_program = end_program(),
                       0);

  /* Cairo.PathElement */
  start_new_program();
  {
    ADD_STORAGE(struct cairo_mod_path_element);
    ADD_FUNCTION("get_type", f_path_element_get_type, tFunc(tNone,tInt), ID_PUBLIC);
    ADD_FUNCTION("get_point", f_path_element_get_point, tFunc(tInt, tMapping), ID_PUBLIC);
    ADD_FUNCTION("_sprintf", f_path_element_sprintf, tFunc(tInt tMapping, tStr), ID_STATIC);
    set_init_callback(init_cairo_mod_path_element);
    set_exit_callback(exit_cairo_mod_path_element);
  }
  add_program_constant("PathElement",
                       cairo_mod_path_element_program = end_program(),
                       0);

  /* Cairo.PathIterator */
  start_new_program();
  {
    ADD_STORAGE(struct cairo_mod_path_iterator);
    ADD_FUNCTION("`!", f_path_iterator_not_operator, tFunc(tVoid,tInt), ID_PUBLIC);
    ADD_FUNCTION("`+=", f_path_iterator_add_self, tFunc(tInt,tObj), ID_PUBLIC);
    ADD_FUNCTION("index", f_path_iterator_index, tFunc(tNone,tObj), ID_PUBLIC);
    ADD_FUNCTION("value", f_path_iterator_value, tFunc(tNone,tObj), ID_PUBLIC);
    ADD_FUNCTION("first", f_path_iterator_first, tFunc(tNone,tInt), ID_PUBLIC);
    ADD_FUNCTION("next", f_path_iterator_next, tFunc(tNone,tObj), ID_PUBLIC);
    set_init_callback(init_cairo_mod_path_iterator);
    set_exit_callback(exit_cairo_mod_path_iterator);
  }
  add_program_constant("PathIterator",
                       cairo_mod_path_iterator_program = end_program(),
                       0);
}
Beispiel #2
0
void init_stdio_port(void)
{
  ptrdiff_t offset;
  START_NEW_PROGRAM_ID (STDIO_PORT);
  offset = ADD_STORAGE(struct port);
  PIKE_MAP_VARIABLE("_accept_callback",
                    offset + OFFSETOF(port, accept_callback),
                    tMix, PIKE_T_MIXED, 0);
  PIKE_MAP_VARIABLE("_id",
                    offset + OFFSETOF(port, id), tMix, PIKE_T_MIXED, 0);
  /* function(int|string,void|mixed,void|string:int) */
  ADD_FUNCTION("bind", port_bind,
	       tFunc(tOr(tInt,tStr) tOr(tVoid,tMix) tOr(tVoid,tStr) tOr(tVoid,tInt),tInt), 0);
#ifdef HAVE_SYS_UN_H
  /* function(int|string,void|mixed,void|string:int) */
  ADD_FUNCTION("bind_unix", bind_unix,
               tFunc(tStr tOr(tVoid,tMix),tInt), ID_OPTIONAL);
#endif /* HAVE_SYS_UN_H */
  ADD_FUNCTION("close",port_close,tFunc(tNone,tVoid),0);
  /* function(int,void|mixed:int) */
  ADD_FUNCTION("listen_fd",port_listen_fd,tFunc(tInt tOr(tVoid,tMix),tInt),0);
  /* function(mixed:mixed) */
  ADD_FUNCTION("set_id",port_set_id,tFunc(tMix,tMix),0);
  /* function(:mixed) */
  ADD_FUNCTION("query_id",port_query_id,tFunc(tNone,tMix),0);
  /* function(:string) */
  ADD_FUNCTION("query_address",socket_query_address,tFunc(tNone,tStr),0);
  /* function(:int) */
  ADD_FUNCTION("errno",port_errno,tFunc(tNone,tInt),0);
  /* function(:object) */
  port_fd_factory_fun_num =
    ADD_FUNCTION("fd_factory", port_fd_factory, tFunc(tNone,tObjIs_STDIO_FD),
                 ID_PROTECTED);
  ADD_FUNCTION("accept",port_accept,tFunc(tNone,tObjIs_STDIO_FD),0);
  /* function(void|string|int,void|mixed,void|string:void) */
  ADD_FUNCTION("create", port_create,
	       tFunc(tOr3(tVoid,tStr,tInt) tOr(tVoid,tMix) tOr(tVoid,tStr),
		     tVoid), 0);
  ADD_FUNCTION ("set_backend", port_set_backend, tFunc(tObj,tVoid), 0);
  ADD_FUNCTION ("query_backend", port_query_backend, tFunc(tVoid,tObj), 0);
  ADD_FUNCTION ("query_fd", port_query_fd, tFunc(tVoid,tInt), 0);

#ifdef SO_REUSEPORT
  ADD_INT_CONSTANT( "SO_REUSEPORT_SUPPORT", SO_REUSEPORT, ID_OPTIONAL );
#endif
#ifdef TCP_FASTOPEN
  ADD_INT_CONSTANT( "TCP_FASTOPEN_SUPPORT", TCP_FASTOPEN, ID_OPTIONAL );
#endif
  set_init_callback(init_port_struct);
  set_exit_callback(exit_port_struct);

  port_program = end_program();
  add_program_constant( "_port", port_program, 0 );

}
Beispiel #3
0
void pike_module_init() {
	struct utsname utsname;
	char *p;
	uname(&utsname);
	if ((p = strchr (utsname.nodename, '.')))
		*p = 0;
	Hostname=strdup(utsname.nodename);
	Tempdir=(char *) LIBMUTT_TEMPDIR;

	ADD_INT_CONSTANT("M_READ",M_READ,0);
	ADD_INT_CONSTANT("M_REPLIED",M_REPLIED,0);
	ADD_INT_CONSTANT("M_OLD",M_OLD,0);
	ADD_INT_CONSTANT("M_FLAG",M_FLAG,0);
	ADD_INT_CONSTANT("M_DELETE",M_DELETE,0);
	ADD_INT_CONSTANT("M_TAG",M_TAG,0);
	ADD_INT_CONSTANT("M_NEW",M_NEW,0);

	/* constants for mx_check_mailbox() */
	ADD_INT_CONSTANT("M_NEW_MAIL",M_NEW_MAIL,0);
	ADD_INT_CONSTANT("M_REOPENED",M_REOPENED,0);
	ADD_INT_CONSTANT("M_FLAGS",M_FLAGS,0);

	start_new_program();
	 ADD_STORAGE(MAILSTORE_STORAGE);
	
	 set_init_callback(init_mailstore);
	 set_exit_callback(exit_mailstore);


	// public pike methods
	ADD_FUNCTION("create", f_create,
		tFunc(tString, tVoid), 0);
	ADD_FUNCTION("_sizeof", f__sizeof,
		tFunc(tVoid, tInt), 0);
	ADD_FUNCTION("stat", f_stat,
		tFunc(tVoid, tMapping), 0); 
	ADD_FUNCTION("get_header", f_get_header,
		tFunc(tInt, tMapping), 0);
	ADD_FUNCTION("debug", f_debug,
		tFunc(tInt, tInt), 0);
	ADD_FUNCTION("set_flag", f_set_flag,
		tFunc(tInt tInt, tVoid), 0);
	ADD_FUNCTION("reset_flag", f_reset_flag,
		tFunc(tInt tInt, tVoid), 0);
	ADD_FUNCTION("check_mailbox", f_check_mailbox,
		tFunc(tVoid, tInt), 0);

	/* Mailbox.Message */
	start_new_program();
 	  set_init_callback(init_message_storage);
	  set_exit_callback(exit_message_storage);
	  ADD_STORAGE( MESSAGE_STORAGE );
	  ADD_FUNCTION("create", f_msg_create,
			tFunc(tInt, tVoid), 0);
	  ADD_FUNCTION("getFD", f_msg_getfd,   
			tFunc(tVoid, tInt), 0);
	  ADD_FUNCTION("get_header",f_msg_get_header, 
			tFunc(tVoid, tMapping), 0);
	 end_class("Message",0);

	end_class("Mailbox",0);
	
	mutt_error=libmutt_error;
	/* reference it so that it's not optimized out */
	__dummy_variable[0] = (void*)NULL;
}
Beispiel #4
0
static void
add_constants (PyObject *m)
{
#define ADD_INT_CONSTANT(name) \
  PyModule_AddIntConstant (m, #name, OCFS2_ ## name)
#define ADD_STR_CONSTANT(name) \
  PyModule_AddStringConstant (m, #name, OCFS2_ ## name)

  ADD_INT_CONSTANT (SUPER_BLOCK_BLKNO);

  ADD_INT_CONSTANT (MIN_CLUSTERSIZE);
  ADD_INT_CONSTANT (MAX_CLUSTERSIZE);

  ADD_INT_CONSTANT (MIN_BLOCKSIZE);
  ADD_INT_CONSTANT (MAX_BLOCKSIZE);

  ADD_INT_CONSTANT (SUPER_MAGIC);

  ADD_STR_CONSTANT (SUPER_BLOCK_SIGNATURE);
  ADD_STR_CONSTANT (INODE_SIGNATURE);
  ADD_STR_CONSTANT (EXTENT_BLOCK_SIGNATURE);
  ADD_STR_CONSTANT (GROUP_DESC_SIGNATURE);

  ADD_INT_CONSTANT (VALID_FL);
  ADD_INT_CONSTANT (ORPHANED_FL);

  ADD_INT_CONSTANT (SYSTEM_FL);
  ADD_INT_CONSTANT (SUPER_BLOCK_FL);
  ADD_INT_CONSTANT (LOCAL_ALLOC_FL);
  ADD_INT_CONSTANT (BITMAP_FL);
  ADD_INT_CONSTANT (JOURNAL_FL);
  ADD_INT_CONSTANT (HEARTBEAT_FL);
  ADD_INT_CONSTANT (CHAIN_FL);

  ADD_INT_CONSTANT (JOURNAL_DIRTY_FL);
  
  ADD_INT_CONSTANT (ERROR_FS);

  ADD_INT_CONSTANT (MAX_FILENAME_LEN);

  ADD_INT_CONSTANT (MAX_SLOTS);

  ADD_INT_CONSTANT (INVALID_SLOT);

  ADD_INT_CONSTANT (VOL_UUID_LEN);
  ADD_INT_CONSTANT (MAX_VOL_LABEL_LEN);

  ADD_INT_CONSTANT (MIN_JOURNAL_SIZE);

  ADD_INT_CONSTANT (FIRST_ONLINE_SYSTEM_INODE);
  ADD_INT_CONSTANT (LAST_GLOBAL_SYSTEM_INODE);

  ADD_INT_CONSTANT (FT_UNKNOWN);
  ADD_INT_CONSTANT (FT_REG_FILE);
  ADD_INT_CONSTANT (FT_DIR);
  ADD_INT_CONSTANT (FT_CHRDEV);
  ADD_INT_CONSTANT (FT_BLKDEV);
  ADD_INT_CONSTANT (FT_FIFO);
  ADD_INT_CONSTANT (FT_SOCK);
  ADD_INT_CONSTANT (FT_SYMLINK);
  ADD_INT_CONSTANT (FT_MAX);

  ADD_INT_CONSTANT (LINK_MAX);

  ADD_INT_CONSTANT (FLAG_RO);
  ADD_INT_CONSTANT (FLAG_RW);
  ADD_INT_CONSTANT (FLAG_CHANGED);
  ADD_INT_CONSTANT (FLAG_DIRTY);
  ADD_INT_CONSTANT (FLAG_SWAP_BYTES);
  ADD_INT_CONSTANT (FLAG_BUFFERED);
  ADD_INT_CONSTANT (FLAG_NO_REV_CHECK);

  ADD_INT_CONSTANT (DIRENT_CHANGED);
  ADD_INT_CONSTANT (DIRENT_ABORT);
  ADD_INT_CONSTANT (DIRENT_ERROR);

  ADD_INT_CONSTANT (DIRENT_FLAG_INCLUDE_EMPTY);
  ADD_INT_CONSTANT (DIRENT_FLAG_INCLUDE_REMOVED);
  ADD_INT_CONSTANT (DIRENT_FLAG_EXCLUDE_DOTS);

#undef ADD_INT_CONSTANT
#undef ADD_STR_CONSTANT

#define ADD_INT_CONSTANT(name) \
  PyModule_AddIntConstant (m, #name, name)

  ADD_INT_CONSTANT (BAD_BLOCK_SYSTEM_INODE);
  ADD_INT_CONSTANT (GLOBAL_INODE_ALLOC_SYSTEM_INODE);
  ADD_INT_CONSTANT (SLOT_MAP_SYSTEM_INODE);
  ADD_INT_CONSTANT (HEARTBEAT_SYSTEM_INODE);
  ADD_INT_CONSTANT (GLOBAL_BITMAP_SYSTEM_INODE);
  ADD_INT_CONSTANT (ORPHAN_DIR_SYSTEM_INODE);
  ADD_INT_CONSTANT (EXTENT_ALLOC_SYSTEM_INODE);
  ADD_INT_CONSTANT (INODE_ALLOC_SYSTEM_INODE);
  ADD_INT_CONSTANT (JOURNAL_SYSTEM_INODE);
  ADD_INT_CONSTANT (LOCAL_ALLOC_SYSTEM_INODE);
  ADD_INT_CONSTANT (NUM_SYSTEM_INODES);

#undef ADD_INT_CONSTANT
}