diff --git a/Building Syphon.rtf b/Building Syphon.rtf new file mode 100644 index 0000000..7119201 --- /dev/null +++ b/Building Syphon.rtf @@ -0,0 +1,10 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320 +{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;} +{\colortbl;\red255\green255\blue255;\red0\green0\blue0;} +\deftab560 +\pard\tx560\pardeftab560\ql\qnatural\pardirnatural + +\f0\fs22 \cf2 \CocoaLigature0 We support custom framework builds with unique class names to allow the framework to be embedded in a plugin without conflict with any other loaded instances.\ + \ + To create a custom build, set SYPHON_UNIQUE_CLASS_NAME_PREFIX=MyPrefix in the Preprocessor Macros (GCC_PREPROCESSOR_DEFINITIONS) build setting.\ +} \ No newline at end of file diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000..244e5c4 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,1663 @@ +# Doxyfile 1.7.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = Syphon + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = "1.0 Beta" + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = "/SVN Repositories/v002/Syphon/Documentation" + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. The create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = "/SVN Repositories/v002/Syphon/Syphon Framework/build/Debug/Syphon.framework/Versions/A/Headers" + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.vhd \ + *.vhdl + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the stylesheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = NO + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvances is that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = SYPHON_CLIENT_UNIQUE_CLASS_NAME=SyphonClient \ + SYPHON_SERVER_DIRECTORY_UNIQUE_CLASS_NAME=SyphonServerDirectory \ + SYPHON_SERVER_UNIQUE_CLASS_NAME=SyphonServer + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = NO + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans.ttf + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/DoxygenLayout.xml b/DoxygenLayout.xml new file mode 100644 index 0000000..260e418 --- /dev/null +++ b/DoxygenLayout.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/English.lproj/InfoPlist.strings b/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..88f65cf --- /dev/null +++ b/English.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/Exported_Symbols.exp b/Exported_Symbols.exp new file mode 100755 index 0000000..ddf6002 --- /dev/null +++ b/Exported_Symbols.exp @@ -0,0 +1,45 @@ +// +// Exported Symbols.exp +// Syphon +// +// Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY +// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// +// This file gets passed through the C preprocessor before it is used + + +SYPHON_UNIQUE_CLASS_SYMBOL(SyphonClient) +SYPHON_UNIQUE_CLASS_SYMBOL(SyphonServer) +SYPHON_UNIQUE_CLASS_SYMBOL(SyphonServerDirectory) +SYPHON_UNIQUE_CLASS_SYMBOL(SyphonImage) + +_SyphonServerAnnounceNotification +_SyphonServerDescriptionAppNameKey +_SyphonServerDescriptionIconKey +_SyphonServerDescriptionNameKey +_SyphonServerDescriptionUUIDKey +_SyphonServerOptionIsPrivate +_SyphonServerRetireNotification +_SyphonServerUpdateNotification diff --git a/Info.plist b/Info.plist new file mode 100644 index 0000000..2fa7340 --- /dev/null +++ b/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + info.v002.${PRODUCT_NAME:rfc1034Identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSPrincipalClass + + + diff --git a/License.txt b/License.txt new file mode 100644 index 0000000..7e72306 --- /dev/null +++ b/License.txt @@ -0,0 +1,29 @@ +Syphon Framework License: + +Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +* Neither the name of the Syphon Project nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/Syphon.h b/Syphon.h new file mode 100644 index 0000000..d8cefb0 --- /dev/null +++ b/Syphon.h @@ -0,0 +1,184 @@ +/* + Syphon.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SyphonServerDirectory.h" +#import "SyphonServer.h" +#import "SyphonClient.h" +#import "SyphonImage.h" + +/*! \mainpage Syphon Framework + @section intro_sec Developing with Syphon + + + + @section introduction Developing with Syphon + + The Syphon framework provides the classes necessary to add Syphon support to your application. SyphonServer is used to make frames available to other applications. SyphonServerDirectory is used to discover available servers. SyphonClient is used to connect to and receive frames from a SyphonServer. + + The framework requires MacOS X 10.6 or later. Syphon makes use of IOSurface, which is a 10.6-only technology. Syphon takes advantage of other 10.6 features such as blocks, and is compatible with garbage-collection. + + To include Syphon in your application, follow these steps: + +
    +
  1. Add the framework to your Xcode project.

    +

    The simplest way is to drag it to the Linked Frameworks group in the project window.

  2. +
  3. Link your application with Syphon at build time.

    +

    Add the framework to the Link Binary With Libraries build stage of your application's target.

  4. +
  5. Copy the framework into your application's bundle.

    +

    Add a new Copy Files build phase to your application's target.
    + Get Info on the build phase and select Frameworks as the destination.
    + Drag the Syphon framework into the build phase.

  6. +
  7. Import the headers.

    +

    #import <Syphon/Syphon.h> in any file where you want to use Syphon classes.

  8. +
+ + @section servers Servers + + Class documentation: SyphonServer + + Create a server: + + @code + SyphonServer *myServer = [[SyphonServer alloc] initWithName:@"My Output" context:myContext options:nil]; + @endcode + + and then publish new frames (you can also use GL_TEXTURE_2D textures): + + @code + [myServer publishFrameTexture:myTex textureTarget:GL_TEXTURE_RECTANGLE_EXT imageRegion:NSMakeRect(0, 0, width, height) textureDimensions:NSMakeSize(width, height) flipped:NO]; + @endcode + + Alternatively there are methods to bind and unbind the server to the OpenGL context, so you can draw into it directly. + You can publish new frames as often as you like, but if you only publish when you have a frame different from the previous one, then clients can do less work. + You must stop the server when you are finished with it: + + @code + [myServer stop]; + @endcode + + @section finding-servers Finding Servers + + Class documentation: SyphonServerDirectory + + SyphonServerDirectory handles server discovery for you. You can get an array of dictionaries describing available servers: + + @code + NSArray *available = [[SyphonServerDirectory sharedDirectory] servers]; + @endcode + + The servers property can be observed for changes, or you can register to receive the notifications posted by SyphonServerDirectory. + + Server description dictionaries are used by Syphon when you create a client, and also contain information you can use to describe available servers in your UI: + + @code + [myMenuItem setTitle:[description objectForKey:SyphonServerDescriptionNameKey]]; + @endcode + + @section clients Clients + + Class documentation: SyphonClient, SyphonImage + + Usually you create a client with a server description dictionary you obtained from SyphonServerDirectory: + + @code + SyphonClient *myClient = [[SyphonClient alloc] initWithServerDescription:description options:nil newFrameHandler:^(SyphonClient *client) { + [myView setNeedsDisplay:YES]; + }]; + @endcode + + The new-frame handler is optional: you can pass in nil. Here we use it to tell a view it needs to draw whenever the client receives a frame. + + When you are ready to draw: + + @code + SyphonImage *myFrame = [myClient newFrameImageForContext:cgl_ctx]; + if (myFrame) + { + GLuint tex = myFrame.textureName; + NSSize dimensions = myFrame.textureSize; + + // YOUR OPENGL DRAWING CODE HERE + + [myFrame release]; + } + @endcode + + As with servers, you must stop the client when you are finished with it: + + @code + [myClient stop]; + @endcode + + @section plugins Syphon.framework in a Plugin + + If you are using Syphon in any sort of plugin, please download the framework source and compile a version of the framework with unique class names. This avoids class-name conflicts if another plugin or the host application also embeds the Syphon framework. The framework source is set up to make this easy for you: you just need to change one build setting. + +
    +
  1. Open the framework's Xcode project.

    +

    +
  2. +
  3. Define SYPHON_UNIQUE_CLASS_NAME_PREFIX using the Preprocessor Macros build setting.

    +

    Select the Syphon target in the project window.
    + Get Info on the target, and click the Build tab to display the build settings.
    + Scroll down (or use the search field) to find the Preprocessor Macros (GCC_PREPROCESSOR_DEFINITIONS) setting.
    + Double click the setting to add SYPHON_UNIQUE_CLASS_NAME_PREFIX=MyPluginName as a macro. +

  4. +
  5. Build the framework.

    +

    The built framework will have custom class names. The headers alias the custom names, so you can use SyphonServer, SyphonClient, SyphonImage and SyphonServerDirectory as normal in your code.
    +

  6. +
+ + @section help More examples and help + + Example projects implementing a server and client are included with the Syphon SDK. You can also examine the source to the provided Syphon implementations at their Google Code project. + + Use the Syphon developer forum to ask questions, and for any development related discussion. + + Good luck! + + @section framework_dev Framework development + + If you'd like to examine the framework's source code, report a bug, or get involved in development, head on over to the Syphon framework Google Code project. + + */ \ No newline at end of file diff --git a/Syphon.xcodeproj/project.pbxproj b/Syphon.xcodeproj/project.pbxproj new file mode 100644 index 0000000..b1589ec --- /dev/null +++ b/Syphon.xcodeproj/project.pbxproj @@ -0,0 +1,723 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXAggregateTarget section */ + BD909C9612785ADE00CC898A /* Syphon Documentation */ = { + isa = PBXAggregateTarget; + buildConfigurationList = BD909C9C12785B0300CC898A /* Build configuration list for PBXAggregateTarget "Syphon Documentation" */; + buildPhases = ( + BD909C9512785ADE00CC898A /* ShellScript */, + ); + dependencies = ( + BD909C9B12785AE400CC898A /* PBXTargetDependency */, + ); + name = "Syphon Documentation"; + productName = "Syphon Documentation"; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 1B09069B11CB2FBD00BCBE41 /* IOSurface.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B09069A11CB2FBD00BCBE41 /* IOSurface.framework */; }; + 1B09069D11CB2FBD00BCBE41 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B09069C11CB2FBD00BCBE41 /* OpenGL.framework */; }; + 1B0906C111CBB0F500BCBE41 /* SyphonServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B0906BF11CBB0F500BCBE41 /* SyphonServer.m */; }; + 1B0906C711CBB1C100BCBE41 /* SyphonClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B0906C511CBB1C100BCBE41 /* SyphonClient.m */; }; + 1B0906C911CBB1CE00BCBE41 /* Syphon.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B0906C811CBB1CE00BCBE41 /* Syphon.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1B09098711CD9A1C00BCBE41 /* SyphonClientConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B09098511CD9A1C00BCBE41 /* SyphonClientConnectionManager.h */; settings = {ATTRIBUTES = (); }; }; + 1B09098811CD9A1C00BCBE41 /* SyphonClientConnectionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B09098611CD9A1C00BCBE41 /* SyphonClientConnectionManager.m */; }; + 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; + 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; + BD038877122EAB1A007725FF /* SyphonIOSurfaceImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BD038875122EAB1A007725FF /* SyphonIOSurfaceImage.h */; }; + BD038878122EAB1A007725FF /* SyphonIOSurfaceImage.m in Sources */ = {isa = PBXBuildFile; fileRef = BD038876122EAB1A007725FF /* SyphonIOSurfaceImage.m */; }; + BD038887122EABE2007725FF /* SyphonImage.m in Sources */ = {isa = PBXBuildFile; fileRef = BD038886122EABE2007725FF /* SyphonImage.m */; }; + BD27307611D2B85E0084BB5E /* SyphonPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BD27307511D2B85E0084BB5E /* SyphonPrivate.h */; }; + BD3796D211DD470D0042870B /* SyphonPrivate.m in Sources */ = {isa = PBXBuildFile; fileRef = BD3796CF11DD470D0042870B /* SyphonPrivate.m */; }; + BD45586211DF6BD300F15521 /* SyphonServerConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BD45585C11DF6BD300F15521 /* SyphonServerConnectionManager.h */; }; + BD45586311DF6BD300F15521 /* SyphonServerConnectionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BD45585D11DF6BD300F15521 /* SyphonServerConnectionManager.m */; }; + BD606D6911D2842D00E02702 /* SyphonServerDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = BD606D6711D2842D00E02702 /* SyphonServerDirectory.m */; }; + BDB8DA2F1211F59A0028D250 /* SyphonMessageReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = BDB8DA211211F5990028D250 /* SyphonMessageReceiver.h */; }; + BDB8DA301211F59A0028D250 /* SyphonMessageReceiver.m in Sources */ = {isa = PBXBuildFile; fileRef = BDB8DA221211F5990028D250 /* SyphonMessageReceiver.m */; }; + BDB8DA311211F59A0028D250 /* SyphonCFMessageReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = BDB8DA231211F5990028D250 /* SyphonCFMessageReceiver.h */; }; + BDB8DA321211F59A0028D250 /* SyphonCFMessageReceiver.m in Sources */ = {isa = PBXBuildFile; fileRef = BDB8DA241211F5990028D250 /* SyphonCFMessageReceiver.m */; }; + BDB8DA351211F59A0028D250 /* SyphonMessageSender.h in Headers */ = {isa = PBXBuildFile; fileRef = BDB8DA271211F5990028D250 /* SyphonMessageSender.h */; }; + BDB8DA361211F59A0028D250 /* SyphonMessageSender.m in Sources */ = {isa = PBXBuildFile; fileRef = BDB8DA281211F5990028D250 /* SyphonMessageSender.m */; }; + BDB8DA371211F59A0028D250 /* SyphonCFMessageSender.h in Headers */ = {isa = PBXBuildFile; fileRef = BDB8DA291211F5990028D250 /* SyphonCFMessageSender.h */; }; + BDB8DA381211F59A0028D250 /* SyphonCFMessageSender.m in Sources */ = {isa = PBXBuildFile; fileRef = BDB8DA2A1211F59A0028D250 /* SyphonCFMessageSender.m */; }; + BDB8DAF51211FA7F0028D250 /* SyphonMessaging.h in Headers */ = {isa = PBXBuildFile; fileRef = BDB8DAF31211FA7F0028D250 /* SyphonMessaging.h */; }; + BDB8DAF61211FA7F0028D250 /* SyphonMessaging.m in Sources */ = {isa = PBXBuildFile; fileRef = BDB8DAF41211FA7F0028D250 /* SyphonMessaging.m */; }; + BDFBD77D126F4D8800075A23 /* SyphonDispatch.h in Headers */ = {isa = PBXBuildFile; fileRef = BDFBD77B126F4D8800075A23 /* SyphonDispatch.h */; }; + BDFBD77E126F4D8800075A23 /* SyphonDispatch.c in Sources */ = {isa = PBXBuildFile; fileRef = BDFBD77C126F4D8800075A23 /* SyphonDispatch.c */; }; + E2DE7FD312495BF50081453B /* SyphonMessageQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = E2DE7FD112495BF50081453B /* SyphonMessageQueue.h */; }; + E2DE7FD412495BF50081453B /* SyphonMessageQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = E2DE7FD212495BF50081453B /* SyphonMessageQueue.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + BD909C9A12785AE400CC898A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = Syphon; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 1B09069A11CB2FBD00BCBE41 /* IOSurface.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOSurface.framework; path = System/Library/Frameworks/IOSurface.framework; sourceTree = SDKROOT; }; + 1B09069C11CB2FBD00BCBE41 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; }; + 1B0906BE11CBB0F500BCBE41 /* SyphonServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonServer.h; sourceTree = ""; wrapsLines = 1; }; + 1B0906BF11CBB0F500BCBE41 /* SyphonServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonServer.m; sourceTree = ""; }; + 1B0906C411CBB1C100BCBE41 /* SyphonClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonClient.h; sourceTree = ""; wrapsLines = 1; }; + 1B0906C511CBB1C100BCBE41 /* SyphonClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonClient.m; sourceTree = ""; }; + 1B0906C811CBB1CE00BCBE41 /* Syphon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Syphon.h; sourceTree = ""; wrapsLines = 1; }; + 1B09098511CD9A1C00BCBE41 /* SyphonClientConnectionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonClientConnectionManager.h; sourceTree = ""; }; + 1B09098611CD9A1C00BCBE41 /* SyphonClientConnectionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonClientConnectionManager.m; sourceTree = ""; }; + 32DBCF5E0370ADEE00C91783 /* Syphon_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Syphon_Prefix.pch; sourceTree = ""; }; + 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8DC2EF5B0486A6940098B216 /* Syphon.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Syphon.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BD038870122EA9FF007725FF /* SyphonImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonImage.h; sourceTree = ""; }; + BD038875122EAB1A007725FF /* SyphonIOSurfaceImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonIOSurfaceImage.h; sourceTree = ""; }; + BD038876122EAB1A007725FF /* SyphonIOSurfaceImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonIOSurfaceImage.m; sourceTree = ""; }; + BD038886122EABE2007725FF /* SyphonImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonImage.m; sourceTree = ""; }; + BD1718201224308200CB2E18 /* Exported_Symbols.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = Exported_Symbols.exp; sourceTree = ""; }; + BD27307511D2B85E0084BB5E /* SyphonPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonPrivate.h; sourceTree = ""; }; + BD3796CF11DD470D0042870B /* SyphonPrivate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonPrivate.m; sourceTree = ""; }; + BD45585C11DF6BD300F15521 /* SyphonServerConnectionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonServerConnectionManager.h; sourceTree = ""; }; + BD45585D11DF6BD300F15521 /* SyphonServerConnectionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonServerConnectionManager.m; sourceTree = ""; }; + BD606D6611D2842D00E02702 /* SyphonServerDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonServerDirectory.h; sourceTree = ""; wrapsLines = 1; }; + BD606D6711D2842D00E02702 /* SyphonServerDirectory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonServerDirectory.m; sourceTree = ""; }; + BD8BFECA122C1A2A0015B2BE /* Building Syphon.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = "Building Syphon.rtf"; sourceTree = ""; }; + BD909AA21277BF9D00CC898A /* doxygen.config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = doxygen.config; sourceTree = ""; }; + BDB8DA211211F5990028D250 /* SyphonMessageReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonMessageReceiver.h; sourceTree = ""; }; + BDB8DA221211F5990028D250 /* SyphonMessageReceiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonMessageReceiver.m; sourceTree = ""; }; + BDB8DA231211F5990028D250 /* SyphonCFMessageReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonCFMessageReceiver.h; sourceTree = ""; }; + BDB8DA241211F5990028D250 /* SyphonCFMessageReceiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonCFMessageReceiver.m; sourceTree = ""; }; + BDB8DA251211F5990028D250 /* SyphonMachMessageReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonMachMessageReceiver.h; sourceTree = ""; }; + BDB8DA261211F5990028D250 /* SyphonMachMessageReceiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonMachMessageReceiver.m; sourceTree = ""; }; + BDB8DA271211F5990028D250 /* SyphonMessageSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonMessageSender.h; sourceTree = ""; }; + BDB8DA281211F5990028D250 /* SyphonMessageSender.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonMessageSender.m; sourceTree = ""; }; + BDB8DA291211F5990028D250 /* SyphonCFMessageSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonCFMessageSender.h; sourceTree = ""; }; + BDB8DA2A1211F59A0028D250 /* SyphonCFMessageSender.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonCFMessageSender.m; sourceTree = ""; }; + BDB8DA2B1211F59A0028D250 /* SyphonMachMessageSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonMachMessageSender.h; sourceTree = ""; }; + BDB8DA2C1211F59A0028D250 /* SyphonMachMessageSender.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonMachMessageSender.m; sourceTree = ""; }; + BDB8DAF31211FA7F0028D250 /* SyphonMessaging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonMessaging.h; sourceTree = ""; }; + BDB8DAF41211FA7F0028D250 /* SyphonMessaging.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonMessaging.m; sourceTree = ""; }; + BDCB92AF127A3C9A00C9E06E /* doxygen.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = doxygen.css; sourceTree = ""; }; + BDCB92B0127A3C9A00C9E06E /* footer.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = footer.html; sourceTree = ""; }; + BDCB92B1127A3C9A00C9E06E /* header.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = header.html; sourceTree = ""; }; + BDCB9399127ADEBF00C9E06E /* DoxygenLayout.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = DoxygenLayout.xml; sourceTree = ""; }; + BDFBD77B126F4D8800075A23 /* SyphonDispatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonDispatch.h; sourceTree = ""; }; + BDFBD77C126F4D8800075A23 /* SyphonDispatch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SyphonDispatch.c; sourceTree = ""; }; + BDFE68091228684F009C2E21 /* SyphonBuildMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonBuildMacros.h; sourceTree = ""; }; + D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + E2DE7FD112495BF50081453B /* SyphonMessageQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyphonMessageQueue.h; sourceTree = ""; }; + E2DE7FD212495BF50081453B /* SyphonMessageQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyphonMessageQueue.m; sourceTree = ""; }; + E2F73E34127CE2D300240AE6 /* index.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = index.html; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DC2EF560486A6940098B216 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, + 1B09069B11CB2FBD00BCBE41 /* IOSurface.framework in Frameworks */, + 1B09069D11CB2FBD00BCBE41 /* OpenGL.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 034768DFFF38A50411DB9C8B /* Products */ = { + isa = PBXGroup; + children = ( + BDCB93DE127AE42C00C9E06E /* FrameworkDocumentation */, + BDCB949A127AE42C00C9E06E /* info.v002.syphon.docs.docset */, + 8DC2EF5B0486A6940098B216 /* Syphon.framework */, + ); + name = Products; + sourceTree = ""; + }; + 0867D691FE84028FC02AAC07 /* OpenVideoTap */ = { + isa = PBXGroup; + children = ( + BD8BFECA122C1A2A0015B2BE /* Building Syphon.rtf */, + 08FB77AEFE84172EC02AAC07 /* Classes */, + 32C88DFF0371C24200C91783 /* Other Sources */, + 089C1665FE841158C02AAC07 /* Resources */, + BDCB92AE127A3C7200C9E06E /* Documentation */, + 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, + 034768DFFF38A50411DB9C8B /* Products */, + ); + name = OpenVideoTap; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */, + 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 /* Resources */ = { + isa = PBXGroup; + children = ( + BD1718201224308200CB2E18 /* Exported_Symbols.exp */, + 8DC2EF5A0486A6940098B216 /* Info.plist */, + 089C1666FE841158C02AAC07 /* InfoPlist.strings */, + ); + name = Resources; + sourceTree = ""; + }; + 08FB77AEFE84172EC02AAC07 /* Classes */ = { + isa = PBXGroup; + children = ( + BD27304C11D2B3BB0084BB5E /* Public Headers */, + BD27306E11D2B7B70084BB5E /* Private Shared */, + 1B0906C311CBB10000BCBE41 /* Client */, + 1B0906C211CBB0FB00BCBE41 /* Server */, + BD8BFD5C122BF8C40015B2BE /* Server Directory */, + BD057EE912307B3B0024694B /* Image */, + 1B09098411CD99F900BCBE41 /* Communication */, + ); + name = Classes; + sourceTree = ""; + }; + 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1B09069C11CB2FBD00BCBE41 /* OpenGL.framework */, + 1B09069A11CB2FBD00BCBE41 /* IOSurface.framework */, + 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 0867D6A5FE840307C02AAC07 /* AppKit.framework */, + D2F7E79907B2D74100F64583 /* CoreData.framework */, + 0867D69BFE84028FC02AAC07 /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 1B0906C211CBB0FB00BCBE41 /* Server */ = { + isa = PBXGroup; + children = ( + 1B0906BF11CBB0F500BCBE41 /* SyphonServer.m */, + BD45585C11DF6BD300F15521 /* SyphonServerConnectionManager.h */, + BD45585D11DF6BD300F15521 /* SyphonServerConnectionManager.m */, + ); + name = Server; + sourceTree = ""; + }; + 1B0906C311CBB10000BCBE41 /* Client */ = { + isa = PBXGroup; + children = ( + 1B0906C511CBB1C100BCBE41 /* SyphonClient.m */, + 1B09098511CD9A1C00BCBE41 /* SyphonClientConnectionManager.h */, + 1B09098611CD9A1C00BCBE41 /* SyphonClientConnectionManager.m */, + ); + name = Client; + sourceTree = ""; + }; + 1B09098411CD99F900BCBE41 /* Communication */ = { + isa = PBXGroup; + children = ( + BDB8DAF31211FA7F0028D250 /* SyphonMessaging.h */, + BDB8DAF41211FA7F0028D250 /* SyphonMessaging.m */, + BDB8DA211211F5990028D250 /* SyphonMessageReceiver.h */, + BDB8DA221211F5990028D250 /* SyphonMessageReceiver.m */, + BDB8DA271211F5990028D250 /* SyphonMessageSender.h */, + BDB8DA281211F5990028D250 /* SyphonMessageSender.m */, + E2DE7FD712495F360081453B /* Messaging Internal */, + ); + name = Communication; + sourceTree = ""; + }; + 32C88DFF0371C24200C91783 /* Other Sources */ = { + isa = PBXGroup; + children = ( + BDFE68091228684F009C2E21 /* SyphonBuildMacros.h */, + 32DBCF5E0370ADEE00C91783 /* Syphon_Prefix.pch */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + BD057EE912307B3B0024694B /* Image */ = { + isa = PBXGroup; + children = ( + BD038886122EABE2007725FF /* SyphonImage.m */, + BD038875122EAB1A007725FF /* SyphonIOSurfaceImage.h */, + BD038876122EAB1A007725FF /* SyphonIOSurfaceImage.m */, + ); + name = Image; + sourceTree = ""; + }; + BD27304C11D2B3BB0084BB5E /* Public Headers */ = { + isa = PBXGroup; + children = ( + 1B0906C811CBB1CE00BCBE41 /* Syphon.h */, + 1B0906BE11CBB0F500BCBE41 /* SyphonServer.h */, + 1B0906C411CBB1C100BCBE41 /* SyphonClient.h */, + BD038870122EA9FF007725FF /* SyphonImage.h */, + BD606D6611D2842D00E02702 /* SyphonServerDirectory.h */, + ); + name = "Public Headers"; + sourceTree = ""; + }; + BD27306E11D2B7B70084BB5E /* Private Shared */ = { + isa = PBXGroup; + children = ( + BD27307511D2B85E0084BB5E /* SyphonPrivate.h */, + BD3796CF11DD470D0042870B /* SyphonPrivate.m */, + BDFBD77B126F4D8800075A23 /* SyphonDispatch.h */, + BDFBD77C126F4D8800075A23 /* SyphonDispatch.c */, + ); + name = "Private Shared"; + sourceTree = ""; + }; + BD8BFD5C122BF8C40015B2BE /* Server Directory */ = { + isa = PBXGroup; + children = ( + BD606D6711D2842D00E02702 /* SyphonServerDirectory.m */, + ); + name = "Server Directory"; + sourceTree = ""; + }; + BDCB92AE127A3C7200C9E06E /* Documentation */ = { + isa = PBXGroup; + children = ( + BDCB92AF127A3C9A00C9E06E /* doxygen.css */, + BDCB9399127ADEBF00C9E06E /* DoxygenLayout.xml */, + BDCB92B0127A3C9A00C9E06E /* footer.html */, + BDCB92B1127A3C9A00C9E06E /* header.html */, + BD909AA21277BF9D00CC898A /* doxygen.config */, + ); + name = Documentation; + sourceTree = ""; + }; + BDCB93DE127AE42C00C9E06E /* FrameworkDocumentation */ = { + isa = PBXGroup; + children = ( + E2F73E34127CE2D300240AE6 /* index.html */, + ); + path = FrameworkDocumentation; + sourceTree = BUILT_PRODUCTS_DIR; + }; + BDCB949A127AE42C00C9E06E /* info.v002.syphon.docs.docset */ = { + isa = PBXGroup; + children = ( + ); + path = info.v002.syphon.docs.docset; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E2DE7FD712495F360081453B /* Messaging Internal */ = { + isa = PBXGroup; + children = ( + BDB8DA231211F5990028D250 /* SyphonCFMessageReceiver.h */, + BDB8DA241211F5990028D250 /* SyphonCFMessageReceiver.m */, + BDB8DA251211F5990028D250 /* SyphonMachMessageReceiver.h */, + BDB8DA261211F5990028D250 /* SyphonMachMessageReceiver.m */, + BDB8DA291211F5990028D250 /* SyphonCFMessageSender.h */, + BDB8DA2A1211F59A0028D250 /* SyphonCFMessageSender.m */, + BDB8DA2B1211F59A0028D250 /* SyphonMachMessageSender.h */, + BDB8DA2C1211F59A0028D250 /* SyphonMachMessageSender.m */, + E2DE7FD112495BF50081453B /* SyphonMessageQueue.h */, + E2DE7FD212495BF50081453B /* SyphonMessageQueue.m */, + ); + name = "Messaging Internal"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 8DC2EF500486A6940098B216 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 1B0906C911CBB1CE00BCBE41 /* Syphon.h in Headers */, + 1B09098711CD9A1C00BCBE41 /* SyphonClientConnectionManager.h in Headers */, + BD27307611D2B85E0084BB5E /* SyphonPrivate.h in Headers */, + BD45586211DF6BD300F15521 /* SyphonServerConnectionManager.h in Headers */, + BDB8DA2F1211F59A0028D250 /* SyphonMessageReceiver.h in Headers */, + BDB8DA311211F59A0028D250 /* SyphonCFMessageReceiver.h in Headers */, + BDB8DA351211F59A0028D250 /* SyphonMessageSender.h in Headers */, + BDB8DA371211F59A0028D250 /* SyphonCFMessageSender.h in Headers */, + BDB8DAF51211FA7F0028D250 /* SyphonMessaging.h in Headers */, + BD038877122EAB1A007725FF /* SyphonIOSurfaceImage.h in Headers */, + E2DE7FD312495BF50081453B /* SyphonMessageQueue.h in Headers */, + BDFBD77D126F4D8800075A23 /* SyphonDispatch.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 8DC2EF4F0486A6940098B216 /* Syphon */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "Syphon" */; + buildPhases = ( + BDFE6806122866C7009C2E21 /* Generate Exported Symbols File */, + 8DC2EF500486A6940098B216 /* Headers */, + BDE0C5FC1229457900DDF631 /* Generate Public Headers */, + 8DC2EF520486A6940098B216 /* Resources */, + 8DC2EF540486A6940098B216 /* Sources */, + 8DC2EF560486A6940098B216 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Syphon; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = OpenVideoTap; + productReference = 8DC2EF5B0486A6940098B216 /* Syphon.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0867D690FE84028FC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "Syphon" */; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 0867D691FE84028FC02AAC07 /* OpenVideoTap */; + productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DC2EF4F0486A6940098B216 /* Syphon */, + BD909C9612785ADE00CC898A /* Syphon Documentation */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8DC2EF520486A6940098B216 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + BD909C9512785ADE00CC898A /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/SyphonBuildMacros.h", + "$(SRCROOT)/SyphonClient.h", + "$(SRCROOT)/SyphonImage.h", + "$(SRCROOT)/SyphonServerDirectory.h", + "$(SRCROOT)/SyphonServer.h", + "$(SRCROOT)/doxygen.config", + "$(SRCROOT)/Syphon.h", + "$(SRCROOT)/doxygen.css", + "$(SRCROOT)/footer.html", + "$(SRCROOT)/header.html", + "$(SRCROOT)/DoxygenLayout.xml", + ); + outputPaths = ( + "$(BUILT_PRODUCTS_DIR)/info.v002.syphon.docs.docset/Contents/Info.plist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Syphon doxygen script based on http://developer.apple.com/tools/creatingdocsetswithdoxygen.html\n# Build the doxygen documentation for the project and load the docset into Xcode.\n\n# Use the following to adjust the value of the $DOXYGEN_PATH User-Defined Setting:\n# Binary install location: /Applications/Doxygen.app/Contents/Resources/doxygen\n# Source build install location: /usr/local/bin/doxygen\n\n# If the config file doesn't exist, run 'doxygen -g $SOURCE_ROOT/doxygen.config' to \n# a get default file.\n\nif ! [ -f \"$SOURCE_ROOT/doxygen.config\" ] \nthen \n echo doxygen config file does not exist\n $DOXYGEN_PATH -g \"$SOURCE_ROOT/doxygen.config\"\nfi\n\n# Make the Derived File directory if it doesn't exist, and delete previous output\nmkdir -p \"$DERIVED_FILE_DIR\"\nrm -rf \"$DERIVED_FILE_DIR/DoxygenDocs\"\n\n# Append the proper input/output directories and docset info to the config file.\n# This works even though values are assigned higher up in the file. Easier than sed.\n\ncp \"$SOURCE_ROOT/doxygen.config\" \"$TEMP_DIR/doxygen.config\"\n\necho \"INPUT = \\\"$BUILT_PRODUCTS_DIR/Syphon.framework/Headers/\\\" \\\"$SRCROOT/header.html\\\" \\\"$SRCROOT/footer.html\\\" \\\"$SRCROOT/doxygen.css\\\"\" >> \"$TEMP_DIR/doxygen.config\"\necho \"OUTPUT_DIRECTORY = \\\"$DERIVED_FILE_DIR/DoxygenDocs\\\"\" >> \"$TEMP_DIR/doxygen.config\"\necho \"GENERATE_DOCSET = YES\" >> \"$TEMP_DIR/doxygen.config\"\necho \"DOCSET_BUNDLE_ID = info.v002.syphon.docs\" >> \"$TEMP_DIR/doxygen.config\"\n\n# Run doxygen on the updated config file.\n# Note: doxygen creates a Makefile that does most of the heavy lifting.\n\n$DOXYGEN_PATH \"$TEMP_DIR/doxygen.config\"\n\n# make will invoke docsetutil. Take a look at the Makefile to see how this is done.\n\nmake -C \"$DERIVED_FILE_DIR/DoxygenDocs/html\" install\n\n# Copy the results back to our Built Products directory\n\nrm -rf \"$BUILT_PRODUCTS_DIR/info.v002.syphon.docs.docset\"\nrm -rf \"$BUILT_PRODUCTS_DIR/FrameworkDocumentation\"\ncp -R \"/Users/$USER/Library/Developer/Shared/Documentation/DocSets/info.v002.syphon.docs.docset\" \"$BUILT_PRODUCTS_DIR/\"\ncp -R \"$DERIVED_FILE_DIR/DoxygenDocs/html\" \"$BUILT_PRODUCTS_DIR/FrameworkDocumentation\"\nrm -f \"$BUILT_PRODUCTS_DIR/FrameworkDocumentation/Info.plist\"\nrm -rf \"$BUILT_PRODUCTS_DIR/FrameworkDocumentation/info.v002.syphon.docs.docset\"\nrm -f \"$BUILT_PRODUCTS_DIR/FrameworkDocumentation/installdox\"\nrm -f \"$BUILT_PRODUCTS_DIR/FrameworkDocumentation/Makefile\"\nrm -f \"$BUILT_PRODUCTS_DIR/FrameworkDocumentation/Nodes.xml\"\nrm -f \"$BUILT_PRODUCTS_DIR/FrameworkDocumentation/Tokens.xml\"\n\n# Construct a temporary applescript file to tell Xcode to load a docset.\n\nrm -f \"$TEMP_DIR/loadDocSet.scpt\"\n\necho \"tell application \\\"Xcode\\\"\" >> \"$TEMP_DIR/loadDocSet.scpt\"\necho \"load documentation set with path \\\"/Users/$USER/Library/Developer/Shared/Documentation/DocSets/\\\" display yes\" >> \"$TEMP_DIR/loadDocSet.scpt\"\necho \"end tell\" >> \"$TEMP_DIR/loadDocSet.scpt\"\n\n# Run the load-docset applescript command.\n\nosascript \"$TEMP_DIR/loadDocSet.scpt\"\n\nexit 0"; + }; + BDE0C5FC1229457900DDF631 /* Generate Public Headers */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/SyphonClient.h", + "$(SRCROOT)/SyphonServer.h", + "$(SRCROOT)/SyphonServerDirectory.h", + "$(SRCROOT)/SyphonBuildMacros.h", + "$(SRCROOT)/SyphonImage.h", + ); + name = "Generate Public Headers"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/SyphonClient.h", + "$(DERIVED_FILE_DIR)/SyphonServer.h", + "$(DERIVED_FILE_DIR)/SyphonServerDirectory.h", + "$(DERIVED_FILE_DIR)/SyphonImage.h", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "mkdir -p \"$DERIVED_FILE_DIR\"\nfor header in \"SyphonClient\" \"SyphonServer\" \"SyphonServerDirectory\" \"SyphonImage\"\ndo\nsed 's:#import://SYPHON_IMPORT_PLACEHOLDER:' \"$SRCROOT/${header}.h\" > \"$DERIVED_FILE_DIR/${header}_stage_1.h\"\ngcc -E -C -P -nostdinc -D \"${GCC_PREPROCESSOR_DEFINITIONS:-SYPHON_THIS_COULD_BE_NEATER}\" -D \"SYPHON_HEADER_BUILD_PHASE\" -include \"$SRCROOT/SyphonBuildMacros.h\" \"$DERIVED_FILE_DIR/${header}_stage_1.h\" -o \"$DERIVED_FILE_DIR/${header}_stage_2.h\"\nsed 's://SYPHON_IMPORT_PLACEHOLDER:#import:' \"$DERIVED_FILE_DIR/${header}_stage_2.h\" > \"$DERIVED_FILE_DIR/${header}_stage_3.h\"\nsed '/./,$!d' \"$DERIVED_FILE_DIR/${header}_stage_3.h\" > \"$DERIVED_FILE_DIR/${header}_stage_4.h\"\ncat -s \"$DERIVED_FILE_DIR/${header}_stage_4.h\" > \"$DERIVED_FILE_DIR/${header}.h\"\nrm \"$DERIVED_FILE_DIR/${header}_stage_1.h\"\nrm \"$DERIVED_FILE_DIR/${header}_stage_2.h\"\nrm \"$DERIVED_FILE_DIR/${header}_stage_3.h\"\nrm \"$DERIVED_FILE_DIR/${header}_stage_4.h\"\ncp \"$DERIVED_FILE_DIR/${header}.h\" \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Headers/${header}.h\"\ndone"; + }; + BDFE6806122866C7009C2E21 /* Generate Exported Symbols File */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/SyphonBuildMacros.h", + "$(SRCROOT)/Exported_Symbols.exp", + ); + name = "Generate Exported Symbols File"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Exported_Symbols.exp", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "mkdir -p \"$DERIVED_FILE_DIR\"\ngcc -E -P -nostdinc -D \"${GCC_PREPROCESSOR_DEFINITIONS:-SYPHON_THIS_COULD_BE_NEATER}\" -include \"$SRCROOT/SyphonBuildMacros.h\" -x c \"$SRCROOT/Exported_Symbols.exp\" -o \"$DERIVED_FILE_DIR/Exported_Symbols.exp\""; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DC2EF540486A6940098B216 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1B0906C111CBB0F500BCBE41 /* SyphonServer.m in Sources */, + 1B0906C711CBB1C100BCBE41 /* SyphonClient.m in Sources */, + 1B09098811CD9A1C00BCBE41 /* SyphonClientConnectionManager.m in Sources */, + BD606D6911D2842D00E02702 /* SyphonServerDirectory.m in Sources */, + BD3796D211DD470D0042870B /* SyphonPrivate.m in Sources */, + BD45586311DF6BD300F15521 /* SyphonServerConnectionManager.m in Sources */, + BDB8DA301211F59A0028D250 /* SyphonMessageReceiver.m in Sources */, + BDB8DA321211F59A0028D250 /* SyphonCFMessageReceiver.m in Sources */, + BDB8DA361211F59A0028D250 /* SyphonMessageSender.m in Sources */, + BDB8DA381211F59A0028D250 /* SyphonCFMessageSender.m in Sources */, + BDB8DAF61211FA7F0028D250 /* SyphonMessaging.m in Sources */, + BD038878122EAB1A007725FF /* SyphonIOSurfaceImage.m in Sources */, + BD038887122EABE2007725FF /* SyphonImage.m in Sources */, + E2DE7FD412495BF50081453B /* SyphonMessageQueue.m in Sources */, + BDFBD77E126F4D8800075A23 /* SyphonDispatch.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + BD909C9B12785AE400CC898A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* Syphon */; + targetProxy = BD909C9A12785AE400CC898A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C1667FE841158C02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 1DEB91AE08733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + EXPORTED_SYMBOLS_FILE = $DERIVED_FILE_DIR/Exported_Symbols.exp; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Syphon_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INFOPLIST_PREPROCESS = NO; + INSTALL_PATH = "@loader_path/../Frameworks"; + PRODUCT_NAME = Syphon; + WRAPPER_EXTENSION = framework; + }; + name = Debug; + }; + 1DEB91AF08733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + EXPORTED_SYMBOLS_FILE = $DERIVED_FILE_DIR/Exported_Symbols.exp; + FRAMEWORK_VERSION = A; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Syphon_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "@loader_path/../Frameworks"; + PRODUCT_NAME = Syphon; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; + 1DEB91B208733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = DEBUG; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + PREBINDING = NO; + SDKROOT = macosx10.6; + VALID_ARCHS = "i386 x86_64"; + }; + name = Debug; + }; + 1DEB91B308733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = macosx10.6; + VALID_ARCHS = "i386 x86_64"; + }; + name = Release; + }; + BD5A05F712187C68005D3F6E /* Debug Messaging Only */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + SYPHON_DEBUG_NO_DRAWING, + DEBUG, + ); + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + PREBINDING = NO; + SDKROOT = macosx10.6; + VALID_ARCHS = "i386 x86_64"; + }; + name = "Debug Messaging Only"; + }; + BD5A05F812187C68005D3F6E /* Debug Messaging Only */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + EXPORTED_SYMBOLS_FILE = $DERIVED_FILE_DIR/Exported_Symbols.exp; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Syphon_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INFOPLIST_PREPROCESS = NO; + INSTALL_PATH = "@loader_path/../Frameworks"; + PRODUCT_NAME = Syphon; + WRAPPER_EXTENSION = framework; + }; + name = "Debug Messaging Only"; + }; + BD909C9712785ADE00CC898A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + PRODUCT_NAME = "Syphon Documentation"; + }; + name = Debug; + }; + BD909C9812785ADE00CC898A /* Debug Messaging Only */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "Syphon Documentation"; + }; + name = "Debug Messaging Only"; + }; + BD909C9912785ADE00CC898A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + PRODUCT_NAME = "Syphon Documentation"; + ZERO_LINK = NO; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "Syphon" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91AE08733DA50010E9CD /* Debug */, + BD5A05F812187C68005D3F6E /* Debug Messaging Only */, + 1DEB91AF08733DA50010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "Syphon" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91B208733DA50010E9CD /* Debug */, + BD5A05F712187C68005D3F6E /* Debug Messaging Only */, + 1DEB91B308733DA50010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BD909C9C12785B0300CC898A /* Build configuration list for PBXAggregateTarget "Syphon Documentation" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BD909C9712785ADE00CC898A /* Debug */, + BD909C9812785ADE00CC898A /* Debug Messaging Only */, + BD909C9912785ADE00CC898A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0867D690FE84028FC02AAC07 /* Project object */; +} diff --git a/SyphonBuildMacros.h b/SyphonBuildMacros.h new file mode 100644 index 0000000..7affb09 --- /dev/null +++ b/SyphonBuildMacros.h @@ -0,0 +1,12 @@ +#define SYPHON_CONCAT(x, y) SYPHON_CONCAT_EXPANDED(x, y) +#define SYPHON_CONCAT_EXPANDED(x, y) x ## y +#define SYPHON_SYMBOL_FROM_CLASS_NAME(NAME) SYPHON_CONCAT(.objc_class_name_, NAME) + +#ifdef SYPHON_UNIQUE_CLASS_NAME_PREFIX + #define SYPHON_UNIQUE_CLASS_NAME(CLASS_NAME) SYPHON_CONCAT(SYPHON_UNIQUE_CLASS_NAME_PREFIX, CLASS_NAME) + #define SYPHON_UNIQUE_CLASS_SYMBOL(CLASS_NAME) SYPHON_SYMBOL_FROM_CLASS_NAME(SYPHON_UNIQUE_CLASS_NAME(CLASS_NAME)) + #define SYPHON_USE_CLASS_ALIAS +#else + #define SYPHON_UNIQUE_CLASS_NAME(CLASS_NAME) CLASS_NAME + #define SYPHON_UNIQUE_CLASS_SYMBOL(CLASS_NAME) SYPHON_SYMBOL_FROM_CLASS_NAME(CLASS_NAME) +#endif diff --git a/SyphonCFMessageReceiver.h b/SyphonCFMessageReceiver.h new file mode 100644 index 0000000..f0678b1 --- /dev/null +++ b/SyphonCFMessageReceiver.h @@ -0,0 +1,45 @@ +/* + SyphonMessageReceiver.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import +#import "SyphonMessageReceiver.h" + +#define SYPHON_CFMESSAGE_RECEIVER_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonCFMessageReceiver) + +@interface SYPHON_CFMESSAGE_RECEIVER_UNIQUE_CLASS_NAME : SyphonMessageReceiver { +@private + CFMessagePortRef _port; + CFRunLoopSourceRef _runLoopSource; +} + +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonCFMessageReceiver SYPHON_CFMESSAGE_RECEIVER_UNIQUE_CLASS_NAME; +#endif diff --git a/SyphonCFMessageReceiver.m b/SyphonCFMessageReceiver.m new file mode 100644 index 0000000..f9ff93f --- /dev/null +++ b/SyphonCFMessageReceiver.m @@ -0,0 +1,93 @@ +/* + SyphonMessageReceiver.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SyphonCFMessageReceiver.h" +#import "SyphonMessaging.h" + +static CFDataRef MessageReturnCallback ( + CFMessagePortRef local, + SInt32 msgid, + CFDataRef data, + void *info + ) +{ + id decoded; + if (data && CFDataGetLength(data)) + { + decoded = [NSKeyedUnarchiver unarchiveObjectWithData:(NSData *)data]; + } else { + decoded = nil; + } + [(SyphonMessageReceiver *)info receiveData:decoded type:msgid]; + return NULL; +} + +@implementation SyphonCFMessageReceiver +- (id)initForName:(NSString *)name protocol:(NSString *)protocolName handler:(void (^)(id data, uint32_t type))handler +{ + if (self = [super initForName:name protocol:protocolName handler:handler]) + { + if ([protocolName isEqualToString:SyphonMessagingProtocolCFMessage]) + { + CFMessagePortContext context = (CFMessagePortContext){0,self,NULL,NULL,NULL}; + _port = CFMessagePortCreateLocal(kCFAllocatorDefault, (CFStringRef)name, MessageReturnCallback, &context, NULL); + } + if (_port == NULL) + { + [self release]; + return nil; + } + _runLoopSource = CFMessagePortCreateRunLoopSource(kCFAllocatorDefault, _port, 0); + // TODO: Think about which run loop we want to be in (current thread, our own private, main, or what?) + CFRunLoopAddSource(CFRunLoopGetMain(), _runLoopSource, kCFRunLoopCommonModes); + } + return self; +} + +- (void)finalize +{ + CFRelease(_runLoopSource); + CFRelease(_port); + [super finalize]; +} + +- (void)dealloc +{ + CFRelease(_runLoopSource); + CFRelease(_port); + [super dealloc]; +} + +- (void)invalidate +{ + CFMessagePortInvalidate(_port); + CFRunLoopSourceInvalidate(_runLoopSource); + [super invalidate]; +} +@end diff --git a/SyphonCFMessageSender.h b/SyphonCFMessageSender.h new file mode 100644 index 0000000..2f4eeba --- /dev/null +++ b/SyphonCFMessageSender.h @@ -0,0 +1,48 @@ +/* + SyphonCFMessageSender.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import +#import "SyphonMessageSender.h" +#import "SyphonMessageQueue.h" +#import "SyphonDispatch.h" + +#define SYPHON_CFMESSAGE_SENDER_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonCFMessageSender) + +@interface SYPHON_CFMESSAGE_SENDER_UNIQUE_CLASS_NAME : SyphonMessageSender { +@private + CFMessagePortRef _port; + SyphonMessageQueue *_queue; + id volatile *_backRef; + SyphonDispatchSourceRef _dispatch; +} +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonCFMessageSender SYPHON_CFMESSAGE_SENDER_UNIQUE_CLASS_NAME; +#endif diff --git a/SyphonCFMessageSender.m b/SyphonCFMessageSender.m new file mode 100644 index 0000000..7b8ac7b --- /dev/null +++ b/SyphonCFMessageSender.m @@ -0,0 +1,144 @@ +/* + SyphonCFMessageSender.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SyphonCFMessageSender.h" +#import "SyphonMessaging.h" +#import "SyphonPrivate.h" + +@interface SyphonCFMessageSender (Private) +- (void)sendOnThread; +- (void)finishPort; +@end + +@implementation SyphonCFMessageSender +- (id)initForName:(NSString *)name protocol:(NSString *)protocolName invalidationHandler:(void (^)(void))handler; +{ + if (self = [super initForName:name protocol:protocolName invalidationHandler:handler]) + { + _port = CFMessagePortCreateRemote(kCFAllocatorDefault, (CFStringRef)name); + if (_port == NULL) + { + [self release]; + return nil; + } + + _queue = [[SyphonMessageQueue alloc] init]; + _queue.userInfo = self; + // local vars for block references, see note below + CFMessagePortRef port = _port; + SyphonMessageQueue *queue = _queue; + _dispatch = SyphonDispatchSourceCreate(^(){ + + //// IMPORTANT // + //// Do not refer to any ivars in this block, or self will be retained, causing a retain-loop // + + CFDataRef returned; + SInt32 result; + uint32_t mType; + NSData *mContent; + while ([queue copyAndDequeue:&mContent type:&mType]) + { + // TODO: think about dealing with time-outs + result = CFMessagePortSendRequest(port, mType, (CFDataRef)mContent, 60, 0, NULL, &returned); + [mContent release]; + if (result != kCFMessagePortSuccess) + { + if (result == kCFMessagePortIsInvalid) + { + [(SyphonCFMessageSender *)queue.userInfo finishPort]; + [(SyphonCFMessageSender *)queue.userInfo invalidate]; + break; + } + } + } + }); + + SyphonDispatchSourceSetCompletionBlock(_dispatch, ^(){ + //// IMPORTANT // + //// Do not refer to any ivars in this block, or self will be retained, causing a retain-loop // + if (port) + { + CFRelease(port); + } + }); + } + return self; +} + +- (void)finishPort +{ + _queue.userInfo = nil; + // our CFMessagePort will be released in the dispatch source's completion block + // we must stop referencing it now + bool result; + do { + void *old = _port; + result = OSAtomicCompareAndSwapPtrBarrier(old, NULL, (void **)&_port); + } while (!result); + do { + void *old = _dispatch; + result = OSAtomicCompareAndSwapPtrBarrier(old, NULL, (void **)&_dispatch); + if (result) SyphonDispatchSourceRelease(old); + } while (!result); +} + +- (void)dealloc +{ + [self finishPort]; + [_queue release]; + [super dealloc]; +} + +- (void)finalize +{ + [self finishPort]; + [super finalize]; +} + +- (BOOL)isValid +{ + return (_port != NULL ? CFMessagePortIsValid(_port) : NO); +} + +- (void)send:(id )data ofType:(uint32_t)type +{ + NSData *encoded; + if (data) + { + encoded = [NSKeyedArchiver archivedDataWithRootObject:data]; + } + else + { + encoded = nil; + } + [_queue queue:encoded ofType:type]; + SyphonDispatchSourceFire(_dispatch); +} + +@end diff --git a/SyphonClient.h b/SyphonClient.h new file mode 100644 index 0000000..32666ae --- /dev/null +++ b/SyphonClient.h @@ -0,0 +1,104 @@ +/* + SyphonClient.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import +#import +#import + +#define SYPHON_CLIENT_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonClient) +#define SYPHON_IMAGE_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonImage) + +@class SYPHON_IMAGE_UNIQUE_CLASS_NAME; + +/*! + SyphonClient makes available frames from a remote SyphonServer. A client is created from a NSDictionary which describes the server. Typically this is obtained from the shared SyphonServerDirectory, or one of Syphon's notifications. + + SyphonClient allows for lazy drawing by the use of a new-frame-handler. Using a handler you can perform drawing without using a timer or polling, achieving frame-accuracy with the minimum of overhead. Alternatively, if your application uses a traditional display link or timer, you can use the hasNewFrame property to make decisions about work you may need to do. Irrespective of the presence of new frames, you can draw with a SyphonClient at any time. + + It is safe to access instances of this class across threads. + */ + +@interface SYPHON_CLIENT_UNIQUE_CLASS_NAME : NSObject +{ +@private + id _connectionManager; + uint32_t _lastFrameID; + void (^_handler)(id); + int32_t _status; + int32_t _lock; +} +/*! + Returns a new client instance for the described server. You should check the isValid property after initialization to ensure a connection was made to the server. + @param description Typically acquired from the shared SyphonServerDirectory, or one of Syphon's notifications. + @param options Currently ignored. May be nil. + @param handler A block which is invoked when a new frame becomes available. handler may be nil. This block may be invoked on a thread other than that on which the client was created. + @returns A newly initialized SyphonClient object, or nil if a client could not be created. +*/ + +- (id)initWithServerDescription:(NSDictionary *)description options:(NSDictionary *)options newFrameHandler:(void (^)(SYPHON_CLIENT_UNIQUE_CLASS_NAME *client))handler; + +/*! + A client is valid if it has a working connection to a server. Once this returns NO, the SyphonClient will not yield any further frames. + */ + +@property (readonly) BOOL isValid; + +/*! + Returns a dictionary with a description of the server the client is attached to. See SyphonServerDirectory.h for the keys this dictionary contains +*/ + +@property (readonly) NSDictionary *serverDescription; + +/*! + Returns YES if the server has output a new frame since the last time newFrameImageForContext: was called for this client, NO otherwise. +*/ + +@property (readonly) BOOL hasNewFrame; + +/*! + Returns a SyphonImage representing the current output from the server. The texture associated with the image may continue to update when you draw with it, but you should not depend on that behaviour: call this method every time you wish to access the current server frame. This object may have GPU resources associated with it and you should release it as soon as you are finished drawing with it. + + This method does not lock the CGL context. If there is a chance other threads may use the context during calls to this method, bracket it with calls to CGLLockContext() and CGLUnlockContext(). + @param cgl_ctx The CGL context in which the SyphonImage will be valid. + @returns A SyphonImage representing the live output from the server. YOU ARE RESPONSIBLE FOR RELEASING THIS OBJECT when you are finished with it. + */ +- (SYPHON_IMAGE_UNIQUE_CLASS_NAME *)newFrameImageForContext:(CGLContextObj)cgl_ctx; + +/*! + Stops the client from receiving any further frames from the server. In garbage-collected applications you must call this method prior to removing strong references to the client. In non-garbage-collected applications, use of this method is optional and releasing all references to the client has the same effect. + */ + +- (void)stop; + +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonClient SYPHON_CLIENT_UNIQUE_CLASS_NAME; +#endif + diff --git a/SyphonClient.m b/SyphonClient.m new file mode 100644 index 0000000..89fe28b --- /dev/null +++ b/SyphonClient.m @@ -0,0 +1,148 @@ +/* + SyphonClient.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#import "SyphonClient.h" +#import "SyphonPrivate.h" +#import "SyphonClientConnectionManager.h" + +#import + +#import + +@implementation SyphonClient +#if SYPHON_DEBUG_NO_DRAWING ++ (void)load +{ + NSLog(@"SYPHON FRAMEWORK: DRAWING IS DISABLED"); + [super load]; +} +#endif + +- (id)init +{ + [self doesNotRecognizeSelector:_cmd]; + return nil; +} + +- (id)initWithServerDescription:(NSDictionary *)description options:(NSDictionary *)options newFrameHandler:(void (^)(SyphonClient *client))handler +{ + if((self = [super init])) + { + NSNumber *dictionaryVersion = [description objectForKey:SyphonServerDescriptionDictionaryVersionKey]; + _connectionManager = [[SyphonClientConnectionManager alloc] initWithServerDescription:description]; + + if (dictionaryVersion == nil + || [dictionaryVersion unsignedIntValue] > kSyphonDictionaryVersion + || _connectionManager == nil) + { + [self release]; + return nil; + } + + [(SyphonClientConnectionManager *)_connectionManager addInfoClient:self]; + + if (handler != nil) + { + _handler = [handler copy]; // copy don't retain + [(SyphonClientConnectionManager *)_connectionManager addFrameClient:(id )self]; + } + _lock = OS_SPINLOCK_INIT; + _status = 1; + } + return self; +} + +- (void)finalize +{ + if (((SyphonClientConnectionManager *)_connectionManager).isValid) + { + [NSException raise:@"SyphonClientException" format:@"finalize called on client that hasn't been stopped."]; + } + [super finalize]; +} + +- (void) dealloc +{ + [self stop]; + [super dealloc]; +} + +- (void)stop +{ + if (OSAtomicDecrement32(&_status) == 0) // so this will only happen once even if stop is called multiple times + { + if (_handler != nil) + { + [(SyphonClientConnectionManager *)_connectionManager removeFrameClient:(id ) self]; + [_handler release]; + } + [(SyphonClientConnectionManager *)_connectionManager removeInfoClient:self]; + [(SyphonClientConnectionManager *)_connectionManager release]; + _connectionManager = nil; + } +} + +- (BOOL)isValid +{ + return ((SyphonClientConnectionManager *)_connectionManager).isValid; +} + +- (void)receiveNewFrame +{ + if (_handler) + { + _handler(self); + } +} + +#pragma mark Rendering frames +- (BOOL)hasNewFrame +{ + BOOL result; + OSSpinLockLock(&_lock); + result = _lastFrameID != ((SyphonClientConnectionManager *)_connectionManager).frameID; + OSSpinLockUnlock(&_lock); + return result; +} + +- (SyphonImage *)newFrameImageForContext:(CGLContextObj)cgl_ctx +{ + OSSpinLockLock(&_lock); + _lastFrameID = [(SyphonClientConnectionManager *)_connectionManager frameID]; + OSSpinLockUnlock(&_lock); + return [(SyphonClientConnectionManager *)_connectionManager newFrameForContext:cgl_ctx]; +} + +- (NSDictionary *)serverDescription +{ + return ((SyphonClientConnectionManager *)_connectionManager).serverDescription; +} + +@end diff --git a/SyphonClientConnectionManager.h b/SyphonClientConnectionManager.h new file mode 100644 index 0000000..212f52e --- /dev/null +++ b/SyphonClientConnectionManager.h @@ -0,0 +1,90 @@ +/* + SyphonClientConnectionManager.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#import +#import +#import +#import "SyphonMessaging.h" +#import "SyphonIOSurfaceImage.h" + +/* This object handles messaging to and from the server. + + SyphonClients should + + addInfoClient:self + addFrameClient:self (if wanted) + ... + removeFrameClient:self (if added) + removeInfoClient:self + + in that order. + + Thread-safe. One instance is shared between all clients for a server. + + */ + +@protocol SyphonFrameReceiving +- (void)receiveNewFrame; +@end + +#define SYPHON_CLIENT_CONNECTION_MANAGER_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonClientConnectionManager) + +@interface SYPHON_CLIENT_CONNECTION_MANAGER_UNIQUE_CLASS_NAME : NSObject +{ +@private + NSString *_myUUID; + IOSurfaceID _surfaceID; + IOSurfaceRef _surface; + uint32_t _lastSeed; + NSMapTable *_frames; + NSUInteger _frameID; + NSMutableDictionary *_serverDescription; + BOOL _active; + SyphonMessageReceiver *_connection; + int32_t _infoClientCount; + int32_t _handlerCount; + NSHashTable *_frameClients; + dispatch_queue_t _frameQueue; + OSSpinLock _lock; +} +- (id)initWithServerDescription:(NSDictionary *)description; +@property (readonly) BOOL isValid; +- (void)addInfoClient:(id)client; // Must be +- (void)removeInfoClient:(id)client; // paired +- (void)addFrameClient:(id )client; // Must be +- (void)removeFrameClient:(id )client; // paired +@property (readonly) NSDictionary *serverDescription; +- (SyphonImage *)newFrameForContext:(CGLContextObj)context; +@property (readonly) NSUInteger frameID; +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonClientConnectionManager SYPHON_CLIENT_CONNECTION_MANAGER_UNIQUE_CLASS_NAME; +#endif diff --git a/SyphonClientConnectionManager.m b/SyphonClientConnectionManager.m new file mode 100644 index 0000000..4e92caa --- /dev/null +++ b/SyphonClientConnectionManager.m @@ -0,0 +1,395 @@ +/* + SyphonClientConnectionManager.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#import "SyphonClientConnectionManager.h" +#import "SyphonPrivate.h" + +#pragma mark Shared Instances + +static OSSpinLock _lookupTableLock = OS_SPINLOCK_INIT; +static NSMapTable *_lookupTable; + +static id SyphonClientPrivateCopyInstance(NSString *uuid) +{ + id result = nil; + OSSpinLockLock(&_lookupTableLock); + if (uuid) result = [_lookupTable objectForKey:uuid]; + [result retain]; + OSSpinLockUnlock(&_lookupTableLock); + return result; +} + +static void SyphonClientPrivateInsertInstance(id instance, NSString *uuid) +{ + OSSpinLockLock(&_lookupTableLock); + if (uuid) + { + if (!_lookupTable) _lookupTable = [[NSMapTable alloc] initWithKeyOptions:NSMapTableStrongMemory valueOptions:NSMapTableZeroingWeakMemory capacity:1]; + [_lookupTable setObject:instance forKey:uuid]; + } + OSSpinLockUnlock(&_lookupTableLock); +} + +static void SyphonClientPrivateRemoveInstance(id instance, NSString *uuid) +{ + OSSpinLockLock(&_lookupTableLock); + if (uuid) [_lookupTable removeObjectForKey:uuid]; + if ([_lookupTable count] == 0) + { + [_lookupTable release]; + _lookupTable = nil; + } + OSSpinLockUnlock(&_lookupTableLock); +} + +@interface SyphonClientConnectionManager (Private) +- (void)setServerName:(NSString *)name; +- (void)publishNewFrame; +- (void)setSurfaceID:(IOSurfaceID)surfaceID; +- (IOSurfaceRef)surfaceHavingLock; +- (void)endConnectionHavingLock:(BOOL)hasLock; +@end +@implementation SyphonClientConnectionManager + +- (id)initWithServerDescription:(NSDictionary *)description +{ + if(self = [super init]) + { + NSString *serverUUID = [description objectForKey:SyphonServerDescriptionUUIDKey]; + + // Return an existing instance for this server if we have one + id existing = SyphonClientPrivateCopyInstance(serverUUID); + if (existing) + { + [self release]; + return existing; + } + + NSArray *surfaces = [description objectForKey:SyphonServerDescriptionSurfacesKey]; + BOOL hasIOSurface = NO; + for (NSDictionary *surface in surfaces) + { + if ([[surface objectForKey:SyphonSurfaceType] isEqualToString:SyphonSurfaceTypeIOSurface]) hasIOSurface = YES; + } + + if (!hasIOSurface) + { + [self release]; + return nil; + } + + _lock = OS_SPINLOCK_INIT; + _serverDescription = [[NSMutableDictionary alloc] initWithDictionary:description]; + _myUUID = SyphonCreateUUIDString(); + + SyphonClientPrivateInsertInstance(self, serverUUID); + _frames = [[NSMapTable mapTableWithKeyOptions:(NSPointerFunctionsOpaquePersonality | NSPointerFunctionsOpaqueMemory) + valueOptions:(NSPointerFunctionsObjectPersonality | NSPointerFunctionsStrongMemory)] retain]; + } + return self; +} + +- (void)finalize +{ + if (_frameQueue) dispatch_release(_frameQueue); + [super finalize]; +} + +- (void) dealloc +{ + SyphonClientPrivateRemoveInstance(self, [_serverDescription objectForKey:SyphonServerDescriptionUUIDKey]); + [_frames release]; + if (_frameQueue) dispatch_release(_frameQueue); + [_frameClients release]; + [_serverDescription release]; + [_myUUID release]; + [super dealloc]; +} + +- (void)endConnectionHavingLock:(BOOL)hasLock +{ + SYPHONLOG(@"Ending connection"); + SyphonMessageReceiver *connection; + IOSurfaceRef surface; + // we copy and clear ivars inside the lock, release them outside it + if (!hasLock) OSSpinLockLock(&_lock); + connection = _connection; + _connection = nil; + _active = NO; + surface = _surface; + _surface = NULL; + [_frames removeAllObjects]; + if (!hasLock) OSSpinLockUnlock(&_lock); + [connection invalidate]; + [connection release]; + if (surface) CFRelease(surface); +} + +- (BOOL)isValid +{ + BOOL result; + OSSpinLockLock(&_lock); + result = _active; + OSSpinLockUnlock(&_lock); + return result; +} + +- (void)addInfoClient:(id)client +{ + OSSpinLockLock(&_lock); + _infoClientCount++; + BOOL shouldSendAdd = NO; + NSString *serverUUID = nil; + if (_infoClientCount == 1) + { + // set up a connection to receive and deal with messages from the server + _connection = [[SyphonMessageReceiver alloc] initForName:_myUUID protocol:SyphonMessagingProtocolCFMessage handler:^(id data, uint32_t type) { + switch (type) { + case SyphonMessageTypeNewFrame: + [self publishNewFrame]; + break; + case SyphonMessageTypeUpdateServerName: + [self setServerName:(NSString *)data]; + break; + case SyphonMessageTypeUpdateSurfaceID: + [self setSurfaceID:[(NSNumber *)data unsignedIntValue]]; + break; + case SyphonMessageTypeRetireServer: + [self endConnectionHavingLock:NO]; + break; + default: + SYPHONLOG(@"Unknown message type #%u received", type); + break; + } + }]; + + if (_connection != nil) + { + serverUUID = [_serverDescription objectForKey:SyphonServerDescriptionUUIDKey]; + _active = shouldSendAdd = YES; + } + } + OSSpinLockUnlock(&_lock); + // We can do this outside the lock because we're not using any protected resources + if (shouldSendAdd) + { + SYPHONLOG(@"Registering for info updates"); + SyphonMessageSender *sender = [[SyphonMessageSender alloc] initForName:serverUUID + protocol:SyphonMessagingProtocolCFMessage + invalidationHandler:nil]; + + if (sender == nil) + { + SYPHONLOG(@"Failed to create connection to server with uuid:%@", serverUUID); + [self endConnectionHavingLock:NO]; + } + [sender send:_myUUID ofType:SyphonMessageTypeAddClientForInfo]; + [sender release]; + } +} + +- (void)removeInfoClient:(id)client +{ + OSSpinLockLock(&_lock); + _infoClientCount--; + if (_infoClientCount == 0) + { + // Remove ourself from the server + NSString *serverUUID = [_serverDescription objectForKey:SyphonServerDescriptionUUIDKey]; + if (_active) + { + SYPHONLOG(@"De-registering for info updates"); + SyphonMessageSender *sender = [[SyphonMessageSender alloc] initForName:serverUUID + protocol:SyphonMessagingProtocolCFMessage + invalidationHandler:nil]; + [sender send:_myUUID ofType:SyphonMessageTypeRemoveClientForInfo]; + [sender release]; + [self endConnectionHavingLock:YES]; + } + } + OSSpinLockUnlock(&_lock); +} + +- (void)addFrameClient:(id)client +{ + OSSpinLockLock(&_lock); + if (_frameQueue == nil) + { + _frameQueue = dispatch_queue_create([_myUUID cStringUsingEncoding:NSUTF8StringEncoding], 0); + _frameClients = [[NSHashTable hashTableWithWeakObjects] retain]; + } + OSSpinLockUnlock(&_lock); + // only access _frameClients within the queue + dispatch_sync(_frameQueue, ^{ + [_frameClients addObject:client]; + }); + if (OSAtomicIncrement32(&_handlerCount) == 1) + { + SYPHONLOG(@"Registering for frame updates"); + SyphonMessageSender *sender = [[SyphonMessageSender alloc] initForName:[self.serverDescription objectForKey:SyphonServerDescriptionUUIDKey] + protocol:SyphonMessagingProtocolCFMessage + invalidationHandler:nil]; + if (sender == nil) + { + SYPHONLOG(@"Failed to create connection to server with uuid:%@", [self.serverDescription objectForKey:SyphonServerDescriptionUUIDKey]); + [self endConnectionHavingLock:NO]; + } + [sender send:_myUUID ofType:SyphonMessageTypeAddClientForFrames]; + [sender release]; + } +} + +- (void)removeFrameClient:(id)client +{ + dispatch_sync(_frameQueue, ^{ + [_frameClients removeObject:client]; + }); + if (OSAtomicDecrement32(&_handlerCount) == 0 && self.isValid) + { + SYPHONLOG(@"De-registering for frame updates"); + SyphonMessageSender *sender = [[SyphonMessageSender alloc] initForName:[self.serverDescription objectForKey:SyphonServerDescriptionUUIDKey] + protocol:SyphonMessagingProtocolCFMessage + invalidationHandler:nil]; + if (sender == nil) + { + SYPHONLOG(@"Failed to create connection to server with uuid:%@", [self.serverDescription objectForKey:SyphonServerDescriptionUUIDKey]); + [self endConnectionHavingLock:NO]; + } + [sender send:_myUUID ofType:SyphonMessageTypeRemoveClientForFrames]; + [sender release]; + } +} + +- (NSString*) description +{ + OSSpinLockLock(&_lock); + NSDictionary *description = [_serverDescription retain]; + OSSpinLockUnlock(&_lock); + NSString *result = [NSString stringWithFormat:@"Server UUID: %@, Server Name: %@, Host Application: %@", + [description objectForKey:SyphonServerDescriptionUUIDKey], + [description objectForKey:SyphonServerDescriptionNameKey], + [description objectForKey:SyphonServerDescriptionAppNameKey], nil]; + [description release]; + return result; +} + +- (NSDictionary *)serverDescription +{ + OSSpinLockLock(&_lock); + NSDictionary *description = [_serverDescription retain]; + OSSpinLockUnlock(&_lock); + NSDictionary *result = [NSDictionary dictionaryWithDictionary:description]; + [description release]; + return result; +} + +- (void)setServerName:(NSString *)name +{ + if (name) + { + OSSpinLockLock(&_lock); + [_serverDescription setObject:name forKey:SyphonServerDescriptionNameKey]; + OSSpinLockUnlock(&_lock); + } +} + +- (void)publishNewFrame +{ + // This could be dispatch_async WHEN we coalesce incoming messages + // Just now it's sync so a server can't flood a client (at the cost of blocking servers) + dispatch_sync(_frameQueue, ^{ + for (id obj in _frameClients) { + [obj receiveNewFrame]; + } + }); +} + +- (IOSurfaceRef)surfaceHavingLock +{ + if (!_surface) + { + // WHOA - This causes a retain. + _surface = IOSurfaceLookup(_surfaceID); + } + return _surface; +} + +- (void)setSurfaceID:(IOSurfaceID)surfaceID +{ + OSSpinLockLock(&_lock); + _surfaceID = surfaceID; + _frameID++; // new surface means a new frame + if (_surface) + { + CFRelease(_surface); + _surface = NULL; + [_frames removeAllObjects]; + } + OSSpinLockUnlock(&_lock); +} + +- (SyphonImage *)newFrameForContext:(CGLContextObj)context +{ + SyphonImage *result; + OSSpinLockLock(&_lock); + result = NSMapGet(_frames, context); + if (result) + { + [result retain]; + } + else + { + result = [[SyphonIOSurfaceImage alloc] initWithSurface:[self surfaceHavingLock] forContext:context]; + NSMapInsertKnownAbsent(_frames, context, result); + } + OSSpinLockUnlock(&_lock); + return result; +} + +- (NSUInteger)frameID +{ + NSUInteger result; + OSSpinLockLock(&_lock); + IOSurfaceRef surface = [self surfaceHavingLock]; + if (surface) + { + uint32_t seed = IOSurfaceGetSeed(surface); + if (_lastSeed != seed) + { + _frameID++; + _lastSeed = seed; + } + } + result = _frameID; + OSSpinLockUnlock(&_lock); + return result; +} + +@end diff --git a/SyphonDispatch.c b/SyphonDispatch.c new file mode 100644 index 0000000..b0ecc16 --- /dev/null +++ b/SyphonDispatch.c @@ -0,0 +1,363 @@ +/* + SyphonDispatch.c + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "SyphonDispatch.h" +// stdlib for malloc +#include +// time.h for gettimeofday in finalizer() +#include +// the rest are used throughout +#include +#include +#include +#include + +//#define SYPHON_DISPATCH_DEBUG_LOGGING + +#ifdef SYPHON_DISPATCH_DEBUG_LOGGING +#include // for printf() +#endif + +// TODO: think about error handling here to catch exceptions in a source's block(s) + +#pragma mark Private Functions, Defines and Types + +/* + kSyphonDispatchUnloadTimeout + The time in seconds we wait for firing sources to finish when the code is unloaded (eg at application quit) + TODO: think about how long this should be + */ +#define kSyphonDispatchUnloadTimeout 1.0 + +typedef struct SyphonDispatchChannel SyphonDispatchChannel; + +static void _SyphonDispatchSourceRelease(SyphonDispatchSourceRef source, bool onChannel); + +/* + _SyphonDispatchChannelLaunchFromPool + Used by SyphonDispatchFire to launch source on a channel, using an existing one from the pool if available, otherwise making a new one + */ +static inline void _SyphonDispatchChannelLaunchFromPool(SyphonDispatchSourceRef source); + +/* + _SyphonDispatchChannelReleaseToPool + Return channel to the pool. channel must not be NULL. + */ +#define _SyphonDispatchChannelReturnToPool(channel) OSAtomicEnqueue(&mChanPool, (channel), offsetof(SyphonDispatchChannel, next)) + +/* + _SyphonDispatchChannelTryFromPool + Returns an existing channel from the pool if available, otherwise NULL + */ +#define _SyphonDispatchChannelTryFromPool() OSAtomicDequeue(&mChanPool, offsetof(SyphonDispatchChannel, next)) + +/* + _SyphonDispatchChannelDestroy + Signals a channel to destroy itself + */ +static void _SyphonDispatchChannelDestroy(SyphonDispatchChannel *channel); + +/* + _SyphonDispatchGetWorkSemaphore() + Returns the global work semaphore to signal work done + */ +static dispatch_semaphore_t _SyphonDispatchGetWorkSemaphore(); + +typedef struct SyphonDispatchSource +{ + volatile int32_t retainc; + void (^fblock)(void); + volatile int32_t firec; + void (^volatile cblock)(void); +} SyphonDispatchSource; + +struct SyphonDispatchChannel +{ + void *next; + SyphonDispatchSourceRef activeSource; + dispatch_semaphore_t signal; + int32_t done; +}; + +#pragma mark Dispatch Globals + +static OSQueueHead mChanPool = OS_ATOMIC_QUEUE_INIT; +static volatile int32_t mSourceC = 0; +static volatile int32_t mChannelC = 0; +static volatile int32_t mActiveC = 0; +static volatile dispatch_semaphore_t mWorkDoneSignal = NULL; + +#pragma mark Constructor and Destructor + +__attribute__((destructor)) +static void finalizer() +{ + struct timeval start; + if(gettimeofday(&start, NULL) == 0) + { + uint64_t elapsed = 0; // in usec + while (mActiveC && elapsed < (kSyphonDispatchUnloadTimeout * USEC_PER_SEC)) { + dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, (kSyphonDispatchUnloadTimeout * USEC_PER_SEC) - elapsed); + dispatch_semaphore_wait(_SyphonDispatchGetWorkSemaphore(), timeout); + struct timeval now; + if (gettimeofday(&now, NULL) != 0) break; + elapsed = ((now.tv_sec - start.tv_sec) * USEC_PER_SEC) + (now.tv_usec - start.tv_usec); + } + } + dispatch_release(_SyphonDispatchGetWorkSemaphore()); +} + +#pragma mark Channel Loop +static void *_SyphonDispatchChannelLoop(SyphonDispatchChannel *channel) +{ +#ifdef SYPHON_DISPATCH_DEBUG_LOGGING + uint64_t tid; + pthread_threadid_np(NULL,&tid); + printf("channel %llu - start\n", tid); +#endif + pthread_setname_np("info.v002.syphon.dispatch"); // shows up in gdb + dispatch_semaphore_t workDoneSem = _SyphonDispatchGetWorkSemaphore(); + while (!channel->done) + { + SyphonDispatchSourceRef source = channel->activeSource; + channel->activeSource = NULL; + + int32_t firec = source->firec; + while (firec > 0) + { +#ifdef SYPHON_DISPATCH_DEBUG_LOGGING +// printf("channel %llu - fire\n", tid); +#endif + source->fblock(); + firec = OSAtomicDecrement32Barrier(&source->firec); + } + // return to pool and then release + // so the channel can be destroyed in release if necessary + _SyphonDispatchChannelReturnToPool(channel); + _SyphonDispatchSourceRelease(source, true); + + // signal done work so app can exit + OSAtomicDecrement32Barrier(&mActiveC); + dispatch_semaphore_signal(workDoneSem); + +#ifdef SYPHON_DISPATCH_DEBUG_LOGGING +// printf("channel %llu - wait\n", tid); +#endif + // wait for something to happen + dispatch_semaphore_wait(channel->signal, DISPATCH_TIME_FOREVER); + } + dispatch_release(channel->signal); + free(channel); +#ifdef SYPHON_DISPATCH_DEBUG_LOGGING + printf("channel %llu - finish\n", tid); +#endif + return NULL; +} + +static dispatch_semaphore_t _SyphonDispatchGetWorkSemaphore() +{ + if (!mWorkDoneSignal) + { + dispatch_semaphore_t sem = dispatch_semaphore_create(0); + if (!OSAtomicCompareAndSwapPtrBarrier(NULL, sem, (void **)&mWorkDoneSignal)) + { + // setting failed, some other thread must have got there first + dispatch_release(sem); + } + } + return mWorkDoneSignal; +} + +#pragma mark Sources +SyphonDispatchSourceRef SyphonDispatchSourceCreate(void (^block)(void)) +{ + if (block) + { + SyphonDispatchSourceRef source = malloc(sizeof(SyphonDispatchSource)); + if (source) + { + source->retainc = 1; + source->fblock = Block_copy(block); + source->firec = 0; + source->cblock = NULL; + OSAtomicIncrement32Barrier(&mSourceC); + } + return source; + } + else + { + return NULL; + } + +} + +void SyphonDispatchSourceSetCompletionBlock(SyphonDispatchSourceRef source, void (^block)()) +{ + void (^copied)() = Block_copy(block); + void (^old)(); + bool result; + do { + old = source->cblock; + result = OSAtomicCompareAndSwapPtrBarrier(old, copied, (void **)&source->cblock); + } while (!result); + if (old) Block_release(old); +} + +SyphonDispatchSourceRef SyphonDispatchSourceRetain(SyphonDispatchSourceRef source) +{ + if (source) + { + OSAtomicIncrement32Barrier(&source->retainc); + } + return source; +} + +void SyphonDispatchSourceRelease(SyphonDispatchSourceRef source) +{ + _SyphonDispatchSourceRelease(source, false); +} + +static void _SyphonDispatchSourceRelease(SyphonDispatchSourceRef source, bool onChannel) +{ + if (source && (OSAtomicDecrement32Barrier(&source->retainc) == 0)) + { + if (source->cblock) + { + if (onChannel) + { + // fire the completion block + source->cblock(); + } + else + { + // fire the completion block on a new source so it too happens in the background + SyphonDispatchSourceRef csource = SyphonDispatchSourceCreate(source->cblock); + SyphonDispatchSourceFire(csource); + SyphonDispatchSourceRelease(csource); + } + + Block_release(source->cblock); + } + Block_release(source->fblock); + free(source); + OSAtomicDecrement32Barrier(&mSourceC); + bool overLimit; + do { + overLimit = (mChannelC > mSourceC); + if (overLimit) + { + SyphonDispatchChannel *channel = _SyphonDispatchChannelTryFromPool(); + if (channel) + { + int32_t old = mChannelC; + if (OSAtomicCompareAndSwap32Barrier(old, old - 1, &mChannelC)) + { + _SyphonDispatchChannelDestroy(channel); + } + else + { + // otherwise the channel-count changed so return it to the pool and try again + _SyphonDispatchChannelReturnToPool(channel); + } + } + // TODO: consider else break; here + } + + } while (overLimit); + } +} + +void SyphonDispatchSourceFire(SyphonDispatchSourceRef source) +{ + if (source) + { + if (OSAtomicIncrement32Barrier(&source->firec) == 1) + { + // if we incremented to 1 then this source is not currently on a channel + // so launch it + OSAtomicIncrement32Barrier(&mActiveC); + _SyphonDispatchChannelLaunchFromPool(source); + } + } +} + +#pragma mark Channels + +static inline void _SyphonDispatchChannelLaunchFromPool(SyphonDispatchSourceRef source) +{ + // we retain the source until it has finished this and any subsequent fires + SyphonDispatchSourceRetain(source); + // look for an existing free channel + SyphonDispatchChannel *channel = _SyphonDispatchChannelTryFromPool(); + if (channel) + { + // we found an existing channel in the pool + channel->activeSource = source; + + // signal the channel to wake + dispatch_semaphore_signal(channel->signal); + } + else + { + // we didn't find a free channel, so create a new one + channel = malloc(sizeof(SyphonDispatchChannel)); + if (channel) + { + channel->next = NULL; + channel->activeSource = source; + channel->signal = dispatch_semaphore_create(0); + channel->done = 0; + + // create a detached thread so it will clean itself up when it exits + pthread_t thread; + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); + if (pthread_create(&thread, &attr, (void *(*)(void *))_SyphonDispatchChannelLoop, channel) != 0) + { + // we couldn't create a new thread + dispatch_release(channel->signal); + free(channel); + SyphonDispatchSourceRelease(source); + } + else + { + OSAtomicIncrement32Barrier(&mChannelC); + } + } + } +} + +static void _SyphonDispatchChannelDestroy(SyphonDispatchChannel *channel) +{ + OSAtomicIncrement32Barrier(&channel->done); + dispatch_semaphore_signal(channel->signal); + // channel will be freed on its own thread +} + diff --git a/SyphonDispatch.h b/SyphonDispatch.h new file mode 100644 index 0000000..282baf1 --- /dev/null +++ b/SyphonDispatch.h @@ -0,0 +1,80 @@ +/* + SyphonDispatch.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + */ + +/* + Syphon Dispatch handles performing a task in the background such that + + - Tasks from a single source happen serially + - Threads are shared where possible + - Threads calling Syphon Dispatch never block waiting for background tasks + + Why not just use dispatch_queues? + + - Syphon Dispatch uses fewer threads + - dispatch_async must copy a block every time it is called, Syphon Dispatch can re-use the same block. + +*/ + +/* + SyphonDispatchSourceRef + Opaque reference to a dispatch source. + */ +typedef struct SyphonDispatchSource *SyphonDispatchSourceRef; + +/* + SyphonDispatchSourceCreate + Creates a new dispatch source using the supplied block, which takes no arguments and returns no value. + */ +SyphonDispatchSourceRef SyphonDispatchSourceCreate(void (^block)()); + +/* + SyphonDispatchSourceSetCompletionBlock + Sets a block to be invoked after the last reference to the source is released and all firings have been executed. + The provided block takes no arguments and returns no value. + */ +void SyphonDispatchSourceSetCompletionBlock(SyphonDispatchSourceRef source, void (^block)()); + +/* + SyphonDispatchSourceRetain + Retain + */ +SyphonDispatchSourceRef SyphonDispatchSourceRetain(SyphonDispatchSourceRef source); + +/* + SyphonDispatchSourceRelease + Release + */ +void SyphonDispatchSourceRelease(SyphonDispatchSourceRef source); + +/* + SyphonDispatchSourceFire + The block passed in at creation time is invoked on a background thread. + */ +void SyphonDispatchSourceFire(SyphonDispatchSourceRef source); diff --git a/SyphonIOSurfaceImage.h b/SyphonIOSurfaceImage.h new file mode 100644 index 0000000..16a86ce --- /dev/null +++ b/SyphonIOSurfaceImage.h @@ -0,0 +1,48 @@ +/* + SyphonIOSurfaceImage.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#import +#import "SyphonImage.h" +#import + +#define SYPHON_IOSURFACE_IMAGE_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonIOSurfaceImage) + +@interface SYPHON_IOSURFACE_IMAGE_UNIQUE_CLASS_NAME : SyphonImage { +@private + CGLContextObj cgl_ctx; + IOSurfaceRef _surface; + GLuint _texture; + NSSize _size; +} +- (id)initWithSurface:(IOSurfaceRef)surfaceRef forContext:(CGLContextObj)context; +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonIOSurfaceImage SYPHON_IOSURFACE_IMAGE_UNIQUE_CLASS_NAME; +#endif diff --git a/SyphonIOSurfaceImage.m b/SyphonIOSurfaceImage.m new file mode 100644 index 0000000..df8f6bf --- /dev/null +++ b/SyphonIOSurfaceImage.m @@ -0,0 +1,102 @@ +/* + SyphonIOSurfaceImage.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#import "SyphonIOSurfaceImage.h" +#import +// For IOSurface +#import +#import + +@implementation SyphonIOSurfaceImage +- (id)initWithSurface:(IOSurfaceRef)surfaceRef forContext:(CGLContextObj)context +{ + if (self = [super init]) + { + if (context == nil || surfaceRef == nil) + { + [self release]; + return nil; + } + _surface = (IOSurfaceRef)CFRetain(surfaceRef); + cgl_ctx = CGLRetainContext(context); + _size.width = IOSurfaceGetWidth(surfaceRef); + _size.height = IOSurfaceGetHeight(surfaceRef); + + CGLLockContext(cgl_ctx); + glPushAttrib(GL_TEXTURE_BIT); + + // create the surface backed texture + glGenTextures(1, &_texture); + glEnable(GL_TEXTURE_RECTANGLE_ARB); + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, _texture); + + CGLTexImageIOSurface2D(cgl_ctx, GL_TEXTURE_RECTANGLE_ARB, GL_RGBA8, _size.width, _size.height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, _surface, 0); + + glPopAttrib(); + CGLUnlockContext(cgl_ctx); + } + return self; +} + +- (void)destroyResources +{ + // TODO: think about exposing this so it can be destroyed straight away in a GC app + if (_texture != 0) + { + CGLLockContext(cgl_ctx); + glDeleteTextures(1, &_texture); + CGLUnlockContext(cgl_ctx); + } + if (_surface) CFRelease(_surface); + if (cgl_ctx) CGLReleaseContext(cgl_ctx); +} + +- (void)finalize +{ + [self destroyResources]; + [super finalize]; +} + +- (void)dealloc +{ + [self destroyResources]; + [super dealloc]; +} + +- (GLuint)textureName +{ + return _texture; +} + +- (NSSize)textureSize +{ + return _size; +} + +@end diff --git a/SyphonImage.h b/SyphonImage.h new file mode 100644 index 0000000..2574f83 --- /dev/null +++ b/SyphonImage.h @@ -0,0 +1,56 @@ +/* + SyphonImage.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import +#import + +#define SYPHON_IMAGE_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonImage) + +/** + SyphonImage represents an image stored as an OpenGL texture of type GL_TEXTURE_RECTANGLE_ARB. + */ + +@interface SYPHON_IMAGE_UNIQUE_CLASS_NAME : NSObject { + +} + +/** + A GLuint representing the texture name. The associated texture is of type GL_TEXTURE_RECTANGLE_ARB. + */ +@property (readonly) GLuint textureName; + +/** + A NSSize representing the dimensions of the texture. The image will fill the texture entirely. + */ +@property (readonly) NSSize textureSize; +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonImage SYPHON_IMAGE_UNIQUE_CLASS_NAME; +#endif \ No newline at end of file diff --git a/SyphonImage.m b/SyphonImage.m new file mode 100644 index 0000000..a1b7827 --- /dev/null +++ b/SyphonImage.m @@ -0,0 +1,36 @@ +/* + SyphonImage.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SyphonImage.h" + + +@implementation SyphonImage +- (GLuint)textureName {return 0;} +- (NSSize)textureSize {return NSMakeSize(0, 0);} +@end diff --git a/SyphonMachMessageReceiver.h b/SyphonMachMessageReceiver.h new file mode 100644 index 0000000..f539daa --- /dev/null +++ b/SyphonMachMessageReceiver.h @@ -0,0 +1,44 @@ +/* + SyphonMachMessageReceiver.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import +#import "SyphonMessageReceiver.h" + +#define SYPHON_MACH_MESSAGE_RECEIVER_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonMachMessageReceiver) + +@interface SYPHON_MACH_MESSAGE_RECEIVER_UNIQUE_CLASS_NAME : SyphonMessageReceiver { +@private + NSMachPort *_port; +} + +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonMachMessageReceiver SYPHON_MACH_MESSAGE_RECEIVER_UNIQUE_CLASS_NAME; +#endif \ No newline at end of file diff --git a/SyphonMachMessageReceiver.m b/SyphonMachMessageReceiver.m new file mode 100644 index 0000000..b9abf23 --- /dev/null +++ b/SyphonMachMessageReceiver.m @@ -0,0 +1,72 @@ +/* + SyphonMachMessageReceiver.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SyphonMachMessageReceiver.h" +#import "SyphonMessaging.h" +#include +#include + +@implementation SyphonMachMessageReceiver +- (id)initForName:(NSString *)name protocol:(NSString *)protocolName handler:(void (^)(id data, uint32_t type))handler +{ + if (self = [super initForName:name protocol:protocolName handler:handler]) + { + mach_port_t port; + kern_return_t result = bootstrap_check_in(bootstrap_port, [name cStringUsingEncoding:NSUTF8StringEncoding], &port); + if (result != BOOTSTRAP_SUCCESS) + { + NSLog(@"FAILED"); + [self release]; + return nil; + } + _port = [[NSMachPort alloc] initWithMachPort:port]; + [_port setDelegate:self]; + [_port scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; + } + return self; +} + +- (void)invalidate +{ + [super invalidate]; + [_port invalidate]; +} + +- (void)dealloc +{ + [_port release]; + [super dealloc]; +} + +- (void)handleMachMessage:(void *)msg +{ + // TODO: handle data in messages + [self receiveData:nil type:0]; +} +@end diff --git a/SyphonMachMessageSender.h b/SyphonMachMessageSender.h new file mode 100644 index 0000000..c97a6ac --- /dev/null +++ b/SyphonMachMessageSender.h @@ -0,0 +1,43 @@ +/* + SyphonMachMessageSender.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#import +#import "SyphonMessageSender.h" + +#define SYPHON_MACH_MESSAGE_SENDER_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonMachMessageSender) + +@interface SYPHON_MACH_MESSAGE_SENDER_UNIQUE_CLASS_NAME : SyphonMessageSender { +@private + NSMachPort *_port; +} +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonMachMessageSender SYPHON_MACH_MESSAGE_SENDER_UNIQUE_CLASS_NAME; +#endif \ No newline at end of file diff --git a/SyphonMachMessageSender.m b/SyphonMachMessageSender.m new file mode 100644 index 0000000..ded32f8 --- /dev/null +++ b/SyphonMachMessageSender.m @@ -0,0 +1,87 @@ +/* + SyphonMachMessageSender.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#import "SyphonMachMessageSender.h" +#import "SyphonMessaging.h" +//#include // using NSMachBootstrapServer instead +#include + +typedef struct { + mach_msg_header_t header; + // Think we ought to have a message type here + int data; +} SyphonMachMessage; + +@implementation SyphonMachMessageSender +- (id)initForName:(NSString *)name protocol:(NSString *)protocolName invalidationHandler:(void (^)(void))handler +{ + if (self = [super initForName:name protocol:protocolName invalidationHandler:handler]) + { + _port = [[[NSMachBootstrapServer sharedInstance] portForName:name] retain]; + } + return self; +} + +- (void)finishPort +{ + if (_port) + { + [_port invalidate]; + [_port release]; + _port = nil; + } +} + +- (void)finalize +{ + [self finishPort]; + [super finalize]; +} + +- (void)dealloc +{ + [self finishPort]; + [super dealloc]; +} + +- (void)send:(id )data ofType:(uint32_t)type +{ + // TODO: handle sending data in messages, this just sends an integer, which isn't particularly handy... + SyphonMachMessage message; + mach_msg_header_t *header = &(message.header); +// header->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, MACH_MSG_TYPE_MAKE_SEND); + // not at all sure about this: + header->msgh_bits = MACH_MSGH_BITS_REMOTE(MACH_MSG_TYPE_COPY_SEND); // mark this as complex to use OOL memory + header->msgh_remote_port = [_port machPort]; + header->msgh_local_port = MACH_PORT_NULL; + header->msgh_size = sizeof(SyphonMachMessage); + header->msgh_id = type; + mach_msg(header, MACH_SEND_MSG, header->msgh_size, 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); +} +@end diff --git a/SyphonMessageQueue.h b/SyphonMessageQueue.h new file mode 100644 index 0000000..cc11def --- /dev/null +++ b/SyphonMessageQueue.h @@ -0,0 +1,71 @@ +/* + SyphonMessageQueue.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#import +#import + +/* + + SyphonMessageQueue + + Queues messages (typically for dequeing and delivery on a seperate thread, and to that end is thread-safe). + Coalesces pending messages - messages of the same type are removed when another message of that type is queued. + + */ + +#define SYPHON_MESSAGE_QUEUE_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonMessageQueue) + +@interface SYPHON_MESSAGE_QUEUE_UNIQUE_CLASS_NAME : NSObject { +@private + OSSpinLock _lock; + void *_head; + OSQueueHead _pool; // TODO: or maybe manage our own within the lock as we lock anyway + void *_info; +} + +- (void)queue:(NSData *)content ofType:(uint32_t)type; +/* + - (BOOL)copyAndDequeue:(NSData **)content; type:(uint32_t *)type + The values of content and type will be set to those of the message from the front of the queue. + You are responsible for releasing the content NSData if present. + If no message was queued, the result will be NO. + */ +- (BOOL)copyAndDequeue:(NSData **)content type:(uint32_t *)type; + +/* + - (void *)userInfo + Attach any custom info to the queue + */ +@property (readwrite, assign) void *userInfo; + +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonMessageQueue SYPHON_MESSAGE_QUEUE_UNIQUE_CLASS_NAME; +#endif diff --git a/SyphonMessageQueue.m b/SyphonMessageQueue.m new file mode 100644 index 0000000..156b9fd --- /dev/null +++ b/SyphonMessageQueue.m @@ -0,0 +1,191 @@ +/* + SyphonMessageQueue.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#import "SyphonMessageQueue.h" + +/* + + Designed for a low number of message types. May want to use a collection class for internal storage if we need to support a great number of different types. + + */ + + +typedef struct SyphonQMember +{ + NSData *content; + uint32_t type; + struct SyphonQMember *next; +} SyphonQMember; + +static SyphonQMember *SyphonQMemberCreateFromPool(OSQueueHead *pool, NSData *mcontent, uint32_t mtype) +{ + SyphonQMember *n = OSAtomicDequeue(pool, offsetof(SyphonQMember, next)); + if (!n) + { + n = malloc(sizeof(SyphonQMember)); + } + if (n) + { + n->next = NULL; + n->content = [mcontent retain]; + n->type = mtype; + } + return n; +} + +#define SyphonQMemberReturnToPool(pool, member) OSAtomicEnqueue((pool), (member), offsetof(SyphonQMember, next)) + +#define SyphonQMemberDestroy(m) free((m)) + +@implementation SyphonMessageQueue +- (id)init +{ + if (self = [super init]) + { + // These are the values of OS_ATOMIC_QUEUE_INIT + _pool.opaque1 = NULL; + _pool.opaque2 = 0; + _lock = OS_SPINLOCK_INIT; + } + return self; +} + +- (void)drainQueueAndPool +{ + SyphonQMember *m = _head; + SyphonQMember *n; + while (m) + { + n = m; + m = m->next; + [n->content release]; + SyphonQMemberDestroy(n); + } + do { + m = OSAtomicDequeue(&_pool, offsetof(SyphonQMember, next)); + SyphonQMemberDestroy(m); + } while (m); +} + +- (void)finalize +{ + [self drainQueueAndPool]; + [super finalize]; +} + +- (void)dealloc +{ + [self drainQueueAndPool]; + [super dealloc]; +} + +- (void)queue:(NSData *)content ofType:(uint32_t)type +{ + SyphonQMember *incoming = SyphonQMemberCreateFromPool(&_pool, content, type); + OSSpinLockLock(&_lock); + // We do duplicate message removal and then new message insertion in two passes. + // Feel free to improve on that... + SyphonQMember *current = (SyphonQMember *)_head; + SyphonQMember **prev = (SyphonQMember **)&_head; + SyphonQMember *delete = NULL; + while (current) + { + if (current->type == type) + { + [current->content release]; + *prev = current->next; + delete = current; + } + else + { + prev = ¤t->next; + } + current = current->next; + if (delete) + { + SyphonQMemberReturnToPool(&_pool, delete); + delete = NULL; + } + } + if (_head == NULL) + { + _head = incoming; + } + else + { + current = _head; + while (current->next != NULL) + { + current = current->next; + } + current->next = incoming; + } + OSSpinLockUnlock(&_lock); +} + +- (BOOL)copyAndDequeue:(NSData **)content type:(uint32_t *)type +{ + BOOL result; + SyphonQMember *toDelete; + OSSpinLockLock(&_lock); + if (_head) + { + result = YES; + SyphonQMember *head = (SyphonQMember *)_head; + *content = head->content; + *type = head->type; + _head = head->next; + toDelete = head; + } + else + { + result = NO; + *content = nil; + *type = 0; + toDelete = NULL; + } + OSSpinLockUnlock(&_lock); + if (toDelete) SyphonQMemberReturnToPool(&_pool, toDelete); + return result; +} + +- (void *)userInfo +{ + return _info; +} + +- (void)setUserInfo:(void *)info +{ + bool result; + do { + void *old = _info; + result = OSAtomicCompareAndSwapPtrBarrier(old, info, &_info); + } while (!result); +} +@end diff --git a/SyphonMessageReceiver.h b/SyphonMessageReceiver.h new file mode 100644 index 0000000..c26d678 --- /dev/null +++ b/SyphonMessageReceiver.h @@ -0,0 +1,50 @@ +/* + SyphonMessageReceiver.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import + +#define SYPHON_MESSAGE_RECEIVER_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonMessageReceiver) + +@interface SYPHON_MESSAGE_RECEIVER_UNIQUE_CLASS_NAME : NSObject { +@private + NSString *_name; + void (^_handler)(id , uint32_t); +} +- (id)initForName:(NSString *)name protocol:(NSString *)protocolName handler:(void (^)(id data, uint32_t type))handler; +@property (readonly) NSString *name; +// Always invalidate before release +- (void)invalidate; +@end +@interface SYPHON_MESSAGE_RECEIVER_UNIQUE_CLASS_NAME (Subclassing) +- (void)receiveData:(id )data type:(uint32_t)type; +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonMessageReceiver SYPHON_MESSAGE_RECEIVER_UNIQUE_CLASS_NAME; +#endif diff --git a/SyphonMessageReceiver.m b/SyphonMessageReceiver.m new file mode 100644 index 0000000..8d82575 --- /dev/null +++ b/SyphonMessageReceiver.m @@ -0,0 +1,94 @@ +/* + SyphonMessageReceiver.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SyphonMessageReceiver.h" +#import "SyphonMessaging.h" +#import "SyphonCFMessageReceiver.h" +//#import "SyphonMachMessageReceiver.h" + +@implementation SyphonMessageReceiver +- (id)initForName:(NSString *)name protocol:(NSString *)protocolName handler:(void (^)(id data, uint32_t type))handler +{ + if (self = [super init]) + { + if ([self class] == [SyphonMessageReceiver class]) + { + [self release]; + if ([protocolName isEqualToString:SyphonMessagingProtocolCFMessage]) + { + return [[SyphonCFMessageReceiver alloc] initForName:name protocol:protocolName handler:handler]; + } + /* + else if ([protocolName isEqualToString:SyphonMessagingProtocolMachMessage]) + { + return [[SyphonMessageReceiverMachMessage alloc] initForName:name protocol:protocolName handler:handler]; + } + */ + else + { + return nil; + } + } + else + { + // SyphonMessageReceiver init here + if (handler == nil) + { + [self release]; + return nil; + } + _name = [name copy]; + _handler = [handler copy]; + } + } + return self; +} + +- (void)invalidate +{ + +} + +- (void)dealloc +{ + [_name release]; + [_handler release]; + [super dealloc]; +} + +- (NSString *)name +{ + return _name; +} + +- (void)receiveData:(id )data type:(uint32_t)type +{ + _handler(data, type); +} +@end diff --git a/SyphonMessageSender.h b/SyphonMessageSender.h new file mode 100644 index 0000000..b025e8f --- /dev/null +++ b/SyphonMessageSender.h @@ -0,0 +1,50 @@ +/* + SyphonMessageSender.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import + +#define SYPHON_MESSAGE_SENDER_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonMessageSender) + +@interface SYPHON_MESSAGE_SENDER_UNIQUE_CLASS_NAME : NSObject { +@private + NSString *_name; + void (^_handler)(void); +} +- (id)initForName:(NSString *)name protocol:(NSString *)protocolName invalidationHandler:(void (^)(void))handler; +@property (readonly) NSString *name; +@property (readonly) BOOL isValid; +- (void)send:(id )data ofType:(uint32_t)type; +@end +@interface SYPHON_MESSAGE_SENDER_UNIQUE_CLASS_NAME (Subclassing) +- (void)invalidate; +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonMessageSender SYPHON_MESSAGE_SENDER_UNIQUE_CLASS_NAME; +#endif diff --git a/SyphonMessageSender.m b/SyphonMessageSender.m new file mode 100644 index 0000000..916080c --- /dev/null +++ b/SyphonMessageSender.m @@ -0,0 +1,97 @@ +/* + SyphonMessageSender.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SyphonMessageSender.h" +#import "SyphonMessaging.h" +#import "SyphonCFMessageSender.h" +//#import "SyphonMachMessageSender.h" + +@implementation SyphonMessageSender +- (id)initForName:(NSString *)name protocol:(NSString *)protocolName invalidationHandler:(void (^)(void))handler; +{ + if (self = [super init]) + { + if ([self class] == [SyphonMessageSender class]) + { + [self release]; + if ([protocolName isEqualToString:SyphonMessagingProtocolCFMessage]) + { + return [[SyphonCFMessageSender alloc] initForName:name protocol:protocolName invalidationHandler:handler]; + } + /* + else if ([protocolName isEqualToString:SyphonMessagingProtocolMachMessage]) + { + return [[SyphonMessageSenderMachMessage alloc] initForName:name protocol:protocolName invalidationHandler:handler]; + } + */ + else + { + return nil; + } + } + else + { + // SyphonMessageSender init here + _handler = [handler copy]; + _name = [name copy]; + } + } + return self; +} + +- (void)dealloc +{ + [_name release]; + [_handler release]; + [super dealloc]; +} + +- (NSString *)name +{ + return _name; +} + +- (BOOL)isValid +{ + return NO; +} + +- (void)send:(id )data ofType:(uint32_t)type +{ + // subclasses override this +} + +- (void)invalidate +{ + if (_handler != nil) + { + _handler(); + } +} +@end diff --git a/SyphonMessaging.h b/SyphonMessaging.h new file mode 100644 index 0000000..a80f4c7 --- /dev/null +++ b/SyphonMessaging.h @@ -0,0 +1,35 @@ +/* + SyphonMessaging.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import +#import "SyphonMessageReceiver.h" +#import "SyphonMessageSender.h" + +//extern NSString * const SyphonMessagingProtocolMachMessage; +extern NSString * const SyphonMessagingProtocolCFMessage; \ No newline at end of file diff --git a/SyphonMessaging.m b/SyphonMessaging.m new file mode 100644 index 0000000..297ec07 --- /dev/null +++ b/SyphonMessaging.m @@ -0,0 +1,33 @@ +/* + SyphonMessaging.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SyphonMessaging.h" + +//NSString * const SyphonMessagingProtocolMachMessage = @"SyphonMessagingProtocolMachMessage_v1"; +NSString * const SyphonMessagingProtocolCFMessage = @"SyphonMessagingProtocolCFMessage_v1"; diff --git a/SyphonPrivate.h b/SyphonPrivate.h new file mode 100644 index 0000000..dc3bcf0 --- /dev/null +++ b/SyphonPrivate.h @@ -0,0 +1,93 @@ +/* + SyphonPrivate.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#import // For SyphonSafeBool + +#define kSyphonDictionaryVersion 0U + +#ifdef __OBJC__ + +#define kSyphonIdentifier @"info.v002.Syphon" + +// NSNotification names for Syphon's distributed notifications +#define SyphonServerAnnounceRequest @"info.v002.Syphon.ServerAnnounceRequest" +#define SyphonServerAnnounce @"info.v002.Syphon.ServerAnnounce" +#define SyphonServerRetire @"info.v002.Syphon.ServerRetire" +#define SyphonServerUpdate @"info.v002.Syphon.ServerUpdate" + + +// Server-description keys // and content +extern NSString * const SyphonServerDescriptionUUIDKey; // NSString +extern NSString * const SyphonServerDescriptionNameKey; // NSString +extern NSString * const SyphonServerDescriptionAppNameKey; // NSString +// extern NSString * const SyphonServerDescriptionIconKey; // TODO: remove this from here if we continue to reconstruct the icon on the far side rather than pack it +extern NSString * const SyphonServerDescriptionDictionaryVersionKey; // NSNumber as unsigned int +extern NSString * const SyphonServerDescriptionSurfacesKey; // An NSArray of NSDictionaries describing each supported surface type + +// Surface-description (dictionary for SyphonServerDescriptionSurfacesKey) keys // and content +extern NSString * const SyphonSurfaceType; +extern NSString * const SyphonSurfaceTypeIOSurface; + +// SyphonServer options +extern NSString * const SyphonServerOptionIsPrivate; + + +NSString *SyphonCreateUUIDString(); + +typedef volatile int32_t SyphonSafeBool; + +BOOL SyphonSafeBoolGet(SyphonSafeBool *b); +void SyphonSafeBoolSet(SyphonSafeBool *b, BOOL value); + +#endif + +#pragma mark Communication Constants +/* + + Various constants used as message types in communications. + + Groupings are for one sender/receiver pair + + */ +enum { + SyphonMessageTypeAddClientForInfo = 0, /* Accompanying data is a NSString with the client's UUID. + Server will send server description changes, IOSurfaceID changes and server retirement notices. */ + SyphonMessageTypeAddClientForFrames = 1, /* Accompanying data is a NSString with the client's UUID. + Server will send new frame notices. */ + SyphonMessageTypeRemoveClientForInfo = 2, /* Accompanying data is a NSString with the client's UUID. + Server will stop sending server description changes, IOSurfaceID changes and server retirement notices. */ + SyphonMessageTypeRemoveClientForFrames = 3 /* Accompanying data is a NSString with the client's UUID. + Server will stop sending new frame notices. */ +}; + +enum { + SyphonMessageTypeUpdateServerName = 0, /* Accompanying data is the server name as NSString. */ + SyphonMessageTypeNewFrame = 1, /* No accompanying data. */ + SyphonMessageTypeUpdateSurfaceID = 2, /* Accompanying data is an unsigned integer value in a NSNumber representing a new IOSurfaceID */ + SyphonMessageTypeRetireServer = 3 /* No accompanying data. */ +}; \ No newline at end of file diff --git a/SyphonPrivate.m b/SyphonPrivate.m new file mode 100644 index 0000000..8d59833 --- /dev/null +++ b/SyphonPrivate.m @@ -0,0 +1,69 @@ +/* + SyphonConstants.c + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SyphonPrivate.h" + +NSString * const SyphonServerDescriptionDictionaryVersionKey = @"SyphonServerDescriptionDictionaryVersionKey"; +NSString * const SyphonServerDescriptionUUIDKey = @"SyphonServerDescriptionUUIDKey"; +NSString * const SyphonServerDescriptionNameKey = @"SyphonServerDescriptionNameKey"; +NSString * const SyphonServerDescriptionAppNameKey = @"SyphonServerDescriptionAppNameKey"; +NSString * const SyphonServerDescriptionIconKey = @"SyphonServerDescriptionIconKey"; +NSString * const SyphonServerDescriptionSurfacesKey = @"SyphonServerDescriptionSurfacesKey"; + +NSString * const SyphonSurfaceType = @"SyphonSurfaceType"; +NSString * const SyphonSurfaceTypeIOSurface = @"SyphonSurfaceTypeIOSurface"; + + +NSString * const SyphonServerOptionIsPrivate = @"SyphonServerOptionIsPrivate"; + +NSString *SyphonCreateUUIDString() +{ + // generate UUID + CFUUIDRef uuidObj = CFUUIDCreate(nil); + CFStringRef uuid = CFUUIDCreateString(nil, uuidObj); + CFRelease(uuidObj); + NSString *result = [[NSString alloc] initWithFormat:@"%@.%@", kSyphonIdentifier, uuid]; + CFRelease(uuid); + return result; +} + +BOOL SyphonSafeBoolGet(SyphonSafeBool *b) +{ + return (*b == 0 ? NO : YES); +} + +void SyphonSafeBoolSet(SyphonSafeBool *b, BOOL value) +{ + bool result; + int32_t new = value ? 1 : 0; + do { + int32_t old = *b; + result = OSAtomicCompareAndSwap32(old, new, b); + } while (!result); +} diff --git a/SyphonServer.h b/SyphonServer.h new file mode 100644 index 0000000..e101362 --- /dev/null +++ b/SyphonServer.h @@ -0,0 +1,162 @@ +/* + SyphonServer.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import +#import +#import + +/*! @name Server Options Dictionary Key Constants */ +/*! @{ */ + +/*! + @relates SyphonServer + If this key is matched with a NSNumber with a BOOL value YES, then the server will be invisible to other Syphon users. You are then responsible for passing the NSDictionary returned by serverDescription to processes which require it to create a SyphonClient. Default is NO. + */ +extern NSString * const SyphonServerOptionIsPrivate; + +/*! @} */ + +/*! + @nosubgrouping + SyphonServer handles the publishing of frames from one video source to any number of clients. Frames can be published either by passing in an existing OpenGL texture, or by binding the server's FBO, drawing using OpenGL calls, then calling the unbindAndPublish method. + + A SyphonServer object represents one video output for your application. If your application produces several video outputs, then they should each have their own SyphonServer. If your application might have multiple servers running, you should name each server to aid identification by users. + + It is safe to access instances of this class across threads, however a call to bindToDrawFrameOfSize: must have returned before a call is made to unbindAndPublish, and these methods must be paired and called in order. You should not call the stop method while the FBO is bound. + */ + +#define SYPHON_SERVER_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonServer) + +@interface SYPHON_SERVER_UNIQUE_CLASS_NAME : NSObject +{ +@private + NSString *_name; + NSString *_uuid; + BOOL _broadcasts; + + id _connectionManager; + + CGLContextObj cgl_ctx; + + void *_surfaceRef; + BOOL _pushPending; + NSSize _surfaceSize; + GLuint _surfaceTexture; + GLuint _surfaceFBO; + + GLint _previousReadFBO; + GLint _previousDrawFBO; + GLint _previousFBO; + + int32_t _mdLock; +} +/** @name Instantiation */ +/** @{ */ +/*! + Creates a new server with the specified human-readable name (which need not be unique), CGLContext and options. The server will be started immediately. Init may fail and return nil if the server could not be started. + @param serverName Non-unique human readable server name. This is not required and may be nil, but is usually used by clients in their UI to aid identification. + @param context The CGLContextObj context that textures will be valid and available on for publishing. + @param options A dictionary containing key-value pairs to specify options for the server. Currently the only option is SyphonServerOptionIsPrivate. See its description for details. + @returns A newly intialized SyphonServer. Nil on failure. +*/ + +- (id)initWithName:(NSString*)serverName context:(CGLContextObj)context options:(NSDictionary *)options; + +/** @} */ + +/** @name Properties */ +/** @{ */ +/*! + The CGLContext the server uses for drawing. This may or may not be the context passed in at init. +*/ + +@property (readonly) CGLContextObj context; + +/*! + A string representing the name of the SyphonServer. +*/ + +@property (retain) NSString* name; + +/*! + A dictionary describing the server. Normally you won't need to access this, however if you created the server as private (using SyphonServerOptionIsPrivate) then you must pass this dictionary to any process in which you wish to create a SyphonClient. You should not rely on the presence of any particular keys in this dictionary. The content will always conform to the \ protocol. +*/ + +@property (readonly) NSDictionary* serverDescription; + +/*! +YES if clients are currently attached, NO otherwise. If you generate frames frequently (for instance on a display-link timer), you may choose to test this and only call publishFrameTexture:textureTarget:imageRegion:textureDimensions:flipped: when clients are attached. +*/ + +@property (readonly) BOOL hasClients; + +/** @} */ +/** @name Publishing Frames */ +/** @{ */ + +/*! + Publishes the part of the texture described in region of the named texture to clients. The texture is copied and can be safely disposed of or modified once this method has returned. You should not bracket calls to this method with calls to -bindToDrawFrameOfSize: and -unbindAndPublish - they are provided as an alternative to using this method. + + This method does not lock the server's CGL context. If there is a chance of other threads using the context during calls to this method, bracket it with calls to CGLLockContext() and CGLUnlockContext(), passing in the value of the server's context property as the argument. + @param texID The name of the texture to publish, which must be a texture valid in the CGL context provided when the server was created. + @param target GL_TEXTURE_RECTANGLE_EXT or GL_TEXTURE_2D. + @param region The sub-region of the texture to publish. + @param size The full size of the texture + @param isFlipped Is the texture flipped? +*/ + +- (void)publishFrameTexture:(GLuint)texID textureTarget:(GLenum)target imageRegion:(NSRect)region textureDimensions:(NSSize)size flipped:(BOOL)isFlipped; + +/*! + Binds an FBO for you to publish a frame of the given dimensions by drawing into the server's context (check it using the context property). If YES is returned, you must pair this with a call to -unbindAndPublish once you have finished drawing. If NO is returned you should abandon drawing and not call -unbindAndPublish. + This method does not lock the server's CGL context. If there is a chance other threads may use the context during calls to this method, bracket it with calls to CGLLockContext() and CGLUnlockContext(), passing in the value of the server's context property as the argument. + @param size The size the frame you wish to publish. + @returns YES if binding succeeded, NO otherwise. +*/ + +- (BOOL)bindToDrawFrameOfSize:(NSSize)size; + +/*! + Restores any previously bound FBO and publishes the just-drawn frame. This method will flush the GL context (so you don't have to). + This method does not lock the server's CGL context. If there is a chance of other threads using the context during calls to this method, bracket it with calls to CGLLockContext() and CGLUnlockContext(), passing in the value of the server's context property as the argument. +*/ + +- (void)unbindAndPublish; + +/*! + Stops the server instance. In garbage-collected applications you must call this method prior to removing strong references to the server. In non-garbage-collected applications, use of this method is optional. +*/ + +- (void)stop; +/** @} */ +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonServer SYPHON_SERVER_UNIQUE_CLASS_NAME; +#endif \ No newline at end of file diff --git a/SyphonServer.m b/SyphonServer.m new file mode 100644 index 0000000..d514477 --- /dev/null +++ b/SyphonServer.m @@ -0,0 +1,562 @@ +/* + SyphonServer.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#import "SyphonServer.h" +#import "SyphonPrivate.h" +#import "SyphonServerConnectionManager.h" + +#import +#import +#import + +#import + +@interface SyphonServer (Private) +// IOSurface +- (void) setupIOSurface; +- (void) destroyIOSurface; +// Broadcast and Discovery +- (void)startBroadcasts; +- (void)stopBroadcasts; +- (void)broadcastServerAnnounce; +- (void)broadcastServerUpdate; +@end + +@implementation SyphonServer + ++ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)theKey +{ + BOOL automatic; + if ([theKey isEqualToString:@"hasClients"]) + { + automatic=NO; + } + else + { + automatic=[super automaticallyNotifiesObserversForKey:theKey]; + } + return automatic; +} + ++ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key +{ + if ([key isEqualToString:@"serverDescription"]) + { + return [NSSet setWithObject:@"name"]; + } + else + { + return [super keyPathsForValuesAffectingValueForKey:key]; + } +} + +- (id)init +{ + return [self initWithName:nil context:NULL options:nil]; +} + +- (id)initWithName:(NSString*)serverName context:(CGLContextObj)context options:(NSDictionary *)options +{ + if((self = [super init])) + { + if (context == NULL) + { + [self release]; + return nil; + } + + _mdLock = OS_SPINLOCK_INIT; + + cgl_ctx = CGLRetainContext(context); + + if (serverName == nil) + { + serverName = @""; + } + _name = [serverName copy]; + _uuid = SyphonCreateUUIDString(); + + _connectionManager = [[SyphonServerConnectionManager alloc] initWithUUID:_uuid options:options]; + + [(SyphonServerConnectionManager *)_connectionManager addObserver:self forKeyPath:@"hasClients" options:NSKeyValueObservingOptionPrior context:nil]; + + if (![(SyphonServerConnectionManager *)_connectionManager start]) + { + [self release]; + return nil; + } + + _surfaceSize = NSZeroSize; + + NSNumber *isPrivate = [options objectForKey:SyphonServerOptionIsPrivate]; + if ([isPrivate respondsToSelector:@selector(boolValue)] + && [isPrivate boolValue] == YES) + { + _broadcasts = NO; + } + else + { + _broadcasts = YES; + } + + if (_broadcasts) + { + [self startBroadcasts]; + } + + } + return self; +} + +- (void) shutDownServer +{ + if (_connectionManager) + { + [(SyphonServerConnectionManager *)_connectionManager removeObserver:self forKeyPath:@"hasClients"]; + [(SyphonServerConnectionManager *)_connectionManager stop]; + [(SyphonServerConnectionManager *)_connectionManager release]; + _connectionManager = nil; + + [self destroyIOSurface]; + + if (_broadcasts) + { + [self stopBroadcasts]; + } + } + + if (cgl_ctx) + { + CGLReleaseContext(cgl_ctx); + cgl_ctx = NULL; + } +} + +- (void)finalize +{ + [self shutDownServer]; + [super finalize]; +} + +- (void) dealloc +{ + SYPHONLOG(@"Server deallocing, name: %@, UUID: %@", self.name, [self.serverDescription objectForKey:SyphonServerDescriptionUUIDKey]); + [self shutDownServer]; + [_name release]; + [_uuid release]; + [super dealloc]; +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + if ([keyPath isEqualToString:@"hasClients"]) + { + if ([[change objectForKey:NSKeyValueChangeNotificationIsPriorKey] boolValue] == YES) + { + [self willChangeValueForKey:keyPath]; + } + else + { + [self didChangeValueForKey:keyPath]; + } + } + else + { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + } +} + +- (CGLContextObj)context +{ + return cgl_ctx; +} + +- (NSDictionary *)serverDescription +{ + NSDictionary *surface = ((SyphonServerConnectionManager *)_connectionManager).surfaceDescription; + if (!surface) surface = [NSDictionary dictionary]; + return [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithUnsignedInt:kSyphonDictionaryVersion], SyphonServerDescriptionDictionaryVersionKey, + self.name, SyphonServerDescriptionNameKey, + _uuid, SyphonServerDescriptionUUIDKey, + [[NSRunningApplication currentApplication] localizedName], SyphonServerDescriptionAppNameKey, + [NSArray arrayWithObject:surface], SyphonServerDescriptionSurfacesKey, + nil]; +} + +- (NSString*)name +{ + OSSpinLockLock(&_mdLock); + NSString *result = [_name retain]; + OSSpinLockUnlock(&_mdLock); + return [result autorelease]; +} + +- (void)setName:(NSString *)newName +{ + [newName retain]; + OSSpinLockLock(&_mdLock); + [_name release]; + _name = newName; + OSSpinLockUnlock(&_mdLock); + [(SyphonServerConnectionManager *)_connectionManager setName:newName]; + if (_broadcasts) + { + [self broadcastServerUpdate]; + } +} + +- (void)stop +{ + [self shutDownServer]; +} + +- (BOOL)hasClients +{ + return ((SyphonServerConnectionManager *)_connectionManager).hasClients; +} + +- (BOOL)bindToDrawFrameOfSize:(NSSize)size +{ + // TODO: we should probably check we're not already bound and raise an exception here + // to enforce proper use +#if !SYPHON_DEBUG_NO_DRAWING + // check the images bounds, compare with our cached rect, if they dont match, rebuild the IOSurface/FBO/Texture combo. + if(! NSEqualSizes(_surfaceSize, size)) + { + _surfaceSize = size; + [self destroyIOSurface]; + [self setupIOSurface]; + _pushPending = YES; + } + + glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &_previousFBO); + glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING_EXT, &_previousReadFBO); + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING_EXT, &_previousDrawFBO); + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _surfaceFBO); + + GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if(status != GL_FRAMEBUFFER_COMPLETE_EXT) + { + // restore state + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _previousFBO); + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, _previousReadFBO); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, _previousDrawFBO); + return NO; + } +#endif + return YES; +} + +- (void)unbindAndPublish +{ +#if !SYPHON_DEBUG_NO_DRAWING + // flush to make sure IOSurface updates are seen globally. + glFlushRenderAPPLE(); + + // restore state + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _previousFBO); + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, _previousReadFBO); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, _previousDrawFBO); +#endif + if (_pushPending) + { + // Push the new surface ID to clients + [(SyphonServerConnectionManager *)_connectionManager setSurfaceID:IOSurfaceGetID(_surfaceRef)]; + _pushPending = NO; + } + [(SyphonServerConnectionManager *)_connectionManager publishNewFrame]; +} + +- (void)publishFrameTexture:(GLuint)texID textureTarget:(GLenum)target imageRegion:(NSRect)region textureDimensions:(NSSize)size flipped:(BOOL)isFlipped +{ + if(texID != 0 && ((target == GL_TEXTURE_2D) || (target == GL_TEXTURE_RECTANGLE_EXT)) && [self bindToDrawFrameOfSize:region.size]) + { +#if !SYPHON_DEBUG_NO_DRAWING + // render to our FBO with an IOSurface backed texture attachment (whew!) + // GLint matrixMode; + // glGetIntegerv(GL_MATRIX_MODE, &matrixMode); + + glPushAttrib(GL_ALL_ATTRIB_BITS); + glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS); + // Setup OpenGL states + glViewport(0, 0, _surfaceSize.width, _surfaceSize.height); + + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glLoadIdentity(); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, _surfaceSize.width, 0, _surfaceSize.height, -1, 1); + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + + // dont bother clearing. we dont have any alpha so we just write over the buffer contents. saves us a write. + // via GL_REPLACE TEX_ENV + glActiveTexture(GL_TEXTURE0); + glEnable(target); + glBindTexture(target, texID); + + // do a nearest interp. +// glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); +// glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glColor4f(1.0, 1.0, 1.0, 1.0); + + // why do we need it ? + glDisable(GL_BLEND); + + GLfloat tex_coords[8]; + + if(target == GL_TEXTURE_2D) + { + GLfloat texOriginX = region.origin.x / size.width; + GLfloat texOriginY = region.origin.y / size.height; + GLfloat texExtentX = (region.size.width + region.origin.x) / size.width; + GLfloat texExtentY = (region.size.height + region.origin.y) / size.height; + + if(!isFlipped) + { + // X // Y + tex_coords[0] = texOriginX; tex_coords[1] = texOriginY; + tex_coords[2] = texOriginX; tex_coords[3] = texExtentY; + tex_coords[4] = texExtentX; tex_coords[5] = texExtentY; + tex_coords[6] = texExtentX; tex_coords[7] = texOriginY; + } + else + { + tex_coords[0] = texOriginX; tex_coords[1] = texExtentY; + tex_coords[2] = texOriginX; tex_coords[3] = texOriginY; + tex_coords[4] = texExtentX; tex_coords[5] = texOriginY; + tex_coords[6] = texExtentX; tex_coords[7] = texExtentY; + } + } + else + { + if(!isFlipped) + { // X // Y + tex_coords[0] = region.origin.x; tex_coords[1] = 0.0; + tex_coords[2] = region.origin.x; tex_coords[3] = region.size.height + region.origin.y; + tex_coords[4] = region.size.width + region.origin.x; tex_coords[5] = region.size.height + region.origin.y; + tex_coords[6] = region.size.width + region.origin.x; tex_coords[7] = 0.0; + } + else + { + tex_coords[0] = region.origin.x; tex_coords[1] = region.size.height + region.origin.y; + tex_coords[2] = region.origin.x; tex_coords[3] = region.origin.y; + tex_coords[4] = _surfaceSize.width; tex_coords[5] = region.origin.y; + tex_coords[6] = _surfaceSize.width; tex_coords[7] = region.size.height + region.origin.y; + } + } + + GLfloat verts[] = + { + 0.0f, 0.0f, + 0.0f, _surfaceSize.height, + _surfaceSize.width, _surfaceSize.height, + _surfaceSize.width, 0.0f, + }; + + // Ought to cache the GL_ARRAY_BUFFER_BINDING, GL_ELEMENT_ARRAY_BUFFER_BINDING, set buffer to 0, and reset + GLint arrayBuffer, elementArrayBuffer; + glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &elementArrayBuffer); + glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &arrayBuffer); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + + glEnableClientState( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer(2, GL_FLOAT, 0, tex_coords ); + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(2, GL_FLOAT, 0, verts ); + glDrawArrays( GL_TRIANGLE_FAN, 0, 4 ); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementArrayBuffer); + glBindBuffer(GL_ARRAY_BUFFER, arrayBuffer); + + glBindTexture(target, 0); + + // Restore OpenGL states + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + + + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + + glPopClientAttrib(); + glPopAttrib(); +#endif // SYPHON_DEBUG_NO_DRAWING + [self unbindAndPublish]; + } +// glMatrixMode(matrixMode); +} + +#pragma mark - +#pragma mark Private methods + +#pragma mark IOSurface handling +- (void) setupIOSurface +{ +#if !SYPHON_DEBUG_NO_DRAWING + // init our texture and IOSurface + NSDictionary* surfaceAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES], (NSString*)kIOSurfaceIsGlobal, + [NSNumber numberWithUnsignedInteger:(NSUInteger)_surfaceSize.width], (NSString*)kIOSurfaceWidth, + [NSNumber numberWithUnsignedInteger:(NSUInteger)_surfaceSize.height], (NSString*)kIOSurfaceHeight, + [NSNumber numberWithUnsignedInteger:4U], (NSString*)kIOSurfaceBytesPerElement, nil]; + + _surfaceRef = IOSurfaceCreate((CFDictionaryRef) surfaceAttributes); + [surfaceAttributes release]; + + // make a new texture. + + // save state + glPushAttrib(GL_ALL_ATTRIB_BITS); + glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &_previousFBO); + glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING_EXT, &_previousReadFBO); + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING_EXT, &_previousDrawFBO); + + + glGenTextures(1, &_surfaceTexture); + glEnable(GL_TEXTURE_RECTANGLE_ARB); + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, _surfaceTexture); + + CGLError err = CGLTexImageIOSurface2D(cgl_ctx, GL_TEXTURE_RECTANGLE_ARB, GL_RGBA8, (GLsizei)_surfaceSize.width, (GLsizei) _surfaceSize.height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, _surfaceRef, 0); + if(err != kCGLNoError) + { + NSLog(@"Syphon Server: Error creating IOSurface texture: %s & %x", CGLErrorString(err), glGetError()); + _surfaceSize = NSZeroSize; + [self destroyIOSurface]; + } + else + { + // no error + glGenFramebuffersEXT(1, &_surfaceFBO); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _surfaceFBO); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_EXT, _surfaceTexture, 0); + + GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if(status != GL_FRAMEBUFFER_COMPLETE_EXT) + { + NSLog(@"Syphon Server: Cannot create FBO (OpenGL Error %04X)", status); + _surfaceSize = NSZeroSize; + [self destroyIOSurface]; + } + } + + // restore state + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _previousFBO); + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, _previousReadFBO); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, _previousDrawFBO); + glPopAttrib(); +#endif // SYPHON_DEBUG_NO_DRAWING +} + +- (void) destroyIOSurface +{ +#if !SYPHON_DEBUG_NO_DRAWING + if (_surfaceRef != NULL) + { + glDeleteTextures(1,&_surfaceTexture); + _surfaceTexture = 0; + + glDeleteFramebuffersEXT(1, &_surfaceFBO); + _surfaceFBO = 0; + + CFRelease(_surfaceRef); + _surfaceRef = NULL; + } +#endif +} + +#pragma mark Notification Handling for Server Presence +/* + Broadcast and discovery is done via NSDistributedNotificationCenter. Servers notify announce, change (currently only affects name) and retirement. + Discovery is done by a discovery-request notification, to which servers respond with an announce. + + If this gets unweildy we could move it into a SyphonBroadcaster class + + */ + +- (void)startBroadcasts +{ + // Register for any Announcement Requests. + [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDiscoveryRequest:) name:SyphonServerAnnounceRequest object:nil]; + + [self broadcastServerAnnounce]; +} + +- (void) handleDiscoveryRequest:(NSNotification*) aNotification +{ + SYPHONLOG(@"Got Discovery Request"); + + [self broadcastServerAnnounce]; +} + +- (void)broadcastServerAnnounce +{ + if (_broadcasts) + { + NSDictionary *description = self.serverDescription; + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:SyphonServerAnnounce + object:[description objectForKey:SyphonServerDescriptionUUIDKey] + userInfo:description]; + } +} + +- (void)broadcastServerUpdate +{ + NSDictionary *description = self.serverDescription; + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:SyphonServerUpdate + object:[description objectForKey:SyphonServerDescriptionUUIDKey] + userInfo:description]; +} + +- (void)stopBroadcasts +{ + [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; + NSDictionary *description = self.serverDescription; + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:SyphonServerRetire + object:[description objectForKey:SyphonServerDescriptionUUIDKey] + userInfo:description]; +} + +@end + + diff --git a/SyphonServerConnectionManager.h b/SyphonServerConnectionManager.h new file mode 100644 index 0000000..8b7b5d6 --- /dev/null +++ b/SyphonServerConnectionManager.h @@ -0,0 +1,70 @@ +/* + SyphonServerConnectionManager.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#import +#import "SyphonMessaging.h" +#import "SyphonPrivate.h" + +/* + This class is not KVO compliant for serverDescription, as changes to name won't raise a notification for serverDescription + This isn't a problem currently, as SyphonServer is KVO compliant for name/serverDescription + */ + +#define SYPHON_SERVER_CONNECTION_MANAGER_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonServerConnectionManager) + +@interface SYPHON_SERVER_CONNECTION_MANAGER_UNIQUE_CLASS_NAME : NSObject { +@private + SyphonMessageReceiver *_connection; + NSMutableDictionary *_infoClients; + NSMutableDictionary *_frameClients; + BOOL _alive; + NSString *_uuid; + IOSurfaceID _surfaceID; + SyphonSafeBool _hasClients; + dispatch_queue_t _queue; +} +- (id)initWithUUID:(NSString *)uuid options:(NSDictionary *)options; +@property (readonly) NSDictionary *surfaceDescription; +/* + - (BOOL)start + + Starts the server. Returns YES if the server was started, NO if it could not be started. + */ +- (BOOL)start; +- (void)stop; +@property (readonly) BOOL hasClients; +- (void)publishNewFrame; +- (void)setSurfaceID:(IOSurfaceID)newID; +- (void)setName:(NSString *)name; +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonServerConnectionManager SYPHON_SERVER_CONNECTION_MANAGER_UNIQUE_CLASS_NAME; +#endif \ No newline at end of file diff --git a/SyphonServerConnectionManager.m b/SyphonServerConnectionManager.m new file mode 100644 index 0000000..c7ea244 --- /dev/null +++ b/SyphonServerConnectionManager.m @@ -0,0 +1,367 @@ +/* + SyphonServerConnectionManager.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SyphonServerConnectionManager.h" +#import "SyphonPrivate.h" + +@interface SyphonServerConnectionManager (Private) +- (void)addInfoClient:(NSString *)clientUUID; +- (void)removeInfoClient:(NSString *)clientUUID; +- (void)addFrameClient:(NSString *)clientUUID; +- (void)removeFrameClient:(NSString *)clientUUID; +- (void)handleDeadConnection; +@end + +@implementation SyphonServerConnectionManager + ++ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)theKey +{ + BOOL automatic; + if ([theKey isEqualToString:@"hasClients"]) + { + automatic=NO; + } + else + { + automatic=[super automaticallyNotifiesObserversForKey:theKey]; + } + return automatic; +} + ++ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key +{ + if ([key isEqualToString:@"serverDescription"]) + { + return [NSSet setWithObject:@"name"]; + } + else + { + return [super keyPathsForValuesAffectingValueForKey:key]; + } +} + +- (id)init +{ + return [self initWithUUID:nil options:nil]; +} + +- (id)initWithUUID:(NSString *)uuid options:(NSDictionary *)options +{ + if (self = [super init]) + { + SyphonSafeBoolSet(&_hasClients, NO); + _uuid = [uuid copy]; + _infoClients = [[NSMutableDictionary alloc] initWithCapacity:1]; + _frameClients = [[NSMutableDictionary alloc] initWithCapacity:1]; + _queue = dispatch_queue_create([uuid cStringUsingEncoding:NSUTF8StringEncoding], NULL); + } + return self; +} + +- (void)finalize +{ + if (_alive) + { + [NSException raise:@"SyphonServerConnectionManager" format:@"SyphonServerConnectionManager released while running. Call -stop."]; + } + SYPHONLOG(@"Releasing SyphonServerConnectionManager for server \"%@\"", _uuid); + dispatch_release(_queue); + [super finalize]; +} + +- (void)dealloc +{ + if (_alive) + { + [NSException raise:@"SyphonServerConnectionManager" format:@"SyphonServerConnectionManager released while running. Call -stop."]; + } + SYPHONLOG(@"Releasing SyphonServerConnectionManager for server \"%@\"", _uuid); + dispatch_release(_queue); + [_infoClients release]; + [_frameClients release]; + [_uuid release]; + [super dealloc]; +} + +- (void)setName:(NSString *)serverName +{ + // Tell connected clients + dispatch_async(_queue, ^{ + [_infoClients enumerateKeysAndObjectsUsingBlock:^(id key, id client, BOOL *stop) { + [(SyphonMessageSender *)client send:serverName ofType:SyphonMessageTypeUpdateServerName]; + }]; + }); +} + +- (NSDictionary *)surfaceDescription +{ + return [NSDictionary dictionaryWithObject:SyphonSurfaceTypeIOSurface forKey:SyphonSurfaceType]; +} + +- (void)addInfoClient:(NSString *)clientUUID +{ + SYPHONLOG(@"Add info client: %@", clientUUID); + dispatch_async(_queue, ^{ + if (_alive && clientUUID) + { + SyphonMessageSender *sender = [[SyphonMessageSender alloc] initForName:clientUUID protocol:SyphonMessagingProtocolCFMessage invalidationHandler:^(void){ + [self handleDeadConnection]; + }]; + if (sender) + { + NSUInteger countBefore = [_infoClients count]; + if (countBefore == 0) + { + [self willChangeValueForKey:@"hasClients"]; + } + if (_surfaceID != 0) + { + [sender send:[NSNumber numberWithUnsignedInt:_surfaceID] ofType:SyphonMessageTypeUpdateSurfaceID]; + } + [_infoClients setObject:sender forKey:clientUUID]; + [sender release]; + if (countBefore == 0) + { + SyphonSafeBoolSet(&_hasClients, YES); + [self didChangeValueForKey:@"hasClients"]; + } + } + else + { + [self handleDeadConnection]; + } + + } + }); +} + +- (void)removeInfoClient:(NSString *)clientUUID +{ + SYPHONLOG(@"Remove info client: %@", clientUUID); + dispatch_async(_queue, ^{ + if (_alive && clientUUID) + { + if ([_infoClients objectForKey:clientUUID]) + { + NSUInteger countBefore = [_infoClients count]; + if (countBefore == 1) + { + [self willChangeValueForKey:@"hasClients"]; + } + + [_infoClients removeObjectForKey:clientUUID]; + + if (countBefore == 1) + { + SyphonSafeBoolSet(&_hasClients, NO); + [self didChangeValueForKey:@"hasClients"]; + } + } + } + }); +} + +- (void)addFrameClient:(NSString *)clientUUID +{ + dispatch_async(_queue, ^{ + if (_alive && clientUUID) + { + SYPHONLOG(@"Adding frame client: %@", clientUUID); + SyphonMessageSender *sender = [_infoClients objectForKey:clientUUID]; + if (sender == nil) + { + SYPHONLOG(@"No info client when frame client added."); + sender = [[SyphonMessageSender alloc] initForName:clientUUID + protocol:SyphonMessagingProtocolCFMessage + invalidationHandler:^(void){[self handleDeadConnection];}]; + [sender autorelease]; + } + if (sender) + { + [_frameClients setObject:sender forKey:clientUUID]; + } + if (_surfaceID != 0) + { + // If we have a valid surface + // then we must have an existing frame + // so publish it + [sender send:nil ofType:SyphonMessageTypeNewFrame]; + } + } + }); +} + +- (void)removeFrameClient:(NSString *)clientUUID +{ + SYPHONLOG(@"Removing frame client: %@", clientUUID); + dispatch_async(_queue, ^{ + if (_alive && clientUUID) + { + [_frameClients removeObjectForKey:clientUUID]; + } + }); +} + + + +#pragma mark Connection handling +- (BOOL)start +{ + SYPHONLOG(@"Start Connection"); + __block BOOL result; + dispatch_sync(_queue, ^{ + if (!_alive) + { + + _connection = [[SyphonMessageReceiver alloc] initForName:_uuid + protocol:SyphonMessagingProtocolCFMessage + handler:^(id data, uint32_t type) { + switch (type) { + case SyphonMessageTypeAddClientForInfo: + [self addInfoClient:(NSString *)data]; + break; + case SyphonMessageTypeRemoveClientForInfo: + [self removeInfoClient:(NSString *)data]; + break; + case SyphonMessageTypeAddClientForFrames: + [self addFrameClient:(NSString *)data]; + break; + case SyphonMessageTypeRemoveClientForFrames: + [self removeFrameClient:(NSString *)data]; + break; + default: + SYPHONLOG(@"Unknown message type %u received.", type); + break; + } + }]; + + if(_connection == nil) + { + SYPHONLOG(@"Syphon Server: Failed to create connection with UUID, id: %@", _uuid); + _alive = NO; + } + else + { + // otherwise it all worked, so lets publish + SYPHONLOG(@"Created connection with UUID: %@", _uuid); + _alive = YES; + } + } + result = _alive; + }); + return result; +} + +- (void)stop +{ + SYPHONLOG(@"stopping"); + dispatch_sync(_queue, ^{ + if (_alive) + { + // make sure we destroy our connection + NSUInteger clientCount = [_infoClients count]; + if (clientCount != 0) + { + [self willChangeValueForKey:@"hasClients"]; + } + [_infoClients enumerateKeysAndObjectsUsingBlock:^(id key, id client, BOOL *stop) { + [(SyphonMessageSender *)client send:nil ofType:SyphonMessageTypeRetireServer]; + }]; + + [_infoClients removeAllObjects]; + [_frameClients removeAllObjects]; + + [_connection invalidate]; + [_connection release]; + _connection = nil; + + _alive = NO; + if (clientCount != 0) + { + SyphonSafeBoolSet(&_hasClients, NO); + [self didChangeValueForKey:@"hasClients"]; + } + } + }); +} + +- (BOOL)hasClients +{ + return SyphonSafeBoolGet(&_hasClients); +} + +#pragma mark Serving + +- (void)publishNewFrame +{ + dispatch_sync(_queue, ^{ + [_frameClients enumerateKeysAndObjectsUsingBlock:^(id key, id client, BOOL *stop) { + [(SyphonMessageSender *)client send:nil ofType:SyphonMessageTypeNewFrame]; + }]; + }); +} + +- (void)setSurfaceID:(IOSurfaceID)newID +{ + dispatch_sync(_queue, ^{ + _surfaceID = newID; + [_infoClients enumerateKeysAndObjectsUsingBlock:^(id key, id client, BOOL *stop) { + [(SyphonMessageSender *)client send:[NSNumber numberWithUnsignedInt:newID] ofType:SyphonMessageTypeUpdateSurfaceID]; + }]; + }); +} + +#pragma mark Notification Handling for NSConnection + +- (void)handleDeadConnection +{ + dispatch_async(_queue, ^{ + NSMutableArray *inMemorium = [NSMutableArray arrayWithCapacity:1]; + [_infoClients enumerateKeysAndObjectsUsingBlock:^(id key, id client, BOOL *stop) { + if (![client isValid]) + { + [inMemorium addObject:key]; + } + }]; + [inMemorium enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + [self removeInfoClient:obj]; + }]; + [inMemorium removeAllObjects]; + [_frameClients enumerateKeysAndObjectsUsingBlock:^(id key, id client, BOOL *stop) { + if (![client isValid]) + { + [inMemorium addObject:key]; + } + }]; + [inMemorium enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + [self removeFrameClient:obj]; + }]; + }); +} +@end diff --git a/SyphonServerDirectory.h b/SyphonServerDirectory.h new file mode 100644 index 0000000..3466a49 --- /dev/null +++ b/SyphonServerDirectory.h @@ -0,0 +1,131 @@ +/* + SyphonServerDirectory.h + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import + +/*! @name Server Description Dictionary Key Constants */ +/*! @{ */ + +/*! + @relates SyphonServerDirectory + The object for this key is a NSString which uniquely identifies a SyphonServer instance. If two dictionaries contain the same string for this key, they represent the same server. This is provided solely to allow you to programmatically determine the identity of a server, and should never be displayed to users in interface elements. +*/ + +extern NSString * const SyphonServerDescriptionUUIDKey; + +/*! + @relates SyphonServerDirectory + The object for this key is a NSString which is the human-readable non-unique name for the SyphonServer. If this string exists and is non-empty, you should use it in interface elements to identify the server, usually in combination with the name of the server's application (see SyphonServerDescriptionAppNameKey). +*/ + +extern NSString * const SyphonServerDescriptionNameKey; + +/*! + @relates SyphonServerDirectory + The object for this key is a NSString with the localized name of the application in which the SyphonServer is running. Use this in combination with the server's name (if present) to identify the server in interface elements. +*/ + +extern NSString * const SyphonServerDescriptionAppNameKey; + +/*! + @relates SyphonServerDirectory + The object for this key is a NSImage representation of the icon of the application in which the SyphonServer is running. +*/ + +extern NSString * const SyphonServerDescriptionIconKey; + +/*! @} */ + +/*! @name Notifications */ +/*! @{ */ + +/*! + @relates SyphonServerDirectory + A new SyphonServer is available on the system. The notification object is a NSDictionary describing the server. +*/ + +extern NSString * const SyphonServerAnnounceNotification; + +/*! + @relates SyphonServerDirectory + An existing SyphonServer instance has changed its description. The notification object is a NSDictionary describing the server. +*/ + +extern NSString * const SyphonServerUpdateNotification; + +/*! + @relates SyphonServerDirectory + A SyphonServer instance will no longer be available. The notification object is a NSDictionary describing the retiring server. +*/ + +extern NSString * const SyphonServerRetireNotification; + +/*! @} */ + +/*! + @nosubgrouping + SyphonServerDirectory provides information on available Syphon Servers. Servers are represented by dictionaries. Generally you can expect to find some or all of the keys listed in Constants. +*/ + +#define SYPHON_SERVER_DIRECTORY_UNIQUE_CLASS_NAME SYPHON_UNIQUE_CLASS_NAME(SyphonServerDirectory) + +@interface SYPHON_SERVER_DIRECTORY_UNIQUE_CLASS_NAME : NSObject { +@private + NSMutableArray *_servers; + pthread_mutex_t _generalLock; + pthread_mutex_t _mutateLock; +} + +/*! + Returns the shared server directory instance. This object is KVO complaint, and can be used to observe changes in server availability, server names and statuses. + @returns the shared server instance +*/ + ++ (SYPHON_SERVER_DIRECTORY_UNIQUE_CLASS_NAME *)sharedDirectory; + +/*! + NSArray of NSDictionaries that describe (using the keys above) currently available SyphonServer instances on the system. +*/ + +@property (readonly) NSArray *servers; + +/*! + Use this method to discover servers based soley on their name, or application host name. Both parameters are optional. If you do not specify either, all available SyphonServers will be returned. + @param name Optional (pass nil to not specify) Name of the published SyphonServer, matches the key value for SyphonServerDescriptionNameKey + @param appname Optional (pass nil to not specify) Application Name of the published SyphonServer, matches the key value for SyphonServerDescriptionAppNameKey + @returns An array of NSDictionaries matching the query you specified. +*/ + +- (NSArray *)serversMatchingName:(NSString *)name appName:(NSString *)appname; + +@end + +#if defined(SYPHON_USE_CLASS_ALIAS) +@compatibility_alias SyphonServerDirectory SYPHON_SERVER_DIRECTORY_UNIQUE_CLASS_NAME; +#endif diff --git a/SyphonServerDirectory.m b/SyphonServerDirectory.m new file mode 100644 index 0000000..f5283f5 --- /dev/null +++ b/SyphonServerDirectory.m @@ -0,0 +1,333 @@ +/* + SyphonServerDirectory.m + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SyphonServerDirectory.h" +#import "SyphonPrivate.h" +#import + +static SyphonServerDirectory *_sharedDirectory = nil; + +NSString * const SyphonServerAnnounceNotification = @"SyphonServerAnnounceNotification"; +NSString * const SyphonServerUpdateNotification = @"SyphonServerUpdateNotification"; +NSString * const SyphonServerRetireNotification = @"SyphonServerRetireNotification"; + +@interface NSDictionary (SyphonServerDirectoryPimpMyDictionary) +- (NSDictionary *)pimpedVersionForSyphon; +@end + +@interface NSArray (SyphonServerDirectoryServerSearch) +- (NSUInteger)indexOfDescriptionForSyphonServerUUID:(NSString *)uuid; +@end + +@implementation SyphonServerDirectory + ++ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)theKey +{ + BOOL automatic; + if ([theKey isEqualToString:@"servers"]) + { + automatic=NO; + } + else + { + automatic=[super automaticallyNotifiesObserversForKey:theKey]; + } + return automatic; +} + +#pragma mark Singleton Instance ++ (void)load +{ + // cause our instantiation so we always post notifications + [SyphonServerDirectory sharedDirectory]; +} + ++ (SyphonServerDirectory *)sharedDirectory +{ + @synchronized([SyphonServerDirectory class]) { + if (_sharedDirectory == nil) { + [[self alloc] init]; // assignment not done here but in alloc + } + } + return _sharedDirectory; +} + ++ (id)allocWithZone:(NSZone *)zone +{ + @synchronized([SyphonServerDirectory class]) { + if (_sharedDirectory == nil) { + _sharedDirectory = [super allocWithZone:zone]; + return _sharedDirectory; // assignment and return on first allocation + } + } + return nil; //on subsequent allocation attempts return nil +} + +- (id)copyWithZone:(NSZone *)zone +{ + return self; +} + +- (id)retain +{ + return self; +} + +- (NSUInteger)retainCount +{ + return UINT_MAX; //denotes an object that cannot be released +} + +- (void)release +{ + //do nothing +} + +- (id)autorelease +{ + return self; +} + +- (id)init +{ + if (self = [super init]) + { + if (pthread_mutex_init(&_generalLock, NULL) != 0 + || pthread_mutex_init(&_mutateLock, NULL) != 0) + { + [self release]; + return nil; + } + _servers = [[NSMutableArray alloc] initWithCapacity:4]; + [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(handleServerAnnounce:) name:SyphonServerAnnounce object:nil]; + [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(handleServerRetire:) name:SyphonServerRetire object:nil]; + [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(handleServerUpdate:) name:SyphonServerUpdate object:nil]; + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:SyphonServerAnnounceRequest object:nil userInfo:nil]; + + } + return self; +} + +- (void)finalize +{ + [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; + pthread_mutex_destroy(&_generalLock); + pthread_mutex_destroy(&_mutateLock); + [super finalize]; +} + +- (void)dealloc +{ + // This will never get called as long as we're a singleton object, + // but maintain it for completeness, and in case we add dealloc on + // framework unload or something later + [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; + pthread_mutex_destroy(&_generalLock); + pthread_mutex_destroy(&_mutateLock); + [_servers release]; + [super dealloc]; +} + +- (NSArray *)servers +{ + pthread_mutex_lock(&_generalLock); + NSArray *array = [NSArray arrayWithArray:_servers]; + pthread_mutex_unlock(&_generalLock); + return array; +} + +- (NSArray *)serversMatchingName:(NSString *)name appName:(NSString *)appname +{ + if ([name length] == 0) + { + name = nil; + } + if ([appname length] == 0) + { + appname = nil; + } + pthread_mutex_lock(&_generalLock); + NSIndexSet *indexes = [_servers indexesOfObjectsPassingTest:^(id obj, NSUInteger idx, BOOL *stop) { + if ((name == nil || [[obj objectForKey:SyphonServerDescriptionNameKey] isEqualToString:name]) + && (appname == nil || [[obj objectForKey:SyphonServerDescriptionAppNameKey] isEqualToString:appname])) + { + return YES; + } else { + return NO; + } + }]; + NSArray *array = [_servers objectsAtIndexes:indexes]; + pthread_mutex_unlock(&_generalLock); + return array; +} + +#pragma mark Notification Handling + +- (void)handleServerAnnounce:(NSNotification *)aNotification +{ + +// SYPHONLOG(@"new server description: %@", serverInfo); + + NSDictionary* serverInfo = [[aNotification userInfo] pimpedVersionForSyphon]; + NSString *uuid = [serverInfo objectForKey:SyphonServerDescriptionUUIDKey]; + // Lock so nobody mutates for the duration + pthread_mutex_lock(&_mutateLock); + // Lock for access + pthread_mutex_lock(&_generalLock); + NSUInteger index = [_servers indexOfDescriptionForSyphonServerUUID:uuid]; + NSUInteger count = [_servers count]; + // Unlock for access, so others can access in response to the willChange + pthread_mutex_unlock(&_generalLock); + if (index == NSNotFound) + { + NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(count, 1)]; + [self willChange:NSKeyValueChangeInsertion valuesAtIndexes:indexSet forKey:@"servers"]; + // lock for access + pthread_mutex_lock(&_generalLock); + [_servers addObject:serverInfo]; + // unlock for access so others can access in response to the didChange + pthread_mutex_unlock(&_generalLock); + [self didChange:NSKeyValueChangeInsertion valuesAtIndexes:indexSet forKey:@"servers"]; + + [[NSNotificationCenter defaultCenter] postNotificationName:SyphonServerAnnounceNotification object:serverInfo userInfo:nil]; + } + // unlock mutate lock + pthread_mutex_unlock(&_mutateLock); +} + +- (void)handleServerRetire:(NSNotification *)aNotification +{ +// SYPHONLOG(@"retire server description: %@", serverInfo); + + NSDictionary* serverInfo = [[aNotification userInfo] pimpedVersionForSyphon]; + NSString *uuid = [serverInfo objectForKey:SyphonServerDescriptionUUIDKey]; + // Lock so nobody mutates for the duration + pthread_mutex_lock(&_mutateLock); + // lock for access + pthread_mutex_lock(&_generalLock); + NSUInteger index = [_servers indexOfDescriptionForSyphonServerUUID:uuid]; + // unlock for access so others can access in response to willChange + pthread_mutex_unlock(&_generalLock); + if(index != NSNotFound) + { + NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:index]; + [self willChange:NSKeyValueChangeRemoval valuesAtIndexes:indexSet forKey:@"servers"]; + // lock for access + pthread_mutex_lock(&_generalLock); + [_servers removeObjectAtIndex:index]; + // unlock for access so others can access in response to didChange + pthread_mutex_unlock(&_generalLock); + [self didChange:NSKeyValueChangeRemoval valuesAtIndexes:indexSet forKey:@"servers"]; + + [[NSNotificationCenter defaultCenter] postNotificationName:SyphonServerRetireNotification object:serverInfo userInfo:nil]; + } + // unlock mutate lock + pthread_mutex_unlock(&_mutateLock); +} + +- (void)handleServerUpdate:(NSNotification *)aNotification +{ +// SYPHONLOG(@"updated server description: %@", serverInfo); + + NSDictionary* serverInfo = [[aNotification userInfo] pimpedVersionForSyphon]; + NSString *uuid = [serverInfo objectForKey:SyphonServerDescriptionUUIDKey]; + // Lock so nobody mutates for the duration + pthread_mutex_lock(&_mutateLock); + // lock for access + pthread_mutex_lock(&_generalLock); + NSUInteger index = [_servers indexOfDescriptionForSyphonServerUUID:uuid]; + // unlock for access so others can access in response to willChange + pthread_mutex_unlock(&_generalLock); + if(index != NSNotFound) + { + NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:index]; + [self willChange:NSKeyValueChangeReplacement valuesAtIndexes:indexSet forKey:@"servers"]; + // lock for access + pthread_mutex_lock(&_generalLock); + [_servers replaceObjectAtIndex:index withObject:serverInfo]; + // unlock for access so others can access in response to didChange + pthread_mutex_unlock(&_generalLock); + [self didChange:NSKeyValueChangeReplacement valuesAtIndexes:indexSet forKey:@"servers"]; + + [[NSNotificationCenter defaultCenter] postNotificationName:SyphonServerUpdateNotification object:serverInfo userInfo:nil]; + } + pthread_mutex_unlock(&_mutateLock); +} +@end + +@implementation NSDictionary (SyphonServerDirectoryPimpMyDictionary) +/* + + This all seems a bit silly, and it is probably easier and has no performance penalty to pass the NSImage through the notification. + NSImage is NSCoding compliant, so that should work and save us a bit of hassle and this bit of code. + */ + +- (NSDictionary *)pimpedVersionForSyphon +{ + if ([self objectForKey:SyphonServerDescriptionIconKey] == nil) + { + NSString *appName = [self objectForKey:SyphonServerDescriptionAppNameKey]; + NSImage *appImage = nil; + for(NSRunningApplication* app in [[NSWorkspace sharedWorkspace] runningApplications]) + { + if([appName isEqualToString:[app localizedName]]) + { + appImage = [app icon]; + } + } + + if(appImage != nil) + { + NSMutableDictionary *newDictionary = [NSMutableDictionary dictionaryWithDictionary:self]; + [newDictionary setObject:appImage forKey:SyphonServerDescriptionIconKey]; + return newDictionary; + } + } + return self; +} +@end + +@implementation NSArray (SyphonServerDirectoryServerSearch) +/* + + UUID is the only sure identity, as other members of a dictionary may change, unhelpfully yeilding a NO for isEqual + + */ +- (NSUInteger)indexOfDescriptionForSyphonServerUUID:(NSString *)uuid +{ + return [self indexOfObjectPassingTest:^(id obj, NSUInteger idx, BOOL *stop) { + if ([[obj objectForKey:SyphonServerDescriptionUUIDKey] isEqualToString:uuid]) + { + return YES; + } else { + return NO; + } + }]; +} +@end \ No newline at end of file diff --git a/Syphon_Prefix.pch b/Syphon_Prefix.pch new file mode 100644 index 0000000..41b0400 --- /dev/null +++ b/Syphon_Prefix.pch @@ -0,0 +1,45 @@ +/* + Syphon_Prefix.pch + Syphon + + Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#import "SyphonBuildMacros.h" + +#if SYPHON_DEBUG_NO_DRAWING + #define DEBUG 1 +#endif + +#ifdef __OBJC__ + #import + + // logging only enabled if debug is on. + #ifdef DEBUG + #define SYPHONLOG(format, ...) NSLog(@"SYPHON DEBUG: %@: %@", NSStringFromClass([self class]), [NSString stringWithFormat:format, ##__VA_ARGS__]); + #else + #define SYPHONLOG(format, ...) + #endif +#endif diff --git a/doxygen.config b/doxygen.config new file mode 100644 index 0000000..2f75345 --- /dev/null +++ b/doxygen.config @@ -0,0 +1,1656 @@ +# Doxyfile 1.7.2 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = Syphon + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = NO + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = NO + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = NO + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. The create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = DoxygenLayout.xml + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = header.html + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = footer.html + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = doxygen.css + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the stylesheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Syphon" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = info.v002.syphondocs + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = info.v002 + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = v002 + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [0,1..20]) +# that doxygen will group on one line in the generated HTML documentation. +# Note that a value of 0 will completely suppress the enum values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the mathjax.org site, so you can quickly see the result without installing +# MathJax, but it is strongly recommended to install a local copy of MathJax +# before deployment. + +MATHJAX_RELPATH = http://www.mathjax.org/mathjax + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = NO + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans.ttf + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif. +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/doxygen.css b/doxygen.css new file mode 100644 index 0000000..1d22bd0 --- /dev/null +++ b/doxygen.css @@ -0,0 +1,686 @@ +/* The standard CSS for doxygen */ + +body, table, div, p, dl { + font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size: 12px; +} + +/* @group Heading Levels */ + +h1 { + font-size: 150%; +} + +h2 { + font-size: 120%; +} + +h3 { + font-size: 100%; +} + +dt { + font-weight: bold; +} + +div.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; +} + +p.startli, p.startdd, p.starttd { + margin-top: 2px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.navtab{ + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + padding: 2px; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #ffffff; + border: 1px double #869DCA; +} + +.contents a.qindexHL:visited { + color: #ffffff; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code { + color: #4665A2; +} + +a.codeRef { + color: #4665A2; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +.fragment { + font-family: monospace, fixed; + font-size: 105%; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; +} + +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px; + padding: 0.2em; + border: solid thin #333; + border-radius: 0.5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + box-shadow: 2px 2px 3px #999; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 10px; + margin-right: 10px; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memItemLeft, .memItemRight, .memTemplParams { + border-top: 1px solid #C4CFE5; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.memitem { + padding: 0; + margin-bottom: 10px; +} + +.memname { + white-space: nowrap; + font-weight: bold; + margin-left: 6px; +} + +.memproto { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #253555; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 8px; + border-top-left-radius: 8px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 8px; + -moz-border-radius-topleft: 8px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 8px; + -webkit-border-top-left-radius: 8px; + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + +} + +.memdoc { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 2px 5px; + background-color: #FBFCFD; + border-top-width: 0; + /* opera specific markup */ + border-bottom-left-radius: 8px; + border-bottom-right-radius: 8px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 8px; + -moz-border-radius-bottomright: 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7); + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7)); +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} + +.params, .retval, .exception, .tparams { + border-spacing: 6px 2px; +} + +.params .paramname, .retval .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + + + + +/* @end */ + +/* @group Directory (tree) */ + +/* for the tree view */ + +.ftvtree { + font-family: sans-serif; + margin: 0px; +} + +/* these are for tree view when used as main index */ + +.directory { + font-size: 9pt; + font-weight: bold; + margin: 5px; +} + +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +/* +The following two styles can be used to replace the root node title +with an image of your choice. Simply uncomment the next two styles, +specify the name of your image and be sure to set 'height' to the +proper pixel height of your image. +*/ + +/* +.directory h3.swap { + height: 61px; + background-repeat: no-repeat; + background-image: url("yourimage.gif"); +} +.directory h3.swap span { + display: none; +} +*/ + +.directory > h3 { + margin-top: 0; +} + +.directory p { + margin: 0px; + white-space: nowrap; +} + +.directory div { + display: none; + margin: 0px; +} + +.directory img { + vertical-align: -30%; +} + +/* these are for tree view when not used as main index */ + +.directory-alt { + font-size: 100%; + font-weight: bold; +} + +.directory-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +.directory-alt > h3 { + margin-top: 0; +} + +.directory-alt p { + margin: 0px; + white-space: nowrap; +} + +.directory-alt div { + display: none; + margin: 0px; +} + +.directory-alt img { + vertical-align: -30%; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable { + border-collapse:collapse; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; +} + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right: 15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#364D7C; +} + +.navpath a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; +} + +.navpath a:hover +{ + color:#6884BD; +} + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + diff --git a/footer.html b/footer.html new file mode 100644 index 0000000..2d46f7f --- /dev/null +++ b/footer.html @@ -0,0 +1,5 @@ + +http://syphon.v002.info + + + diff --git a/header.html b/header.html new file mode 100644 index 0000000..09f0645 --- /dev/null +++ b/header.html @@ -0,0 +1,11 @@ + + + + +$title + + + + + +